diff --git a/.gitattributes b/.gitattributes
index c7d9f3332a950355d5a77d85000f05e6f45435ea..7f28bbe129ca00ba7d3f5f22e169061b0e943411 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
+generate_human_motion/VQTrans/output/results.gif filter=lfs diff=lfs merge=lfs -text
diff --git a/generate_human_motion/VQTrans/GPT_eval_multi.py b/generate_human_motion/VQTrans/GPT_eval_multi.py
new file mode 100644
index 0000000000000000000000000000000000000000..b5e3ebcb1199e42cf16748e60863b554a0046f00
--- /dev/null
+++ b/generate_human_motion/VQTrans/GPT_eval_multi.py
@@ -0,0 +1,121 @@
+import os
+import torch
+import numpy as np
+from torch.utils.tensorboard import SummaryWriter
+import json
+import clip
+
+import options.option_transformer as option_trans
+import models.vqvae as vqvae
+import utils.utils_model as utils_model
+import utils.eval_trans as eval_trans
+from dataset import dataset_TM_eval
+import models.t2m_trans as trans
+from options.get_eval_option import get_opt
+from models.evaluator_wrapper import EvaluatorModelWrapper
+import warnings
+warnings.filterwarnings('ignore')
+
+##### ---- Exp dirs ---- #####
+args = option_trans.get_args_parser()
+torch.manual_seed(args.seed)
+
+args.out_dir = os.path.join(args.out_dir, f'{args.exp_name}')
+os.makedirs(args.out_dir, exist_ok = True)
+
+##### ---- Logger ---- #####
+logger = utils_model.get_logger(args.out_dir)
+writer = SummaryWriter(args.out_dir)
+logger.info(json.dumps(vars(args), indent=4, sort_keys=True))
+
+from utils.word_vectorizer import WordVectorizer
+w_vectorizer = WordVectorizer('./glove', 'our_vab')
+val_loader = dataset_TM_eval.DATALoader(args.dataname, True, 32, w_vectorizer)
+
+dataset_opt_path = 'checkpoints/kit/Comp_v6_KLD005/opt.txt' if args.dataname == 'kit' else 'checkpoints/t2m/Comp_v6_KLD005/opt.txt'
+
+wrapper_opt = get_opt(dataset_opt_path, torch.device('cuda'))
+eval_wrapper = EvaluatorModelWrapper(wrapper_opt)
+
+##### ---- Network ---- #####
+
+## load clip model and datasets
+clip_model, clip_preprocess = clip.load("ViT-B/32", device=torch.device('cuda'), jit=False, download_root='/apdcephfs_cq2/share_1290939/maelyszhang/.cache/clip') # Must set jit=False for training
+clip.model.convert_weights(clip_model) # Actually this line is unnecessary since clip by default already on float16
+clip_model.eval()
+for p in clip_model.parameters():
+ p.requires_grad = False
+
+net = vqvae.HumanVQVAE(args, ## use args to define different parameters in different quantizers
+ args.nb_code,
+ args.code_dim,
+ args.output_emb_width,
+ args.down_t,
+ args.stride_t,
+ args.width,
+ args.depth,
+ args.dilation_growth_rate)
+
+
+trans_encoder = trans.Text2Motion_Transformer(num_vq=args.nb_code,
+ embed_dim=args.embed_dim_gpt,
+ clip_dim=args.clip_dim,
+ block_size=args.block_size,
+ num_layers=args.num_layers,
+ n_head=args.n_head_gpt,
+ drop_out_rate=args.drop_out_rate,
+ fc_rate=args.ff_rate)
+
+
+print ('loading checkpoint from {}'.format(args.resume_pth))
+ckpt = torch.load(args.resume_pth, map_location='cpu')
+net.load_state_dict(ckpt['net'], strict=True)
+net.eval()
+net.cuda()
+
+if args.resume_trans is not None:
+ print ('loading transformer checkpoint from {}'.format(args.resume_trans))
+ ckpt = torch.load(args.resume_trans, map_location='cpu')
+ trans_encoder.load_state_dict(ckpt['trans'], strict=True)
+trans_encoder.train()
+trans_encoder.cuda()
+
+
+fid = []
+div = []
+top1 = []
+top2 = []
+top3 = []
+matching = []
+multi = []
+repeat_time = 20
+
+
+for i in range(repeat_time):
+ best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, best_multi, writer, logger = eval_trans.evaluation_transformer_test(args.out_dir, val_loader, net, trans_encoder, logger, writer, 0, best_fid=1000, best_iter=0, best_div=100, best_top1=0, best_top2=0, best_top3=0, best_matching=100, best_multi=0, clip_model=clip_model, eval_wrapper=eval_wrapper, draw=False, savegif=False, save=False, savenpy=(i==0))
+ fid.append(best_fid)
+ div.append(best_div)
+ top1.append(best_top1)
+ top2.append(best_top2)
+ top3.append(best_top3)
+ matching.append(best_matching)
+ multi.append(best_multi)
+
+print('final result:')
+print('fid: ', sum(fid)/repeat_time)
+print('div: ', sum(div)/repeat_time)
+print('top1: ', sum(top1)/repeat_time)
+print('top2: ', sum(top2)/repeat_time)
+print('top3: ', sum(top3)/repeat_time)
+print('matching: ', sum(matching)/repeat_time)
+print('multi: ', sum(multi)/repeat_time)
+
+fid = np.array(fid)
+div = np.array(div)
+top1 = np.array(top1)
+top2 = np.array(top2)
+top3 = np.array(top3)
+matching = np.array(matching)
+multi = np.array(multi)
+msg_final = f"FID. {np.mean(fid):.3f}, conf. {np.std(fid)*1.96/np.sqrt(repeat_time):.3f}, Diversity. {np.mean(div):.3f}, conf. {np.std(div)*1.96/np.sqrt(repeat_time):.3f}, TOP1. {np.mean(top1):.3f}, conf. {np.std(top1)*1.96/np.sqrt(repeat_time):.3f}, TOP2. {np.mean(top2):.3f}, conf. {np.std(top2)*1.96/np.sqrt(repeat_time):.3f}, TOP3. {np.mean(top3):.3f}, conf. {np.std(top3)*1.96/np.sqrt(repeat_time):.3f}, Matching. {np.mean(matching):.3f}, conf. {np.std(matching)*1.96/np.sqrt(repeat_time):.3f}, Multi. {np.mean(multi):.3f}, conf. {np.std(multi)*1.96/np.sqrt(repeat_time):.3f}"
+logger.info(msg_final)
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/VQ_eval.py b/generate_human_motion/VQTrans/VQ_eval.py
new file mode 100644
index 0000000000000000000000000000000000000000..f1b7f269e344f730797eba13a45c9672f323b9f5
--- /dev/null
+++ b/generate_human_motion/VQTrans/VQ_eval.py
@@ -0,0 +1,95 @@
+import os
+import json
+
+import torch
+from torch.utils.tensorboard import SummaryWriter
+import numpy as np
+import models.vqvae as vqvae
+import options.option_vq as option_vq
+import utils.utils_model as utils_model
+from dataset import dataset_TM_eval
+import utils.eval_trans as eval_trans
+from options.get_eval_option import get_opt
+from models.evaluator_wrapper import EvaluatorModelWrapper
+import warnings
+warnings.filterwarnings('ignore')
+import numpy as np
+##### ---- Exp dirs ---- #####
+args = option_vq.get_args_parser()
+torch.manual_seed(args.seed)
+
+args.out_dir = os.path.join(args.out_dir, f'{args.exp_name}')
+os.makedirs(args.out_dir, exist_ok = True)
+
+##### ---- Logger ---- #####
+logger = utils_model.get_logger(args.out_dir)
+writer = SummaryWriter(args.out_dir)
+logger.info(json.dumps(vars(args), indent=4, sort_keys=True))
+
+
+from utils.word_vectorizer import WordVectorizer
+w_vectorizer = WordVectorizer('./glove', 'our_vab')
+
+
+dataset_opt_path = 'checkpoints/kit/Comp_v6_KLD005/opt.txt' if args.dataname == 'kit' else 'checkpoints/t2m/Comp_v6_KLD005/opt.txt'
+
+wrapper_opt = get_opt(dataset_opt_path, torch.device('cuda'))
+eval_wrapper = EvaluatorModelWrapper(wrapper_opt)
+
+
+##### ---- Dataloader ---- #####
+args.nb_joints = 21 if args.dataname == 'kit' else 22
+
+val_loader = dataset_TM_eval.DATALoader(args.dataname, True, 32, w_vectorizer, unit_length=2**args.down_t)
+
+##### ---- Network ---- #####
+net = vqvae.HumanVQVAE(args, ## use args to define different parameters in different quantizers
+ args.nb_code,
+ args.code_dim,
+ args.output_emb_width,
+ args.down_t,
+ args.stride_t,
+ args.width,
+ args.depth,
+ args.dilation_growth_rate,
+ args.vq_act,
+ args.vq_norm)
+
+if args.resume_pth :
+ logger.info('loading checkpoint from {}'.format(args.resume_pth))
+ ckpt = torch.load(args.resume_pth, map_location='cpu')
+ net.load_state_dict(ckpt['net'], strict=True)
+net.train()
+net.cuda()
+
+fid = []
+div = []
+top1 = []
+top2 = []
+top3 = []
+matching = []
+repeat_time = 20
+for i in range(repeat_time):
+ best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, writer, logger = eval_trans.evaluation_vqvae(args.out_dir, val_loader, net, logger, writer, 0, best_fid=1000, best_iter=0, best_div=100, best_top1=0, best_top2=0, best_top3=0, best_matching=100, eval_wrapper=eval_wrapper, draw=False, save=False, savenpy=(i==0))
+ fid.append(best_fid)
+ div.append(best_div)
+ top1.append(best_top1)
+ top2.append(best_top2)
+ top3.append(best_top3)
+ matching.append(best_matching)
+print('final result:')
+print('fid: ', sum(fid)/repeat_time)
+print('div: ', sum(div)/repeat_time)
+print('top1: ', sum(top1)/repeat_time)
+print('top2: ', sum(top2)/repeat_time)
+print('top3: ', sum(top3)/repeat_time)
+print('matching: ', sum(matching)/repeat_time)
+
+fid = np.array(fid)
+div = np.array(div)
+top1 = np.array(top1)
+top2 = np.array(top2)
+top3 = np.array(top3)
+matching = np.array(matching)
+msg_final = f"FID. {np.mean(fid):.3f}, conf. {np.std(fid)*1.96/np.sqrt(repeat_time):.3f}, Diversity. {np.mean(div):.3f}, conf. {np.std(div)*1.96/np.sqrt(repeat_time):.3f}, TOP1. {np.mean(top1):.3f}, conf. {np.std(top1)*1.96/np.sqrt(repeat_time):.3f}, TOP2. {np.mean(top2):.3f}, conf. {np.std(top2)*1.96/np.sqrt(repeat_time):.3f}, TOP3. {np.mean(top3):.3f}, conf. {np.std(top3)*1.96/np.sqrt(repeat_time):.3f}, Matching. {np.mean(matching):.3f}, conf. {np.std(matching)*1.96/np.sqrt(repeat_time):.3f}"
+logger.info(msg_final)
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/ViT-B-32.pt b/generate_human_motion/VQTrans/ViT-B-32.pt
new file mode 100644
index 0000000000000000000000000000000000000000..06a4dea8587eb4948a3221b1e1b2e2475e0e203b
--- /dev/null
+++ b/generate_human_motion/VQTrans/ViT-B-32.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:40d365715913c9da98579312b702a82c18be219cc2a73407c4526f58eba950af
+size 353976522
diff --git a/generate_human_motion/VQTrans/__init__.py b/generate_human_motion/VQTrans/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/generate_human_motion/VQTrans/__pycache__/__init__.cpython-310.pyc b/generate_human_motion/VQTrans/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..003d28e9874505699e5fbfd23ae9b8d288ab5da9
Binary files /dev/null and b/generate_human_motion/VQTrans/__pycache__/__init__.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/body_models/smpl/J_regressor_extra.npy b/generate_human_motion/VQTrans/body_models/smpl/J_regressor_extra.npy
new file mode 100644
index 0000000000000000000000000000000000000000..d6cf8c0f6747d3c623a0d300c5176843ae99031d
--- /dev/null
+++ b/generate_human_motion/VQTrans/body_models/smpl/J_regressor_extra.npy
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:cc968ea4f9855571e82f90203280836b01f13ee42a8e1b89d8d580b801242a89
+size 496160
diff --git a/generate_human_motion/VQTrans/body_models/smpl/SMPL_NEUTRAL.pkl b/generate_human_motion/VQTrans/body_models/smpl/SMPL_NEUTRAL.pkl
new file mode 100644
index 0000000000000000000000000000000000000000..26574fd104c4b69467f3c7c3516a8508d8a1a36e
--- /dev/null
+++ b/generate_human_motion/VQTrans/body_models/smpl/SMPL_NEUTRAL.pkl
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:98e65c74ad9b998783132f00880d1025a8d64b158e040e6ef13a557e5098bc42
+size 39001280
diff --git a/generate_human_motion/VQTrans/body_models/smpl/kintree_table.pkl b/generate_human_motion/VQTrans/body_models/smpl/kintree_table.pkl
new file mode 100644
index 0000000000000000000000000000000000000000..3f72aca47e9257f017ab09470ee977a33f41a49e
--- /dev/null
+++ b/generate_human_motion/VQTrans/body_models/smpl/kintree_table.pkl
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:62116ec76c6192ae912557122ea935267ba7188144efb9306ea1366f0e50d4d2
+size 349
diff --git a/generate_human_motion/VQTrans/body_models/smpl/smplfaces.npy b/generate_human_motion/VQTrans/body_models/smpl/smplfaces.npy
new file mode 100644
index 0000000000000000000000000000000000000000..6cadb74c9df2b6deebcdc90ee4f8cf9efbffb11d
--- /dev/null
+++ b/generate_human_motion/VQTrans/body_models/smpl/smplfaces.npy
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7ee8e99db736acf178a6078ab5710ca942edc3738d34c72f41a35c40b370e045
+size 165440
diff --git a/generate_human_motion/VQTrans/checkpoints/kit.zip b/generate_human_motion/VQTrans/checkpoints/kit.zip
new file mode 100644
index 0000000000000000000000000000000000000000..f0ed05d6a11c4a4e8337072287c2ac787793c8a0
--- /dev/null
+++ b/generate_human_motion/VQTrans/checkpoints/kit.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0e9d54e1c68bacad61277f89c7d05f9c88a68fd92ff79f79644128bb9b2508cb
+size 704518254
diff --git a/generate_human_motion/VQTrans/checkpoints/t2m.zip b/generate_human_motion/VQTrans/checkpoints/t2m.zip
new file mode 100644
index 0000000000000000000000000000000000000000..43d6be4f2fb100d8696d2ab9aef463cc2aab7bb5
--- /dev/null
+++ b/generate_human_motion/VQTrans/checkpoints/t2m.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:09e0628dbc585416217617c0583415c8f654ff855703d72fdb713f7061c0863e
+size 1222422692
diff --git a/generate_human_motion/VQTrans/checkpoints/train_vq.py b/generate_human_motion/VQTrans/checkpoints/train_vq.py
new file mode 100644
index 0000000000000000000000000000000000000000..d89b9930ba1262747542df3d5b2f03f8fab1b04a
--- /dev/null
+++ b/generate_human_motion/VQTrans/checkpoints/train_vq.py
@@ -0,0 +1,171 @@
+import os
+import json
+
+import torch
+import torch.optim as optim
+from torch.utils.tensorboard import SummaryWriter
+
+import models.vqvae as vqvae
+import utils.losses as losses
+import options.option_vq as option_vq
+import utils.utils_model as utils_model
+from dataset import dataset_VQ, dataset_TM_eval
+import utils.eval_trans as eval_trans
+from options.get_eval_option import get_opt
+from models.evaluator_wrapper import EvaluatorModelWrapper
+import warnings
+warnings.filterwarnings('ignore')
+from utils.word_vectorizer import WordVectorizer
+
+def update_lr_warm_up(optimizer, nb_iter, warm_up_iter, lr):
+
+ current_lr = lr * (nb_iter + 1) / (warm_up_iter + 1)
+ for param_group in optimizer.param_groups:
+ param_group["lr"] = current_lr
+
+ return optimizer, current_lr
+
+##### ---- Exp dirs ---- #####
+args = option_vq.get_args_parser()
+torch.manual_seed(args.seed)
+
+args.out_dir = os.path.join(args.out_dir, f'{args.exp_name}')
+os.makedirs(args.out_dir, exist_ok = True)
+
+##### ---- Logger ---- #####
+logger = utils_model.get_logger(args.out_dir)
+writer = SummaryWriter(args.out_dir)
+logger.info(json.dumps(vars(args), indent=4, sort_keys=True))
+
+
+
+w_vectorizer = WordVectorizer('./glove', 'our_vab')
+
+if args.dataname == 'kit' :
+ dataset_opt_path = 'checkpoints/kit/Comp_v6_KLD005/opt.txt'
+ args.nb_joints = 21
+
+else :
+ dataset_opt_path = 'checkpoints/t2m/Comp_v6_KLD005/opt.txt'
+ args.nb_joints = 22
+
+logger.info(f'Training on {args.dataname}, motions are with {args.nb_joints} joints')
+
+wrapper_opt = get_opt(dataset_opt_path, torch.device('cuda'))
+eval_wrapper = EvaluatorModelWrapper(wrapper_opt)
+
+
+##### ---- Dataloader ---- #####
+train_loader = dataset_VQ.DATALoader(args.dataname,
+ args.batch_size,
+ window_size=args.window_size,
+ unit_length=2**args.down_t)
+
+train_loader_iter = dataset_VQ.cycle(train_loader)
+
+val_loader = dataset_TM_eval.DATALoader(args.dataname, False,
+ 32,
+ w_vectorizer,
+ unit_length=2**args.down_t)
+
+##### ---- Network ---- #####
+net = vqvae.HumanVQVAE(args, ## use args to define different parameters in different quantizers
+ args.nb_code,
+ args.code_dim,
+ args.output_emb_width,
+ args.down_t,
+ args.stride_t,
+ args.width,
+ args.depth,
+ args.dilation_growth_rate,
+ args.vq_act,
+ args.vq_norm)
+
+
+if args.resume_pth :
+ logger.info('loading checkpoint from {}'.format(args.resume_pth))
+ ckpt = torch.load(args.resume_pth, map_location='cpu')
+ net.load_state_dict(ckpt['net'], strict=True)
+net.train()
+net.cuda()
+
+##### ---- Optimizer & Scheduler ---- #####
+optimizer = optim.AdamW(net.parameters(), lr=args.lr, betas=(0.9, 0.99), weight_decay=args.weight_decay)
+scheduler = torch.optim.lr_scheduler.MultiStepLR(optimizer, milestones=args.lr_scheduler, gamma=args.gamma)
+
+
+Loss = losses.ReConsLoss(args.recons_loss, args.nb_joints)
+
+##### ------ warm-up ------- #####
+avg_recons, avg_perplexity, avg_commit = 0., 0., 0.
+
+for nb_iter in range(1, args.warm_up_iter):
+
+ optimizer, current_lr = update_lr_warm_up(optimizer, nb_iter, args.warm_up_iter, args.lr)
+
+ gt_motion = next(train_loader_iter)
+ gt_motion = gt_motion.cuda().float() # (bs, 64, dim)
+
+ pred_motion, loss_commit, perplexity = net(gt_motion)
+ loss_motion = Loss(pred_motion, gt_motion)
+ loss_vel = Loss.forward_vel(pred_motion, gt_motion)
+
+ loss = loss_motion + args.commit * loss_commit + args.loss_vel * loss_vel
+
+ optimizer.zero_grad()
+ loss.backward()
+ optimizer.step()
+
+ avg_recons += loss_motion.item()
+ avg_perplexity += perplexity.item()
+ avg_commit += loss_commit.item()
+
+ if nb_iter % args.print_iter == 0 :
+ avg_recons /= args.print_iter
+ avg_perplexity /= args.print_iter
+ avg_commit /= args.print_iter
+
+ logger.info(f"Warmup. Iter {nb_iter} : lr {current_lr:.5f} \t Commit. {avg_commit:.5f} \t PPL. {avg_perplexity:.2f} \t Recons. {avg_recons:.5f}")
+
+ avg_recons, avg_perplexity, avg_commit = 0., 0., 0.
+
+##### ---- Training ---- #####
+avg_recons, avg_perplexity, avg_commit = 0., 0., 0.
+best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, writer, logger = eval_trans.evaluation_vqvae(args.out_dir, val_loader, net, logger, writer, 0, best_fid=1000, best_iter=0, best_div=100, best_top1=0, best_top2=0, best_top3=0, best_matching=100, eval_wrapper=eval_wrapper)
+
+for nb_iter in range(1, args.total_iter + 1):
+
+ gt_motion = next(train_loader_iter)
+ gt_motion = gt_motion.cuda().float() # bs, nb_joints, joints_dim, seq_len
+
+ pred_motion, loss_commit, perplexity = net(gt_motion)
+ loss_motion = Loss(pred_motion, gt_motion)
+ loss_vel = Loss.forward_vel(pred_motion, gt_motion)
+
+ loss = loss_motion + args.commit * loss_commit + args.loss_vel * loss_vel
+
+ optimizer.zero_grad()
+ loss.backward()
+ optimizer.step()
+ scheduler.step()
+
+ avg_recons += loss_motion.item()
+ avg_perplexity += perplexity.item()
+ avg_commit += loss_commit.item()
+
+ if nb_iter % args.print_iter == 0 :
+ avg_recons /= args.print_iter
+ avg_perplexity /= args.print_iter
+ avg_commit /= args.print_iter
+
+ writer.add_scalar('./Train/L1', avg_recons, nb_iter)
+ writer.add_scalar('./Train/PPL', avg_perplexity, nb_iter)
+ writer.add_scalar('./Train/Commit', avg_commit, nb_iter)
+
+ logger.info(f"Train. Iter {nb_iter} : \t Commit. {avg_commit:.5f} \t PPL. {avg_perplexity:.2f} \t Recons. {avg_recons:.5f}")
+
+ avg_recons, avg_perplexity, avg_commit = 0., 0., 0.,
+
+ if nb_iter % args.eval_iter==0 :
+ best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, writer, logger = eval_trans.evaluation_vqvae(args.out_dir, val_loader, net, logger, writer, nb_iter, best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, eval_wrapper=eval_wrapper)
+
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/dataset/dataset_TM_eval.py b/generate_human_motion/VQTrans/dataset/dataset_TM_eval.py
new file mode 100644
index 0000000000000000000000000000000000000000..576a53b7dabd8095bed59dcc86199e30f2798838
--- /dev/null
+++ b/generate_human_motion/VQTrans/dataset/dataset_TM_eval.py
@@ -0,0 +1,217 @@
+import torch
+from torch.utils import data
+import numpy as np
+from os.path import join as pjoin
+import random
+import codecs as cs
+from tqdm import tqdm
+
+import utils.paramUtil as paramUtil
+from torch.utils.data._utils.collate import default_collate
+
+
+def collate_fn(batch):
+ batch.sort(key=lambda x: x[3], reverse=True)
+ return default_collate(batch)
+
+
+'''For use of training text-2-motion generative model'''
+class Text2MotionDataset(data.Dataset):
+ def __init__(self, dataset_name, is_test, w_vectorizer, feat_bias = 5, max_text_len = 20, unit_length = 4):
+
+ self.max_length = 20
+ self.pointer = 0
+ self.dataset_name = dataset_name
+ self.is_test = is_test
+ self.max_text_len = max_text_len
+ self.unit_length = unit_length
+ self.w_vectorizer = w_vectorizer
+ if dataset_name == 't2m':
+ self.data_root = './dataset/HumanML3D'
+ self.motion_dir = pjoin(self.data_root, 'new_joint_vecs')
+ self.text_dir = pjoin(self.data_root, 'texts')
+ self.joints_num = 22
+ radius = 4
+ fps = 20
+ self.max_motion_length = 196
+ dim_pose = 263
+ kinematic_chain = paramUtil.t2m_kinematic_chain
+ self.meta_dir = 'checkpoints/t2m/VQVAEV3_CB1024_CMT_H1024_NRES3/meta'
+ elif dataset_name == 'kit':
+ self.data_root = './dataset/KIT-ML'
+ self.motion_dir = pjoin(self.data_root, 'new_joint_vecs')
+ self.text_dir = pjoin(self.data_root, 'texts')
+ self.joints_num = 21
+ radius = 240 * 8
+ fps = 12.5
+ dim_pose = 251
+ self.max_motion_length = 196
+ kinematic_chain = paramUtil.kit_kinematic_chain
+ self.meta_dir = 'checkpoints/kit/VQVAEV3_CB1024_CMT_H1024_NRES3/meta'
+
+ mean = np.load(pjoin(self.meta_dir, 'mean.npy'))
+ std = np.load(pjoin(self.meta_dir, 'std.npy'))
+
+ if is_test:
+ split_file = pjoin(self.data_root, 'test.txt')
+ else:
+ split_file = pjoin(self.data_root, 'val.txt')
+
+ min_motion_len = 40 if self.dataset_name =='t2m' else 24
+ # min_motion_len = 64
+
+ joints_num = self.joints_num
+
+ data_dict = {}
+ id_list = []
+ with cs.open(split_file, 'r') as f:
+ for line in f.readlines():
+ id_list.append(line.strip())
+
+ new_name_list = []
+ length_list = []
+ for name in tqdm(id_list):
+ try:
+ motion = np.load(pjoin(self.motion_dir, name + '.npy'))
+ if (len(motion)) < min_motion_len or (len(motion) >= 200):
+ continue
+ text_data = []
+ flag = False
+ with cs.open(pjoin(self.text_dir, name + '.txt')) as f:
+ for line in f.readlines():
+ text_dict = {}
+ line_split = line.strip().split('#')
+ caption = line_split[0]
+ tokens = line_split[1].split(' ')
+ f_tag = float(line_split[2])
+ to_tag = float(line_split[3])
+ f_tag = 0.0 if np.isnan(f_tag) else f_tag
+ to_tag = 0.0 if np.isnan(to_tag) else to_tag
+
+ text_dict['caption'] = caption
+ text_dict['tokens'] = tokens
+ if f_tag == 0.0 and to_tag == 0.0:
+ flag = True
+ text_data.append(text_dict)
+ else:
+ try:
+ n_motion = motion[int(f_tag*fps) : int(to_tag*fps)]
+ if (len(n_motion)) < min_motion_len or (len(n_motion) >= 200):
+ continue
+ new_name = random.choice('ABCDEFGHIJKLMNOPQRSTUVW') + '_' + name
+ while new_name in data_dict:
+ new_name = random.choice('ABCDEFGHIJKLMNOPQRSTUVW') + '_' + name
+ data_dict[new_name] = {'motion': n_motion,
+ 'length': len(n_motion),
+ 'text':[text_dict]}
+ new_name_list.append(new_name)
+ length_list.append(len(n_motion))
+ except:
+ print(line_split)
+ print(line_split[2], line_split[3], f_tag, to_tag, name)
+ # break
+
+ if flag:
+ data_dict[name] = {'motion': motion,
+ 'length': len(motion),
+ 'text': text_data}
+ new_name_list.append(name)
+ length_list.append(len(motion))
+ except Exception as e:
+ # print(e)
+ pass
+
+ name_list, length_list = zip(*sorted(zip(new_name_list, length_list), key=lambda x: x[1]))
+ self.mean = mean
+ self.std = std
+ self.length_arr = np.array(length_list)
+ self.data_dict = data_dict
+ self.name_list = name_list
+ self.reset_max_len(self.max_length)
+
+ def reset_max_len(self, length):
+ assert length <= self.max_motion_length
+ self.pointer = np.searchsorted(self.length_arr, length)
+ print("Pointer Pointing at %d"%self.pointer)
+ self.max_length = length
+
+ def inv_transform(self, data):
+ return data * self.std + self.mean
+
+ def forward_transform(self, data):
+ return (data - self.mean) / self.std
+
+ def __len__(self):
+ return len(self.data_dict) - self.pointer
+
+ def __getitem__(self, item):
+ idx = self.pointer + item
+ name = self.name_list[idx]
+ data = self.data_dict[name]
+ # data = self.data_dict[self.name_list[idx]]
+ motion, m_length, text_list = data['motion'], data['length'], data['text']
+ # Randomly select a caption
+ text_data = random.choice(text_list)
+ caption, tokens = text_data['caption'], text_data['tokens']
+
+ if len(tokens) < self.max_text_len:
+ # pad with "unk"
+ tokens = ['sos/OTHER'] + tokens + ['eos/OTHER']
+ sent_len = len(tokens)
+ tokens = tokens + ['unk/OTHER'] * (self.max_text_len + 2 - sent_len)
+ else:
+ # crop
+ tokens = tokens[:self.max_text_len]
+ tokens = ['sos/OTHER'] + tokens + ['eos/OTHER']
+ sent_len = len(tokens)
+ pos_one_hots = []
+ word_embeddings = []
+ for token in tokens:
+ word_emb, pos_oh = self.w_vectorizer[token]
+ pos_one_hots.append(pos_oh[None, :])
+ word_embeddings.append(word_emb[None, :])
+ pos_one_hots = np.concatenate(pos_one_hots, axis=0)
+ word_embeddings = np.concatenate(word_embeddings, axis=0)
+
+ if self.unit_length < 10:
+ coin2 = np.random.choice(['single', 'single', 'double'])
+ else:
+ coin2 = 'single'
+
+ if coin2 == 'double':
+ m_length = (m_length // self.unit_length - 1) * self.unit_length
+ elif coin2 == 'single':
+ m_length = (m_length // self.unit_length) * self.unit_length
+ idx = random.randint(0, len(motion) - m_length)
+ motion = motion[idx:idx+m_length]
+
+ "Z Normalization"
+ motion = (motion - self.mean) / self.std
+
+ if m_length < self.max_motion_length:
+ motion = np.concatenate([motion,
+ np.zeros((self.max_motion_length - m_length, motion.shape[1]))
+ ], axis=0)
+
+ return word_embeddings, pos_one_hots, caption, sent_len, motion, m_length, '_'.join(tokens), name
+
+
+
+
+def DATALoader(dataset_name, is_test,
+ batch_size, w_vectorizer,
+ num_workers = 8, unit_length = 4) :
+
+ val_loader = torch.utils.data.DataLoader(Text2MotionDataset(dataset_name, is_test, w_vectorizer, unit_length=unit_length),
+ batch_size,
+ shuffle = True,
+ num_workers=num_workers,
+ collate_fn=collate_fn,
+ drop_last = True)
+ return val_loader
+
+
+def cycle(iterable):
+ while True:
+ for x in iterable:
+ yield x
diff --git a/generate_human_motion/VQTrans/dataset/dataset_TM_train.py b/generate_human_motion/VQTrans/dataset/dataset_TM_train.py
new file mode 100644
index 0000000000000000000000000000000000000000..0b0223effb01c1cf57fa6b2b6fb8d9d01b83f84a
--- /dev/null
+++ b/generate_human_motion/VQTrans/dataset/dataset_TM_train.py
@@ -0,0 +1,161 @@
+import torch
+from torch.utils import data
+import numpy as np
+from os.path import join as pjoin
+import random
+import codecs as cs
+from tqdm import tqdm
+import utils.paramUtil as paramUtil
+from torch.utils.data._utils.collate import default_collate
+
+
+def collate_fn(batch):
+ batch.sort(key=lambda x: x[3], reverse=True)
+ return default_collate(batch)
+
+
+'''For use of training text-2-motion generative model'''
+class Text2MotionDataset(data.Dataset):
+ def __init__(self, dataset_name, feat_bias = 5, unit_length = 4, codebook_size = 1024, tokenizer_name=None):
+
+ self.max_length = 64
+ self.pointer = 0
+ self.dataset_name = dataset_name
+
+ self.unit_length = unit_length
+ # self.mot_start_idx = codebook_size
+ self.mot_end_idx = codebook_size
+ self.mot_pad_idx = codebook_size + 1
+ if dataset_name == 't2m':
+ self.data_root = './dataset/HumanML3D'
+ self.motion_dir = pjoin(self.data_root, 'new_joint_vecs')
+ self.text_dir = pjoin(self.data_root, 'texts')
+ self.joints_num = 22
+ radius = 4
+ fps = 20
+ self.max_motion_length = 26 if unit_length == 8 else 51
+ dim_pose = 263
+ kinematic_chain = paramUtil.t2m_kinematic_chain
+ elif dataset_name == 'kit':
+ self.data_root = './dataset/KIT-ML'
+ self.motion_dir = pjoin(self.data_root, 'new_joint_vecs')
+ self.text_dir = pjoin(self.data_root, 'texts')
+ self.joints_num = 21
+ radius = 240 * 8
+ fps = 12.5
+ dim_pose = 251
+ self.max_motion_length = 26 if unit_length == 8 else 51
+ kinematic_chain = paramUtil.kit_kinematic_chain
+
+ split_file = pjoin(self.data_root, 'train.txt')
+
+
+ id_list = []
+ with cs.open(split_file, 'r') as f:
+ for line in f.readlines():
+ id_list.append(line.strip())
+
+ new_name_list = []
+ data_dict = {}
+ for name in tqdm(id_list):
+ try:
+ m_token_list = np.load(pjoin(self.data_root, tokenizer_name, '%s.npy'%name))
+
+ # Read text
+ with cs.open(pjoin(self.text_dir, name + '.txt')) as f:
+ text_data = []
+ flag = False
+ lines = f.readlines()
+
+ for line in lines:
+ try:
+ text_dict = {}
+ line_split = line.strip().split('#')
+ caption = line_split[0]
+ t_tokens = line_split[1].split(' ')
+ f_tag = float(line_split[2])
+ to_tag = float(line_split[3])
+ f_tag = 0.0 if np.isnan(f_tag) else f_tag
+ to_tag = 0.0 if np.isnan(to_tag) else to_tag
+
+ text_dict['caption'] = caption
+ text_dict['tokens'] = t_tokens
+ if f_tag == 0.0 and to_tag == 0.0:
+ flag = True
+ text_data.append(text_dict)
+ else:
+ m_token_list_new = [tokens[int(f_tag*fps/unit_length) : int(to_tag*fps/unit_length)] for tokens in m_token_list if int(f_tag*fps/unit_length) < int(to_tag*fps/unit_length)]
+
+ if len(m_token_list_new) == 0:
+ continue
+ new_name = '%s_%f_%f'%(name, f_tag, to_tag)
+
+ data_dict[new_name] = {'m_token_list': m_token_list_new,
+ 'text':[text_dict]}
+ new_name_list.append(new_name)
+ except:
+ pass
+
+ if flag:
+ data_dict[name] = {'m_token_list': m_token_list,
+ 'text':text_data}
+ new_name_list.append(name)
+ except:
+ pass
+ self.data_dict = data_dict
+ self.name_list = new_name_list
+
+ def __len__(self):
+ return len(self.data_dict)
+
+ def __getitem__(self, item):
+ data = self.data_dict[self.name_list[item]]
+ m_token_list, text_list = data['m_token_list'], data['text']
+ m_tokens = random.choice(m_token_list)
+
+ text_data = random.choice(text_list)
+ caption= text_data['caption']
+
+
+ coin = np.random.choice([False, False, True])
+ # print(len(m_tokens))
+ if coin:
+ # drop one token at the head or tail
+ coin2 = np.random.choice([True, False])
+ if coin2:
+ m_tokens = m_tokens[:-1]
+ else:
+ m_tokens = m_tokens[1:]
+ m_tokens_len = m_tokens.shape[0]
+
+ if m_tokens_len+1 < self.max_motion_length:
+ m_tokens = np.concatenate([m_tokens, np.ones((1), dtype=int) * self.mot_end_idx, np.ones((self.max_motion_length-1-m_tokens_len), dtype=int) * self.mot_pad_idx], axis=0)
+ else:
+ m_tokens = np.concatenate([m_tokens, np.ones((1), dtype=int) * self.mot_end_idx], axis=0)
+
+ return caption, m_tokens.reshape(-1), m_tokens_len
+
+
+
+
+def DATALoader(dataset_name,
+ batch_size, codebook_size, tokenizer_name, unit_length=4,
+ num_workers = 8) :
+
+ train_loader = torch.utils.data.DataLoader(Text2MotionDataset(dataset_name, codebook_size = codebook_size, tokenizer_name = tokenizer_name, unit_length=unit_length),
+ batch_size,
+ shuffle=True,
+ num_workers=num_workers,
+ #collate_fn=collate_fn,
+ drop_last = True)
+
+
+ return train_loader
+
+
+def cycle(iterable):
+ while True:
+ for x in iterable:
+ yield x
+
+
diff --git a/generate_human_motion/VQTrans/dataset/dataset_VQ.py b/generate_human_motion/VQTrans/dataset/dataset_VQ.py
new file mode 100644
index 0000000000000000000000000000000000000000..2342de946f2cbdf64729a5145168df1bdda54fa0
--- /dev/null
+++ b/generate_human_motion/VQTrans/dataset/dataset_VQ.py
@@ -0,0 +1,109 @@
+import torch
+from torch.utils import data
+import numpy as np
+from os.path import join as pjoin
+import random
+import codecs as cs
+from tqdm import tqdm
+
+
+
+class VQMotionDataset(data.Dataset):
+ def __init__(self, dataset_name, window_size = 64, unit_length = 4):
+ self.window_size = window_size
+ self.unit_length = unit_length
+ self.dataset_name = dataset_name
+
+ if dataset_name == 't2m':
+ self.data_root = './dataset/HumanML3D'
+ self.motion_dir = pjoin(self.data_root, 'new_joint_vecs')
+ self.text_dir = pjoin(self.data_root, 'texts')
+ self.joints_num = 22
+ self.max_motion_length = 196
+ self.meta_dir = 'checkpoints/t2m/VQVAEV3_CB1024_CMT_H1024_NRES3/meta'
+
+ elif dataset_name == 'kit':
+ self.data_root = './dataset/KIT-ML'
+ self.motion_dir = pjoin(self.data_root, 'new_joint_vecs')
+ self.text_dir = pjoin(self.data_root, 'texts')
+ self.joints_num = 21
+
+ self.max_motion_length = 196
+ self.meta_dir = 'checkpoints/kit/VQVAEV3_CB1024_CMT_H1024_NRES3/meta'
+
+ joints_num = self.joints_num
+
+ mean = np.load(pjoin(self.meta_dir, 'mean.npy'))
+ std = np.load(pjoin(self.meta_dir, 'std.npy'))
+
+ split_file = pjoin(self.data_root, 'train.txt')
+
+ self.data = []
+ self.lengths = []
+ id_list = []
+ with cs.open(split_file, 'r') as f:
+ for line in f.readlines():
+ id_list.append(line.strip())
+
+ for name in tqdm(id_list):
+ try:
+ motion = np.load(pjoin(self.motion_dir, name + '.npy'))
+ if motion.shape[0] < self.window_size:
+ continue
+ self.lengths.append(motion.shape[0] - self.window_size)
+ self.data.append(motion)
+ except:
+ # Some motion may not exist in KIT dataset
+ pass
+
+
+ self.mean = mean
+ self.std = std
+ print("Total number of motions {}".format(len(self.data)))
+
+ def inv_transform(self, data):
+ return data * self.std + self.mean
+
+ def compute_sampling_prob(self) :
+
+ prob = np.array(self.lengths, dtype=np.float32)
+ prob /= np.sum(prob)
+ return prob
+
+ def __len__(self):
+ return len(self.data)
+
+ def __getitem__(self, item):
+ motion = self.data[item]
+
+ idx = random.randint(0, len(motion) - self.window_size)
+
+ motion = motion[idx:idx+self.window_size]
+ "Z Normalization"
+ motion = (motion - self.mean) / self.std
+
+ return motion
+
+def DATALoader(dataset_name,
+ batch_size,
+ num_workers = 8,
+ window_size = 64,
+ unit_length = 4):
+
+ trainSet = VQMotionDataset(dataset_name, window_size=window_size, unit_length=unit_length)
+ prob = trainSet.compute_sampling_prob()
+ sampler = torch.utils.data.WeightedRandomSampler(prob, num_samples = len(trainSet) * 1000, replacement=True)
+ train_loader = torch.utils.data.DataLoader(trainSet,
+ batch_size,
+ shuffle=True,
+ #sampler=sampler,
+ num_workers=num_workers,
+ #collate_fn=collate_fn,
+ drop_last = True)
+
+ return train_loader
+
+def cycle(iterable):
+ while True:
+ for x in iterable:
+ yield x
diff --git a/generate_human_motion/VQTrans/dataset/dataset_tokenize.py b/generate_human_motion/VQTrans/dataset/dataset_tokenize.py
new file mode 100644
index 0000000000000000000000000000000000000000..641a02a75f2cfaadea45851cad2a95b39bfa1eae
--- /dev/null
+++ b/generate_human_motion/VQTrans/dataset/dataset_tokenize.py
@@ -0,0 +1,117 @@
+import torch
+from torch.utils import data
+import numpy as np
+from os.path import join as pjoin
+import random
+import codecs as cs
+from tqdm import tqdm
+
+
+
+class VQMotionDataset(data.Dataset):
+ def __init__(self, dataset_name, feat_bias = 5, window_size = 64, unit_length = 8):
+ self.window_size = window_size
+ self.unit_length = unit_length
+ self.feat_bias = feat_bias
+
+ self.dataset_name = dataset_name
+ min_motion_len = 40 if dataset_name =='t2m' else 24
+
+ if dataset_name == 't2m':
+ self.data_root = './dataset/HumanML3D'
+ self.motion_dir = pjoin(self.data_root, 'new_joint_vecs')
+ self.text_dir = pjoin(self.data_root, 'texts')
+ self.joints_num = 22
+ radius = 4
+ fps = 20
+ self.max_motion_length = 196
+ dim_pose = 263
+ self.meta_dir = 'checkpoints/t2m/VQVAEV3_CB1024_CMT_H1024_NRES3/meta'
+ #kinematic_chain = paramUtil.t2m_kinematic_chain
+ elif dataset_name == 'kit':
+ self.data_root = './dataset/KIT-ML'
+ self.motion_dir = pjoin(self.data_root, 'new_joint_vecs')
+ self.text_dir = pjoin(self.data_root, 'texts')
+ self.joints_num = 21
+ radius = 240 * 8
+ fps = 12.5
+ dim_pose = 251
+ self.max_motion_length = 196
+ self.meta_dir = 'checkpoints/kit/VQVAEV3_CB1024_CMT_H1024_NRES3/meta'
+ #kinematic_chain = paramUtil.kit_kinematic_chain
+
+ joints_num = self.joints_num
+
+ mean = np.load(pjoin(self.meta_dir, 'mean.npy'))
+ std = np.load(pjoin(self.meta_dir, 'std.npy'))
+
+ split_file = pjoin(self.data_root, 'train.txt')
+
+ data_dict = {}
+ id_list = []
+ with cs.open(split_file, 'r') as f:
+ for line in f.readlines():
+ id_list.append(line.strip())
+
+ new_name_list = []
+ length_list = []
+ for name in tqdm(id_list):
+ try:
+ motion = np.load(pjoin(self.motion_dir, name + '.npy'))
+ if (len(motion)) < min_motion_len or (len(motion) >= 200):
+ continue
+
+ data_dict[name] = {'motion': motion,
+ 'length': len(motion),
+ 'name': name}
+ new_name_list.append(name)
+ length_list.append(len(motion))
+ except:
+ # Some motion may not exist in KIT dataset
+ pass
+
+
+ self.mean = mean
+ self.std = std
+ self.length_arr = np.array(length_list)
+ self.data_dict = data_dict
+ self.name_list = new_name_list
+
+ def inv_transform(self, data):
+ return data * self.std + self.mean
+
+ def __len__(self):
+ return len(self.data_dict)
+
+ def __getitem__(self, item):
+ name = self.name_list[item]
+ data = self.data_dict[name]
+ motion, m_length = data['motion'], data['length']
+
+ m_length = (m_length // self.unit_length) * self.unit_length
+
+ idx = random.randint(0, len(motion) - m_length)
+ motion = motion[idx:idx+m_length]
+
+ "Z Normalization"
+ motion = (motion - self.mean) / self.std
+
+ return motion, name
+
+def DATALoader(dataset_name,
+ batch_size = 1,
+ num_workers = 8, unit_length = 4) :
+
+ train_loader = torch.utils.data.DataLoader(VQMotionDataset(dataset_name, unit_length=unit_length),
+ batch_size,
+ shuffle=True,
+ num_workers=num_workers,
+ #collate_fn=collate_fn,
+ drop_last = True)
+
+ return train_loader
+
+def cycle(iterable):
+ while True:
+ for x in iterable:
+ yield x
diff --git a/generate_human_motion/VQTrans/dataset/prepare/download_extractor.sh b/generate_human_motion/VQTrans/dataset/prepare/download_extractor.sh
new file mode 100644
index 0000000000000000000000000000000000000000..b1c456e8311a59a1c8d86e85da5ddd3aa7e1f9a4
--- /dev/null
+++ b/generate_human_motion/VQTrans/dataset/prepare/download_extractor.sh
@@ -0,0 +1,15 @@
+rm -rf checkpoints
+mkdir checkpoints
+cd checkpoints
+echo -e "Downloading extractors"
+gdown --fuzzy https://drive.google.com/file/d/1o7RTDQcToJjTm9_mNWTyzvZvjTWpZfug/view
+gdown --fuzzy https://drive.google.com/file/d/1tX79xk0fflp07EZ660Xz1RAFE33iEyJR/view
+
+
+unzip t2m.zip
+unzip kit.zip
+
+echo -e "Cleaning\n"
+rm t2m.zip
+rm kit.zip
+echo -e "Downloading done!"
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/dataset/prepare/download_glove.sh b/generate_human_motion/VQTrans/dataset/prepare/download_glove.sh
new file mode 100644
index 0000000000000000000000000000000000000000..058599aa32c9c97e0e3fc0a9658822e9c904955a
--- /dev/null
+++ b/generate_human_motion/VQTrans/dataset/prepare/download_glove.sh
@@ -0,0 +1,9 @@
+echo -e "Downloading glove (in use by the evaluators)"
+gdown --fuzzy https://drive.google.com/file/d/1bCeS6Sh_mLVTebxIgiUHgdPrroW06mb6/view?usp=sharing
+rm -rf glove
+
+unzip glove.zip
+echo -e "Cleaning\n"
+rm glove.zip
+
+echo -e "Downloading done!"
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/dataset/prepare/download_model.sh b/generate_human_motion/VQTrans/dataset/prepare/download_model.sh
new file mode 100644
index 0000000000000000000000000000000000000000..da32436f6efa93e0c14e1dd52f97068bd75956ab
--- /dev/null
+++ b/generate_human_motion/VQTrans/dataset/prepare/download_model.sh
@@ -0,0 +1,12 @@
+
+mkdir -p pretrained
+cd pretrained/
+
+echo -e "The pretrained model files will be stored in the 'pretrained' folder\n"
+gdown 1LaOvwypF-jM2Axnq5dc-Iuvv3w_G-WDE
+
+unzip VQTrans_pretrained.zip
+echo -e "Cleaning\n"
+rm VQTrans_pretrained.zip
+
+echo -e "Downloading done!"
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/dataset/prepare/download_smpl.sh b/generate_human_motion/VQTrans/dataset/prepare/download_smpl.sh
new file mode 100644
index 0000000000000000000000000000000000000000..411325b509e891d96b859bf28f7b983005ca360a
--- /dev/null
+++ b/generate_human_motion/VQTrans/dataset/prepare/download_smpl.sh
@@ -0,0 +1,13 @@
+
+mkdir -p body_models
+cd body_models/
+
+echo -e "The smpl files will be stored in the 'body_models/smpl/' folder\n"
+gdown 1INYlGA76ak_cKGzvpOV2Pe6RkYTlXTW2
+rm -rf smpl
+
+unzip smpl.zip
+echo -e "Cleaning\n"
+rm smpl.zip
+
+echo -e "Downloading done!"
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/environment.yml b/generate_human_motion/VQTrans/environment.yml
new file mode 100644
index 0000000000000000000000000000000000000000..cb0abb7f5c278d1eaee782c02abb3a46da736f90
--- /dev/null
+++ b/generate_human_motion/VQTrans/environment.yml
@@ -0,0 +1,121 @@
+name: VQTrans
+channels:
+ - pytorch
+ - defaults
+dependencies:
+ - _libgcc_mutex=0.1=main
+ - _openmp_mutex=4.5=1_gnu
+ - blas=1.0=mkl
+ - bzip2=1.0.8=h7b6447c_0
+ - ca-certificates=2021.7.5=h06a4308_1
+ - certifi=2021.5.30=py38h06a4308_0
+ - cudatoolkit=10.1.243=h6bb024c_0
+ - ffmpeg=4.3=hf484d3e_0
+ - freetype=2.10.4=h5ab3b9f_0
+ - gmp=6.2.1=h2531618_2
+ - gnutls=3.6.15=he1e5248_0
+ - intel-openmp=2021.3.0=h06a4308_3350
+ - jpeg=9b=h024ee3a_2
+ - lame=3.100=h7b6447c_0
+ - lcms2=2.12=h3be6417_0
+ - ld_impl_linux-64=2.35.1=h7274673_9
+ - libffi=3.3=he6710b0_2
+ - libgcc-ng=9.3.0=h5101ec6_17
+ - libgomp=9.3.0=h5101ec6_17
+ - libiconv=1.15=h63c8f33_5
+ - libidn2=2.3.2=h7f8727e_0
+ - libpng=1.6.37=hbc83047_0
+ - libstdcxx-ng=9.3.0=hd4cf53a_17
+ - libtasn1=4.16.0=h27cfd23_0
+ - libtiff=4.2.0=h85742a9_0
+ - libunistring=0.9.10=h27cfd23_0
+ - libuv=1.40.0=h7b6447c_0
+ - libwebp-base=1.2.0=h27cfd23_0
+ - lz4-c=1.9.3=h295c915_1
+ - mkl=2021.3.0=h06a4308_520
+ - mkl-service=2.4.0=py38h7f8727e_0
+ - mkl_fft=1.3.0=py38h42c9631_2
+ - mkl_random=1.2.2=py38h51133e4_0
+ - ncurses=6.2=he6710b0_1
+ - nettle=3.7.3=hbbd107a_1
+ - ninja=1.10.2=hff7bd54_1
+ - numpy=1.20.3=py38hf144106_0
+ - numpy-base=1.20.3=py38h74d4b33_0
+ - olefile=0.46=py_0
+ - openh264=2.1.0=hd408876_0
+ - openjpeg=2.3.0=h05c96fa_1
+ - openssl=1.1.1k=h27cfd23_0
+ - pillow=8.3.1=py38h2c7a002_0
+ - pip=21.0.1=py38h06a4308_0
+ - python=3.8.11=h12debd9_0_cpython
+ - pytorch=1.8.1=py3.8_cuda10.1_cudnn7.6.3_0
+ - readline=8.1=h27cfd23_0
+ - setuptools=52.0.0=py38h06a4308_0
+ - six=1.16.0=pyhd3eb1b0_0
+ - sqlite=3.36.0=hc218d9a_0
+ - tk=8.6.10=hbc83047_0
+ - torchaudio=0.8.1=py38
+ - torchvision=0.9.1=py38_cu101
+ - typing_extensions=3.10.0.0=pyh06a4308_0
+ - wheel=0.37.0=pyhd3eb1b0_0
+ - xz=5.2.5=h7b6447c_0
+ - zlib=1.2.11=h7b6447c_3
+ - zstd=1.4.9=haebb681_0
+ - pip:
+ - absl-py==0.13.0
+ - backcall==0.2.0
+ - cachetools==4.2.2
+ - charset-normalizer==2.0.4
+ - chumpy==0.70
+ - cycler==0.10.0
+ - decorator==5.0.9
+ - google-auth==1.35.0
+ - google-auth-oauthlib==0.4.5
+ - grpcio==1.39.0
+ - idna==3.2
+ - imageio==2.9.0
+ - ipdb==0.13.9
+ - ipython==7.26.0
+ - ipython-genutils==0.2.0
+ - jedi==0.18.0
+ - joblib==1.0.1
+ - kiwisolver==1.3.1
+ - markdown==3.3.4
+ - matplotlib==3.4.3
+ - matplotlib-inline==0.1.2
+ - oauthlib==3.1.1
+ - pandas==1.3.2
+ - parso==0.8.2
+ - pexpect==4.8.0
+ - pickleshare==0.7.5
+ - prompt-toolkit==3.0.20
+ - protobuf==3.17.3
+ - ptyprocess==0.7.0
+ - pyasn1==0.4.8
+ - pyasn1-modules==0.2.8
+ - pygments==2.10.0
+ - pyparsing==2.4.7
+ - python-dateutil==2.8.2
+ - pytz==2021.1
+ - pyyaml==5.4.1
+ - requests==2.26.0
+ - requests-oauthlib==1.3.0
+ - rsa==4.7.2
+ - scikit-learn==0.24.2
+ - scipy==1.7.1
+ - sklearn==0.0
+ - smplx==0.1.28
+ - tensorboard==2.6.0
+ - tensorboard-data-server==0.6.1
+ - tensorboard-plugin-wit==1.8.0
+ - threadpoolctl==2.2.0
+ - toml==0.10.2
+ - tqdm==4.62.2
+ - traitlets==5.0.5
+ - urllib3==1.26.6
+ - wcwidth==0.2.5
+ - werkzeug==2.0.1
+ - git+https://github.com/openai/CLIP.git
+ - git+https://github.com/nghorbani/human_body_prior
+ - gdown
+ - moviepy
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/models/__init__.py b/generate_human_motion/VQTrans/models/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/generate_human_motion/VQTrans/models/__pycache__/__init__.cpython-310.pyc b/generate_human_motion/VQTrans/models/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..42d828a64029e31634eec1bd6eff15d043e0c330
Binary files /dev/null and b/generate_human_motion/VQTrans/models/__pycache__/__init__.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/models/__pycache__/encdec.cpython-310.pyc b/generate_human_motion/VQTrans/models/__pycache__/encdec.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f75375efd0bbefb71f4217de393f07d5d295e9b4
Binary files /dev/null and b/generate_human_motion/VQTrans/models/__pycache__/encdec.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/models/__pycache__/pos_encoding.cpython-310.pyc b/generate_human_motion/VQTrans/models/__pycache__/pos_encoding.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..085792f33b9074e5618016afb28ddf5e40486446
Binary files /dev/null and b/generate_human_motion/VQTrans/models/__pycache__/pos_encoding.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/models/__pycache__/quantize_cnn.cpython-310.pyc b/generate_human_motion/VQTrans/models/__pycache__/quantize_cnn.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1e2582dc67bb9ad573c5351dcf6c006023e40f36
Binary files /dev/null and b/generate_human_motion/VQTrans/models/__pycache__/quantize_cnn.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/models/__pycache__/resnet.cpython-310.pyc b/generate_human_motion/VQTrans/models/__pycache__/resnet.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6acd7cfa3a663feb191fecdf5ca742dfc40f4a25
Binary files /dev/null and b/generate_human_motion/VQTrans/models/__pycache__/resnet.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/models/__pycache__/rotation2xyz.cpython-310.pyc b/generate_human_motion/VQTrans/models/__pycache__/rotation2xyz.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6eba892c83168025e51810846f949de715478bdf
Binary files /dev/null and b/generate_human_motion/VQTrans/models/__pycache__/rotation2xyz.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/models/__pycache__/smpl.cpython-310.pyc b/generate_human_motion/VQTrans/models/__pycache__/smpl.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fef49203fac0cc4acc3d579f6c5fa64fa916ab6e
Binary files /dev/null and b/generate_human_motion/VQTrans/models/__pycache__/smpl.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/models/__pycache__/t2m_trans.cpython-310.pyc b/generate_human_motion/VQTrans/models/__pycache__/t2m_trans.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6c28ffcf35fe567b93e081ec1d81a6aa608c0d98
Binary files /dev/null and b/generate_human_motion/VQTrans/models/__pycache__/t2m_trans.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/models/__pycache__/vqvae.cpython-310.pyc b/generate_human_motion/VQTrans/models/__pycache__/vqvae.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5da75d812fbf979520be324b839e71cbc1680b1e
Binary files /dev/null and b/generate_human_motion/VQTrans/models/__pycache__/vqvae.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/models/encdec.py b/generate_human_motion/VQTrans/models/encdec.py
new file mode 100644
index 0000000000000000000000000000000000000000..2a2792b8c71611f4897a54bae860d0eb237c90f3
--- /dev/null
+++ b/generate_human_motion/VQTrans/models/encdec.py
@@ -0,0 +1,67 @@
+import torch.nn as nn
+from resnet import Resnet1D
+
+class Encoder(nn.Module):
+ def __init__(self,
+ input_emb_width = 3,
+ output_emb_width = 512,
+ down_t = 3,
+ stride_t = 2,
+ width = 512,
+ depth = 3,
+ dilation_growth_rate = 3,
+ activation='relu',
+ norm=None):
+ super().__init__()
+
+ blocks = []
+ filter_t, pad_t = stride_t * 2, stride_t // 2
+ blocks.append(nn.Conv1d(input_emb_width, width, 3, 1, 1))
+ blocks.append(nn.ReLU())
+
+ for i in range(down_t):
+ input_dim = width
+ block = nn.Sequential(
+ nn.Conv1d(input_dim, width, filter_t, stride_t, pad_t),
+ Resnet1D(width, depth, dilation_growth_rate, activation=activation, norm=norm),
+ )
+ blocks.append(block)
+ blocks.append(nn.Conv1d(width, output_emb_width, 3, 1, 1))
+ self.model = nn.Sequential(*blocks)
+
+ def forward(self, x):
+ return self.model(x)
+
+class Decoder(nn.Module):
+ def __init__(self,
+ input_emb_width = 3,
+ output_emb_width = 512,
+ down_t = 3,
+ stride_t = 2,
+ width = 512,
+ depth = 3,
+ dilation_growth_rate = 3,
+ activation='relu',
+ norm=None):
+ super().__init__()
+ blocks = []
+
+ filter_t, pad_t = stride_t * 2, stride_t // 2
+ blocks.append(nn.Conv1d(output_emb_width, width, 3, 1, 1))
+ blocks.append(nn.ReLU())
+ for i in range(down_t):
+ out_dim = width
+ block = nn.Sequential(
+ Resnet1D(width, depth, dilation_growth_rate, reverse_dilation=True, activation=activation, norm=norm),
+ nn.Upsample(scale_factor=2, mode='nearest'),
+ nn.Conv1d(width, out_dim, 3, 1, 1)
+ )
+ blocks.append(block)
+ blocks.append(nn.Conv1d(width, width, 3, 1, 1))
+ blocks.append(nn.ReLU())
+ blocks.append(nn.Conv1d(width, input_emb_width, 3, 1, 1))
+ self.model = nn.Sequential(*blocks)
+
+ def forward(self, x):
+ return self.model(x)
+
diff --git a/generate_human_motion/VQTrans/models/evaluator_wrapper.py b/generate_human_motion/VQTrans/models/evaluator_wrapper.py
new file mode 100644
index 0000000000000000000000000000000000000000..fe4558a13ccc2ce0579540b8b77f958096e9984c
--- /dev/null
+++ b/generate_human_motion/VQTrans/models/evaluator_wrapper.py
@@ -0,0 +1,92 @@
+
+import torch
+from os.path import join as pjoin
+import numpy as np
+from models.modules import MovementConvEncoder, TextEncoderBiGRUCo, MotionEncoderBiGRUCo
+from utils.word_vectorizer import POS_enumerator
+
+def build_models(opt):
+ movement_enc = MovementConvEncoder(opt.dim_pose-4, opt.dim_movement_enc_hidden, opt.dim_movement_latent)
+ text_enc = TextEncoderBiGRUCo(word_size=opt.dim_word,
+ pos_size=opt.dim_pos_ohot,
+ hidden_size=opt.dim_text_hidden,
+ output_size=opt.dim_coemb_hidden,
+ device=opt.device)
+
+ motion_enc = MotionEncoderBiGRUCo(input_size=opt.dim_movement_latent,
+ hidden_size=opt.dim_motion_hidden,
+ output_size=opt.dim_coemb_hidden,
+ device=opt.device)
+
+ checkpoint = torch.load(pjoin(opt.checkpoints_dir, opt.dataset_name, 'text_mot_match', 'model', 'finest.tar'),
+ map_location=opt.device)
+ movement_enc.load_state_dict(checkpoint['movement_encoder'])
+ text_enc.load_state_dict(checkpoint['text_encoder'])
+ motion_enc.load_state_dict(checkpoint['motion_encoder'])
+ print('Loading Evaluation Model Wrapper (Epoch %d) Completed!!' % (checkpoint['epoch']))
+ return text_enc, motion_enc, movement_enc
+
+
+class EvaluatorModelWrapper(object):
+
+ def __init__(self, opt):
+
+ if opt.dataset_name == 't2m':
+ opt.dim_pose = 263
+ elif opt.dataset_name == 'kit':
+ opt.dim_pose = 251
+ else:
+ raise KeyError('Dataset not Recognized!!!')
+
+ opt.dim_word = 300
+ opt.max_motion_length = 196
+ opt.dim_pos_ohot = len(POS_enumerator)
+ opt.dim_motion_hidden = 1024
+ opt.max_text_len = 20
+ opt.dim_text_hidden = 512
+ opt.dim_coemb_hidden = 512
+
+ # print(opt)
+
+ self.text_encoder, self.motion_encoder, self.movement_encoder = build_models(opt)
+ self.opt = opt
+ self.device = opt.device
+
+ self.text_encoder.to(opt.device)
+ self.motion_encoder.to(opt.device)
+ self.movement_encoder.to(opt.device)
+
+ self.text_encoder.eval()
+ self.motion_encoder.eval()
+ self.movement_encoder.eval()
+
+ # Please note that the results does not following the order of inputs
+ def get_co_embeddings(self, word_embs, pos_ohot, cap_lens, motions, m_lens):
+ with torch.no_grad():
+ word_embs = word_embs.detach().to(self.device).float()
+ pos_ohot = pos_ohot.detach().to(self.device).float()
+ motions = motions.detach().to(self.device).float()
+
+ '''Movement Encoding'''
+ movements = self.movement_encoder(motions[..., :-4]).detach()
+ m_lens = m_lens // self.opt.unit_length
+ motion_embedding = self.motion_encoder(movements, m_lens)
+
+ '''Text Encoding'''
+ text_embedding = self.text_encoder(word_embs, pos_ohot, cap_lens)
+ return text_embedding, motion_embedding
+
+ # Please note that the results does not following the order of inputs
+ def get_motion_embeddings(self, motions, m_lens):
+ with torch.no_grad():
+ motions = motions.detach().to(self.device).float()
+
+ align_idx = np.argsort(m_lens.data.tolist())[::-1].copy()
+ motions = motions[align_idx]
+ m_lens = m_lens[align_idx]
+
+ '''Movement Encoding'''
+ movements = self.movement_encoder(motions[..., :-4]).detach()
+ m_lens = m_lens // self.opt.unit_length
+ motion_embedding = self.motion_encoder(movements, m_lens)
+ return motion_embedding
diff --git a/generate_human_motion/VQTrans/models/modules.py b/generate_human_motion/VQTrans/models/modules.py
new file mode 100644
index 0000000000000000000000000000000000000000..4f06cd98d4f6029bd3df073095cf50498483d54a
--- /dev/null
+++ b/generate_human_motion/VQTrans/models/modules.py
@@ -0,0 +1,109 @@
+import torch
+import torch.nn as nn
+from torch.nn.utils.rnn import pack_padded_sequence
+
+def init_weight(m):
+ if isinstance(m, nn.Conv1d) or isinstance(m, nn.Linear) or isinstance(m, nn.ConvTranspose1d):
+ nn.init.xavier_normal_(m.weight)
+ # m.bias.data.fill_(0.01)
+ if m.bias is not None:
+ nn.init.constant_(m.bias, 0)
+
+
+class MovementConvEncoder(nn.Module):
+ def __init__(self, input_size, hidden_size, output_size):
+ super(MovementConvEncoder, self).__init__()
+ self.main = nn.Sequential(
+ nn.Conv1d(input_size, hidden_size, 4, 2, 1),
+ nn.Dropout(0.2, inplace=True),
+ nn.LeakyReLU(0.2, inplace=True),
+ nn.Conv1d(hidden_size, output_size, 4, 2, 1),
+ nn.Dropout(0.2, inplace=True),
+ nn.LeakyReLU(0.2, inplace=True),
+ )
+ self.out_net = nn.Linear(output_size, output_size)
+ self.main.apply(init_weight)
+ self.out_net.apply(init_weight)
+
+ def forward(self, inputs):
+ inputs = inputs.permute(0, 2, 1)
+ outputs = self.main(inputs).permute(0, 2, 1)
+ # print(outputs.shape)
+ return self.out_net(outputs)
+
+
+
+class TextEncoderBiGRUCo(nn.Module):
+ def __init__(self, word_size, pos_size, hidden_size, output_size, device):
+ super(TextEncoderBiGRUCo, self).__init__()
+ self.device = device
+
+ self.pos_emb = nn.Linear(pos_size, word_size)
+ self.input_emb = nn.Linear(word_size, hidden_size)
+ self.gru = nn.GRU(hidden_size, hidden_size, batch_first=True, bidirectional=True)
+ self.output_net = nn.Sequential(
+ nn.Linear(hidden_size * 2, hidden_size),
+ nn.LayerNorm(hidden_size),
+ nn.LeakyReLU(0.2, inplace=True),
+ nn.Linear(hidden_size, output_size)
+ )
+
+ self.input_emb.apply(init_weight)
+ self.pos_emb.apply(init_weight)
+ self.output_net.apply(init_weight)
+ self.hidden_size = hidden_size
+ self.hidden = nn.Parameter(torch.randn((2, 1, self.hidden_size), requires_grad=True))
+
+ # input(batch_size, seq_len, dim)
+ def forward(self, word_embs, pos_onehot, cap_lens):
+ num_samples = word_embs.shape[0]
+
+ pos_embs = self.pos_emb(pos_onehot)
+ inputs = word_embs + pos_embs
+ input_embs = self.input_emb(inputs)
+ hidden = self.hidden.repeat(1, num_samples, 1)
+
+ cap_lens = cap_lens.data.tolist()
+ emb = pack_padded_sequence(input_embs, cap_lens, batch_first=True)
+
+ gru_seq, gru_last = self.gru(emb, hidden)
+
+ gru_last = torch.cat([gru_last[0], gru_last[1]], dim=-1)
+
+ return self.output_net(gru_last)
+
+
+class MotionEncoderBiGRUCo(nn.Module):
+ def __init__(self, input_size, hidden_size, output_size, device):
+ super(MotionEncoderBiGRUCo, self).__init__()
+ self.device = device
+
+ self.input_emb = nn.Linear(input_size, hidden_size)
+ self.gru = nn.GRU(hidden_size, hidden_size, batch_first=True, bidirectional=True)
+ self.output_net = nn.Sequential(
+ nn.Linear(hidden_size*2, hidden_size),
+ nn.LayerNorm(hidden_size),
+ nn.LeakyReLU(0.2, inplace=True),
+ nn.Linear(hidden_size, output_size)
+ )
+
+ self.input_emb.apply(init_weight)
+ self.output_net.apply(init_weight)
+ self.hidden_size = hidden_size
+ self.hidden = nn.Parameter(torch.randn((2, 1, self.hidden_size), requires_grad=True))
+
+ # input(batch_size, seq_len, dim)
+ def forward(self, inputs, m_lens):
+ num_samples = inputs.shape[0]
+
+ input_embs = self.input_emb(inputs)
+ hidden = self.hidden.repeat(1, num_samples, 1)
+
+ cap_lens = m_lens.data.tolist()
+ emb = pack_padded_sequence(input_embs, cap_lens, batch_first=True, enforce_sorted=False)
+
+ gru_seq, gru_last = self.gru(emb, hidden)
+
+ gru_last = torch.cat([gru_last[0], gru_last[1]], dim=-1)
+
+ return self.output_net(gru_last)
diff --git a/generate_human_motion/VQTrans/models/pos_encoding.py b/generate_human_motion/VQTrans/models/pos_encoding.py
new file mode 100644
index 0000000000000000000000000000000000000000..066be3e1f8a1636f7eaabd1c534b9c618ee3e9f8
--- /dev/null
+++ b/generate_human_motion/VQTrans/models/pos_encoding.py
@@ -0,0 +1,43 @@
+"""
+Various positional encodings for the transformer.
+"""
+import math
+import torch
+from torch import nn
+
+def PE1d_sincos(seq_length, dim):
+ """
+ :param d_model: dimension of the model
+ :param length: length of positions
+ :return: length*d_model position matrix
+ """
+ if dim % 2 != 0:
+ raise ValueError("Cannot use sin/cos positional encoding with "
+ "odd dim (got dim={:d})".format(dim))
+ pe = torch.zeros(seq_length, dim)
+ position = torch.arange(0, seq_length).unsqueeze(1)
+ div_term = torch.exp((torch.arange(0, dim, 2, dtype=torch.float) *
+ -(math.log(10000.0) / dim)))
+ pe[:, 0::2] = torch.sin(position.float() * div_term)
+ pe[:, 1::2] = torch.cos(position.float() * div_term)
+
+ return pe.unsqueeze(1)
+
+
+class PositionEmbedding(nn.Module):
+ """
+ Absolute pos embedding (standard), learned.
+ """
+ def __init__(self, seq_length, dim, dropout, grad=False):
+ super().__init__()
+ self.embed = nn.Parameter(data=PE1d_sincos(seq_length, dim), requires_grad=grad)
+ self.dropout = nn.Dropout(p=dropout)
+
+ def forward(self, x):
+ # x.shape: bs, seq_len, feat_dim
+ l = x.shape[1]
+ x = x.permute(1, 0, 2) + self.embed[:l].expand(x.permute(1, 0, 2).shape)
+ x = self.dropout(x.permute(1, 0, 2))
+ return x
+
+
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/models/quantize_cnn.py b/generate_human_motion/VQTrans/models/quantize_cnn.py
new file mode 100644
index 0000000000000000000000000000000000000000..b796772749efda9a225bdcb0e7262791a972a710
--- /dev/null
+++ b/generate_human_motion/VQTrans/models/quantize_cnn.py
@@ -0,0 +1,415 @@
+import numpy as np
+import torch
+import torch.nn as nn
+import torch.nn.functional as F
+
+class QuantizeEMAReset(nn.Module):
+ def __init__(self, nb_code, code_dim, args):
+ super().__init__()
+ self.nb_code = nb_code
+ self.code_dim = code_dim
+ self.mu = args.mu
+ self.reset_codebook()
+
+ def reset_codebook(self):
+ self.init = False
+ self.code_sum = None
+ self.code_count = None
+ if torch.cuda.is_available():
+ self.register_buffer('codebook', torch.zeros(self.nb_code, self.code_dim).cuda())
+ else:
+ self.register_buffer('codebook', torch.zeros(self.nb_code, self.code_dim))
+
+ def _tile(self, x):
+ nb_code_x, code_dim = x.shape
+ if nb_code_x < self.nb_code:
+ n_repeats = (self.nb_code + nb_code_x - 1) // nb_code_x
+ std = 0.01 / np.sqrt(code_dim)
+ out = x.repeat(n_repeats, 1)
+ out = out + torch.randn_like(out) * std
+ else :
+ out = x
+ return out
+
+ def init_codebook(self, x):
+ out = self._tile(x)
+ self.codebook = out[:self.nb_code]
+ self.code_sum = self.codebook.clone()
+ self.code_count = torch.ones(self.nb_code, device=self.codebook.device)
+ self.init = True
+
+ @torch.no_grad()
+ def compute_perplexity(self, code_idx) :
+ # Calculate new centres
+ code_onehot = torch.zeros(self.nb_code, code_idx.shape[0], device=code_idx.device) # nb_code, N * L
+ code_onehot.scatter_(0, code_idx.view(1, code_idx.shape[0]), 1)
+
+ code_count = code_onehot.sum(dim=-1) # nb_code
+ prob = code_count / torch.sum(code_count)
+ perplexity = torch.exp(-torch.sum(prob * torch.log(prob + 1e-7)))
+ return perplexity
+
+ @torch.no_grad()
+ def update_codebook(self, x, code_idx):
+
+ code_onehot = torch.zeros(self.nb_code, x.shape[0], device=x.device) # nb_code, N * L
+ code_onehot.scatter_(0, code_idx.view(1, x.shape[0]), 1)
+
+ code_sum = torch.matmul(code_onehot, x) # nb_code, w
+ code_count = code_onehot.sum(dim=-1) # nb_code
+
+ out = self._tile(x)
+ code_rand = out[:self.nb_code]
+
+ # Update centres
+ self.code_sum = self.mu * self.code_sum + (1. - self.mu) * code_sum # w, nb_code
+ self.code_count = self.mu * self.code_count + (1. - self.mu) * code_count # nb_code
+
+ usage = (self.code_count.view(self.nb_code, 1) >= 1.0).float()
+ code_update = self.code_sum.view(self.nb_code, self.code_dim) / self.code_count.view(self.nb_code, 1)
+
+ self.codebook = usage * code_update + (1 - usage) * code_rand
+ prob = code_count / torch.sum(code_count)
+ perplexity = torch.exp(-torch.sum(prob * torch.log(prob + 1e-7)))
+
+
+ return perplexity
+
+ def preprocess(self, x):
+ # NCT -> NTC -> [NT, C]
+ x = x.permute(0, 2, 1).contiguous()
+ x = x.view(-1, x.shape[-1])
+ return x
+
+ def quantize(self, x):
+ # Calculate latent code x_l
+ k_w = self.codebook.t()
+ distance = torch.sum(x ** 2, dim=-1, keepdim=True) - 2 * torch.matmul(x, k_w) + torch.sum(k_w ** 2, dim=0,
+ keepdim=True) # (N * L, b)
+ _, code_idx = torch.min(distance, dim=-1)
+ return code_idx
+
+ def dequantize(self, code_idx):
+ x = F.embedding(code_idx, self.codebook)
+ return x
+
+
+ def forward(self, x):
+ N, width, T = x.shape
+
+ # Preprocess
+ x = self.preprocess(x)
+
+ # Init codebook if not inited
+ if self.training and not self.init:
+ self.init_codebook(x)
+
+ # quantize and dequantize through bottleneck
+ code_idx = self.quantize(x)
+ x_d = self.dequantize(code_idx)
+
+ # Update embeddings
+ if self.training:
+ perplexity = self.update_codebook(x, code_idx)
+ else :
+ perplexity = self.compute_perplexity(code_idx)
+
+ # Loss
+ commit_loss = F.mse_loss(x, x_d.detach())
+
+ # Passthrough
+ x_d = x + (x_d - x).detach()
+
+ # Postprocess
+ x_d = x_d.view(N, T, -1).permute(0, 2, 1).contiguous() #(N, DIM, T)
+
+ return x_d, commit_loss, perplexity
+
+
+
+class Quantizer(nn.Module):
+ def __init__(self, n_e, e_dim, beta):
+ super(Quantizer, self).__init__()
+
+ self.e_dim = e_dim
+ self.n_e = n_e
+ self.beta = beta
+
+ self.embedding = nn.Embedding(self.n_e, self.e_dim)
+ self.embedding.weight.data.uniform_(-1.0 / self.n_e, 1.0 / self.n_e)
+
+ def forward(self, z):
+
+ N, width, T = z.shape
+ z = self.preprocess(z)
+ assert z.shape[-1] == self.e_dim
+ z_flattened = z.contiguous().view(-1, self.e_dim)
+
+ # B x V
+ d = torch.sum(z_flattened ** 2, dim=1, keepdim=True) + \
+ torch.sum(self.embedding.weight**2, dim=1) - 2 * \
+ torch.matmul(z_flattened, self.embedding.weight.t())
+ # B x 1
+ min_encoding_indices = torch.argmin(d, dim=1)
+ z_q = self.embedding(min_encoding_indices).view(z.shape)
+
+ # compute loss for embedding
+ loss = torch.mean((z_q - z.detach())**2) + self.beta * \
+ torch.mean((z_q.detach() - z)**2)
+
+ # preserve gradients
+ z_q = z + (z_q - z).detach()
+ z_q = z_q.view(N, T, -1).permute(0, 2, 1).contiguous() #(N, DIM, T)
+
+ min_encodings = F.one_hot(min_encoding_indices, self.n_e).type(z.dtype)
+ e_mean = torch.mean(min_encodings, dim=0)
+ perplexity = torch.exp(-torch.sum(e_mean*torch.log(e_mean + 1e-10)))
+ return z_q, loss, perplexity
+
+ def quantize(self, z):
+
+ assert z.shape[-1] == self.e_dim
+
+ # B x V
+ d = torch.sum(z ** 2, dim=1, keepdim=True) + \
+ torch.sum(self.embedding.weight ** 2, dim=1) - 2 * \
+ torch.matmul(z, self.embedding.weight.t())
+ # B x 1
+ min_encoding_indices = torch.argmin(d, dim=1)
+ return min_encoding_indices
+
+ def dequantize(self, indices):
+
+ index_flattened = indices.view(-1)
+ z_q = self.embedding(index_flattened)
+ z_q = z_q.view(indices.shape + (self.e_dim, )).contiguous()
+ return z_q
+
+ def preprocess(self, x):
+ # NCT -> NTC -> [NT, C]
+ x = x.permute(0, 2, 1).contiguous()
+ x = x.view(-1, x.shape[-1])
+ return x
+
+
+
+class QuantizeReset(nn.Module):
+ def __init__(self, nb_code, code_dim, args):
+ super().__init__()
+ self.nb_code = nb_code
+ self.code_dim = code_dim
+ self.reset_codebook()
+ self.codebook = nn.Parameter(torch.randn(nb_code, code_dim))
+
+ def reset_codebook(self):
+ self.init = False
+ self.code_count = None
+
+ def _tile(self, x):
+ nb_code_x, code_dim = x.shape
+ if nb_code_x < self.nb_code:
+ n_repeats = (self.nb_code + nb_code_x - 1) // nb_code_x
+ std = 0.01 / np.sqrt(code_dim)
+ out = x.repeat(n_repeats, 1)
+ out = out + torch.randn_like(out) * std
+ else :
+ out = x
+ return out
+
+ def init_codebook(self, x):
+ out = self._tile(x)
+ self.codebook = nn.Parameter(out[:self.nb_code])
+ self.code_count = torch.ones(self.nb_code, device=self.codebook.device)
+ self.init = True
+
+ @torch.no_grad()
+ def compute_perplexity(self, code_idx) :
+ # Calculate new centres
+ code_onehot = torch.zeros(self.nb_code, code_idx.shape[0], device=code_idx.device) # nb_code, N * L
+ code_onehot.scatter_(0, code_idx.view(1, code_idx.shape[0]), 1)
+
+ code_count = code_onehot.sum(dim=-1) # nb_code
+ prob = code_count / torch.sum(code_count)
+ perplexity = torch.exp(-torch.sum(prob * torch.log(prob + 1e-7)))
+ return perplexity
+
+ def update_codebook(self, x, code_idx):
+
+ code_onehot = torch.zeros(self.nb_code, x.shape[0], device=x.device) # nb_code, N * L
+ code_onehot.scatter_(0, code_idx.view(1, x.shape[0]), 1)
+
+ code_count = code_onehot.sum(dim=-1) # nb_code
+
+ out = self._tile(x)
+ code_rand = out[:self.nb_code]
+
+ # Update centres
+ self.code_count = code_count # nb_code
+ usage = (self.code_count.view(self.nb_code, 1) >= 1.0).float()
+
+ self.codebook.data = usage * self.codebook.data + (1 - usage) * code_rand
+ prob = code_count / torch.sum(code_count)
+ perplexity = torch.exp(-torch.sum(prob * torch.log(prob + 1e-7)))
+
+
+ return perplexity
+
+ def preprocess(self, x):
+ # NCT -> NTC -> [NT, C]
+ x = x.permute(0, 2, 1).contiguous()
+ x = x.view(-1, x.shape[-1])
+ return x
+
+ def quantize(self, x):
+ # Calculate latent code x_l
+ k_w = self.codebook.t()
+ distance = torch.sum(x ** 2, dim=-1, keepdim=True) - 2 * torch.matmul(x, k_w) + torch.sum(k_w ** 2, dim=0,
+ keepdim=True) # (N * L, b)
+ _, code_idx = torch.min(distance, dim=-1)
+ return code_idx
+
+ def dequantize(self, code_idx):
+ x = F.embedding(code_idx, self.codebook)
+ return x
+
+
+ def forward(self, x):
+ N, width, T = x.shape
+ # Preprocess
+ x = self.preprocess(x)
+ # Init codebook if not inited
+ if self.training and not self.init:
+ self.init_codebook(x)
+ # quantize and dequantize through bottleneck
+ code_idx = self.quantize(x)
+ x_d = self.dequantize(code_idx)
+ # Update embeddings
+ if self.training:
+ perplexity = self.update_codebook(x, code_idx)
+ else :
+ perplexity = self.compute_perplexity(code_idx)
+
+ # Loss
+ commit_loss = F.mse_loss(x, x_d.detach())
+
+ # Passthrough
+ x_d = x + (x_d - x).detach()
+
+ # Postprocess
+ x_d = x_d.view(N, T, -1).permute(0, 2, 1).contiguous() #(N, DIM, T)
+
+ return x_d, commit_loss, perplexity
+
+class QuantizeEMA(nn.Module):
+ def __init__(self, nb_code, code_dim, args):
+ super().__init__()
+ self.nb_code = nb_code
+ self.code_dim = code_dim
+ self.mu = 0.99
+ self.reset_codebook()
+
+ def reset_codebook(self):
+ self.init = False
+ self.code_sum = None
+ self.code_count = None
+ self.register_buffer('codebook', torch.zeros(self.nb_code, self.code_dim).cuda())
+
+ def _tile(self, x):
+ nb_code_x, code_dim = x.shape
+ if nb_code_x < self.nb_code:
+ n_repeats = (self.nb_code + nb_code_x - 1) // nb_code_x
+ std = 0.01 / np.sqrt(code_dim)
+ out = x.repeat(n_repeats, 1)
+ out = out + torch.randn_like(out) * std
+ else :
+ out = x
+ return out
+
+ def init_codebook(self, x):
+ out = self._tile(x)
+ self.codebook = out[:self.nb_code]
+ self.code_sum = self.codebook.clone()
+ self.code_count = torch.ones(self.nb_code, device=self.codebook.device)
+ self.init = True
+
+ @torch.no_grad()
+ def compute_perplexity(self, code_idx) :
+ # Calculate new centres
+ code_onehot = torch.zeros(self.nb_code, code_idx.shape[0], device=code_idx.device) # nb_code, N * L
+ code_onehot.scatter_(0, code_idx.view(1, code_idx.shape[0]), 1)
+
+ code_count = code_onehot.sum(dim=-1) # nb_code
+ prob = code_count / torch.sum(code_count)
+ perplexity = torch.exp(-torch.sum(prob * torch.log(prob + 1e-7)))
+ return perplexity
+
+ @torch.no_grad()
+ def update_codebook(self, x, code_idx):
+
+ code_onehot = torch.zeros(self.nb_code, x.shape[0], device=x.device) # nb_code, N * L
+ code_onehot.scatter_(0, code_idx.view(1, x.shape[0]), 1)
+
+ code_sum = torch.matmul(code_onehot, x) # nb_code, w
+ code_count = code_onehot.sum(dim=-1) # nb_code
+
+ # Update centres
+ self.code_sum = self.mu * self.code_sum + (1. - self.mu) * code_sum # w, nb_code
+ self.code_count = self.mu * self.code_count + (1. - self.mu) * code_count # nb_code
+
+ code_update = self.code_sum.view(self.nb_code, self.code_dim) / self.code_count.view(self.nb_code, 1)
+
+ self.codebook = code_update
+ prob = code_count / torch.sum(code_count)
+ perplexity = torch.exp(-torch.sum(prob * torch.log(prob + 1e-7)))
+
+ return perplexity
+
+ def preprocess(self, x):
+ # NCT -> NTC -> [NT, C]
+ x = x.permute(0, 2, 1).contiguous()
+ x = x.view(-1, x.shape[-1])
+ return x
+
+ def quantize(self, x):
+ # Calculate latent code x_l
+ k_w = self.codebook.t()
+ distance = torch.sum(x ** 2, dim=-1, keepdim=True) - 2 * torch.matmul(x, k_w) + torch.sum(k_w ** 2, dim=0,
+ keepdim=True) # (N * L, b)
+ _, code_idx = torch.min(distance, dim=-1)
+ return code_idx
+
+ def dequantize(self, code_idx):
+ x = F.embedding(code_idx, self.codebook)
+ return x
+
+
+ def forward(self, x):
+ N, width, T = x.shape
+
+ # Preprocess
+ x = self.preprocess(x)
+
+ # Init codebook if not inited
+ if self.training and not self.init:
+ self.init_codebook(x)
+
+ # quantize and dequantize through bottleneck
+ code_idx = self.quantize(x)
+ x_d = self.dequantize(code_idx)
+
+ # Update embeddings
+ if self.training:
+ perplexity = self.update_codebook(x, code_idx)
+ else :
+ perplexity = self.compute_perplexity(code_idx)
+
+ # Loss
+ commit_loss = F.mse_loss(x, x_d.detach())
+
+ # Passthrough
+ x_d = x + (x_d - x).detach()
+
+ # Postprocess
+ x_d = x_d.view(N, T, -1).permute(0, 2, 1).contiguous() #(N, DIM, T)
+
+ return x_d, commit_loss, perplexity
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/models/resnet.py b/generate_human_motion/VQTrans/models/resnet.py
new file mode 100644
index 0000000000000000000000000000000000000000..062346e3ba2fc4d6ae5636f228c5b7565bdb62b7
--- /dev/null
+++ b/generate_human_motion/VQTrans/models/resnet.py
@@ -0,0 +1,82 @@
+import torch.nn as nn
+import torch
+
+class nonlinearity(nn.Module):
+ def __init__(self):
+ super().__init__()
+
+ def forward(self, x):
+ # swish
+ return x * torch.sigmoid(x)
+
+class ResConv1DBlock(nn.Module):
+ def __init__(self, n_in, n_state, dilation=1, activation='silu', norm=None, dropout=None):
+ super().__init__()
+ padding = dilation
+ self.norm = norm
+ if norm == "LN":
+ self.norm1 = nn.LayerNorm(n_in)
+ self.norm2 = nn.LayerNorm(n_in)
+ elif norm == "GN":
+ self.norm1 = nn.GroupNorm(num_groups=32, num_channels=n_in, eps=1e-6, affine=True)
+ self.norm2 = nn.GroupNorm(num_groups=32, num_channels=n_in, eps=1e-6, affine=True)
+ elif norm == "BN":
+ self.norm1 = nn.BatchNorm1d(num_features=n_in, eps=1e-6, affine=True)
+ self.norm2 = nn.BatchNorm1d(num_features=n_in, eps=1e-6, affine=True)
+
+ else:
+ self.norm1 = nn.Identity()
+ self.norm2 = nn.Identity()
+
+ if activation == "relu":
+ self.activation1 = nn.ReLU()
+ self.activation2 = nn.ReLU()
+
+ elif activation == "silu":
+ self.activation1 = nonlinearity()
+ self.activation2 = nonlinearity()
+
+ elif activation == "gelu":
+ self.activation1 = nn.GELU()
+ self.activation2 = nn.GELU()
+
+
+
+ self.conv1 = nn.Conv1d(n_in, n_state, 3, 1, padding, dilation)
+ self.conv2 = nn.Conv1d(n_state, n_in, 1, 1, 0,)
+
+
+ def forward(self, x):
+ x_orig = x
+ if self.norm == "LN":
+ x = self.norm1(x.transpose(-2, -1))
+ x = self.activation1(x.transpose(-2, -1))
+ else:
+ x = self.norm1(x)
+ x = self.activation1(x)
+
+ x = self.conv1(x)
+
+ if self.norm == "LN":
+ x = self.norm2(x.transpose(-2, -1))
+ x = self.activation2(x.transpose(-2, -1))
+ else:
+ x = self.norm2(x)
+ x = self.activation2(x)
+
+ x = self.conv2(x)
+ x = x + x_orig
+ return x
+
+class Resnet1D(nn.Module):
+ def __init__(self, n_in, n_depth, dilation_growth_rate=1, reverse_dilation=True, activation='relu', norm=None):
+ super().__init__()
+
+ blocks = [ResConv1DBlock(n_in, n_in, dilation=dilation_growth_rate ** depth, activation=activation, norm=norm) for depth in range(n_depth)]
+ if reverse_dilation:
+ blocks = blocks[::-1]
+
+ self.model = nn.Sequential(*blocks)
+
+ def forward(self, x):
+ return self.model(x)
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/models/rotation2xyz.py b/generate_human_motion/VQTrans/models/rotation2xyz.py
new file mode 100644
index 0000000000000000000000000000000000000000..d2c4875e0d4f29917cfbcda84a2df802f25fc7f0
--- /dev/null
+++ b/generate_human_motion/VQTrans/models/rotation2xyz.py
@@ -0,0 +1,92 @@
+# This code is based on https://github.com/Mathux/ACTOR.git
+import torch
+import VQTrans.utils.rotation_conversions as geometry
+
+
+from smpl import SMPL, JOINTSTYPE_ROOT
+# from .get_model import JOINTSTYPES
+JOINTSTYPES = ["a2m", "a2mpl", "smpl", "vibe", "vertices"]
+
+
+class Rotation2xyz:
+ def __init__(self, device, dataset='amass'):
+ self.device = device
+ self.dataset = dataset
+ self.smpl_model = SMPL().eval().to(device)
+
+ def __call__(self, x, mask, pose_rep, translation, glob,
+ jointstype, vertstrans, betas=None, beta=0,
+ glob_rot=None, get_rotations_back=False, **kwargs):
+ if pose_rep == "xyz":
+ return x
+
+ if mask is None:
+ mask = torch.ones((x.shape[0], x.shape[-1]), dtype=bool, device=x.device)
+
+ if not glob and glob_rot is None:
+ raise TypeError("You must specify global rotation if glob is False")
+
+ if jointstype not in JOINTSTYPES:
+ raise NotImplementedError("This jointstype is not implemented.")
+
+ if translation:
+ x_translations = x[:, -1, :3]
+ x_rotations = x[:, :-1]
+ else:
+ x_rotations = x
+
+ x_rotations = x_rotations.permute(0, 3, 1, 2)
+ nsamples, time, njoints, feats = x_rotations.shape
+
+ # Compute rotations (convert only masked sequences output)
+ if pose_rep == "rotvec":
+ rotations = geometry.axis_angle_to_matrix(x_rotations[mask])
+ elif pose_rep == "rotmat":
+ rotations = x_rotations[mask].view(-1, njoints, 3, 3)
+ elif pose_rep == "rotquat":
+ rotations = geometry.quaternion_to_matrix(x_rotations[mask])
+ elif pose_rep == "rot6d":
+ rotations = geometry.rotation_6d_to_matrix(x_rotations[mask])
+ else:
+ raise NotImplementedError("No geometry for this one.")
+
+ if not glob:
+ global_orient = torch.tensor(glob_rot, device=x.device)
+ global_orient = geometry.axis_angle_to_matrix(global_orient).view(1, 1, 3, 3)
+ global_orient = global_orient.repeat(len(rotations), 1, 1, 1)
+ else:
+ global_orient = rotations[:, 0]
+ rotations = rotations[:, 1:]
+
+ if betas is None:
+ betas = torch.zeros([rotations.shape[0], self.smpl_model.num_betas],
+ dtype=rotations.dtype, device=rotations.device)
+ betas[:, 1] = beta
+ # import ipdb; ipdb.set_trace()
+ out = self.smpl_model(body_pose=rotations, global_orient=global_orient, betas=betas)
+
+ # get the desirable joints
+ joints = out[jointstype]
+
+ x_xyz = torch.empty(nsamples, time, joints.shape[1], 3, device=x.device, dtype=x.dtype)
+ x_xyz[~mask] = 0
+ x_xyz[mask] = joints
+
+ x_xyz = x_xyz.permute(0, 2, 3, 1).contiguous()
+
+ # the first translation root at the origin on the prediction
+ if jointstype != "vertices":
+ rootindex = JOINTSTYPE_ROOT[jointstype]
+ x_xyz = x_xyz - x_xyz[:, [rootindex], :, :]
+
+ if translation and vertstrans:
+ # the first translation root at the origin
+ x_translations = x_translations - x_translations[:, :, [0]]
+
+ # add the translation to all the joints
+ x_xyz = x_xyz + x_translations[:, None, :, :]
+
+ if get_rotations_back:
+ return x_xyz, rotations, global_orient
+ else:
+ return x_xyz
diff --git a/generate_human_motion/VQTrans/models/smpl.py b/generate_human_motion/VQTrans/models/smpl.py
new file mode 100644
index 0000000000000000000000000000000000000000..c4229abdcc9fd2cc8c1951005ca842e1ca191fae
--- /dev/null
+++ b/generate_human_motion/VQTrans/models/smpl.py
@@ -0,0 +1,97 @@
+# This code is based on https://github.com/Mathux/ACTOR.git
+import numpy as np
+import torch
+
+import contextlib
+
+from smplx import SMPLLayer as _SMPLLayer
+from smplx.lbs import vertices2joints
+
+
+# action2motion_joints = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 21, 24, 38]
+# change 0 and 8
+action2motion_joints = [8, 1, 2, 3, 4, 5, 6, 7, 0, 9, 10, 11, 12, 13, 14, 21, 24, 38]
+
+from VQTrans.utils.config import SMPL_MODEL_PATH, JOINT_REGRESSOR_TRAIN_EXTRA
+
+JOINTSTYPE_ROOT = {"a2m": 0, # action2motion
+ "smpl": 0,
+ "a2mpl": 0, # set(smpl, a2m)
+ "vibe": 8} # 0 is the 8 position: OP MidHip below
+
+JOINT_MAP = {
+ 'OP Nose': 24, 'OP Neck': 12, 'OP RShoulder': 17,
+ 'OP RElbow': 19, 'OP RWrist': 21, 'OP LShoulder': 16,
+ 'OP LElbow': 18, 'OP LWrist': 20, 'OP MidHip': 0,
+ 'OP RHip': 2, 'OP RKnee': 5, 'OP RAnkle': 8,
+ 'OP LHip': 1, 'OP LKnee': 4, 'OP LAnkle': 7,
+ 'OP REye': 25, 'OP LEye': 26, 'OP REar': 27,
+ 'OP LEar': 28, 'OP LBigToe': 29, 'OP LSmallToe': 30,
+ 'OP LHeel': 31, 'OP RBigToe': 32, 'OP RSmallToe': 33, 'OP RHeel': 34,
+ 'Right Ankle': 8, 'Right Knee': 5, 'Right Hip': 45,
+ 'Left Hip': 46, 'Left Knee': 4, 'Left Ankle': 7,
+ 'Right Wrist': 21, 'Right Elbow': 19, 'Right Shoulder': 17,
+ 'Left Shoulder': 16, 'Left Elbow': 18, 'Left Wrist': 20,
+ 'Neck (LSP)': 47, 'Top of Head (LSP)': 48,
+ 'Pelvis (MPII)': 49, 'Thorax (MPII)': 50,
+ 'Spine (H36M)': 51, 'Jaw (H36M)': 52,
+ 'Head (H36M)': 53, 'Nose': 24, 'Left Eye': 26,
+ 'Right Eye': 25, 'Left Ear': 28, 'Right Ear': 27
+}
+
+JOINT_NAMES = [
+ 'OP Nose', 'OP Neck', 'OP RShoulder',
+ 'OP RElbow', 'OP RWrist', 'OP LShoulder',
+ 'OP LElbow', 'OP LWrist', 'OP MidHip',
+ 'OP RHip', 'OP RKnee', 'OP RAnkle',
+ 'OP LHip', 'OP LKnee', 'OP LAnkle',
+ 'OP REye', 'OP LEye', 'OP REar',
+ 'OP LEar', 'OP LBigToe', 'OP LSmallToe',
+ 'OP LHeel', 'OP RBigToe', 'OP RSmallToe', 'OP RHeel',
+ 'Right Ankle', 'Right Knee', 'Right Hip',
+ 'Left Hip', 'Left Knee', 'Left Ankle',
+ 'Right Wrist', 'Right Elbow', 'Right Shoulder',
+ 'Left Shoulder', 'Left Elbow', 'Left Wrist',
+ 'Neck (LSP)', 'Top of Head (LSP)',
+ 'Pelvis (MPII)', 'Thorax (MPII)',
+ 'Spine (H36M)', 'Jaw (H36M)',
+ 'Head (H36M)', 'Nose', 'Left Eye',
+ 'Right Eye', 'Left Ear', 'Right Ear'
+]
+
+
+# adapted from VIBE/SPIN to output smpl_joints, vibe joints and action2motion joints
+class SMPL(_SMPLLayer):
+ """ Extension of the official SMPL implementation to support more joints """
+
+ def __init__(self, model_path=SMPL_MODEL_PATH, **kwargs):
+ kwargs["model_path"] = model_path
+
+ # remove the verbosity for the 10-shapes beta parameters
+ with contextlib.redirect_stdout(None):
+ super(SMPL, self).__init__(**kwargs)
+
+ J_regressor_extra = np.load(JOINT_REGRESSOR_TRAIN_EXTRA)
+ self.register_buffer('J_regressor_extra', torch.tensor(J_regressor_extra, dtype=torch.float32))
+ vibe_indexes = np.array([JOINT_MAP[i] for i in JOINT_NAMES])
+ a2m_indexes = vibe_indexes[action2motion_joints]
+ smpl_indexes = np.arange(24)
+ a2mpl_indexes = np.unique(np.r_[smpl_indexes, a2m_indexes])
+
+ self.maps = {"vibe": vibe_indexes,
+ "a2m": a2m_indexes,
+ "smpl": smpl_indexes,
+ "a2mpl": a2mpl_indexes}
+
+ def forward(self, *args, **kwargs):
+ smpl_output = super(SMPL, self).forward(*args, **kwargs)
+
+ extra_joints = vertices2joints(self.J_regressor_extra, smpl_output.vertices)
+ all_joints = torch.cat([smpl_output.joints, extra_joints], dim=1)
+
+ output = {"vertices": smpl_output.vertices}
+
+ for joinstype, indexes in self.maps.items():
+ output[joinstype] = all_joints[:, indexes]
+
+ return output
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/models/t2m_trans.py b/generate_human_motion/VQTrans/models/t2m_trans.py
new file mode 100644
index 0000000000000000000000000000000000000000..9ad52331d4c9c0f11d0813990049817a1b0ba67c
--- /dev/null
+++ b/generate_human_motion/VQTrans/models/t2m_trans.py
@@ -0,0 +1,211 @@
+import math
+import torch
+import torch.nn as nn
+from torch.nn import functional as F
+from torch.distributions import Categorical
+import pos_encoding as pos_encoding
+
+class Text2Motion_Transformer(nn.Module):
+
+ def __init__(self,
+ num_vq=1024,
+ embed_dim=512,
+ clip_dim=512,
+ block_size=16,
+ num_layers=2,
+ n_head=8,
+ drop_out_rate=0.1,
+ fc_rate=4):
+ super().__init__()
+ self.trans_base = CrossCondTransBase(num_vq, embed_dim, clip_dim, block_size, num_layers, n_head, drop_out_rate, fc_rate)
+ self.trans_head = CrossCondTransHead(num_vq, embed_dim, block_size, num_layers, n_head, drop_out_rate, fc_rate)
+ self.block_size = block_size
+ self.num_vq = num_vq
+
+ def get_block_size(self):
+ return self.block_size
+
+ def forward(self, idxs, clip_feature):
+ feat = self.trans_base(idxs, clip_feature)
+ logits = self.trans_head(feat)
+ return logits
+
+ def sample(self, clip_feature, if_categorial=False):
+ for k in range(self.block_size):
+ if k == 0:
+ x = []
+ else:
+ x = xs
+ logits = self.forward(x, clip_feature)
+ logits = logits[:, -1, :]
+ probs = F.softmax(logits, dim=-1)
+ if if_categorial:
+ dist = Categorical(probs)
+ idx = dist.sample()
+ if idx == self.num_vq:
+ break
+ idx = idx.unsqueeze(-1)
+ else:
+ _, idx = torch.topk(probs, k=1, dim=-1)
+ if idx[0] == self.num_vq:
+ break
+ # append to the sequence and continue
+ if k == 0:
+ xs = idx
+ else:
+ xs = torch.cat((xs, idx), dim=1)
+
+ if k == self.block_size - 1:
+ return xs[:, :-1]
+ return xs
+
+class CausalCrossConditionalSelfAttention(nn.Module):
+
+ def __init__(self, embed_dim=512, block_size=16, n_head=8, drop_out_rate=0.1):
+ super().__init__()
+ assert embed_dim % 8 == 0
+ # key, query, value projections for all heads
+ self.key = nn.Linear(embed_dim, embed_dim)
+ self.query = nn.Linear(embed_dim, embed_dim)
+ self.value = nn.Linear(embed_dim, embed_dim)
+
+ self.attn_drop = nn.Dropout(drop_out_rate)
+ self.resid_drop = nn.Dropout(drop_out_rate)
+
+ self.proj = nn.Linear(embed_dim, embed_dim)
+ # causal mask to ensure that attention is only applied to the left in the input sequence
+ self.register_buffer("mask", torch.tril(torch.ones(block_size, block_size)).view(1, 1, block_size, block_size))
+ self.n_head = n_head
+
+ def forward(self, x):
+ B, T, C = x.size()
+
+ # calculate query, key, values for all heads in batch and move head forward to be the batch dim
+ k = self.key(x).view(B, T, self.n_head, C // self.n_head).transpose(1, 2) # (B, nh, T, hs)
+ q = self.query(x).view(B, T, self.n_head, C // self.n_head).transpose(1, 2) # (B, nh, T, hs)
+ v = self.value(x).view(B, T, self.n_head, C // self.n_head).transpose(1, 2) # (B, nh, T, hs)
+ # causal self-attention; Self-attend: (B, nh, T, hs) x (B, nh, hs, T) -> (B, nh, T, T)
+ att = (q @ k.transpose(-2, -1)) * (1.0 / math.sqrt(k.size(-1)))
+ att = att.masked_fill(self.mask[:,:,:T,:T] == 0, float('-inf'))
+ att = F.softmax(att, dim=-1)
+ att = self.attn_drop(att)
+ y = att @ v # (B, nh, T, T) x (B, nh, T, hs) -> (B, nh, T, hs)
+ y = y.transpose(1, 2).contiguous().view(B, T, C) # re-assemble all head outputs side by side
+
+ # output projection
+ y = self.resid_drop(self.proj(y))
+ return y
+
+class Block(nn.Module):
+
+ def __init__(self, embed_dim=512, block_size=16, n_head=8, drop_out_rate=0.1, fc_rate=4):
+ super().__init__()
+ self.ln1 = nn.LayerNorm(embed_dim)
+ self.ln2 = nn.LayerNorm(embed_dim)
+ self.attn = CausalCrossConditionalSelfAttention(embed_dim, block_size, n_head, drop_out_rate)
+ self.mlp = nn.Sequential(
+ nn.Linear(embed_dim, fc_rate * embed_dim),
+ nn.GELU(),
+ nn.Linear(fc_rate * embed_dim, embed_dim),
+ nn.Dropout(drop_out_rate),
+ )
+
+ def forward(self, x):
+ x = x + self.attn(self.ln1(x))
+ x = x + self.mlp(self.ln2(x))
+ return x
+
+class CrossCondTransBase(nn.Module):
+
+ def __init__(self,
+ num_vq=1024,
+ embed_dim=512,
+ clip_dim=512,
+ block_size=16,
+ num_layers=2,
+ n_head=8,
+ drop_out_rate=0.1,
+ fc_rate=4):
+ super().__init__()
+ self.tok_emb = nn.Embedding(num_vq + 2, embed_dim)
+ self.cond_emb = nn.Linear(clip_dim, embed_dim)
+ self.pos_embedding = nn.Embedding(block_size, embed_dim)
+ self.drop = nn.Dropout(drop_out_rate)
+ # transformer block
+ self.blocks = nn.Sequential(*[Block(embed_dim, block_size, n_head, drop_out_rate, fc_rate) for _ in range(num_layers)])
+ self.pos_embed = pos_encoding.PositionEmbedding(block_size, embed_dim, 0.0, False)
+
+ self.block_size = block_size
+
+ self.apply(self._init_weights)
+
+ def get_block_size(self):
+ return self.block_size
+
+ def _init_weights(self, module):
+ if isinstance(module, (nn.Linear, nn.Embedding)):
+ module.weight.data.normal_(mean=0.0, std=0.02)
+ if isinstance(module, nn.Linear) and module.bias is not None:
+ module.bias.data.zero_()
+ elif isinstance(module, nn.LayerNorm):
+ module.bias.data.zero_()
+ module.weight.data.fill_(1.0)
+
+ def forward(self, idx, clip_feature):
+ if len(idx) == 0:
+ token_embeddings = self.cond_emb(clip_feature).unsqueeze(1)
+ else:
+ b, t = idx.size()
+ assert t <= self.block_size, "Cannot forward, model block size is exhausted."
+ # forward the Trans model
+ token_embeddings = self.tok_emb(idx)
+ token_embeddings = torch.cat([self.cond_emb(clip_feature).unsqueeze(1), token_embeddings], dim=1)
+
+ x = self.pos_embed(token_embeddings)
+ x = self.blocks(x)
+
+ return x
+
+
+class CrossCondTransHead(nn.Module):
+
+ def __init__(self,
+ num_vq=1024,
+ embed_dim=512,
+ block_size=16,
+ num_layers=2,
+ n_head=8,
+ drop_out_rate=0.1,
+ fc_rate=4):
+ super().__init__()
+
+ self.blocks = nn.Sequential(*[Block(embed_dim, block_size, n_head, drop_out_rate, fc_rate) for _ in range(num_layers)])
+ self.ln_f = nn.LayerNorm(embed_dim)
+ self.head = nn.Linear(embed_dim, num_vq + 1, bias=False)
+ self.block_size = block_size
+
+ self.apply(self._init_weights)
+
+ def get_block_size(self):
+ return self.block_size
+
+ def _init_weights(self, module):
+ if isinstance(module, (nn.Linear, nn.Embedding)):
+ module.weight.data.normal_(mean=0.0, std=0.02)
+ if isinstance(module, nn.Linear) and module.bias is not None:
+ module.bias.data.zero_()
+ elif isinstance(module, nn.LayerNorm):
+ module.bias.data.zero_()
+ module.weight.data.fill_(1.0)
+
+ def forward(self, x):
+ x = self.blocks(x)
+ x = self.ln_f(x)
+ logits = self.head(x)
+ return logits
+
+
+
+
+
+
diff --git a/generate_human_motion/VQTrans/models/vqvae.py b/generate_human_motion/VQTrans/models/vqvae.py
new file mode 100644
index 0000000000000000000000000000000000000000..4598f3f748d6778f72426320616a59672d33f05a
--- /dev/null
+++ b/generate_human_motion/VQTrans/models/vqvae.py
@@ -0,0 +1,118 @@
+import torch.nn as nn
+from encdec import Encoder, Decoder
+from quantize_cnn import QuantizeEMAReset, Quantizer, QuantizeEMA, QuantizeReset
+
+
+class VQVAE_251(nn.Module):
+ def __init__(self,
+ args,
+ nb_code=1024,
+ code_dim=512,
+ output_emb_width=512,
+ down_t=3,
+ stride_t=2,
+ width=512,
+ depth=3,
+ dilation_growth_rate=3,
+ activation='relu',
+ norm=None):
+
+ super().__init__()
+ self.code_dim = code_dim
+ self.num_code = nb_code
+ self.quant = args.quantizer
+ self.encoder = Encoder(251 if args.dataname == 'kit' else 263, output_emb_width, down_t, stride_t, width, depth, dilation_growth_rate, activation=activation, norm=norm)
+ self.decoder = Decoder(251 if args.dataname == 'kit' else 263, output_emb_width, down_t, stride_t, width, depth, dilation_growth_rate, activation=activation, norm=norm)
+ if args.quantizer == "ema_reset":
+ self.quantizer = QuantizeEMAReset(nb_code, code_dim, args)
+ elif args.quantizer == "orig":
+ self.quantizer = Quantizer(nb_code, code_dim, 1.0)
+ elif args.quantizer == "ema":
+ self.quantizer = QuantizeEMA(nb_code, code_dim, args)
+ elif args.quantizer == "reset":
+ self.quantizer = QuantizeReset(nb_code, code_dim, args)
+
+
+ def preprocess(self, x):
+ # (bs, T, Jx3) -> (bs, Jx3, T)
+ x = x.permute(0,2,1).float()
+ return x
+
+
+ def postprocess(self, x):
+ # (bs, Jx3, T) -> (bs, T, Jx3)
+ x = x.permute(0,2,1)
+ return x
+
+
+ def encode(self, x):
+ N, T, _ = x.shape
+ x_in = self.preprocess(x)
+ x_encoder = self.encoder(x_in)
+ x_encoder = self.postprocess(x_encoder)
+ x_encoder = x_encoder.contiguous().view(-1, x_encoder.shape[-1]) # (NT, C)
+ code_idx = self.quantizer.quantize(x_encoder)
+ code_idx = code_idx.view(N, -1)
+ return code_idx
+
+
+ def forward(self, x):
+
+ x_in = self.preprocess(x)
+ # Encode
+ x_encoder = self.encoder(x_in)
+
+ ## quantization
+ x_quantized, loss, perplexity = self.quantizer(x_encoder)
+
+ ## decoder
+ x_decoder = self.decoder(x_quantized)
+ x_out = self.postprocess(x_decoder)
+ return x_out, loss, perplexity
+
+
+ def forward_decoder(self, x):
+ x_d = self.quantizer.dequantize(x)
+ x_d = x_d.view(1, -1, self.code_dim).permute(0, 2, 1).contiguous()
+
+ # decoder
+ x_decoder = self.decoder(x_d)
+ x_out = self.postprocess(x_decoder)
+ return x_out
+
+
+
+class HumanVQVAE(nn.Module):
+ def __init__(self,
+ args,
+ nb_code=512,
+ code_dim=512,
+ output_emb_width=512,
+ down_t=3,
+ stride_t=2,
+ width=512,
+ depth=3,
+ dilation_growth_rate=3,
+ activation='relu',
+ norm=None):
+
+ super().__init__()
+
+ self.nb_joints = 21 if args.dataname == 'kit' else 22
+ self.vqvae = VQVAE_251(args, nb_code, code_dim, output_emb_width, down_t, stride_t, width, depth, dilation_growth_rate, activation=activation, norm=norm)
+
+ def encode(self, x):
+ b, t, c = x.size()
+ quants = self.vqvae.encode(x) # (N, T)
+ return quants
+
+ def forward(self, x):
+
+ x_out, loss, perplexity = self.vqvae(x)
+
+ return x_out, loss, perplexity
+
+ def forward_decoder(self, x):
+ x_out = self.vqvae.forward_decoder(x)
+ return x_out
+
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/options/__pycache__/option_transformer.cpython-310.pyc b/generate_human_motion/VQTrans/options/__pycache__/option_transformer.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2821738b84dc049f19703982304b8f14fed3ff2b
Binary files /dev/null and b/generate_human_motion/VQTrans/options/__pycache__/option_transformer.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/options/get_eval_option.py b/generate_human_motion/VQTrans/options/get_eval_option.py
new file mode 100644
index 0000000000000000000000000000000000000000..d0989ba1a8116068753ada2cb1806744e4512447
--- /dev/null
+++ b/generate_human_motion/VQTrans/options/get_eval_option.py
@@ -0,0 +1,83 @@
+from argparse import Namespace
+import re
+from os.path import join as pjoin
+
+
+def is_float(numStr):
+ flag = False
+ numStr = str(numStr).strip().lstrip('-').lstrip('+')
+ try:
+ reg = re.compile(r'^[-+]?[0-9]+\.[0-9]+$')
+ res = reg.match(str(numStr))
+ if res:
+ flag = True
+ except Exception as ex:
+ print("is_float() - error: " + str(ex))
+ return flag
+
+
+def is_number(numStr):
+ flag = False
+ numStr = str(numStr).strip().lstrip('-').lstrip('+')
+ if str(numStr).isdigit():
+ flag = True
+ return flag
+
+
+def get_opt(opt_path, device):
+ opt = Namespace()
+ opt_dict = vars(opt)
+
+ skip = ('-------------- End ----------------',
+ '------------ Options -------------',
+ '\n')
+ print('Reading', opt_path)
+ with open(opt_path) as f:
+ for line in f:
+ if line.strip() not in skip:
+ # print(line.strip())
+ key, value = line.strip().split(': ')
+ if value in ('True', 'False'):
+ opt_dict[key] = (value == 'True')
+ # print(key, value)
+ elif is_float(value):
+ opt_dict[key] = float(value)
+ elif is_number(value):
+ opt_dict[key] = int(value)
+ else:
+ opt_dict[key] = str(value)
+
+ # print(opt)
+ opt_dict['which_epoch'] = 'finest'
+ opt.save_root = pjoin(opt.checkpoints_dir, opt.dataset_name, opt.name)
+ opt.model_dir = pjoin(opt.save_root, 'model')
+ opt.meta_dir = pjoin(opt.save_root, 'meta')
+
+ if opt.dataset_name == 't2m':
+ opt.data_root = './dataset/HumanML3D/'
+ opt.motion_dir = pjoin(opt.data_root, 'new_joint_vecs')
+ opt.text_dir = pjoin(opt.data_root, 'texts')
+ opt.joints_num = 22
+ opt.dim_pose = 263
+ opt.max_motion_length = 196
+ opt.max_motion_frame = 196
+ opt.max_motion_token = 55
+ elif opt.dataset_name == 'kit':
+ opt.data_root = './dataset/KIT-ML/'
+ opt.motion_dir = pjoin(opt.data_root, 'new_joint_vecs')
+ opt.text_dir = pjoin(opt.data_root, 'texts')
+ opt.joints_num = 21
+ opt.dim_pose = 251
+ opt.max_motion_length = 196
+ opt.max_motion_frame = 196
+ opt.max_motion_token = 55
+ else:
+ raise KeyError('Dataset not recognized')
+
+ opt.dim_word = 300
+ opt.num_classes = 200 // opt.unit_length
+ opt.is_train = False
+ opt.is_continue = False
+ opt.device = device
+
+ return opt
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/options/option_transformer.py b/generate_human_motion/VQTrans/options/option_transformer.py
new file mode 100644
index 0000000000000000000000000000000000000000..cf48ce1fdac663ec44419d67721ac268806f8127
--- /dev/null
+++ b/generate_human_motion/VQTrans/options/option_transformer.py
@@ -0,0 +1,68 @@
+import argparse
+
+def get_args_parser():
+ parser = argparse.ArgumentParser(description='Optimal Transport AutoEncoder training for Amass',
+ add_help=True,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter)
+
+ ## dataloader
+
+ parser.add_argument('--dataname', type=str, default='kit', help='dataset directory')
+ parser.add_argument('--batch-size', default=128, type=int, help='batch size')
+ parser.add_argument('--fps', default=[20], nargs="+", type=int, help='frames per second')
+ parser.add_argument('--seq-len', type=int, default=64, help='training motion length')
+
+ ## optimization
+ parser.add_argument('--total-iter', default=100000, type=int, help='number of total iterations to run')
+ parser.add_argument('--warm-up-iter', default=1000, type=int, help='number of total iterations for warmup')
+ parser.add_argument('--lr', default=2e-4, type=float, help='max learning rate')
+ parser.add_argument('--lr-scheduler', default=[60000], nargs="+", type=int, help="learning rate schedule (iterations)")
+ parser.add_argument('--gamma', default=0.05, type=float, help="learning rate decay")
+
+ parser.add_argument('--weight-decay', default=1e-6, type=float, help='weight decay')
+ parser.add_argument('--decay-option',default='all', type=str, choices=['all', 'noVQ'], help='disable weight decay on codebook')
+ parser.add_argument('--optimizer',default='adamw', type=str, choices=['adam', 'adamw'], help='disable weight decay on codebook')
+
+ ## vqvae arch
+ parser.add_argument("--code-dim", type=int, default=512, help="embedding dimension")
+ parser.add_argument("--nb-code", type=int, default=512, help="nb of embedding")
+ parser.add_argument("--mu", type=float, default=0.99, help="exponential moving average to update the codebook")
+ parser.add_argument("--down-t", type=int, default=3, help="downsampling rate")
+ parser.add_argument("--stride-t", type=int, default=2, help="stride size")
+ parser.add_argument("--width", type=int, default=512, help="width of the network")
+ parser.add_argument("--depth", type=int, default=3, help="depth of the network")
+ parser.add_argument("--dilation-growth-rate", type=int, default=3, help="dilation growth rate")
+ parser.add_argument("--output-emb-width", type=int, default=512, help="output embedding width")
+ parser.add_argument('--vq-act', type=str, default='relu', choices = ['relu', 'silu', 'gelu'], help='dataset directory')
+
+ ## gpt arch
+ parser.add_argument("--block-size", type=int, default=25, help="seq len")
+ parser.add_argument("--embed-dim-gpt", type=int, default=512, help="embedding dimension")
+ parser.add_argument("--clip-dim", type=int, default=512, help="latent dimension in the clip feature")
+ parser.add_argument("--num-layers", type=int, default=2, help="nb of transformer layers")
+ parser.add_argument("--n-head-gpt", type=int, default=8, help="nb of heads")
+ parser.add_argument("--ff-rate", type=int, default=4, help="feedforward size")
+ parser.add_argument("--drop-out-rate", type=float, default=0.1, help="dropout ratio in the pos encoding")
+
+ ## quantizer
+ parser.add_argument("--quantizer", type=str, default='ema_reset', choices = ['ema', 'orig', 'ema_reset', 'reset'], help="eps for optimal transport")
+ parser.add_argument('--quantbeta', type=float, default=1.0, help='dataset directory')
+
+ ## resume
+ parser.add_argument("--resume-pth", type=str, default=None, help='resume vq pth')
+ parser.add_argument("--resume-trans", type=str, default=None, help='resume gpt pth')
+
+
+ ## output directory
+ parser.add_argument('--out-dir', type=str, default='output_GPT_Final/', help='output directory')
+ parser.add_argument('--exp-name', type=str, default='exp_debug', help='name of the experiment, will create a file inside out-dir')
+ parser.add_argument('--vq-name', type=str, default='exp_debug', help='name of the generated dataset .npy, will create a file inside out-dir')
+ ## other
+ parser.add_argument('--print-iter', default=200, type=int, help='print frequency')
+ parser.add_argument('--eval-iter', default=5000, type=int, help='evaluation frequency')
+ parser.add_argument('--seed', default=123, type=int, help='seed for initializing training. ')
+ parser.add_argument("--if-maxtest", action='store_true', help="test in max")
+ parser.add_argument('--pkeep', type=float, default=1.0, help='keep rate for gpt training')
+
+
+ return parser.parse_args()
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/options/option_vq.py b/generate_human_motion/VQTrans/options/option_vq.py
new file mode 100644
index 0000000000000000000000000000000000000000..08a53ff1270facc10ab44ec0647e673ed1336d0d
--- /dev/null
+++ b/generate_human_motion/VQTrans/options/option_vq.py
@@ -0,0 +1,61 @@
+import argparse
+
+def get_args_parser():
+ parser = argparse.ArgumentParser(description='Optimal Transport AutoEncoder training for AIST',
+ add_help=True,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter)
+
+ ## dataloader
+ parser.add_argument('--dataname', type=str, default='kit', help='dataset directory')
+ parser.add_argument('--batch-size', default=128, type=int, help='batch size')
+ parser.add_argument('--window-size', type=int, default=64, help='training motion length')
+
+ ## optimization
+ parser.add_argument('--total-iter', default=200000, type=int, help='number of total iterations to run')
+ parser.add_argument('--warm-up-iter', default=1000, type=int, help='number of total iterations for warmup')
+ parser.add_argument('--lr', default=2e-4, type=float, help='max learning rate')
+ parser.add_argument('--lr-scheduler', default=[50000, 400000], nargs="+", type=int, help="learning rate schedule (iterations)")
+ parser.add_argument('--gamma', default=0.05, type=float, help="learning rate decay")
+
+ parser.add_argument('--weight-decay', default=0.0, type=float, help='weight decay')
+ parser.add_argument("--commit", type=float, default=0.02, help="hyper-parameter for the commitment loss")
+ parser.add_argument('--loss-vel', type=float, default=0.1, help='hyper-parameter for the velocity loss')
+ parser.add_argument('--recons-loss', type=str, default='l2', help='reconstruction loss')
+
+ ## vqvae arch
+ parser.add_argument("--code-dim", type=int, default=512, help="embedding dimension")
+ parser.add_argument("--nb-code", type=int, default=512, help="nb of embedding")
+ parser.add_argument("--mu", type=float, default=0.99, help="exponential moving average to update the codebook")
+ parser.add_argument("--down-t", type=int, default=2, help="downsampling rate")
+ parser.add_argument("--stride-t", type=int, default=2, help="stride size")
+ parser.add_argument("--width", type=int, default=512, help="width of the network")
+ parser.add_argument("--depth", type=int, default=3, help="depth of the network")
+ parser.add_argument("--dilation-growth-rate", type=int, default=3, help="dilation growth rate")
+ parser.add_argument("--output-emb-width", type=int, default=512, help="output embedding width")
+ parser.add_argument('--vq-act', type=str, default='relu', choices = ['relu', 'silu', 'gelu'], help='dataset directory')
+ parser.add_argument('--vq-norm', type=str, default=None, help='dataset directory')
+
+ ## quantizer
+ parser.add_argument("--quantizer", type=str, default='ema_reset', choices = ['ema', 'orig', 'ema_reset', 'reset'], help="eps for optimal transport")
+ parser.add_argument('--beta', type=float, default=1.0, help='commitment loss in standard VQ')
+
+ ## resume
+ parser.add_argument("--resume-pth", type=str, default=None, help='resume pth for VQ')
+ parser.add_argument("--resume-gpt", type=str, default=None, help='resume pth for GPT')
+
+
+ ## output directory
+ parser.add_argument('--out-dir', type=str, default='output_vqfinal/', help='output directory')
+ parser.add_argument('--results-dir', type=str, default='visual_results/', help='output directory')
+ parser.add_argument('--visual-name', type=str, default='baseline', help='output directory')
+ parser.add_argument('--exp-name', type=str, default='exp_debug', help='name of the experiment, will create a file inside out-dir')
+ ## other
+ parser.add_argument('--print-iter', default=200, type=int, help='print frequency')
+ parser.add_argument('--eval-iter', default=1000, type=int, help='evaluation frequency')
+ parser.add_argument('--seed', default=123, type=int, help='seed for initializing training.')
+
+ parser.add_argument('--vis-gt', action='store_true', help='whether visualize GT motions')
+ parser.add_argument('--nb-vis', default=20, type=int, help='nb of visualizations')
+
+
+ return parser.parse_args()
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/output/02ab4ad275eda92f352e2ed8d942eeef_pred.pt b/generate_human_motion/VQTrans/output/02ab4ad275eda92f352e2ed8d942eeef_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..26ae791994a554f66195ed85c2319cc5e6cd680f
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/02ab4ad275eda92f352e2ed8d942eeef_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:80236f3d1abbbbebe1d8c507192e43d4bc0a45530ba07878359aac3b32b497c8
+size 10253253
diff --git a/generate_human_motion/VQTrans/output/06c27c738e874b23067c006f52e18ebc_pred.pt b/generate_human_motion/VQTrans/output/06c27c738e874b23067c006f52e18ebc_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..cb2d191374e9774021fd86b2e2753d06c5375372
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/06c27c738e874b23067c006f52e18ebc_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d4ae194ab73d235b8db97d33b8d16fa5992eebd0d8a827ec795441e6f6000295
+size 4961733
diff --git a/generate_human_motion/VQTrans/output/0edd5f692aeec051d748dee0844f94e1_pred.pt b/generate_human_motion/VQTrans/output/0edd5f692aeec051d748dee0844f94e1_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..e8e6542ae5efd0920add4dc793de04ca0c3237d2
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/0edd5f692aeec051d748dee0844f94e1_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:00eb8444c64fc2e33a9e19f66c0f2c8f104000da647c0aabc510a5bb46afd1a9
+size 6946053
diff --git a/generate_human_motion/VQTrans/output/23cb7d0e26bb1646b3d386331971449c_pred.pt b/generate_human_motion/VQTrans/output/23cb7d0e26bb1646b3d386331971449c_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..9a076444c9a447919ab0249568c34bbbbed7a005
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/23cb7d0e26bb1646b3d386331971449c_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9e05998e1d4ac1eebcba89ec989112b6fcdb55c8cceeef2faea7cb564a381525
+size 16206213
diff --git a/generate_human_motion/VQTrans/output/3076bd805b9e1991722b4f9e3b821856_pred.pt b/generate_human_motion/VQTrans/output/3076bd805b9e1991722b4f9e3b821856_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..ab2fcf321fd5968d5c1d0732a3f8db3713251149
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/3076bd805b9e1991722b4f9e3b821856_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4c52d09fabdcbe1c21231b9066d2c41a92aaf4975feac8362cc26dbaaaf823af
+size 13560453
diff --git a/generate_human_motion/VQTrans/output/358f2934afb464d5780ba824af41820c_pred.pt b/generate_human_motion/VQTrans/output/358f2934afb464d5780ba824af41820c_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..d32d04e7aa41c38b1b153c5b217d51b59245cebc
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/358f2934afb464d5780ba824af41820c_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:cc0dafc92084c5eaecb3d82b2a79b5b535c58b575c6a028c12ebce7ffc59f23a
+size 9591813
diff --git a/generate_human_motion/VQTrans/output/4167282f4235c27b0069bd1c4e31b368_pred.pt b/generate_human_motion/VQTrans/output/4167282f4235c27b0069bd1c4e31b368_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..d928e82ebd0031e37c25d1a446a1f1f6d3d0b92a
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/4167282f4235c27b0069bd1c4e31b368_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5234fa690582a2ba85a4ee75afec493ec39acc05a8af050b7b29a2a803d41a1b
+size 8268933
diff --git a/generate_human_motion/VQTrans/output/43234200eddda80d2df6fcc8044eade0_pred.pt b/generate_human_motion/VQTrans/output/43234200eddda80d2df6fcc8044eade0_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..aa2f32c724933090c01f3e7db641b0d648fff172
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/43234200eddda80d2df6fcc8044eade0_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:16c788e8d3e1ed1258b8acc16d5a42df6417ef3077ed3b34049e2bc80d3672f9
+size 9591813
diff --git a/generate_human_motion/VQTrans/output/5262111d79127d1f680af5f5202dcd81_pred.pt b/generate_human_motion/VQTrans/output/5262111d79127d1f680af5f5202dcd81_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..cb5673b1c83badec6a5ec750c4188e4b0ef7c26b
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/5262111d79127d1f680af5f5202dcd81_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:06f041378e43757e6d583e9dd0076ab2143240fae004d4c084625aae37c9c26e
+size 13560453
diff --git a/generate_human_motion/VQTrans/output/6472e72a29d8b34be23bd24a455249d3_pred.pt b/generate_human_motion/VQTrans/output/6472e72a29d8b34be23bd24a455249d3_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..9c49b54f1adde7e09d1e6dafb270d62c4f48b522
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/6472e72a29d8b34be23bd24a455249d3_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:188c34f9f6399ec64005c24b5937c69949f7d16439dd648c6068b05f757f020f
+size 13229765
diff --git a/generate_human_motion/VQTrans/output/6e9a67186ffedff76b9376738c66de36_pred.pt b/generate_human_motion/VQTrans/output/6e9a67186ffedff76b9376738c66de36_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..4d3135c310cd81f8be3e7f9113dea36a72e19d34
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/6e9a67186ffedff76b9376738c66de36_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a5af53eb4fb45a33be53730d026cbd58be5a94806328aaa1654261fa604ce1ef
+size 11906885
diff --git a/generate_human_motion/VQTrans/output/792766afc316339bfe1f9ff828594038_pred.pt b/generate_human_motion/VQTrans/output/792766afc316339bfe1f9ff828594038_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..62c8b4c7fd4b4650f2edf8ea12d611ac0eaf3049
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/792766afc316339bfe1f9ff828594038_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f8eceee1bf1a3d582065ceadbb72b2425188a1a21e4b7720a25a1ec7bb9017da
+size 13891205
diff --git a/generate_human_motion/VQTrans/output/79abb36fab729587ebc6252118e6e647_pred.pt b/generate_human_motion/VQTrans/output/79abb36fab729587ebc6252118e6e647_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..506c7a10c07714147b8fd98099eece1053fd93bd
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/79abb36fab729587ebc6252118e6e647_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ff941ebc0f0a49c73b8bb875424f51cc20998558f5d7735781e48ed4beb8cf21
+size 6946053
diff --git a/generate_human_motion/VQTrans/output/7fa37839a0ea2671c0418166ad03ccd8_pred.pt b/generate_human_motion/VQTrans/output/7fa37839a0ea2671c0418166ad03ccd8_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..87d688630b4f0396d5c0428126e188b9e3f2a8b3
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/7fa37839a0ea2671c0418166ad03ccd8_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4f5374459259ce25df81dee704242c27b10eb729139fe8e1ec4fb9ee008f9939
+size 15875525
diff --git a/generate_human_motion/VQTrans/output/90dd3007b93da07eca7527c836b4d6d0_pred.pt b/generate_human_motion/VQTrans/output/90dd3007b93da07eca7527c836b4d6d0_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..da6dec12adce86c06255d273dac9e7018119edbd
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/90dd3007b93da07eca7527c836b4d6d0_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a24b9eecef62fc4a498c45e9342b265304191b9b0bd0f673bf3e029a6524bedd
+size 16206213
diff --git a/generate_human_motion/VQTrans/output/a23afab7d29369a4db16fa5d5758c002_pred.pt b/generate_human_motion/VQTrans/output/a23afab7d29369a4db16fa5d5758c002_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..d16733716b94b385bfd22364395bd3140a0580ea
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/a23afab7d29369a4db16fa5d5758c002_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f3ce2539cf6c3a9ef10571e63478600632e8b00891e8d50e7f6978d084221de2
+size 15875525
diff --git a/generate_human_motion/VQTrans/output/a9c77448bb3aa544e03e22bceba3bb8e_pred.pt b/generate_human_motion/VQTrans/output/a9c77448bb3aa544e03e22bceba3bb8e_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..6bff20845e55b15c8c9738de2f4758f8f6db8b52
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/a9c77448bb3aa544e03e22bceba3bb8e_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7ad3fb2feaf615bd2969410ba15d1186be89ba8f41d7419c08d4d5aac53e0922
+size 15875525
diff --git a/generate_human_motion/VQTrans/output/c281cb969ed5eb7aefc899fc3d07f188_pred.pt b/generate_human_motion/VQTrans/output/c281cb969ed5eb7aefc899fc3d07f188_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..9a3b9f7f1214951c4e39d10bcb7206cc6493a023
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/c281cb969ed5eb7aefc899fc3d07f188_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:373866bbbd935fd0078ff6d6f603751ab3985dd9fa88b7521a0a30374aa27c49
+size 15875525
diff --git a/generate_human_motion/VQTrans/output/c3785325ba8f17ce7427b43d49903e51_pred.pt b/generate_human_motion/VQTrans/output/c3785325ba8f17ce7427b43d49903e51_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..d72827a2475f3fb6c5be9f5f32d0c7eb6f2a87cf
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/c3785325ba8f17ce7427b43d49903e51_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3513af257c3ffa7b2168f02288a9d3349648efbfba4dcf88e00e9bca1e850855
+size 10584005
diff --git a/generate_human_motion/VQTrans/output/ddc590f0a7355b36d0939c54df42479d_pred.pt b/generate_human_motion/VQTrans/output/ddc590f0a7355b36d0939c54df42479d_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..a521a85afa882aa06727cd0271832586819fd3fb
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/ddc590f0a7355b36d0939c54df42479d_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a9a145adba8242e0326e43d6b81371658c5db057c714cdc0326243a5e2542862
+size 10914693
diff --git a/generate_human_motion/VQTrans/output/ecda0baa5aaac5a62928ce2bc05a7632_pred.pt b/generate_human_motion/VQTrans/output/ecda0baa5aaac5a62928ce2bc05a7632_pred.pt
new file mode 100644
index 0000000000000000000000000000000000000000..dab4a0e4091958ef3466608132122b8683b3c837
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/ecda0baa5aaac5a62928ce2bc05a7632_pred.pt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1c6f454e91471e48bee3b5b101c22d1d0a0eca554409d069dbad4cefb7567979
+size 15875525
diff --git a/generate_human_motion/VQTrans/output/results.gif b/generate_human_motion/VQTrans/output/results.gif
new file mode 100644
index 0000000000000000000000000000000000000000..639c0be7fa7788375ab58de89f5fe6d60226d5f9
--- /dev/null
+++ b/generate_human_motion/VQTrans/output/results.gif
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:06898b58cdc0e5de17a85c234b2ca72450baa76f3b65d9b8ce3f9e3a53073f46
+size 3647301
diff --git a/generate_human_motion/VQTrans/output/results.mp4 b/generate_human_motion/VQTrans/output/results.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..6aa9ff94b9830f5f2bd9f9315144ff8ad2264d99
Binary files /dev/null and b/generate_human_motion/VQTrans/output/results.mp4 differ
diff --git a/generate_human_motion/VQTrans/render_final.py b/generate_human_motion/VQTrans/render_final.py
new file mode 100644
index 0000000000000000000000000000000000000000..41b3bfdb2e6bff74aeaceb8f1a7ebac9dc1acaba
--- /dev/null
+++ b/generate_human_motion/VQTrans/render_final.py
@@ -0,0 +1,194 @@
+from models.rotation2xyz import Rotation2xyz
+import numpy as np
+from trimesh import Trimesh
+import os
+os.environ['PYOPENGL_PLATFORM'] = "osmesa"
+
+import torch
+from visualize.simplify_loc2rot import joints2smpl
+import pyrender
+import matplotlib.pyplot as plt
+
+import io
+import imageio
+from shapely import geometry
+import trimesh
+from pyrender.constants import RenderFlags
+import math
+# import ffmpeg
+from PIL import Image
+
+class WeakPerspectiveCamera(pyrender.Camera):
+ def __init__(self,
+ scale,
+ translation,
+ znear=pyrender.camera.DEFAULT_Z_NEAR,
+ zfar=None,
+ name=None):
+ super(WeakPerspectiveCamera, self).__init__(
+ znear=znear,
+ zfar=zfar,
+ name=name,
+ )
+ self.scale = scale
+ self.translation = translation
+
+ def get_projection_matrix(self, width=None, height=None):
+ P = np.eye(4)
+ P[0, 0] = self.scale[0]
+ P[1, 1] = self.scale[1]
+ P[0, 3] = self.translation[0] * self.scale[0]
+ P[1, 3] = -self.translation[1] * self.scale[1]
+ P[2, 2] = -1
+ return P
+
+def render(motions, outdir='test_vis', device_id=0, name=None, pred=True):
+ frames, njoints, nfeats = motions.shape
+ MINS = motions.min(axis=0).min(axis=0)
+ MAXS = motions.max(axis=0).max(axis=0)
+
+ height_offset = MINS[1]
+ motions[:, :, 1] -= height_offset
+ trajec = motions[:, 0, [0, 2]]
+
+ j2s = joints2smpl(num_frames=frames, device_id=0, cuda=True)
+ rot2xyz = Rotation2xyz(device=torch.device("cuda:0"))
+ faces = rot2xyz.smpl_model.faces
+
+ if (not os.path.exists(outdir + name+'_pred.pt') and pred) or (not os.path.exists(outdir + name+'_gt.pt') and not pred):
+ print(f'Running SMPLify, it may take a few minutes.')
+ motion_tensor, opt_dict = j2s.joint2smpl(motions) # [nframes, njoints, 3]
+
+ vertices = rot2xyz(torch.tensor(motion_tensor).clone(), mask=None,
+ pose_rep='rot6d', translation=True, glob=True,
+ jointstype='vertices',
+ vertstrans=True)
+
+ if pred:
+ torch.save(vertices, outdir + name+'_pred.pt')
+ else:
+ torch.save(vertices, outdir + name+'_gt.pt')
+ else:
+ if pred:
+ vertices = torch.load(outdir + name+'_pred.pt')
+ else:
+ vertices = torch.load(outdir + name+'_gt.pt')
+ frames = vertices.shape[3] # shape: 1, nb_frames, 3, nb_joints
+ print (vertices.shape)
+ MINS = torch.min(torch.min(vertices[0], axis=0)[0], axis=1)[0]
+ MAXS = torch.max(torch.max(vertices[0], axis=0)[0], axis=1)[0]
+ # vertices[:,:,1,:] -= MINS[1] + 1e-5
+
+
+ out_list = []
+
+ minx = MINS[0] - 0.5
+ maxx = MAXS[0] + 0.5
+ minz = MINS[2] - 0.5
+ maxz = MAXS[2] + 0.5
+ polygon = geometry.Polygon([[minx, minz], [minx, maxz], [maxx, maxz], [maxx, minz]])
+ polygon_mesh = trimesh.creation.extrude_polygon(polygon, 1e-5)
+
+ vid = []
+ for i in range(frames):
+ if i % 10 == 0:
+ print(i)
+
+ mesh = Trimesh(vertices=vertices[0, :, :, i].squeeze().tolist(), faces=faces)
+
+ base_color = (0.11, 0.53, 0.8, 0.5)
+ ## OPAQUE rendering without alpha
+ ## BLEND rendering consider alpha
+ material = pyrender.MetallicRoughnessMaterial(
+ metallicFactor=0.7,
+ alphaMode='OPAQUE',
+ baseColorFactor=base_color
+ )
+
+
+ mesh = pyrender.Mesh.from_trimesh(mesh, material=material)
+
+ polygon_mesh.visual.face_colors = [0, 0, 0, 0.21]
+ polygon_render = pyrender.Mesh.from_trimesh(polygon_mesh, smooth=False)
+
+ bg_color = [1, 1, 1, 0.8]
+ scene = pyrender.Scene(bg_color=bg_color, ambient_light=(0.4, 0.4, 0.4))
+
+ sx, sy, tx, ty = [0.75, 0.75, 0, 0.10]
+
+ camera = pyrender.PerspectiveCamera(yfov=(np.pi / 3.0))
+
+ light = pyrender.DirectionalLight(color=[1,1,1], intensity=300)
+
+ scene.add(mesh)
+
+ c = np.pi / 2
+
+ scene.add(polygon_render, pose=np.array([[ 1, 0, 0, 0],
+
+ [ 0, np.cos(c), -np.sin(c), MINS[1].cpu().numpy()],
+
+ [ 0, np.sin(c), np.cos(c), 0],
+
+ [ 0, 0, 0, 1]]))
+
+ light_pose = np.eye(4)
+ light_pose[:3, 3] = [0, -1, 1]
+ scene.add(light, pose=light_pose.copy())
+
+ light_pose[:3, 3] = [0, 1, 1]
+ scene.add(light, pose=light_pose.copy())
+
+ light_pose[:3, 3] = [1, 1, 2]
+ scene.add(light, pose=light_pose.copy())
+
+
+ c = -np.pi / 6
+
+ scene.add(camera, pose=[[ 1, 0, 0, (minx+maxx).cpu().numpy()/2],
+
+ [ 0, np.cos(c), -np.sin(c), 1.5],
+
+ [ 0, np.sin(c), np.cos(c), max(4, minz.cpu().numpy()+(1.5-MINS[1].cpu().numpy())*2, (maxx-minx).cpu().numpy())],
+
+ [ 0, 0, 0, 1]
+ ])
+
+ # render scene
+ r = pyrender.OffscreenRenderer(960, 960)
+
+ color, _ = r.render(scene, flags=RenderFlags.RGBA)
+ # Image.fromarray(color).save(outdir+'/'+name+'_'+str(i)+'.png')
+
+ vid.append(color)
+
+ r.delete()
+
+ out = np.stack(vid, axis=0)
+ if pred:
+ imageio.mimsave(outdir + name+'_pred.gif', out, fps=20)
+ else:
+ imageio.mimsave(outdir + name+'_gt.gif', out, fps=20)
+
+
+
+
+
+if __name__ == "__main__":
+ import argparse
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--filedir", type=str, default=None, help='motion npy file dir')
+ parser.add_argument('--motion-list', default=None, nargs="+", type=str, help="motion name list")
+ args = parser.parse_args()
+
+ filename_list = args.motion_list
+ filedir = args.filedir
+
+ for filename in filename_list:
+ motions = np.load(filedir + filename+'_pred.npy')
+ print('pred', motions.shape, filename)
+ render(motions[0], outdir=filedir, device_id=0, name=filename, pred=True)
+
+ motions = np.load(filedir + filename+'_gt.npy')
+ print('gt', motions.shape, filename)
+ render(motions[0], outdir=filedir, device_id=0, name=filename, pred=False)
diff --git a/generate_human_motion/VQTrans/train_t2m_trans.py b/generate_human_motion/VQTrans/train_t2m_trans.py
new file mode 100644
index 0000000000000000000000000000000000000000..8da444f87aa7ca71cd8bc3604868cf30a6c70e02
--- /dev/null
+++ b/generate_human_motion/VQTrans/train_t2m_trans.py
@@ -0,0 +1,191 @@
+import os
+import torch
+import numpy as np
+
+from torch.utils.tensorboard import SummaryWriter
+from os.path import join as pjoin
+from torch.distributions import Categorical
+import json
+import clip
+
+import options.option_transformer as option_trans
+import models.vqvae as vqvae
+import utils.utils_model as utils_model
+import utils.eval_trans as eval_trans
+from dataset import dataset_TM_train
+from dataset import dataset_TM_eval
+from dataset import dataset_tokenize
+import models.t2m_trans as trans
+from options.get_eval_option import get_opt
+from models.evaluator_wrapper import EvaluatorModelWrapper
+import warnings
+warnings.filterwarnings('ignore')
+
+##### ---- Exp dirs ---- #####
+args = option_trans.get_args_parser()
+torch.manual_seed(args.seed)
+
+args.out_dir = os.path.join(args.out_dir, f'{args.exp_name}')
+args.vq_dir= os.path.join("./dataset/KIT-ML" if args.dataname == 'kit' else "./dataset/HumanML3D", f'{args.vq_name}')
+os.makedirs(args.out_dir, exist_ok = True)
+os.makedirs(args.vq_dir, exist_ok = True)
+
+##### ---- Logger ---- #####
+logger = utils_model.get_logger(args.out_dir)
+writer = SummaryWriter(args.out_dir)
+logger.info(json.dumps(vars(args), indent=4, sort_keys=True))
+
+##### ---- Dataloader ---- #####
+train_loader_token = dataset_tokenize.DATALoader(args.dataname, 1, unit_length=2**args.down_t)
+
+from utils.word_vectorizer import WordVectorizer
+w_vectorizer = WordVectorizer('./glove', 'our_vab')
+val_loader = dataset_TM_eval.DATALoader(args.dataname, False, 32, w_vectorizer)
+
+dataset_opt_path = 'checkpoints/kit/Comp_v6_KLD005/opt.txt' if args.dataname == 'kit' else 'checkpoints/t2m/Comp_v6_KLD005/opt.txt'
+
+wrapper_opt = get_opt(dataset_opt_path, torch.device('cuda'))
+eval_wrapper = EvaluatorModelWrapper(wrapper_opt)
+
+##### ---- Network ---- #####
+clip_model, clip_preprocess = clip.load("ViT-B/32", device=torch.device('cuda'), jit=False, download_root='/apdcephfs_cq2/share_1290939/maelyszhang/.cache/clip') # Must set jit=False for training
+clip.model.convert_weights(clip_model) # Actually this line is unnecessary since clip by default already on float16
+clip_model.eval()
+for p in clip_model.parameters():
+ p.requires_grad = False
+
+net = vqvae.HumanVQVAE(args, ## use args to define different parameters in different quantizers
+ args.nb_code,
+ args.code_dim,
+ args.output_emb_width,
+ args.down_t,
+ args.stride_t,
+ args.width,
+ args.depth,
+ args.dilation_growth_rate)
+
+
+trans_encoder = trans.Text2Motion_Transformer(num_vq=args.nb_code,
+ embed_dim=args.embed_dim_gpt,
+ clip_dim=args.clip_dim,
+ block_size=args.block_size,
+ num_layers=args.num_layers,
+ n_head=args.n_head_gpt,
+ drop_out_rate=args.drop_out_rate,
+ fc_rate=args.ff_rate)
+
+
+print ('loading checkpoint from {}'.format(args.resume_pth))
+ckpt = torch.load(args.resume_pth, map_location='cpu')
+net.load_state_dict(ckpt['net'], strict=True)
+net.eval()
+net.cuda()
+
+if args.resume_trans is not None:
+ print ('loading transformer checkpoint from {}'.format(args.resume_trans))
+ ckpt = torch.load(args.resume_trans, map_location='cpu')
+ trans_encoder.load_state_dict(ckpt['trans'], strict=True)
+trans_encoder.train()
+trans_encoder.cuda()
+
+##### ---- Optimizer & Scheduler ---- #####
+optimizer = utils_model.initial_optim(args.decay_option, args.lr, args.weight_decay, trans_encoder, args.optimizer)
+scheduler = torch.optim.lr_scheduler.MultiStepLR(optimizer, milestones=args.lr_scheduler, gamma=args.gamma)
+
+##### ---- Optimization goals ---- #####
+loss_ce = torch.nn.CrossEntropyLoss()
+
+nb_iter, avg_loss_cls, avg_acc = 0, 0., 0.
+right_num = 0
+nb_sample_train = 0
+
+##### ---- get code ---- #####
+for batch in train_loader_token:
+ pose, name = batch
+ bs, seq = pose.shape[0], pose.shape[1]
+
+ pose = pose.cuda().float() # bs, nb_joints, joints_dim, seq_len
+ target = net.encode(pose)
+ target = target.cpu().numpy()
+ np.save(pjoin(args.vq_dir, name[0] +'.npy'), target)
+
+
+train_loader = dataset_TM_train.DATALoader(args.dataname, args.batch_size, args.nb_code, args.vq_name, unit_length=2**args.down_t)
+train_loader_iter = dataset_TM_train.cycle(train_loader)
+
+
+##### ---- Training ---- #####
+best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, writer, logger = eval_trans.evaluation_transformer(args.out_dir, val_loader, net, trans_encoder, logger, writer, 0, best_fid=1000, best_iter=0, best_div=100, best_top1=0, best_top2=0, best_top3=0, best_matching=100, clip_model=clip_model, eval_wrapper=eval_wrapper)
+while nb_iter <= args.total_iter:
+
+ batch = next(train_loader_iter)
+ clip_text, m_tokens, m_tokens_len = batch
+ m_tokens, m_tokens_len = m_tokens.cuda(), m_tokens_len.cuda()
+ bs = m_tokens.shape[0]
+ target = m_tokens # (bs, 26)
+ target = target.cuda()
+
+ text = clip.tokenize(clip_text, truncate=True).cuda()
+
+ feat_clip_text = clip_model.encode_text(text).float()
+
+ input_index = target[:,:-1]
+
+ if args.pkeep == -1:
+ proba = np.random.rand(1)[0]
+ mask = torch.bernoulli(proba * torch.ones(input_index.shape,
+ device=input_index.device))
+ else:
+ mask = torch.bernoulli(args.pkeep * torch.ones(input_index.shape,
+ device=input_index.device))
+ mask = mask.round().to(dtype=torch.int64)
+ r_indices = torch.randint_like(input_index, args.nb_code)
+ a_indices = mask*input_index+(1-mask)*r_indices
+
+ cls_pred = trans_encoder(a_indices, feat_clip_text)
+ cls_pred = cls_pred.contiguous()
+
+ loss_cls = 0.0
+ for i in range(bs):
+ # loss function (26), (26, 513)
+ loss_cls += loss_ce(cls_pred[i][:m_tokens_len[i] + 1], target[i][:m_tokens_len[i] + 1]) / bs
+
+ # Accuracy
+ probs = torch.softmax(cls_pred[i][:m_tokens_len[i] + 1], dim=-1)
+
+ if args.if_maxtest:
+ _, cls_pred_index = torch.max(probs, dim=-1)
+
+ else:
+ dist = Categorical(probs)
+ cls_pred_index = dist.sample()
+ right_num += (cls_pred_index.flatten(0) == target[i][:m_tokens_len[i] + 1].flatten(0)).sum().item()
+
+ ## global loss
+ optimizer.zero_grad()
+ loss_cls.backward()
+ optimizer.step()
+ scheduler.step()
+
+ avg_loss_cls = avg_loss_cls + loss_cls.item()
+ nb_sample_train = nb_sample_train + (m_tokens_len + 1).sum().item()
+
+ nb_iter += 1
+ if nb_iter % args.print_iter == 0 :
+ avg_loss_cls = avg_loss_cls / args.print_iter
+ avg_acc = right_num * 100 / nb_sample_train
+ writer.add_scalar('./Loss/train', avg_loss_cls, nb_iter)
+ writer.add_scalar('./ACC/train', avg_acc, nb_iter)
+ msg = f"Train. Iter {nb_iter} : Loss. {avg_loss_cls:.5f}, ACC. {avg_acc:.4f}"
+ logger.info(msg)
+ avg_loss_cls = 0.
+ right_num = 0
+ nb_sample_train = 0
+
+ if nb_iter % args.eval_iter == 0:
+ best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, writer, logger = eval_trans.evaluation_transformer(args.out_dir, val_loader, net, trans_encoder, logger, writer, nb_iter, best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, clip_model=clip_model, eval_wrapper=eval_wrapper)
+
+ if nb_iter == args.total_iter:
+ msg_final = f"Train. Iter {best_iter} : FID. {best_fid:.5f}, Diversity. {best_div:.4f}, TOP1. {best_top1:.4f}, TOP2. {best_top2:.4f}, TOP3. {best_top3:.4f}"
+ logger.info(msg_final)
+ break
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/train_vq.py b/generate_human_motion/VQTrans/train_vq.py
new file mode 100644
index 0000000000000000000000000000000000000000..d89b9930ba1262747542df3d5b2f03f8fab1b04a
--- /dev/null
+++ b/generate_human_motion/VQTrans/train_vq.py
@@ -0,0 +1,171 @@
+import os
+import json
+
+import torch
+import torch.optim as optim
+from torch.utils.tensorboard import SummaryWriter
+
+import models.vqvae as vqvae
+import utils.losses as losses
+import options.option_vq as option_vq
+import utils.utils_model as utils_model
+from dataset import dataset_VQ, dataset_TM_eval
+import utils.eval_trans as eval_trans
+from options.get_eval_option import get_opt
+from models.evaluator_wrapper import EvaluatorModelWrapper
+import warnings
+warnings.filterwarnings('ignore')
+from utils.word_vectorizer import WordVectorizer
+
+def update_lr_warm_up(optimizer, nb_iter, warm_up_iter, lr):
+
+ current_lr = lr * (nb_iter + 1) / (warm_up_iter + 1)
+ for param_group in optimizer.param_groups:
+ param_group["lr"] = current_lr
+
+ return optimizer, current_lr
+
+##### ---- Exp dirs ---- #####
+args = option_vq.get_args_parser()
+torch.manual_seed(args.seed)
+
+args.out_dir = os.path.join(args.out_dir, f'{args.exp_name}')
+os.makedirs(args.out_dir, exist_ok = True)
+
+##### ---- Logger ---- #####
+logger = utils_model.get_logger(args.out_dir)
+writer = SummaryWriter(args.out_dir)
+logger.info(json.dumps(vars(args), indent=4, sort_keys=True))
+
+
+
+w_vectorizer = WordVectorizer('./glove', 'our_vab')
+
+if args.dataname == 'kit' :
+ dataset_opt_path = 'checkpoints/kit/Comp_v6_KLD005/opt.txt'
+ args.nb_joints = 21
+
+else :
+ dataset_opt_path = 'checkpoints/t2m/Comp_v6_KLD005/opt.txt'
+ args.nb_joints = 22
+
+logger.info(f'Training on {args.dataname}, motions are with {args.nb_joints} joints')
+
+wrapper_opt = get_opt(dataset_opt_path, torch.device('cuda'))
+eval_wrapper = EvaluatorModelWrapper(wrapper_opt)
+
+
+##### ---- Dataloader ---- #####
+train_loader = dataset_VQ.DATALoader(args.dataname,
+ args.batch_size,
+ window_size=args.window_size,
+ unit_length=2**args.down_t)
+
+train_loader_iter = dataset_VQ.cycle(train_loader)
+
+val_loader = dataset_TM_eval.DATALoader(args.dataname, False,
+ 32,
+ w_vectorizer,
+ unit_length=2**args.down_t)
+
+##### ---- Network ---- #####
+net = vqvae.HumanVQVAE(args, ## use args to define different parameters in different quantizers
+ args.nb_code,
+ args.code_dim,
+ args.output_emb_width,
+ args.down_t,
+ args.stride_t,
+ args.width,
+ args.depth,
+ args.dilation_growth_rate,
+ args.vq_act,
+ args.vq_norm)
+
+
+if args.resume_pth :
+ logger.info('loading checkpoint from {}'.format(args.resume_pth))
+ ckpt = torch.load(args.resume_pth, map_location='cpu')
+ net.load_state_dict(ckpt['net'], strict=True)
+net.train()
+net.cuda()
+
+##### ---- Optimizer & Scheduler ---- #####
+optimizer = optim.AdamW(net.parameters(), lr=args.lr, betas=(0.9, 0.99), weight_decay=args.weight_decay)
+scheduler = torch.optim.lr_scheduler.MultiStepLR(optimizer, milestones=args.lr_scheduler, gamma=args.gamma)
+
+
+Loss = losses.ReConsLoss(args.recons_loss, args.nb_joints)
+
+##### ------ warm-up ------- #####
+avg_recons, avg_perplexity, avg_commit = 0., 0., 0.
+
+for nb_iter in range(1, args.warm_up_iter):
+
+ optimizer, current_lr = update_lr_warm_up(optimizer, nb_iter, args.warm_up_iter, args.lr)
+
+ gt_motion = next(train_loader_iter)
+ gt_motion = gt_motion.cuda().float() # (bs, 64, dim)
+
+ pred_motion, loss_commit, perplexity = net(gt_motion)
+ loss_motion = Loss(pred_motion, gt_motion)
+ loss_vel = Loss.forward_vel(pred_motion, gt_motion)
+
+ loss = loss_motion + args.commit * loss_commit + args.loss_vel * loss_vel
+
+ optimizer.zero_grad()
+ loss.backward()
+ optimizer.step()
+
+ avg_recons += loss_motion.item()
+ avg_perplexity += perplexity.item()
+ avg_commit += loss_commit.item()
+
+ if nb_iter % args.print_iter == 0 :
+ avg_recons /= args.print_iter
+ avg_perplexity /= args.print_iter
+ avg_commit /= args.print_iter
+
+ logger.info(f"Warmup. Iter {nb_iter} : lr {current_lr:.5f} \t Commit. {avg_commit:.5f} \t PPL. {avg_perplexity:.2f} \t Recons. {avg_recons:.5f}")
+
+ avg_recons, avg_perplexity, avg_commit = 0., 0., 0.
+
+##### ---- Training ---- #####
+avg_recons, avg_perplexity, avg_commit = 0., 0., 0.
+best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, writer, logger = eval_trans.evaluation_vqvae(args.out_dir, val_loader, net, logger, writer, 0, best_fid=1000, best_iter=0, best_div=100, best_top1=0, best_top2=0, best_top3=0, best_matching=100, eval_wrapper=eval_wrapper)
+
+for nb_iter in range(1, args.total_iter + 1):
+
+ gt_motion = next(train_loader_iter)
+ gt_motion = gt_motion.cuda().float() # bs, nb_joints, joints_dim, seq_len
+
+ pred_motion, loss_commit, perplexity = net(gt_motion)
+ loss_motion = Loss(pred_motion, gt_motion)
+ loss_vel = Loss.forward_vel(pred_motion, gt_motion)
+
+ loss = loss_motion + args.commit * loss_commit + args.loss_vel * loss_vel
+
+ optimizer.zero_grad()
+ loss.backward()
+ optimizer.step()
+ scheduler.step()
+
+ avg_recons += loss_motion.item()
+ avg_perplexity += perplexity.item()
+ avg_commit += loss_commit.item()
+
+ if nb_iter % args.print_iter == 0 :
+ avg_recons /= args.print_iter
+ avg_perplexity /= args.print_iter
+ avg_commit /= args.print_iter
+
+ writer.add_scalar('./Train/L1', avg_recons, nb_iter)
+ writer.add_scalar('./Train/PPL', avg_perplexity, nb_iter)
+ writer.add_scalar('./Train/Commit', avg_commit, nb_iter)
+
+ logger.info(f"Train. Iter {nb_iter} : \t Commit. {avg_commit:.5f} \t PPL. {avg_perplexity:.2f} \t Recons. {avg_recons:.5f}")
+
+ avg_recons, avg_perplexity, avg_commit = 0., 0., 0.,
+
+ if nb_iter % args.eval_iter==0 :
+ best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, writer, logger = eval_trans.evaluation_vqvae(args.out_dir, val_loader, net, logger, writer, nb_iter, best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, eval_wrapper=eval_wrapper)
+
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/utils/__init__.py b/generate_human_motion/VQTrans/utils/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/generate_human_motion/VQTrans/utils/__pycache__/__init__.cpython-310.pyc b/generate_human_motion/VQTrans/utils/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d3eb49a5b5893fa8b86672213573f71e02101ceb
Binary files /dev/null and b/generate_human_motion/VQTrans/utils/__pycache__/__init__.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/utils/__pycache__/config.cpython-310.pyc b/generate_human_motion/VQTrans/utils/__pycache__/config.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2c5d018ae6f76befb441f3381aadd62eec65748b
Binary files /dev/null and b/generate_human_motion/VQTrans/utils/__pycache__/config.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/utils/__pycache__/motion_process.cpython-310.pyc b/generate_human_motion/VQTrans/utils/__pycache__/motion_process.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d17cae94927fcf3b41446121af461e23a016f256
Binary files /dev/null and b/generate_human_motion/VQTrans/utils/__pycache__/motion_process.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/utils/__pycache__/rotation_conversions.cpython-310.pyc b/generate_human_motion/VQTrans/utils/__pycache__/rotation_conversions.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..06374797b3922c14e5b49bd9be888b73940cc468
Binary files /dev/null and b/generate_human_motion/VQTrans/utils/__pycache__/rotation_conversions.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/utils/config.py b/generate_human_motion/VQTrans/utils/config.py
new file mode 100644
index 0000000000000000000000000000000000000000..091d790e963959c326917688ee267e6a4ec136d1
--- /dev/null
+++ b/generate_human_motion/VQTrans/utils/config.py
@@ -0,0 +1,17 @@
+import os
+
+SMPL_DATA_PATH = "./body_models/smpl"
+
+SMPL_KINTREE_PATH = os.path.join(SMPL_DATA_PATH, "kintree_table.pkl")
+SMPL_MODEL_PATH = os.path.join(SMPL_DATA_PATH, "SMPL_NEUTRAL.pkl")
+JOINT_REGRESSOR_TRAIN_EXTRA = os.path.join(SMPL_DATA_PATH, 'J_regressor_extra.npy')
+
+ROT_CONVENTION_TO_ROT_NUMBER = {
+ 'legacy': 23,
+ 'no_hands': 21,
+ 'full_hands': 51,
+ 'mitten_hands': 33,
+}
+
+GENDERS = ['neutral', 'male', 'female']
+NUM_BETAS = 10
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/utils/eval_trans.py b/generate_human_motion/VQTrans/utils/eval_trans.py
new file mode 100644
index 0000000000000000000000000000000000000000..8778bb8cb7e7a320e5f7f2f3b43c7ba0b4c285ab
--- /dev/null
+++ b/generate_human_motion/VQTrans/utils/eval_trans.py
@@ -0,0 +1,580 @@
+import os
+
+import clip
+import numpy as np
+import torch
+from scipy import linalg
+
+import visualization.plot_3d_global as plot_3d
+from utils.motion_process import recover_from_ric
+
+
+def tensorborad_add_video_xyz(writer, xyz, nb_iter, tag, nb_vis=4, title_batch=None, outname=None):
+ xyz = xyz[:1]
+ bs, seq = xyz.shape[:2]
+ xyz = xyz.reshape(bs, seq, -1, 3)
+ plot_xyz = plot_3d.draw_to_batch(xyz.cpu().numpy(),title_batch, outname)
+ plot_xyz =np.transpose(plot_xyz, (0, 1, 4, 2, 3))
+ writer.add_video(tag, plot_xyz, nb_iter, fps = 20)
+
+@torch.no_grad()
+def evaluation_vqvae(out_dir, val_loader, net, logger, writer, nb_iter, best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, eval_wrapper, draw = True, save = True, savegif=False, savenpy=False) :
+ net.eval()
+ nb_sample = 0
+
+ draw_org = []
+ draw_pred = []
+ draw_text = []
+
+
+ motion_annotation_list = []
+ motion_pred_list = []
+
+ R_precision_real = 0
+ R_precision = 0
+
+ nb_sample = 0
+ matching_score_real = 0
+ matching_score_pred = 0
+ for batch in val_loader:
+ word_embeddings, pos_one_hots, caption, sent_len, motion, m_length, token, name = batch
+
+ motion = motion.cuda()
+ et, em = eval_wrapper.get_co_embeddings(word_embeddings, pos_one_hots, sent_len, motion, m_length)
+ bs, seq = motion.shape[0], motion.shape[1]
+
+ num_joints = 21 if motion.shape[-1] == 251 else 22
+
+ pred_pose_eval = torch.zeros((bs, seq, motion.shape[-1])).cuda()
+
+ for i in range(bs):
+ pose = val_loader.dataset.inv_transform(motion[i:i+1, :m_length[i], :].detach().cpu().numpy())
+ pose_xyz = recover_from_ric(torch.from_numpy(pose).float().cuda(), num_joints)
+
+
+ pred_pose, loss_commit, perplexity = net(motion[i:i+1, :m_length[i]])
+ pred_denorm = val_loader.dataset.inv_transform(pred_pose.detach().cpu().numpy())
+ pred_xyz = recover_from_ric(torch.from_numpy(pred_denorm).float().cuda(), num_joints)
+
+ if savenpy:
+ np.save(os.path.join(out_dir, name[i]+'_gt.npy'), pose_xyz[:, :m_length[i]].cpu().numpy())
+ np.save(os.path.join(out_dir, name[i]+'_pred.npy'), pred_xyz.detach().cpu().numpy())
+
+ pred_pose_eval[i:i+1,:m_length[i],:] = pred_pose
+
+ if i < min(4, bs):
+ draw_org.append(pose_xyz)
+ draw_pred.append(pred_xyz)
+ draw_text.append(caption[i])
+
+ et_pred, em_pred = eval_wrapper.get_co_embeddings(word_embeddings, pos_one_hots, sent_len, pred_pose_eval, m_length)
+
+ motion_pred_list.append(em_pred)
+ motion_annotation_list.append(em)
+
+ temp_R, temp_match = calculate_R_precision(et.cpu().numpy(), em.cpu().numpy(), top_k=3, sum_all=True)
+ R_precision_real += temp_R
+ matching_score_real += temp_match
+ temp_R, temp_match = calculate_R_precision(et_pred.cpu().numpy(), em_pred.cpu().numpy(), top_k=3, sum_all=True)
+ R_precision += temp_R
+ matching_score_pred += temp_match
+
+ nb_sample += bs
+
+ motion_annotation_np = torch.cat(motion_annotation_list, dim=0).cpu().numpy()
+ motion_pred_np = torch.cat(motion_pred_list, dim=0).cpu().numpy()
+ gt_mu, gt_cov = calculate_activation_statistics(motion_annotation_np)
+ mu, cov= calculate_activation_statistics(motion_pred_np)
+
+ diversity_real = calculate_diversity(motion_annotation_np, 300 if nb_sample > 300 else 100)
+ diversity = calculate_diversity(motion_pred_np, 300 if nb_sample > 300 else 100)
+
+ R_precision_real = R_precision_real / nb_sample
+ R_precision = R_precision / nb_sample
+
+ matching_score_real = matching_score_real / nb_sample
+ matching_score_pred = matching_score_pred / nb_sample
+
+ fid = calculate_frechet_distance(gt_mu, gt_cov, mu, cov)
+
+ msg = f"--> \t Eva. Iter {nb_iter} :, FID. {fid:.4f}, Diversity Real. {diversity_real:.4f}, Diversity. {diversity:.4f}, R_precision_real. {R_precision_real}, R_precision. {R_precision}, matching_score_real. {matching_score_real}, matching_score_pred. {matching_score_pred}"
+ logger.info(msg)
+
+ if draw:
+ writer.add_scalar('./Test/FID', fid, nb_iter)
+ writer.add_scalar('./Test/Diversity', diversity, nb_iter)
+ writer.add_scalar('./Test/top1', R_precision[0], nb_iter)
+ writer.add_scalar('./Test/top2', R_precision[1], nb_iter)
+ writer.add_scalar('./Test/top3', R_precision[2], nb_iter)
+ writer.add_scalar('./Test/matching_score', matching_score_pred, nb_iter)
+
+
+ if nb_iter % 5000 == 0 :
+ for ii in range(4):
+ tensorborad_add_video_xyz(writer, draw_org[ii], nb_iter, tag='./Vis/org_eval'+str(ii), nb_vis=1, title_batch=[draw_text[ii]], outname=[os.path.join(out_dir, 'gt'+str(ii)+'.gif')] if savegif else None)
+
+ if nb_iter % 5000 == 0 :
+ for ii in range(4):
+ tensorborad_add_video_xyz(writer, draw_pred[ii], nb_iter, tag='./Vis/pred_eval'+str(ii), nb_vis=1, title_batch=[draw_text[ii]], outname=[os.path.join(out_dir, 'pred'+str(ii)+'.gif')] if savegif else None)
+
+
+ if fid < best_fid :
+ msg = f"--> --> \t FID Improved from {best_fid:.5f} to {fid:.5f} !!!"
+ logger.info(msg)
+ best_fid, best_iter = fid, nb_iter
+ if save:
+ torch.save({'net' : net.state_dict()}, os.path.join(out_dir, 'net_best_fid.pth'))
+
+ if abs(diversity_real - diversity) < abs(diversity_real - best_div) :
+ msg = f"--> --> \t Diversity Improved from {best_div:.5f} to {diversity:.5f} !!!"
+ logger.info(msg)
+ best_div = diversity
+ if save:
+ torch.save({'net' : net.state_dict()}, os.path.join(out_dir, 'net_best_div.pth'))
+
+ if R_precision[0] > best_top1 :
+ msg = f"--> --> \t Top1 Improved from {best_top1:.4f} to {R_precision[0]:.4f} !!!"
+ logger.info(msg)
+ best_top1 = R_precision[0]
+ if save:
+ torch.save({'net' : net.state_dict()}, os.path.join(out_dir, 'net_best_top1.pth'))
+
+ if R_precision[1] > best_top2 :
+ msg = f"--> --> \t Top2 Improved from {best_top2:.4f} to {R_precision[1]:.4f} !!!"
+ logger.info(msg)
+ best_top2 = R_precision[1]
+
+ if R_precision[2] > best_top3 :
+ msg = f"--> --> \t Top3 Improved from {best_top3:.4f} to {R_precision[2]:.4f} !!!"
+ logger.info(msg)
+ best_top3 = R_precision[2]
+
+ if matching_score_pred < best_matching :
+ msg = f"--> --> \t matching_score Improved from {best_matching:.5f} to {matching_score_pred:.5f} !!!"
+ logger.info(msg)
+ best_matching = matching_score_pred
+ if save:
+ torch.save({'net' : net.state_dict()}, os.path.join(out_dir, 'net_best_matching.pth'))
+
+ if save:
+ torch.save({'net' : net.state_dict()}, os.path.join(out_dir, 'net_last.pth'))
+
+ net.train()
+ return best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, writer, logger
+
+
+@torch.no_grad()
+def evaluation_transformer(out_dir, val_loader, net, trans, logger, writer, nb_iter, best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, clip_model, eval_wrapper, draw = True, save = True, savegif=False) :
+
+ trans.eval()
+ nb_sample = 0
+
+ draw_org = []
+ draw_pred = []
+ draw_text = []
+ draw_text_pred = []
+
+ motion_annotation_list = []
+ motion_pred_list = []
+ R_precision_real = 0
+ R_precision = 0
+ matching_score_real = 0
+ matching_score_pred = 0
+
+ nb_sample = 0
+ for i in range(1):
+ for batch in val_loader:
+ word_embeddings, pos_one_hots, clip_text, sent_len, pose, m_length, token, name = batch
+
+ bs, seq = pose.shape[:2]
+ num_joints = 21 if pose.shape[-1] == 251 else 22
+
+ text = clip.tokenize(clip_text, truncate=True).cuda()
+
+ feat_clip_text = clip_model.encode_text(text).float()
+ pred_pose_eval = torch.zeros((bs, seq, pose.shape[-1])).cuda()
+ pred_len = torch.ones(bs).long()
+
+ for k in range(bs):
+ try:
+ index_motion = trans.sample(feat_clip_text[k:k+1], False)
+ except:
+ index_motion = torch.ones(1,1).cuda().long()
+
+ pred_pose = net.forward_decoder(index_motion)
+ cur_len = pred_pose.shape[1]
+
+ pred_len[k] = min(cur_len, seq)
+ pred_pose_eval[k:k+1, :cur_len] = pred_pose[:, :seq]
+
+ if draw:
+ pred_denorm = val_loader.dataset.inv_transform(pred_pose.detach().cpu().numpy())
+ pred_xyz = recover_from_ric(torch.from_numpy(pred_denorm).float().cuda(), num_joints)
+
+ if i == 0 and k < 4:
+ draw_pred.append(pred_xyz)
+ draw_text_pred.append(clip_text[k])
+
+ et_pred, em_pred = eval_wrapper.get_co_embeddings(word_embeddings, pos_one_hots, sent_len, pred_pose_eval, pred_len)
+
+ if i == 0:
+ pose = pose.cuda().float()
+
+ et, em = eval_wrapper.get_co_embeddings(word_embeddings, pos_one_hots, sent_len, pose, m_length)
+ motion_annotation_list.append(em)
+ motion_pred_list.append(em_pred)
+
+ if draw:
+ pose = val_loader.dataset.inv_transform(pose.detach().cpu().numpy())
+ pose_xyz = recover_from_ric(torch.from_numpy(pose).float().cuda(), num_joints)
+
+
+ for j in range(min(4, bs)):
+ draw_org.append(pose_xyz[j][:m_length[j]].unsqueeze(0))
+ draw_text.append(clip_text[j])
+
+ temp_R, temp_match = calculate_R_precision(et.cpu().numpy(), em.cpu().numpy(), top_k=3, sum_all=True)
+ R_precision_real += temp_R
+ matching_score_real += temp_match
+ temp_R, temp_match = calculate_R_precision(et_pred.cpu().numpy(), em_pred.cpu().numpy(), top_k=3, sum_all=True)
+ R_precision += temp_R
+ matching_score_pred += temp_match
+
+ nb_sample += bs
+
+ motion_annotation_np = torch.cat(motion_annotation_list, dim=0).cpu().numpy()
+ motion_pred_np = torch.cat(motion_pred_list, dim=0).cpu().numpy()
+ gt_mu, gt_cov = calculate_activation_statistics(motion_annotation_np)
+ mu, cov= calculate_activation_statistics(motion_pred_np)
+
+ diversity_real = calculate_diversity(motion_annotation_np, 300 if nb_sample > 300 else 100)
+ diversity = calculate_diversity(motion_pred_np, 300 if nb_sample > 300 else 100)
+
+ R_precision_real = R_precision_real / nb_sample
+ R_precision = R_precision / nb_sample
+
+ matching_score_real = matching_score_real / nb_sample
+ matching_score_pred = matching_score_pred / nb_sample
+
+
+ fid = calculate_frechet_distance(gt_mu, gt_cov, mu, cov)
+
+ msg = f"--> \t Eva. Iter {nb_iter} :, FID. {fid:.4f}, Diversity Real. {diversity_real:.4f}, Diversity. {diversity:.4f}, R_precision_real. {R_precision_real}, R_precision. {R_precision}, matching_score_real. {matching_score_real}, matching_score_pred. {matching_score_pred}"
+ logger.info(msg)
+
+
+ if draw:
+ writer.add_scalar('./Test/FID', fid, nb_iter)
+ writer.add_scalar('./Test/Diversity', diversity, nb_iter)
+ writer.add_scalar('./Test/top1', R_precision[0], nb_iter)
+ writer.add_scalar('./Test/top2', R_precision[1], nb_iter)
+ writer.add_scalar('./Test/top3', R_precision[2], nb_iter)
+ writer.add_scalar('./Test/matching_score', matching_score_pred, nb_iter)
+
+
+ if nb_iter % 10000 == 0 :
+ for ii in range(4):
+ tensorborad_add_video_xyz(writer, draw_org[ii], nb_iter, tag='./Vis/org_eval'+str(ii), nb_vis=1, title_batch=[draw_text[ii]], outname=[os.path.join(out_dir, 'gt'+str(ii)+'.gif')] if savegif else None)
+
+ if nb_iter % 10000 == 0 :
+ for ii in range(4):
+ tensorborad_add_video_xyz(writer, draw_pred[ii], nb_iter, tag='./Vis/pred_eval'+str(ii), nb_vis=1, title_batch=[draw_text_pred[ii]], outname=[os.path.join(out_dir, 'pred'+str(ii)+'.gif')] if savegif else None)
+
+
+ if fid < best_fid :
+ msg = f"--> --> \t FID Improved from {best_fid:.5f} to {fid:.5f} !!!"
+ logger.info(msg)
+ best_fid, best_iter = fid, nb_iter
+ if save:
+ torch.save({'trans' : trans.state_dict()}, os.path.join(out_dir, 'net_best_fid.pth'))
+
+ if matching_score_pred < best_matching :
+ msg = f"--> --> \t matching_score Improved from {best_matching:.5f} to {matching_score_pred:.5f} !!!"
+ logger.info(msg)
+ best_matching = matching_score_pred
+
+ if abs(diversity_real - diversity) < abs(diversity_real - best_div) :
+ msg = f"--> --> \t Diversity Improved from {best_div:.5f} to {diversity:.5f} !!!"
+ logger.info(msg)
+ best_div = diversity
+
+ if R_precision[0] > best_top1 :
+ msg = f"--> --> \t Top1 Improved from {best_top1:.4f} to {R_precision[0]:.4f} !!!"
+ logger.info(msg)
+ best_top1 = R_precision[0]
+
+ if R_precision[1] > best_top2 :
+ msg = f"--> --> \t Top2 Improved from {best_top2:.4f} to {R_precision[1]:.4f} !!!"
+ logger.info(msg)
+ best_top2 = R_precision[1]
+
+ if R_precision[2] > best_top3 :
+ msg = f"--> --> \t Top3 Improved from {best_top3:.4f} to {R_precision[2]:.4f} !!!"
+ logger.info(msg)
+ best_top3 = R_precision[2]
+
+ if save:
+ torch.save({'trans' : trans.state_dict()}, os.path.join(out_dir, 'net_last.pth'))
+
+ trans.train()
+ return best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, writer, logger
+
+
+@torch.no_grad()
+def evaluation_transformer_test(out_dir, val_loader, net, trans, logger, writer, nb_iter, best_fid, best_iter, best_div, best_top1, best_top2, best_top3, best_matching, best_multi, clip_model, eval_wrapper, draw = True, save = True, savegif=False, savenpy=False) :
+
+ trans.eval()
+ nb_sample = 0
+
+ draw_org = []
+ draw_pred = []
+ draw_text = []
+ draw_text_pred = []
+ draw_name = []
+
+ motion_annotation_list = []
+ motion_pred_list = []
+ motion_multimodality = []
+ R_precision_real = 0
+ R_precision = 0
+ matching_score_real = 0
+ matching_score_pred = 0
+
+ nb_sample = 0
+
+ for batch in val_loader:
+
+ word_embeddings, pos_one_hots, clip_text, sent_len, pose, m_length, token, name = batch
+ bs, seq = pose.shape[:2]
+ num_joints = 21 if pose.shape[-1] == 251 else 22
+
+ text = clip.tokenize(clip_text, truncate=True).cuda()
+
+ feat_clip_text = clip_model.encode_text(text).float()
+ motion_multimodality_batch = []
+ for i in range(30):
+ pred_pose_eval = torch.zeros((bs, seq, pose.shape[-1])).cuda()
+ pred_len = torch.ones(bs).long()
+
+ for k in range(bs):
+ try:
+ index_motion = trans.sample(feat_clip_text[k:k+1], True)
+ except:
+ index_motion = torch.ones(1,1).cuda().long()
+
+ pred_pose = net.forward_decoder(index_motion)
+ cur_len = pred_pose.shape[1]
+
+ pred_len[k] = min(cur_len, seq)
+ pred_pose_eval[k:k+1, :cur_len] = pred_pose[:, :seq]
+
+ if i == 0 and (draw or savenpy):
+ pred_denorm = val_loader.dataset.inv_transform(pred_pose.detach().cpu().numpy())
+ pred_xyz = recover_from_ric(torch.from_numpy(pred_denorm).float().cuda(), num_joints)
+
+ if savenpy:
+ np.save(os.path.join(out_dir, name[k]+'_pred.npy'), pred_xyz.detach().cpu().numpy())
+
+ if draw:
+ if i == 0:
+ draw_pred.append(pred_xyz)
+ draw_text_pred.append(clip_text[k])
+ draw_name.append(name[k])
+
+ et_pred, em_pred = eval_wrapper.get_co_embeddings(word_embeddings, pos_one_hots, sent_len, pred_pose_eval, pred_len)
+
+ motion_multimodality_batch.append(em_pred.reshape(bs, 1, -1))
+
+ if i == 0:
+ pose = pose.cuda().float()
+
+ et, em = eval_wrapper.get_co_embeddings(word_embeddings, pos_one_hots, sent_len, pose, m_length)
+ motion_annotation_list.append(em)
+ motion_pred_list.append(em_pred)
+
+ if draw or savenpy:
+ pose = val_loader.dataset.inv_transform(pose.detach().cpu().numpy())
+ pose_xyz = recover_from_ric(torch.from_numpy(pose).float().cuda(), num_joints)
+
+ if savenpy:
+ for j in range(bs):
+ np.save(os.path.join(out_dir, name[j]+'_gt.npy'), pose_xyz[j][:m_length[j]].unsqueeze(0).cpu().numpy())
+
+ if draw:
+ for j in range(bs):
+ draw_org.append(pose_xyz[j][:m_length[j]].unsqueeze(0))
+ draw_text.append(clip_text[j])
+
+ temp_R, temp_match = calculate_R_precision(et.cpu().numpy(), em.cpu().numpy(), top_k=3, sum_all=True)
+ R_precision_real += temp_R
+ matching_score_real += temp_match
+ temp_R, temp_match = calculate_R_precision(et_pred.cpu().numpy(), em_pred.cpu().numpy(), top_k=3, sum_all=True)
+ R_precision += temp_R
+ matching_score_pred += temp_match
+
+ nb_sample += bs
+
+ motion_multimodality.append(torch.cat(motion_multimodality_batch, dim=1))
+
+ motion_annotation_np = torch.cat(motion_annotation_list, dim=0).cpu().numpy()
+ motion_pred_np = torch.cat(motion_pred_list, dim=0).cpu().numpy()
+ gt_mu, gt_cov = calculate_activation_statistics(motion_annotation_np)
+ mu, cov= calculate_activation_statistics(motion_pred_np)
+
+ diversity_real = calculate_diversity(motion_annotation_np, 300 if nb_sample > 300 else 100)
+ diversity = calculate_diversity(motion_pred_np, 300 if nb_sample > 300 else 100)
+
+ R_precision_real = R_precision_real / nb_sample
+ R_precision = R_precision / nb_sample
+
+ matching_score_real = matching_score_real / nb_sample
+ matching_score_pred = matching_score_pred / nb_sample
+
+ multimodality = 0
+ motion_multimodality = torch.cat(motion_multimodality, dim=0).cpu().numpy()
+ multimodality = calculate_multimodality(motion_multimodality, 10)
+
+ fid = calculate_frechet_distance(gt_mu, gt_cov, mu, cov)
+
+ msg = f"--> \t Eva. Iter {nb_iter} :, FID. {fid:.4f}, Diversity Real. {diversity_real:.4f}, Diversity. {diversity:.4f}, R_precision_real. {R_precision_real}, R_precision. {R_precision}, matching_score_real. {matching_score_real}, matching_score_pred. {matching_score_pred}, multimodality. {multimodality:.4f}"
+ logger.info(msg)
+
+
+ if draw:
+ for ii in range(len(draw_org)):
+ tensorborad_add_video_xyz(writer, draw_org[ii], nb_iter, tag='./Vis/'+draw_name[ii]+'_org', nb_vis=1, title_batch=[draw_text[ii]], outname=[os.path.join(out_dir, draw_name[ii]+'_skel_gt.gif')] if savegif else None)
+
+ tensorborad_add_video_xyz(writer, draw_pred[ii], nb_iter, tag='./Vis/'+draw_name[ii]+'_pred', nb_vis=1, title_batch=[draw_text_pred[ii]], outname=[os.path.join(out_dir, draw_name[ii]+'_skel_pred.gif')] if savegif else None)
+
+ trans.train()
+ return fid, best_iter, diversity, R_precision[0], R_precision[1], R_precision[2], matching_score_pred, multimodality, writer, logger
+
+# (X - X_train)*(X - X_train) = -2X*X_train + X*X + X_train*X_train
+def euclidean_distance_matrix(matrix1, matrix2):
+ """
+ Params:
+ -- matrix1: N1 x D
+ -- matrix2: N2 x D
+ Returns:
+ -- dist: N1 x N2
+ dist[i, j] == distance(matrix1[i], matrix2[j])
+ """
+ assert matrix1.shape[1] == matrix2.shape[1]
+ d1 = -2 * np.dot(matrix1, matrix2.T) # shape (num_test, num_train)
+ d2 = np.sum(np.square(matrix1), axis=1, keepdims=True) # shape (num_test, 1)
+ d3 = np.sum(np.square(matrix2), axis=1) # shape (num_train, )
+ dists = np.sqrt(d1 + d2 + d3) # broadcasting
+ return dists
+
+
+
+def calculate_top_k(mat, top_k):
+ size = mat.shape[0]
+ gt_mat = np.expand_dims(np.arange(size), 1).repeat(size, 1)
+ bool_mat = (mat == gt_mat)
+ correct_vec = False
+ top_k_list = []
+ for i in range(top_k):
+# print(correct_vec, bool_mat[:, i])
+ correct_vec = (correct_vec | bool_mat[:, i])
+ # print(correct_vec)
+ top_k_list.append(correct_vec[:, None])
+ top_k_mat = np.concatenate(top_k_list, axis=1)
+ return top_k_mat
+
+
+def calculate_R_precision(embedding1, embedding2, top_k, sum_all=False):
+ dist_mat = euclidean_distance_matrix(embedding1, embedding2)
+ matching_score = dist_mat.trace()
+ argmax = np.argsort(dist_mat, axis=1)
+ top_k_mat = calculate_top_k(argmax, top_k)
+ if sum_all:
+ return top_k_mat.sum(axis=0), matching_score
+ else:
+ return top_k_mat, matching_score
+
+def calculate_multimodality(activation, multimodality_times):
+ assert len(activation.shape) == 3
+ assert activation.shape[1] > multimodality_times
+ num_per_sent = activation.shape[1]
+
+ first_dices = np.random.choice(num_per_sent, multimodality_times, replace=False)
+ second_dices = np.random.choice(num_per_sent, multimodality_times, replace=False)
+ dist = linalg.norm(activation[:, first_dices] - activation[:, second_dices], axis=2)
+ return dist.mean()
+
+
+def calculate_diversity(activation, diversity_times):
+ assert len(activation.shape) == 2
+ assert activation.shape[0] > diversity_times
+ num_samples = activation.shape[0]
+
+ first_indices = np.random.choice(num_samples, diversity_times, replace=False)
+ second_indices = np.random.choice(num_samples, diversity_times, replace=False)
+ dist = linalg.norm(activation[first_indices] - activation[second_indices], axis=1)
+ return dist.mean()
+
+
+
+def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):
+
+ mu1 = np.atleast_1d(mu1)
+ mu2 = np.atleast_1d(mu2)
+
+ sigma1 = np.atleast_2d(sigma1)
+ sigma2 = np.atleast_2d(sigma2)
+
+ assert mu1.shape == mu2.shape, \
+ 'Training and test mean vectors have different lengths'
+ assert sigma1.shape == sigma2.shape, \
+ 'Training and test covariances have different dimensions'
+
+ diff = mu1 - mu2
+
+ # Product might be almost singular
+ covmean, _ = linalg.sqrtm(sigma1.dot(sigma2), disp=False)
+ if not np.isfinite(covmean).all():
+ msg = ('fid calculation produces singular product; '
+ 'adding %s to diagonal of cov estimates') % eps
+ print(msg)
+ offset = np.eye(sigma1.shape[0]) * eps
+ covmean = linalg.sqrtm((sigma1 + offset).dot(sigma2 + offset))
+
+ # Numerical error might give slight imaginary component
+ if np.iscomplexobj(covmean):
+ if not np.allclose(np.diagonal(covmean).imag, 0, atol=1e-3):
+ m = np.max(np.abs(covmean.imag))
+ raise ValueError('Imaginary component {}'.format(m))
+ covmean = covmean.real
+
+ tr_covmean = np.trace(covmean)
+
+ return (diff.dot(diff) + np.trace(sigma1)
+ + np.trace(sigma2) - 2 * tr_covmean)
+
+
+
+def calculate_activation_statistics(activations):
+
+ mu = np.mean(activations, axis=0)
+ cov = np.cov(activations, rowvar=False)
+ return mu, cov
+
+
+def calculate_frechet_feature_distance(feature_list1, feature_list2):
+ feature_list1 = np.stack(feature_list1)
+ feature_list2 = np.stack(feature_list2)
+
+ # normalize the scale
+ mean = np.mean(feature_list1, axis=0)
+ std = np.std(feature_list1, axis=0) + 1e-10
+ feature_list1 = (feature_list1 - mean) / std
+ feature_list2 = (feature_list2 - mean) / std
+
+ dist = calculate_frechet_distance(
+ mu1=np.mean(feature_list1, axis=0),
+ sigma1=np.cov(feature_list1, rowvar=False),
+ mu2=np.mean(feature_list2, axis=0),
+ sigma2=np.cov(feature_list2, rowvar=False),
+ )
+ return dist
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/utils/losses.py b/generate_human_motion/VQTrans/utils/losses.py
new file mode 100644
index 0000000000000000000000000000000000000000..1998161032731fc2c3edae701700679c00fd00d0
--- /dev/null
+++ b/generate_human_motion/VQTrans/utils/losses.py
@@ -0,0 +1,30 @@
+import torch
+import torch.nn as nn
+
+class ReConsLoss(nn.Module):
+ def __init__(self, recons_loss, nb_joints):
+ super(ReConsLoss, self).__init__()
+
+ if recons_loss == 'l1':
+ self.Loss = torch.nn.L1Loss()
+ elif recons_loss == 'l2' :
+ self.Loss = torch.nn.MSELoss()
+ elif recons_loss == 'l1_smooth' :
+ self.Loss = torch.nn.SmoothL1Loss()
+
+ # 4 global motion associated to root
+ # 12 local motion (3 local xyz, 3 vel xyz, 6 rot6d)
+ # 3 global vel xyz
+ # 4 foot contact
+ self.nb_joints = nb_joints
+ self.motion_dim = (nb_joints - 1) * 12 + 4 + 3 + 4
+
+ def forward(self, motion_pred, motion_gt) :
+ loss = self.Loss(motion_pred[..., : self.motion_dim], motion_gt[..., :self.motion_dim])
+ return loss
+
+ def forward_vel(self, motion_pred, motion_gt) :
+ loss = self.Loss(motion_pred[..., 4 : (self.nb_joints - 1) * 3 + 4], motion_gt[..., 4 : (self.nb_joints - 1) * 3 + 4])
+ return loss
+
+
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/utils/motion_process.py b/generate_human_motion/VQTrans/utils/motion_process.py
new file mode 100644
index 0000000000000000000000000000000000000000..6347166876fc59d2bf1836bcf0307387792c9cda
--- /dev/null
+++ b/generate_human_motion/VQTrans/utils/motion_process.py
@@ -0,0 +1,59 @@
+import torch
+from quaternion import quaternion_to_cont6d, qrot, qinv
+
+def recover_root_rot_pos(data):
+ rot_vel = data[..., 0]
+ r_rot_ang = torch.zeros_like(rot_vel).to(data.device)
+ '''Get Y-axis rotation from rotation velocity'''
+ r_rot_ang[..., 1:] = rot_vel[..., :-1]
+ r_rot_ang = torch.cumsum(r_rot_ang, dim=-1)
+
+ r_rot_quat = torch.zeros(data.shape[:-1] + (4,)).to(data.device)
+ r_rot_quat[..., 0] = torch.cos(r_rot_ang)
+ r_rot_quat[..., 2] = torch.sin(r_rot_ang)
+
+ r_pos = torch.zeros(data.shape[:-1] + (3,)).to(data.device)
+ r_pos[..., 1:, [0, 2]] = data[..., :-1, 1:3]
+ '''Add Y-axis rotation to root position'''
+ r_pos = qrot(qinv(r_rot_quat), r_pos)
+
+ r_pos = torch.cumsum(r_pos, dim=-2)
+
+ r_pos[..., 1] = data[..., 3]
+ return r_rot_quat, r_pos
+
+
+def recover_from_rot(data, joints_num, skeleton):
+ r_rot_quat, r_pos = recover_root_rot_pos(data)
+
+ r_rot_cont6d = quaternion_to_cont6d(r_rot_quat)
+
+ start_indx = 1 + 2 + 1 + (joints_num - 1) * 3
+ end_indx = start_indx + (joints_num - 1) * 6
+ cont6d_params = data[..., start_indx:end_indx]
+ # print(r_rot_cont6d.shape, cont6d_params.shape, r_pos.shape)
+ cont6d_params = torch.cat([r_rot_cont6d, cont6d_params], dim=-1)
+ cont6d_params = cont6d_params.view(-1, joints_num, 6)
+
+ positions = skeleton.forward_kinematics_cont6d(cont6d_params, r_pos)
+
+ return positions
+
+
+def recover_from_ric(data, joints_num):
+ r_rot_quat, r_pos = recover_root_rot_pos(data)
+ positions = data[..., 4:(joints_num - 1) * 3 + 4]
+ positions = positions.view(positions.shape[:-1] + (-1, 3))
+
+ '''Add Y-axis rotation to local joints'''
+ positions = qrot(qinv(r_rot_quat[..., None, :]).expand(positions.shape[:-1] + (4,)), positions)
+
+ '''Add root XZ to joints'''
+ positions[..., 0] += r_pos[..., 0:1]
+ positions[..., 2] += r_pos[..., 2:3]
+
+ '''Concate root and joints'''
+ positions = torch.cat([r_pos.unsqueeze(-2), positions], dim=-2)
+
+ return positions
+
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/utils/paramUtil.py b/generate_human_motion/VQTrans/utils/paramUtil.py
new file mode 100644
index 0000000000000000000000000000000000000000..a9f1708b85ca80a9051cb3675cec9b999a0d0e2b
--- /dev/null
+++ b/generate_human_motion/VQTrans/utils/paramUtil.py
@@ -0,0 +1,63 @@
+import numpy as np
+
+# Define a kinematic tree for the skeletal struture
+kit_kinematic_chain = [[0, 11, 12, 13, 14, 15], [0, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4], [3, 5, 6, 7], [3, 8, 9, 10]]
+
+kit_raw_offsets = np.array(
+ [
+ [0, 0, 0],
+ [0, 1, 0],
+ [0, 1, 0],
+ [0, 1, 0],
+ [0, 1, 0],
+ [1, 0, 0],
+ [0, -1, 0],
+ [0, -1, 0],
+ [-1, 0, 0],
+ [0, -1, 0],
+ [0, -1, 0],
+ [1, 0, 0],
+ [0, -1, 0],
+ [0, -1, 0],
+ [0, 0, 1],
+ [0, 0, 1],
+ [-1, 0, 0],
+ [0, -1, 0],
+ [0, -1, 0],
+ [0, 0, 1],
+ [0, 0, 1]
+ ]
+)
+
+t2m_raw_offsets = np.array([[0,0,0],
+ [1,0,0],
+ [-1,0,0],
+ [0,1,0],
+ [0,-1,0],
+ [0,-1,0],
+ [0,1,0],
+ [0,-1,0],
+ [0,-1,0],
+ [0,1,0],
+ [0,0,1],
+ [0,0,1],
+ [0,1,0],
+ [1,0,0],
+ [-1,0,0],
+ [0,0,1],
+ [0,-1,0],
+ [0,-1,0],
+ [0,-1,0],
+ [0,-1,0],
+ [0,-1,0],
+ [0,-1,0]])
+
+t2m_kinematic_chain = [[0, 2, 5, 8, 11], [0, 1, 4, 7, 10], [0, 3, 6, 9, 12, 15], [9, 14, 17, 19, 21], [9, 13, 16, 18, 20]]
+t2m_left_hand_chain = [[20, 22, 23, 24], [20, 34, 35, 36], [20, 25, 26, 27], [20, 31, 32, 33], [20, 28, 29, 30]]
+t2m_right_hand_chain = [[21, 43, 44, 45], [21, 46, 47, 48], [21, 40, 41, 42], [21, 37, 38, 39], [21, 49, 50, 51]]
+
+
+kit_tgt_skel_id = '03950'
+
+t2m_tgt_skel_id = '000021'
+
diff --git a/generate_human_motion/VQTrans/utils/quaternion.py b/generate_human_motion/VQTrans/utils/quaternion.py
new file mode 100644
index 0000000000000000000000000000000000000000..e2daa00aef1df60e43775864d1dd3d551f89ded8
--- /dev/null
+++ b/generate_human_motion/VQTrans/utils/quaternion.py
@@ -0,0 +1,423 @@
+# Copyright (c) 2018-present, Facebook, Inc.
+# All rights reserved.
+#
+# This source code is licensed under the license found in the
+# LICENSE file in the root directory of this source tree.
+#
+
+import torch
+import numpy as np
+
+_EPS4 = np.finfo(float).eps * 4.0
+
+_FLOAT_EPS = np.finfo(np.float).eps
+
+# PyTorch-backed implementations
+def qinv(q):
+ assert q.shape[-1] == 4, 'q must be a tensor of shape (*, 4)'
+ mask = torch.ones_like(q)
+ mask[..., 1:] = -mask[..., 1:]
+ return q * mask
+
+
+def qinv_np(q):
+ assert q.shape[-1] == 4, 'q must be a tensor of shape (*, 4)'
+ return qinv(torch.from_numpy(q).float()).numpy()
+
+
+def qnormalize(q):
+ assert q.shape[-1] == 4, 'q must be a tensor of shape (*, 4)'
+ return q / torch.norm(q, dim=-1, keepdim=True)
+
+
+def qmul(q, r):
+ """
+ Multiply quaternion(s) q with quaternion(s) r.
+ Expects two equally-sized tensors of shape (*, 4), where * denotes any number of dimensions.
+ Returns q*r as a tensor of shape (*, 4).
+ """
+ assert q.shape[-1] == 4
+ assert r.shape[-1] == 4
+
+ original_shape = q.shape
+
+ # Compute outer product
+ terms = torch.bmm(r.view(-1, 4, 1), q.view(-1, 1, 4))
+
+ w = terms[:, 0, 0] - terms[:, 1, 1] - terms[:, 2, 2] - terms[:, 3, 3]
+ x = terms[:, 0, 1] + terms[:, 1, 0] - terms[:, 2, 3] + terms[:, 3, 2]
+ y = terms[:, 0, 2] + terms[:, 1, 3] + terms[:, 2, 0] - terms[:, 3, 1]
+ z = terms[:, 0, 3] - terms[:, 1, 2] + terms[:, 2, 1] + terms[:, 3, 0]
+ return torch.stack((w, x, y, z), dim=1).view(original_shape)
+
+
+def qrot(q, v):
+ """
+ Rotate vector(s) v about the rotation described by quaternion(s) q.
+ Expects a tensor of shape (*, 4) for q and a tensor of shape (*, 3) for v,
+ where * denotes any number of dimensions.
+ Returns a tensor of shape (*, 3).
+ """
+ assert q.shape[-1] == 4
+ assert v.shape[-1] == 3
+ assert q.shape[:-1] == v.shape[:-1]
+
+ original_shape = list(v.shape)
+ # print(q.shape)
+ q = q.contiguous().view(-1, 4)
+ v = v.contiguous().view(-1, 3)
+
+ qvec = q[:, 1:]
+ uv = torch.cross(qvec, v, dim=1)
+ uuv = torch.cross(qvec, uv, dim=1)
+ return (v + 2 * (q[:, :1] * uv + uuv)).view(original_shape)
+
+
+def qeuler(q, order, epsilon=0, deg=True):
+ """
+ Convert quaternion(s) q to Euler angles.
+ Expects a tensor of shape (*, 4), where * denotes any number of dimensions.
+ Returns a tensor of shape (*, 3).
+ """
+ assert q.shape[-1] == 4
+
+ original_shape = list(q.shape)
+ original_shape[-1] = 3
+ q = q.view(-1, 4)
+
+ q0 = q[:, 0]
+ q1 = q[:, 1]
+ q2 = q[:, 2]
+ q3 = q[:, 3]
+
+ if order == 'xyz':
+ x = torch.atan2(2 * (q0 * q1 - q2 * q3), 1 - 2 * (q1 * q1 + q2 * q2))
+ y = torch.asin(torch.clamp(2 * (q1 * q3 + q0 * q2), -1 + epsilon, 1 - epsilon))
+ z = torch.atan2(2 * (q0 * q3 - q1 * q2), 1 - 2 * (q2 * q2 + q3 * q3))
+ elif order == 'yzx':
+ x = torch.atan2(2 * (q0 * q1 - q2 * q3), 1 - 2 * (q1 * q1 + q3 * q3))
+ y = torch.atan2(2 * (q0 * q2 - q1 * q3), 1 - 2 * (q2 * q2 + q3 * q3))
+ z = torch.asin(torch.clamp(2 * (q1 * q2 + q0 * q3), -1 + epsilon, 1 - epsilon))
+ elif order == 'zxy':
+ x = torch.asin(torch.clamp(2 * (q0 * q1 + q2 * q3), -1 + epsilon, 1 - epsilon))
+ y = torch.atan2(2 * (q0 * q2 - q1 * q3), 1 - 2 * (q1 * q1 + q2 * q2))
+ z = torch.atan2(2 * (q0 * q3 - q1 * q2), 1 - 2 * (q1 * q1 + q3 * q3))
+ elif order == 'xzy':
+ x = torch.atan2(2 * (q0 * q1 + q2 * q3), 1 - 2 * (q1 * q1 + q3 * q3))
+ y = torch.atan2(2 * (q0 * q2 + q1 * q3), 1 - 2 * (q2 * q2 + q3 * q3))
+ z = torch.asin(torch.clamp(2 * (q0 * q3 - q1 * q2), -1 + epsilon, 1 - epsilon))
+ elif order == 'yxz':
+ x = torch.asin(torch.clamp(2 * (q0 * q1 - q2 * q3), -1 + epsilon, 1 - epsilon))
+ y = torch.atan2(2 * (q1 * q3 + q0 * q2), 1 - 2 * (q1 * q1 + q2 * q2))
+ z = torch.atan2(2 * (q1 * q2 + q0 * q3), 1 - 2 * (q1 * q1 + q3 * q3))
+ elif order == 'zyx':
+ x = torch.atan2(2 * (q0 * q1 + q2 * q3), 1 - 2 * (q1 * q1 + q2 * q2))
+ y = torch.asin(torch.clamp(2 * (q0 * q2 - q1 * q3), -1 + epsilon, 1 - epsilon))
+ z = torch.atan2(2 * (q0 * q3 + q1 * q2), 1 - 2 * (q2 * q2 + q3 * q3))
+ else:
+ raise
+
+ if deg:
+ return torch.stack((x, y, z), dim=1).view(original_shape) * 180 / np.pi
+ else:
+ return torch.stack((x, y, z), dim=1).view(original_shape)
+
+
+# Numpy-backed implementations
+
+def qmul_np(q, r):
+ q = torch.from_numpy(q).contiguous().float()
+ r = torch.from_numpy(r).contiguous().float()
+ return qmul(q, r).numpy()
+
+
+def qrot_np(q, v):
+ q = torch.from_numpy(q).contiguous().float()
+ v = torch.from_numpy(v).contiguous().float()
+ return qrot(q, v).numpy()
+
+
+def qeuler_np(q, order, epsilon=0, use_gpu=False):
+ if use_gpu:
+ q = torch.from_numpy(q).cuda().float()
+ return qeuler(q, order, epsilon).cpu().numpy()
+ else:
+ q = torch.from_numpy(q).contiguous().float()
+ return qeuler(q, order, epsilon).numpy()
+
+
+def qfix(q):
+ """
+ Enforce quaternion continuity across the time dimension by selecting
+ the representation (q or -q) with minimal distance (or, equivalently, maximal dot product)
+ between two consecutive frames.
+
+ Expects a tensor of shape (L, J, 4), where L is the sequence length and J is the number of joints.
+ Returns a tensor of the same shape.
+ """
+ assert len(q.shape) == 3
+ assert q.shape[-1] == 4
+
+ result = q.copy()
+ dot_products = np.sum(q[1:] * q[:-1], axis=2)
+ mask = dot_products < 0
+ mask = (np.cumsum(mask, axis=0) % 2).astype(bool)
+ result[1:][mask] *= -1
+ return result
+
+
+def euler2quat(e, order, deg=True):
+ """
+ Convert Euler angles to quaternions.
+ """
+ assert e.shape[-1] == 3
+
+ original_shape = list(e.shape)
+ original_shape[-1] = 4
+
+ e = e.view(-1, 3)
+
+ ## if euler angles in degrees
+ if deg:
+ e = e * np.pi / 180.
+
+ x = e[:, 0]
+ y = e[:, 1]
+ z = e[:, 2]
+
+ rx = torch.stack((torch.cos(x / 2), torch.sin(x / 2), torch.zeros_like(x), torch.zeros_like(x)), dim=1)
+ ry = torch.stack((torch.cos(y / 2), torch.zeros_like(y), torch.sin(y / 2), torch.zeros_like(y)), dim=1)
+ rz = torch.stack((torch.cos(z / 2), torch.zeros_like(z), torch.zeros_like(z), torch.sin(z / 2)), dim=1)
+
+ result = None
+ for coord in order:
+ if coord == 'x':
+ r = rx
+ elif coord == 'y':
+ r = ry
+ elif coord == 'z':
+ r = rz
+ else:
+ raise
+ if result is None:
+ result = r
+ else:
+ result = qmul(result, r)
+
+ # Reverse antipodal representation to have a non-negative "w"
+ if order in ['xyz', 'yzx', 'zxy']:
+ result *= -1
+
+ return result.view(original_shape)
+
+
+def expmap_to_quaternion(e):
+ """
+ Convert axis-angle rotations (aka exponential maps) to quaternions.
+ Stable formula from "Practical Parameterization of Rotations Using the Exponential Map".
+ Expects a tensor of shape (*, 3), where * denotes any number of dimensions.
+ Returns a tensor of shape (*, 4).
+ """
+ assert e.shape[-1] == 3
+
+ original_shape = list(e.shape)
+ original_shape[-1] = 4
+ e = e.reshape(-1, 3)
+
+ theta = np.linalg.norm(e, axis=1).reshape(-1, 1)
+ w = np.cos(0.5 * theta).reshape(-1, 1)
+ xyz = 0.5 * np.sinc(0.5 * theta / np.pi) * e
+ return np.concatenate((w, xyz), axis=1).reshape(original_shape)
+
+
+def euler_to_quaternion(e, order):
+ """
+ Convert Euler angles to quaternions.
+ """
+ assert e.shape[-1] == 3
+
+ original_shape = list(e.shape)
+ original_shape[-1] = 4
+
+ e = e.reshape(-1, 3)
+
+ x = e[:, 0]
+ y = e[:, 1]
+ z = e[:, 2]
+
+ rx = np.stack((np.cos(x / 2), np.sin(x / 2), np.zeros_like(x), np.zeros_like(x)), axis=1)
+ ry = np.stack((np.cos(y / 2), np.zeros_like(y), np.sin(y / 2), np.zeros_like(y)), axis=1)
+ rz = np.stack((np.cos(z / 2), np.zeros_like(z), np.zeros_like(z), np.sin(z / 2)), axis=1)
+
+ result = None
+ for coord in order:
+ if coord == 'x':
+ r = rx
+ elif coord == 'y':
+ r = ry
+ elif coord == 'z':
+ r = rz
+ else:
+ raise
+ if result is None:
+ result = r
+ else:
+ result = qmul_np(result, r)
+
+ # Reverse antipodal representation to have a non-negative "w"
+ if order in ['xyz', 'yzx', 'zxy']:
+ result *= -1
+
+ return result.reshape(original_shape)
+
+
+def quaternion_to_matrix(quaternions):
+ """
+ Convert rotations given as quaternions to rotation matrices.
+ Args:
+ quaternions: quaternions with real part first,
+ as tensor of shape (..., 4).
+ Returns:
+ Rotation matrices as tensor of shape (..., 3, 3).
+ """
+ r, i, j, k = torch.unbind(quaternions, -1)
+ two_s = 2.0 / (quaternions * quaternions).sum(-1)
+
+ o = torch.stack(
+ (
+ 1 - two_s * (j * j + k * k),
+ two_s * (i * j - k * r),
+ two_s * (i * k + j * r),
+ two_s * (i * j + k * r),
+ 1 - two_s * (i * i + k * k),
+ two_s * (j * k - i * r),
+ two_s * (i * k - j * r),
+ two_s * (j * k + i * r),
+ 1 - two_s * (i * i + j * j),
+ ),
+ -1,
+ )
+ return o.reshape(quaternions.shape[:-1] + (3, 3))
+
+
+def quaternion_to_matrix_np(quaternions):
+ q = torch.from_numpy(quaternions).contiguous().float()
+ return quaternion_to_matrix(q).numpy()
+
+
+def quaternion_to_cont6d_np(quaternions):
+ rotation_mat = quaternion_to_matrix_np(quaternions)
+ cont_6d = np.concatenate([rotation_mat[..., 0], rotation_mat[..., 1]], axis=-1)
+ return cont_6d
+
+
+def quaternion_to_cont6d(quaternions):
+ rotation_mat = quaternion_to_matrix(quaternions)
+ cont_6d = torch.cat([rotation_mat[..., 0], rotation_mat[..., 1]], dim=-1)
+ return cont_6d
+
+
+def cont6d_to_matrix(cont6d):
+ assert cont6d.shape[-1] == 6, "The last dimension must be 6"
+ x_raw = cont6d[..., 0:3]
+ y_raw = cont6d[..., 3:6]
+
+ x = x_raw / torch.norm(x_raw, dim=-1, keepdim=True)
+ z = torch.cross(x, y_raw, dim=-1)
+ z = z / torch.norm(z, dim=-1, keepdim=True)
+
+ y = torch.cross(z, x, dim=-1)
+
+ x = x[..., None]
+ y = y[..., None]
+ z = z[..., None]
+
+ mat = torch.cat([x, y, z], dim=-1)
+ return mat
+
+
+def cont6d_to_matrix_np(cont6d):
+ q = torch.from_numpy(cont6d).contiguous().float()
+ return cont6d_to_matrix(q).numpy()
+
+
+def qpow(q0, t, dtype=torch.float):
+ ''' q0 : tensor of quaternions
+ t: tensor of powers
+ '''
+ q0 = qnormalize(q0)
+ theta0 = torch.acos(q0[..., 0])
+
+ ## if theta0 is close to zero, add epsilon to avoid NaNs
+ mask = (theta0 <= 10e-10) * (theta0 >= -10e-10)
+ theta0 = (1 - mask) * theta0 + mask * 10e-10
+ v0 = q0[..., 1:] / torch.sin(theta0).view(-1, 1)
+
+ if isinstance(t, torch.Tensor):
+ q = torch.zeros(t.shape + q0.shape)
+ theta = t.view(-1, 1) * theta0.view(1, -1)
+ else: ## if t is a number
+ q = torch.zeros(q0.shape)
+ theta = t * theta0
+
+ q[..., 0] = torch.cos(theta)
+ q[..., 1:] = v0 * torch.sin(theta).unsqueeze(-1)
+
+ return q.to(dtype)
+
+
+def qslerp(q0, q1, t):
+ '''
+ q0: starting quaternion
+ q1: ending quaternion
+ t: array of points along the way
+
+ Returns:
+ Tensor of Slerps: t.shape + q0.shape
+ '''
+
+ q0 = qnormalize(q0)
+ q1 = qnormalize(q1)
+ q_ = qpow(qmul(q1, qinv(q0)), t)
+
+ return qmul(q_,
+ q0.contiguous().view(torch.Size([1] * len(t.shape)) + q0.shape).expand(t.shape + q0.shape).contiguous())
+
+
+def qbetween(v0, v1):
+ '''
+ find the quaternion used to rotate v0 to v1
+ '''
+ assert v0.shape[-1] == 3, 'v0 must be of the shape (*, 3)'
+ assert v1.shape[-1] == 3, 'v1 must be of the shape (*, 3)'
+
+ v = torch.cross(v0, v1)
+ w = torch.sqrt((v0 ** 2).sum(dim=-1, keepdim=True) * (v1 ** 2).sum(dim=-1, keepdim=True)) + (v0 * v1).sum(dim=-1,
+ keepdim=True)
+ return qnormalize(torch.cat([w, v], dim=-1))
+
+
+def qbetween_np(v0, v1):
+ '''
+ find the quaternion used to rotate v0 to v1
+ '''
+ assert v0.shape[-1] == 3, 'v0 must be of the shape (*, 3)'
+ assert v1.shape[-1] == 3, 'v1 must be of the shape (*, 3)'
+
+ v0 = torch.from_numpy(v0).float()
+ v1 = torch.from_numpy(v1).float()
+ return qbetween(v0, v1).numpy()
+
+
+def lerp(p0, p1, t):
+ if not isinstance(t, torch.Tensor):
+ t = torch.Tensor([t])
+
+ new_shape = t.shape + p0.shape
+ new_view_t = t.shape + torch.Size([1] * len(p0.shape))
+ new_view_p = torch.Size([1] * len(t.shape)) + p0.shape
+ p0 = p0.view(new_view_p).expand(new_shape)
+ p1 = p1.view(new_view_p).expand(new_shape)
+ t = t.view(new_view_t).expand(new_shape)
+
+ return p0 + t * (p1 - p0)
diff --git a/generate_human_motion/VQTrans/utils/rotation_conversions.py b/generate_human_motion/VQTrans/utils/rotation_conversions.py
new file mode 100644
index 0000000000000000000000000000000000000000..1006e8a3117b231a7a456d5b826e76347fe0bfd4
--- /dev/null
+++ b/generate_human_motion/VQTrans/utils/rotation_conversions.py
@@ -0,0 +1,532 @@
+# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
+# Check PYTORCH3D_LICENCE before use
+
+import functools
+from typing import Optional
+
+import torch
+import torch.nn.functional as F
+
+
+"""
+The transformation matrices returned from the functions in this file assume
+the points on which the transformation will be applied are column vectors.
+i.e. the R matrix is structured as
+ R = [
+ [Rxx, Rxy, Rxz],
+ [Ryx, Ryy, Ryz],
+ [Rzx, Rzy, Rzz],
+ ] # (3, 3)
+This matrix can be applied to column vectors by post multiplication
+by the points e.g.
+ points = [[0], [1], [2]] # (3 x 1) xyz coordinates of a point
+ transformed_points = R * points
+To apply the same matrix to points which are row vectors, the R matrix
+can be transposed and pre multiplied by the points:
+e.g.
+ points = [[0, 1, 2]] # (1 x 3) xyz coordinates of a point
+ transformed_points = points * R.transpose(1, 0)
+"""
+
+
+def quaternion_to_matrix(quaternions):
+ """
+ Convert rotations given as quaternions to rotation matrices.
+ Args:
+ quaternions: quaternions with real part first,
+ as tensor of shape (..., 4).
+ Returns:
+ Rotation matrices as tensor of shape (..., 3, 3).
+ """
+ r, i, j, k = torch.unbind(quaternions, -1)
+ two_s = 2.0 / (quaternions * quaternions).sum(-1)
+
+ o = torch.stack(
+ (
+ 1 - two_s * (j * j + k * k),
+ two_s * (i * j - k * r),
+ two_s * (i * k + j * r),
+ two_s * (i * j + k * r),
+ 1 - two_s * (i * i + k * k),
+ two_s * (j * k - i * r),
+ two_s * (i * k - j * r),
+ two_s * (j * k + i * r),
+ 1 - two_s * (i * i + j * j),
+ ),
+ -1,
+ )
+ return o.reshape(quaternions.shape[:-1] + (3, 3))
+
+
+def _copysign(a, b):
+ """
+ Return a tensor where each element has the absolute value taken from the,
+ corresponding element of a, with sign taken from the corresponding
+ element of b. This is like the standard copysign floating-point operation,
+ but is not careful about negative 0 and NaN.
+ Args:
+ a: source tensor.
+ b: tensor whose signs will be used, of the same shape as a.
+ Returns:
+ Tensor of the same shape as a with the signs of b.
+ """
+ signs_differ = (a < 0) != (b < 0)
+ return torch.where(signs_differ, -a, a)
+
+
+def _sqrt_positive_part(x):
+ """
+ Returns torch.sqrt(torch.max(0, x))
+ but with a zero subgradient where x is 0.
+ """
+ ret = torch.zeros_like(x)
+ positive_mask = x > 0
+ ret[positive_mask] = torch.sqrt(x[positive_mask])
+ return ret
+
+
+def matrix_to_quaternion(matrix):
+ """
+ Convert rotations given as rotation matrices to quaternions.
+ Args:
+ matrix: Rotation matrices as tensor of shape (..., 3, 3).
+ Returns:
+ quaternions with real part first, as tensor of shape (..., 4).
+ """
+ if matrix.size(-1) != 3 or matrix.size(-2) != 3:
+ raise ValueError(f"Invalid rotation matrix shape f{matrix.shape}.")
+ m00 = matrix[..., 0, 0]
+ m11 = matrix[..., 1, 1]
+ m22 = matrix[..., 2, 2]
+ o0 = 0.5 * _sqrt_positive_part(1 + m00 + m11 + m22)
+ x = 0.5 * _sqrt_positive_part(1 + m00 - m11 - m22)
+ y = 0.5 * _sqrt_positive_part(1 - m00 + m11 - m22)
+ z = 0.5 * _sqrt_positive_part(1 - m00 - m11 + m22)
+ o1 = _copysign(x, matrix[..., 2, 1] - matrix[..., 1, 2])
+ o2 = _copysign(y, matrix[..., 0, 2] - matrix[..., 2, 0])
+ o3 = _copysign(z, matrix[..., 1, 0] - matrix[..., 0, 1])
+ return torch.stack((o0, o1, o2, o3), -1)
+
+
+def _axis_angle_rotation(axis: str, angle):
+ """
+ Return the rotation matrices for one of the rotations about an axis
+ of which Euler angles describe, for each value of the angle given.
+ Args:
+ axis: Axis label "X" or "Y or "Z".
+ angle: any shape tensor of Euler angles in radians
+ Returns:
+ Rotation matrices as tensor of shape (..., 3, 3).
+ """
+
+ cos = torch.cos(angle)
+ sin = torch.sin(angle)
+ one = torch.ones_like(angle)
+ zero = torch.zeros_like(angle)
+
+ if axis == "X":
+ R_flat = (one, zero, zero, zero, cos, -sin, zero, sin, cos)
+ if axis == "Y":
+ R_flat = (cos, zero, sin, zero, one, zero, -sin, zero, cos)
+ if axis == "Z":
+ R_flat = (cos, -sin, zero, sin, cos, zero, zero, zero, one)
+
+ return torch.stack(R_flat, -1).reshape(angle.shape + (3, 3))
+
+
+def euler_angles_to_matrix(euler_angles, convention: str):
+ """
+ Convert rotations given as Euler angles in radians to rotation matrices.
+ Args:
+ euler_angles: Euler angles in radians as tensor of shape (..., 3).
+ convention: Convention string of three uppercase letters from
+ {"X", "Y", and "Z"}.
+ Returns:
+ Rotation matrices as tensor of shape (..., 3, 3).
+ """
+ if euler_angles.dim() == 0 or euler_angles.shape[-1] != 3:
+ raise ValueError("Invalid input euler angles.")
+ if len(convention) != 3:
+ raise ValueError("Convention must have 3 letters.")
+ if convention[1] in (convention[0], convention[2]):
+ raise ValueError(f"Invalid convention {convention}.")
+ for letter in convention:
+ if letter not in ("X", "Y", "Z"):
+ raise ValueError(f"Invalid letter {letter} in convention string.")
+ matrices = map(_axis_angle_rotation, convention, torch.unbind(euler_angles, -1))
+ return functools.reduce(torch.matmul, matrices)
+
+
+def _angle_from_tan(
+ axis: str, other_axis: str, data, horizontal: bool, tait_bryan: bool
+):
+ """
+ Extract the first or third Euler angle from the two members of
+ the matrix which are positive constant times its sine and cosine.
+ Args:
+ axis: Axis label "X" or "Y or "Z" for the angle we are finding.
+ other_axis: Axis label "X" or "Y or "Z" for the middle axis in the
+ convention.
+ data: Rotation matrices as tensor of shape (..., 3, 3).
+ horizontal: Whether we are looking for the angle for the third axis,
+ which means the relevant entries are in the same row of the
+ rotation matrix. If not, they are in the same column.
+ tait_bryan: Whether the first and third axes in the convention differ.
+ Returns:
+ Euler Angles in radians for each matrix in data as a tensor
+ of shape (...).
+ """
+
+ i1, i2 = {"X": (2, 1), "Y": (0, 2), "Z": (1, 0)}[axis]
+ if horizontal:
+ i2, i1 = i1, i2
+ even = (axis + other_axis) in ["XY", "YZ", "ZX"]
+ if horizontal == even:
+ return torch.atan2(data[..., i1], data[..., i2])
+ if tait_bryan:
+ return torch.atan2(-data[..., i2], data[..., i1])
+ return torch.atan2(data[..., i2], -data[..., i1])
+
+
+def _index_from_letter(letter: str):
+ if letter == "X":
+ return 0
+ if letter == "Y":
+ return 1
+ if letter == "Z":
+ return 2
+
+
+def matrix_to_euler_angles(matrix, convention: str):
+ """
+ Convert rotations given as rotation matrices to Euler angles in radians.
+ Args:
+ matrix: Rotation matrices as tensor of shape (..., 3, 3).
+ convention: Convention string of three uppercase letters.
+ Returns:
+ Euler angles in radians as tensor of shape (..., 3).
+ """
+ if len(convention) != 3:
+ raise ValueError("Convention must have 3 letters.")
+ if convention[1] in (convention[0], convention[2]):
+ raise ValueError(f"Invalid convention {convention}.")
+ for letter in convention:
+ if letter not in ("X", "Y", "Z"):
+ raise ValueError(f"Invalid letter {letter} in convention string.")
+ if matrix.size(-1) != 3 or matrix.size(-2) != 3:
+ raise ValueError(f"Invalid rotation matrix shape f{matrix.shape}.")
+ i0 = _index_from_letter(convention[0])
+ i2 = _index_from_letter(convention[2])
+ tait_bryan = i0 != i2
+ if tait_bryan:
+ central_angle = torch.asin(
+ matrix[..., i0, i2] * (-1.0 if i0 - i2 in [-1, 2] else 1.0)
+ )
+ else:
+ central_angle = torch.acos(matrix[..., i0, i0])
+
+ o = (
+ _angle_from_tan(
+ convention[0], convention[1], matrix[..., i2], False, tait_bryan
+ ),
+ central_angle,
+ _angle_from_tan(
+ convention[2], convention[1], matrix[..., i0, :], True, tait_bryan
+ ),
+ )
+ return torch.stack(o, -1)
+
+
+def random_quaternions(
+ n: int, dtype: Optional[torch.dtype] = None, device=None, requires_grad=False
+):
+ """
+ Generate random quaternions representing rotations,
+ i.e. versors with nonnegative real part.
+ Args:
+ n: Number of quaternions in a batch to return.
+ dtype: Type to return.
+ device: Desired device of returned tensor. Default:
+ uses the current device for the default tensor type.
+ requires_grad: Whether the resulting tensor should have the gradient
+ flag set.
+ Returns:
+ Quaternions as tensor of shape (N, 4).
+ """
+ o = torch.randn((n, 4), dtype=dtype, device=device, requires_grad=requires_grad)
+ s = (o * o).sum(1)
+ o = o / _copysign(torch.sqrt(s), o[:, 0])[:, None]
+ return o
+
+
+def random_rotations(
+ n: int, dtype: Optional[torch.dtype] = None, device=None, requires_grad=False
+):
+ """
+ Generate random rotations as 3x3 rotation matrices.
+ Args:
+ n: Number of rotation matrices in a batch to return.
+ dtype: Type to return.
+ device: Device of returned tensor. Default: if None,
+ uses the current device for the default tensor type.
+ requires_grad: Whether the resulting tensor should have the gradient
+ flag set.
+ Returns:
+ Rotation matrices as tensor of shape (n, 3, 3).
+ """
+ quaternions = random_quaternions(
+ n, dtype=dtype, device=device, requires_grad=requires_grad
+ )
+ return quaternion_to_matrix(quaternions)
+
+
+def random_rotation(
+ dtype: Optional[torch.dtype] = None, device=None, requires_grad=False
+):
+ """
+ Generate a single random 3x3 rotation matrix.
+ Args:
+ dtype: Type to return
+ device: Device of returned tensor. Default: if None,
+ uses the current device for the default tensor type
+ requires_grad: Whether the resulting tensor should have the gradient
+ flag set
+ Returns:
+ Rotation matrix as tensor of shape (3, 3).
+ """
+ return random_rotations(1, dtype, device, requires_grad)[0]
+
+
+def standardize_quaternion(quaternions):
+ """
+ Convert a unit quaternion to a standard form: one in which the real
+ part is non negative.
+ Args:
+ quaternions: Quaternions with real part first,
+ as tensor of shape (..., 4).
+ Returns:
+ Standardized quaternions as tensor of shape (..., 4).
+ """
+ return torch.where(quaternions[..., 0:1] < 0, -quaternions, quaternions)
+
+
+def quaternion_raw_multiply(a, b):
+ """
+ Multiply two quaternions.
+ Usual torch rules for broadcasting apply.
+ Args:
+ a: Quaternions as tensor of shape (..., 4), real part first.
+ b: Quaternions as tensor of shape (..., 4), real part first.
+ Returns:
+ The product of a and b, a tensor of quaternions shape (..., 4).
+ """
+ aw, ax, ay, az = torch.unbind(a, -1)
+ bw, bx, by, bz = torch.unbind(b, -1)
+ ow = aw * bw - ax * bx - ay * by - az * bz
+ ox = aw * bx + ax * bw + ay * bz - az * by
+ oy = aw * by - ax * bz + ay * bw + az * bx
+ oz = aw * bz + ax * by - ay * bx + az * bw
+ return torch.stack((ow, ox, oy, oz), -1)
+
+
+def quaternion_multiply(a, b):
+ """
+ Multiply two quaternions representing rotations, returning the quaternion
+ representing their composition, i.e. the versor with nonnegative real part.
+ Usual torch rules for broadcasting apply.
+ Args:
+ a: Quaternions as tensor of shape (..., 4), real part first.
+ b: Quaternions as tensor of shape (..., 4), real part first.
+ Returns:
+ The product of a and b, a tensor of quaternions of shape (..., 4).
+ """
+ ab = quaternion_raw_multiply(a, b)
+ return standardize_quaternion(ab)
+
+
+def quaternion_invert(quaternion):
+ """
+ Given a quaternion representing rotation, get the quaternion representing
+ its inverse.
+ Args:
+ quaternion: Quaternions as tensor of shape (..., 4), with real part
+ first, which must be versors (unit quaternions).
+ Returns:
+ The inverse, a tensor of quaternions of shape (..., 4).
+ """
+
+ return quaternion * quaternion.new_tensor([1, -1, -1, -1])
+
+
+def quaternion_apply(quaternion, point):
+ """
+ Apply the rotation given by a quaternion to a 3D point.
+ Usual torch rules for broadcasting apply.
+ Args:
+ quaternion: Tensor of quaternions, real part first, of shape (..., 4).
+ point: Tensor of 3D points of shape (..., 3).
+ Returns:
+ Tensor of rotated points of shape (..., 3).
+ """
+ if point.size(-1) != 3:
+ raise ValueError(f"Points are not in 3D, f{point.shape}.")
+ real_parts = point.new_zeros(point.shape[:-1] + (1,))
+ point_as_quaternion = torch.cat((real_parts, point), -1)
+ out = quaternion_raw_multiply(
+ quaternion_raw_multiply(quaternion, point_as_quaternion),
+ quaternion_invert(quaternion),
+ )
+ return out[..., 1:]
+
+
+def axis_angle_to_matrix(axis_angle):
+ """
+ Convert rotations given as axis/angle to rotation matrices.
+ Args:
+ axis_angle: Rotations given as a vector in axis angle form,
+ as a tensor of shape (..., 3), where the magnitude is
+ the angle turned anticlockwise in radians around the
+ vector's direction.
+ Returns:
+ Rotation matrices as tensor of shape (..., 3, 3).
+ """
+ return quaternion_to_matrix(axis_angle_to_quaternion(axis_angle))
+
+
+def matrix_to_axis_angle(matrix):
+ """
+ Convert rotations given as rotation matrices to axis/angle.
+ Args:
+ matrix: Rotation matrices as tensor of shape (..., 3, 3).
+ Returns:
+ Rotations given as a vector in axis angle form, as a tensor
+ of shape (..., 3), where the magnitude is the angle
+ turned anticlockwise in radians around the vector's
+ direction.
+ """
+ return quaternion_to_axis_angle(matrix_to_quaternion(matrix))
+
+
+def axis_angle_to_quaternion(axis_angle):
+ """
+ Convert rotations given as axis/angle to quaternions.
+ Args:
+ axis_angle: Rotations given as a vector in axis angle form,
+ as a tensor of shape (..., 3), where the magnitude is
+ the angle turned anticlockwise in radians around the
+ vector's direction.
+ Returns:
+ quaternions with real part first, as tensor of shape (..., 4).
+ """
+ angles = torch.norm(axis_angle, p=2, dim=-1, keepdim=True)
+ half_angles = 0.5 * angles
+ eps = 1e-6
+ small_angles = angles.abs() < eps
+ sin_half_angles_over_angles = torch.empty_like(angles)
+ sin_half_angles_over_angles[~small_angles] = (
+ torch.sin(half_angles[~small_angles]) / angles[~small_angles]
+ )
+ # for x small, sin(x/2) is about x/2 - (x/2)^3/6
+ # so sin(x/2)/x is about 1/2 - (x*x)/48
+ sin_half_angles_over_angles[small_angles] = (
+ 0.5 - (angles[small_angles] * angles[small_angles]) / 48
+ )
+ quaternions = torch.cat(
+ [torch.cos(half_angles), axis_angle * sin_half_angles_over_angles], dim=-1
+ )
+ return quaternions
+
+
+def quaternion_to_axis_angle(quaternions):
+ """
+ Convert rotations given as quaternions to axis/angle.
+ Args:
+ quaternions: quaternions with real part first,
+ as tensor of shape (..., 4).
+ Returns:
+ Rotations given as a vector in axis angle form, as a tensor
+ of shape (..., 3), where the magnitude is the angle
+ turned anticlockwise in radians around the vector's
+ direction.
+ """
+ norms = torch.norm(quaternions[..., 1:], p=2, dim=-1, keepdim=True)
+ half_angles = torch.atan2(norms, quaternions[..., :1])
+ angles = 2 * half_angles
+ eps = 1e-6
+ small_angles = angles.abs() < eps
+ sin_half_angles_over_angles = torch.empty_like(angles)
+ sin_half_angles_over_angles[~small_angles] = (
+ torch.sin(half_angles[~small_angles]) / angles[~small_angles]
+ )
+ # for x small, sin(x/2) is about x/2 - (x/2)^3/6
+ # so sin(x/2)/x is about 1/2 - (x*x)/48
+ sin_half_angles_over_angles[small_angles] = (
+ 0.5 - (angles[small_angles] * angles[small_angles]) / 48
+ )
+ return quaternions[..., 1:] / sin_half_angles_over_angles
+
+
+def rotation_6d_to_matrix(d6: torch.Tensor) -> torch.Tensor:
+ """
+ Converts 6D rotation representation by Zhou et al. [1] to rotation matrix
+ using Gram--Schmidt orthogonalisation per Section B of [1].
+ Args:
+ d6: 6D rotation representation, of size (*, 6)
+ Returns:
+ batch of rotation matrices of size (*, 3, 3)
+ [1] Zhou, Y., Barnes, C., Lu, J., Yang, J., & Li, H.
+ On the Continuity of Rotation Representations in Neural Networks.
+ IEEE Conference on Computer Vision and Pattern Recognition, 2019.
+ Retrieved from http://arxiv.org/abs/1812.07035
+ """
+
+ a1, a2 = d6[..., :3], d6[..., 3:]
+ b1 = F.normalize(a1, dim=-1)
+ b2 = a2 - (b1 * a2).sum(-1, keepdim=True) * b1
+ b2 = F.normalize(b2, dim=-1)
+ b3 = torch.cross(b1, b2, dim=-1)
+ return torch.stack((b1, b2, b3), dim=-2)
+
+
+def matrix_to_rotation_6d(matrix: torch.Tensor) -> torch.Tensor:
+ """
+ Converts rotation matrices to 6D rotation representation by Zhou et al. [1]
+ by dropping the last row. Note that 6D representation is not unique.
+ Args:
+ matrix: batch of rotation matrices of size (*, 3, 3)
+ Returns:
+ 6D rotation representation, of size (*, 6)
+ [1] Zhou, Y., Barnes, C., Lu, J., Yang, J., & Li, H.
+ On the Continuity of Rotation Representations in Neural Networks.
+ IEEE Conference on Computer Vision and Pattern Recognition, 2019.
+ Retrieved from http://arxiv.org/abs/1812.07035
+ """
+ return matrix[..., :2, :].clone().reshape(*matrix.size()[:-2], 6)
+
+def canonicalize_smplh(poses, trans = None):
+ bs, nframes, njoints = poses.shape[:3]
+
+ global_orient = poses[:, :, 0]
+
+ # first global rotations
+ rot2d = matrix_to_axis_angle(global_orient[:, 0])
+ #rot2d[:, :2] = 0 # Remove the rotation along the vertical axis
+ rot2d = axis_angle_to_matrix(rot2d)
+
+ # Rotate the global rotation to eliminate Z rotations
+ global_orient = torch.einsum("ikj,imkl->imjl", rot2d, global_orient)
+
+ # Construct canonicalized version of x
+ xc = torch.cat((global_orient[:, :, None], poses[:, :, 1:]), dim=2)
+
+ if trans is not None:
+ vel = trans[:, 1:] - trans[:, :-1]
+ # Turn the translation as well
+ vel = torch.einsum("ikj,ilk->ilj", rot2d, vel)
+ trans = torch.cat((torch.zeros(bs, 1, 3, device=vel.device),
+ torch.cumsum(vel, 1)), 1)
+ return xc, trans
+ else:
+ return xc
+
+
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/utils/skeleton.py b/generate_human_motion/VQTrans/utils/skeleton.py
new file mode 100644
index 0000000000000000000000000000000000000000..6de56af0c29ae7cccbd7178f912459413f87c646
--- /dev/null
+++ b/generate_human_motion/VQTrans/utils/skeleton.py
@@ -0,0 +1,199 @@
+from utils.quaternion import *
+import scipy.ndimage.filters as filters
+
+class Skeleton(object):
+ def __init__(self, offset, kinematic_tree, device):
+ self.device = device
+ self._raw_offset_np = offset.numpy()
+ self._raw_offset = offset.clone().detach().to(device).float()
+ self._kinematic_tree = kinematic_tree
+ self._offset = None
+ self._parents = [0] * len(self._raw_offset)
+ self._parents[0] = -1
+ for chain in self._kinematic_tree:
+ for j in range(1, len(chain)):
+ self._parents[chain[j]] = chain[j-1]
+
+ def njoints(self):
+ return len(self._raw_offset)
+
+ def offset(self):
+ return self._offset
+
+ def set_offset(self, offsets):
+ self._offset = offsets.clone().detach().to(self.device).float()
+
+ def kinematic_tree(self):
+ return self._kinematic_tree
+
+ def parents(self):
+ return self._parents
+
+ # joints (batch_size, joints_num, 3)
+ def get_offsets_joints_batch(self, joints):
+ assert len(joints.shape) == 3
+ _offsets = self._raw_offset.expand(joints.shape[0], -1, -1).clone()
+ for i in range(1, self._raw_offset.shape[0]):
+ _offsets[:, i] = torch.norm(joints[:, i] - joints[:, self._parents[i]], p=2, dim=1)[:, None] * _offsets[:, i]
+
+ self._offset = _offsets.detach()
+ return _offsets
+
+ # joints (joints_num, 3)
+ def get_offsets_joints(self, joints):
+ assert len(joints.shape) == 2
+ _offsets = self._raw_offset.clone()
+ for i in range(1, self._raw_offset.shape[0]):
+ # print(joints.shape)
+ _offsets[i] = torch.norm(joints[i] - joints[self._parents[i]], p=2, dim=0) * _offsets[i]
+
+ self._offset = _offsets.detach()
+ return _offsets
+
+ # face_joint_idx should follow the order of right hip, left hip, right shoulder, left shoulder
+ # joints (batch_size, joints_num, 3)
+ def inverse_kinematics_np(self, joints, face_joint_idx, smooth_forward=False):
+ assert len(face_joint_idx) == 4
+ '''Get Forward Direction'''
+ l_hip, r_hip, sdr_r, sdr_l = face_joint_idx
+ across1 = joints[:, r_hip] - joints[:, l_hip]
+ across2 = joints[:, sdr_r] - joints[:, sdr_l]
+ across = across1 + across2
+ across = across / np.sqrt((across**2).sum(axis=-1))[:, np.newaxis]
+ # print(across1.shape, across2.shape)
+
+ # forward (batch_size, 3)
+ forward = np.cross(np.array([[0, 1, 0]]), across, axis=-1)
+ if smooth_forward:
+ forward = filters.gaussian_filter1d(forward, 20, axis=0, mode='nearest')
+ # forward (batch_size, 3)
+ forward = forward / np.sqrt((forward**2).sum(axis=-1))[..., np.newaxis]
+
+ '''Get Root Rotation'''
+ target = np.array([[0,0,1]]).repeat(len(forward), axis=0)
+ root_quat = qbetween_np(forward, target)
+
+ '''Inverse Kinematics'''
+ # quat_params (batch_size, joints_num, 4)
+ # print(joints.shape[:-1])
+ quat_params = np.zeros(joints.shape[:-1] + (4,))
+ # print(quat_params.shape)
+ root_quat[0] = np.array([[1.0, 0.0, 0.0, 0.0]])
+ quat_params[:, 0] = root_quat
+ # quat_params[0, 0] = np.array([[1.0, 0.0, 0.0, 0.0]])
+ for chain in self._kinematic_tree:
+ R = root_quat
+ for j in range(len(chain) - 1):
+ # (batch, 3)
+ u = self._raw_offset_np[chain[j+1]][np.newaxis,...].repeat(len(joints), axis=0)
+ # print(u.shape)
+ # (batch, 3)
+ v = joints[:, chain[j+1]] - joints[:, chain[j]]
+ v = v / np.sqrt((v**2).sum(axis=-1))[:, np.newaxis]
+ # print(u.shape, v.shape)
+ rot_u_v = qbetween_np(u, v)
+
+ R_loc = qmul_np(qinv_np(R), rot_u_v)
+
+ quat_params[:,chain[j + 1], :] = R_loc
+ R = qmul_np(R, R_loc)
+
+ return quat_params
+
+ # Be sure root joint is at the beginning of kinematic chains
+ def forward_kinematics(self, quat_params, root_pos, skel_joints=None, do_root_R=True):
+ # quat_params (batch_size, joints_num, 4)
+ # joints (batch_size, joints_num, 3)
+ # root_pos (batch_size, 3)
+ if skel_joints is not None:
+ offsets = self.get_offsets_joints_batch(skel_joints)
+ if len(self._offset.shape) == 2:
+ offsets = self._offset.expand(quat_params.shape[0], -1, -1)
+ joints = torch.zeros(quat_params.shape[:-1] + (3,)).to(self.device)
+ joints[:, 0] = root_pos
+ for chain in self._kinematic_tree:
+ if do_root_R:
+ R = quat_params[:, 0]
+ else:
+ R = torch.tensor([[1.0, 0.0, 0.0, 0.0]]).expand(len(quat_params), -1).detach().to(self.device)
+ for i in range(1, len(chain)):
+ R = qmul(R, quat_params[:, chain[i]])
+ offset_vec = offsets[:, chain[i]]
+ joints[:, chain[i]] = qrot(R, offset_vec) + joints[:, chain[i-1]]
+ return joints
+
+ # Be sure root joint is at the beginning of kinematic chains
+ def forward_kinematics_np(self, quat_params, root_pos, skel_joints=None, do_root_R=True):
+ # quat_params (batch_size, joints_num, 4)
+ # joints (batch_size, joints_num, 3)
+ # root_pos (batch_size, 3)
+ if skel_joints is not None:
+ skel_joints = torch.from_numpy(skel_joints)
+ offsets = self.get_offsets_joints_batch(skel_joints)
+ if len(self._offset.shape) == 2:
+ offsets = self._offset.expand(quat_params.shape[0], -1, -1)
+ offsets = offsets.numpy()
+ joints = np.zeros(quat_params.shape[:-1] + (3,))
+ joints[:, 0] = root_pos
+ for chain in self._kinematic_tree:
+ if do_root_R:
+ R = quat_params[:, 0]
+ else:
+ R = np.array([[1.0, 0.0, 0.0, 0.0]]).repeat(len(quat_params), axis=0)
+ for i in range(1, len(chain)):
+ R = qmul_np(R, quat_params[:, chain[i]])
+ offset_vec = offsets[:, chain[i]]
+ joints[:, chain[i]] = qrot_np(R, offset_vec) + joints[:, chain[i - 1]]
+ return joints
+
+ def forward_kinematics_cont6d_np(self, cont6d_params, root_pos, skel_joints=None, do_root_R=True):
+ # cont6d_params (batch_size, joints_num, 6)
+ # joints (batch_size, joints_num, 3)
+ # root_pos (batch_size, 3)
+ if skel_joints is not None:
+ skel_joints = torch.from_numpy(skel_joints)
+ offsets = self.get_offsets_joints_batch(skel_joints)
+ if len(self._offset.shape) == 2:
+ offsets = self._offset.expand(cont6d_params.shape[0], -1, -1)
+ offsets = offsets.numpy()
+ joints = np.zeros(cont6d_params.shape[:-1] + (3,))
+ joints[:, 0] = root_pos
+ for chain in self._kinematic_tree:
+ if do_root_R:
+ matR = cont6d_to_matrix_np(cont6d_params[:, 0])
+ else:
+ matR = np.eye(3)[np.newaxis, :].repeat(len(cont6d_params), axis=0)
+ for i in range(1, len(chain)):
+ matR = np.matmul(matR, cont6d_to_matrix_np(cont6d_params[:, chain[i]]))
+ offset_vec = offsets[:, chain[i]][..., np.newaxis]
+ # print(matR.shape, offset_vec.shape)
+ joints[:, chain[i]] = np.matmul(matR, offset_vec).squeeze(-1) + joints[:, chain[i-1]]
+ return joints
+
+ def forward_kinematics_cont6d(self, cont6d_params, root_pos, skel_joints=None, do_root_R=True):
+ # cont6d_params (batch_size, joints_num, 6)
+ # joints (batch_size, joints_num, 3)
+ # root_pos (batch_size, 3)
+ if skel_joints is not None:
+ # skel_joints = torch.from_numpy(skel_joints)
+ offsets = self.get_offsets_joints_batch(skel_joints)
+ if len(self._offset.shape) == 2:
+ offsets = self._offset.expand(cont6d_params.shape[0], -1, -1)
+ joints = torch.zeros(cont6d_params.shape[:-1] + (3,)).to(cont6d_params.device)
+ joints[..., 0, :] = root_pos
+ for chain in self._kinematic_tree:
+ if do_root_R:
+ matR = cont6d_to_matrix(cont6d_params[:, 0])
+ else:
+ matR = torch.eye(3).expand((len(cont6d_params), -1, -1)).detach().to(cont6d_params.device)
+ for i in range(1, len(chain)):
+ matR = torch.matmul(matR, cont6d_to_matrix(cont6d_params[:, chain[i]]))
+ offset_vec = offsets[:, chain[i]].unsqueeze(-1)
+ # print(matR.shape, offset_vec.shape)
+ joints[:, chain[i]] = torch.matmul(matR, offset_vec).squeeze(-1) + joints[:, chain[i-1]]
+ return joints
+
+
+
+
+
diff --git a/generate_human_motion/VQTrans/utils/utils_model.py b/generate_human_motion/VQTrans/utils/utils_model.py
new file mode 100644
index 0000000000000000000000000000000000000000..b3653a47ddb96f2ba27aae73b4eef8be904e9bf0
--- /dev/null
+++ b/generate_human_motion/VQTrans/utils/utils_model.py
@@ -0,0 +1,66 @@
+import numpy as np
+import torch
+import torch.optim as optim
+import logging
+import os
+import sys
+
+def getCi(accLog):
+
+ mean = np.mean(accLog)
+ std = np.std(accLog)
+ ci95 = 1.96*std/np.sqrt(len(accLog))
+
+ return mean, ci95
+
+def get_logger(out_dir):
+ logger = logging.getLogger('Exp')
+ logger.setLevel(logging.INFO)
+ formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s")
+
+ file_path = os.path.join(out_dir, "run.log")
+ file_hdlr = logging.FileHandler(file_path)
+ file_hdlr.setFormatter(formatter)
+
+ strm_hdlr = logging.StreamHandler(sys.stdout)
+ strm_hdlr.setFormatter(formatter)
+
+ logger.addHandler(file_hdlr)
+ logger.addHandler(strm_hdlr)
+ return logger
+
+## Optimizer
+def initial_optim(decay_option, lr, weight_decay, net, optimizer) :
+
+ if optimizer == 'adamw' :
+ optimizer_adam_family = optim.AdamW
+ elif optimizer == 'adam' :
+ optimizer_adam_family = optim.Adam
+ if decay_option == 'all':
+ #optimizer = optimizer_adam_family(net.parameters(), lr=lr, betas=(0.9, 0.999), weight_decay=weight_decay)
+ optimizer = optimizer_adam_family(net.parameters(), lr=lr, betas=(0.5, 0.9), weight_decay=weight_decay)
+
+ elif decay_option == 'noVQ':
+ all_params = set(net.parameters())
+ no_decay = set([net.vq_layer])
+
+ decay = all_params - no_decay
+ optimizer = optimizer_adam_family([
+ {'params': list(no_decay), 'weight_decay': 0},
+ {'params': list(decay), 'weight_decay' : weight_decay}], lr=lr)
+
+ return optimizer
+
+
+def get_motion_with_trans(motion, velocity) :
+ '''
+ motion : torch.tensor, shape (batch_size, T, 72), with the global translation = 0
+ velocity : torch.tensor, shape (batch_size, T, 3), contain the information of velocity = 0
+
+ '''
+ trans = torch.cumsum(velocity, dim=1)
+ trans = trans - trans[:, :1] ## the first root is initialized at 0 (just for visualization)
+ trans = trans.repeat((1, 1, 21))
+ motion_with_trans = motion + trans
+ return motion_with_trans
+
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/utils/word_vectorizer.py b/generate_human_motion/VQTrans/utils/word_vectorizer.py
new file mode 100644
index 0000000000000000000000000000000000000000..557ff97a9539c084167f3eca51fb50f53f33c8ea
--- /dev/null
+++ b/generate_human_motion/VQTrans/utils/word_vectorizer.py
@@ -0,0 +1,99 @@
+import numpy as np
+import pickle
+from os.path import join as pjoin
+
+POS_enumerator = {
+ 'VERB': 0,
+ 'NOUN': 1,
+ 'DET': 2,
+ 'ADP': 3,
+ 'NUM': 4,
+ 'AUX': 5,
+ 'PRON': 6,
+ 'ADJ': 7,
+ 'ADV': 8,
+ 'Loc_VIP': 9,
+ 'Body_VIP': 10,
+ 'Obj_VIP': 11,
+ 'Act_VIP': 12,
+ 'Desc_VIP': 13,
+ 'OTHER': 14,
+}
+
+Loc_list = ('left', 'right', 'clockwise', 'counterclockwise', 'anticlockwise', 'forward', 'back', 'backward',
+ 'up', 'down', 'straight', 'curve')
+
+Body_list = ('arm', 'chin', 'foot', 'feet', 'face', 'hand', 'mouth', 'leg', 'waist', 'eye', 'knee', 'shoulder', 'thigh')
+
+Obj_List = ('stair', 'dumbbell', 'chair', 'window', 'floor', 'car', 'ball', 'handrail', 'baseball', 'basketball')
+
+Act_list = ('walk', 'run', 'swing', 'pick', 'bring', 'kick', 'put', 'squat', 'throw', 'hop', 'dance', 'jump', 'turn',
+ 'stumble', 'dance', 'stop', 'sit', 'lift', 'lower', 'raise', 'wash', 'stand', 'kneel', 'stroll',
+ 'rub', 'bend', 'balance', 'flap', 'jog', 'shuffle', 'lean', 'rotate', 'spin', 'spread', 'climb')
+
+Desc_list = ('slowly', 'carefully', 'fast', 'careful', 'slow', 'quickly', 'happy', 'angry', 'sad', 'happily',
+ 'angrily', 'sadly')
+
+VIP_dict = {
+ 'Loc_VIP': Loc_list,
+ 'Body_VIP': Body_list,
+ 'Obj_VIP': Obj_List,
+ 'Act_VIP': Act_list,
+ 'Desc_VIP': Desc_list,
+}
+
+
+class WordVectorizer(object):
+ def __init__(self, meta_root, prefix):
+ vectors = np.load(pjoin(meta_root, '%s_data.npy'%prefix))
+ words = pickle.load(open(pjoin(meta_root, '%s_words.pkl'%prefix), 'rb'))
+ self.word2idx = pickle.load(open(pjoin(meta_root, '%s_idx.pkl'%prefix), 'rb'))
+ self.word2vec = {w: vectors[self.word2idx[w]] for w in words}
+
+ def _get_pos_ohot(self, pos):
+ pos_vec = np.zeros(len(POS_enumerator))
+ if pos in POS_enumerator:
+ pos_vec[POS_enumerator[pos]] = 1
+ else:
+ pos_vec[POS_enumerator['OTHER']] = 1
+ return pos_vec
+
+ def __len__(self):
+ return len(self.word2vec)
+
+ def __getitem__(self, item):
+ word, pos = item.split('/')
+ if word in self.word2vec:
+ word_vec = self.word2vec[word]
+ vip_pos = None
+ for key, values in VIP_dict.items():
+ if word in values:
+ vip_pos = key
+ break
+ if vip_pos is not None:
+ pos_vec = self._get_pos_ohot(vip_pos)
+ else:
+ pos_vec = self._get_pos_ohot(pos)
+ else:
+ word_vec = self.word2vec['unk']
+ pos_vec = self._get_pos_ohot('OTHER')
+ return word_vec, pos_vec
+
+
+class WordVectorizerV2(WordVectorizer):
+ def __init__(self, meta_root, prefix):
+ super(WordVectorizerV2, self).__init__(meta_root, prefix)
+ self.idx2word = {self.word2idx[w]: w for w in self.word2idx}
+
+ def __getitem__(self, item):
+ word_vec, pose_vec = super(WordVectorizerV2, self).__getitem__(item)
+ word, pos = item.split('/')
+ if word in self.word2vec:
+ return word_vec, pose_vec, self.word2idx[word]
+ else:
+ return word_vec, pose_vec, self.word2idx['unk']
+
+ def itos(self, idx):
+ if idx == len(self.idx2word):
+ return "pad"
+ return self.idx2word[idx]
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/visualization/__pycache__/plot_3d_global.cpython-310.pyc b/generate_human_motion/VQTrans/visualization/__pycache__/plot_3d_global.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5a3db1b449a341f9249881f01f16d89d1de4ef87
Binary files /dev/null and b/generate_human_motion/VQTrans/visualization/__pycache__/plot_3d_global.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/visualization/plot_3d_global.py b/generate_human_motion/VQTrans/visualization/plot_3d_global.py
new file mode 100644
index 0000000000000000000000000000000000000000..c1063ead52040663e1e1fce481da167155084ce7
--- /dev/null
+++ b/generate_human_motion/VQTrans/visualization/plot_3d_global.py
@@ -0,0 +1,129 @@
+import torch
+import matplotlib.pyplot as plt
+import numpy as np
+import io
+import matplotlib
+from mpl_toolkits.mplot3d.art3d import Poly3DCollection
+import mpl_toolkits.mplot3d.axes3d as p3
+from textwrap import wrap
+import imageio
+
+def plot_3d_motion(args, figsize=(10, 10), fps=120, radius=4):
+ matplotlib.use('Agg')
+
+
+ joints, out_name, title = args
+
+ data = joints.copy().reshape(len(joints), -1, 3)
+
+ nb_joints = joints.shape[1]
+ smpl_kinetic_chain = [[0, 11, 12, 13, 14, 15], [0, 16, 17, 18, 19, 20], [0, 1, 2, 3, 4], [3, 5, 6, 7], [3, 8, 9, 10]] if nb_joints == 21 else [[0, 2, 5, 8, 11], [0, 1, 4, 7, 10], [0, 3, 6, 9, 12, 15], [9, 14, 17, 19, 21], [9, 13, 16, 18, 20]]
+ limits = 1000 if nb_joints == 21 else 2
+ MINS = data.min(axis=0).min(axis=0)
+ MAXS = data.max(axis=0).max(axis=0)
+ colors = ['red', 'blue', 'black', 'red', 'blue',
+ 'darkblue', 'darkblue', 'darkblue', 'darkblue', 'darkblue',
+ 'darkred', 'darkred', 'darkred', 'darkred', 'darkred']
+ frame_number = data.shape[0]
+ # print(data.shape)
+
+ height_offset = MINS[1]
+ data[:, :, 1] -= height_offset
+ trajec = data[:, 0, [0, 2]]
+
+ data[..., 0] -= data[:, 0:1, 0]
+ data[..., 2] -= data[:, 0:1, 2]
+
+ def update(index):
+
+ def init():
+ ax.set_xlim(-limits, limits)
+ ax.set_ylim(-limits, limits)
+ ax.set_zlim(0, limits)
+ ax.grid(b=False)
+ def plot_xzPlane(minx, maxx, miny, minz, maxz):
+ ## Plot a plane XZ
+ verts = [
+ [minx, miny, minz],
+ [minx, miny, maxz],
+ [maxx, miny, maxz],
+ [maxx, miny, minz]
+ ]
+ xz_plane = Poly3DCollection([verts])
+ xz_plane.set_facecolor((0.5, 0.5, 0.5, 0.5))
+ ax.add_collection3d(xz_plane)
+ fig = plt.figure(figsize=(480/96., 320/96.), dpi=96) if nb_joints == 21 else plt.figure(figsize=(10, 10), dpi=96)
+ if title is not None :
+ wraped_title = '\n'.join(wrap(title, 40))
+ fig.suptitle(wraped_title, fontsize=16)
+ ax = p3.Axes3D(fig)
+
+ init()
+
+ lines = ax.lines
+ collections = ax.collections
+ ax.view_init(elev=110, azim=-90)
+ ax.dist = 7.5
+ # ax =
+ plot_xzPlane(MINS[0] - trajec[index, 0], MAXS[0] - trajec[index, 0], 0, MINS[2] - trajec[index, 1],
+ MAXS[2] - trajec[index, 1])
+ # ax.scatter(data[index, :22, 0], data[index, :22, 1], data[index, :22, 2], color='black', s=3)
+
+ if index > 1:
+ ax.plot3D(trajec[:index, 0] - trajec[index, 0], np.zeros_like(trajec[:index, 0]),
+ trajec[:index, 1] - trajec[index, 1], linewidth=1.0,
+ color='blue')
+ # ax = plot_xzPlane(ax, MINS[0], MAXS[0], 0, MINS[2], MAXS[2])
+
+ for i, (chain, color) in enumerate(zip(smpl_kinetic_chain, colors)):
+ # print(color)
+ if i < 5:
+ linewidth = 4.0
+ else:
+ linewidth = 2.0
+ ax.plot3D(data[index, chain, 0], data[index, chain, 1], data[index, chain, 2], linewidth=linewidth,
+ color=color)
+ # print(trajec[:index, 0].shape)
+
+ plt.axis('off')
+ ax.set_xticklabels([])
+ ax.set_yticklabels([])
+ ax.set_zticklabels([])
+
+ if out_name is not None :
+ plt.savefig(out_name, dpi=96)
+ plt.close()
+
+ else :
+ io_buf = io.BytesIO()
+ fig.savefig(io_buf, format='raw', dpi=96)
+ io_buf.seek(0)
+ # print(fig.bbox.bounds)
+ arr = np.reshape(np.frombuffer(io_buf.getvalue(), dtype=np.uint8),
+ newshape=(int(fig.bbox.bounds[3]), int(fig.bbox.bounds[2]), -1))
+ io_buf.close()
+ plt.close()
+ return arr
+
+ out = []
+ for i in range(frame_number) :
+ out.append(update(i))
+ out = np.stack(out, axis=0)
+ return torch.from_numpy(out)
+
+
+def draw_to_batch(smpl_joints_batch, title_batch=None, outname=None) :
+
+ batch_size = len(smpl_joints_batch)
+ out = []
+ for i in range(batch_size) :
+ out.append(plot_3d_motion([smpl_joints_batch[i], None, title_batch[i] if title_batch is not None else None]))
+ if outname is not None:
+ imageio.mimsave(outname[i], np.array(out[-1]), fps=20)
+ out = torch.stack(out, axis=0)
+ return out
+
+
+
+
+
diff --git a/generate_human_motion/VQTrans/visualize/__pycache__/simplify_loc2rot.cpython-310.pyc b/generate_human_motion/VQTrans/visualize/__pycache__/simplify_loc2rot.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..70ec0bcc45363c07dbdcd50b7b5bda01d925e185
Binary files /dev/null and b/generate_human_motion/VQTrans/visualize/__pycache__/simplify_loc2rot.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/visualize/joints2smpl/smpl_models/SMPL_downsample_index.pkl b/generate_human_motion/VQTrans/visualize/joints2smpl/smpl_models/SMPL_downsample_index.pkl
new file mode 100644
index 0000000000000000000000000000000000000000..7bb54c4f1e03340ad58b60485abaed1641d68d47
--- /dev/null
+++ b/generate_human_motion/VQTrans/visualize/joints2smpl/smpl_models/SMPL_downsample_index.pkl
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e5b783c1677079397ee4bc26df5c72d73b8bb393bea41fa295b951187443daec
+size 3556
diff --git a/generate_human_motion/VQTrans/visualize/joints2smpl/smpl_models/gmm_08.pkl b/generate_human_motion/VQTrans/visualize/joints2smpl/smpl_models/gmm_08.pkl
new file mode 100644
index 0000000000000000000000000000000000000000..c97a1d7ef396581e56ce74a12cc39175680ce028
--- /dev/null
+++ b/generate_human_motion/VQTrans/visualize/joints2smpl/smpl_models/gmm_08.pkl
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e1374908aae055a2afa01a2cd9a169bc6cfec1ceb7aa590e201a47b383060491
+size 839127
diff --git a/generate_human_motion/VQTrans/visualize/joints2smpl/smpl_models/neutral_smpl_mean_params.h5 b/generate_human_motion/VQTrans/visualize/joints2smpl/smpl_models/neutral_smpl_mean_params.h5
new file mode 100644
index 0000000000000000000000000000000000000000..b6ecce2a748128cfde09b219ccc74307de50bbae
--- /dev/null
+++ b/generate_human_motion/VQTrans/visualize/joints2smpl/smpl_models/neutral_smpl_mean_params.h5
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ac9b474c74daec0253ed084720f662059336e976850f08a4a9a3f76d06613776
+size 4848
diff --git a/generate_human_motion/VQTrans/visualize/joints2smpl/smpl_models/smplx_parts_segm.pkl b/generate_human_motion/VQTrans/visualize/joints2smpl/smpl_models/smplx_parts_segm.pkl
new file mode 100644
index 0000000000000000000000000000000000000000..77ce98631741ba3887d689077baf35422d39299d
--- /dev/null
+++ b/generate_human_motion/VQTrans/visualize/joints2smpl/smpl_models/smplx_parts_segm.pkl
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bb69c10801205c9cfb5353fdeb1b9cc5ade53d14c265c3339421cdde8b9c91e7
+size 1323168
diff --git a/generate_human_motion/VQTrans/visualize/joints2smpl/src/__pycache__/config.cpython-310.pyc b/generate_human_motion/VQTrans/visualize/joints2smpl/src/__pycache__/config.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ec8680d34d59771e9733f09ece7556299bc592a1
Binary files /dev/null and b/generate_human_motion/VQTrans/visualize/joints2smpl/src/__pycache__/config.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/visualize/joints2smpl/src/__pycache__/customloss.cpython-310.pyc b/generate_human_motion/VQTrans/visualize/joints2smpl/src/__pycache__/customloss.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..992af46a703f1c4074168767c5daad7144965ae5
Binary files /dev/null and b/generate_human_motion/VQTrans/visualize/joints2smpl/src/__pycache__/customloss.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/visualize/joints2smpl/src/__pycache__/prior.cpython-310.pyc b/generate_human_motion/VQTrans/visualize/joints2smpl/src/__pycache__/prior.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a56f64ed9c82d49e6d01a495bc364b810c67122d
Binary files /dev/null and b/generate_human_motion/VQTrans/visualize/joints2smpl/src/__pycache__/prior.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/visualize/joints2smpl/src/__pycache__/smplify.cpython-310.pyc b/generate_human_motion/VQTrans/visualize/joints2smpl/src/__pycache__/smplify.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6d301008c46264407e4fcccb558ab9b71466d01b
Binary files /dev/null and b/generate_human_motion/VQTrans/visualize/joints2smpl/src/__pycache__/smplify.cpython-310.pyc differ
diff --git a/generate_human_motion/VQTrans/visualize/joints2smpl/src/config.py b/generate_human_motion/VQTrans/visualize/joints2smpl/src/config.py
new file mode 100644
index 0000000000000000000000000000000000000000..1021115a53f19974fbea3d3768c25874a4ae5d38
--- /dev/null
+++ b/generate_human_motion/VQTrans/visualize/joints2smpl/src/config.py
@@ -0,0 +1,40 @@
+import numpy as np
+
+# Map joints Name to SMPL joints idx
+JOINT_MAP = {
+'MidHip': 0,
+'LHip': 1, 'LKnee': 4, 'LAnkle': 7, 'LFoot': 10,
+'RHip': 2, 'RKnee': 5, 'RAnkle': 8, 'RFoot': 11,
+'LShoulder': 16, 'LElbow': 18, 'LWrist': 20, 'LHand': 22,
+'RShoulder': 17, 'RElbow': 19, 'RWrist': 21, 'RHand': 23,
+'spine1': 3, 'spine2': 6, 'spine3': 9, 'Neck': 12, 'Head': 15,
+'LCollar':13, 'Rcollar' :14,
+'Nose':24, 'REye':26, 'LEye':26, 'REar':27, 'LEar':28,
+'LHeel': 31, 'RHeel': 34,
+'OP RShoulder': 17, 'OP LShoulder': 16,
+'OP RHip': 2, 'OP LHip': 1,
+'OP Neck': 12,
+}
+
+full_smpl_idx = range(24)
+key_smpl_idx = [0, 1, 4, 7, 2, 5, 8, 17, 19, 21, 16, 18, 20]
+
+
+AMASS_JOINT_MAP = {
+'MidHip': 0,
+'LHip': 1, 'LKnee': 4, 'LAnkle': 7, 'LFoot': 10,
+'RHip': 2, 'RKnee': 5, 'RAnkle': 8, 'RFoot': 11,
+'LShoulder': 16, 'LElbow': 18, 'LWrist': 20,
+'RShoulder': 17, 'RElbow': 19, 'RWrist': 21,
+'spine1': 3, 'spine2': 6, 'spine3': 9, 'Neck': 12, 'Head': 15,
+'LCollar':13, 'Rcollar' :14,
+}
+amass_idx = range(22)
+amass_smpl_idx = range(22)
+
+
+SMPL_MODEL_DIR = "./body_models/"
+GMM_MODEL_DIR = "./visualize/joints2smpl/smpl_models/"
+SMPL_MEAN_FILE = "./visualize/joints2smpl/smpl_models/neutral_smpl_mean_params.h5"
+# for collsion
+Part_Seg_DIR = "./visualize/joints2smpl/smpl_models/smplx_parts_segm.pkl"
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/visualize/joints2smpl/src/customloss.py b/generate_human_motion/VQTrans/visualize/joints2smpl/src/customloss.py
new file mode 100644
index 0000000000000000000000000000000000000000..880ab4861c58cec9faeb086e430fde7387c5cc9e
--- /dev/null
+++ b/generate_human_motion/VQTrans/visualize/joints2smpl/src/customloss.py
@@ -0,0 +1,222 @@
+import torch
+import torch.nn.functional as F
+from visualize.joints2smpl.src import config
+
+# Guassian
+def gmof(x, sigma):
+ """
+ Geman-McClure error function
+ """
+ x_squared = x ** 2
+ sigma_squared = sigma ** 2
+ return (sigma_squared * x_squared) / (sigma_squared + x_squared)
+
+# angle prior
+def angle_prior(pose):
+ """
+ Angle prior that penalizes unnatural bending of the knees and elbows
+ """
+ # We subtract 3 because pose does not include the global rotation of the model
+ return torch.exp(
+ pose[:, [55 - 3, 58 - 3, 12 - 3, 15 - 3]] * torch.tensor([1., -1., -1, -1.], device=pose.device)) ** 2
+
+
+def perspective_projection(points, rotation, translation,
+ focal_length, camera_center):
+ """
+ This function computes the perspective projection of a set of points.
+ Input:
+ points (bs, N, 3): 3D points
+ rotation (bs, 3, 3): Camera rotation
+ translation (bs, 3): Camera translation
+ focal_length (bs,) or scalar: Focal length
+ camera_center (bs, 2): Camera center
+ """
+ batch_size = points.shape[0]
+ K = torch.zeros([batch_size, 3, 3], device=points.device)
+ K[:, 0, 0] = focal_length
+ K[:, 1, 1] = focal_length
+ K[:, 2, 2] = 1.
+ K[:, :-1, -1] = camera_center
+
+ # Transform points
+ points = torch.einsum('bij,bkj->bki', rotation, points)
+ points = points + translation.unsqueeze(1)
+
+ # Apply perspective distortion
+ projected_points = points / points[:, :, -1].unsqueeze(-1)
+
+ # Apply camera intrinsics
+ projected_points = torch.einsum('bij,bkj->bki', K, projected_points)
+
+ return projected_points[:, :, :-1]
+
+
+def body_fitting_loss(body_pose, betas, model_joints, camera_t, camera_center,
+ joints_2d, joints_conf, pose_prior,
+ focal_length=5000, sigma=100, pose_prior_weight=4.78,
+ shape_prior_weight=5, angle_prior_weight=15.2,
+ output='sum'):
+ """
+ Loss function for body fitting
+ """
+ batch_size = body_pose.shape[0]
+ rotation = torch.eye(3, device=body_pose.device).unsqueeze(0).expand(batch_size, -1, -1)
+
+ projected_joints = perspective_projection(model_joints, rotation, camera_t,
+ focal_length, camera_center)
+
+ # Weighted robust reprojection error
+ reprojection_error = gmof(projected_joints - joints_2d, sigma)
+ reprojection_loss = (joints_conf ** 2) * reprojection_error.sum(dim=-1)
+
+ # Pose prior loss
+ pose_prior_loss = (pose_prior_weight ** 2) * pose_prior(body_pose, betas)
+
+ # Angle prior for knees and elbows
+ angle_prior_loss = (angle_prior_weight ** 2) * angle_prior(body_pose).sum(dim=-1)
+
+ # Regularizer to prevent betas from taking large values
+ shape_prior_loss = (shape_prior_weight ** 2) * (betas ** 2).sum(dim=-1)
+
+ total_loss = reprojection_loss.sum(dim=-1) + pose_prior_loss + angle_prior_loss + shape_prior_loss
+
+ if output == 'sum':
+ return total_loss.sum()
+ elif output == 'reprojection':
+ return reprojection_loss
+
+
+# --- get camera fitting loss -----
+def camera_fitting_loss(model_joints, camera_t, camera_t_est, camera_center,
+ joints_2d, joints_conf,
+ focal_length=5000, depth_loss_weight=100):
+ """
+ Loss function for camera optimization.
+ """
+ # Project model joints
+ batch_size = model_joints.shape[0]
+ rotation = torch.eye(3, device=model_joints.device).unsqueeze(0).expand(batch_size, -1, -1)
+ projected_joints = perspective_projection(model_joints, rotation, camera_t,
+ focal_length, camera_center)
+
+ # get the indexed four
+ op_joints = ['OP RHip', 'OP LHip', 'OP RShoulder', 'OP LShoulder']
+ op_joints_ind = [config.JOINT_MAP[joint] for joint in op_joints]
+ gt_joints = ['RHip', 'LHip', 'RShoulder', 'LShoulder']
+ gt_joints_ind = [config.JOINT_MAP[joint] for joint in gt_joints]
+
+ reprojection_error_op = (joints_2d[:, op_joints_ind] -
+ projected_joints[:, op_joints_ind]) ** 2
+ reprojection_error_gt = (joints_2d[:, gt_joints_ind] -
+ projected_joints[:, gt_joints_ind]) ** 2
+
+ # Check if for each example in the batch all 4 OpenPose detections are valid, otherwise use the GT detections
+ # OpenPose joints are more reliable for this task, so we prefer to use them if possible
+ is_valid = (joints_conf[:, op_joints_ind].min(dim=-1)[0][:, None, None] > 0).float()
+ reprojection_loss = (is_valid * reprojection_error_op + (1 - is_valid) * reprojection_error_gt).sum(dim=(1, 2))
+
+ # Loss that penalizes deviation from depth estimate
+ depth_loss = (depth_loss_weight ** 2) * (camera_t[:, 2] - camera_t_est[:, 2]) ** 2
+
+ total_loss = reprojection_loss + depth_loss
+ return total_loss.sum()
+
+
+
+ # #####--- body fitiing loss -----
+def body_fitting_loss_3d(body_pose, preserve_pose,
+ betas, model_joints, camera_translation,
+ j3d, pose_prior,
+ joints3d_conf,
+ sigma=100, pose_prior_weight=4.78*1.5,
+ shape_prior_weight=5.0, angle_prior_weight=15.2,
+ joint_loss_weight=500.0,
+ pose_preserve_weight=0.0,
+ use_collision=False,
+ model_vertices=None, model_faces=None,
+ search_tree=None, pen_distance=None, filter_faces=None,
+ collision_loss_weight=1000
+ ):
+ """
+ Loss function for body fitting
+ """
+ batch_size = body_pose.shape[0]
+
+ #joint3d_loss = (joint_loss_weight ** 2) * gmof((model_joints + camera_translation) - j3d, sigma).sum(dim=-1)
+
+ joint3d_error = gmof((model_joints + camera_translation) - j3d, sigma)
+
+ joint3d_loss_part = (joints3d_conf ** 2) * joint3d_error.sum(dim=-1)
+ joint3d_loss = ((joint_loss_weight ** 2) * joint3d_loss_part).sum(dim=-1)
+
+ # Pose prior loss
+ pose_prior_loss = (pose_prior_weight ** 2) * pose_prior(body_pose, betas)
+ # Angle prior for knees and elbows
+ angle_prior_loss = (angle_prior_weight ** 2) * angle_prior(body_pose).sum(dim=-1)
+ # Regularizer to prevent betas from taking large values
+ shape_prior_loss = (shape_prior_weight ** 2) * (betas ** 2).sum(dim=-1)
+
+ collision_loss = 0.0
+ # Calculate the loss due to interpenetration
+ if use_collision:
+ triangles = torch.index_select(
+ model_vertices, 1,
+ model_faces).view(batch_size, -1, 3, 3)
+
+ with torch.no_grad():
+ collision_idxs = search_tree(triangles)
+
+ # Remove unwanted collisions
+ if filter_faces is not None:
+ collision_idxs = filter_faces(collision_idxs)
+
+ if collision_idxs.ge(0).sum().item() > 0:
+ collision_loss = torch.sum(collision_loss_weight * pen_distance(triangles, collision_idxs))
+
+ pose_preserve_loss = (pose_preserve_weight ** 2) * ((body_pose - preserve_pose) ** 2).sum(dim=-1)
+
+ # print('joint3d_loss', joint3d_loss.shape)
+ # print('pose_prior_loss', pose_prior_loss.shape)
+ # print('angle_prior_loss', angle_prior_loss.shape)
+ # print('shape_prior_loss', shape_prior_loss.shape)
+ # print('collision_loss', collision_loss)
+ # print('pose_preserve_loss', pose_preserve_loss.shape)
+
+ total_loss = joint3d_loss + pose_prior_loss + angle_prior_loss + shape_prior_loss + collision_loss + pose_preserve_loss
+
+ return total_loss.sum()
+
+
+# #####--- get camera fitting loss -----
+def camera_fitting_loss_3d(model_joints, camera_t, camera_t_est,
+ j3d, joints_category="orig", depth_loss_weight=100.0):
+ """
+ Loss function for camera optimization.
+ """
+ model_joints = model_joints + camera_t
+ # # get the indexed four
+ # op_joints = ['OP RHip', 'OP LHip', 'OP RShoulder', 'OP LShoulder']
+ # op_joints_ind = [config.JOINT_MAP[joint] for joint in op_joints]
+ #
+ # j3d_error_loss = (j3d[:, op_joints_ind] -
+ # model_joints[:, op_joints_ind]) ** 2
+
+ gt_joints = ['RHip', 'LHip', 'RShoulder', 'LShoulder']
+ gt_joints_ind = [config.JOINT_MAP[joint] for joint in gt_joints]
+
+ if joints_category=="orig":
+ select_joints_ind = [config.JOINT_MAP[joint] for joint in gt_joints]
+ elif joints_category=="AMASS":
+ select_joints_ind = [config.AMASS_JOINT_MAP[joint] for joint in gt_joints]
+ else:
+ print("NO SUCH JOINTS CATEGORY!")
+
+ j3d_error_loss = (j3d[:, select_joints_ind] -
+ model_joints[:, gt_joints_ind]) ** 2
+
+ # Loss that penalizes deviation from depth estimate
+ depth_loss = (depth_loss_weight**2) * (camera_t - camera_t_est)**2
+
+ total_loss = j3d_error_loss + depth_loss
+ return total_loss.sum()
diff --git a/generate_human_motion/VQTrans/visualize/joints2smpl/src/prior.py b/generate_human_motion/VQTrans/visualize/joints2smpl/src/prior.py
new file mode 100644
index 0000000000000000000000000000000000000000..7f13806dd1f6607507b0c7e5ad463b3fb0026be8
--- /dev/null
+++ b/generate_human_motion/VQTrans/visualize/joints2smpl/src/prior.py
@@ -0,0 +1,230 @@
+# -*- coding: utf-8 -*-
+
+# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
+# holder of all proprietary rights on this computer program.
+# You can only use this computer program if you have closed
+# a license agreement with MPG or you get the right to use the computer
+# program from someone who is authorized to grant you that right.
+# Any use of the computer program without a valid license is prohibited and
+# liable to prosecution.
+#
+# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
+# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
+# for Intelligent Systems. All rights reserved.
+#
+# Contact: ps-license@tuebingen.mpg.de
+
+from __future__ import absolute_import
+from __future__ import print_function
+from __future__ import division
+
+import sys
+import os
+
+import time
+import pickle
+
+import numpy as np
+
+import torch
+import torch.nn as nn
+
+DEFAULT_DTYPE = torch.float32
+
+
+def create_prior(prior_type, **kwargs):
+ if prior_type == 'gmm':
+ prior = MaxMixturePrior(**kwargs)
+ elif prior_type == 'l2':
+ return L2Prior(**kwargs)
+ elif prior_type == 'angle':
+ return SMPLifyAnglePrior(**kwargs)
+ elif prior_type == 'none' or prior_type is None:
+ # Don't use any pose prior
+ def no_prior(*args, **kwargs):
+ return 0.0
+ prior = no_prior
+ else:
+ raise ValueError('Prior {}'.format(prior_type) + ' is not implemented')
+ return prior
+
+
+class SMPLifyAnglePrior(nn.Module):
+ def __init__(self, dtype=torch.float32, **kwargs):
+ super(SMPLifyAnglePrior, self).__init__()
+
+ # Indices for the roration angle of
+ # 55: left elbow, 90deg bend at -np.pi/2
+ # 58: right elbow, 90deg bend at np.pi/2
+ # 12: left knee, 90deg bend at np.pi/2
+ # 15: right knee, 90deg bend at np.pi/2
+ angle_prior_idxs = np.array([55, 58, 12, 15], dtype=np.int64)
+ angle_prior_idxs = torch.tensor(angle_prior_idxs, dtype=torch.long)
+ self.register_buffer('angle_prior_idxs', angle_prior_idxs)
+
+ angle_prior_signs = np.array([1, -1, -1, -1],
+ dtype=np.float32 if dtype == torch.float32
+ else np.float64)
+ angle_prior_signs = torch.tensor(angle_prior_signs,
+ dtype=dtype)
+ self.register_buffer('angle_prior_signs', angle_prior_signs)
+
+ def forward(self, pose, with_global_pose=False):
+ ''' Returns the angle prior loss for the given pose
+
+ Args:
+ pose: (Bx[23 + 1] * 3) torch tensor with the axis-angle
+ representation of the rotations of the joints of the SMPL model.
+ Kwargs:
+ with_global_pose: Whether the pose vector also contains the global
+ orientation of the SMPL model. If not then the indices must be
+ corrected.
+ Returns:
+ A sze (B) tensor containing the angle prior loss for each element
+ in the batch.
+ '''
+ angle_prior_idxs = self.angle_prior_idxs - (not with_global_pose) * 3
+ return torch.exp(pose[:, angle_prior_idxs] *
+ self.angle_prior_signs).pow(2)
+
+
+class L2Prior(nn.Module):
+ def __init__(self, dtype=DEFAULT_DTYPE, reduction='sum', **kwargs):
+ super(L2Prior, self).__init__()
+
+ def forward(self, module_input, *args):
+ return torch.sum(module_input.pow(2))
+
+
+class MaxMixturePrior(nn.Module):
+
+ def __init__(self, prior_folder='prior',
+ num_gaussians=6, dtype=DEFAULT_DTYPE, epsilon=1e-16,
+ use_merged=True,
+ **kwargs):
+ super(MaxMixturePrior, self).__init__()
+
+ if dtype == DEFAULT_DTYPE:
+ np_dtype = np.float32
+ elif dtype == torch.float64:
+ np_dtype = np.float64
+ else:
+ print('Unknown float type {}, exiting!'.format(dtype))
+ sys.exit(-1)
+
+ self.num_gaussians = num_gaussians
+ self.epsilon = epsilon
+ self.use_merged = use_merged
+ gmm_fn = 'gmm_{:02d}.pkl'.format(num_gaussians)
+
+ full_gmm_fn = os.path.join(prior_folder, gmm_fn)
+ if not os.path.exists(full_gmm_fn):
+ print('The path to the mixture prior "{}"'.format(full_gmm_fn) +
+ ' does not exist, exiting!')
+ sys.exit(-1)
+
+ with open(full_gmm_fn, 'rb') as f:
+ gmm = pickle.load(f, encoding='latin1')
+
+ if type(gmm) == dict:
+ means = gmm['means'].astype(np_dtype)
+ covs = gmm['covars'].astype(np_dtype)
+ weights = gmm['weights'].astype(np_dtype)
+ elif 'sklearn.mixture.gmm.GMM' in str(type(gmm)):
+ means = gmm.means_.astype(np_dtype)
+ covs = gmm.covars_.astype(np_dtype)
+ weights = gmm.weights_.astype(np_dtype)
+ else:
+ print('Unknown type for the prior: {}, exiting!'.format(type(gmm)))
+ sys.exit(-1)
+
+ self.register_buffer('means', torch.tensor(means, dtype=dtype))
+
+ self.register_buffer('covs', torch.tensor(covs, dtype=dtype))
+
+ precisions = [np.linalg.inv(cov) for cov in covs]
+ precisions = np.stack(precisions).astype(np_dtype)
+
+ self.register_buffer('precisions',
+ torch.tensor(precisions, dtype=dtype))
+
+ # The constant term:
+ sqrdets = np.array([(np.sqrt(np.linalg.det(c)))
+ for c in gmm['covars']])
+ const = (2 * np.pi)**(69 / 2.)
+
+ nll_weights = np.asarray(gmm['weights'] / (const *
+ (sqrdets / sqrdets.min())))
+ nll_weights = torch.tensor(nll_weights, dtype=dtype).unsqueeze(dim=0)
+ self.register_buffer('nll_weights', nll_weights)
+
+ weights = torch.tensor(gmm['weights'], dtype=dtype).unsqueeze(dim=0)
+ self.register_buffer('weights', weights)
+
+ self.register_buffer('pi_term',
+ torch.log(torch.tensor(2 * np.pi, dtype=dtype)))
+
+ cov_dets = [np.log(np.linalg.det(cov.astype(np_dtype)) + epsilon)
+ for cov in covs]
+ self.register_buffer('cov_dets',
+ torch.tensor(cov_dets, dtype=dtype))
+
+ # The dimensionality of the random variable
+ self.random_var_dim = self.means.shape[1]
+
+ def get_mean(self):
+ ''' Returns the mean of the mixture '''
+ mean_pose = torch.matmul(self.weights, self.means)
+ return mean_pose
+
+ def merged_log_likelihood(self, pose, betas):
+ diff_from_mean = pose.unsqueeze(dim=1) - self.means
+
+ prec_diff_prod = torch.einsum('mij,bmj->bmi',
+ [self.precisions, diff_from_mean])
+ diff_prec_quadratic = (prec_diff_prod * diff_from_mean).sum(dim=-1)
+
+ curr_loglikelihood = 0.5 * diff_prec_quadratic - \
+ torch.log(self.nll_weights)
+ # curr_loglikelihood = 0.5 * (self.cov_dets.unsqueeze(dim=0) +
+ # self.random_var_dim * self.pi_term +
+ # diff_prec_quadratic
+ # ) - torch.log(self.weights)
+
+ min_likelihood, _ = torch.min(curr_loglikelihood, dim=1)
+ return min_likelihood
+
+ def log_likelihood(self, pose, betas, *args, **kwargs):
+ ''' Create graph operation for negative log-likelihood calculation
+ '''
+ likelihoods = []
+
+ for idx in range(self.num_gaussians):
+ mean = self.means[idx]
+ prec = self.precisions[idx]
+ cov = self.covs[idx]
+ diff_from_mean = pose - mean
+
+ curr_loglikelihood = torch.einsum('bj,ji->bi',
+ [diff_from_mean, prec])
+ curr_loglikelihood = torch.einsum('bi,bi->b',
+ [curr_loglikelihood,
+ diff_from_mean])
+ cov_term = torch.log(torch.det(cov) + self.epsilon)
+ curr_loglikelihood += 0.5 * (cov_term +
+ self.random_var_dim *
+ self.pi_term)
+ likelihoods.append(curr_loglikelihood)
+
+ log_likelihoods = torch.stack(likelihoods, dim=1)
+ min_idx = torch.argmin(log_likelihoods, dim=1)
+ weight_component = self.nll_weights[:, min_idx]
+ weight_component = -torch.log(weight_component)
+
+ return weight_component + log_likelihoods[:, min_idx]
+
+ def forward(self, pose, betas):
+ if self.use_merged:
+ return self.merged_log_likelihood(pose, betas)
+ else:
+ return self.log_likelihood(pose, betas)
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/visualize/joints2smpl/src/smplify.py b/generate_human_motion/VQTrans/visualize/joints2smpl/src/smplify.py
new file mode 100644
index 0000000000000000000000000000000000000000..580efef98dfdcf6e7486b7f5c5436820edfb6c4b
--- /dev/null
+++ b/generate_human_motion/VQTrans/visualize/joints2smpl/src/smplify.py
@@ -0,0 +1,279 @@
+import torch
+import os, sys
+import pickle
+import smplx
+import numpy as np
+
+sys.path.append(os.path.dirname(__file__))
+from customloss import (camera_fitting_loss,
+ body_fitting_loss,
+ camera_fitting_loss_3d,
+ body_fitting_loss_3d,
+ )
+from prior import MaxMixturePrior
+from visualize.joints2smpl.src import config
+
+
+
+@torch.no_grad()
+def guess_init_3d(model_joints,
+ j3d,
+ joints_category="orig"):
+ """Initialize the camera translation via triangle similarity, by using the torso joints .
+ :param model_joints: SMPL model with pre joints
+ :param j3d: 25x3 array of Kinect Joints
+ :returns: 3D vector corresponding to the estimated camera translation
+ """
+ # get the indexed four
+ gt_joints = ['RHip', 'LHip', 'RShoulder', 'LShoulder']
+ gt_joints_ind = [config.JOINT_MAP[joint] for joint in gt_joints]
+
+ if joints_category=="orig":
+ joints_ind_category = [config.JOINT_MAP[joint] for joint in gt_joints]
+ elif joints_category=="AMASS":
+ joints_ind_category = [config.AMASS_JOINT_MAP[joint] for joint in gt_joints]
+ else:
+ print("NO SUCH JOINTS CATEGORY!")
+
+ sum_init_t = (j3d[:, joints_ind_category] - model_joints[:, gt_joints_ind]).sum(dim=1)
+ init_t = sum_init_t / 4.0
+ return init_t
+
+
+# SMPLIfy 3D
+class SMPLify3D():
+ """Implementation of SMPLify, use 3D joints."""
+
+ def __init__(self,
+ smplxmodel,
+ step_size=1e-2,
+ batch_size=1,
+ num_iters=100,
+ use_collision=False,
+ use_lbfgs=True,
+ joints_category="orig",
+ device=torch.device('cuda:0'),
+ ):
+
+ # Store options
+ self.batch_size = batch_size
+ self.device = device
+ self.step_size = step_size
+
+ self.num_iters = num_iters
+ # --- choose optimizer
+ self.use_lbfgs = use_lbfgs
+ # GMM pose prior
+ self.pose_prior = MaxMixturePrior(prior_folder=config.GMM_MODEL_DIR,
+ num_gaussians=8,
+ dtype=torch.float32).to(device)
+ # collision part
+ self.use_collision = use_collision
+ if self.use_collision:
+ self.part_segm_fn = config.Part_Seg_DIR
+
+ # reLoad SMPL-X model
+ self.smpl = smplxmodel
+
+ self.model_faces = smplxmodel.faces_tensor.view(-1)
+
+ # select joint joint_category
+ self.joints_category = joints_category
+
+ if joints_category=="orig":
+ self.smpl_index = config.full_smpl_idx
+ self.corr_index = config.full_smpl_idx
+ elif joints_category=="AMASS":
+ self.smpl_index = config.amass_smpl_idx
+ self.corr_index = config.amass_idx
+ else:
+ self.smpl_index = None
+ self.corr_index = None
+ print("NO SUCH JOINTS CATEGORY!")
+
+ # ---- get the man function here ------
+ def __call__(self, init_pose, init_betas, init_cam_t, j3d, conf_3d=1.0, seq_ind=0):
+ """Perform body fitting.
+ Input:
+ init_pose: SMPL pose estimate
+ init_betas: SMPL betas estimate
+ init_cam_t: Camera translation estimate
+ j3d: joints 3d aka keypoints
+ conf_3d: confidence for 3d joints
+ seq_ind: index of the sequence
+ Returns:
+ vertices: Vertices of optimized shape
+ joints: 3D joints of optimized shape
+ pose: SMPL pose parameters of optimized shape
+ betas: SMPL beta parameters of optimized shape
+ camera_translation: Camera translation
+ """
+
+ # # # add the mesh inter-section to avoid
+ search_tree = None
+ pen_distance = None
+ filter_faces = None
+
+ if self.use_collision:
+ from mesh_intersection.bvh_search_tree import BVH
+ import mesh_intersection.loss as collisions_loss
+ from mesh_intersection.filter_faces import FilterFaces
+
+ search_tree = BVH(max_collisions=8)
+
+ pen_distance = collisions_loss.DistanceFieldPenetrationLoss(
+ sigma=0.5, point2plane=False, vectorized=True, penalize_outside=True)
+
+ if self.part_segm_fn:
+ # Read the part segmentation
+ part_segm_fn = os.path.expandvars(self.part_segm_fn)
+ with open(part_segm_fn, 'rb') as faces_parents_file:
+ face_segm_data = pickle.load(faces_parents_file, encoding='latin1')
+ faces_segm = face_segm_data['segm']
+ faces_parents = face_segm_data['parents']
+ # Create the module used to filter invalid collision pairs
+ filter_faces = FilterFaces(
+ faces_segm=faces_segm, faces_parents=faces_parents,
+ ign_part_pairs=None).to(device=self.device)
+
+
+ # Split SMPL pose to body pose and global orientation
+ body_pose = init_pose[:, 3:].detach().clone()
+ global_orient = init_pose[:, :3].detach().clone()
+ betas = init_betas.detach().clone()
+
+ # use guess 3d to get the initial
+ smpl_output = self.smpl(global_orient=global_orient,
+ body_pose=body_pose,
+ betas=betas)
+ model_joints = smpl_output.joints
+
+ init_cam_t = guess_init_3d(model_joints, j3d, self.joints_category).unsqueeze(1).detach()
+ camera_translation = init_cam_t.clone()
+
+ preserve_pose = init_pose[:, 3:].detach().clone()
+ # -------------Step 1: Optimize camera translation and body orientation--------
+ # Optimize only camera translation and body orientation
+ body_pose.requires_grad = False
+ betas.requires_grad = False
+ global_orient.requires_grad = True
+ camera_translation.requires_grad = True
+
+ camera_opt_params = [global_orient, camera_translation]
+
+ if self.use_lbfgs:
+ camera_optimizer = torch.optim.LBFGS(camera_opt_params, max_iter=self.num_iters,
+ lr=self.step_size, line_search_fn='strong_wolfe')
+ for i in range(10):
+ def closure():
+ camera_optimizer.zero_grad()
+ smpl_output = self.smpl(global_orient=global_orient,
+ body_pose=body_pose,
+ betas=betas)
+ model_joints = smpl_output.joints
+ # print('model_joints', model_joints.shape)
+ # print('camera_translation', camera_translation.shape)
+ # print('init_cam_t', init_cam_t.shape)
+ # print('j3d', j3d.shape)
+ loss = camera_fitting_loss_3d(model_joints, camera_translation,
+ init_cam_t, j3d, self.joints_category)
+ loss.backward()
+ return loss
+
+ camera_optimizer.step(closure)
+ else:
+ camera_optimizer = torch.optim.Adam(camera_opt_params, lr=self.step_size, betas=(0.9, 0.999))
+
+ for i in range(20):
+ smpl_output = self.smpl(global_orient=global_orient,
+ body_pose=body_pose,
+ betas=betas)
+ model_joints = smpl_output.joints
+
+ loss = camera_fitting_loss_3d(model_joints[:, self.smpl_index], camera_translation,
+ init_cam_t, j3d[:, self.corr_index], self.joints_category)
+ camera_optimizer.zero_grad()
+ loss.backward()
+ camera_optimizer.step()
+
+ # Fix camera translation after optimizing camera
+ # --------Step 2: Optimize body joints --------------------------
+ # Optimize only the body pose and global orientation of the body
+ body_pose.requires_grad = True
+ global_orient.requires_grad = True
+ camera_translation.requires_grad = True
+
+ # --- if we use the sequence, fix the shape
+ if seq_ind == 0:
+ betas.requires_grad = True
+ body_opt_params = [body_pose, betas, global_orient, camera_translation]
+ else:
+ betas.requires_grad = False
+ body_opt_params = [body_pose, global_orient, camera_translation]
+
+ if self.use_lbfgs:
+ body_optimizer = torch.optim.LBFGS(body_opt_params, max_iter=self.num_iters,
+ lr=self.step_size, line_search_fn='strong_wolfe')
+ for i in range(self.num_iters):
+ def closure():
+ body_optimizer.zero_grad()
+ smpl_output = self.smpl(global_orient=global_orient,
+ body_pose=body_pose,
+ betas=betas)
+ model_joints = smpl_output.joints
+ model_vertices = smpl_output.vertices
+
+ loss = body_fitting_loss_3d(body_pose, preserve_pose, betas, model_joints[:, self.smpl_index], camera_translation,
+ j3d[:, self.corr_index], self.pose_prior,
+ joints3d_conf=conf_3d,
+ joint_loss_weight=600.0,
+ pose_preserve_weight=5.0,
+ use_collision=self.use_collision,
+ model_vertices=model_vertices, model_faces=self.model_faces,
+ search_tree=search_tree, pen_distance=pen_distance, filter_faces=filter_faces)
+ loss.backward()
+ return loss
+
+ body_optimizer.step(closure)
+ else:
+ body_optimizer = torch.optim.Adam(body_opt_params, lr=self.step_size, betas=(0.9, 0.999))
+
+ for i in range(self.num_iters):
+ smpl_output = self.smpl(global_orient=global_orient,
+ body_pose=body_pose,
+ betas=betas)
+ model_joints = smpl_output.joints
+ model_vertices = smpl_output.vertices
+
+ loss = body_fitting_loss_3d(body_pose, preserve_pose, betas, model_joints[:, self.smpl_index], camera_translation,
+ j3d[:, self.corr_index], self.pose_prior,
+ joints3d_conf=conf_3d,
+ joint_loss_weight=600.0,
+ use_collision=self.use_collision,
+ model_vertices=model_vertices, model_faces=self.model_faces,
+ search_tree=search_tree, pen_distance=pen_distance, filter_faces=filter_faces)
+ body_optimizer.zero_grad()
+ loss.backward()
+ body_optimizer.step()
+
+ # Get final loss value
+ with torch.no_grad():
+ smpl_output = self.smpl(global_orient=global_orient,
+ body_pose=body_pose,
+ betas=betas, return_full_pose=True)
+ model_joints = smpl_output.joints
+ model_vertices = smpl_output.vertices
+
+ final_loss = body_fitting_loss_3d(body_pose, preserve_pose, betas, model_joints[:, self.smpl_index], camera_translation,
+ j3d[:, self.corr_index], self.pose_prior,
+ joints3d_conf=conf_3d,
+ joint_loss_weight=600.0,
+ use_collision=self.use_collision, model_vertices=model_vertices, model_faces=self.model_faces,
+ search_tree=search_tree, pen_distance=pen_distance, filter_faces=filter_faces)
+
+ vertices = smpl_output.vertices.detach()
+ joints = smpl_output.joints.detach()
+ pose = torch.cat([global_orient, body_pose], dim=-1).detach()
+ betas = betas.detach()
+
+ return vertices, joints, pose, betas, camera_translation, final_loss
diff --git a/generate_human_motion/VQTrans/visualize/render_mesh.py b/generate_human_motion/VQTrans/visualize/render_mesh.py
new file mode 100644
index 0000000000000000000000000000000000000000..d44d04f551ccb4f1ffc9efb4cb1a44c407ede836
--- /dev/null
+++ b/generate_human_motion/VQTrans/visualize/render_mesh.py
@@ -0,0 +1,33 @@
+import argparse
+import os
+from visualize import vis_utils
+import shutil
+from tqdm import tqdm
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--input_path", type=str, required=True, help='stick figure mp4 file to be rendered.')
+ parser.add_argument("--cuda", type=bool, default=True, help='')
+ parser.add_argument("--device", type=int, default=0, help='')
+ params = parser.parse_args()
+
+ assert params.input_path.endswith('.mp4')
+ parsed_name = os.path.basename(params.input_path).replace('.mp4', '').replace('sample', '').replace('rep', '')
+ sample_i, rep_i = [int(e) for e in parsed_name.split('_')]
+ npy_path = os.path.join(os.path.dirname(params.input_path), 'results.npy')
+ out_npy_path = params.input_path.replace('.mp4', '_smpl_params.npy')
+ assert os.path.exists(npy_path)
+ results_dir = params.input_path.replace('.mp4', '_obj')
+ if os.path.exists(results_dir):
+ shutil.rmtree(results_dir)
+ os.makedirs(results_dir)
+
+ npy2obj = vis_utils.npy2obj(npy_path, sample_i, rep_i,
+ device=params.device, cuda=params.cuda)
+
+ print('Saving obj files to [{}]'.format(os.path.abspath(results_dir)))
+ for frame_i in tqdm(range(npy2obj.real_num_frames)):
+ npy2obj.save_obj(os.path.join(results_dir, 'frame{:03d}.obj'.format(frame_i)), frame_i)
+
+ print('Saving SMPL params to [{}]'.format(os.path.abspath(out_npy_path)))
+ npy2obj.save_npy(out_npy_path)
diff --git a/generate_human_motion/VQTrans/visualize/simplify_loc2rot.py b/generate_human_motion/VQTrans/visualize/simplify_loc2rot.py
new file mode 100644
index 0000000000000000000000000000000000000000..d50870acdc891061700afa8e33eca8036be8c867
--- /dev/null
+++ b/generate_human_motion/VQTrans/visualize/simplify_loc2rot.py
@@ -0,0 +1,131 @@
+import numpy as np
+import os
+import torch
+from visualize.joints2smpl.src import config
+import smplx
+import h5py
+from visualize.joints2smpl.src.smplify import SMPLify3D
+from tqdm import tqdm
+import VQTrans.utils.rotation_conversions as geometry
+import argparse
+
+
+class joints2smpl:
+
+ def __init__(self, num_frames, device_id, cuda=True):
+ self.device = torch.device("cuda:" + str(device_id) if cuda else "cpu")
+ # self.device = torch.device("cpu")
+ self.batch_size = num_frames
+ self.num_joints = 22 # for HumanML3D
+ self.joint_category = "AMASS"
+ self.num_smplify_iters = 150
+ self.fix_foot = False
+ print(config.SMPL_MODEL_DIR)
+ smplmodel = smplx.create(config.SMPL_MODEL_DIR,
+ model_type="smpl", gender="neutral", ext="pkl",
+ batch_size=self.batch_size).to(self.device)
+
+ # ## --- load the mean pose as original ----
+ smpl_mean_file = config.SMPL_MEAN_FILE
+
+ file = h5py.File(smpl_mean_file, 'r')
+ self.init_mean_pose = torch.from_numpy(file['pose'][:]).unsqueeze(0).repeat(self.batch_size, 1).float().to(self.device)
+ self.init_mean_shape = torch.from_numpy(file['shape'][:]).unsqueeze(0).repeat(self.batch_size, 1).float().to(self.device)
+ self.cam_trans_zero = torch.Tensor([0.0, 0.0, 0.0]).unsqueeze(0).to(self.device)
+ #
+
+ # # #-------------initialize SMPLify
+ self.smplify = SMPLify3D(smplxmodel=smplmodel,
+ batch_size=self.batch_size,
+ joints_category=self.joint_category,
+ num_iters=self.num_smplify_iters,
+ device=self.device)
+
+
+ def npy2smpl(self, npy_path):
+ out_path = npy_path.replace('.npy', '_rot.npy')
+ motions = np.load(npy_path, allow_pickle=True)[None][0]
+ # print_batch('', motions)
+ n_samples = motions['motion'].shape[0]
+ all_thetas = []
+ for sample_i in tqdm(range(n_samples)):
+ thetas, _ = self.joint2smpl(motions['motion'][sample_i].transpose(2, 0, 1)) # [nframes, njoints, 3]
+ all_thetas.append(thetas.cpu().numpy())
+ motions['motion'] = np.concatenate(all_thetas, axis=0)
+ print('motions', motions['motion'].shape)
+
+ print(f'Saving [{out_path}]')
+ np.save(out_path, motions)
+ exit()
+
+
+
+ def joint2smpl(self, input_joints, init_params=None):
+ _smplify = self.smplify # if init_params is None else self.smplify_fast
+ pred_pose = torch.zeros(self.batch_size, 72).to(self.device)
+ pred_betas = torch.zeros(self.batch_size, 10).to(self.device)
+ pred_cam_t = torch.zeros(self.batch_size, 3).to(self.device)
+ keypoints_3d = torch.zeros(self.batch_size, self.num_joints, 3).to(self.device)
+
+ # run the whole seqs
+ num_seqs = input_joints.shape[0]
+
+
+ # joints3d = input_joints[idx] # *1.2 #scale problem [check first]
+ keypoints_3d = torch.Tensor(input_joints).to(self.device).float()
+
+ # if idx == 0:
+ if init_params is None:
+ pred_betas = self.init_mean_shape
+ pred_pose = self.init_mean_pose
+ pred_cam_t = self.cam_trans_zero
+ else:
+ pred_betas = init_params['betas']
+ pred_pose = init_params['pose']
+ pred_cam_t = init_params['cam']
+
+ if self.joint_category == "AMASS":
+ confidence_input = torch.ones(self.num_joints)
+ # make sure the foot and ankle
+ if self.fix_foot == True:
+ confidence_input[7] = 1.5
+ confidence_input[8] = 1.5
+ confidence_input[10] = 1.5
+ confidence_input[11] = 1.5
+ else:
+ print("Such category not settle down!")
+
+ new_opt_vertices, new_opt_joints, new_opt_pose, new_opt_betas, \
+ new_opt_cam_t, new_opt_joint_loss = _smplify(
+ pred_pose.detach(),
+ pred_betas.detach(),
+ pred_cam_t.detach(),
+ keypoints_3d,
+ conf_3d=confidence_input.to(self.device),
+ # seq_ind=idx
+ )
+
+ thetas = new_opt_pose.reshape(self.batch_size, 24, 3)
+ thetas = geometry.matrix_to_rotation_6d(geometry.axis_angle_to_matrix(thetas)) # [bs, 24, 6]
+ root_loc = torch.tensor(keypoints_3d[:, 0]) # [bs, 3]
+ root_loc = torch.cat([root_loc, torch.zeros_like(root_loc)], dim=-1).unsqueeze(1) # [bs, 1, 6]
+ thetas = torch.cat([thetas, root_loc], dim=1).unsqueeze(0).permute(0, 2, 3, 1) # [1, 25, 6, 196]
+
+ return thetas.clone().detach(), {'pose': new_opt_joints[0, :24].flatten().clone().detach(), 'betas': new_opt_betas.clone().detach(), 'cam': new_opt_cam_t.clone().detach()}
+
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--input_path", type=str, required=True, help='Blender file or dir with blender files')
+ parser.add_argument("--cuda", type=bool, default=True, help='')
+ parser.add_argument("--device", type=int, default=0, help='')
+ params = parser.parse_args()
+
+ simplify = joints2smpl(device_id=params.device, cuda=params.cuda)
+
+ if os.path.isfile(params.input_path) and params.input_path.endswith('.npy'):
+ simplify.npy2smpl(params.input_path)
+ elif os.path.isdir(params.input_path):
+ files = [os.path.join(params.input_path, f) for f in os.listdir(params.input_path) if f.endswith('.npy')]
+ for f in files:
+ simplify.npy2smpl(f)
\ No newline at end of file
diff --git a/generate_human_motion/VQTrans/visualize/vis_utils.py b/generate_human_motion/VQTrans/visualize/vis_utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..05728b38e3d6be4bfd83324907e3fa7a3f358071
--- /dev/null
+++ b/generate_human_motion/VQTrans/visualize/vis_utils.py
@@ -0,0 +1,66 @@
+from model.rotation2xyz import Rotation2xyz
+import numpy as np
+from trimesh import Trimesh
+import os
+import torch
+from visualize.simplify_loc2rot import joints2smpl
+
+class npy2obj:
+ def __init__(self, npy_path, sample_idx, rep_idx, device=0, cuda=True):
+ self.npy_path = npy_path
+ self.motions = np.load(self.npy_path, allow_pickle=True)
+ if self.npy_path.endswith('.npz'):
+ self.motions = self.motions['arr_0']
+ self.motions = self.motions[None][0]
+ self.rot2xyz = Rotation2xyz(device='cpu')
+ self.faces = self.rot2xyz.smpl_model.faces
+ self.bs, self.njoints, self.nfeats, self.nframes = self.motions['motion'].shape
+ self.opt_cache = {}
+ self.sample_idx = sample_idx
+ self.total_num_samples = self.motions['num_samples']
+ self.rep_idx = rep_idx
+ self.absl_idx = self.rep_idx*self.total_num_samples + self.sample_idx
+ self.num_frames = self.motions['motion'][self.absl_idx].shape[-1]
+ self.j2s = joints2smpl(num_frames=self.num_frames, device_id=device, cuda=cuda)
+
+ if self.nfeats == 3:
+ print(f'Running SMPLify For sample [{sample_idx}], repetition [{rep_idx}], it may take a few minutes.')
+ motion_tensor, opt_dict = self.j2s.joint2smpl(self.motions['motion'][self.absl_idx].transpose(2, 0, 1)) # [nframes, njoints, 3]
+ self.motions['motion'] = motion_tensor.cpu().numpy()
+ elif self.nfeats == 6:
+ self.motions['motion'] = self.motions['motion'][[self.absl_idx]]
+ self.bs, self.njoints, self.nfeats, self.nframes = self.motions['motion'].shape
+ self.real_num_frames = self.motions['lengths'][self.absl_idx]
+
+ self.vertices = self.rot2xyz(torch.tensor(self.motions['motion']), mask=None,
+ pose_rep='rot6d', translation=True, glob=True,
+ jointstype='vertices',
+ # jointstype='smpl', # for joint locations
+ vertstrans=True)
+ self.root_loc = self.motions['motion'][:, -1, :3, :].reshape(1, 1, 3, -1)
+ self.vertices += self.root_loc
+
+ def get_vertices(self, sample_i, frame_i):
+ return self.vertices[sample_i, :, :, frame_i].squeeze().tolist()
+
+ def get_trimesh(self, sample_i, frame_i):
+ return Trimesh(vertices=self.get_vertices(sample_i, frame_i),
+ faces=self.faces)
+
+ def save_obj(self, save_path, frame_i):
+ mesh = self.get_trimesh(0, frame_i)
+ with open(save_path, 'w') as fw:
+ mesh.export(fw, 'obj')
+ return save_path
+
+ def save_npy(self, save_path):
+ data_dict = {
+ 'motion': self.motions['motion'][0, :, :, :self.real_num_frames],
+ 'thetas': self.motions['motion'][0, :-1, :, :self.real_num_frames],
+ 'root_translation': self.motions['motion'][0, -1, :3, :self.real_num_frames],
+ 'faces': self.faces,
+ 'vertices': self.vertices[0, :, :, :self.real_num_frames],
+ 'text': self.motions['text'][0],
+ 'length': self.real_num_frames,
+ }
+ np.save(save_path, data_dict)
diff --git a/generate_human_motion/app.py b/generate_human_motion/app.py
new file mode 100644
index 0000000000000000000000000000000000000000..a70e8bb5f2bf486c27da82dc542797447a8ebdb9
--- /dev/null
+++ b/generate_human_motion/app.py
@@ -0,0 +1,319 @@
+import sys
+import os
+import OpenGL.GL as gl
+os.environ["PYOPENGL_PLATFORM"] = "egl"
+os.environ["MESA_GL_VERSION_OVERRIDE"] = "4.1"
+#os.system('pip install E:\Text2Motion\Human_motion\generate_human_motion\pyrender')
+
+sys.argv = ['VQTrans/GPT_eval_multi.py']
+os.chdir('VQTrans')
+
+sys.path.append('E:\Text2Motion\Human_motion\generate_human_motion\VQTrans')
+sys.path.append('E:\Text2Motion\Human_motion\generate_human_motion\pyrender')
+sys.path.append('E:\Text2Motion\Human_motion\generate_human_motion\VQTrans\models')
+
+import options.option_transformer as option_trans
+from huggingface_hub import snapshot_download
+model_path = snapshot_download(repo_id="vumichien/T2M-GPT")
+
+args = option_trans.get_args_parser()
+
+args.dataname = 't2m'
+args.resume_pth = f'{model_path}/VQVAE/net_last.pth'
+args.resume_trans = f'{model_path}/VQTransformer_corruption05/net_best_fid.pth'
+args.down_t = 2
+args.depth = 3
+args.block_size = 51
+
+import clip
+import torch
+import numpy as np
+#import models.vqvae as vqvae
+import VQTrans.models.vqvae as vqvae
+import VQTrans.models.t2m_trans as trans
+from VQTrans.utils.motion_process import recover_from_ric
+import VQTrans.visualization.plot_3d_global as plot_3d
+from VQTrans.models.rotation2xyz import Rotation2xyz
+import numpy as np
+from trimesh import Trimesh
+import gc
+
+import torch
+from visualize.simplify_loc2rot import joints2smpl
+import pyrender
+# import matplotlib.pyplot as plt
+
+import io
+import imageio
+from shapely import geometry
+import trimesh
+from pyrender.constants import RenderFlags
+import math
+# import ffmpeg
+# from PIL import Image
+import hashlib
+import gradio as gr
+import moviepy.editor as mp
+
+## load clip model and datasets
+is_cuda = torch.cuda.is_available()
+device = torch.device("cuda" if is_cuda else "cpu")
+print(device)
+clip_model, clip_preprocess = clip.load("ViT-B/32", device=device, jit=False, download_root='./') # Must set jit=False for training
+
+if is_cuda:
+ clip.model.convert_weights(clip_model)
+
+clip_model.eval()
+for p in clip_model.parameters():
+ p.requires_grad = False
+
+net = vqvae.HumanVQVAE(args, ## use args to define different parameters in different quantizers
+ args.nb_code,
+ args.code_dim,
+ args.output_emb_width,
+ args.down_t,
+ args.stride_t,
+ args.width,
+ args.depth,
+ args.dilation_growth_rate)
+
+
+trans_encoder = trans.Text2Motion_Transformer(num_vq=args.nb_code,
+ embed_dim=1024,
+ clip_dim=args.clip_dim,
+ block_size=args.block_size,
+ num_layers=9,
+ n_head=16,
+ drop_out_rate=args.drop_out_rate,
+ fc_rate=args.ff_rate)
+
+
+print('loading checkpoint from {}'.format(args.resume_pth))
+ckpt = torch.load(args.resume_pth, map_location='cpu')
+net.load_state_dict(ckpt['net'], strict=True)
+net.eval()
+
+print('loading transformer checkpoint from {}'.format(args.resume_trans))
+ckpt = torch.load(args.resume_trans, map_location='cpu')
+trans_encoder.load_state_dict(ckpt['trans'], strict=True)
+trans_encoder.eval()
+
+mean = torch.from_numpy(np.load(f'{model_path}/meta/mean.npy'))
+std = torch.from_numpy(np.load(f'{model_path}/meta/std.npy'))
+
+if is_cuda:
+ net.cuda()
+ trans_encoder.cuda()
+ mean = mean.cuda()
+ std = std.cuda()
+
+def render(motions, device_id=0, name='test_vis'):
+ frames, njoints, nfeats = motions.shape
+ MINS = motions.min(axis=0).min(axis=0)
+ MAXS = motions.max(axis=0).max(axis=0)
+
+ height_offset = MINS[1]
+ motions[:, :, 1] -= height_offset
+ trajec = motions[:, 0, [0, 2]]
+ is_cuda = torch.cuda.is_available()
+ # device = torch.device("cuda" if is_cuda else "cpu")
+ j2s = joints2smpl(num_frames=frames, device_id=0, cuda=is_cuda)
+ rot2xyz = Rotation2xyz(device=device)
+ faces = rot2xyz.smpl_model.faces
+
+ if not os.path.exists(f'output/{name}_pred.pt'):
+ print(f'Running SMPLify, it may take a few minutes.')
+ motion_tensor, opt_dict = j2s.joint2smpl(motions) # [nframes, njoints, 3]
+
+ vertices = rot2xyz(torch.tensor(motion_tensor).clone(), mask=None,
+ pose_rep='rot6d', translation=True, glob=True,
+ jointstype='vertices',
+ vertstrans=True)
+ vertices = vertices.detach().cpu()
+ torch.save(vertices, f'output/{name}_pred.pt')
+ else:
+ vertices = torch.load(f'output/{name}_pred.pt')
+ frames = vertices.shape[3] # shape: 1, nb_frames, 3, nb_joints
+ print(vertices.shape)
+ MINS = torch.min(torch.min(vertices[0], axis=0)[0], axis=1)[0]
+ MAXS = torch.max(torch.max(vertices[0], axis=0)[0], axis=1)[0]
+
+ out_list = []
+
+ minx = MINS[0] - 0.5
+ maxx = MAXS[0] + 0.5
+ minz = MINS[2] - 0.5
+ maxz = MAXS[2] + 0.5
+ polygon = geometry.Polygon([[minx, minz], [minx, maxz], [maxx, maxz], [maxx, minz]])
+ polygon_mesh = trimesh.creation.extrude_polygon(polygon, 1e-5)
+
+ vid = []
+ for i in range(frames):
+ if i % 10 == 0:
+ print(i)
+
+ mesh = Trimesh(vertices=vertices[0, :, :, i].squeeze().tolist(), faces=faces)
+
+ base_color = (0.11, 0.53, 0.8, 0.5)
+ ## OPAQUE rendering without alpha
+ ## BLEND rendering consider alpha
+ material = pyrender.MetallicRoughnessMaterial(
+ metallicFactor=0.7,
+ alphaMode='OPAQUE',
+ baseColorFactor=base_color
+ )
+
+
+ mesh = pyrender.Mesh.from_trimesh(mesh, material=material)
+
+ polygon_mesh.visual.face_colors = [0, 0, 0, 0.21]
+ polygon_render = pyrender.Mesh.from_trimesh(polygon_mesh, smooth=False)
+
+ bg_color = [1, 1, 1, 0.8]
+ scene = pyrender.Scene(bg_color=bg_color, ambient_light=(0.4, 0.4, 0.4))
+
+ sx, sy, tx, ty = [0.75, 0.75, 0, 0.10]
+
+ camera = pyrender.PerspectiveCamera(yfov=(np.pi / 3.0))
+
+ light = pyrender.DirectionalLight(color=[1,1,1], intensity=300)
+
+ scene.add(mesh)
+
+ c = np.pi / 2
+
+ scene.add(polygon_render, pose=np.array([[ 1, 0, 0, 0],
+
+ [ 0, np.cos(c), -np.sin(c), MINS[1].cpu().numpy()],
+
+ [ 0, np.sin(c), np.cos(c), 0],
+
+ [ 0, 0, 0, 1]]))
+
+ light_pose = np.eye(4)
+ light_pose[:3, 3] = [0, -1, 1]
+ scene.add(light, pose=light_pose.copy())
+
+ light_pose[:3, 3] = [0, 1, 1]
+ scene.add(light, pose=light_pose.copy())
+
+ light_pose[:3, 3] = [1, 1, 2]
+ scene.add(light, pose=light_pose.copy())
+
+
+ c = -np.pi / 6
+
+ scene.add(camera, pose=[[ 1, 0, 0, (minx+maxx).cpu().numpy()/2],
+
+ [ 0, np.cos(c), -np.sin(c), 1.5],
+
+ [ 0, np.sin(c), np.cos(c), max(4, minz.cpu().numpy()+(1.5-MINS[1].cpu().numpy())*2, (maxx-minx).cpu().numpy())],
+
+ [ 0, 0, 0, 1]
+ ])
+
+ # render scene
+ r = pyrender.OffscreenRenderer(960, 960)
+
+ color, _ = r.render(scene, flags=RenderFlags.RGBA)
+ # Image.fromarray(color).save(outdir+'/'+name+'_'+str(i)+'.png')
+
+ vid.append(color)
+
+ r.delete()
+
+ out = np.stack(vid, axis=0)
+ imageio.mimwrite(f'output/results.gif', out, fps=20)
+ out_video = mp.VideoFileClip(f'output/results.gif')
+ out_video.write_videofile("output/results.mp4")
+ del out, vertices
+ return f'output/results.mp4'
+
+def predict(clip_text, method='fast'):
+ gc.collect()
+ print('prompt text instruction: {}'.format(clip_text))
+ if torch.cuda.is_available():
+ text = clip.tokenize([clip_text], truncate=True).cuda()
+ else:
+ text = clip.tokenize([clip_text], truncate=True)
+ feat_clip_text = clip_model.encode_text(text).float()
+ index_motion = trans_encoder.sample(feat_clip_text[0:1], False)
+ pred_pose = net.forward_decoder(index_motion)
+ pred_xyz = recover_from_ric((pred_pose*std+mean).float(), 22)
+ output_name = hashlib.md5(clip_text.encode()).hexdigest()
+ if method == 'fast':
+ xyz = pred_xyz.reshape(1, -1, 22, 3)
+ pose_vis = plot_3d.draw_to_batch(xyz.detach().cpu().numpy(), title_batch=None, outname=[f'output/results.gif'])
+ out_video = mp.VideoFileClip("output/results.gif")
+ out_video.write_videofile("output/results.mp4")
+ return f'output/results.mp4'
+ elif method == 'slow':
+ output_path = render(pred_xyz.detach().cpu().numpy().squeeze(axis=0), device_id=0, name=output_name)
+ return output_path
+
+
+# ---- Gradio Layout -----
+text_prompt = gr.Textbox(label="Text prompt", lines=1, interactive=True)
+video_out = gr.Video(label="Motion", mirror_webcam=False, interactive=False)
+demo = gr.Blocks()
+demo.encrypt = False
+
+with demo:
+ gr.Markdown('''
+
+
Character Animation Creator using Text Prompt.
+ Text-2-Motion-GPT models for human motion creation from textural descriptors.
+
+ ''')
+ # with gr.Row():
+ # with gr.Column():
+ # gr.Markdown('''
+ #
+ #
+ # a man starts off in an up right position with botg arms extended out by his sides, he then brings his arms down to his body and claps his hands together. after this he wals down amd the the left where he proceeds to sit on a seat
+ #
+ #
+ # ''')
+ # with gr.Column():
+ # gr.Markdown('''
+ #
+ #
+ # a person puts their hands together, leans forwards slightly then swings the arms from right to left
+ #
+ #
+ # ''')
+ # with gr.Column():
+ # gr.Markdown('''
+ #
+ #
+ # a man is practicing the waltz with a partner
+ #
+ #
+ # ''')
+ with gr.Row():
+ with gr.Column():
+ gr.Markdown('''
+ ### Generate human motion by **Entering Text**
+ ''')
+ with gr.Column():
+ with gr.Row():
+ text_prompt.render()
+ method = gr.Dropdown(["slow", "fast"], label="Method", value="slow")
+ with gr.Row():
+ generate_btn = gr.Button("Generate")
+ generate_btn.click(predict, [text_prompt, method], [video_out], api_name="generate")
+ print(video_out)
+ with gr.Row():
+ video_out.render()
+ # with gr.Row():
+ # gr.Markdown('''
+ # ### You can test by following examples:
+ # ''')
+ # examples = gr.Examples(examples=
+ # [ "a person jogs in place, slowly at first, then increases speed. they then back up and squat down.",
+ # "a man steps forward and does a handstand",
+ # "a man rises from the ground, walks in a circle and sits back down on the ground"],
+ # label="Examples", inputs=[text_prompt])
+
+demo.launch(debug=True)
diff --git a/generate_human_motion/pyrender/.coveragerc b/generate_human_motion/pyrender/.coveragerc
new file mode 100644
index 0000000000000000000000000000000000000000..ee31cded3509cbd991a33dd27e2525b93a1a6558
--- /dev/null
+++ b/generate_human_motion/pyrender/.coveragerc
@@ -0,0 +1,5 @@
+[report]
+exclude_lines =
+ def __repr__
+ def __str__
+ @abc.abstractmethod
diff --git a/generate_human_motion/pyrender/.eggs/README.txt b/generate_human_motion/pyrender/.eggs/README.txt
new file mode 100644
index 0000000000000000000000000000000000000000..5d01668824f45c3a6683e12d1b9048bb1d273041
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/README.txt
@@ -0,0 +1,6 @@
+This directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins.
+
+This directory caches those eggs to prevent repeated downloads.
+
+However, it is safe to delete this directory.
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/LICENSE b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..467065f653add8f463e016d3a192b1125baafe71
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/LICENSE
@@ -0,0 +1,30 @@
+Copyright (c) 2006-2008 Alex Holkner
+Copyright (c) 2008-2023 pyglet contributors
+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 pyglet 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.
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/PKG-INFO b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/PKG-INFO
new file mode 100644
index 0000000000000000000000000000000000000000..d200a524b7253f8ac704787f832ecf921616df90
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/PKG-INFO
@@ -0,0 +1,180 @@
+Metadata-Version: 2.1
+Name: pyglet
+Version: 2.0.5
+Summary: Cross-platform windowing and multimedia library
+Home-page: http://pyglet.readthedocs.org/en/latest/
+Download-URL: http://pypi.python.org/pypi/pyglet
+Author: Alex Holkner
+Author-email: Alex.Holkner@gmail.com
+License: BSD
+Project-URL: Documentation, https://pyglet.readthedocs.io/en/latest
+Project-URL: Source, https://github.com/pyglet/pyglet
+Project-URL: Tracker, https://github.com/pyglet/pyglet/issues
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: MacOS X
+Classifier: Environment :: Win32 (MS Windows)
+Classifier: Environment :: X11 Applications
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: POSIX :: Linux
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Topic :: Games/Entertainment
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Description-Content-Type: text/markdown
+License-File: LICENSE
+
+[](https://pypi.python.org/pypi/pyglet) [](https://pyglet.readthedocs.io) [](https://github.com/pyglet/pyglet/actions/workflows/unittests.yml)
+
+
+
+# pyglet
+
+*pyglet* is a cross-platform windowing and multimedia library for Python, intended for developing games
+and other visually rich applications. It supports windowing, user interface event handling, Joysticks,
+OpenGL graphics, loading images and videos, and playing sounds and music. *pyglet* works on Windows, OS X and Linux.
+
+> :exclamation: :exclamation: A major pyglet update has just been released (v2.0). This brings many
+> new exciting features, but also some necessary breaking changes. If your game/application has suddenly
+> stopped working, please read the [migration section in the documentation](https://pyglet.readthedocs.io/en/latest/programming_guide/migration.html)
+> The previous version of pyglet is tracked in the `pyglet-1.5-maintenance` branch.
+> **If you want to do a pull request for the previous release, please target the appropriate branch**.
+
+> :exclamation: `pyglet.graphics.draw` and `pyglet.graphics.draw_indexed` will be removed
+> in pyglet v2.1. The `shapes` module is an alternative for drawing simple shapes.
+
+* pyglet [documentation]
+* pyglet on [PyPI]
+* pyglet [discord] server
+* pyglet [mailing list]
+* pyglet [issue tracker]
+* pyglet [website]
+
+pyglet has an active developer and user community. If you find a bug or a problem with the documentation,
+please [open an issue](https://github.com/pyglet/pyglet/issues).
+Anyone is welcome to join our [discord] server where a lot of the development discussion is going on.
+It's also a great place to ask for help.
+
+Some features of pyglet are:
+
+* **No external dependencies or installation requirements.** For most application and game requirements, *pyglet*
+ needs nothing else besides Python, simplifying distribution and installation. It's easy to package your project
+ with freezers such as PyInstaller.
+* **Take advantage of multiple windows and multi-monitor desktops.** *pyglet* allows you to use multiple
+ platform-native windows, and is fully aware of multi-monitor setups for use with fullscreen games.
+* **Load images, sound, music and video in almost any format.** *pyglet* can optionally use FFmpeg to play back
+ audio formats such as MP3, OGG/Vorbis and WMA, and video formats such as MPEG2, H.264, H.265, WMV and Xvid.
+ Without FFmpeg, *pyglet* contains built-in support for standard formats such as wav, png, bmp, and others.
+* **pyglet is written entirely in pure Python**, and makes use of the *ctypes* module to interface with system
+ libraries. You can modify the codebase or make a contribution without any second language compilation steps or
+ compiler setup. Despite being pure Python, *pyglet* has excellent performance thanks to advanced batching for
+ drawing thousands of objects.
+* **pyglet is provided under the BSD open-source license**, allowing you to use it for both commercial and other
+ open-source projects with very little restriction.
+
+## Requirements
+
+pyglet runs under Python 3.8+. Being written in pure Python, it also works on other Python interpreters such as PyPy. Supported platforms are:
+
+* Windows 7 or later
+* Mac OS X 10.3 or later
+* Linux, with the following libraries (most recent distributions will have
+ these in a default installation):
+ * OpenGL and GLX
+ * GDK 2.0+ or Pillow (required for loading images other than PNG and BMP)
+ * OpenAL or Pulseaudio (required for playing audio)
+
+**As of pyglet 2.0, OpenGL 3.3+ is required**.
+
+To play a large variety of compressed audio and video files,
+pyglet can optionally take advantage of [FFmpeg](https://ffmpeg.org/).
+
+## Installation
+
+pyglet is installable from PyPI:
+
+ pip install --upgrade --user pyglet
+
+## Installation from source
+
+If you're reading this `README` from a source distribution, you can install pyglet with:
+
+ python setup.py install --user
+
+You can also install the latest development version direct from Github using:
+
+ pip install --upgrade --user https://github.com/pyglet/pyglet/archive/master.zip
+
+For local development install pyglet in editable mode:
+
+```bash
+# with pip
+pip install -e .
+# with setup.py
+python setup.py develop
+```
+
+There are no compilation steps during the installation; if you prefer,
+you can simply add this directory to your `PYTHONPATH` and use pyglet without
+installing it. You can also copy pyglet directly into your project folder.
+
+## Contributing
+
+**A good way to start contributing to a component of pyglet is by its documentation**. When studying the code you
+are going to work with, also read the associated docs. If you don't understand the code with the help of the docs,
+it is a sign that the docs should be improved.
+
+If you want to contribute to pyglet, we suggest the following:
+
+* Fork the [official repository](https://github.com/pyglet/pyglet/fork).
+* Checkout the branch you wish to contribute to (such as *pyglet-1.4-maintenance*).
+* Apply your changes to your fork.
+* Submit a [pull request](https://github.com/pyglet/pyglet/pulls) describing the changes you have made.
+* Alternatively you can create a patch and submit it to the issue tracker.
+
+When making a pull request, check that you have addressed its respective documentation, both within the code docstrings
+and the programming guide (if applicable). It is very important to all of us that the documentation matches the latest
+code and vice-versa.
+
+Consequently, an error in the documentation, either because it is hard to understand or because it doesn't match the
+code, is a bug that deserves to be reported on a ticket.
+
+## Building Docs
+
+ pip install -r doc/requirements.txt
+ python setup.py build_sphinx
+
+Please check [the README.md file in the doc directory](doc/README.md) for more details.
+
+## Testing
+
+pyglet makes use of pytest for its test suite.
+
+```bash
+pip install -r tests/requirements.txt --user
+# Only run unittests
+pytest tests/unit
+```
+
+Please check the [testing section in the development guide](https://pyglet.readthedocs.io/en/latest/internal/testing.html)
+for more information about running and writing tests.
+
+## Contact
+
+pyglet is developed by many individual volunteers, and there is no central point of contact. If you have a question
+about developing with pyglet, or you wish to contribute, please join the [mailing list] or the [discord] server.
+
+For legal issues, please contact [Alex Holkner](mailto:Alex.Holkner@gmail.com).
+
+[discord]: https://discord.gg/QXyegWe
+[mailing list]: http://groups.google.com/group/pyglet-users
+[documentation]: https://pyglet.readthedocs.io
+[wiki]: https://github.com/pyglet/pyglet/wiki
+[pypi]: https://pypi.org/project/pyglet/
+[website]: http://pyglet.org/
+[issue tracker]: https://github.com/pyglet/pyglet/issues
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/RECORD b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..7d29504a94901b5434be43b3f66d2c0e8bcc35f8
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/RECORD
@@ -0,0 +1,201 @@
+pyglet/__init__.py,sha256=rdahIexvidwA3kDoZdSeVNY3oeja8K-Y__aIVOnN37Y,11823
+pyglet/clock.py,sha256=j4rgPJuOC3dRPyWpZiNbQ6QjEd8FqYWeIIGIXRLNAMI,22972
+pyglet/event.py,sha256=oDpfsXusNR43Cb4940fJjXJxQTdxKk6FZsWq--KmvTs,17263
+pyglet/info.py,sha256=1IPYxDatxqtxZYmkKOXmC7Tj3POIiYwOQlJZZYL5Wco,5994
+pyglet/lib.py,sha256=cznw6HrqV-var2_8Wa7DKt0Vr8lmRoD0P5gUR3JruKg,10849
+pyglet/math.py,sha256=FKsitRaUzOMlJxHXTH2QjrsmaAvzI7VS0Pr36Z6I0Q4,35928
+pyglet/resource.py,sha256=6BOFeP1FB0SoLlWeq9QYIStWzw7T5VGByrs-F-AyJl0,30029
+pyglet/shapes.py,sha256=3A-dihG8cGvNB5Ah1M7ySTs89WE5qygHTCmYj8ED5ls,56160
+pyglet/sprite.py,sha256=r-o8I68czSlSE8OJo8WvWHGwLDRuZPskCphhuUTFRD4,26555
+pyglet/util.py,sha256=CC9XHqXac91vGtXQkZ0iG_1J-gVxzj81jolO7HrEX7Y,8663
+pyglet/app/__init__.py,sha256=ObHghgaP8DlXx_swh2RzKhmG1C6jSdk-tVizqHtGRVY,2569
+pyglet/app/base.py,sha256=Z9t4gjKLNl_ooS9ZBoGNM4dbZmA7ySIVsPpQFlyxIVI,10405
+pyglet/app/cocoa.py,sha256=UEY4v5LWTmS-q55TZmTJ-v3cBEaKckYZR6m_UGRtDUc,6710
+pyglet/app/win32.py,sha256=HcuKegMVqvQ9mQVThf5yz07ChHE9IeFVMZb0BFl3rBE,4325
+pyglet/app/xlib.py,sha256=-LTcV5nV7mrlrfOXXIvTMXTiGx87TG9P7f8xRztm8TE,2543
+pyglet/canvas/__init__.py,sha256=wM2V9wbh4gVb1wxbsMao2-q7siNf4S7Mq0TUBECLseg,3247
+pyglet/canvas/base.py,sha256=ujR8SiqBHZ3_K0ZK29CPloBCmoUf-2aBB_y3NHf306U,10433
+pyglet/canvas/cocoa.py,sha256=x0jhksqCchVfdK2HjPqr0lWt0H8z6mhdo-GGFf-S4dw,4998
+pyglet/canvas/headless.py,sha256=hMsy3SvIsf7fEOymIZmSxjzncqBqKW6YbkXn6bUCDfs,2152
+pyglet/canvas/win32.py,sha256=t9ZV8fnH7Hg1piIyyidy3ZHM-C1PkHNTvpFoATOcHYI,3552
+pyglet/canvas/xlib.py,sha256=MITsFQxawt7YVW4pAlADD8hdSxaEbabZIezBvieTcbk,8466
+pyglet/canvas/xlib_vidmoderestore.py,sha256=JQpc7BXJUB7rHRptXoVIyATb36y3F9g3OfatnsX2nA8,5654
+pyglet/extlibs/__init__.py,sha256=rbqvpywhuc1ZNYmTQ_mHoL07CrYIlNbKhwyhH7KygUo,128
+pyglet/extlibs/png.py,sha256=jFithML7nYFMlROSuugWe0X0N9t_uy13-aQrXbrPCAQ,81400
+pyglet/font/__init__.py,sha256=Y8otrEynKmIkDOLLgsWwsShkazYXDWttx45ApFOJz_0,6003
+pyglet/font/base.py,sha256=K3cNdgg3wIIKpq2vTKSOctE0EqidOF95ugRjq1Cyf-s,13521
+pyglet/font/directwrite.py,sha256=NM7uOzxLo1P6xuBef0ooSKR6h0-XR39ZrzVZy5HtIws,95827
+pyglet/font/fontconfig.py,sha256=uu2_ZXBybBnHPPPsbXKf5DTQq4_okKTTG6GpWQ6suSw,9763
+pyglet/font/freetype.py,sha256=wWSVB5Hfw1FmbtpnBqzoggy2HnsN3yxKwuo6VLR3G0A,12212
+pyglet/font/freetype_lib.py,sha256=Z3vTYOOaGQaIFxoUzl59aZtzQvQ2UBemxYVoiikehW8,15642
+pyglet/font/quartz.py,sha256=x1C3ouD4C6NqFXUB5Wt001AkRpbfM0J5CVkdSOPca_g,11350
+pyglet/font/ttf.py,sha256=nzu0fNPGHjCsLDcAaUvrcAYpAohhv6lf-sUC_juVxTY,23834
+pyglet/font/win32.py,sha256=YkmjpSPBfDIkZgmkq0Iw2hljxrDVKpiGcA18jUQHzpk,19316
+pyglet/font/win32query.py,sha256=ADDc7uRa1AhCDOWiPDKZHz_jr5AT1wHgLNAfrKnVS_c,15964
+pyglet/gl/__init__.py,sha256=htVgiY6cCTWR261iMke3u1NuWyVEJaTJssxQT6MUjaQ,5294
+pyglet/gl/agl.py,sha256=HCxcK8sZh9WjnvW8EYtPaH1t2s5eyPS15QKe1Hk3dWg,26670
+pyglet/gl/base.py,sha256=bosgbOvmzOwXWmHiwDdpkoKKsnBbMfUxQVnf35dvD54,12509
+pyglet/gl/cocoa.py,sha256=ZMwt3Yglsjx8ikplhDtKw_YVeagF7wO9Lv-fJPGZHBI,10818
+pyglet/gl/gl.py,sha256=wvv6jGUGpiiXnY0LJ4WTcKq31ovuWqkbDChcWxo9QAE,199570
+pyglet/gl/gl_compat.py,sha256=FkmWcPORFDDZ1at-aZSYWBoda9FClhuJkZ7F8znVJ64,264240
+pyglet/gl/gl_info.py,sha256=tBWZqUqWDs_590GvpGFNlCoKezQAHeYaOklsBAA35RM,6507
+pyglet/gl/glx.py,sha256=HmAzfPLBiWO665uSHKisc8LgNdK9APjqIy6dChFg2Y0,29235
+pyglet/gl/glx_info.py,sha256=DUk-az1b1ovAFYqOw58UHLkIIdGUxHvmhxVb-W3nS-A,3565
+pyglet/gl/glxext_arb.py,sha256=ym9LaX44AFBday7ZCnJ8v6KYFgLCWqbl7Xm1csPitlg,50608
+pyglet/gl/glxext_mesa.py,sha256=FJ-If7h0M5ZgTs1nzJqW05WH-e1bSKfOo2XcLx9o3NA,261
+pyglet/gl/glxext_nv.py,sha256=5YWDsAqUt7ZO1C3_Pffp0QBWMwK0uNWxz33drsiWfPg,41435
+pyglet/gl/headless.py,sha256=PSN5XxdsNsZPyHozTE0iAKvVC_liIwsxpkY57kTNwWQ,5509
+pyglet/gl/lib.py,sha256=MWdOzRGnsDR6DeyH9lpDzfN_t9fI1xZCNrGyIeDj_B4,3394
+pyglet/gl/lib_agl.py,sha256=Nz7rueIDwQkye4fATan9tvNc7fQSeUEn6jDUqyJhgpc,902
+pyglet/gl/lib_glx.py,sha256=MvkilrDCKHOt6VNi92zS8_troqNSgoVfChhIomMeeeo,1408
+pyglet/gl/lib_wgl.py,sha256=x_LvtHhpJPG1OZ8d0quq8yQLUUlfo47xtBLGKqOCECM,2910
+pyglet/gl/wgl.py,sha256=5DwpUM-1NRkYN7YnEiQz66HgkULUMOyF1KCAzyrHVIE,16109
+pyglet/gl/wgl_info.py,sha256=sHiy93LenCo7bTt4re_rBEiotLuQBPuOx4NfiMFoRHs,954
+pyglet/gl/wglext_arb.py,sha256=LeaIfmaJWypU63_EhG9Kbl0qHKEhYnVRhsEuxdySTBg,70293
+pyglet/gl/wglext_nv.py,sha256=gy4dRRxO-aaTE-XQB-4Z3GMi2yWkjXNvMda6pMn4lAI,69927
+pyglet/gl/win32.py,sha256=az47lv_8jo25ZU56AqIZqOJXtYbZN0y6f-7T_4hrE-o,9708
+pyglet/gl/xlib.py,sha256=hMCmAHVaXm4E5s8z03ivOKk5YeIwhv8e3_mNr-FjTHo,8908
+pyglet/graphics/__init__.py,sha256=fh6MW3Db3zjjuRtkBODQ423hLFH7DZ0nrpBhM58TWLI,21171
+pyglet/graphics/allocation.py,sha256=yuzT6kKKxig_U2ABgJ9A4gODPl4ql37fQqe8Sayfo5Y,12604
+pyglet/graphics/shader.py,sha256=ScZrwEJ_ggoO7zTMrUYKdLZfwCvR3TF9yuNK6YwPXPM,37242
+pyglet/graphics/vertexarray.py,sha256=Yne7DZxvJp2-EIWwHWv8QbvLRRHJRqokrIFLPmW5Wy0,1057
+pyglet/graphics/vertexbuffer.py,sha256=fv43FKaGxTzVvYNFff7LNcA_w0sHCfEWd9aVgDQDrSY,10253
+pyglet/graphics/vertexdomain.py,sha256=wrXfjQkjFmOzgkTb-hLfah5ksu8H6MIe-dgbA3ITpxE,20555
+pyglet/gui/__init__.py,sha256=ypYwEmAH6DWf59NhdWD3cLNnqm-fri735Xc6NW_sARE,44
+pyglet/gui/frame.py,sha256=zOQUTyztAeFGVTr4hqLBfWzypNwxO7gAlOKOdDjRLaw,5770
+pyglet/gui/widgets.py,sha256=dXXg8kyi9-275f3NtDS8cyGYULlKkPSf27WLJzypMTc,15857
+pyglet/image/__init__.py,sha256=XSecSHaAkGevOMh5luhbGb8vjV52G6xtb5zvczkVlaM,75923
+pyglet/image/animation.py,sha256=sNlydaEGaIcmQBitAhVn8Ehxeu0bd4iLf1CbeBzup0o,6413
+pyglet/image/atlas.py,sha256=PY7jGNguTgVcbGCefJtQOD7z1OXk1ZJC39vZP9mQtZk,8237
+pyglet/image/buffer.py,sha256=zQTtgVt-Q2vkv6dmX3jBOvEhZJJM0kgBM26wKIMVhg8,7702
+pyglet/image/codecs/__init__.py,sha256=KjCmbAHfkWl_eBz66WNgzA-crtM13DzdcYmZNzBY9qE,6498
+pyglet/image/codecs/bmp.py,sha256=-2Cqo0oporGYQ8Y6kryn243oLiQaTgAZlQU0cVQfdF4,10642
+pyglet/image/codecs/dds.py,sha256=TqdLFPrBYPpaDOLfFY2C0tVP7ukOopgB8wlfgpc9o3k,5668
+pyglet/image/codecs/gdiplus.py,sha256=Rpa-6uUvZ_xmKrDH2I674yuNxub4_v6f8tmOK0Wlb_o,11012
+pyglet/image/codecs/gdkpixbuf2.py,sha256=xIGV5FA3804UceYSVyUlAm9xx2ZWk3vlw0uk4CNWdyw,8939
+pyglet/image/codecs/gif.py,sha256=h8JZhWo5uJFhavLVQ2CI8jfb3u4wuQca4RPawLa6F2g,3571
+pyglet/image/codecs/pil.py,sha256=wlw_7IF_QOceAPRsTdK8NI-552gJe5uwd2IeNlG5ahg,2592
+pyglet/image/codecs/png.py,sha256=p0gotYKIIuusSa52q6EcotHGr3CotsAEYXIVzNYUUCk,2081
+pyglet/image/codecs/quartz.py,sha256=Nl41ool5MDnp6MDGQjWotvGNYIfobCq4UPnGMjyL0XU,4708
+pyglet/image/codecs/s3tc.py,sha256=XsBcl8tOli61BVEoukb-9Ydw5aPSyydlJXWDC__W84Y,12392
+pyglet/image/codecs/wic.py,sha256=9meKvzLH5NN0zOVsCPO4h7K00GSB7GODI6ZO8nzLQ6w,22443
+pyglet/input/__init__.py,sha256=cy3RPO5NcHQO8yM0W__XVemAFidj8x1FSjQT3L8u7xk,6247
+pyglet/input/base.py,sha256=Il4XS1n1tme1R4M2B8wnyRm4OL-b3GKEK1uBkqEMZXc,41395
+pyglet/input/controller.py,sha256=5QjfyxUUf6T8hRj9ALny5Ae5kjVFdfm3J2excczPouI,5594
+pyglet/input/controller_db.py,sha256=_tpHT7Z28mpRBGMT0K5hINsSU_bOP44fSR5v13eXBuo,219376
+pyglet/input/linux/__init__.py,sha256=fd8rAts7soFEND4l5rUtLmEwK4rRpfFZ7Ibj9EOcrrA,391
+pyglet/input/linux/evdev.py,sha256=ZPEwc-vVnQx0EQZkKMGmC2ct6iLjTMLGE_Y3MiVVmyI,19157
+pyglet/input/linux/evdev_constants.py,sha256=7nCbrg7Wh3hzlRnW3b0XjMNz_od5qCZ35ewMtIpWqkw,9789
+pyglet/input/linux/x11_xinput.py,sha256=3ecQXSADN6jVJULCm7zaWmFS3lko2aXENqbKTKXMa-M,10988
+pyglet/input/linux/x11_xinput_tablet.py,sha256=ArsetMOcWeGSaxPnKY4JPIUGyZKOn3ckW757uoH30hU,3007
+pyglet/input/macos/__init__.py,sha256=5VQqkzxDR6gZfF21vxEG-GKts-BRRpETxJaK7OYiBoo,348
+pyglet/input/macos/darwin_hid.py,sha256=zZXn_81VuaRfkvagXO16r131qBrjy4G2fGw8oyjm49g,24465
+pyglet/input/win32/__init__.py,sha256=m3wFiSsiDTweygaidwoJ24LfvVTtCh_tGFvD7sOi1xE,4195
+pyglet/input/win32/directinput.py,sha256=d7FXQZ0g8fx8Syc5m_MgSQLNTeBRJGKevL9T1a1STI8,16810
+pyglet/input/win32/wintab.py,sha256=yPBooI1pHkc59k9BHukdz5xsX2vqILb6keuRdPWaAeM,14512
+pyglet/input/win32/xinput.py,sha256=af8r4yw6GExHQA_HEQnmkrNuMPwdAplu4-AO4og0E7I,20826
+pyglet/libs/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
+pyglet/libs/darwin/__init__.py,sha256=Kx8qOx_xjgLZj9pf9qDj9-tZiWbzKfSmnmIeMaAiVnU,23
+pyglet/libs/darwin/quartzkey.py,sha256=nXq8f3PRhc2q_DbktkPHrP-mDtfhWA7iSX_3XU4D3s0,5179
+pyglet/libs/darwin/cocoapy/__init__.py,sha256=rmvRNKFk3CR4_hKVVGsrmnU8H-fjuiJ7aFBVU8tnzZU,1742
+pyglet/libs/darwin/cocoapy/cocoalibs.py,sha256=WYFGFRSdYZU4dh5mcPk7LWmSbaHVm65XHLxtMhxHgjU,21781
+pyglet/libs/darwin/cocoapy/cocoatypes.py,sha256=UNymqQdVNrq7T6jIupCgRgoxgm51hhQW-R42Y-tRP00,2629
+pyglet/libs/darwin/cocoapy/runtime.py,sha256=ousAhhO0cuTejvyzpRLfR6LOPTQB2-fZPkeEdHD_P04,51925
+pyglet/libs/egl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pyglet/libs/egl/egl.py,sha256=sfSx2puVsMJDIY_xH9EbadsG3cCpsNUN7V2UgebUzvk,29920
+pyglet/libs/egl/eglext.py,sha256=NPqhL-GQK1Y5cHLwXSNpyWEqWhSgqyxc3vgk374-D0s,859
+pyglet/libs/egl/lib.py,sha256=IdQfLfRPbTckgNBEIUumdmEQ6iSWiy1nhTnkTTzaZ6M,893
+pyglet/libs/win32/__init__.py,sha256=SGI8fh-g8Eb98wpxX8yvSZfn242iX6Nygew8PVb8gZE,12676
+pyglet/libs/win32/com.py,sha256=fvZdbJgZ6LD5R01H9ARHks1kTjN2SUGZE3L3hYNLC8g,11462
+pyglet/libs/win32/constants.py,sha256=6xv_2f3bGNxWwn_GYyJn4mPsgnjZYPVwI9sb8QJ1_Y0,121184
+pyglet/libs/win32/dinput.py,sha256=ta-A1ZXFgMsAKU6L2WWSXvqjKFQ170eAt3IZb-MEReI,10968
+pyglet/libs/win32/libwintab.py,sha256=Qw2UmNG2-rZov483o16qjFtywwMGBJbDbIuKl_NFLe8,10901
+pyglet/libs/win32/types.py,sha256=qohdu9Pq3iQQ5d4ye0JIunJPGNC1ShIRhuwLlzfbVfg,14219
+pyglet/libs/win32/winkey.py,sha256=0yKZTOyrGirM3oAIhJRUgiKwDgQ_XF0_k9KRXf3MJaQ,4667
+pyglet/libs/x11/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
+pyglet/libs/x11/cursorfont.py,sha256=31GFWHJWnNrmaiF6uvjUdLSM7gBL9DL0kjnfxjM8jAg,1451
+pyglet/libs/x11/xf86vmode.py,sha256=YkdY2fG2K_TsF7nKuxD6RYALXNcsJD6dhw7Q-C51YX4,13531
+pyglet/libs/x11/xinerama.py,sha256=T015JX3e4pqV_zcShwTKOMic9G7A9rpCZacF0J6v-EQ,2182
+pyglet/libs/x11/xinput.py,sha256=RE0aMlSl4uJsWC2lfyljfiWX-LMrXHnIVjX2rbkWwsc,54556
+pyglet/libs/x11/xlib.py,sha256=Xan4-KdOyjHKAO-SjV9Uowgr_J6E-rrtPX2giNp3xRc,183255
+pyglet/libs/x11/xsync.py,sha256=Ui_k4As8aNj2H3nA64HLgCHt7kupweY-LXVST-E3EXk,15202
+pyglet/media/__init__.py,sha256=l0jlHf6hH6JCoTFM7s12TTXQFfMd8cdq5L9B56UAwh0,3208
+pyglet/media/buffered_logger.py,sha256=FtNqz-WcPLDE6lMOIWMgBwks1W5u1mLZX8f2CAHUXuU,1025
+pyglet/media/exceptions.py,sha256=ftERqNPFB2F05Ml3jx3t-0_SXtgNWwZO9DavsGRN8Nw,152
+pyglet/media/instrumentation.py,sha256=Wc6pJ82fAEr339gOJgr8M8jIqPGiGihJGEjYIaVqK-4,10798
+pyglet/media/mediathreads.py,sha256=lHJbcIwBg3H88Njax_eKPCBZuhO94cplG5wKA3lYxcU,4590
+pyglet/media/player.py,sha256=m0U9UZd71YEsVnahNVMwlo1XDZQLLUvwfDmmWYI7qpI,22308
+pyglet/media/synthesis.py,sha256=tj4y3GyL_2VgthEAKWp70S_1CyOn0gXII3C_w7njDYw,11759
+pyglet/media/codecs/__init__.py,sha256=bct7kKeWPXgtdPpI6qjtT_4MGoFF9fmtc-SxeH7o_AE,2565
+pyglet/media/codecs/base.py,sha256=gUDu4p5o9hES6F9gLrUxP0BysJ9GjzROxfqNKBlLs_U,17960
+pyglet/media/codecs/ffmpeg.py,sha256=Zug7TrpvHynYLdE2hh8FYOJBpHi-HiEiufo0z5zgb-w,40854
+pyglet/media/codecs/gstreamer.py,sha256=RdPn1qKJ1mX3WbWBDykIRact0eIoOx6I6ORnlb6vNik,9250
+pyglet/media/codecs/pyogg.py,sha256=dFHsM_twcNQCZIwIHz9ToUagbSxdlyWKPlTddnhKWvQ,17727
+pyglet/media/codecs/wave.py,sha256=LsZzQgkR2372N0xSctehtwYZNehJC1i92PedvcaY9E0,3566
+pyglet/media/codecs/wmf.py,sha256=61y4NNhI4rzXvcNhtjl2zFt3et8kFtx89Bra9F_MilM,34300
+pyglet/media/codecs/ffmpeg_lib/__init__.py,sha256=MzdctEH9MnPm-ML5rJRvVmpe5EEKAD-9lBsqLNztx1g,201
+pyglet/media/codecs/ffmpeg_lib/compat.py,sha256=ob9k_sp4KesT8FNnBTmK9K0pfv5Nf10k7obgRlrEwds,2280
+pyglet/media/codecs/ffmpeg_lib/libavcodec.py,sha256=YQwNzc1CrVSoKPxLqi2an0tyuSsD_-7vcgCe9mKv1Mk,14670
+pyglet/media/codecs/ffmpeg_lib/libavformat.py,sha256=GeLUcha1y4OJTeeyWLpCB2QnxICcRNGzPKzJkAOgblU,9682
+pyglet/media/codecs/ffmpeg_lib/libavutil.py,sha256=5oxHRI-cTx4da3yIsR8ncYt_Q0YvpBmRe947eFk7KWQ,6960
+pyglet/media/codecs/ffmpeg_lib/libswresample.py,sha256=dYs-EczSa6UgGYG1-kwt7F5wtCt-g5MHtctwG7Nsv7Y,1688
+pyglet/media/codecs/ffmpeg_lib/libswscale.py,sha256=poyzqO23yzQlWuEcpaki9oSimJXWDWe1G6IqI2Awrqo,1475
+pyglet/media/devices/__init__.py,sha256=X6cc8vMKg_HsVCmjqzamCgvNKqXiyLrjXpz-vnVxm-A,773
+pyglet/media/devices/base.py,sha256=JanI6qLUES4wR1d8kZ2ir5-UWrqo0CgqppShNrAC4Ts,2805
+pyglet/media/devices/win32.py,sha256=m95_0gxDOYKiedQNSWjOoxL91VbiHhcelC0_MTH30iI,10611
+pyglet/media/drivers/__init__.py,sha256=YY_1zlholkoHI5a5dwSWrPMFYyYGKCzd-T5aq_xqWc4,2468
+pyglet/media/drivers/base.py,sha256=ImiJsrfs-K1b2SShTMnhFaRVoBuWbeL-klujAFJfDO4,6777
+pyglet/media/drivers/listener.py,sha256=WCHyDcYuQvnnULWUzDn9Bx8dhn5sGwnUTWCKoK_0wCY,2492
+pyglet/media/drivers/directsound/__init__.py,sha256=4pZuMWsqb6WFQXH8lV-5XFb03KPL9J5jY3dZ_91nJsg,251
+pyglet/media/drivers/directsound/adaptation.py,sha256=FejkPOYJPVF_3nIwzQp05xu5KLoBi13vdj-3Ra4PXF8,14593
+pyglet/media/drivers/directsound/exceptions.py,sha256=DNslGA8HwhO1ees5Rd4dpH-wtSTax2UtLPEUKyev2oo,325
+pyglet/media/drivers/directsound/interface.py,sha256=0w3Skt763jdSnsUpE8G_ldQ1_eoYYkXE5yufmbbQeDU,13701
+pyglet/media/drivers/directsound/lib_dsound.py,sha256=ErwWeKWc7suuv2G-g7U-DqnKyO5_MLUyXFFhjHz53VQ,12735
+pyglet/media/drivers/openal/__init__.py,sha256=yuks0X4x50nYQsAYAZftgxcI1iqNflxMetSskIipnf0,324
+pyglet/media/drivers/openal/adaptation.py,sha256=zATPOEe8isE7isszLkqVxaWoPix4I0hYaBK_k3HOASE,12452
+pyglet/media/drivers/openal/interface.py,sha256=CYgwdN5AbDDWNklpihOA1m_I4QGzjTR8-cTtLZSMBQU,17051
+pyglet/media/drivers/openal/lib_alc.py,sha256=bIG8WSCWvHvAu_PmQcPExq9SGLXv9JkKjE0HoBGGv7Q,10833
+pyglet/media/drivers/openal/lib_openal.py,sha256=2Z6ulaYjgP0Gucpg9Wj71b4OA5KZJv_QQ-MjpVYb-_k,26707
+pyglet/media/drivers/pulse/__init__.py,sha256=WrQZ3-ABfq0NxKKEFnJ9gM8i9NLWPv69F42-ZB6e9SE,244
+pyglet/media/drivers/pulse/adaptation.py,sha256=AJCzPgE_aXyBc_yDRGQ9FsIHJS3i6gg4xTyccpbc0ac,13616
+pyglet/media/drivers/pulse/interface.py,sha256=udB2JWwQZV1DD6QOMQqoM0dwxYYpgEpi1Uqvci3I9W0,23676
+pyglet/media/drivers/pulse/lib_pulseaudio.py,sha256=ucG7RhnykWkMFaIRNiVr_yQ-ThtiG1N0CEeAFA7wGCk,121975
+pyglet/media/drivers/silent/__init__.py,sha256=ll3SIdXcO5oBn7PolMNKJLPU3yQXQz6KOslCZXWokR8,127
+pyglet/media/drivers/silent/adaptation.py,sha256=xoyVYe398eO9x4TwVvdeDKAZzYqI6xcH9Sc3_KlmCzs,1561
+pyglet/media/drivers/xaudio2/__init__.py,sha256=RipwpSVIsNEqgUYYFA0TbxHEBl41pre0XB4sFRQvBg8,128
+pyglet/media/drivers/xaudio2/adaptation.py,sha256=Q-1CHfqG4LMmtpPHs7uNytRaGnARjVH_7oHr_XOWQUw,12959
+pyglet/media/drivers/xaudio2/interface.py,sha256=p1J672Vt3PiOmIk4urku3SJU_T9xsvtnGSMwsH_3X5E,20913
+pyglet/media/drivers/xaudio2/lib_xaudio2.py,sha256=A7QGiyVkRBrrBE311J02BpYeYw5P-YeWB18UftUo8WQ,29089
+pyglet/model/__init__.py,sha256=ul3vloxj4wW-Bmg8drpoSwyFA5ZrSRWXCCFcmmnemLI,9963
+pyglet/model/codecs/__init__.py,sha256=w-oR9At7FHGsMWmWBTsmdCikFDW4YllZOuJxMx5VaL8,1502
+pyglet/model/codecs/gltf.py,sha256=jmFc8sZD_QLVe6ecibVHn3JfeloRMF2gh1yJl3YkNuU,7303
+pyglet/model/codecs/obj.py,sha256=rv9Y7AZL1OegoGuTsefjuFZ1DWyImEMFYDoTG_0ZQdM,7638
+pyglet/text/__init__.py,sha256=b_CPoJCPVf2b5r9F6-oc4yXIDsmWn5LE9jakSiP5uOo,17173
+pyglet/text/caret.py,sha256=x19qCu4tjuE4DbEvKdnfRrQf47aD6kYHZRkhEy_IZOg,18646
+pyglet/text/document.py,sha256=RDybn0rsrGu_0J5PXVNa_jN879wHpVGBq-VTHiAvVrc,24516
+pyglet/text/layout.py,sha256=ydOa-j306pDbkylaoXn8IWoISaslK5woMz3f8xphYb4,96399
+pyglet/text/runlist.py,sha256=JMex9ANxUYpvPAbo31hzd0X8N5wVz8RZZ6T27Iat9n4,12514
+pyglet/text/formats/__init__.py,sha256=hg6sCJFBKRRAqeGVpX6zYB8DAjelircrPQNloLdTl_Y,48
+pyglet/text/formats/attributed.py,sha256=wI--F1KLVf11VJf84WhqhqLZ4Da6FIvpC8TMcpRfG3A,2679
+pyglet/text/formats/html.py,sha256=0WeVAqKq3venhVNQo2MjaE-qe1lC1gdlEjkkA2cZjpw,11551
+pyglet/text/formats/plaintext.py,sha256=9945KcO6s5wSvaefoz7rbwY4NBZfqt2uzT5IIDEm-4A,264
+pyglet/text/formats/structured.py,sha256=4loChBTwrdZh155Jn8c4bTsyy4wsMQL8oppkS_R4oUQ,8397
+pyglet/window/__init__.py,sha256=05rDct6LdQOpbf4FCKS6dQ601-SsMmt_miqbKGca6A4,65777
+pyglet/window/event.py,sha256=TrLl2yAX_2NclrRjRTT4P03pOplePHDJpZ-CoSM8vls,3830
+pyglet/window/key.py,sha256=Gos7PzuXgdwogfHDoCdM-js6f50wjIzB7wYnhVFIk3A,9293
+pyglet/window/mouse.py,sha256=KBFRkQMNZeMpiGVC1bqYpBdNROA8BAa51wEtvShvhOU,2324
+pyglet/window/cocoa/__init__.py,sha256=zfbR7endULoAgW05WHBKn1ZbU1U22ip6dkri7Ty4hyA,23861
+pyglet/window/cocoa/pyglet_delegate.py,sha256=5x8ZX01hr-yhu8w4rhtCfAXUGiFZ4qQH8SEh__yEIbs,5308
+pyglet/window/cocoa/pyglet_textview.py,sha256=tXY-pQOeZbYLlenLBJFnVCB-GBTvfohh439IZNhah5o,6388
+pyglet/window/cocoa/pyglet_view.py,sha256=l77HxMkBTiAj0irYQtlgepIK32Kg_-ns6Bjl3KjAHWI,14089
+pyglet/window/cocoa/pyglet_window.py,sha256=BBwAQRls6zP7ZUMQIjKeXQ_G8WRBfTWfgb0Yw3vb3L0,3284
+pyglet/window/cocoa/systemcursor.py,sha256=V3qOyY16A8EX96duJiVHjwYm6av3c-fafXmR1yjrUMw,691
+pyglet/window/headless/__init__.py,sha256=rLoKu9xoZiQKjmMPRG_oh1lJ-2e31dNV7GeRW38VQOk,2775
+pyglet/window/win32/__init__.py,sha256=SvVIrmQxag6ASqSoRK7jpZhKd04ErtzFjA30JQ4tABk,45440
+pyglet/window/xlib/__init__.py,sha256=vkPACDQVIP1neMjLf8H5HSSmoIJ5y-JP1-kluROwzoc,61953
+pyglet-2.0.5.dist-info/LICENSE,sha256=V-fuy2c8jUDPMZJjPEgH-6jIFoUymjfht2PhVW1d7TQ,1546
+pyglet-2.0.5.dist-info/METADATA,sha256=lVPFi8AA65azAp3si4039HM6f3c1DxYGTCnt-Qq-zCY,8373
+pyglet-2.0.5.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
+pyglet-2.0.5.dist-info/top_level.txt,sha256=61eFbwB3jWRqmWcMw5zMR4Wf1hIS6eVceAnnn-JngaE,7
+pyglet-2.0.5.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
+pyglet-2.0.5.dist-info/RECORD,,
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/WHEEL b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..57e3d840d59a650ac5bccbad5baeec47d155f0ad
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.38.4)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/top_level.txt b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fdadde2d3ba265f2f667a84519bc05341633172d
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/top_level.txt
@@ -0,0 +1 @@
+pyglet
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/zip-safe b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/zip-safe
new file mode 100644
index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/EGG-INFO/zip-safe
@@ -0,0 +1 @@
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..c6bda769a578578ebe6d83e5cd7e7af4a4eac026
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/__init__.py
@@ -0,0 +1,372 @@
+"""pyglet is a cross-platform games and multimedia package.
+
+More information is available at http://www.pyglet.org
+"""
+
+import os
+import sys
+
+from typing import TYPE_CHECKING
+
+#: The release version
+version = '2.0.5'
+__version__ = version
+
+MIN_PYTHON_VERSION = 3, 8
+MIN_PYTHON_VERSION_STR = '.'.join([str(v) for v in MIN_PYTHON_VERSION])
+
+if sys.version_info < MIN_PYTHON_VERSION:
+ raise Exception(f"pyglet {version} requires Python {MIN_PYTHON_VERSION_STR} or newer.")
+
+if 'sphinx' in sys.modules:
+ setattr(sys, 'is_pyglet_doc_run', True)
+_is_pyglet_doc_run = hasattr(sys, "is_pyglet_doc_run") and sys.is_pyglet_doc_run
+
+# pyglet platform treats *BSD systems as Linux
+compat_platform = sys.platform
+if "bsd" in compat_platform:
+ compat_platform = "linux-compat"
+
+_enable_optimisations = not __debug__
+if getattr(sys, 'frozen', None):
+ _enable_optimisations = True
+
+#: Global dict of pyglet options. To change an option from its default, you
+#: must import ``pyglet`` before any sub-packages. For example::
+#:
+#: import pyglet
+#: pyglet.options['debug_gl'] = False
+#:
+#: The default options can be overridden from the OS environment. The
+#: corresponding environment variable for each option key is prefaced by
+#: ``PYGLET_``. For example, in Bash you can set the ``debug_gl`` option with::
+#:
+#: PYGLET_DEBUG_GL=True; export PYGLET_DEBUG_GL
+#:
+#: For options requiring a tuple of values, separate each value with a comma.
+#:
+#: The non-development options are:
+#:
+#: audio
+#: A sequence of the names of audio modules to attempt to load, in
+#: order of preference. Valid driver names are:
+#:
+#: * xaudio2, the Windows Xaudio2 audio module (Windows only)
+#: * directsound, the Windows DirectSound audio module (Windows only)
+#: * pulse, the PulseAudio module (Linux only)
+#: * openal, the OpenAL audio module
+#: * silent, no audio
+#: debug_lib
+#: If True, prints the path of each dynamic library loaded.
+#: debug_gl
+#: If True, all calls to OpenGL functions are checked afterwards for
+#: errors using ``glGetError``. This will severely impact performance,
+#: but provides useful exceptions at the point of failure. By default,
+#: this option is enabled if ``__debug__`` is (i.e., if Python was not run
+#: with the -O option). It is disabled by default when pyglet is "frozen"
+#: within a py2exe or py2app library archive.
+#: shadow_window
+#: By default, pyglet creates a hidden window with a GL context when
+#: pyglet.gl is imported. This allows resources to be loaded before
+#: the application window is created, and permits GL objects to be
+#: shared between windows even after they've been closed. You can
+#: disable the creation of the shadow window by setting this option to
+#: False.
+#:
+#: Some OpenGL driver implementations may not support shared OpenGL
+#: contexts and may require disabling the shadow window (and all resources
+#: must be loaded after the window using them was created). Recommended
+#: for advanced developers only.
+#:
+#: .. versionadded:: 1.1
+#: vsync
+#: If set, the `pyglet.window.Window.vsync` property is ignored, and
+#: this option overrides it (to either force vsync on or off). If unset,
+#: or set to None, the `pyglet.window.Window.vsync` property behaves
+#: as documented.
+#: xsync
+#: If set (the default), pyglet will attempt to synchronise the drawing of
+#: double-buffered windows to the border updates of the X11 window
+#: manager. This improves the appearance of the window during resize
+#: operations. This option only affects double-buffered windows on
+#: X11 servers supporting the Xsync extension with a window manager
+#: that implements the _NET_WM_SYNC_REQUEST protocol.
+#:
+#: .. versionadded:: 1.1
+#: search_local_libs
+#: If False, pyglet won't try to search for libraries in the script
+#: directory and its `lib` subdirectory. This is useful to load a local
+#: library instead of the system installed version. This option is set
+#: to True by default.
+#:
+#: .. versionadded:: 1.2
+#:
+options = {
+ 'audio': ('xaudio2', 'directsound', 'openal', 'pulse', 'silent'),
+ 'debug_font': False,
+ 'debug_gl': not _enable_optimisations,
+ 'debug_gl_trace': False,
+ 'debug_gl_trace_args': False,
+ 'debug_gl_shaders': False,
+ 'debug_graphics_batch': False,
+ 'debug_lib': False,
+ 'debug_media': False,
+ 'debug_texture': False,
+ 'debug_trace': False,
+ 'debug_trace_args': False,
+ 'debug_trace_depth': 1,
+ 'debug_trace_flush': True,
+ 'debug_win32': False,
+ 'debug_input': False,
+ 'debug_x11': False,
+ 'shadow_window': True,
+ 'vsync': None,
+ 'xsync': True,
+ 'xlib_fullscreen_override_redirect': False,
+ 'search_local_libs': True,
+ 'win32_gdi_font': False,
+ 'headless': False,
+ 'headless_device': 0,
+ 'win32_disable_shaping': False,
+ 'dw_legacy_naming': False,
+ 'win32_disable_xinput': False,
+ 'com_mta': False,
+}
+
+_option_types = {
+ 'audio': tuple,
+ 'debug_font': bool,
+ 'debug_gl': bool,
+ 'debug_gl_trace': bool,
+ 'debug_gl_trace_args': bool,
+ 'debug_gl_shaders': bool,
+ 'debug_graphics_batch': bool,
+ 'debug_lib': bool,
+ 'debug_media': bool,
+ 'debug_texture': bool,
+ 'debug_trace': bool,
+ 'debug_trace_args': bool,
+ 'debug_trace_depth': int,
+ 'debug_trace_flush': bool,
+ 'debug_win32': bool,
+ 'debug_input': bool,
+ 'debug_x11': bool,
+ 'shadow_window': bool,
+ 'vsync': bool,
+ 'xsync': bool,
+ 'xlib_fullscreen_override_redirect': bool,
+ 'search_local_libs': bool,
+ 'win32_gdi_font': bool,
+ 'headless': bool,
+ 'headless_device': int,
+ 'win32_disable_shaping': bool,
+ 'dw_legacy_naming': bool,
+ 'win32_disable_xinput': bool,
+ 'com_mta': bool
+}
+
+
+for key in options:
+ """Read defaults for options from environment"""
+ assert key in _option_types, f"Option '{key}' must have a type set in _option_types."
+ env = f'PYGLET_{key.upper()}'
+ try:
+ value = os.environ[env]
+ if _option_types[key] is tuple:
+ options[key] = value.split(',')
+ elif _option_types[key] is bool:
+ options[key] = value in ('true', 'TRUE', 'True', '1')
+ elif _option_types[key] is int:
+ options[key] = int(value)
+ except KeyError:
+ pass
+
+
+if compat_platform == 'cygwin':
+ # This hack pretends that the posix-like ctypes provides windows
+ # functionality. COM does not work with this hack, so there is no
+ # DirectSound support.
+ import ctypes
+
+ ctypes.windll = ctypes.cdll
+ ctypes.oledll = ctypes.cdll
+ ctypes.WINFUNCTYPE = ctypes.CFUNCTYPE
+ ctypes.HRESULT = ctypes.c_long
+
+# Call tracing
+# ------------
+
+_trace_filename_abbreviations = {}
+
+
+def _trace_repr(value, size=40):
+ value = repr(value)
+ if len(value) > size:
+ value = value[:size // 2 - 2] + '...' + value[-size // 2 - 1:]
+ return value
+
+
+def _trace_frame(thread, frame, indent):
+ from pyglet import lib
+ if frame.f_code is lib._TraceFunction.__call__.__code__:
+ is_ctypes = True
+ func = frame.f_locals['self']._func
+ name = func.__name__
+ location = '[ctypes]'
+ else:
+ is_ctypes = False
+ code = frame.f_code
+ name = code.co_name
+ path = code.co_filename
+ line = code.co_firstlineno
+
+ try:
+ filename = _trace_filename_abbreviations[path]
+ except KeyError:
+ # Trim path down
+ dir = ''
+ path, filename = os.path.split(path)
+ while len(dir + filename) < 30:
+ filename = os.path.join(dir, filename)
+ path, dir = os.path.split(path)
+ if not dir:
+ filename = os.path.join('', filename)
+ break
+ else:
+ filename = os.path.join('...', filename)
+ _trace_filename_abbreviations[path] = filename
+
+ location = f'({filename}:{line})'
+
+ if indent:
+ name = f'Called from {name}'
+ print(f'[{thread}] {indent}{name} {location}')
+
+ if _trace_args:
+ if is_ctypes:
+ args = [_trace_repr(arg) for arg in frame.f_locals['args']]
+ print(f' {indent}args=({", ".join(args)})')
+ else:
+ for argname in code.co_varnames[:code.co_argcount]:
+ try:
+ argvalue = _trace_repr(frame.f_locals[argname])
+ print(f' {indent}{argname}={argvalue}')
+ except:
+ pass
+
+ if _trace_flush:
+ sys.stdout.flush()
+
+
+def _thread_trace_func(thread):
+ def _trace_func(frame, event, arg):
+ if event == 'call':
+ indent = ''
+ for i in range(_trace_depth):
+ _trace_frame(thread, frame, indent)
+ indent += ' '
+ frame = frame.f_back
+ if not frame:
+ break
+
+ elif event == 'exception':
+ (exception, value, traceback) = arg
+ print('First chance exception raised:', repr(exception))
+
+ return _trace_func
+
+
+def _install_trace():
+ global _trace_thread_count
+ sys.setprofile(_thread_trace_func(_trace_thread_count))
+ _trace_thread_count += 1
+
+
+_trace_thread_count = 0
+_trace_args = options['debug_trace_args']
+_trace_depth = options['debug_trace_depth']
+_trace_flush = options['debug_trace_flush']
+if options['debug_trace']:
+ _install_trace()
+
+
+# Lazy loading
+# ------------
+
+class _ModuleProxy:
+ _module = None
+
+ def __init__(self, name):
+ self.__dict__['_module_name'] = name
+
+ def __getattr__(self, name):
+ try:
+ return getattr(self._module, name)
+ except AttributeError:
+ if self._module is not None:
+ raise
+
+ import_name = f'pyglet.{self._module_name}'
+ __import__(import_name)
+ module = sys.modules[import_name]
+ object.__setattr__(self, '_module', module)
+ globals()[self._module_name] = module
+ return getattr(module, name)
+
+ def __setattr__(self, name, value):
+ try:
+ setattr(self._module, name, value)
+ except AttributeError:
+ if self._module is not None:
+ raise
+
+ import_name = f'pyglet.{self._module_name}'
+ __import__(import_name)
+ module = sys.modules[import_name]
+ object.__setattr__(self, '_module', module)
+ globals()[self._module_name] = module
+ setattr(module, name, value)
+
+
+# Lazily load all modules, except if performing
+# type checking or code inspection.
+if TYPE_CHECKING:
+ from . import app
+ from . import canvas
+ from . import clock
+ from . import event
+ from . import font
+ from . import gl
+ from . import graphics
+ from . import gui
+ from . import input
+ from . import image
+ from . import lib
+ from . import math
+ from . import media
+ from . import model
+ from . import resource
+ from . import sprite
+ from . import shapes
+ from . import text
+ from . import window
+else:
+ app = _ModuleProxy('app')
+ canvas = _ModuleProxy('canvas')
+ clock = _ModuleProxy('clock')
+ event = _ModuleProxy('event')
+ font = _ModuleProxy('font')
+ gl = _ModuleProxy('gl')
+ graphics = _ModuleProxy('graphics')
+ gui = _ModuleProxy('gui')
+ image = _ModuleProxy('image')
+ input = _ModuleProxy('input')
+ lib = _ModuleProxy('lib')
+ math = _ModuleProxy('math')
+ media = _ModuleProxy('media')
+ model = _ModuleProxy('model')
+ resource = _ModuleProxy('resource')
+ sprite = _ModuleProxy('sprite')
+ shapes = _ModuleProxy('shapes')
+ text = _ModuleProxy('text')
+ window = _ModuleProxy('window')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..d15509415423ea283968d1ca2920bda4de77b035
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/__init__.py
@@ -0,0 +1,97 @@
+"""Application-wide functionality.
+
+Applications
+------------
+
+Most applications need only call :func:`run` after creating one or more
+windows to begin processing events. For example, a simple application
+consisting of one window is::
+
+ import pyglet
+
+ win = pyglet.window.Window()
+ pyglet.app.run()
+
+
+Events
+======
+
+To handle events on the main event loop, instantiate it manually. The
+following example exits the application as soon as any window is closed (the
+default policy is to wait until all windows are closed)::
+
+ event_loop = pyglet.app.EventLoop()
+
+ @event_loop.event
+ def on_window_close(window):
+ event_loop.exit()
+
+.. versionadded:: 1.1
+"""
+
+import sys
+import weakref
+
+from pyglet.app.base import EventLoop
+from pyglet import compat_platform
+
+_is_pyglet_doc_run = hasattr(sys, "is_pyglet_doc_run") and sys.is_pyglet_doc_run
+
+
+if _is_pyglet_doc_run:
+ from pyglet.app.base import PlatformEventLoop
+else:
+ if compat_platform == 'darwin':
+ from pyglet.app.cocoa import CocoaEventLoop as PlatformEventLoop
+ elif compat_platform in ('win32', 'cygwin'):
+ from pyglet.app.win32 import Win32EventLoop as PlatformEventLoop
+ else:
+ from pyglet.app.xlib import XlibEventLoop as PlatformEventLoop
+
+
+class AppException(Exception):
+ pass
+
+
+windows = weakref.WeakSet()
+"""Set of all open windows (including invisible windows). Instances of
+:class:`pyglet.window.Window` are automatically added to this set upon
+construction. The set uses weak references, so windows are removed from
+the set when they are no longer referenced or are closed explicitly.
+"""
+
+
+def run(interval=1/60):
+ """Begin processing events, scheduled functions and window updates.
+
+ This is a convenience function, equivalent to::
+
+ pyglet.app.event_loop.run()
+
+ """
+ event_loop.run(interval)
+
+
+def exit():
+ """Exit the application event loop.
+
+ Causes the application event loop to finish, if an event loop is currently
+ running. The application may not necessarily exit (for example, there may
+ be additional code following the `run` invocation).
+
+ This is a convenience function, equivalent to::
+
+ event_loop.exit()
+
+ """
+ event_loop.exit()
+
+
+#: The global event loop. Applications can replace this
+#: with their own subclass of :class:`EventLoop` before calling
+#: :meth:`EventLoop.run`.
+event_loop = EventLoop()
+
+#: The platform-dependent event loop. Applications must not subclass
+# or replace this :class:`PlatformEventLoop` object.
+platform_event_loop = PlatformEventLoop()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/base.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..be2c641580d80f0868452ad4a127456b4deccf30
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/base.py
@@ -0,0 +1,314 @@
+import sys
+import queue
+import threading
+
+from pyglet import app
+from pyglet import clock
+from pyglet import event
+
+_is_pyglet_doc_run = hasattr(sys, "is_pyglet_doc_run") and sys.is_pyglet_doc_run
+
+
+class PlatformEventLoop:
+ """ Abstract class, implementation depends on platform.
+
+ .. versionadded:: 1.2
+ """
+ def __init__(self):
+ self._event_queue = queue.Queue()
+ self._is_running = threading.Event()
+
+ def is_running(self):
+ """Return True if the event loop is currently processing, or False
+ if it is blocked or not activated.
+
+ :rtype: bool
+ """
+ return self._is_running.is_set()
+
+ def post_event(self, dispatcher, event, *args):
+ """Post an event into the main application thread.
+
+ The event is queued internally until the :py:meth:`run` method's thread
+ is able to dispatch the event. This method can be safely called
+ from any thread.
+
+ If the method is called from the :py:meth:`run` method's thread (for
+ example, from within an event handler), the event may be dispatched
+ within the same runloop iteration or the next one; the choice is
+ nondeterministic.
+
+ :Parameters:
+ `dispatcher` : EventDispatcher
+ Dispatcher to process the event.
+ `event` : str
+ Event name.
+ `args` : sequence
+ Arguments to pass to the event handlers.
+
+ """
+ self._event_queue.put((dispatcher, event, args))
+ self.notify()
+
+ def dispatch_posted_events(self):
+ """Immediately dispatch all pending events.
+
+ Normally this is called automatically by the runloop iteration.
+ """
+ while True:
+ try:
+ dispatcher, evnt, args = self._event_queue.get(False)
+ dispatcher.dispatch_event(evnt, *args)
+ except queue.Empty:
+ break
+ except ReferenceError:
+ # weakly-referenced object no longer exists
+ pass
+
+ def notify(self):
+ """Notify the event loop that something needs processing.
+
+ If the event loop is blocked, it will unblock and perform an iteration
+ immediately. If the event loop is running, another iteration is
+ scheduled for immediate execution afterwards.
+ """
+ raise NotImplementedError('abstract')
+
+ def start(self):
+ pass
+
+ def step(self, timeout=None):
+ raise NotImplementedError('abstract')
+
+ def set_timer(self, func, interval):
+ pass
+
+ def stop(self):
+ pass
+
+
+class EventLoop(event.EventDispatcher):
+ """The main run loop of the application.
+
+ Calling `run` begins the application event loop, which processes
+ operating system events, calls :py:func:`pyglet.clock.tick` to call
+ scheduled functions and calls :py:meth:`pyglet.window.Window.on_draw` and
+ :py:meth:`pyglet.window.Window.flip` to update window contents.
+
+ Applications can subclass :py:class:`EventLoop` and override certain methods
+ to integrate another framework's run loop, or to customise processing
+ in some other way. You should not in general override :py:meth:`run`, as
+ this method contains platform-specific code that ensures the application
+ remains responsive to the user while keeping CPU usage to a minimum.
+ """
+
+ _has_exit_condition = None
+ _has_exit = False
+
+ def __init__(self):
+ self._has_exit_condition = threading.Condition()
+ self.clock = clock.get_default()
+ self.is_running = False
+
+ @staticmethod
+ def _redraw_windows(dt):
+ # Redraw all windows
+ for window in app.windows:
+ window.switch_to()
+ window.dispatch_event('on_draw')
+ window.dispatch_event('on_refresh', dt)
+ window.flip()
+
+ def run(self, interval=1/60):
+ """Begin processing events, scheduled functions and window updates.
+
+ This method returns when :py:attr:`has_exit` is set to True.
+
+ Developers are discouraged from overriding this method, as the
+ implementation is platform-specific.
+ """
+ if not interval:
+ self.clock.schedule(self._redraw_windows)
+ else:
+ self.clock.schedule_interval(self._redraw_windows, interval)
+
+ self.has_exit = False
+
+ from pyglet.window import Window
+ Window._enable_event_queue = False
+
+ # Dispatch pending events
+ for window in app.windows:
+ window.switch_to()
+ window.dispatch_pending_events()
+
+ platform_event_loop = app.platform_event_loop
+ platform_event_loop.start()
+ self.dispatch_event('on_enter')
+ self.is_running = True
+
+ while not self.has_exit:
+ timeout = self.idle()
+ platform_event_loop.step(timeout)
+
+ self.is_running = False
+ self.dispatch_event('on_exit')
+ platform_event_loop.stop()
+
+ def enter_blocking(self):
+ """Called by pyglet internal processes when the operating system
+ is about to block due to a user interaction. For example, this
+ is common when the user begins resizing or moving a window.
+
+ This method provides the event loop with an opportunity to set up
+ an OS timer on the platform event loop, which will continue to
+ be invoked during the blocking operation.
+
+ The default implementation ensures that :py:meth:`idle` continues to be
+ called as documented.
+
+ .. versionadded:: 1.2
+ """
+ timeout = self.idle()
+ app.platform_event_loop.set_timer(self._blocking_timer, timeout)
+
+ @staticmethod
+ def exit_blocking():
+ """Called by pyglet internal processes when the blocking operation
+ completes. See :py:meth:`enter_blocking`.
+ """
+ app.platform_event_loop.set_timer(None, None)
+
+ def _blocking_timer(self):
+ timeout = self.idle()
+ app.platform_event_loop.set_timer(self._blocking_timer, timeout)
+
+ def idle(self):
+ """Called during each iteration of the event loop.
+
+ The method is called immediately after any window events (i.e., after
+ any user input). The method can return a duration after which
+ the idle method will be called again. The method may be called
+ earlier if the user creates more input events. The method
+ can return `None` to only wait for user events.
+
+ For example, return ``1.0`` to have the idle method called every
+ second, or immediately after any user events.
+
+ The default implementation dispatches the
+ :py:meth:`pyglet.window.Window.on_draw` event for all windows and uses
+ :py:func:`pyglet.clock.tick` and :py:func:`pyglet.clock.get_sleep_time`
+ on the default clock to determine the return value.
+
+ This method should be overridden by advanced users only. To have
+ code execute at regular intervals, use the
+ :py:func:`pyglet.clock.schedule` methods.
+
+ :rtype: float
+ :return: The number of seconds before the idle method should
+ be called again, or `None` to block for user input.
+ """
+ dt = self.clock.update_time()
+ self.clock.call_scheduled_functions(dt)
+
+ # Update timout
+ return self.clock.get_sleep_time(True)
+
+ @property
+ def has_exit(self):
+ """Flag indicating if the event loop will exit in
+ the next iteration. When set, all waiting threads are interrupted (see
+ :py:meth:`sleep`).
+
+ Thread-safe since pyglet 1.2.
+
+ :see: `exit`
+ :type: bool
+ """
+ self._has_exit_condition.acquire()
+ result = self._has_exit
+ self._has_exit_condition.release()
+ return result
+
+ @has_exit.setter
+ def has_exit(self, value):
+ self._has_exit_condition.acquire()
+ self._has_exit = value
+ self._has_exit_condition.notify()
+ self._has_exit_condition.release()
+
+ def exit(self):
+ """Safely exit the event loop at the end of the current iteration.
+
+ This method is a thread-safe equivalent for setting
+ :py:attr:`has_exit` to ``True``. All waiting threads will be
+ interrupted (see :py:meth:`sleep`).
+ """
+ self.has_exit = True
+ app.platform_event_loop.notify()
+
+ def sleep(self, timeout):
+ """Wait for some amount of time, or until the :py:attr:`has_exit` flag
+ is set or :py:meth:`exit` is called.
+
+ This method is thread-safe.
+
+ :Parameters:
+ `timeout` : float
+ Time to wait, in seconds.
+
+ .. versionadded:: 1.2
+
+ :rtype: bool
+ :return: ``True`` if the `has_exit` flag is set, otherwise ``False``.
+ """
+ self._has_exit_condition.acquire()
+ self._has_exit_condition.wait(timeout)
+ result = self._has_exit
+ self._has_exit_condition.release()
+ return result
+
+ def on_window_close(self, window):
+ """Default window close handler."""
+ if len(app.windows) == 0:
+ self.exit()
+
+ if _is_pyglet_doc_run:
+ def on_window_close(self, window):
+ """A window was closed.
+
+ This event is dispatched when a window is closed. It is not
+ dispatched if the window's close button was pressed but the
+ window did not close.
+
+ The default handler calls :py:meth:`exit` if no more windows are
+ open. You can override this handler to base your application exit
+ on some other policy.
+
+ :event:
+ """
+
+ def on_enter(self):
+ """The event loop is about to begin.
+
+ This is dispatched when the event loop is prepared to enter
+ the main run loop, and represents the last chance for an
+ application to initialise itself.
+
+ :event:
+ """
+
+ def on_exit(self):
+ """The event loop is about to exit.
+
+ After dispatching this event, the :py:meth:`run` method returns (the
+ application may not actually exit if you have more code
+ following the :py:meth:`run` invocation).
+
+ :event:
+ """
+
+
+EventLoop.register_event_type('on_window_close')
+EventLoop.register_event_type('on_enter')
+EventLoop.register_event_type('on_exit')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/cocoa.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/cocoa.py
new file mode 100644
index 0000000000000000000000000000000000000000..f3cbe84f3b690cf33b870a0e1da872136265af15
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/cocoa.py
@@ -0,0 +1,159 @@
+from pyglet.app.base import PlatformEventLoop
+from pyglet.libs.darwin import cocoapy
+
+NSApplication = cocoapy.ObjCClass('NSApplication')
+NSMenu = cocoapy.ObjCClass('NSMenu')
+NSMenuItem = cocoapy.ObjCClass('NSMenuItem')
+NSAutoreleasePool = cocoapy.ObjCClass('NSAutoreleasePool')
+NSDate = cocoapy.ObjCClass('NSDate')
+NSEvent = cocoapy.ObjCClass('NSEvent')
+NSUserDefaults = cocoapy.ObjCClass('NSUserDefaults')
+
+
+class AutoReleasePool:
+ def __enter__(self):
+ self.pool = NSAutoreleasePool.alloc().init()
+ return self.pool
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ self.pool.drain()
+ del self.pool
+
+
+def add_menu_item(menu, title, action, key):
+ with AutoReleasePool():
+ title = cocoapy.CFSTR(title)
+ action = cocoapy.get_selector(action)
+ key = cocoapy.CFSTR(key)
+ menuItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
+ title, action, key)
+ menu.addItem_(menuItem)
+
+ # cleanup
+ title.release()
+ key.release()
+ menuItem.release()
+
+
+def create_menu():
+ with AutoReleasePool():
+ appMenu = NSMenu.alloc().init()
+
+ # Hide still doesn't work!?
+ add_menu_item(appMenu, 'Hide!', 'hide:', 'h')
+ appMenu.addItem_(NSMenuItem.separatorItem())
+ add_menu_item(appMenu, 'Quit!', 'terminate:', 'q')
+
+ menubar = NSMenu.alloc().init()
+ appMenuItem = NSMenuItem.alloc().init()
+ appMenuItem.setSubmenu_(appMenu)
+ menubar.addItem_(appMenuItem)
+ NSApp = NSApplication.sharedApplication()
+ NSApp.setMainMenu_(menubar)
+
+ # cleanup
+ appMenu.release()
+ menubar.release()
+ appMenuItem.release()
+
+
+class CocoaEventLoop(PlatformEventLoop):
+
+ def __init__(self):
+ super(CocoaEventLoop, self).__init__()
+ with AutoReleasePool():
+ # Prepare the default application.
+ self.NSApp = NSApplication.sharedApplication()
+ if self.NSApp.isRunning():
+ # Application was already started by GUI library (e.g. wxPython).
+ return
+ if not self.NSApp.mainMenu():
+ create_menu()
+ self.NSApp.setActivationPolicy_(cocoapy.NSApplicationActivationPolicyRegular)
+ # Prevent Lion / Mountain Lion from automatically saving application state.
+ # If we don't do this, new windows will not display on 10.8 after finishLaunching
+ # has been called.
+ defaults = NSUserDefaults.standardUserDefaults()
+ ignoreState = cocoapy.CFSTR("ApplePersistenceIgnoreState")
+ if not defaults.objectForKey_(ignoreState):
+ defaults.setBool_forKey_(True, ignoreState)
+ self._finished_launching = False
+
+ def start(self):
+ with AutoReleasePool():
+ if not self.NSApp.isRunning() and not self._finished_launching:
+ # finishLaunching should be called only once. However isRunning will not
+ # guard this, as we are not using the normal event loop.
+ self.NSApp.finishLaunching()
+ self.NSApp.activateIgnoringOtherApps_(True)
+ self._finished_launching = True
+
+ def step(self, timeout=None):
+ with AutoReleasePool():
+ self.dispatch_posted_events()
+
+ # Determine the timeout date.
+ if timeout is None:
+ # Using distantFuture as untilDate means that nextEventMatchingMask
+ # will wait until the next event comes along.
+ timeout_date = NSDate.distantFuture()
+ else:
+ timeout_date = NSDate.dateWithTimeIntervalSinceNow_(timeout)
+
+ # Retrieve the next event (if any). We wait for an event to show up
+ # and then process it, or if timeout_date expires we simply return.
+ # We only process one event per call of step().
+ self._is_running.set()
+ event = self.NSApp.nextEventMatchingMask_untilDate_inMode_dequeue_(
+ cocoapy.NSAnyEventMask, timeout_date, cocoapy.NSDefaultRunLoopMode, True)
+
+ # Dispatch the event (if any).
+ if event is not None:
+ event_type = event.type()
+ if event_type != cocoapy.NSApplicationDefined:
+ # Send out event as normal. Responders will still receive
+ # keyUp:, keyDown:, and flagsChanged: events.
+ self.NSApp.sendEvent_(event)
+
+ # Resend key events as special pyglet-specific messages
+ # which supplant the keyDown:, keyUp:, and flagsChanged: messages
+ # because NSApplication translates multiple key presses into key
+ # equivalents before sending them on, which means that some keyUp:
+ # messages are never sent for individual keys. Our pyglet-specific
+ # replacements ensure that we see all the raw key presses & releases.
+ # We also filter out key-down repeats since pyglet only sends one
+ # on_key_press event per key press.
+ if event_type == cocoapy.NSKeyDown and not event.isARepeat():
+ self.NSApp.sendAction_to_from_(cocoapy.get_selector("pygletKeyDown:"), None, event)
+ elif event_type == cocoapy.NSKeyUp:
+ self.NSApp.sendAction_to_from_(cocoapy.get_selector("pygletKeyUp:"), None, event)
+ elif event_type == cocoapy.NSFlagsChanged:
+ self.NSApp.sendAction_to_from_(cocoapy.get_selector("pygletFlagsChanged:"), None, event)
+
+ self.NSApp.updateWindows()
+ did_time_out = False
+ else:
+ did_time_out = True
+
+ self._is_running.clear()
+
+ return did_time_out
+
+ def stop(self):
+ pass
+
+ def notify(self):
+ with AutoReleasePool():
+ notifyEvent = NSEvent.otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_(
+ cocoapy.NSApplicationDefined, # type
+ cocoapy.NSPoint(0.0, 0.0), # location
+ 0, # modifierFlags
+ 0, # timestamp
+ 0, # windowNumber
+ None, # graphicsContext
+ 0, # subtype
+ 0, # data1
+ 0, # data2
+ )
+
+ self.NSApp.postEvent_atStart_(notifyEvent, False)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/win32.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/win32.py
new file mode 100644
index 0000000000000000000000000000000000000000..2549ebf052917225a72ba183124dde560565d7fe
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/win32.py
@@ -0,0 +1,118 @@
+import ctypes
+
+from .base import PlatformEventLoop
+
+from pyglet.libs.win32 import _kernel32, _user32, types, constants
+from pyglet.libs.win32.types import *
+
+
+class Win32EventLoop(PlatformEventLoop):
+ def __init__(self):
+ super().__init__()
+
+ self._next_idle_time = None
+
+ # Force immediate creation of an event queue on this thread -- note
+ # that since event loop is created on pyglet.app import, whatever
+ # imports pyglet.app _must_ own the main run loop.
+ msg = types.MSG()
+ _user32.PeekMessageW(ctypes.byref(msg), 0,
+ constants.WM_USER, constants.WM_USER,
+ constants.PM_NOREMOVE)
+
+ self._event_thread = _kernel32.GetCurrentThreadId()
+
+ self._wait_objects = []
+ self._recreate_wait_objects_array()
+
+ self._timer_proc = types.TIMERPROC(self._timer_proc_func)
+ self._timer = _user32.SetTimer(0, 0, constants.USER_TIMER_MAXIMUM, self._timer_proc)
+ self._timer_func = None
+
+ # Windows Multimedia timer precision functions
+ # https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod
+ self._winmm = ctypes.windll.LoadLibrary('winmm')
+ timecaps = TIMECAPS()
+ self._winmm.timeGetDevCaps(ctypes.byref(timecaps), ctypes.sizeof(timecaps))
+ self._timer_precision = min(max(1, timecaps.wPeriodMin), timecaps.wPeriodMax)
+
+ def add_wait_object(self, obj, func):
+ self._wait_objects.append((obj, func))
+ self._recreate_wait_objects_array()
+
+ def remove_wait_object(self, obj):
+ for i, (_object, _) in enumerate(self._wait_objects):
+ if obj == _object:
+ del self._wait_objects[i]
+ break
+ self._recreate_wait_objects_array()
+
+ def _recreate_wait_objects_array(self):
+ if not self._wait_objects:
+ self._wait_objects_n = 0
+ self._wait_objects_array = None
+ return
+
+ self._wait_objects_n = len(self._wait_objects)
+ self._wait_objects_array = (HANDLE * self._wait_objects_n)(*[o for o, f in self._wait_objects])
+
+ def start(self):
+ if _kernel32.GetCurrentThreadId() != self._event_thread:
+ raise RuntimeError('EventLoop.run() must be called from the same ' +
+ 'thread that imports pyglet.app')
+
+ self._timer_func = None
+
+ self._winmm.timeBeginPeriod(self._timer_precision)
+
+ def step(self, timeout=None):
+ self.dispatch_posted_events()
+
+ msg = types.MSG()
+ if timeout is None:
+ timeout = constants.INFINITE
+ else:
+ timeout = int(timeout * 1000) # milliseconds
+
+ result = _user32.MsgWaitForMultipleObjects(
+ self._wait_objects_n,
+ self._wait_objects_array,
+ False,
+ timeout,
+ constants.QS_ALLINPUT)
+ result -= constants.WAIT_OBJECT_0
+
+ if result == self._wait_objects_n:
+ while _user32.PeekMessageW(ctypes.byref(msg),
+ 0, 0, 0, constants.PM_REMOVE):
+ _user32.TranslateMessage(ctypes.byref(msg))
+ _user32.DispatchMessageW(ctypes.byref(msg))
+ elif 0 <= result < self._wait_objects_n:
+ obj, func = self._wait_objects[result]
+ func()
+
+ # Return True if timeout was interrupted.
+ return result <= self._wait_objects_n
+
+ def stop(self):
+ self._winmm.timeEndPeriod(self._timer_precision)
+
+ def notify(self):
+ # Nudge the event loop with a message it will discard. Note that only
+ # user events are actually posted. The posted event will not
+ # interrupt the window move/size drag loop -- it seems there's no way
+ # to do this.
+ _user32.PostThreadMessageW(self._event_thread, constants.WM_USER, 0, 0)
+
+ def set_timer(self, func, interval):
+ if func is None or interval is None:
+ interval = constants.USER_TIMER_MAXIMUM
+ else:
+ interval = int(interval * 1000) # milliseconds
+
+ self._timer_func = func
+ _user32.SetTimer(0, self._timer, interval, self._timer_proc)
+
+ def _timer_proc_func(self, hwnd, msg, timer, t):
+ if self._timer_func:
+ self._timer_func()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/xlib.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/xlib.py
new file mode 100644
index 0000000000000000000000000000000000000000..1563e99f5038bb8b0f654dce65194ced43a38520
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/app/xlib.py
@@ -0,0 +1,88 @@
+import os
+import select
+import threading
+
+from pyglet import app
+from pyglet.app.base import PlatformEventLoop
+
+
+class XlibSelectDevice:
+ def fileno(self):
+ """Get the file handle for ``select()`` for this device.
+
+ :rtype: int
+ """
+ raise NotImplementedError('abstract')
+
+ def select(self):
+ """Perform event processing on the device.
+
+ Called when ``select()`` returns this device in its list of active
+ files.
+ """
+ raise NotImplementedError('abstract')
+
+ def poll(self):
+ """Check if the device has events ready to process.
+
+ :rtype: bool
+ :return: True if there are events to process, False otherwise.
+ """
+ return False
+
+
+class NotificationDevice(XlibSelectDevice):
+ def __init__(self):
+ self._sync_file_read, self._sync_file_write = os.pipe()
+ self._event = threading.Event()
+
+ def fileno(self):
+ return self._sync_file_read
+
+ def set(self):
+ self._event.set()
+ os.write(self._sync_file_write, b'1')
+
+ def select(self):
+ self._event.clear()
+ os.read(self._sync_file_read, 1)
+ app.platform_event_loop.dispatch_posted_events()
+
+ def poll(self):
+ return self._event.is_set()
+
+
+class XlibEventLoop(PlatformEventLoop):
+ def __init__(self):
+ super(XlibEventLoop, self).__init__()
+ self._notification_device = NotificationDevice()
+ self.select_devices = set()
+ self.select_devices.add(self._notification_device)
+
+ def notify(self):
+ self._notification_device.set()
+
+ def step(self, timeout=None):
+ # Timeout is from EventLoop.idle(). Return after that timeout or directly
+ # after receiving a new event. None means: block for user input.
+
+ # Poll devices to check for already pending events (select.select is not enough)
+ pending_devices = []
+ for device in self.select_devices:
+ if device.poll():
+ pending_devices.append(device)
+
+ # If no devices were ready, wait until one gets ready
+ if not pending_devices:
+ pending_devices, _, _ = select.select(self.select_devices, (), (), timeout)
+
+ if not pending_devices:
+ # Notify caller that timeout expired without incoming events
+ return False
+
+ # Dispatch activity on matching devices
+ for device in pending_devices:
+ device.select()
+
+ # Notify caller that events were handled before timeout expired
+ return True
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..2ef7b539fd65987001ee474f18d4b40a46f9268d
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/__init__.py
@@ -0,0 +1,81 @@
+"""Display and screen management.
+
+Rendering is performed on a :class:`Canvas`, which conceptually could be an
+off-screen buffer, the content area of a :class:`pyglet.window.Window`, or an
+entire screen. Currently, canvases can only be created with windows (though
+windows can be set fullscreen).
+
+Windows and canvases must belong to a :class:`Display`. On Windows and Mac OS X
+there is only one display, which can be obtained with :func:`get_display`.
+Linux supports multiple displays, corresponding to discrete X11 display
+connections and screens. :func:`get_display` on Linux returns the default
+display and screen 0 (``localhost:0.0``); if a particular screen or display is
+required then :class:`Display` can be instantiated directly.
+
+Within a display one or more screens are attached. A :class:`Screen` often
+corresponds to a physical attached monitor, however a monitor or projector set
+up to clone another screen will not be listed. Use :meth:`Display.get_screens`
+to get a list of the attached screens; these can then be queried for their
+sizes and virtual positions on the desktop.
+
+The size of a screen is determined by its current mode, which can be changed
+by the application; see the documentation for :class:`Screen`.
+
+.. versionadded:: 1.2
+"""
+
+import sys
+import weakref
+
+
+_is_pyglet_doc_run = hasattr(sys, "is_pyglet_doc_run") and sys.is_pyglet_doc_run
+
+
+_displays = weakref.WeakSet()
+"""Set of all open displays. Instances of :class:`Display` are automatically
+added to this set upon construction. The set uses weak references, so displays
+are removed from the set when they are no longer referenced.
+
+:type: :class:`WeakSet`
+"""
+
+
+def get_display():
+ """Get the default display device.
+
+ If there is already a :class:`Display` connection, that display will be
+ returned. Otherwise, a default :class:`Display` is created and returned.
+ If multiple display connections are active, an arbitrary one is returned.
+
+ .. versionadded:: 1.2
+
+ :rtype: :class:`Display`
+ """
+ # If there are existing displays, return one of them arbitrarily.
+ for display in _displays:
+ return display
+
+ # Otherwise, create a new display and return it.
+ return Display()
+
+
+if _is_pyglet_doc_run:
+ from pyglet.canvas.base import Display, Screen, Canvas, ScreenMode
+else:
+ from pyglet import compat_platform, options
+ if options['headless']:
+ from pyglet.canvas.headless import HeadlessDisplay as Display
+ from pyglet.canvas.headless import HeadlessScreen as Screen
+ from pyglet.canvas.headless import HeadlessCanvas as Canvas
+ elif compat_platform == 'darwin':
+ from pyglet.canvas.cocoa import CocoaDisplay as Display
+ from pyglet.canvas.cocoa import CocoaScreen as Screen
+ from pyglet.canvas.cocoa import CocoaCanvas as Canvas
+ elif compat_platform in ('win32', 'cygwin'):
+ from pyglet.canvas.win32 import Win32Display as Display
+ from pyglet.canvas.win32 import Win32Screen as Screen
+ from pyglet.canvas.win32 import Win32Canvas as Canvas
+ else:
+ from pyglet.canvas.xlib import XlibDisplay as Display
+ from pyglet.canvas.xlib import XlibScreen as Screen
+ from pyglet.canvas.xlib import XlibCanvas as Canvas
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/base.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..d11af489e9bea0c7bed37bded713197557e111aa
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/base.py
@@ -0,0 +1,335 @@
+from pyglet import gl
+from pyglet import app
+from pyglet import window
+from pyglet import canvas
+
+
+class Display:
+ """A display device supporting one or more screens.
+
+ .. versionadded:: 1.2
+ """
+
+ name = None
+ """Name of this display, if applicable.
+
+ :type: str
+ """
+
+ x_screen = None
+ """The X11 screen number of this display, if applicable.
+
+ :type: int
+ """
+
+ def __init__(self, name=None, x_screen=None):
+ """Create a display connection for the given name and screen.
+
+ On X11, :attr:`name` is of the form ``"hostname:display"``, where the
+ default is usually ``":1"``. On X11, :attr:`x_screen` gives the X
+ screen number to use with this display. A pyglet display can only be
+ used with one X screen; open multiple display connections to access
+ multiple X screens.
+
+ Note that TwinView, Xinerama, xrandr and other extensions present
+ multiple monitors on a single X screen; this is usually the preferred
+ mechanism for working with multiple monitors under X11 and allows each
+ screen to be accessed through a single pyglet`~pyglet.canvas.Display`
+
+ On platforms other than X11, :attr:`name` and :attr:`x_screen` are
+ ignored; there is only a single display device on these systems.
+
+ :Parameters:
+ name : str
+ The name of the display to connect to.
+ x_screen : int
+ The X11 screen number to use.
+
+ """
+ canvas._displays.add(self)
+
+ def get_screens(self):
+ """Get the available screens.
+
+ A typical multi-monitor workstation comprises one :class:`Display`
+ with multiple :class:`Screen` s. This method returns a list of
+ screens which can be enumerated to select one for full-screen display.
+
+ For the purposes of creating an OpenGL config, the default screen
+ will suffice.
+
+ :rtype: list of :class:`Screen`
+ """
+ raise NotImplementedError('abstract')
+
+ def get_default_screen(self):
+ """Get the default (primary) screen as specified by the user's operating system
+ preferences.
+
+ :rtype: :class:`Screen`
+ """
+ screens = self.get_screens()
+ for screen in screens:
+ if screen.x == 0 and screen.y == 0:
+ return screen
+
+ # No Primary screen found?
+ return screens[0]
+
+ def get_windows(self):
+ """Get the windows currently attached to this display.
+
+ :rtype: sequence of :class:`~pyglet.window.Window`
+ """
+ return [window for window in app.windows if window.display is self]
+
+
+class Screen:
+ """A virtual monitor that supports fullscreen windows.
+
+ Screens typically map onto a physical display such as a
+ monitor, television or projector. Selecting a screen for a window
+ has no effect unless the window is made fullscreen, in which case
+ the window will fill only that particular virtual screen.
+
+ The :attr:`width` and :attr:`height` attributes of a screen give the
+ current resolution of the screen. The :attr:`x` and :attr:`y` attributes
+ give the global location of the top-left corner of the screen. This is
+ useful for determining if screens are arranged above or next to one
+ another.
+
+ Use :func:`~Display.get_screens` or :func:`~Display.get_default_screen`
+ to obtain an instance of this class.
+ """
+
+ def __init__(self, display, x, y, width, height):
+ """
+
+ :parameters:
+ `display` : `~pyglet.canvas.Display`
+ :attr:`display`
+ `x` : int
+ Left edge :attr:`x`
+ `y` : int
+ Top edge :attr:`y`
+ `width` : int
+ :attr:`width`
+ `height` : int
+ :attr:`height`
+ """
+ self.display = display
+ """Display this screen belongs to."""
+ self.x = x
+ """Left edge of the screen on the virtual desktop."""
+ self.y = y
+ """Top edge of the screen on the virtual desktop."""
+ self.width = width
+ """Width of the screen, in pixels."""
+ self.height = height
+ """Height of the screen, in pixels."""
+
+ def __repr__(self):
+ return '{}(x={}, y={}, width={}, height={})'.format(self.__class__.__name__, self.x, self.y, self.width, self.height)
+
+ def get_best_config(self, template=None):
+ """Get the best available GL config.
+
+ Any required attributes can be specified in `template`. If
+ no configuration matches the template,
+ :class:`~pyglet.window.NoSuchConfigException` will be raised.
+
+ :deprecated: Use :meth:`pyglet.gl.Config.match`.
+
+ :Parameters:
+ `template` : `pyglet.gl.Config`
+ A configuration with desired attributes filled in.
+
+ :rtype: :class:`~pyglet.gl.Config`
+ :return: A configuration supported by the platform that best
+ fulfils the needs described by the template.
+ """
+ configs = None
+ if template is None:
+ for template_config in [gl.Config(double_buffer=True, depth_size=24, major_version=3, minor_version=3),
+ gl.Config(double_buffer=True, depth_size=16, major_version=3, minor_version=3),
+ None]:
+ try:
+ configs = self.get_matching_configs(template_config)
+ break
+ except window.NoSuchConfigException:
+ pass
+ else:
+ configs = self.get_matching_configs(template)
+ if not configs:
+ raise window.NoSuchConfigException()
+ return configs[0]
+
+ def get_matching_configs(self, template):
+ """Get a list of configs that match a specification.
+
+ Any attributes specified in `template` will have values equal
+ to or greater in each returned config. If no configs satisfy
+ the template, an empty list is returned.
+
+ :deprecated: Use :meth:`pyglet.gl.Config.match`.
+
+ :Parameters:
+ `template` : `pyglet.gl.Config`
+ A configuration with desired attributes filled in.
+
+ :rtype: list of :class:`~pyglet.gl.Config`
+ :return: A list of matching configs.
+ """
+ raise NotImplementedError('abstract')
+
+ def get_modes(self):
+ """Get a list of screen modes supported by this screen.
+
+ :rtype: list of :class:`ScreenMode`
+
+ .. versionadded:: 1.2
+ """
+ raise NotImplementedError('abstract')
+
+ def get_mode(self):
+ """Get the current display mode for this screen.
+
+ :rtype: :class:`ScreenMode`
+
+ .. versionadded:: 1.2
+ """
+ raise NotImplementedError('abstract')
+
+ def get_closest_mode(self, width, height):
+ """Get the screen mode that best matches a given size.
+
+ If no supported mode exactly equals the requested size, a larger one
+ is returned; or ``None`` if no mode is large enough.
+
+ :Parameters:
+ `width` : int
+ Requested screen width.
+ `height` : int
+ Requested screen height.
+
+ :rtype: :class:`ScreenMode`
+
+ .. versionadded:: 1.2
+ """
+ # Best mode is one with smallest resolution larger than width/height,
+ # with depth and refresh rate equal to current mode.
+ current = self.get_mode()
+
+ best = None
+ for mode in self.get_modes():
+ # Reject resolutions that are too small
+ if mode.width < width or mode.height < height:
+ continue
+
+ if best is None:
+ best = mode
+
+ # Must strictly dominate dimensions
+ if (mode.width <= best.width and mode.height <= best.height and
+ (mode.width < best.width or mode.height < best.height)):
+ best = mode
+
+ # Preferably match rate, then depth.
+ if mode.width == best.width and mode.height == best.height:
+ points = 0
+ if mode.rate == current.rate:
+ points += 2
+ if best.rate == current.rate:
+ points -= 2
+ if mode.depth == current.depth:
+ points += 1
+ if best.depth == current.depth:
+ points -= 1
+ if points > 0:
+ best = mode
+ return best
+
+ def set_mode(self, mode):
+ """Set the display mode for this screen.
+
+ The mode must be one previously returned by :meth:`get_mode` or
+ :meth:`get_modes`.
+
+ :Parameters:
+ `mode` : `ScreenMode`
+ Screen mode to switch this screen to.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def restore_mode(self):
+ """Restore the screen mode to the user's default.
+ """
+ raise NotImplementedError('abstract')
+
+
+class ScreenMode:
+ """Screen resolution and display settings.
+
+ Applications should not construct `ScreenMode` instances themselves; see
+ :meth:`Screen.get_modes`.
+
+ The :attr:`depth` and :attr:`rate` variables may be ``None`` if the
+ operating system does not provide relevant data.
+
+ .. versionadded:: 1.2
+
+ """
+
+ width = None
+ """Width of screen, in pixels.
+
+ :type: int
+ """
+ height = None
+ """Height of screen, in pixels.
+
+ :type: int
+ """
+ depth = None
+ """Pixel color depth, in bits per pixel.
+
+ :type: int
+ """
+ rate = None
+ """Screen refresh rate in Hz.
+
+ :type: int
+ """
+
+ def __init__(self, screen):
+ """
+
+ :parameters:
+ `screen` : `Screen`
+ """
+ self.screen = screen
+
+ def __repr__(self):
+ return f'{self.__class__.__name__}(width={self.width!r}, height={self.height!r}, depth={self.depth!r}, rate={self.rate})'
+
+
+class Canvas:
+ """Abstract drawing area.
+
+ Canvases are used internally by pyglet to represent drawing areas --
+ either within a window or full-screen.
+
+ .. versionadded:: 1.2
+ """
+
+ def __init__(self, display):
+ """
+
+ :parameters:
+ `display` : `Display`
+ :attr:`display`
+
+ """
+ self.display = display
+ """Display this canvas was created on."""
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/cocoa.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/cocoa.py
new file mode 100644
index 0000000000000000000000000000000000000000..30f01d65642e0af9b6205fa65cbcbb3df81030eb
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/cocoa.py
@@ -0,0 +1,127 @@
+# Note: The display mode API used here is Mac OS 10.6 only.
+
+from ctypes import *
+
+from .base import Display, Screen, ScreenMode, Canvas
+
+from pyglet.libs.darwin.cocoapy import CGDirectDisplayID, quartz, cf
+from pyglet.libs.darwin.cocoapy import cfstring_to_string, cfarray_to_list
+
+
+class CocoaDisplay(Display):
+
+ def get_screens(self):
+ maxDisplays = 256
+ activeDisplays = (CGDirectDisplayID * maxDisplays)()
+ count = c_uint32()
+ quartz.CGGetActiveDisplayList(maxDisplays, activeDisplays, byref(count))
+ return [CocoaScreen(self, displayID) for displayID in list(activeDisplays)[:count.value]]
+
+
+class CocoaScreen(Screen):
+
+ def __init__(self, display, displayID):
+ bounds = quartz.CGDisplayBounds(displayID)
+ # FIX ME:
+ # Probably need to convert the origin coordinates depending on context:
+ # http://www.cocoabuilder.com/archive/cocoa/233492-ns-cg-rect-conversion-and-screen-coordinates.html
+ x, y = bounds.origin.x, bounds.origin.y
+ width, height = bounds.size.width, bounds.size.height
+ super(CocoaScreen, self).__init__(display, int(x), int(y), int(width), int(height))
+ self._cg_display_id = displayID
+ # Save the default mode so we can restore to it.
+ self._default_mode = self.get_mode()
+
+ # FIX ME:
+ # This method is needed to get multi-monitor support working properly.
+ # However the NSScreens.screens() message currently sends out a warning:
+ # "*** -[NSLock unlock]: lock ( '(null)') unlocked when not locked"
+ # on Snow Leopard and apparently causes python to crash on Lion.
+ #
+ # def get_nsscreen(self):
+ # """Returns the NSScreen instance that matches our CGDirectDisplayID."""
+ # NSScreen = ObjCClass('NSScreen')
+ # # Get a list of all currently active NSScreens and then search through
+ # # them until we find one that matches our CGDisplayID.
+ # screen_array = NSScreen.screens()
+ # count = screen_array.count()
+ # for i in range(count):
+ # nsscreen = screen_array.objectAtIndex_(i)
+ # screenInfo = nsscreen.deviceDescription()
+ # displayID = screenInfo.objectForKey_(get_NSString('NSScreenNumber'))
+ # displayID = displayID.intValue()
+ # if displayID == self._cg_display_id:
+ # return nsscreen
+ # return None
+
+ def get_matching_configs(self, template):
+ canvas = CocoaCanvas(self.display, self, None)
+ return template.match(canvas)
+
+ def get_modes(self):
+ cgmodes = c_void_p(quartz.CGDisplayCopyAllDisplayModes(self._cg_display_id, None))
+ modes = [CocoaScreenMode(self, cgmode) for cgmode in cfarray_to_list(cgmodes)]
+ cf.CFRelease(cgmodes)
+ return modes
+
+ def get_mode(self):
+ cgmode = c_void_p(quartz.CGDisplayCopyDisplayMode(self._cg_display_id))
+ mode = CocoaScreenMode(self, cgmode)
+ quartz.CGDisplayModeRelease(cgmode)
+ return mode
+
+ def set_mode(self, mode):
+ assert mode.screen is self
+ quartz.CGDisplayCapture(self._cg_display_id)
+ quartz.CGDisplaySetDisplayMode(self._cg_display_id, mode.cgmode, None)
+ self.width = mode.width
+ self.height = mode.height
+
+ def restore_mode(self):
+ quartz.CGDisplaySetDisplayMode(self._cg_display_id, self._default_mode.cgmode, None)
+ quartz.CGDisplayRelease(self._cg_display_id)
+
+ def capture_display(self):
+ quartz.CGDisplayCapture(self._cg_display_id)
+
+ def release_display(self):
+ quartz.CGDisplayRelease(self._cg_display_id)
+
+
+class CocoaScreenMode(ScreenMode):
+
+ def __init__(self, screen, cgmode):
+ super(CocoaScreenMode, self).__init__(screen)
+ quartz.CGDisplayModeRetain(cgmode)
+ self.cgmode = cgmode
+ self.width = int(quartz.CGDisplayModeGetWidth(cgmode))
+ self.height = int(quartz.CGDisplayModeGetHeight(cgmode))
+ self.depth = self.getBitsPerPixel(cgmode)
+ self.rate = quartz.CGDisplayModeGetRefreshRate(cgmode)
+
+ def __del__(self):
+ quartz.CGDisplayModeRelease(self.cgmode)
+ self.cgmode = None
+
+ def getBitsPerPixel(self, cgmode):
+ # from /System/Library/Frameworks/IOKit.framework/Headers/graphics/IOGraphicsTypes.h
+ IO8BitIndexedPixels = "PPPPPPPP"
+ IO16BitDirectPixels = "-RRRRRGGGGGBBBBB"
+ IO32BitDirectPixels = "--------RRRRRRRRGGGGGGGGBBBBBBBB"
+
+ cfstring = c_void_p(quartz.CGDisplayModeCopyPixelEncoding(cgmode))
+ pixelEncoding = cfstring_to_string(cfstring)
+ cf.CFRelease(cfstring)
+
+ if pixelEncoding == IO8BitIndexedPixels: return 8
+ if pixelEncoding == IO16BitDirectPixels: return 16
+ if pixelEncoding == IO32BitDirectPixels: return 32
+ return 0
+
+
+class CocoaCanvas(Canvas):
+
+ def __init__(self, display, screen, nsview):
+ super(CocoaCanvas, self).__init__(display)
+ self.screen = screen
+ self.nsview = nsview
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/headless.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/headless.py
new file mode 100644
index 0000000000000000000000000000000000000000..2262d9f2779f0dc98eb5d0486c6249290b132b65
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/headless.py
@@ -0,0 +1,71 @@
+import pyglet
+import warnings
+
+from .base import Display, Screen, ScreenMode, Canvas
+
+
+from ctypes import *
+from pyglet.libs.egl import egl
+from pyglet.libs.egl import eglext
+
+
+class HeadlessDisplay(Display):
+
+ def __init__(self):
+ super().__init__()
+ # TODO: fix this placeholder:
+ self._screens = [HeadlessScreen(self, 0, 0, 1920, 1080)]
+
+ num_devices = egl.EGLint()
+ eglext.eglQueryDevicesEXT(0, None, byref(num_devices))
+ if num_devices.value > 0:
+ headless_device = pyglet.options['headless_device']
+ if headless_device < 0 or headless_device >= num_devices.value:
+ raise ValueError(f'Invalid EGL devide id: {headless_device}')
+ devices = (eglext.EGLDeviceEXT * num_devices.value)()
+ eglext.eglQueryDevicesEXT(num_devices.value, devices, byref(num_devices))
+ self._display_connection = eglext.eglGetPlatformDisplayEXT(
+ eglext.EGL_PLATFORM_DEVICE_EXT, devices[headless_device], None)
+ else:
+ warnings.warn('No device available for EGL device platform. Using native display type.')
+ display = egl.EGLNativeDisplayType()
+ self._display_connection = egl.eglGetDisplay(display)
+
+ egl.eglInitialize(self._display_connection, None, None)
+
+ def get_screens(self):
+ return self._screens
+
+ def __del__(self):
+ egl.eglTerminate(self._display_connection)
+
+
+class HeadlessCanvas(Canvas):
+ def __init__(self, display, egl_surface):
+ super().__init__(display)
+ self.egl_surface = egl_surface
+
+
+class HeadlessScreen(Screen):
+ def __init__(self, display, x, y, width, height):
+ super().__init__(display, x, y, width, height)
+
+ def get_matching_configs(self, template):
+ canvas = HeadlessCanvas(self.display, None)
+ configs = template.match(canvas)
+ # XXX deprecate
+ for config in configs:
+ config.screen = self
+ return configs
+
+ def get_modes(self):
+ pass
+
+ def get_mode(self):
+ pass
+
+ def set_mode(self, mode):
+ pass
+
+ def restore_mode(self):
+ pass
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/win32.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/win32.py
new file mode 100644
index 0000000000000000000000000000000000000000..31c08bb2499557487d5f7c8b2d97497bad6767d6
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/win32.py
@@ -0,0 +1,108 @@
+from .base import Display, Screen, ScreenMode, Canvas
+
+from pyglet.libs.win32 import _user32
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+
+
+class Win32Display(Display):
+ def get_screens(self):
+ screens = []
+
+ def enum_proc(hMonitor, hdcMonitor, lprcMonitor, dwData):
+ r = lprcMonitor.contents
+ width = r.right - r.left
+ height = r.bottom - r.top
+ screens.append(
+ Win32Screen(self, hMonitor, r.left, r.top, width, height))
+ return True
+
+ enum_proc_ptr = MONITORENUMPROC(enum_proc)
+ _user32.EnumDisplayMonitors(None, None, enum_proc_ptr, 0)
+ return screens
+
+
+class Win32Screen(Screen):
+ _initial_mode = None
+
+ def __init__(self, display, handle, x, y, width, height):
+ super(Win32Screen, self).__init__(display, x, y, width, height)
+ self._handle = handle
+
+ def get_matching_configs(self, template):
+ hdc = _user32.GetDC(0)
+ canvas = Win32Canvas(self.display, 0, hdc)
+ configs = template.match(canvas)
+ # XXX deprecate config's being screen-specific
+ for config in configs:
+ config.screen = self
+ _user32.ReleaseDC(0, hdc)
+ return configs
+
+ def get_device_name(self):
+ info = MONITORINFOEX()
+ info.cbSize = sizeof(MONITORINFOEX)
+ _user32.GetMonitorInfoW(self._handle, byref(info))
+ return info.szDevice
+
+ def get_modes(self):
+ device_name = self.get_device_name()
+ i = 0
+ modes = []
+ while True:
+ mode = DEVMODE()
+ mode.dmSize = sizeof(DEVMODE)
+ r = _user32.EnumDisplaySettingsW(device_name, i, byref(mode))
+ if not r:
+ break
+
+ modes.append(Win32ScreenMode(self, mode))
+ i += 1
+
+ return modes
+
+ def get_mode(self):
+ mode = DEVMODE()
+ mode.dmSize = sizeof(DEVMODE)
+ _user32.EnumDisplaySettingsW(self.get_device_name(),
+ ENUM_CURRENT_SETTINGS,
+ byref(mode))
+ return Win32ScreenMode(self, mode)
+
+ def set_mode(self, mode):
+ assert mode.screen is self
+
+ if not self._initial_mode:
+ self._initial_mode = self.get_mode()
+ r = _user32.ChangeDisplaySettingsExW(self.get_device_name(),
+ byref(mode._mode),
+ None,
+ CDS_FULLSCREEN,
+ None)
+ if r == DISP_CHANGE_SUCCESSFUL:
+ self.width = mode.width
+ self.height = mode.height
+
+ def restore_mode(self):
+ if self._initial_mode:
+ self.set_mode(self._initial_mode)
+
+
+class Win32ScreenMode(ScreenMode):
+ def __init__(self, screen, mode):
+ super(Win32ScreenMode, self).__init__(screen)
+ self._mode = mode
+ self.width = mode.dmPelsWidth
+ self.height = mode.dmPelsHeight
+ self.depth = mode.dmBitsPerPel
+ self.rate = mode.dmDisplayFrequency
+ self.scaling = mode.dmDisplayFixedOutput
+
+ def __repr__(self):
+ return f'{self.__class__.__name__}(width={self.width!r}, height={self.height!r}, depth={self.depth!r}, rate={self.rate}, scaling={self.scaling})'
+
+class Win32Canvas(Canvas):
+ def __init__(self, display, hwnd, hdc):
+ super(Win32Canvas, self).__init__(display)
+ self.hwnd = hwnd
+ self.hdc = hdc
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/xlib.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/xlib.py
new file mode 100644
index 0000000000000000000000000000000000000000..27bf0e5714523f1ce3d83bf972e06bf14a1a356a
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/xlib.py
@@ -0,0 +1,260 @@
+import ctypes
+from ctypes import *
+
+from pyglet import app
+from pyglet.app.xlib import XlibSelectDevice
+from .base import Display, Screen, ScreenMode, Canvas
+
+from . import xlib_vidmoderestore
+
+
+# XXX
+# from pyglet.window import NoSuchDisplayException
+class NoSuchDisplayException(Exception):
+ pass
+
+
+from pyglet.libs.x11 import xlib
+
+try:
+ from pyglet.libs.x11 import xinerama
+
+ _have_xinerama = True
+except:
+ _have_xinerama = False
+
+try:
+ from pyglet.libs.x11 import xsync
+
+ _have_xsync = True
+except:
+ _have_xsync = False
+
+try:
+ from pyglet.libs.x11 import xf86vmode
+
+ _have_xf86vmode = True
+except:
+ _have_xf86vmode = False
+
+
+# Set up error handler
+def _error_handler(display, event):
+ # By default, all errors are silently ignored: this has a better chance
+ # of working than the default behaviour of quitting ;-)
+ #
+ # We've actually never seen an error that was our fault; they're always
+ # driver bugs (and so the reports are useless). Nevertheless, set
+ # environment variable PYGLET_DEBUG_X11 to 1 to get dumps of the error
+ # and a traceback (execution will continue).
+ import pyglet
+ if pyglet.options['debug_x11']:
+ event = event.contents
+ buf = c_buffer(1024)
+ xlib.XGetErrorText(display, event.error_code, buf, len(buf))
+ print('X11 error:', buf.value)
+ print(' serial:', event.serial)
+ print(' request:', event.request_code)
+ print(' minor:', event.minor_code)
+ print(' resource:', event.resourceid)
+
+ import traceback
+ print('Python stack trace (innermost last):')
+ traceback.print_stack()
+ return 0
+
+
+_error_handler_ptr = xlib.XErrorHandler(_error_handler)
+xlib.XSetErrorHandler(_error_handler_ptr)
+
+
+class XlibDisplay(XlibSelectDevice, Display):
+ _display = None # POINTER(xlib.Display)
+
+ _x_im = None # X input method
+ # TODO close _x_im when display connection closed.
+ _enable_xsync = False
+ _screens = None # Cache of get_screens()
+
+ def __init__(self, name=None, x_screen=None):
+ if x_screen is None:
+ x_screen = 0
+
+ if isinstance(name, str):
+ name = c_char_p(name.encode('ascii'))
+
+ self._display = xlib.XOpenDisplay(name)
+ if not self._display:
+ raise NoSuchDisplayException(f'Cannot connect to "{name}"')
+
+ screen_count = xlib.XScreenCount(self._display)
+ if x_screen >= screen_count:
+ raise NoSuchDisplayException(f'Display "{name}" has no screen {x_screen:d}')
+
+ super(XlibDisplay, self).__init__()
+ self.name = name
+ self.x_screen = x_screen
+
+ self._fileno = xlib.XConnectionNumber(self._display)
+ self._window_map = {}
+
+ # Initialise XSync
+ if _have_xsync:
+ event_base = c_int()
+ error_base = c_int()
+ if xsync.XSyncQueryExtension(self._display,
+ byref(event_base),
+ byref(error_base)):
+ major_version = c_int()
+ minor_version = c_int()
+ if xsync.XSyncInitialize(self._display,
+ byref(major_version),
+ byref(minor_version)):
+ self._enable_xsync = True
+
+ # Add to event loop select list. Assume we never go away.
+ app.platform_event_loop.select_devices.add(self)
+
+ def get_screens(self):
+ if self._screens:
+ return self._screens
+
+ if _have_xinerama and xinerama.XineramaIsActive(self._display):
+ number = c_int()
+ infos = xinerama.XineramaQueryScreens(self._display, byref(number))
+ infos = cast(infos, POINTER(xinerama.XineramaScreenInfo * number.value)).contents
+ self._screens = []
+ using_xinerama = number.value > 1
+ for info in infos:
+ self._screens.append(XlibScreen(self,
+ info.x_org,
+ info.y_org,
+ info.width,
+ info.height,
+ using_xinerama))
+ xlib.XFree(infos)
+ else:
+ # No xinerama
+ screen_info = xlib.XScreenOfDisplay(self._display, self.x_screen)
+ screen = XlibScreen(self,
+ 0, 0,
+ screen_info.contents.width,
+ screen_info.contents.height,
+ False)
+ self._screens = [screen]
+ return self._screens
+
+ # XlibSelectDevice interface
+
+ def fileno(self):
+ return self._fileno
+
+ def select(self):
+ e = xlib.XEvent()
+ while xlib.XPending(self._display):
+ xlib.XNextEvent(self._display, e)
+
+ # Key events are filtered by the xlib window event
+ # handler so they get a shot at the prefiltered event.
+ if e.xany.type not in (xlib.KeyPress, xlib.KeyRelease):
+ if xlib.XFilterEvent(e, e.xany.window):
+ continue
+ try:
+ dispatch = self._window_map[e.xany.window]
+ except KeyError:
+ continue
+
+ dispatch(e)
+
+ def poll(self):
+ return xlib.XPending(self._display)
+
+
+class XlibScreen(Screen):
+ _initial_mode = None
+
+ def __init__(self, display, x, y, width, height, xinerama):
+ super(XlibScreen, self).__init__(display, x, y, width, height)
+ self._xinerama = xinerama
+
+ def get_matching_configs(self, template):
+ canvas = XlibCanvas(self.display, None)
+ configs = template.match(canvas)
+ # XXX deprecate
+ for config in configs:
+ config.screen = self
+ return configs
+
+ def get_modes(self):
+ if not _have_xf86vmode:
+ return []
+
+ if self._xinerama:
+ # If Xinerama/TwinView is enabled, xf86vidmode's modelines
+ # correspond to metamodes, which don't distinguish one screen from
+ # another. XRandR (broken) or NV (complicated) extensions needed.
+ return []
+
+ count = ctypes.c_int()
+ info_array = ctypes.POINTER(ctypes.POINTER(xf86vmode.XF86VidModeModeInfo))()
+ xf86vmode.XF86VidModeGetAllModeLines(self.display._display, self.display.x_screen, count, info_array)
+
+ # Copy modes out of list and free list
+ modes = []
+ for i in range(count.value):
+ info = xf86vmode.XF86VidModeModeInfo()
+ ctypes.memmove(ctypes.byref(info),
+ ctypes.byref(info_array.contents[i]),
+ ctypes.sizeof(info))
+ modes.append(XlibScreenMode(self, info))
+ if info.privsize:
+ xlib.XFree(info.private)
+ xlib.XFree(info_array)
+
+ return modes
+
+ def get_mode(self):
+ modes = self.get_modes()
+ if modes:
+ return modes[0]
+ return None
+
+ def set_mode(self, mode):
+ assert mode.screen is self
+
+ if not self._initial_mode:
+ self._initial_mode = self.get_mode()
+ xlib_vidmoderestore.set_initial_mode(self._initial_mode)
+
+ xf86vmode.XF86VidModeSwitchToMode(self.display._display, self.display.x_screen, mode.info)
+ xlib.XFlush(self.display._display)
+ xf86vmode.XF86VidModeSetViewPort(self.display._display, self.display.x_screen, 0, 0)
+ xlib.XFlush(self.display._display)
+
+ self.width = mode.width
+ self.height = mode.height
+
+ def restore_mode(self):
+ if self._initial_mode:
+ self.set_mode(self._initial_mode)
+
+ def __repr__(self):
+ return f"{self.__class__.__name__}(display={self.display!r}, x={self.x}, y={self.y}, " \
+ f"width={self.width}, height={self.height}, xinerama={self._xinerama})"
+
+
+
+class XlibScreenMode(ScreenMode):
+ def __init__(self, screen, info):
+ super(XlibScreenMode, self).__init__(screen)
+ self.info = info
+ self.width = info.hdisplay
+ self.height = info.vdisplay
+ self.rate = info.dotclock
+ self.depth = None
+
+
+class XlibCanvas(Canvas):
+ def __init__(self, display, x_window):
+ super(XlibCanvas, self).__init__(display)
+ self.x_window = x_window
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/xlib_vidmoderestore.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/xlib_vidmoderestore.py
new file mode 100644
index 0000000000000000000000000000000000000000..04a8a7d9b6978476f08728d1444934da2d70cfa5
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/canvas/xlib_vidmoderestore.py
@@ -0,0 +1,171 @@
+"""Fork a child process and inform it of mode changes to each screen. The
+child waits until the parent process dies, and then connects to each X server
+with a mode change and restores the mode.
+
+This emulates the behaviour of Windows and Mac, so that resolution changes
+made by an application are not permanent after the program exits, even if
+the process is terminated uncleanly.
+
+The child process is communicated to via a pipe, and watches for parent
+death with a Linux extension signal handler.
+"""
+
+import ctypes
+import os
+import signal
+import struct
+import threading
+
+from pyglet.libs.x11 import xlib
+from pyglet.util import asbytes
+
+try:
+ from pyglet.libs.x11 import xf86vmode
+except:
+ # No xf86vmode... should not be switching modes.
+ pass
+
+_restore_mode_child_installed = False
+_restorable_screens = set()
+_mode_write_pipe = None
+
+
+# Mode packets tell the child process how to restore a given display and
+# screen. Only one packet should be sent per display/screen (more would
+# indicate redundancy or incorrect restoration). Packet format is:
+# display (max 256 chars),
+# screen
+# width
+# height
+# rate
+class ModePacket:
+ format = '256siHHI'
+ size = struct.calcsize(format)
+
+ def __init__(self, display, screen, width, height, rate):
+ self.display = display
+ self.screen = screen
+ self.width = width
+ self.height = height
+ self.rate = rate
+
+ def encode(self):
+ return struct.pack(self.format, self.display, self.screen, self.width, self.height, self.rate)
+
+ @classmethod
+ def decode(cls, data):
+ display, screen, width, height, rate = struct.unpack(cls.format, data)
+ return cls(display.strip(asbytes('\0')), screen, width, height, rate)
+
+ def __repr__(self):
+ return f'{self.__class__.__name__}({self.display}, ' \
+ f'{self.screen}, {self.width}, {self.height}, {self.rate})'
+
+ def set(self):
+ display = xlib.XOpenDisplay(self.display)
+ modes, n_modes = get_modes_array(display, self.screen)
+ mode = get_matching_mode(modes, n_modes, self.width, self.height, self.rate)
+ if mode is not None:
+ xf86vmode.XF86VidModeSwitchToMode(display, self.screen, mode)
+ free_modes_array(modes, n_modes)
+ xlib.XCloseDisplay(display)
+
+
+def get_modes_array(display, screen):
+ count = ctypes.c_int()
+ modes = ctypes.POINTER(ctypes.POINTER(xf86vmode.XF86VidModeModeInfo))()
+ xf86vmode.XF86VidModeGetAllModeLines(display, screen, count, modes)
+ return modes, count.value
+
+
+def get_matching_mode(modes, n_modes, width, height, rate):
+ # Copy modes out of list and free list
+ for i in range(n_modes):
+ mode = modes.contents[i]
+ if (mode.hdisplay == width and
+ mode.vdisplay == height and
+ mode.dotclock == rate):
+ return mode
+ return None
+
+
+def free_modes_array(modes, n_modes):
+ for i in range(n_modes):
+ mode = modes.contents[i]
+ if mode.privsize:
+ xlib.XFree(mode.private)
+ xlib.XFree(modes)
+
+
+def _install_restore_mode_child():
+ global _mode_write_pipe
+ global _restore_mode_child_installed
+
+ if _restore_mode_child_installed:
+ return
+
+ # Parent communicates to child by sending "mode packets" through a pipe:
+ mode_read_pipe, _mode_write_pipe = os.pipe()
+
+ if os.fork() == 0:
+ # Child process (watches for parent to die then restores video mode(s).
+ os.close(_mode_write_pipe)
+
+ # Set up SIGHUP to be the signal for when the parent dies.
+ PR_SET_PDEATHSIG = 1
+ libc = ctypes.cdll.LoadLibrary('libc.so.6')
+ libc.prctl.argtypes = (ctypes.c_int, ctypes.c_ulong, ctypes.c_ulong,
+ ctypes.c_ulong, ctypes.c_ulong)
+ libc.prctl(PR_SET_PDEATHSIG, signal.SIGHUP, 0, 0, 0)
+
+ # SIGHUP indicates the parent has died. The child lock is unlocked, it
+ # stops reading from the mode packet pipe and restores video modes on
+ # all displays/screens it knows about.
+ def _sighup(signum, frame):
+ parent_wait_lock.release()
+
+ parent_wait_lock = threading.Lock()
+ parent_wait_lock.acquire()
+ signal.signal(signal.SIGHUP, _sighup)
+
+ # Wait for parent to die and read packets from parent pipe
+ packets = []
+ buffer = asbytes('')
+ while parent_wait_lock.locked():
+ try:
+ data = os.read(mode_read_pipe, ModePacket.size)
+ buffer += data
+ # Decode packets
+ while len(buffer) >= ModePacket.size:
+ packet = ModePacket.decode(buffer[:ModePacket.size])
+ packets.append(packet)
+ buffer = buffer[ModePacket.size:]
+ except OSError:
+ pass # Interrupted system call
+
+ for packet in packets:
+ packet.set()
+ os._exit(0)
+
+ else:
+ # Parent process. Clean up pipe then continue running program as
+ # normal. Send mode packets through pipe as additional
+ # displays/screens are mode switched.
+ os.close(mode_read_pipe)
+ _restore_mode_child_installed = True
+
+
+def set_initial_mode(mode):
+ _install_restore_mode_child()
+
+ display = xlib.XDisplayString(mode.screen.display._display)
+ screen = mode.screen.display.x_screen
+
+ # Only store one mode per screen.
+ if (display, screen) in _restorable_screens:
+ return
+
+ packet = ModePacket(display, screen, mode.width, mode.height, mode.rate)
+
+ os.write(_mode_write_pipe, packet.encode())
+ _restorable_screens.add((display, screen))
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/clock.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/clock.py
new file mode 100644
index 0000000000000000000000000000000000000000..f05cf948d2c517f34a356c6568e3951fb91a06b9
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/clock.py
@@ -0,0 +1,642 @@
+"""Precise framerate calculation function scheduling.
+
+The :py:mod:`~pyglet.clock` module allows you to schedule functions
+to run periodically, or for one-shot future execution. pyglet's default
+event loop (:py:func:`~pyglet.app.run`) keeps an internal instance of
+a :py:class:`~pyglet.clock.Clock`, which is ticked automatically.
+
+..note:: Some internal modules will schedule items on the clock. If you
+ are using a custom event loop, always remember to `tick` the clock!
+
+Scheduling
+==========
+
+You can schedule a function to be called every time the clock is ticked::
+
+ def callback(dt):
+ print(f"{dt} seconds since last callback")
+
+ clock.schedule(callback)
+
+The `schedule_interval` method causes a function to be called every "n"
+seconds::
+
+ clock.schedule_interval(callback, 0.5) # called twice a second
+
+The `schedule_once` method causes a function to be called once "n" seconds
+in the future::
+
+ clock.schedule_once(callback, 5) # called in 5 seconds
+
+All the `schedule` methods will pass on any additional args or keyword args
+you specify to the callback function::
+
+ def move(dt, velocity, sprite):
+ sprite.position += dt * velocity
+
+ clock.schedule(move, velocity=5.0, sprite=alien)
+
+You can cancel a function scheduled with any of these methods using
+`unschedule`::
+
+ clock.unschedule(move)
+
+Using multiple clocks
+=====================
+
+The clock functions are all relayed to an instance of
+:py:class:`~pyglet.clock.Clock` which is initialised with the module. You can
+get this instance to use directly::
+
+ clk = pyglet.clock.get_default()
+
+You can also replace the default clock with your own:
+
+ myclk = pyglet.clock.Clock()
+ pyglet.clock.set_default(myclk)
+
+Each clock maintains its own set of scheduled functions and frequency
+measurement. Each clock must be "ticked" separately.
+
+Multiple and derived clocks potentially allow you to separate "game-time" and
+"wall-time", or to synchronise your clock to an audio or video stream instead
+of the system clock.
+"""
+
+import time as _time
+
+from typing import Callable
+from heapq import heappop as _heappop
+from heapq import heappush as _heappush
+from heapq import heappushpop as _heappushpop
+from operator import attrgetter as _attrgetter
+from collections import deque as _deque
+
+
+class _ScheduledItem:
+ __slots__ = ['func', 'args', 'kwargs']
+
+ def __init__(self, func, args, kwargs):
+ self.func = func
+ self.args = args
+ self.kwargs = kwargs
+
+
+class _ScheduledIntervalItem:
+ __slots__ = ['func', 'interval', 'last_ts', 'next_ts', 'args', 'kwargs']
+
+ def __init__(self, func, interval, last_ts, next_ts, args, kwargs):
+ self.func = func
+ self.interval = interval
+ self.last_ts = last_ts
+ self.next_ts = next_ts
+ self.args = args
+ self.kwargs = kwargs
+
+ def __lt__(self, other):
+ try:
+ return self.next_ts < other.next_ts
+ except AttributeError:
+ return self.next_ts < other
+
+
+class Clock:
+ """Class for calculating and limiting framerate.
+
+ It is also used for calling scheduled functions.
+ """
+ # List of functions to call every tick.
+ _schedule_items = None
+
+ # List of schedule interval items kept in sort order.
+ _schedule_interval_items = None
+
+ # If True, a sleep(0) is inserted on every tick.
+ _force_sleep = False
+
+ def __init__(self, time_function=_time.perf_counter):
+ """Initialise a Clock, with optional custom time function.
+
+ You can provide a custom time function to return the elapsed
+ time of the application, in seconds. Defaults to time.perf_counter,
+ but can be replaced to allow for easy time dilation effects or game
+ pausing.
+ """
+ self.time = time_function
+ self.next_ts = self.time()
+ self.last_ts = None
+
+ # Used by self.get_frequency to show update frequency
+ self.times = _deque()
+ self.cumulative_time = 0
+ self.window_size = 60
+
+ self._schedule_items = []
+ self._schedule_interval_items = []
+ self._current_interval_item = None
+
+ @staticmethod
+ def sleep(microseconds):
+ _time.sleep(microseconds * 1e-6)
+
+ def update_time(self):
+ """Get the elapsed time since the last call to `update_time`.
+
+ This updates the clock's internal measure of time and returns
+ the difference since the last update (or since the clock was created).
+
+ .. versionadded:: 1.2
+
+ :rtype: float
+ :return: The number of seconds since the last `update_time`, or 0
+ if this was the first time it was called.
+ """
+ ts = self.time()
+ if self.last_ts is None:
+ delta_t = 0
+ else:
+ delta_t = ts - self.last_ts
+ self.times.appendleft(delta_t)
+ if len(self.times) > self.window_size:
+ self.cumulative_time -= self.times.pop()
+ self.cumulative_time += delta_t
+ self.last_ts = ts
+
+ return delta_t
+
+ def call_scheduled_functions(self, dt):
+ """Call scheduled functions that elapsed on the last `update_time`.
+
+ .. versionadded:: 1.2
+
+ :Parameters:
+ dt : float
+ The elapsed time since the last update to pass to each
+ scheduled function. This is *not* used to calculate which
+ functions have elapsed.
+
+ :rtype: bool
+ :return: True if any functions were called, otherwise False.
+ """
+ now = self.last_ts
+ result = False # flag indicates if any function was called
+
+ # handle items scheduled for every tick
+ if self._schedule_items:
+ result = True
+ # duplicate list in case event unschedules itself
+ for item in list(self._schedule_items):
+ item.func(dt, *item.args, **item.kwargs)
+
+ # check the next scheduled item that is not called each tick
+ # if it is scheduled in the future, then exit
+ interval_items = self._schedule_interval_items
+ try:
+ if interval_items[0].next_ts > now:
+ return result
+
+ # raised when the interval_items list is empty
+ except IndexError:
+ return result
+
+ # NOTE: there is no special handling required to manage things
+ # that are scheduled during this loop, due to the heap
+ self._current_interval_item = item = None
+ get_soft_next_ts = self._get_soft_next_ts
+ while interval_items:
+
+ # the scheduler will hold onto a reference to an item in
+ # case it needs to be rescheduled. it is more efficient
+ # to push and pop the heap at once rather than two operations
+ if item is None:
+ item = _heappop(interval_items)
+ else:
+ item = _heappushpop(interval_items, item)
+
+ # a scheduled function may try to unschedule itself,
+ # so we need to keep a reference to the current
+ # item no longer on heap to be able to check
+ self._current_interval_item = item
+
+ # if next item is scheduled in the future then break
+ if item.next_ts > now:
+ break
+
+ # execute the callback
+ try:
+ item.func(now - item.last_ts, *item.args, **item.kwargs)
+ except ReferenceError:
+ pass # weakly-referenced object no longer exists.
+
+ if item.interval:
+
+ # Try to keep timing regular, even if overslept this time;
+ # but don't schedule in the past (which could lead to
+ # infinitely-worsening error).
+ item.next_ts = item.last_ts + item.interval
+ item.last_ts = now
+
+ # test the schedule for the next execution
+ if item.next_ts <= now:
+ # the scheduled time of this item has already
+ # passed, so it must be rescheduled
+ if now - item.next_ts < 0.05:
+ # missed execution time by 'reasonable' amount, so
+ # reschedule at normal interval
+ item.next_ts = now + item.interval
+ else:
+ # missed by significant amount, now many events have
+ # likely missed execution. do a soft re-schedule to
+ # avoid lumping many events together.
+ # in this case, the next dt will not be accurate
+ item.next_ts = get_soft_next_ts(now, item.interval)
+ item.last_ts = item.next_ts - item.interval
+ else:
+ # not an interval, so this item will not be rescheduled
+ self._current_interval_item = item = None
+
+ if item is not None:
+ _heappush(interval_items, item)
+
+ return True
+
+ def tick(self, poll=False):
+ """Signify that one frame has passed.
+
+ This will call any scheduled functions that have elapsed.
+
+ :Parameters:
+ `poll` : bool
+ If True, the function will call any scheduled functions
+ but will not sleep or busy-wait for any reason. Recommended
+ for advanced applications managing their own sleep timers
+ only.
+
+ Since pyglet 1.1.
+
+ :rtype: float
+ :return: The number of seconds since the last "tick", or 0 if this was
+ the first frame.
+ """
+ if not poll and self._force_sleep:
+ self.sleep(0)
+
+ delta_t = self.update_time()
+ self.call_scheduled_functions(delta_t)
+ return delta_t
+
+ def get_sleep_time(self, sleep_idle):
+ """Get the time until the next item is scheduled.
+
+ Applications can choose to continue receiving updates at the
+ maximum framerate during idle time (when no functions are scheduled),
+ or they can sleep through their idle time and allow the CPU to
+ switch to other processes or run in low-power mode.
+
+ If `sleep_idle` is ``True`` the latter behaviour is selected, and
+ ``None`` will be returned if there are no scheduled items.
+
+ Otherwise, if `sleep_idle` is ``False``, or if any scheduled items
+ exist, a value of 0 is returned.
+
+ :Parameters:
+ `sleep_idle` : bool
+ If True, the application intends to sleep through its idle
+ time; otherwise it will continue ticking at the maximum
+ frame rate allowed.
+
+ :rtype: float
+ :return: Time until the next scheduled event in seconds, or ``None``
+ if there is no event scheduled.
+
+ .. versionadded:: 1.1
+ """
+ if self._schedule_items or not sleep_idle:
+ return 0.0
+
+ if self._schedule_interval_items:
+ return max(self._schedule_interval_items[0].next_ts - self.time(), 0.0)
+
+ return None
+
+ def get_frequency(self):
+ """Get the average clock update frequency of recent history.
+
+ The result is the average of a sliding window of the last "n" updates,
+ where "n" is some number designed to cover approximately 1 second.
+ This is **not** the Window redraw rate.
+
+ :rtype: float
+ :return: The measured updates per second.
+ """
+ if not self.cumulative_time:
+ return 0
+ return len(self.times) / self.cumulative_time
+
+ def _get_nearest_ts(self):
+ """Get the nearest timestamp.
+
+ Schedule from now, unless now is sufficiently close to last_ts, in
+ which case use last_ts. This clusters together scheduled items that
+ probably want to be scheduled together. The old (pre 1.1.1)
+ behaviour was to always use self.last_ts, and not look at ts. The
+ new behaviour is needed because clock ticks can now be quite
+ irregular, and span several seconds.
+ """
+ last_ts = self.last_ts or self.next_ts
+ ts = self.time()
+ if ts - last_ts > 0.2:
+ return ts
+ return last_ts
+
+ def _get_soft_next_ts(self, last_ts, interval):
+
+ def taken(ts, e):
+ """Check if `ts` has already got an item scheduled nearby."""
+ # TODO this function is slow and called very often.
+ # Optimise it, maybe?
+ for item in self._schedule_interval_items:
+ if abs(item.next_ts - ts) <= e:
+ return True
+ elif item.next_ts > ts + e:
+ return False
+
+ return False
+
+ # sorted list is required to produce expected results
+ # taken() will iterate through the heap, expecting it to be sorted
+ # and will not always catch the smallest value, so sort here.
+ # do not remove the sort key...it is faster than relaying comparisons
+ # NOTE: do not rewrite as popping from heap, as that is super slow!
+ self._schedule_interval_items.sort(key=_attrgetter('next_ts'))
+
+ # Binary division over interval:
+ #
+ # 0 interval
+ # |--------------------------|
+ # 5 3 6 2 7 4 8 1 Order of search
+ #
+ # i.e., first scheduled at interval,
+ # then at interval/2
+ # then at interval/4
+ # then at interval*3/4
+ # then at ...
+ #
+ # Schedule is hopefully then evenly distributed for any interval,
+ # and any number of scheduled functions.
+
+ next_ts = last_ts + interval
+ if not taken(next_ts, interval / 4):
+ return next_ts
+
+ dt = interval
+ divs = 1
+ while True:
+ next_ts = last_ts
+ for i in range(divs - 1):
+ next_ts += dt
+ if not taken(next_ts, dt / 4):
+ return next_ts
+ dt /= 2
+ divs *= 2
+
+ # Avoid infinite loop in pathological case
+ if divs > 16:
+ return next_ts
+
+ def schedule(self, func, *args, **kwargs):
+ """Schedule a function to be called every frame.
+
+ The function should have a prototype that includes ``dt`` as the
+ first argument, which gives the elapsed time, in seconds, since the
+ last clock tick. Any additional arguments given to this function
+ are passed on to the callback::
+
+ def callback(dt, *args, **kwargs):
+ pass
+
+ :Parameters:
+ `func` : callable
+ The function to call each frame.
+ """
+ item = _ScheduledItem(func, args, kwargs)
+ self._schedule_items.append(item)
+
+ def schedule_once(self, func, delay, *args, **kwargs):
+ """Schedule a function to be called once after `delay` seconds.
+
+ The callback function prototype is the same as for `schedule`.
+
+ :Parameters:
+ `func` : callable
+ The function to call when the timer lapses.
+ `delay` : float
+ The number of seconds to wait before the timer lapses.
+ """
+ last_ts = self._get_nearest_ts()
+ next_ts = last_ts + delay
+ item = _ScheduledIntervalItem(func, 0, last_ts, next_ts, args, kwargs)
+ _heappush(self._schedule_interval_items, item)
+
+ def schedule_interval(self, func, interval, *args, **kwargs):
+ """Schedule a function to be called every `interval` seconds.
+
+ Specifying an interval of 0 prevents the function from being
+ called again (see `schedule` to call a function as often as possible).
+
+ The callback function prototype is the same as for `schedule`.
+
+ :Parameters:
+ `func` : callable
+ The function to call when the timer lapses.
+ `interval` : float
+ The number of seconds to wait between each call.
+
+ """
+ last_ts = self._get_nearest_ts()
+ next_ts = last_ts + interval
+ item = _ScheduledIntervalItem(func, interval, last_ts, next_ts, args, kwargs)
+ _heappush(self._schedule_interval_items, item)
+
+ def schedule_interval_soft(self, func, interval, *args, **kwargs):
+ """Schedule a function to be called every ``interval`` seconds.
+
+ This method is similar to `schedule_interval`, except that the
+ clock will move the interval out of phase with other scheduled
+ functions in order to distribute CPU load more evenly.
+
+ This is useful for functions that need to be called regularly,
+ but not relative to the initial start time. :py:mod:`pyglet.media`
+ does this for scheduling audio buffer updates, which need to occur
+ regularly -- if all audio updates are scheduled at the same time
+ (for example, mixing several tracks of a music score, or playing
+ multiple videos back simultaneously), the resulting load on the
+ CPU is excessive for those intervals but idle outside. Using
+ the soft interval scheduling, the load is more evenly distributed.
+
+ Soft interval scheduling can also be used as an easy way to schedule
+ graphics animations out of phase; for example, multiple flags
+ waving in the wind.
+
+ .. versionadded:: 1.1
+
+ :Parameters:
+ `func` : callable
+ The function to call when the timer lapses.
+ `interval` : float
+ The number of seconds to wait between each call.
+
+ """
+ next_ts = self._get_soft_next_ts(self._get_nearest_ts(), interval)
+ last_ts = next_ts - interval
+ item = _ScheduledIntervalItem(func, interval, last_ts, next_ts, args, kwargs)
+ _heappush(self._schedule_interval_items, item)
+
+ def unschedule(self, func):
+ """Remove a function from the schedule.
+
+ If the function appears in the schedule more than once, all occurrences
+ are removed. If the function was not scheduled, no error is raised.
+
+ :Parameters:
+ `func` : callable
+ The function to remove from the schedule.
+
+ """
+ # clever remove item without disturbing the heap:
+ # 1. set function to an empty lambda -- original function is not called
+ # 2. set interval to 0 -- item will be removed from heap eventually
+ valid_items = set(item for item in self._schedule_interval_items if item.func == func)
+
+ if self._current_interval_item:
+ if self._current_interval_item.func == func:
+ valid_items.add(self._current_interval_item)
+
+ for item in valid_items:
+ item.interval = 0
+ item.func = lambda x, *args, **kwargs: x
+
+ self._schedule_items = [i for i in self._schedule_items if i.func != func]
+
+
+# Default clock.
+_default = Clock()
+
+
+def set_default(default) -> None:
+ """Set the default clock to use for all module-level functions.
+
+ By default, an instance of :py:class:`~pyglet.clock.Clock` is used.
+ """
+ global _default
+ _default = default
+
+
+def get_default():
+ """Get the pyglet default Clock.
+
+ Return the :py:class:`~pyglet.clock.Clock` instance that is used by all
+ module-level clock functions.
+ """
+ return _default
+
+
+def tick(poll: bool = False) -> float:
+ """Signify that one frame has passed on the default clock.
+
+ This will call any scheduled functions that have elapsed,
+ and return the elapsed seconds since the last tick. The
+ return value will be 0.0 if this is the first tick.
+
+ :Parameters:
+ `poll` : bool
+ If True, the function will call any scheduled functions
+ but will not sleep or busy-wait for any reason. Recommended
+ for advanced applications managing their own sleep timers
+ only.
+
+ Since pyglet 1.1.
+ """
+ return _default.tick(poll)
+
+
+def get_sleep_time(sleep_idle: bool) -> float:
+ """Get the time until the next item is scheduled on the default clock.
+
+ Returns the time until the next scheduled event in seconds, or
+ ``None`` if there is no event scheduled.
+
+ See `Clock.get_sleep_time` for details.
+
+ :Parameters:
+ `sleep_idle` : bool
+ If True, the application intends to sleep through its idle
+ time; otherwise it will continue ticking at the maximum
+ frame rate allowed.
+ """
+ return _default.get_sleep_time(sleep_idle)
+
+
+def get_frequency() -> float:
+ """Get the average clock update frequency.
+
+ The result is the sliding average of the last "n" updates,
+ where "n" is some number designed to cover approximately 1
+ second. This is the internal clock update rate, **not** the
+ Window redraw rate. Platform events, such as moving the
+ mouse rapidly, will cause the clock to refresh more often.
+ """
+ return _default.get_frequency()
+
+
+def schedule(func: Callable, *args, **kwargs) -> None:
+ """Schedule 'func' to be called every frame on the default clock.
+
+ The arguments passed to func are ``dt``, followed by any ``*args`` and
+ ``**kwargs`` given here.
+ """
+ _default.schedule(func, *args, **kwargs)
+
+
+def schedule_interval(func: Callable, interval: float, *args, **kwargs) -> None:
+ """Schedule ``func`` on the default clock every ``interval`` seconds.
+
+ The arguments passed to ``func`` are ``dt`` (time since last function
+ call), followed by any ``*args`` and ``**kwargs`` given here.
+ """
+ _default.schedule_interval(func, interval, *args, **kwargs)
+
+
+def schedule_interval_soft(func: Callable, interval: float, *args, **kwargs) -> None:
+ """Schedule ``func`` on the default clock every interval seconds.
+
+ The clock will move the interval out of phase with other scheduled
+ functions in order to distribute CPU load more evenly.
+
+ The arguments passed to ``func`` are ``dt`` (time since last function
+ call), followed by any ``*args`` and ``**kwargs`` given here.
+
+ :see: `Clock.schedule_interval_soft`
+ """
+ _default.schedule_interval_soft(func, interval, *args, **kwargs)
+
+
+def schedule_once(func: Callable, delay: float, *args, **kwargs) -> None:
+ """Schedule ``func`` to be called once after ``delay`` seconds.
+
+ This function uses the default clock. ``delay`` can be a float. The
+ arguments passed to ``func`` are ``dt`` (time since last function call),
+ followed by any ``*args`` and ``**kwargs`` given here.
+
+ If no default clock is set, the func is queued and will be scheduled
+ on the default clock as soon as it is created.
+ """
+ _default.schedule_once(func, delay, *args, **kwargs)
+
+
+def unschedule(func: Callable) -> None:
+ """Remove ``func`` from the default clock's schedule.
+
+ No error is raised if the ``func`` was never scheduled.
+ """
+ _default.unschedule(func)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/event.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/event.py
new file mode 100644
index 0000000000000000000000000000000000000000..965db9b901d4270e52cbfb5813364c64f7292394
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/event.py
@@ -0,0 +1,485 @@
+"""Event dispatch framework.
+
+All objects that produce events in pyglet implement :py:class:`~pyglet.event.EventDispatcher`,
+providing a consistent interface for registering and manipulating event
+handlers. A commonly used event dispatcher is `pyglet.window.Window`.
+
+Event types
+===========
+
+For each event dispatcher there is a set of events that it dispatches; these
+correspond with the type of event handlers you can attach. Event types are
+identified by their name, for example, ''on_resize''. If you are creating a
+new class which implements :py:class:`~pyglet.event.EventDispatcher`, you must call
+`EventDispatcher.register_event_type` for each event type.
+
+Attaching event handlers
+========================
+
+An event handler is simply a function or method. You can attach an event
+handler by setting the appropriate function on the instance::
+
+ def on_resize(width, height):
+ # ...
+ dispatcher.on_resize = on_resize
+
+There is also a convenience decorator that reduces typing::
+
+ @dispatcher.event
+ def on_resize(width, height):
+ # ...
+
+You may prefer to subclass and override the event handlers instead::
+
+ class MyDispatcher(DispatcherClass):
+ def on_resize(self, width, height):
+ # ...
+
+Event handler stack
+===================
+
+When attaching an event handler to a dispatcher using the above methods, it
+replaces any existing handler (causing the original handler to no longer be
+called). Each dispatcher maintains a stack of event handlers, allowing you to
+insert an event handler "above" the existing one rather than replacing it.
+
+There are two main use cases for "pushing" event handlers:
+
+* Temporarily intercepting the events coming from the dispatcher by pushing a
+ custom set of handlers onto the dispatcher, then later "popping" them all
+ off at once.
+* Creating "chains" of event handlers, where the event propagates from the
+ top-most (most recently added) handler to the bottom, until a handler
+ takes care of it.
+
+Use `EventDispatcher.push_handlers` to create a new level in the stack and
+attach handlers to it. You can push several handlers at once::
+
+ dispatcher.push_handlers(on_resize, on_key_press)
+
+If your function handlers have different names to the events they handle, use
+keyword arguments::
+
+ dispatcher.push_handlers(on_resize=my_resize, on_key_press=my_key_press)
+
+After an event handler has processed an event, it is passed on to the
+next-lowest event handler, unless the handler returns `EVENT_HANDLED`, which
+prevents further propagation.
+
+To remove all handlers on the top stack level, use
+`EventDispatcher.pop_handlers`.
+
+Note that any handlers pushed onto the stack have precedence over the
+handlers set directly on the instance (for example, using the methods
+described in the previous section), regardless of when they were set.
+For example, handler ``foo`` is called before handler ``bar`` in the following
+example::
+
+ dispatcher.push_handlers(on_resize=foo)
+ dispatcher.on_resize = bar
+
+Dispatching events
+==================
+
+pyglet uses a single-threaded model for all application code. Event
+handlers are only ever invoked as a result of calling
+EventDispatcher.dispatch_events`.
+
+It is up to the specific event dispatcher to queue relevant events until they
+can be dispatched, at which point the handlers are called in the order the
+events were originally generated.
+
+This implies that your application runs with a main loop that continuously
+updates the application state and checks for new events::
+
+ while True:
+ dispatcher.dispatch_events()
+ # ... additional per-frame processing
+
+Not all event dispatchers require the call to ``dispatch_events``; check with
+the particular class documentation.
+
+.. note::
+
+ In order to prevent issues with garbage collection, the
+ :py:class:`~pyglet.event.EventDispatcher` class only holds weak
+ references to pushed event handlers. That means the following example
+ will not work, because the pushed object will fall out of scope and be
+ collected::
+
+ dispatcher.push_handlers(MyHandlerClass())
+
+ Instead, you must make sure to keep a reference to the object before pushing
+ it. For example::
+
+ my_handler_instance = MyHandlerClass()
+ dispatcher.push_handlers(my_handler_instance)
+
+"""
+
+import inspect
+
+from functools import partial
+from weakref import WeakMethod
+
+EVENT_HANDLED = True
+EVENT_UNHANDLED = None
+
+
+class EventException(Exception):
+ """An exception raised when an event handler could not be attached.
+ """
+ pass
+
+
+class EventDispatcher:
+ """Generic event dispatcher interface.
+
+ See the module docstring for usage.
+ """
+ # Placeholder empty stack; real stack is created only if needed
+ _event_stack = ()
+
+ @classmethod
+ def register_event_type(cls, name):
+ """Register an event type with the dispatcher.
+
+ Registering event types allows the dispatcher to validate event
+ handler names as they are attached, and to search attached objects for
+ suitable handlers.
+
+ :Parameters:
+ `name` : str
+ Name of the event to register.
+
+ """
+ if not hasattr(cls, 'event_types'):
+ cls.event_types = []
+ cls.event_types.append(name)
+ return name
+
+ def push_handlers(self, *args, **kwargs):
+ """Push a level onto the top of the handler stack, then attach zero or
+ more event handlers.
+
+ If keyword arguments are given, they name the event type to attach.
+ Otherwise, a callable's `__name__` attribute will be used. Any other
+ object may also be specified, in which case it will be searched for
+ callables with event names.
+ """
+ # Create event stack if necessary
+ if type(self._event_stack) is tuple:
+ self._event_stack = []
+
+ # Place dict full of new handlers at beginning of stack
+ self._event_stack.insert(0, {})
+ self.set_handlers(*args, **kwargs)
+
+ def _get_handlers(self, args, kwargs):
+ """Implement handler matching on arguments for set_handlers and
+ remove_handlers.
+ """
+ for obj in args:
+ if inspect.isroutine(obj):
+ # Single magically named function
+ name = obj.__name__
+ if name not in self.event_types:
+ raise EventException(f'Unknown event "{name}"')
+ if inspect.ismethod(obj):
+ yield name, WeakMethod(obj, partial(self._remove_handler, name))
+ else:
+ yield name, obj
+ else:
+ # Single instance with magically named methods
+ for name in dir(obj):
+ if name in self.event_types:
+ meth = getattr(obj, name)
+ yield name, WeakMethod(meth, partial(self._remove_handler, name))
+
+ for name, handler in kwargs.items():
+ # Function for handling given event (no magic)
+ if name not in self.event_types:
+ raise EventException(f'Unknown event "{name}"')
+ if inspect.ismethod(handler):
+ yield name, WeakMethod(handler, partial(self._remove_handler, name))
+ else:
+ yield name, handler
+
+ def set_handlers(self, *args, **kwargs):
+ """Attach one or more event handlers to the top level of the handler
+ stack.
+
+ See :py:meth:`~pyglet.event.EventDispatcher.push_handlers` for the accepted argument types.
+ """
+ # Create event stack if necessary
+ if type(self._event_stack) is tuple:
+ self._event_stack = [{}]
+
+ for name, handler in self._get_handlers(args, kwargs):
+ self.set_handler(name, handler)
+
+ def set_handler(self, name, handler):
+ """Attach a single event handler.
+
+ :Parameters:
+ `name` : str
+ Name of the event type to attach to.
+ `handler` : callable
+ Event handler to attach.
+
+ """
+ # Create event stack if necessary
+ if type(self._event_stack) is tuple:
+ self._event_stack = [{}]
+
+ self._event_stack[0][name] = handler
+
+ def pop_handlers(self):
+ """Pop the top level of event handlers off the stack.
+ """
+ assert self._event_stack and 'No handlers pushed'
+
+ del self._event_stack[0]
+
+ def remove_handlers(self, *args, **kwargs):
+ """Remove event handlers from the event stack.
+
+ See :py:meth:`~pyglet.event.EventDispatcher.push_handlers` for the
+ accepted argument types. All handlers are removed from the first stack
+ frame that contains any of the given handlers. No error is raised if
+ any handler does not appear in that frame, or if no stack frame
+ contains any of the given handlers.
+
+ If the stack frame is empty after removing the handlers, it is
+ removed from the stack. Note that this interferes with the expected
+ symmetry of :py:meth:`~pyglet.event.EventDispatcher.push_handlers` and
+ :py:meth:`~pyglet.event.EventDispatcher.pop_handlers`.
+ """
+ handlers = list(self._get_handlers(args, kwargs))
+
+ # Find the first stack frame containing any of the handlers
+ def find_frame():
+ for frame in self._event_stack:
+ for name, handler in handlers:
+ try:
+ if frame[name] == handler:
+ return frame
+ except KeyError:
+ pass
+
+ frame = find_frame()
+
+ # No frame matched; no error.
+ if not frame:
+ return
+
+ # Remove each handler from the frame.
+ for name, handler in handlers:
+ try:
+ if frame[name] == handler:
+ del frame[name]
+ except KeyError:
+ pass
+
+ # Remove the frame if it's empty.
+ if not frame:
+ self._event_stack.remove(frame)
+
+ def remove_handler(self, name, handler):
+ """Remove a single event handler.
+
+ The given event handler is removed from the first handler stack frame
+ it appears in. The handler must be the exact same callable as passed
+ to `set_handler`, `set_handlers` or
+ :py:meth:`~pyglet.event.EventDispatcher.push_handlers`; and the name
+ must match the event type it is bound to.
+
+ No error is raised if the event handler is not set.
+
+ :Parameters:
+ `name` : str
+ Name of the event type to remove.
+ `handler` : callable
+ Event handler to remove.
+ """
+ for frame in self._event_stack:
+ try:
+ if frame[name] == handler:
+ del frame[name]
+ break
+ except KeyError:
+ pass
+
+ def _remove_handler(self, name, handler):
+ """Used internally to remove all handler instances for the given event name.
+
+ This is normally called from a dead ``WeakMethod`` to remove itself from the
+ event stack.
+ """
+
+ # Iterate over a copy as we might mutate the list
+ for frame in list(self._event_stack):
+
+ if name in frame:
+ try:
+ if frame[name] == handler:
+ del frame[name]
+ if not frame:
+ self._event_stack.remove(frame)
+ except TypeError:
+ # weakref is already dead
+ pass
+
+ def dispatch_event(self, event_type, *args):
+ """Dispatch a single event to the attached handlers.
+
+ The event is propagated to all handlers from from the top of the stack
+ until one returns `EVENT_HANDLED`. This method should be used only by
+ :py:class:`~pyglet.event.EventDispatcher` implementors; applications should call
+ the ``dispatch_events`` method.
+
+ Since pyglet 1.2, the method returns `EVENT_HANDLED` if an event
+ handler returned `EVENT_HANDLED` or `EVENT_UNHANDLED` if all events
+ returned `EVENT_UNHANDLED`. If no matching event handlers are in the
+ stack, ``False`` is returned.
+
+ :Parameters:
+ `event_type` : str
+ Name of the event.
+ `args` : sequence
+ Arguments to pass to the event handler.
+
+ :rtype: bool or None
+ :return: (Since pyglet 1.2) `EVENT_HANDLED` if an event handler
+ returned `EVENT_HANDLED`; `EVENT_UNHANDLED` if one or more event
+ handlers were invoked but returned only `EVENT_UNHANDLED`;
+ otherwise ``False``. In pyglet 1.1 and earlier, the return value
+ is always ``None``.
+
+ """
+ assert hasattr(self, 'event_types'), (
+ "No events registered on this EventDispatcher. "
+ "You need to register events with the class method "
+ "EventDispatcher.register_event_type('event_name')."
+ )
+ assert event_type in self.event_types, \
+ f"{event_type} not found in {self}.event_types == {self.event_types}"
+
+ invoked = False
+
+ # Search handler stack for matching event handlers
+ for frame in list(self._event_stack):
+ handler = frame.get(event_type, None)
+ if not handler:
+ continue
+ if isinstance(handler, WeakMethod):
+ handler = handler()
+ assert handler is not None
+ try:
+ invoked = True
+ if handler(*args):
+ return EVENT_HANDLED
+ except TypeError as exception:
+ self._raise_dispatch_exception(event_type, args, handler, exception)
+
+ # Check instance for an event handler
+ try:
+ if getattr(self, event_type)(*args):
+ return EVENT_HANDLED
+ except AttributeError as e:
+ event_op = getattr(self, event_type, None)
+ if callable(event_op):
+ raise e
+ except TypeError as exception:
+ self._raise_dispatch_exception(event_type, args, getattr(self, event_type), exception)
+ else:
+ invoked = True
+
+ if invoked:
+ return EVENT_UNHANDLED
+
+ return False
+
+ @staticmethod
+ def _raise_dispatch_exception(event_type, args, handler, exception):
+ # A common problem in applications is having the wrong number of
+ # arguments in an event handler. This is caught as a TypeError in
+ # dispatch_event but the error message is obfuscated.
+ #
+ # Here we check if there is indeed a mismatch in argument count,
+ # and construct a more useful exception message if so. If this method
+ # doesn't find a problem with the number of arguments, the error
+ # is re-raised as if we weren't here.
+
+ n_args = len(args)
+
+ # Inspect the handler
+ argspecs = inspect.getfullargspec(handler)
+ handler_args = argspecs.args
+ handler_varargs = argspecs.varargs
+ handler_defaults = argspecs.defaults
+
+ n_handler_args = len(handler_args)
+
+ # Remove "self" arg from handler if it's a bound method
+ if inspect.ismethod(handler) and handler.__self__:
+ n_handler_args -= 1
+
+ # Allow *args varargs to overspecify arguments
+ if handler_varargs:
+ n_handler_args = max(n_handler_args, n_args)
+
+ # Allow default values to overspecify arguments
+ if n_handler_args > n_args >= n_handler_args - len(handler_defaults) and handler_defaults:
+ n_handler_args = n_args
+
+ if n_handler_args != n_args:
+ if inspect.isfunction(handler) or inspect.ismethod(handler):
+ descr = f"'{handler.__name__}' at {handler.__code__.co_filename}:{handler.__code__.co_firstlineno}"
+ else:
+ descr = repr(handler)
+
+ raise TypeError(f"The '{event_type}' event was dispatched with {len(args)} arguments,\n"
+ f"but your handler {descr} accepts only {n_handler_args} arguments.")
+
+ else:
+ raise exception
+
+ def event(self, *args):
+ """Function decorator for an event handler.
+
+ Usage::
+
+ win = window.Window()
+
+ @win.event
+ def on_resize(self, width, height):
+ # ...
+
+ or::
+
+ @win.event('on_resize')
+ def foo(self, width, height):
+ # ...
+
+ """
+ if len(args) == 0: # @window.event()
+ def decorator(func):
+ func_name = func.__name__
+ self.set_handler(func_name, func)
+ return func
+
+ return decorator
+ elif inspect.isroutine(args[0]): # @window.event
+ func = args[0]
+ name = func.__name__
+ self.set_handler(name, func)
+ return args[0]
+ elif isinstance(args[0], str): # @window.event('on_resize')
+ name = args[0]
+
+ def decorator(func):
+ self.set_handler(name, func)
+ return func
+
+ return decorator
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/extlibs/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/extlibs/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..416beddb2de99a57f1849afbf06772ed53369c5b
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/extlibs/__init__.py
@@ -0,0 +1,5 @@
+"""
+External dependencies for Pyglet.
+
+These dependencies are included to publish Pyglet as a fully self-contained package.
+"""
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/extlibs/png.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/extlibs/png.py
new file mode 100644
index 0000000000000000000000000000000000000000..815440d71bf30b60f89a813918666a41b8a58fbf
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/extlibs/png.py
@@ -0,0 +1,2333 @@
+#!/usr/bin/env python
+
+# png.py - PNG encoder/decoder in pure Python
+#
+# Copyright (C) 2006 Johann C. Rocholl
+# Portions Copyright (C) 2009 David Jones
+# And probably portions Copyright (C) 2006 Nicko van Someren
+#
+# Original concept by Johann C. Rocholl.
+#
+# LICENCE (MIT)
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction,
+# including without limitation the rights to use, copy, modify, merge,
+# publish, distribute, sublicense, and/or sell copies of the Software,
+# and to permit persons to whom the Software is furnished to do so,
+# subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+"""
+The ``png`` module can read and write PNG files.
+
+Installation and Overview
+-------------------------
+
+``pip install pypng``
+
+For help, type ``import png; help(png)`` in your python interpreter.
+
+A good place to start is the :class:`Reader` and :class:`Writer` classes.
+
+Coverage of PNG formats is fairly complete;
+all allowable bit depths (1/2/4/8/16/24/32/48/64 bits per pixel) and
+colour combinations are supported:
+
+- greyscale (1/2/4/8/16 bit);
+- RGB, RGBA, LA (greyscale with alpha) with 8/16 bits per channel;
+- colour mapped images (1/2/4/8 bit).
+
+Interlaced images,
+which support a progressive display when downloading,
+are supported for both reading and writing.
+
+A number of optional chunks can be specified (when writing)
+and understood (when reading): ``tRNS``, ``bKGD``, ``gAMA``.
+
+The ``sBIT`` chunk can be used to specify precision for
+non-native bit depths.
+
+Requires Python 3.5 or higher.
+Installation is trivial,
+but see the ``README.txt`` file (with the source distribution) for details.
+
+Full use of all features will need some reading of the PNG specification
+http://www.w3.org/TR/2003/REC-PNG-20031110/.
+
+The package also comes with command line utilities.
+
+- ``pripamtopng`` converts
+ `Netpbm `_ PAM/PNM files to PNG;
+- ``pripngtopam`` converts PNG to file PAM/PNM.
+
+There are a few more for simple PNG manipulations.
+
+Spelling and Terminology
+------------------------
+
+Generally British English spelling is used in the documentation.
+So that's "greyscale" and "colour".
+This not only matches the author's native language,
+it's also used by the PNG specification.
+
+Colour Models
+-------------
+
+The major colour models supported by PNG (and hence by PyPNG) are:
+
+- greyscale;
+- greyscale--alpha;
+- RGB;
+- RGB--alpha.
+
+Also referred to using the abbreviations: L, LA, RGB, RGBA.
+Each letter codes a single channel:
+*L* is for Luminance or Luma or Lightness (greyscale images);
+*A* stands for Alpha, the opacity channel
+(used for transparency effects, but higher values are more opaque,
+so it makes sense to call it opacity);
+*R*, *G*, *B* stand for Red, Green, Blue (colour image).
+
+Lists, arrays, sequences, and so on
+-----------------------------------
+
+When getting pixel data out of this module (reading) and
+presenting data to this module (writing) there are
+a number of ways the data could be represented as a Python value.
+
+The preferred format is a sequence of *rows*,
+which each row being a sequence of *values*.
+In this format, the values are in pixel order,
+with all the values from all the pixels in a row
+being concatenated into a single sequence for that row.
+
+Consider an image that is 3 pixels wide by 2 pixels high, and each pixel
+has RGB components:
+
+Sequence of rows::
+
+ list([R,G,B, R,G,B, R,G,B],
+ [R,G,B, R,G,B, R,G,B])
+
+Each row appears as its own list,
+but the pixels are flattened so that three values for one pixel
+simply follow the three values for the previous pixel.
+
+This is the preferred because
+it provides a good compromise between space and convenience.
+PyPNG regards itself as at liberty to replace any sequence type with
+any sufficiently compatible other sequence type;
+in practice each row is an array (``bytearray`` or ``array.array``).
+
+To allow streaming the outer list is sometimes
+an iterator rather than an explicit list.
+
+An alternative format is a single array holding all the values.
+
+Array of values::
+
+ [R,G,B, R,G,B, R,G,B,
+ R,G,B, R,G,B, R,G,B]
+
+The entire image is one single giant sequence of colour values.
+Generally an array will be used (to save space), not a list.
+
+The top row comes first,
+and within each row the pixels are ordered from left-to-right.
+Within a pixel the values appear in the order R-G-B-A
+(or L-A for greyscale--alpha).
+
+There is another format, which should only be used with caution.
+It is mentioned because it is used internally,
+is close to what lies inside a PNG file itself,
+and has some support from the public API.
+This format is called *packed*.
+When packed, each row is a sequence of bytes (integers from 0 to 255),
+just as it is before PNG scanline filtering is applied.
+When the bit depth is 8 this is the same as a sequence of rows;
+when the bit depth is less than 8 (1, 2 and 4),
+several pixels are packed into each byte;
+when the bit depth is 16 each pixel value is decomposed into 2 bytes
+(and `packed` is a misnomer).
+This format is used by the :meth:`Writer.write_packed` method.
+It isn't usually a convenient format,
+but may be just right if the source data for
+the PNG image comes from something that uses a similar format
+(for example, 1-bit BMPs, or another PNG file).
+"""
+
+__version__ = "0.0.20"
+
+import collections
+import io # For io.BytesIO
+import itertools
+import math
+# http://www.python.org/doc/2.4.4/lib/module-operator.html
+import operator
+import re
+import struct
+import sys
+# http://www.python.org/doc/2.4.4/lib/module-warnings.html
+import warnings
+import zlib
+
+from array import array
+
+
+__all__ = ['Image', 'Reader', 'Writer', 'write_chunks', 'from_array']
+
+
+# The PNG signature.
+# http://www.w3.org/TR/PNG/#5PNG-file-signature
+signature = struct.pack('8B', 137, 80, 78, 71, 13, 10, 26, 10)
+
+# The xstart, ystart, xstep, ystep for the Adam7 interlace passes.
+adam7 = ((0, 0, 8, 8),
+ (4, 0, 8, 8),
+ (0, 4, 4, 8),
+ (2, 0, 4, 4),
+ (0, 2, 2, 4),
+ (1, 0, 2, 2),
+ (0, 1, 1, 2))
+
+
+def adam7_generate(width, height):
+ """
+ Generate the coordinates for the reduced scanlines
+ of an Adam7 interlaced image
+ of size `width` by `height` pixels.
+
+ Yields a generator for each pass,
+ and each pass generator yields a series of (x, y, xstep) triples,
+ each one identifying a reduced scanline consisting of
+ pixels starting at (x, y) and taking every xstep pixel to the right.
+ """
+
+ for xstart, ystart, xstep, ystep in adam7:
+ if xstart >= width:
+ continue
+ yield ((xstart, y, xstep) for y in range(ystart, height, ystep))
+
+
+# Models the 'pHYs' chunk (used by the Reader)
+Resolution = collections.namedtuple('_Resolution', 'x y unit_is_meter')
+
+
+def group(s, n):
+ return list(zip(* [iter(s)] * n))
+
+
+def isarray(x):
+ return isinstance(x, array)
+
+
+def check_palette(palette):
+ """
+ Check a palette argument (to the :class:`Writer` class) for validity.
+ Returns the palette as a list if okay;
+ raises an exception otherwise.
+ """
+
+ # None is the default and is allowed.
+ if palette is None:
+ return None
+
+ p = list(palette)
+ if not (0 < len(p) <= 256):
+ raise ProtocolError(
+ "a palette must have between 1 and 256 entries,"
+ " see https://www.w3.org/TR/PNG/#11PLTE")
+ seen_triple = False
+ for i, t in enumerate(p):
+ if len(t) not in (3, 4):
+ raise ProtocolError(
+ f"palette entry {i}: entries must be 3- or 4-tuples.")
+ if len(t) == 3:
+ seen_triple = True
+ if seen_triple and len(t) == 4:
+ raise ProtocolError(
+ f"palette entry {i}: all 4-tuples must precede all 3-tuples")
+ for x in t:
+ if int(x) != x or not(0 <= x <= 255):
+ raise ProtocolError(
+ f"palette entry {i}: "
+ "values must be integer: 0 <= x <= 255")
+ return p
+
+
+def check_sizes(size, width, height):
+ """
+ Check that these arguments, if supplied, are consistent.
+ Return a (width, height) pair.
+ """
+
+ if not size:
+ return width, height
+
+ if len(size) != 2:
+ raise ProtocolError(
+ "size argument should be a pair (width, height)")
+ if width is not None and width != size[0]:
+ raise ProtocolError(
+ f"size[0] ({size[0]}) and width ({width}) should match when both are used.")
+ if height is not None and height != size[1]:
+ raise ProtocolError(
+ f"size[1] ({size[1]}) and height ({height}) should match when both are used.")
+ return size
+
+
+def check_color(c, greyscale, which):
+ """
+ Checks that a colour argument for transparent or background options
+ is the right form.
+ Returns the colour
+ (which, if it's a bare integer, is "corrected" to a 1-tuple).
+ """
+
+ if c is None:
+ return c
+ if greyscale:
+ try:
+ len(c)
+ except TypeError:
+ c = (c,)
+ if len(c) != 1:
+ raise ProtocolError(f"{which} for greyscale must be 1-tuple")
+ if not is_natural(c[0]):
+ raise ProtocolError(
+ f"{which} colour for greyscale must be integer")
+ else:
+ if not (len(c) == 3 and
+ is_natural(c[0]) and
+ is_natural(c[1]) and
+ is_natural(c[2])):
+ raise ProtocolError(
+ f"{which} colour must be a triple of integers")
+ return c
+
+
+class Error(Exception):
+ def __str__(self):
+ return self.__class__.__name__ + ': ' + ' '.join(self.args)
+
+
+class FormatError(Error):
+ """
+ Problem with input file format.
+ In other words, PNG file does not conform to
+ the specification in some way and is invalid.
+ """
+
+
+class ProtocolError(Error):
+ """
+ Problem with the way the programming interface has been used,
+ or the data presented to it.
+ """
+
+
+class ChunkError(FormatError):
+ pass
+
+
+class Default:
+ """The default for the greyscale paramter."""
+
+
+class Writer:
+ """
+ PNG encoder in pure Python.
+ """
+
+ def __init__(self, width=None, height=None,
+ size=None,
+ greyscale=Default,
+ alpha=False,
+ bitdepth=8,
+ palette=None,
+ transparent=None,
+ background=None,
+ gamma=None,
+ compression=None,
+ interlace=False,
+ planes=None,
+ colormap=None,
+ maxval=None,
+ chunk_limit=2**20,
+ x_pixels_per_unit=None,
+ y_pixels_per_unit=None,
+ unit_is_meter=False):
+ """
+ Create a PNG encoder object.
+
+ Arguments:
+
+ width, height
+ Image size in pixels, as two separate arguments.
+ size
+ Image size (w,h) in pixels, as single argument.
+ greyscale
+ Pixels are greyscale, not RGB.
+ alpha
+ Input data has alpha channel (RGBA or LA).
+ bitdepth
+ Bit depth: from 1 to 16 (for each channel).
+ palette
+ Create a palette for a colour mapped image (colour type 3).
+ transparent
+ Specify a transparent colour (create a ``tRNS`` chunk).
+ background
+ Specify a default background colour (create a ``bKGD`` chunk).
+ gamma
+ Specify a gamma value (create a ``gAMA`` chunk).
+ compression
+ zlib compression level: 0 (none) to 9 (more compressed);
+ default: -1 or None.
+ interlace
+ Create an interlaced image.
+ chunk_limit
+ Write multiple ``IDAT`` chunks to save memory.
+ x_pixels_per_unit
+ Number of pixels a unit along the x axis (write a
+ `pHYs` chunk).
+ y_pixels_per_unit
+ Number of pixels a unit along the y axis (write a
+ `pHYs` chunk). Along with `x_pixel_unit`, this gives
+ the pixel size ratio.
+ unit_is_meter
+ `True` to indicate that the unit (for the `pHYs`
+ chunk) is metre.
+
+ The image size (in pixels) can be specified either by using the
+ `width` and `height` arguments, or with the single `size`
+ argument.
+ If `size` is used it should be a pair (*width*, *height*).
+
+ The `greyscale` argument indicates whether input pixels
+ are greyscale (when true), or colour (when false).
+ The default is true unless `palette=` is used.
+
+ The `alpha` argument (a boolean) specifies
+ whether input pixels have an alpha channel (or not).
+
+ `bitdepth` specifies the bit depth of the source pixel values.
+ Each channel may have a different bit depth.
+ Each source pixel must have values that are
+ an integer between 0 and ``2**bitdepth-1``, where
+ `bitdepth` is the bit depth for the corresponding channel.
+ For example, 8-bit images have values between 0 and 255.
+ PNG only stores images with bit depths of
+ 1,2,4,8, or 16 (the same for all channels).
+ When `bitdepth` is not one of these values or where
+ channels have different bit depths,
+ the next highest valid bit depth is selected,
+ and an ``sBIT`` (significant bits) chunk is generated
+ that specifies the original precision of the source image.
+ In this case the supplied pixel values will be rescaled to
+ fit the range of the selected bit depth.
+
+ The PNG file format supports many bit depth / colour model
+ combinations, but not all.
+ The details are somewhat arcane
+ (refer to the PNG specification for full details).
+ Briefly:
+ Bit depths < 8 (1,2,4) are only allowed with greyscale and
+ colour mapped images;
+ colour mapped images cannot have bit depth 16.
+
+ For colour mapped images
+ (in other words, when the `palette` argument is specified)
+ the `bitdepth` argument must match one of
+ the valid PNG bit depths: 1, 2, 4, or 8.
+ (It is valid to have a PNG image with a palette and
+ an ``sBIT`` chunk, but the meaning is slightly different;
+ it would be awkward to use the `bitdepth` argument for this.)
+
+ The `palette` option, when specified,
+ causes a colour mapped image to be created:
+ the PNG colour type is set to 3;
+ `greyscale` must not be true; `alpha` must not be true;
+ `transparent` must not be set.
+ The bit depth must be 1,2,4, or 8.
+ When a colour mapped image is created,
+ the pixel values are palette indexes and
+ the `bitdepth` argument specifies the size of these indexes
+ (not the size of the colour values in the palette).
+
+ The palette argument value should be a sequence of 3- or
+ 4-tuples.
+ 3-tuples specify RGB palette entries;
+ 4-tuples specify RGBA palette entries.
+ All the 4-tuples (if present) must come before all the 3-tuples.
+ A ``PLTE`` chunk is created;
+ if there are 4-tuples then a ``tRNS`` chunk is created as well.
+ The ``PLTE`` chunk will contain all the RGB triples in the same
+ sequence;
+ the ``tRNS`` chunk will contain the alpha channel for
+ all the 4-tuples, in the same sequence.
+ Palette entries are always 8-bit.
+
+ If specified, the `transparent` and `background` parameters must be
+ a tuple with one element for each channel in the image.
+ Either a 3-tuple of integer (RGB) values for a colour image, or
+ a 1-tuple of a single integer for a greyscale image.
+
+ If specified, the `gamma` parameter must be a positive number
+ (generally, a `float`).
+ A ``gAMA`` chunk will be created.
+ Note that this will not change the values of the pixels as
+ they appear in the PNG file,
+ they are assumed to have already
+ been converted appropriately for the gamma specified.
+
+ The `compression` argument specifies the compression level to
+ be used by the ``zlib`` module.
+ Values from 1 to 9 (highest) specify compression.
+ 0 means no compression.
+ -1 and ``None`` both mean that the ``zlib`` module uses
+ the default level of compession (which is generally acceptable).
+
+ If `interlace` is true then an interlaced image is created
+ (using PNG's so far only interace method, *Adam7*).
+ This does not affect how the pixels should be passed in,
+ rather it changes how they are arranged into the PNG file.
+ On slow connexions interlaced images can be
+ partially decoded by the browser to give
+ a rough view of the image that is
+ successively refined as more image data appears.
+
+ .. note ::
+
+ Enabling the `interlace` option requires the entire image
+ to be processed in working memory.
+
+ `chunk_limit` is used to limit the amount of memory used whilst
+ compressing the image.
+ In order to avoid using large amounts of memory,
+ multiple ``IDAT`` chunks may be created.
+ """
+
+ # At the moment the `planes` argument is ignored;
+ # its purpose is to act as a dummy so that
+ # ``Writer(x, y, **info)`` works, where `info` is a dictionary
+ # returned by Reader.read and friends.
+ # Ditto for `colormap`.
+
+ width, height = check_sizes(size, width, height)
+ del size
+
+ if not is_natural(width) or not is_natural(height):
+ raise ProtocolError("width and height must be integers")
+ if width <= 0 or height <= 0:
+ raise ProtocolError("width and height must be greater than zero")
+ # http://www.w3.org/TR/PNG/#7Integers-and-byte-order
+ if width > 2 ** 31 - 1 or height > 2 ** 31 - 1:
+ raise ProtocolError("width and height cannot exceed 2**31-1")
+
+ if alpha and transparent is not None:
+ raise ProtocolError(
+ "transparent colour not allowed with alpha channel")
+
+ # bitdepth is either single integer, or tuple of integers.
+ # Convert to tuple.
+ try:
+ len(bitdepth)
+ except TypeError:
+ bitdepth = (bitdepth, )
+ for b in bitdepth:
+ valid = is_natural(b) and 1 <= b <= 16
+ if not valid:
+ raise ProtocolError(
+ f"each bitdepth {bitdepth} must be a positive integer <= 16")
+
+ # Calculate channels, and
+ # expand bitdepth to be one element per channel.
+ palette = check_palette(palette)
+ alpha = bool(alpha)
+ colormap = bool(palette)
+ if greyscale is Default and palette:
+ greyscale = False
+ greyscale = bool(greyscale)
+ if colormap:
+ color_planes = 1
+ planes = 1
+ else:
+ color_planes = (3, 1)[greyscale]
+ planes = color_planes + alpha
+ if len(bitdepth) == 1:
+ bitdepth *= planes
+
+ bitdepth, self.rescale = check_bitdepth_rescale(
+ palette,
+ bitdepth,
+ transparent, alpha, greyscale)
+
+ # These are assertions, because above logic should have
+ # corrected or raised all problematic cases.
+ if bitdepth < 8:
+ assert greyscale or palette
+ assert not alpha
+ if bitdepth > 8:
+ assert not palette
+
+ transparent = check_color(transparent, greyscale, 'transparent')
+ background = check_color(background, greyscale, 'background')
+
+ # It's important that the true boolean values
+ # (greyscale, alpha, colormap, interlace) are converted
+ # to bool because Iverson's convention is relied upon later on.
+ self.width = width
+ self.height = height
+ self.transparent = transparent
+ self.background = background
+ self.gamma = gamma
+ self.greyscale = greyscale
+ self.alpha = alpha
+ self.colormap = colormap
+ self.bitdepth = int(bitdepth)
+ self.compression = compression
+ self.chunk_limit = chunk_limit
+ self.interlace = bool(interlace)
+ self.palette = palette
+ self.x_pixels_per_unit = x_pixels_per_unit
+ self.y_pixels_per_unit = y_pixels_per_unit
+ self.unit_is_meter = bool(unit_is_meter)
+
+ self.color_type = (4 * self.alpha +
+ 2 * (not greyscale) +
+ 1 * self.colormap)
+ assert self.color_type in (0, 2, 3, 4, 6)
+
+ self.color_planes = color_planes
+ self.planes = planes
+ # :todo: fix for bitdepth < 8
+ self.psize = (self.bitdepth / 8) * self.planes
+
+ def write(self, outfile, rows):
+ """
+ Write a PNG image to the output file.
+ `rows` should be an iterable that yields each row
+ (each row is a sequence of values).
+ The rows should be the rows of the original image,
+ so there should be ``self.height`` rows of
+ ``self.width * self.planes`` values.
+ If `interlace` is specified (when creating the instance),
+ then an interlaced PNG file will be written.
+ Supply the rows in the normal image order;
+ the interlacing is carried out internally.
+
+ .. note ::
+
+ Interlacing requires the entire image to be in working memory.
+ """
+
+ # Values per row
+ vpr = self.width * self.planes
+
+ def check_rows(rows):
+ """
+ Yield each row in rows,
+ but check each row first (for correct width).
+ """
+ for i, row in enumerate(rows):
+ try:
+ wrong_length = len(row) != vpr
+ except TypeError:
+ # When using an itertools.ichain object or
+ # other generator not supporting __len__,
+ # we set this to False to skip the check.
+ wrong_length = False
+ if wrong_length:
+ # Note: row numbers start at 0.
+ raise ProtocolError(
+ f"Expected {vpr} values but got {len(row)} values, in row {i}")
+ yield row
+
+ if self.interlace:
+ fmt = 'BH'[self.bitdepth > 8]
+ a = array(fmt, itertools.chain(*check_rows(rows)))
+ return self.write_array(outfile, a)
+
+ nrows = self.write_passes(outfile, check_rows(rows))
+ if nrows != self.height:
+ raise ProtocolError(
+ f"rows supplied ({nrows}) does not match height ({self.height})")
+ return nrows
+
+ def write_passes(self, outfile, rows):
+ """
+ Write a PNG image to the output file.
+
+ Most users are expected to find the :meth:`write` or
+ :meth:`write_array` method more convenient.
+
+ The rows should be given to this method in the order that
+ they appear in the output file.
+ For straightlaced images, this is the usual top to bottom ordering.
+ For interlaced images the rows should have been interlaced before
+ passing them to this function.
+
+ `rows` should be an iterable that yields each row
+ (each row being a sequence of values).
+ """
+
+ # Ensure rows are scaled (to 4-/8-/16-bit),
+ # and packed into bytes.
+
+ if self.rescale:
+ rows = rescale_rows(rows, self.rescale)
+
+ if self.bitdepth < 8:
+ rows = pack_rows(rows, self.bitdepth)
+ elif self.bitdepth == 16:
+ rows = unpack_rows(rows)
+
+ return self.write_packed(outfile, rows)
+
+ def write_packed(self, outfile, rows):
+ """
+ Write PNG file to `outfile`.
+ `rows` should be an iterator that yields each packed row;
+ a packed row being a sequence of packed bytes.
+
+ The rows have a filter byte prefixed and
+ are then compressed into one or more IDAT chunks.
+ They are not processed any further,
+ so if bitdepth is other than 1, 2, 4, 8, 16,
+ the pixel values should have been scaled
+ before passing them to this method.
+
+ This method does work for interlaced images but it is best avoided.
+ For interlaced images, the rows should be
+ presented in the order that they appear in the file.
+ """
+
+ self.write_preamble(outfile)
+
+ # http://www.w3.org/TR/PNG/#11IDAT
+ if self.compression is not None:
+ compressor = zlib.compressobj(self.compression)
+ else:
+ compressor = zlib.compressobj()
+
+ # data accumulates bytes to be compressed for the IDAT chunk;
+ # it's compressed when sufficiently large.
+ data = bytearray()
+
+ # raise i scope out of the for loop. set to -1, because the for loop
+ # sets i to 0 on the first pass
+ i = -1
+ for i, row in enumerate(rows):
+ # Add "None" filter type.
+ # Currently, it's essential that this filter type be used
+ # for every scanline as
+ # we do not mark the first row of a reduced pass image;
+ # that means we could accidentally compute
+ # the wrong filtered scanline if we used
+ # "up", "average", or "paeth" on such a line.
+ data.append(0)
+ data.extend(row)
+ if len(data) > self.chunk_limit:
+ compressed = compressor.compress(data)
+ if len(compressed):
+ write_chunk(outfile, b'IDAT', compressed)
+ data = bytearray()
+
+ compressed = compressor.compress(bytes(data))
+ flushed = compressor.flush()
+ if len(compressed) or len(flushed):
+ write_chunk(outfile, b'IDAT', compressed + flushed)
+ # http://www.w3.org/TR/PNG/#11IEND
+ write_chunk(outfile, b'IEND')
+ return i + 1
+
+ def write_preamble(self, outfile):
+ # http://www.w3.org/TR/PNG/#5PNG-file-signature
+ outfile.write(signature)
+
+ # http://www.w3.org/TR/PNG/#11IHDR
+ write_chunk(outfile, b'IHDR',
+ struct.pack("!2I5B", self.width, self.height,
+ self.bitdepth, self.color_type,
+ 0, 0, self.interlace))
+
+ # See :chunk:order
+ # http://www.w3.org/TR/PNG/#11gAMA
+ if self.gamma is not None:
+ write_chunk(outfile, b'gAMA',
+ struct.pack("!L", int(round(self.gamma * 1e5))))
+
+ # See :chunk:order
+ # http://www.w3.org/TR/PNG/#11sBIT
+ if self.rescale:
+ write_chunk(
+ outfile, b'sBIT',
+ struct.pack(f'{self.planes,* [s[0] for s in self.rescale]}B' ))
+
+ # :chunk:order: Without a palette (PLTE chunk),
+ # ordering is relatively relaxed.
+ # With one, gAMA chunk must precede PLTE chunk
+ # which must precede tRNS and bKGD.
+ # See http://www.w3.org/TR/PNG/#5ChunkOrdering
+ if self.palette:
+ p, t = make_palette_chunks(self.palette)
+ write_chunk(outfile, b'PLTE', p)
+ if t:
+ # tRNS chunk is optional;
+ # Only needed if palette entries have alpha.
+ write_chunk(outfile, b'tRNS', t)
+
+ # http://www.w3.org/TR/PNG/#11tRNS
+ if self.transparent is not None:
+ if self.greyscale:
+ fmt = "!1H"
+ else:
+ fmt = "!3H"
+ write_chunk(outfile, b'tRNS',
+ struct.pack(fmt, *self.transparent))
+
+ # http://www.w3.org/TR/PNG/#11bKGD
+ if self.background is not None:
+ if self.greyscale:
+ fmt = "!1H"
+ else:
+ fmt = "!3H"
+ write_chunk(outfile, b'bKGD',
+ struct.pack(fmt, *self.background))
+
+ # http://www.w3.org/TR/PNG/#11pHYs
+ if (self.x_pixels_per_unit is not None and
+ self.y_pixels_per_unit is not None):
+ tup = (self.x_pixels_per_unit,
+ self.y_pixels_per_unit,
+ int(self.unit_is_meter))
+ write_chunk(outfile, b'pHYs', struct.pack("!LLB", *tup))
+
+ def write_array(self, outfile, pixels):
+ """
+ Write an array that holds all the image values
+ as a PNG file on the output file.
+ See also :meth:`write` method.
+ """
+
+ if self.interlace:
+ if type(pixels) != array:
+ # Coerce to array type
+ fmt = 'BH'[self.bitdepth > 8]
+ pixels = array(fmt, pixels)
+ return self.write_passes(
+ outfile,
+ self.array_scanlines_interlace(pixels)
+ )
+ else:
+ return self.write_passes(
+ outfile,
+ self.array_scanlines(pixels)
+ )
+
+ def array_scanlines(self, pixels):
+ """
+ Generates rows (each a sequence of values) from
+ a single array of values.
+ """
+
+ # Values per row
+ vpr = self.width * self.planes
+ stop = 0
+ for y in range(self.height):
+ start = stop
+ stop = start + vpr
+ yield pixels[start:stop]
+
+ def array_scanlines_interlace(self, pixels):
+ """
+ Generator for interlaced scanlines from an array.
+ `pixels` is the full source image as a single array of values.
+ The generator yields each scanline of the reduced passes in turn,
+ each scanline being a sequence of values.
+ """
+
+ # http://www.w3.org/TR/PNG/#8InterlaceMethods
+ # Array type.
+ fmt = 'BH'[self.bitdepth > 8]
+ # Value per row
+ vpr = self.width * self.planes
+
+ # Each iteration generates a scanline starting at (x, y)
+ # and consisting of every xstep pixels.
+ for lines in adam7_generate(self.width, self.height):
+ for x, y, xstep in lines:
+ # Pixels per row (of reduced image)
+ ppr = int(math.ceil((self.width - x) / float(xstep)))
+ # Values per row (of reduced image)
+ reduced_row_len = ppr * self.planes
+ if xstep == 1:
+ # Easy case: line is a simple slice.
+ offset = y * vpr
+ yield pixels[offset: offset + vpr]
+ continue
+ # We have to step by xstep,
+ # which we can do one plane at a time
+ # using the step in Python slices.
+ row = array(fmt)
+ # There's no easier way to set the length of an array
+ row.extend(pixels[0:reduced_row_len])
+ offset = y * vpr + x * self.planes
+ end_offset = (y + 1) * vpr
+ skip = self.planes * xstep
+ for i in range(self.planes):
+ row[i::self.planes] = \
+ pixels[offset + i: end_offset: skip]
+ yield row
+
+
+def write_chunk(outfile, tag, data=b''):
+ """
+ Write a PNG chunk to the output file, including length and
+ checksum.
+ """
+
+ data = bytes(data)
+ # http://www.w3.org/TR/PNG/#5Chunk-layout
+ outfile.write(struct.pack("!I", len(data)))
+ outfile.write(tag)
+ outfile.write(data)
+ checksum = zlib.crc32(tag)
+ checksum = zlib.crc32(data, checksum)
+ checksum &= 2 ** 32 - 1
+ outfile.write(struct.pack("!I", checksum))
+
+
+def write_chunks(out, chunks):
+ """Create a PNG file by writing out the chunks."""
+
+ out.write(signature)
+ for chunk in chunks:
+ write_chunk(out, *chunk)
+
+
+def rescale_rows(rows, rescale):
+ """
+ Take each row in rows (an iterator) and yield
+ a fresh row with the pixels scaled according to
+ the rescale parameters in the list `rescale`.
+ Each element of `rescale` is a tuple of
+ (source_bitdepth, target_bitdepth),
+ with one element per channel.
+ """
+
+ # One factor for each channel
+ fs = [float(2 ** s[1] - 1)/float(2 ** s[0] - 1)
+ for s in rescale]
+
+ # Assume all target_bitdepths are the same
+ target_bitdepths = set(s[1] for s in rescale)
+ assert len(target_bitdepths) == 1
+ (target_bitdepth, ) = target_bitdepths
+ typecode = 'BH'[target_bitdepth > 8]
+
+ # Number of channels
+ n_chans = len(rescale)
+
+ for row in rows:
+ rescaled_row = array(typecode, iter(row))
+ for i in range(n_chans):
+ channel = array(
+ typecode,
+ (int(round(fs[i] * x)) for x in row[i::n_chans]))
+ rescaled_row[i::n_chans] = channel
+ yield rescaled_row
+
+
+def pack_rows(rows, bitdepth):
+ """Yield packed rows that are a byte array.
+ Each byte is packed with the values from several pixels.
+ """
+
+ assert bitdepth < 8
+ assert 8 % bitdepth == 0
+
+ # samples per byte
+ spb = int(8 / bitdepth)
+
+ def make_byte(block):
+ """Take a block of (2, 4, or 8) values,
+ and pack them into a single byte.
+ """
+
+ res = 0
+ for v in block:
+ res = (res << bitdepth) + v
+ return res
+
+ for row in rows:
+ a = bytearray(row)
+ # Adding padding bytes so we can group into a whole
+ # number of spb-tuples.
+ n = float(len(a))
+ extra = math.ceil(n / spb) * spb - n
+ a.extend([0] * int(extra))
+ # Pack into bytes.
+ # Each block is the samples for one byte.
+ blocks = group(a, spb)
+ yield bytearray(make_byte(block) for block in blocks)
+
+
+def unpack_rows(rows):
+ """Unpack each row from being 16-bits per value,
+ to being a sequence of bytes.
+ """
+ for row in rows:
+ fmt = f'!{len(row)}'
+ yield bytearray(struct.pack(fmt, *row))
+
+
+def make_palette_chunks(palette):
+ """
+ Create the byte sequences for a ``PLTE`` and
+ if necessary a ``tRNS`` chunk.
+ Returned as a pair (*p*, *t*).
+ *t* will be ``None`` if no ``tRNS`` chunk is necessary.
+ """
+
+ p = bytearray()
+ t = bytearray()
+
+ for x in palette:
+ p.extend(x[0:3])
+ if len(x) > 3:
+ t.append(x[3])
+ if t:
+ return p, t
+ return p, None
+
+
+def check_bitdepth_rescale(
+ palette, bitdepth, transparent, alpha, greyscale):
+ """
+ Returns (bitdepth, rescale) pair.
+ """
+
+ if palette:
+ if len(bitdepth) != 1:
+ raise ProtocolError(
+ "with palette, only a single bitdepth may be used")
+ (bitdepth, ) = bitdepth
+ if bitdepth not in (1, 2, 4, 8):
+ raise ProtocolError(
+ "with palette, bitdepth must be 1, 2, 4, or 8")
+ if transparent is not None:
+ raise ProtocolError("transparent and palette not compatible")
+ if alpha:
+ raise ProtocolError("alpha and palette not compatible")
+ if greyscale:
+ raise ProtocolError("greyscale and palette not compatible")
+ return bitdepth, None
+
+ # No palette, check for sBIT chunk generation.
+
+ if greyscale and not alpha:
+ # Single channel, L.
+ (bitdepth,) = bitdepth
+ if bitdepth in (1, 2, 4, 8, 16):
+ return bitdepth, None
+ if bitdepth > 8:
+ targetbitdepth = 16
+ elif bitdepth == 3:
+ targetbitdepth = 4
+ else:
+ assert bitdepth in (5, 6, 7)
+ targetbitdepth = 8
+ return targetbitdepth, [(bitdepth, targetbitdepth)]
+
+ assert alpha or not greyscale
+
+ depth_set = tuple(set(bitdepth))
+ if depth_set in [(8,), (16,)]:
+ # No sBIT required.
+ (bitdepth, ) = depth_set
+ return bitdepth, None
+
+ targetbitdepth = (8, 16)[max(bitdepth) > 8]
+ return targetbitdepth, [(b, targetbitdepth) for b in bitdepth]
+
+
+# Regex for decoding mode string
+RegexModeDecode = re.compile("(LA?|RGBA?);?([0-9]*)", flags=re.IGNORECASE)
+
+
+def from_array(a, mode=None, info={}):
+ """
+ Create a PNG :class:`Image` object from a 2-dimensional array.
+ One application of this function is easy PIL-style saving:
+ ``png.from_array(pixels, 'L').save('foo.png')``.
+
+ Unless they are specified using the *info* parameter,
+ the PNG's height and width are taken from the array size.
+ The first axis is the height; the second axis is the
+ ravelled width and channel index.
+ The array is treated is a sequence of rows,
+ each row being a sequence of values (``width*channels`` in number).
+ So an RGB image that is 16 pixels high and 8 wide will
+ occupy a 2-dimensional array that is 16x24
+ (each row will be 8*3 = 24 sample values).
+
+ *mode* is a string that specifies the image colour format in a
+ PIL-style mode. It can be:
+
+ ``'L'``
+ greyscale (1 channel)
+ ``'LA'``
+ greyscale with alpha (2 channel)
+ ``'RGB'``
+ colour image (3 channel)
+ ``'RGBA'``
+ colour image with alpha (4 channel)
+
+ The mode string can also specify the bit depth
+ (overriding how this function normally derives the bit depth,
+ see below).
+ Appending ``';16'`` to the mode will cause the PNG to be
+ 16 bits per channel;
+ any decimal from 1 to 16 can be used to specify the bit depth.
+
+ When a 2-dimensional array is used *mode* determines how many
+ channels the image has, and so allows the width to be derived from
+ the second array dimension.
+
+ The array is expected to be a ``numpy`` array,
+ but it can be any suitable Python sequence.
+ For example, a list of lists can be used:
+ ``png.from_array([[0, 255, 0], [255, 0, 255]], 'L')``.
+ The exact rules are: ``len(a)`` gives the first dimension, height;
+ ``len(a[0])`` gives the second dimension.
+ It's slightly more complicated than that because
+ an iterator of rows can be used, and it all still works.
+ Using an iterator allows data to be streamed efficiently.
+
+ The bit depth of the PNG is normally taken from
+ the array element's datatype
+ (but if *mode* specifies a bitdepth then that is used instead).
+ The array element's datatype is determined in a way which
+ is supposed to work both for ``numpy`` arrays and for Python
+ ``array.array`` objects.
+ A 1 byte datatype will give a bit depth of 8,
+ a 2 byte datatype will give a bit depth of 16.
+ If the datatype does not have an implicit size,
+ like the above example where it is a plain Python list of lists,
+ then a default of 8 is used.
+
+ The *info* parameter is a dictionary that can
+ be used to specify metadata (in the same style as
+ the arguments to the :class:`png.Writer` class).
+ For this function the keys that are useful are:
+
+ height
+ overrides the height derived from the array dimensions and
+ allows *a* to be an iterable.
+ width
+ overrides the width derived from the array dimensions.
+ bitdepth
+ overrides the bit depth derived from the element datatype
+ (but must match *mode* if that also specifies a bit depth).
+
+ Generally anything specified in the *info* dictionary will
+ override any implicit choices that this function would otherwise make,
+ but must match any explicit ones.
+ For example, if the *info* dictionary has a ``greyscale`` key then
+ this must be true when mode is ``'L'`` or ``'LA'`` and
+ false when mode is ``'RGB'`` or ``'RGBA'``.
+ """
+
+ # We abuse the *info* parameter by modifying it. Take a copy here.
+ # (Also typechecks *info* to some extent).
+ info = dict(info)
+
+ # Syntax check mode string.
+ match = RegexModeDecode.match(mode)
+ if not match:
+ raise Error("mode string should be 'RGB' or 'L;16' or similar.")
+
+ mode, bitdepth = match.groups()
+ if bitdepth:
+ bitdepth = int(bitdepth)
+
+ # Colour format.
+ if 'greyscale' in info:
+ if bool(info['greyscale']) != ('L' in mode):
+ raise ProtocolError("info['greyscale'] should match mode.")
+ info['greyscale'] = 'L' in mode
+
+ alpha = 'A' in mode
+ if 'alpha' in info:
+ if bool(info['alpha']) != alpha:
+ raise ProtocolError("info['alpha'] should match mode.")
+ info['alpha'] = alpha
+
+ # Get bitdepth from *mode* if possible.
+ if bitdepth:
+ if info.get("bitdepth") and bitdepth != info['bitdepth']:
+ raise ProtocolError(
+ f"bitdepth ({bitdepth}) should match bitdepth of info ({info[bitdepth]}).")
+ info['bitdepth'] = bitdepth
+
+ # Fill in and/or check entries in *info*.
+ # Dimensions.
+ width, height = check_sizes(
+ info.get("size"),
+ info.get("width"),
+ info.get("height"))
+ if width:
+ info["width"] = width
+ if height:
+ info["height"] = height
+
+ if "height" not in info:
+ try:
+ info['height'] = len(a)
+ except TypeError:
+ raise ProtocolError(
+ "len(a) does not work, supply info['height'] instead.")
+
+ planes = len(mode)
+ if 'planes' in info:
+ if info['planes'] != planes:
+ raise Error("info['planes'] should match mode.")
+
+ # In order to work out whether we the array is 2D or 3D we need its
+ # first row, which requires that we take a copy of its iterator.
+ # We may also need the first row to derive width and bitdepth.
+ a, t = itertools.tee(a)
+ row = next(t)
+ del t
+
+ testelement = row
+ if 'width' not in info:
+ width = len(row) // planes
+ info['width'] = width
+
+ if 'bitdepth' not in info:
+ try:
+ dtype = testelement.dtype
+ # goto the "else:" clause. Sorry.
+ except AttributeError:
+ try:
+ # Try a Python array.array.
+ bitdepth = 8 * testelement.itemsize
+ except AttributeError:
+ # We can't determine it from the array element's datatype,
+ # use a default of 8.
+ bitdepth = 8
+ else:
+ # If we got here without exception,
+ # we now assume that the array is a numpy array.
+ if dtype.kind == 'b':
+ bitdepth = 1
+ else:
+ bitdepth = 8 * dtype.itemsize
+ info['bitdepth'] = bitdepth
+
+ for thing in ["width", "height", "bitdepth", "greyscale", "alpha"]:
+ assert thing in info
+
+ return Image(a, info)
+
+
+# So that refugee's from PIL feel more at home. Not documented.
+fromarray = from_array
+
+
+class Image:
+ """A PNG image. You can create an :class:`Image` object from
+ an array of pixels by calling :meth:`png.from_array`. It can be
+ saved to disk with the :meth:`save` method.
+ """
+
+ def __init__(self, rows, info):
+ """
+ .. note ::
+
+ The constructor is not public. Please do not call it.
+ """
+
+ self.rows = rows
+ self.info = info
+
+ def save(self, file):
+ """Save the image to the named *file*.
+
+ See `.write()` if you already have an open file object.
+
+ In general, you can only call this method once;
+ after it has been called the first time the PNG image is written,
+ the source data will have been streamed, and
+ cannot be streamed again.
+ """
+
+ w = Writer(**self.info)
+
+ with open(file, 'wb') as fd:
+ w.write(fd, self.rows)
+
+ def write(self, file):
+ """Write the image to the open file object.
+
+ See `.save()` if you have a filename.
+
+ In general, you can only call this method once;
+ after it has been called the first time the PNG image is written,
+ the source data will have been streamed, and
+ cannot be streamed again.
+ """
+
+ w = Writer(**self.info)
+ w.write(file, self.rows)
+
+
+class Reader:
+ """
+ Pure Python PNG decoder in pure Python.
+ """
+
+ def __init__(self, _guess=None, filename=None, file=None, bytes=None):
+ """
+ The constructor expects exactly one keyword argument.
+ If you supply a positional argument instead,
+ it will guess the input type.
+ Choose from the following keyword arguments:
+
+ filename
+ Name of input file (a PNG file).
+ file
+ A file-like object (object with a read() method).
+ bytes
+ ``bytes`` or ``bytearray`` with PNG data.
+
+ """
+ keywords_supplied = (
+ (_guess is not None) +
+ (filename is not None) +
+ (file is not None) +
+ (bytes is not None))
+ if keywords_supplied != 1:
+ raise TypeError("Reader() takes exactly 1 argument")
+
+ # Will be the first 8 bytes, later on. See validate_signature.
+ self.signature = None
+ self.transparent = None
+ # A pair of (len,type) if a chunk has been read but its data and
+ # checksum have not (in other words the file position is just
+ # past the 4 bytes that specify the chunk type).
+ # See preamble method for how this is used.
+ self.atchunk = None
+
+ if _guess is not None:
+ if isarray(_guess):
+ bytes = _guess
+ elif isinstance(_guess, str):
+ filename = _guess
+ elif hasattr(_guess, 'read'):
+ file = _guess
+
+ if bytes is not None:
+ self.file = io.BytesIO(bytes)
+ elif filename is not None:
+ self.file = open(filename, "rb")
+ elif file is not None:
+ self.file = file
+ else:
+ raise ProtocolError("expecting filename, file or bytes array")
+
+ def chunk(self, lenient=False):
+ """
+ Read the next PNG chunk from the input file;
+ returns a (*type*, *data*) tuple.
+ *type* is the chunk's type as a byte string
+ (all PNG chunk types are 4 bytes long).
+ *data* is the chunk's data content, as a byte string.
+
+ If the optional `lenient` argument evaluates to `True`,
+ checksum failures will raise warnings rather than exceptions.
+ """
+
+ self.validate_signature()
+
+ # http://www.w3.org/TR/PNG/#5Chunk-layout
+ if not self.atchunk:
+ self.atchunk = self._chunk_len_type()
+ if not self.atchunk:
+ raise ChunkError("No more chunks.")
+ length, type = self.atchunk
+ self.atchunk = None
+
+ data = self.file.read(length)
+ if len(data) != length:
+ raise ChunkError(
+ f'Chunk {type} too short for required {length} octets.')
+ checksum = self.file.read(4)
+ if len(checksum) != 4:
+ raise ChunkError(f'Chunk {type} too short for checksum.')
+ verify = zlib.crc32(type)
+ verify = zlib.crc32(data, verify)
+ verify = struct.pack('!I', verify)
+ if checksum != verify:
+ (a, ) = struct.unpack('!I', checksum)
+ (b, ) = struct.unpack('!I', verify)
+ message = f"Checksum error in {type.decode('ascii')} chunk: 0x{a:08X} != 0x{b:08X}."
+ if lenient:
+ warnings.warn(message, RuntimeWarning)
+ else:
+ raise ChunkError(message)
+ return type, data
+
+ def chunks(self):
+ """Return an iterator that will yield each chunk as a
+ (*chunktype*, *content*) pair.
+ """
+
+ while True:
+ t, v = self.chunk()
+ yield t, v
+ if t == b'IEND':
+ break
+
+ def undo_filter(self, filter_type, scanline, previous):
+ """
+ Undo the filter for a scanline.
+ `scanline` is a sequence of bytes that
+ does not include the initial filter type byte.
+ `previous` is decoded previous scanline
+ (for straightlaced images this is the previous pixel row,
+ but for interlaced images, it is
+ the previous scanline in the reduced image,
+ which in general is not the previous pixel row in the final image).
+ When there is no previous scanline
+ (the first row of a straightlaced image,
+ or the first row in one of the passes in an interlaced image),
+ then this argument should be ``None``.
+
+ The scanline will have the effects of filtering removed;
+ the result will be returned as a fresh sequence of bytes.
+ """
+
+ # :todo: Would it be better to update scanline in place?
+ result = scanline
+
+ if filter_type == 0:
+ return result
+
+ if filter_type not in (1, 2, 3, 4):
+ raise FormatError(
+ 'Invalid PNG Filter Type. '
+ 'See http://www.w3.org/TR/2003/REC-PNG-20031110/#9Filters .')
+
+ # Filter unit. The stride from one pixel to the corresponding
+ # byte from the previous pixel. Normally this is the pixel
+ # size in bytes, but when this is smaller than 1, the previous
+ # byte is used instead.
+ fu = max(1, self.psize)
+
+ # For the first line of a pass, synthesize a dummy previous
+ # line. An alternative approach would be to observe that on the
+ # first line 'up' is the same as 'null', 'paeth' is the same
+ # as 'sub', with only 'average' requiring any special case.
+ if not previous:
+ previous = bytearray([0] * len(scanline))
+
+ # Call appropriate filter algorithm. Note that 0 has already
+ # been dealt with.
+ fn = (None,
+ undo_filter_sub,
+ undo_filter_up,
+ undo_filter_average,
+ undo_filter_paeth)[filter_type]
+ fn(fu, scanline, previous, result)
+ return result
+
+ def _deinterlace(self, raw):
+ """
+ Read raw pixel data, undo filters, deinterlace, and flatten.
+ Return a single array of values.
+ """
+
+ # Values per row (of the target image)
+ vpr = self.width * self.planes
+
+ # Values per image
+ vpi = vpr * self.height
+ # Interleaving writes to the output array randomly
+ # (well, not quite), so the entire output array must be in memory.
+ # Make a result array, and make it big enough.
+ if self.bitdepth > 8:
+ a = array('H', [0] * vpi)
+ else:
+ a = bytearray([0] * vpi)
+ source_offset = 0
+
+ for lines in adam7_generate(self.width, self.height):
+ # The previous (reconstructed) scanline.
+ # `None` at the beginning of a pass
+ # to indicate that there is no previous line.
+ recon = None
+ for x, y, xstep in lines:
+ # Pixels per row (reduced pass image)
+ ppr = int(math.ceil((self.width - x) / float(xstep)))
+ # Row size in bytes for this pass.
+ row_size = int(math.ceil(self.psize * ppr))
+
+ filter_type = raw[source_offset]
+ source_offset += 1
+ scanline = raw[source_offset: source_offset + row_size]
+ source_offset += row_size
+ recon = self.undo_filter(filter_type, scanline, recon)
+ # Convert so that there is one element per pixel value
+ flat = self._bytes_to_values(recon, width=ppr)
+ if xstep == 1:
+ assert x == 0
+ offset = y * vpr
+ a[offset: offset + vpr] = flat
+ else:
+ offset = y * vpr + x * self.planes
+ end_offset = (y + 1) * vpr
+ skip = self.planes * xstep
+ for i in range(self.planes):
+ a[offset + i: end_offset: skip] = \
+ flat[i:: self.planes]
+
+ return a
+
+ def _iter_bytes_to_values(self, byte_rows):
+ """
+ Iterator that yields each scanline;
+ each scanline being a sequence of values.
+ `byte_rows` should be an iterator that yields
+ the bytes of each row in turn.
+ """
+
+ for row in byte_rows:
+ yield self._bytes_to_values(row)
+
+ def _bytes_to_values(self, bs, width=None):
+ """Convert a packed row of bytes into a row of values.
+ Result will be a freshly allocated object,
+ not shared with the argument.
+ """
+
+ if self.bitdepth == 8:
+ return bytearray(bs)
+ if self.bitdepth == 16:
+ return array('H',
+ struct.unpack(f'!{(len(bs) // 2)}H' , bs))
+
+ assert self.bitdepth < 8
+ if width is None:
+ width = self.width
+ # Samples per byte
+ spb = 8 // self.bitdepth
+ out = bytearray()
+ mask = 2**self.bitdepth - 1
+ shifts = [self.bitdepth * i
+ for i in reversed(list(range(spb)))]
+ for o in bs:
+ out.extend([mask & (o >> i) for i in shifts])
+ return out[:width]
+
+ def _iter_straight_packed(self, byte_blocks):
+ """Iterator that undoes the effect of filtering;
+ yields each row as a sequence of packed bytes.
+ Assumes input is straightlaced.
+ `byte_blocks` should be an iterable that yields the raw bytes
+ in blocks of arbitrary size.
+ """
+
+ # length of row, in bytes
+ rb = self.row_bytes
+ a = bytearray()
+ # The previous (reconstructed) scanline.
+ # None indicates first line of image.
+ recon = None
+ for some_bytes in byte_blocks:
+ a.extend(some_bytes)
+ while len(a) >= rb + 1:
+ filter_type = a[0]
+ scanline = a[1: rb + 1]
+ del a[: rb + 1]
+ recon = self.undo_filter(filter_type, scanline, recon)
+ yield recon
+ if len(a) != 0:
+ # :file:format We get here with a file format error:
+ # when the available bytes (after decompressing) do not
+ # pack into exact rows.
+ raise FormatError('Wrong size for decompressed IDAT chunk.')
+ assert len(a) == 0
+
+ def validate_signature(self):
+ """
+ If signature (header) has not been read then read and
+ validate it; otherwise do nothing.
+ """
+
+ if self.signature:
+ return
+ self.signature = self.file.read(8)
+ if self.signature != signature:
+ raise FormatError("PNG file has invalid signature.")
+
+ def preamble(self, lenient=False):
+ """
+ Extract the image metadata by reading
+ the initial part of the PNG file up to
+ the start of the ``IDAT`` chunk.
+ All the chunks that precede the ``IDAT`` chunk are
+ read and either processed for metadata or discarded.
+
+ If the optional `lenient` argument evaluates to `True`,
+ checksum failures will raise warnings rather than exceptions.
+ """
+
+ self.validate_signature()
+
+ while True:
+ if not self.atchunk:
+ self.atchunk = self._chunk_len_type()
+ if self.atchunk is None:
+ raise FormatError('This PNG file has no IDAT chunks.')
+ if self.atchunk[1] == b'IDAT':
+ return
+ self.process_chunk(lenient=lenient)
+
+ def _chunk_len_type(self):
+ """
+ Reads just enough of the input to
+ determine the next chunk's length and type;
+ return a (*length*, *type*) pair where *type* is a byte sequence.
+ If there are no more chunks, ``None`` is returned.
+ """
+
+ x = self.file.read(8)
+ if not x:
+ return None
+ if len(x) != 8:
+ raise FormatError(
+ 'End of file whilst reading chunk length and type.')
+ length, type = struct.unpack('!I4s', x)
+ if length > 2 ** 31 - 1:
+ raise FormatError(f'Chunk {type} is too large: {length}.')
+ # Check that all bytes are in valid ASCII range.
+ # https://www.w3.org/TR/2003/REC-PNG-20031110/#5Chunk-layout
+ type_bytes = set(bytearray(type))
+ if not(type_bytes <= set(range(65, 91)) | set(range(97, 123))):
+ raise FormatError(
+ f'Chunk {list(type)} has invalid Chunk Type.')
+ return length, type
+
+ def process_chunk(self, lenient=False):
+ """
+ Process the next chunk and its data.
+ This only processes the following chunk types:
+ ``IHDR``, ``PLTE``, ``bKGD``, ``tRNS``, ``gAMA``, ``sBIT``, ``pHYs``.
+ All other chunk types are ignored.
+
+ If the optional `lenient` argument evaluates to `True`,
+ checksum failures will raise warnings rather than exceptions.
+ """
+
+ type, data = self.chunk(lenient=lenient)
+ method = '_process_' + type.decode('ascii')
+ m = getattr(self, method, None)
+ if m:
+ m(data)
+
+ def _process_IHDR(self, data):
+ # http://www.w3.org/TR/PNG/#11IHDR
+ if len(data) != 13:
+ raise FormatError('IHDR chunk has incorrect length.')
+ (self.width, self.height, self.bitdepth, self.color_type,
+ self.compression, self.filter,
+ self.interlace) = struct.unpack("!2I5B", data)
+
+ check_bitdepth_colortype(self.bitdepth, self.color_type)
+
+ if self.compression != 0:
+ raise FormatError(
+ f"Unknown compression method {self.compression}")
+ if self.filter != 0:
+ raise FormatError(
+ f"Unknown filter method {self.filter},"
+ " see http://www.w3.org/TR/2003/REC-PNG-20031110/#9Filters ."
+ )
+ if self.interlace not in (0, 1):
+ raise FormatError(
+ f"Unknown interlace method {self.interlace}, see "
+ "http://www.w3.org/TR/2003/REC-PNG-20031110/#8InterlaceMethods"
+ " .")
+
+ # Derived values
+ # http://www.w3.org/TR/PNG/#6Colour-values
+ colormap = bool(self.color_type & 1)
+ greyscale = not(self.color_type & 2)
+ alpha = bool(self.color_type & 4)
+ color_planes = (3, 1)[greyscale or colormap]
+ planes = color_planes + alpha
+
+ self.colormap = colormap
+ self.greyscale = greyscale
+ self.alpha = alpha
+ self.color_planes = color_planes
+ self.planes = planes
+ self.psize = float(self.bitdepth) / float(8) * planes
+ if int(self.psize) == self.psize:
+ self.psize = int(self.psize)
+ self.row_bytes = int(math.ceil(self.width * self.psize))
+ # Stores PLTE chunk if present, and is used to check
+ # chunk ordering constraints.
+ self.plte = None
+ # Stores tRNS chunk if present, and is used to check chunk
+ # ordering constraints.
+ self.trns = None
+ # Stores sBIT chunk if present.
+ self.sbit = None
+
+ def _process_PLTE(self, data):
+ # http://www.w3.org/TR/PNG/#11PLTE
+ if self.plte:
+ warnings.warn("Multiple PLTE chunks present.")
+ self.plte = data
+ if len(data) % 3 != 0:
+ raise FormatError(
+ "PLTE chunk's length should be a multiple of 3.")
+ if len(data) > (2 ** self.bitdepth) * 3:
+ raise FormatError("PLTE chunk is too long.")
+ if len(data) == 0:
+ raise FormatError("Empty PLTE is not allowed.")
+
+ def _process_bKGD(self, data):
+ try:
+ if self.colormap:
+ if not self.plte:
+ warnings.warn(
+ "PLTE chunk is required before bKGD chunk.")
+ self.background = struct.unpack('B', data)
+ else:
+ self.background = struct.unpack(f"!{self.color_planes}",
+ data)
+ except struct.error:
+ raise FormatError("bKGD chunk has incorrect length.")
+
+ def _process_tRNS(self, data):
+ # http://www.w3.org/TR/PNG/#11tRNS
+ self.trns = data
+ if self.colormap:
+ if not self.plte:
+ warnings.warn("PLTE chunk is required before tRNS chunk.")
+ else:
+ if len(data) > len(self.plte) / 3:
+ # Was warning, but promoted to Error as it
+ # would otherwise cause pain later on.
+ raise FormatError("tRNS chunk is too long.")
+ else:
+ if self.alpha:
+ raise FormatError(
+ f"tRNS chunk is not valid with colour type {self.color_type}.")
+ try:
+ self.transparent = \
+ struct.unpack(f"!{self.color_planes}", data)
+ except struct.error:
+ raise FormatError("tRNS chunk has incorrect length.")
+
+ def _process_gAMA(self, data):
+ try:
+ self.gamma = struct.unpack("!L", data)[0] / 100000.0
+ except struct.error:
+ raise FormatError("gAMA chunk has incorrect length.")
+
+ def _process_sBIT(self, data):
+ self.sbit = data
+ if (self.colormap and len(data) != 3 or
+ not self.colormap and len(data) != self.planes):
+ raise FormatError("sBIT chunk has incorrect length.")
+
+ def _process_pHYs(self, data):
+ # http://www.w3.org/TR/PNG/#11pHYs
+ self.phys = data
+ fmt = "!LLB"
+ if len(data) != struct.calcsize(fmt):
+ raise FormatError("pHYs chunk has incorrect length.")
+ self.x_pixels_per_unit, self.y_pixels_per_unit, unit = \
+ struct.unpack(fmt, data)
+ self.unit_is_meter = bool(unit)
+
+ def read(self, lenient=False):
+ """
+ Read the PNG file and decode it.
+ Returns (`width`, `height`, `rows`, `info`).
+
+ May use excessive memory.
+
+ `rows` is a sequence of rows;
+ each row is a sequence of values.
+
+ If the optional `lenient` argument evaluates to True,
+ checksum failures will raise warnings rather than exceptions.
+ """
+
+ def iteridat():
+ """Iterator that yields all the ``IDAT`` chunks as strings."""
+ while True:
+ type, data = self.chunk(lenient=lenient)
+ if type == b'IEND':
+ # http://www.w3.org/TR/PNG/#11IEND
+ break
+ if type != b'IDAT':
+ continue
+ # type == b'IDAT'
+ # http://www.w3.org/TR/PNG/#11IDAT
+ if self.colormap and not self.plte:
+ warnings.warn("PLTE chunk is required before IDAT chunk")
+ yield data
+
+ self.preamble(lenient=lenient)
+ raw = decompress(iteridat())
+
+ if self.interlace:
+ def rows_from_interlace():
+ """Yield each row from an interlaced PNG."""
+ # It's important that this iterator doesn't read
+ # IDAT chunks until it yields the first row.
+ bs = bytearray(itertools.chain(*raw))
+ arraycode = 'BH'[self.bitdepth > 8]
+ # Like :meth:`group` but
+ # producing an array.array object for each row.
+ values = self._deinterlace(bs)
+ vpr = self.width * self.planes
+ for i in range(0, len(values), vpr):
+ row = array(arraycode, values[i:i+vpr])
+ yield row
+ rows = rows_from_interlace()
+ else:
+ rows = self._iter_bytes_to_values(self._iter_straight_packed(raw))
+ info = dict()
+ for attr in 'greyscale alpha planes bitdepth interlace'.split():
+ info[attr] = getattr(self, attr)
+ info['size'] = (self.width, self.height)
+ for attr in 'gamma transparent background'.split():
+ a = getattr(self, attr, None)
+ if a is not None:
+ info[attr] = a
+ if getattr(self, 'x_pixels_per_unit', None):
+ info['physical'] = Resolution(self.x_pixels_per_unit,
+ self.y_pixels_per_unit,
+ self.unit_is_meter)
+ if self.plte:
+ info['palette'] = self.palette()
+ return self.width, self.height, rows, info
+
+ def read_flat(self):
+ """
+ Read a PNG file and decode it into a single array of values.
+ Returns (*width*, *height*, *values*, *info*).
+
+ May use excessive memory.
+
+ `values` is a single array.
+
+ The :meth:`read` method is more stream-friendly than this,
+ because it returns a sequence of rows.
+ """
+
+ x, y, pixel, info = self.read()
+ arraycode = 'BH'[info['bitdepth'] > 8]
+ pixel = array(arraycode, itertools.chain(*pixel))
+ return x, y, pixel, info
+
+ def palette(self, alpha='natural'):
+ """
+ Returns a palette that is a sequence of 3-tuples or 4-tuples,
+ synthesizing it from the ``PLTE`` and ``tRNS`` chunks.
+ These chunks should have already been processed (for example,
+ by calling the :meth:`preamble` method).
+ All the tuples are the same size:
+ 3-tuples if there is no ``tRNS`` chunk,
+ 4-tuples when there is a ``tRNS`` chunk.
+
+ Assumes that the image is colour type
+ 3 and therefore a ``PLTE`` chunk is required.
+
+ If the `alpha` argument is ``'force'`` then an alpha channel is
+ always added, forcing the result to be a sequence of 4-tuples.
+ """
+
+ if not self.plte:
+ raise FormatError(
+ "Required PLTE chunk is missing in colour type 3 image.")
+ plte = group(array('B', self.plte), 3)
+ if self.trns or alpha == 'force':
+ trns = array('B', self.trns or [])
+ trns.extend([255] * (len(plte) - len(trns)))
+ plte = list(map(operator.add, plte, group(trns, 1)))
+ return plte
+
+ def asDirect(self):
+ """
+ Returns the image data as a direct representation of
+ an ``x * y * planes`` array.
+ This removes the need for callers to deal with
+ palettes and transparency themselves.
+ Images with a palette (colour type 3) are converted to RGB or RGBA;
+ images with transparency (a ``tRNS`` chunk) are converted to
+ LA or RGBA as appropriate.
+ When returned in this format the pixel values represent
+ the colour value directly without needing to refer
+ to palettes or transparency information.
+
+ Like the :meth:`read` method this method returns a 4-tuple:
+
+ (*width*, *height*, *rows*, *info*)
+
+ This method normally returns pixel values with
+ the bit depth they have in the source image, but
+ when the source PNG has an ``sBIT`` chunk it is inspected and
+ can reduce the bit depth of the result pixels;
+ pixel values will be reduced according to the bit depth
+ specified in the ``sBIT`` chunk.
+ PNG nerds should note a single result bit depth is
+ used for all channels:
+ the maximum of the ones specified in the ``sBIT`` chunk.
+ An RGB565 image will be rescaled to 6-bit RGB666.
+
+ The *info* dictionary that is returned reflects
+ the `direct` format and not the original source image.
+ For example, an RGB source image with a ``tRNS`` chunk
+ to represent a transparent colour,
+ will start with ``planes=3`` and ``alpha=False`` for the
+ source image,
+ but the *info* dictionary returned by this method
+ will have ``planes=4`` and ``alpha=True`` because
+ an alpha channel is synthesized and added.
+
+ *rows* is a sequence of rows;
+ each row being a sequence of values
+ (like the :meth:`read` method).
+
+ All the other aspects of the image data are not changed.
+ """
+
+ self.preamble()
+
+ # Simple case, no conversion necessary.
+ if not self.colormap and not self.trns and not self.sbit:
+ return self.read()
+
+ x, y, pixels, info = self.read()
+
+ if self.colormap:
+ info['colormap'] = False
+ info['alpha'] = bool(self.trns)
+ info['bitdepth'] = 8
+ info['planes'] = 3 + bool(self.trns)
+ plte = self.palette()
+
+ def iterpal(pixels):
+ for row in pixels:
+ row = [plte[x] for x in row]
+ yield array('B', itertools.chain(*row))
+ pixels = iterpal(pixels)
+ elif self.trns:
+ # It would be nice if there was some reasonable way
+ # of doing this without generating a whole load of
+ # intermediate tuples. But tuples does seem like the
+ # easiest way, with no other way clearly much simpler or
+ # much faster. (Actually, the L to LA conversion could
+ # perhaps go faster (all those 1-tuples!), but I still
+ # wonder whether the code proliferation is worth it)
+ it = self.transparent
+ maxval = 2 ** info['bitdepth'] - 1
+ planes = info['planes']
+ info['alpha'] = True
+ info['planes'] += 1
+ typecode = 'BH'[info['bitdepth'] > 8]
+
+ def itertrns(pixels):
+ for row in pixels:
+ # For each row we group it into pixels, then form a
+ # characterisation vector that says whether each
+ # pixel is opaque or not. Then we convert
+ # True/False to 0/maxval (by multiplication),
+ # and add it as the extra channel.
+ row = group(row, planes)
+ opa = map(it.__ne__, row)
+ opa = map(maxval.__mul__, opa)
+ opa = list(zip(opa)) # convert to 1-tuples
+ yield array(
+ typecode,
+ itertools.chain(*map(operator.add, row, opa)))
+ pixels = itertrns(pixels)
+ targetbitdepth = None
+ if self.sbit:
+ sbit = struct.unpack(f'{len(self.sbit)}', self.sbit)
+ targetbitdepth = max(sbit)
+ if targetbitdepth > info['bitdepth']:
+ raise Error(f'sBIT chunk {sbit!r} exceeds bitdepth {self.bitdepth}')
+ if min(sbit) <= 0:
+ raise Error(f'sBIT chunk {sbit} has a 0-entry')
+ if targetbitdepth:
+ shift = info['bitdepth'] - targetbitdepth
+ info['bitdepth'] = targetbitdepth
+
+ def itershift(pixels):
+ for row in pixels:
+ yield [p >> shift for p in row]
+ pixels = itershift(pixels)
+ return x, y, pixels, info
+
+ def _as_rescale(self, get, targetbitdepth):
+ """Helper used by :meth:`asRGB8` and :meth:`asRGBA8`."""
+
+ width, height, pixels, info = get()
+ maxval = 2**info['bitdepth'] - 1
+ targetmaxval = 2**targetbitdepth - 1
+ factor = float(targetmaxval) / float(maxval)
+ info['bitdepth'] = targetbitdepth
+
+ def iterscale():
+ for row in pixels:
+ yield [int(round(x * factor)) for x in row]
+ if maxval == targetmaxval:
+ return width, height, pixels, info
+ else:
+ return width, height, iterscale(), info
+
+ def asRGB8(self):
+ """
+ Return the image data as an RGB pixels with 8-bits per sample.
+ This is like the :meth:`asRGB` method except that
+ this method additionally rescales the values so that
+ they are all between 0 and 255 (8-bit).
+ In the case where the source image has a bit depth < 8
+ the transformation preserves all the information;
+ where the source image has bit depth > 8, then
+ rescaling to 8-bit values loses precision.
+ No dithering is performed.
+ Like :meth:`asRGB`,
+ an alpha channel in the source image will raise an exception.
+
+ This function returns a 4-tuple:
+ (*width*, *height*, *rows*, *info*).
+ *width*, *height*, *info* are as per the :meth:`read` method.
+
+ *rows* is the pixel data as a sequence of rows.
+ """
+
+ return self._as_rescale(self.asRGB, 8)
+
+ def asRGBA8(self):
+ """
+ Return the image data as RGBA pixels with 8-bits per sample.
+ This method is similar to :meth:`asRGB8` and :meth:`asRGBA`:
+ The result pixels have an alpha channel, *and*
+ values are rescaled to the range 0 to 255.
+ The alpha channel is synthesized if necessary
+ (with a small speed penalty).
+ """
+
+ return self._as_rescale(self.asRGBA, 8)
+
+ def asRGB(self):
+ """
+ Return image as RGB pixels.
+ RGB colour images are passed through unchanged;
+ greyscales are expanded into RGB triplets
+ (there is a small speed overhead for doing this).
+
+ An alpha channel in the source image will raise an exception.
+
+ The return values are as for the :meth:`read` method except that
+ the *info* reflect the returned pixels, not the source image.
+ In particular,
+ for this method ``info['greyscale']`` will be ``False``.
+ """
+
+ width, height, pixels, info = self.asDirect()
+ if info['alpha']:
+ raise Error("will not convert image with alpha channel to RGB")
+ if not info['greyscale']:
+ return width, height, pixels, info
+ info['greyscale'] = False
+ info['planes'] = 3
+
+ if info['bitdepth'] > 8:
+ def newarray():
+ return array('H', [0])
+ else:
+ def newarray():
+ return bytearray([0])
+
+ def iterrgb():
+ for row in pixels:
+ a = newarray() * 3 * width
+ for i in range(3):
+ a[i::3] = row
+ yield a
+ return width, height, iterrgb(), info
+
+ def asRGBA(self):
+ """
+ Return image as RGBA pixels.
+ Greyscales are expanded into RGB triplets;
+ an alpha channel is synthesized if necessary.
+ The return values are as for the :meth:`read` method except that
+ the *info* reflect the returned pixels, not the source image.
+ In particular, for this method
+ ``info['greyscale']`` will be ``False``, and
+ ``info['alpha']`` will be ``True``.
+ """
+
+ width, height, pixels, info = self.asDirect()
+ if info['alpha'] and not info['greyscale']:
+ return width, height, pixels, info
+ typecode = 'BH'[info['bitdepth'] > 8]
+ maxval = 2**info['bitdepth'] - 1
+ maxbuffer = struct.pack('=' + typecode, maxval) * 4 * width
+
+ if info['bitdepth'] > 8:
+ def newarray():
+ return array('H', maxbuffer)
+ else:
+ def newarray():
+ return bytearray(maxbuffer)
+
+ if info['alpha'] and info['greyscale']:
+ # LA to RGBA
+ def convert():
+ for row in pixels:
+ # Create a fresh target row, then copy L channel
+ # into first three target channels, and A channel
+ # into fourth channel.
+ a = newarray()
+ convert_la_to_rgba(row, a)
+ yield a
+ elif info['greyscale']:
+ # L to RGBA
+ def convert():
+ for row in pixels:
+ a = newarray()
+ convert_l_to_rgba(row, a)
+ yield a
+ else:
+ assert not info['alpha'] and not info['greyscale']
+ # RGB to RGBA
+
+ def convert():
+ for row in pixels:
+ a = newarray()
+ convert_rgb_to_rgba(row, a)
+ yield a
+ info['alpha'] = True
+ info['greyscale'] = False
+ info['planes'] = 4
+ return width, height, convert(), info
+
+
+def decompress(data_blocks):
+ """
+ `data_blocks` should be an iterable that
+ yields the compressed data (from the ``IDAT`` chunks).
+ This yields decompressed byte strings.
+ """
+
+ # Currently, with no max_length parameter to decompress,
+ # this routine will do one yield per IDAT chunk: Not very
+ # incremental.
+ d = zlib.decompressobj()
+ # Each IDAT chunk is passed to the decompressor, then any
+ # remaining state is decompressed out.
+ for data in data_blocks:
+ # :todo: add a max_length argument here to limit output size.
+ yield bytearray(d.decompress(data))
+ yield bytearray(d.flush())
+
+
+def check_bitdepth_colortype(bitdepth, colortype):
+ """
+ Check that `bitdepth` and `colortype` are both valid,
+ and specified in a valid combination.
+ Returns (None) if valid, raise an Exception if not valid.
+ """
+
+ if bitdepth not in (1, 2, 4, 8, 16):
+ raise FormatError(f"invalid bit depth {bitdepth}")
+ if colortype not in (0, 2, 3, 4, 6):
+ raise FormatError(f"invalid colour type {colortype}")
+ # Check indexed (palettized) images have 8 or fewer bits
+ # per pixel; check only indexed or greyscale images have
+ # fewer than 8 bits per pixel.
+ if colortype & 1 and bitdepth > 8:
+ raise FormatError(
+ f"Indexed images (colour type {bitdepth}) cannot"
+ f" have bitdepth > 8 (bit depth {colortype})."
+ " See http://www.w3.org/TR/2003/REC-PNG-20031110/#table111 ."
+ )
+ if bitdepth < 8 and colortype not in (0, 3):
+ raise FormatError(
+ f"Illegal combination of bit depth ({bitdepth})"
+ f" and colour type ({colortype})."
+ " See http://www.w3.org/TR/2003/REC-PNG-20031110/#table111 .")
+
+
+def is_natural(x):
+ """A non-negative integer."""
+ try:
+ is_integer = int(x) == x
+ except (TypeError, ValueError):
+ return False
+ return is_integer and x >= 0
+
+
+def undo_filter_sub(filter_unit, scanline, previous, result):
+ """Undo sub filter."""
+
+ ai = 0
+ # Loops starts at index fu. Observe that the initial part
+ # of the result is already filled in correctly with
+ # scanline.
+ for i in range(filter_unit, len(result)):
+ x = scanline[i]
+ a = result[ai]
+ result[i] = (x + a) & 0xff
+ ai += 1
+
+
+def undo_filter_up(filter_unit, scanline, previous, result):
+ """Undo up filter."""
+
+ for i in range(len(result)):
+ x = scanline[i]
+ b = previous[i]
+ result[i] = (x + b) & 0xff
+
+
+def undo_filter_average(filter_unit, scanline, previous, result):
+ """Undo up filter."""
+
+ ai = -filter_unit
+ for i in range(len(result)):
+ x = scanline[i]
+ if ai < 0:
+ a = 0
+ else:
+ a = result[ai]
+ b = previous[i]
+ result[i] = (x + ((a + b) >> 1)) & 0xff
+ ai += 1
+
+
+def undo_filter_paeth(filter_unit, scanline, previous, result):
+ """Undo Paeth filter."""
+
+ # Also used for ci.
+ ai = -filter_unit
+ for i in range(len(result)):
+ x = scanline[i]
+ if ai < 0:
+ a = c = 0
+ else:
+ a = result[ai]
+ c = previous[ai]
+ b = previous[i]
+ p = a + b - c
+ pa = abs(p - a)
+ pb = abs(p - b)
+ pc = abs(p - c)
+ if pa <= pb and pa <= pc:
+ pr = a
+ elif pb <= pc:
+ pr = b
+ else:
+ pr = c
+ result[i] = (x + pr) & 0xff
+ ai += 1
+
+
+def convert_la_to_rgba(row, result):
+ for i in range(3):
+ result[i::4] = row[0::2]
+ result[3::4] = row[1::2]
+
+
+def convert_l_to_rgba(row, result):
+ """
+ Convert a grayscale image to RGBA.
+ This method assumes the alpha channel in result is
+ already correctly initialized.
+ """
+ for i in range(3):
+ result[i::4] = row
+
+
+def convert_rgb_to_rgba(row, result):
+ """
+ Convert an RGB image to RGBA.
+ This method assumes the alpha channel in result is
+ already correctly initialized.
+ """
+ for i in range(3):
+ result[i::4] = row[i::3]
+
+
+# Only reason to include this in this module is that
+# several utilities need it, and it is small.
+def binary_stdin():
+ """
+ A sys.stdin that returns bytes.
+ """
+
+ return sys.stdin.buffer
+
+
+def binary_stdout():
+ """
+ A sys.stdout that accepts bytes.
+ """
+
+ stdout = sys.stdout.buffer
+
+ # On Windows the C runtime file orientation needs changing.
+ if sys.platform == "win32":
+ import msvcrt
+ import os
+ msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+
+ return stdout
+
+
+def cli_open(path):
+ if path == "-":
+ return binary_stdin()
+ return open(path, "rb")
+
+
+def main(argv):
+ """
+ Run command line PNG.
+ """
+ print("What should the command line tool do?", file=sys.stderr)
+
+
+if __name__ == '__main__':
+ try:
+ main(sys.argv)
+ except Error as e:
+ print(e, file=sys.stderr)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..78d7f002536cec3cd23c449b01cd70ac93068d6c
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/__init__.py
@@ -0,0 +1,178 @@
+"""Load fonts.
+
+pyglet will automatically load any system-installed fonts. You can add additional fonts
+(for example, from your program resources) using :meth:`add_file` or
+:meth:`add_directory`. These fonts are then available in the same way as system-installed fonts::
+
+ from pyglet import font
+ font.add_file('action_man.ttf')
+ action_man = font.load('Action Man', 16)
+ # or
+ from pyglet import resource
+ resource.add_font('action_man.ttf')
+ action_man = font.load('Action Man')
+
+See the :mod:`pyglet.font.base` module for documentation on the base classes used
+by this package.
+"""
+
+import os
+import sys
+import weakref
+
+import pyglet
+from pyglet import gl
+
+
+if not getattr(sys, 'is_pyglet_doc_run', False):
+ if pyglet.compat_platform == 'darwin':
+ from pyglet.font.quartz import QuartzFont
+ _font_class = QuartzFont
+
+ elif pyglet.compat_platform in ('win32', 'cygwin'):
+ from pyglet.libs.win32.constants import WINDOWS_7_OR_GREATER
+ if WINDOWS_7_OR_GREATER and not pyglet.options['win32_gdi_font']:
+ from pyglet.font.directwrite import Win32DirectWriteFont
+ _font_class = Win32DirectWriteFont
+ else:
+ from pyglet.font.win32 import GDIPlusFont
+ _font_class = GDIPlusFont
+
+ else:
+ from pyglet.font.freetype import FreeTypeFont
+ _font_class = FreeTypeFont
+
+
+def have_font(name):
+ """Check if specified system font name is available."""
+ return _font_class.have_font(name)
+
+
+def load(name=None, size=None, bold=False, italic=False, stretch=False, dpi=None):
+ """Load a font for rendering.
+
+ :Parameters:
+ `name` : str, or list of str
+ Font family, for example, "Times New Roman". If a list of names
+ is provided, the first one matching a known font is used. If no
+ font can be matched to the name(s), a default font is used. In
+ pyglet 1.1, the name may be omitted.
+ `size` : float
+ Size of the font, in points. The returned font may be an exact
+ match or the closest available.
+ `bold` : bool
+ If True, a bold variant is returned, if one exists for the given
+ family and size.
+ `italic` : bool
+ If True, an italic variant is returned, if one exists for the given
+ family and size.
+ `dpi` : float
+ The assumed resolution of the display device, for the purposes of
+ determining the pixel size of the font. Defaults to 96.
+
+ :rtype: `Font`
+ """
+ # Arbitrary default size
+ if size is None:
+ size = 12
+
+ if dpi is None:
+ dpi = 96
+
+ # Locate or create font cache
+ shared_object_space = gl.current_context.object_space
+ if not hasattr(shared_object_space, 'pyglet_font_font_cache'):
+ shared_object_space.pyglet_font_font_cache = weakref.WeakValueDictionary()
+ shared_object_space.pyglet_font_font_hold = []
+ shared_object_space.pyglet_font_font_name_match = {} # Match a tuple to specific name to reduce lookups.
+
+ font_cache = shared_object_space.pyglet_font_font_cache
+ font_hold = shared_object_space.pyglet_font_font_hold
+ font_name_match = shared_object_space.pyglet_font_font_name_match
+
+ name_type = type(name)
+ if name_type in (tuple, list):
+ if name_type == list:
+ name = tuple(name)
+
+ if name in font_name_match:
+ name = font_name_match[name]
+ else:
+ # Find first matching name, cache it.
+ found_name = None
+ for n in name:
+ if _font_class.have_font(n):
+ found_name = n
+ break
+
+ font_name_match[name] = found_name
+ name = found_name
+
+ # Look for font name in font cache
+ descriptor = (name, size, bold, italic, stretch, dpi)
+ if descriptor in font_cache:
+ return font_cache[descriptor]
+
+ # Not in cache, create from scratch
+ font = _font_class(name, size, bold=bold, italic=italic, stretch=stretch, dpi=dpi)
+
+ # Save parameters for new-style layout classes to recover
+ # TODO: add properties to the Font classes, so these can be queried:
+ font.size = size
+ font.bold = bold
+ font.italic = italic
+ font.stretch = stretch
+ font.dpi = dpi
+
+ # Cache font in weak-ref dictionary to avoid reloading while still in use
+ font_cache[descriptor] = font
+
+ # Hold onto refs of last three loaded fonts to prevent them being
+ # collected if momentarily dropped.
+ del font_hold[3:]
+ font_hold.insert(0, font)
+
+ return font
+
+
+def add_file(font):
+ """Add a font to pyglet's search path.
+
+ In order to load a font that is not installed on the system, you must
+ call this method to tell pyglet that it exists. You can supply
+ either a filename or any file-like object.
+
+ The font format is platform-dependent, but is typically a TrueType font
+ file containing a single font face. Note that to use a font added with this method,
+ you should pass the face name (not the file name) to :meth::py:func:`pyglet.font.load` or any
+ other place where you normally specify a font.
+
+ :Parameters:
+ `font` : str or file-like object
+ Filename or file-like object to load fonts from.
+
+ """
+ if isinstance(font, str):
+ font = open(font, 'rb')
+ if hasattr(font, 'read'):
+ font = font.read()
+ _font_class.add_font_data(font)
+
+
+def add_directory(directory):
+ """Add a directory of fonts to pyglet's search path.
+
+ This function simply calls :meth:`pyglet.font.add_file` for each file with a ``.ttf``
+ extension in the given directory. Subdirectories are not searched.
+
+ :Parameters:
+ `dir` : str
+ Directory that contains font files.
+
+ """
+ for file in os.listdir(directory):
+ if file[-4:].lower() == '.ttf':
+ add_file(os.path.join(directory, file))
+
+
+__all__ = ('add_file', 'add_directory', 'load', 'have_font')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/base.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..7cde5bb27f4794bbea5933b2f33369a0b30030b1
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/base.py
@@ -0,0 +1,415 @@
+"""Abstract classes used by pyglet.font implementations.
+
+These classes should not be constructed directly. Instead, use the functions
+in `pyglet.font` to obtain platform-specific instances. You can use these
+classes as a documented interface to the concrete classes.
+"""
+
+import unicodedata
+
+from pyglet.gl import *
+from pyglet import image
+
+_other_grapheme_extend = list(map(chr, [0x09be, 0x09d7, 0x0be3, 0x0b57, 0x0bbe, 0x0bd7, 0x0cc2,
+ 0x0cd5, 0x0cd6, 0x0d3e, 0x0d57, 0x0dcf, 0x0ddf, 0x200c,
+ 0x200d, 0xff9e, 0xff9f])) # skip codepoints above U+10000
+_logical_order_exception = list(map(chr, list(range(0xe40, 0xe45)) + list(range(0xec0, 0xec4))))
+
+_grapheme_extend = lambda c, cc: cc in ('Me', 'Mn') or c in _other_grapheme_extend
+
+_CR = u'\u000d'
+_LF = u'\u000a'
+_control = lambda c, cc: cc in ('ZI', 'Zp', 'Cc', 'Cf') and not \
+ c in list(map(chr, [0x000d, 0x000a, 0x200c, 0x200d]))
+_extend = lambda c, cc: _grapheme_extend(c, cc) or \
+ c in list(map(chr, [0xe30, 0xe32, 0xe33, 0xe45, 0xeb0, 0xeb2, 0xeb3]))
+_prepend = lambda c, cc: c in _logical_order_exception
+_spacing_mark = lambda c, cc: cc == 'Mc' and c not in _other_grapheme_extend
+
+
+def grapheme_break(left, right):
+ # GB1
+ if left is None:
+ return True
+
+ # GB2 not required, see end of get_grapheme_clusters
+
+ # GB3
+ if left == _CR and right == _LF:
+ return False
+
+ left_cc = unicodedata.category(left)
+
+ # GB4
+ if _control(left, left_cc):
+ return True
+
+ right_cc = unicodedata.category(right)
+
+ # GB5
+ if _control(right, right_cc):
+ return True
+
+ # GB6, GB7, GB8 not implemented
+
+ # GB9
+ if _extend(right, right_cc):
+ return False
+
+ # GB9a
+ if _spacing_mark(right, right_cc):
+ return False
+
+ # GB9b
+ if _prepend(left, left_cc):
+ return False
+
+ # GB10
+ return True
+
+
+def get_grapheme_clusters(text):
+ """Implements Table 2 of UAX #29: Grapheme Cluster Boundaries.
+
+ Does not currently implement Hangul syllable rules.
+
+ :Parameters:
+ `text` : unicode
+ String to cluster.
+
+ .. versionadded:: 1.1.2
+
+ :rtype: List of `unicode`
+ :return: List of Unicode grapheme clusters
+ """
+ clusters = []
+ cluster = ''
+ left = None
+ for right in text:
+ if cluster and grapheme_break(left, right):
+ clusters.append(cluster)
+ cluster = ''
+ elif cluster:
+ # Add a zero-width space to keep len(clusters) == len(text)
+ clusters.append(u'\u200b')
+ cluster += right
+ left = right
+
+ # GB2
+ if cluster:
+ clusters.append(cluster)
+ return clusters
+
+
+class Glyph(image.TextureRegion):
+ """A single glyph located within a larger texture.
+
+ Glyphs are drawn most efficiently using the higher level APIs, for example
+ `GlyphString`.
+
+ :Ivariables:
+ `advance` : int
+ The horizontal advance of this glyph, in pixels.
+ `vertices` : (int, int, int, int)
+ The vertices of this glyph, with (0,0) originating at the
+ left-side bearing at the baseline.
+ `colored` : bool
+ If a glyph is colored by the font renderer, such as an emoji, it may
+ be treated differently by pyglet. For example, being omitted from text color shaders.
+
+ """
+ baseline = 0
+ lsb = 0
+ advance = 0
+ vertices = (0, 0, 0, 0)
+ colored = False
+
+ def set_bearings(self, baseline, left_side_bearing, advance, x_offset=0, y_offset=0):
+ """Set metrics for this glyph.
+
+ :Parameters:
+ `baseline` : int
+ Distance from the bottom of the glyph to its baseline;
+ typically negative.
+ `left_side_bearing` : int
+ Distance to add to the left edge of the glyph.
+ `advance` : int
+ Distance to move the horizontal advance to the next glyph.
+ `offset_x` : int
+ Distance to move the glyph horizontally from its default position.
+ `offset_y` : int
+ Distance to move the glyph vertically from its default position.
+ """
+ self.baseline = baseline
+ self.lsb = left_side_bearing
+ self.advance = advance
+
+ self.vertices = (
+ left_side_bearing + x_offset,
+ -baseline + y_offset,
+ left_side_bearing + self.width + x_offset,
+ -baseline + self.height + y_offset)
+
+ def get_kerning_pair(self, right_glyph):
+ """Not implemented.
+ """
+ return 0
+
+
+class GlyphTexture(image.Texture):
+ region_class = Glyph
+
+
+class GlyphTextureAtlas(image.atlas.TextureAtlas):
+ """A texture atlas containing glyphs."""
+ texture_class = GlyphTexture
+
+ def __init__(self, width=2048, height=2048, fmt=GL_RGBA, min_filter=GL_LINEAR, mag_filter=GL_LINEAR):
+ self.texture = self.texture_class.create(width, height, GL_TEXTURE_2D, fmt, min_filter, mag_filter, fmt=fmt)
+ self.allocator = image.atlas.Allocator(width, height)
+
+
+class GlyphTextureBin(image.atlas.TextureBin):
+ """Same as a TextureBin but allows you to specify filter of Glyphs."""
+
+ def add(self, img, fmt=GL_RGBA, min_filter=GL_LINEAR, mag_filter=GL_LINEAR, border=0):
+ for atlas in list(self.atlases):
+ try:
+ return atlas.add(img, border)
+ except image.atlas.AllocatorException:
+ # Remove atlases that are no longer useful (so that their textures
+ # can later be freed if the images inside them get collected).
+ if img.width < 64 and img.height < 64:
+ self.atlases.remove(atlas)
+
+ atlas = GlyphTextureAtlas(self.texture_width, self.texture_height, fmt, min_filter, mag_filter)
+ self.atlases.append(atlas)
+ return atlas.add(img, border)
+
+
+class GlyphRenderer:
+ """Abstract class for creating glyph images.
+ """
+
+ def __init__(self, font):
+ pass
+
+ def render(self, text):
+ raise NotImplementedError('Subclass must override')
+
+
+class FontException(Exception):
+ """Generic exception related to errors from the font module. Typically
+ these relate to invalid font data."""
+ pass
+
+
+class Font:
+ """Abstract font class able to produce glyphs.
+
+ To construct a font, use :py:func:`pyglet.font.load`, which will instantiate the
+ platform-specific font class.
+
+ Internally, this class is used by the platform classes to manage the set
+ of textures into which glyphs are written.
+
+ :Ivariables:
+ `ascent` : int
+ Maximum ascent above the baseline, in pixels.
+ `descent` : int
+ Maximum descent below the baseline, in pixels. Usually negative.
+ """
+ texture_width = 512
+ texture_height = 512
+
+ optimize_fit = True
+ glyph_fit = 100
+
+ texture_internalformat = GL_RGBA
+ texture_min_filter = GL_LINEAR
+ texture_mag_filter = GL_LINEAR
+
+ # These should also be set by subclass when known
+ ascent = 0
+ descent = 0
+
+ glyph_renderer_class = GlyphRenderer
+ texture_class = GlyphTextureBin
+
+ def __init__(self):
+ self.texture_bin = None
+ self.glyphs = {}
+
+ @property
+ def name(self):
+ """Return the Family Name of the font as a string."""
+ raise NotImplementedError
+
+ @classmethod
+ def add_font_data(cls, data):
+ """Add font data to the font loader.
+
+ This is a class method and affects all fonts loaded. Data must be
+ some byte string of data, for example, the contents of a TrueType font
+ file. Subclasses can override this method to add the font data into
+ the font registry.
+
+ There is no way to instantiate a font given the data directly, you
+ must use :py:func:`pyglet.font.load` specifying the font name.
+ """
+ pass
+
+ @classmethod
+ def have_font(cls, name):
+ """Determine if a font with the given name is installed.
+
+ :Parameters:
+ `name` : str
+ Name of a font to search for
+
+ :rtype: bool
+ """
+ return True
+
+ def create_glyph(self, image, fmt=None):
+ """Create a glyph using the given image.
+
+ This is used internally by `Font` subclasses to add glyph data
+ to the font. Glyphs are packed within large textures maintained by
+ `Font`. This method inserts the image into a font texture and returns
+ a glyph reference; it is up to the subclass to add metadata to the
+ glyph.
+
+ Applications should not use this method directly.
+
+ :Parameters:
+ `image` : `pyglet.image.AbstractImage`
+ The image to write to the font texture.
+ `fmt` : `int`
+ Override for the format and internalformat of the atlas texture
+
+ :rtype: `Glyph`
+ """
+ if self.texture_bin is None:
+ if self.optimize_fit:
+ self.texture_width, self.texture_height = self._get_optimal_atlas_size(image)
+ self.texture_bin = GlyphTextureBin(self.texture_width, self.texture_height)
+
+ glyph = self.texture_bin.add(
+ image, fmt or self.texture_internalformat, self.texture_min_filter, self.texture_mag_filter, border=1)
+
+ return glyph
+
+ def _get_optimal_atlas_size(self, image_data):
+ """Return the smallest size of atlas that can fit around 100 glyphs based on the image_data provided."""
+ # A texture glyph sheet should be able to handle all standard keyboard characters in one sheet.
+ # 26 Alpha upper, 26 lower, 10 numbers, 33 symbols, space = around 96 characters. (Glyph Fit)
+ aw, ah = self.texture_width, self.texture_height
+
+ atlas_size = None
+
+ # Just a fast check to get the smallest atlas size possible to fit.
+ i = 0
+ while not atlas_size:
+ fit = ((aw - (image_data.width + 2)) // (image_data.width + 2) + 1) * (
+ (ah - (image_data.height + 2)) // (image_data.height + 2) + 1)
+
+ if fit >= self.glyph_fit:
+ atlas_size = (aw, ah)
+
+ if i % 2:
+ aw *= 2
+ else:
+ ah *= 2
+
+ i += 1
+
+ return atlas_size
+
+ def get_glyphs(self, text):
+ """Create and return a list of Glyphs for `text`.
+
+ If any characters do not have a known glyph representation in this
+ font, a substitution will be made.
+
+ :Parameters:
+ `text` : str or unicode
+ Text to render.
+
+ :rtype: list of `Glyph`
+ """
+ glyph_renderer = None
+ glyphs = [] # glyphs that are committed.
+ for c in get_grapheme_clusters(str(text)):
+ # Get the glyph for 'c'. Hide tabs (Windows and Linux render
+ # boxes)
+ if c == '\t':
+ c = ' '
+ if c not in self.glyphs:
+ if not glyph_renderer:
+ glyph_renderer = self.glyph_renderer_class(self)
+ self.glyphs[c] = glyph_renderer.render(c)
+ glyphs.append(self.glyphs[c])
+ return glyphs
+
+ def get_glyphs_for_width(self, text, width):
+ """Return a list of glyphs for `text` that fit within the given width.
+
+ If the entire text is larger than 'width', as much as possible will be
+ used while breaking after a space or zero-width space character. If a
+ newline is encountered in text, only text up to that newline will be
+ used. If no break opportunities (newlines or spaces) occur within
+ `width`, the text up to the first break opportunity will be used (this
+ will exceed `width`). If there are no break opportunities, the entire
+ text will be used.
+
+ You can assume that each character of the text is represented by
+ exactly one glyph; so the amount of text "used up" can be determined
+ by examining the length of the returned glyph list.
+
+ :Parameters:
+ `text` : str or unicode
+ Text to render.
+ `width` : int
+ Maximum width of returned glyphs.
+
+ :rtype: list of `Glyph`
+
+ :see: `GlyphString`
+ """
+ glyph_renderer = None
+ glyph_buffer = [] # next glyphs to be added, as soon as a BP is found
+ glyphs = [] # glyphs that are committed.
+ for c in text:
+ if c == '\n':
+ glyphs += glyph_buffer
+ break
+
+ # Get the glyph for 'c'
+ if c not in self.glyphs:
+ if not glyph_renderer:
+ glyph_renderer = self.glyph_renderer_class(self)
+ self.glyphs[c] = glyph_renderer.render(c)
+ glyph = self.glyphs[c]
+
+ # Add to holding buffer and measure
+ glyph_buffer.append(glyph)
+ width -= glyph.advance
+
+ # If over width and have some committed glyphs, finish.
+ if width <= 0 < len(glyphs):
+ break
+
+ # If a valid breakpoint, commit holding buffer
+ if c in u'\u0020\u200b':
+ glyphs += glyph_buffer
+ glyph_buffer = []
+
+ # If nothing was committed, commit everything (no breakpoints found).
+ if len(glyphs) == 0:
+ glyphs = glyph_buffer
+
+ return glyphs
+
+ def __repr__(self):
+ return f"{self.__class__.__name__}('{self.name}')"
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/directwrite.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/directwrite.py
new file mode 100644
index 0000000000000000000000000000000000000000..fcf19972ca43e0809e55151f2a1608511829e63c
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/directwrite.py
@@ -0,0 +1,2772 @@
+import copy
+import os
+import pathlib
+import platform
+from ctypes import *
+from typing import List, Optional, Tuple
+
+import math
+import pyglet
+from pyglet.font import base
+from pyglet.image.codecs.wic import IWICBitmap, WICDecoder, GUID_WICPixelFormat32bppPBGRA
+from pyglet.libs.win32 import _kernel32 as kernel32
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+from pyglet.util import debug_print
+
+try:
+ dwrite = 'dwrite'
+
+ # System32 and SysWOW64 folders are opposite perception in Windows x64.
+ # System32 = x64 dll's | SysWOW64 = x86 dlls
+ # By default ctypes only seems to look in system32 regardless of Python architecture, which has x64 dlls.
+ if platform.architecture()[0] == '32bit':
+ if platform.machine().endswith('64'): # Machine is 64 bit, Python is 32 bit.
+ dwrite = os.path.join(os.environ['WINDIR'], 'SysWOW64', 'dwrite.dll')
+
+ dwrite_lib = ctypes.windll.LoadLibrary(dwrite)
+except OSError as err:
+ # Doesn't exist? Should stop import of library.
+ pass
+
+_debug_font = pyglet.options['debug_font']
+
+_debug_print = debug_print('debug_font')
+
+
+def DWRITE_MAKE_OPENTYPE_TAG(a, b, c, d):
+ return ord(d) << 24 | ord(c) << 16 | ord(b) << 8 | ord(a)
+
+
+DWRITE_FACTORY_TYPE = UINT
+DWRITE_FACTORY_TYPE_SHARED = 0
+DWRITE_FACTORY_TYPE_ISOLATED = 1
+
+DWRITE_FONT_WEIGHT = UINT
+DWRITE_FONT_WEIGHT_THIN = 100
+DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200
+DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200
+DWRITE_FONT_WEIGHT_LIGHT = 300
+DWRITE_FONT_WEIGHT_SEMI_LIGHT = 350
+DWRITE_FONT_WEIGHT_NORMAL = 400
+DWRITE_FONT_WEIGHT_REGULAR = 400
+DWRITE_FONT_WEIGHT_MEDIUM = 500
+DWRITE_FONT_WEIGHT_DEMI_BOLD = 600
+DWRITE_FONT_WEIGHT_SEMI_BOLD = 600
+DWRITE_FONT_WEIGHT_BOLD = 700
+DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800
+DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800
+DWRITE_FONT_WEIGHT_BLACK = 900
+DWRITE_FONT_WEIGHT_HEAVY = 900
+DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950
+
+name_to_weight = {"thin": DWRITE_FONT_WEIGHT_THIN,
+ "extralight": DWRITE_FONT_WEIGHT_EXTRA_LIGHT,
+ "ultralight": DWRITE_FONT_WEIGHT_ULTRA_LIGHT,
+ "light": DWRITE_FONT_WEIGHT_LIGHT,
+ "semilight": DWRITE_FONT_WEIGHT_SEMI_LIGHT,
+ "normal": DWRITE_FONT_WEIGHT_NORMAL,
+ "regular": DWRITE_FONT_WEIGHT_REGULAR,
+ "medium": DWRITE_FONT_WEIGHT_MEDIUM,
+ "demibold": DWRITE_FONT_WEIGHT_DEMI_BOLD,
+ "semibold": DWRITE_FONT_WEIGHT_SEMI_BOLD,
+ "bold": DWRITE_FONT_WEIGHT_BOLD,
+ "extrabold": DWRITE_FONT_WEIGHT_EXTRA_BOLD,
+ "ultrabold": DWRITE_FONT_WEIGHT_ULTRA_BOLD,
+ "black": DWRITE_FONT_WEIGHT_BLACK,
+ "heavy": DWRITE_FONT_WEIGHT_HEAVY,
+ "extrablack": DWRITE_FONT_WEIGHT_EXTRA_BLACK,
+ }
+
+DWRITE_FONT_STRETCH = UINT
+DWRITE_FONT_STRETCH_UNDEFINED = 0
+DWRITE_FONT_STRETCH_ULTRA_CONDENSED = 1
+DWRITE_FONT_STRETCH_EXTRA_CONDENSED = 2
+DWRITE_FONT_STRETCH_CONDENSED = 3
+DWRITE_FONT_STRETCH_SEMI_CONDENSED = 4
+DWRITE_FONT_STRETCH_NORMAL = 5
+DWRITE_FONT_STRETCH_MEDIUM = 5
+DWRITE_FONT_STRETCH_SEMI_EXPANDED = 6
+DWRITE_FONT_STRETCH_EXPANDED = 7
+DWRITE_FONT_STRETCH_EXTRA_EXPANDED = 8
+
+name_to_stretch = {"undefined": DWRITE_FONT_STRETCH_UNDEFINED,
+ "ultracondensed": DWRITE_FONT_STRETCH_ULTRA_CONDENSED,
+ "extracondensed": DWRITE_FONT_STRETCH_EXTRA_CONDENSED,
+ "condensed": DWRITE_FONT_STRETCH_CONDENSED,
+ "semicondensed": DWRITE_FONT_STRETCH_SEMI_CONDENSED,
+ "normal": DWRITE_FONT_STRETCH_NORMAL,
+ "medium": DWRITE_FONT_STRETCH_MEDIUM,
+ "semiexpanded": DWRITE_FONT_STRETCH_SEMI_EXPANDED,
+ "expanded": DWRITE_FONT_STRETCH_EXPANDED,
+ "extraexpanded": DWRITE_FONT_STRETCH_EXTRA_EXPANDED,
+ "narrow": DWRITE_FONT_STRETCH_CONDENSED,
+ }
+
+DWRITE_GLYPH_IMAGE_FORMATS = c_int
+
+DWRITE_GLYPH_IMAGE_FORMATS_NONE = 0x00000000
+DWRITE_GLYPH_IMAGE_FORMATS_TRUETYPE = 0x00000001
+DWRITE_GLYPH_IMAGE_FORMATS_CFF = 0x00000002
+DWRITE_GLYPH_IMAGE_FORMATS_COLR = 0x00000004
+DWRITE_GLYPH_IMAGE_FORMATS_SVG = 0x00000008
+DWRITE_GLYPH_IMAGE_FORMATS_PNG = 0x00000010
+DWRITE_GLYPH_IMAGE_FORMATS_JPEG = 0x00000020
+DWRITE_GLYPH_IMAGE_FORMATS_TIFF = 0x00000040
+DWRITE_GLYPH_IMAGE_FORMATS_PREMULTIPLIED_B8G8R8A8 = 0x00000080
+
+DWRITE_MEASURING_MODE = UINT
+DWRITE_MEASURING_MODE_NATURAL = 0
+DWRITE_MEASURING_MODE_GDI_CLASSIC = 1
+DWRITE_MEASURING_MODE_GDI_NATURAL = 2
+
+DWRITE_GLYPH_IMAGE_FORMATS_ALL = DWRITE_GLYPH_IMAGE_FORMATS_TRUETYPE | \
+ DWRITE_GLYPH_IMAGE_FORMATS_CFF | \
+ DWRITE_GLYPH_IMAGE_FORMATS_COLR | \
+ DWRITE_GLYPH_IMAGE_FORMATS_SVG | \
+ DWRITE_GLYPH_IMAGE_FORMATS_PNG | \
+ DWRITE_GLYPH_IMAGE_FORMATS_JPEG | \
+ DWRITE_GLYPH_IMAGE_FORMATS_TIFF | \
+ DWRITE_GLYPH_IMAGE_FORMATS_PREMULTIPLIED_B8G8R8A8
+
+DWRITE_FONT_STYLE = UINT
+DWRITE_FONT_STYLE_NORMAL = 0
+DWRITE_FONT_STYLE_OBLIQUE = 1
+DWRITE_FONT_STYLE_ITALIC = 2
+
+name_to_style = {"normal": DWRITE_FONT_STYLE_NORMAL,
+ "oblique": DWRITE_FONT_STYLE_OBLIQUE,
+ "italic": DWRITE_FONT_STYLE_ITALIC}
+
+UINT8 = c_uint8
+UINT16 = c_uint16
+INT16 = c_int16
+INT32 = c_int32
+UINT32 = c_uint32
+UINT64 = c_uint64
+
+DWRITE_INFORMATIONAL_STRING_ID = UINT32
+
+DWRITE_INFORMATIONAL_STRING_NONE = 0
+DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE = 1
+DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS = 2
+DWRITE_INFORMATIONAL_STRING_TRADEMARK = 3
+DWRITE_INFORMATIONAL_STRING_MANUFACTURER = 4
+DWRITE_INFORMATIONAL_STRING_DESIGNER = 5
+DWRITE_INFORMATIONAL_STRING_DESIGNER_URL = 6
+DWRITE_INFORMATIONAL_STRING_DESCRIPTION = 7
+DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL = 8
+DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION = 9
+DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL = 10
+DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES = 11
+DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES = 12
+DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_FAMILY_NAMES = 13
+DWRITE_INFORMATIONAL_STRING_TYPOGRAPHIC_SUBFAMILY_NAMES = 14
+DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT = 15
+DWRITE_INFORMATIONAL_STRING_FULL_NAME = 16
+DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_NAME = 17
+DWRITE_INFORMATIONAL_STRING_POSTSCRIPT_CID_NAME = 18
+DWRITE_INFORMATIONAL_STRING_WEIGHT_STRETCH_STYLE_FAMILY_NAME = 19
+DWRITE_INFORMATIONAL_STRING_DESIGN_SCRIPT_LANGUAGE_TAG = 20
+DWRITE_INFORMATIONAL_STRING_SUPPORTED_SCRIPT_LANGUAGE_TAG = 21
+DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES = 22
+DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES = 23
+DWRITE_INFORMATIONAL_STRING_WWS_FAMILY_NAME = 24
+
+
+class D2D_POINT_2F(Structure):
+ _fields_ = (
+ ('x', FLOAT),
+ ('y', FLOAT),
+ )
+
+
+class D2D1_RECT_F(Structure):
+ _fields_ = (
+ ('left', FLOAT),
+ ('top', FLOAT),
+ ('right', FLOAT),
+ ('bottom', FLOAT),
+ )
+
+
+class D2D1_COLOR_F(Structure):
+ _fields_ = (
+ ('r', FLOAT),
+ ('g', FLOAT),
+ ('b', FLOAT),
+ ('a', FLOAT),
+ )
+
+
+class DWRITE_TEXT_METRICS(ctypes.Structure):
+ _fields_ = (
+ ('left', FLOAT),
+ ('top', FLOAT),
+ ('width', FLOAT),
+ ('widthIncludingTrailingWhitespace', FLOAT),
+ ('height', FLOAT),
+ ('layoutWidth', FLOAT),
+ ('layoutHeight', FLOAT),
+ ('maxBidiReorderingDepth', UINT32),
+ ('lineCount', UINT32),
+ )
+
+
+class DWRITE_FONT_METRICS(ctypes.Structure):
+ _fields_ = (
+ ('designUnitsPerEm', UINT16),
+ ('ascent', UINT16),
+ ('descent', UINT16),
+ ('lineGap', INT16),
+ ('capHeight', UINT16),
+ ('xHeight', UINT16),
+ ('underlinePosition', INT16),
+ ('underlineThickness', UINT16),
+ ('strikethroughPosition', INT16),
+ ('strikethroughThickness', UINT16),
+ )
+
+
+class DWRITE_GLYPH_METRICS(ctypes.Structure):
+ _fields_ = (
+ ('leftSideBearing', INT32),
+ ('advanceWidth', UINT32),
+ ('rightSideBearing', INT32),
+ ('topSideBearing', INT32),
+ ('advanceHeight', UINT32),
+ ('bottomSideBearing', INT32),
+ ('verticalOriginY', INT32),
+ )
+
+
+class DWRITE_GLYPH_OFFSET(ctypes.Structure):
+ _fields_ = (
+ ('advanceOffset', FLOAT),
+ ('ascenderOffset', FLOAT),
+ )
+
+ def __repr__(self):
+ return f"DWRITE_GLYPH_OFFSET({self.advanceOffset}, {self.ascenderOffset})"
+
+
+class DWRITE_CLUSTER_METRICS(ctypes.Structure):
+ _fields_ = (
+ ('width', FLOAT),
+ ('length', UINT16),
+ ('canWrapLineAfter', UINT16, 1),
+ ('isWhitespace', UINT16, 1),
+ ('isNewline', UINT16, 1),
+ ('isSoftHyphen', UINT16, 1),
+ ('isRightToLeft', UINT16, 1),
+ ('padding', UINT16, 11),
+ )
+
+
+class IDWriteFontFileStream(com.IUnknown):
+ _methods_ = [
+ ('ReadFileFragment',
+ com.STDMETHOD(c_void_p, POINTER(c_void_p), UINT64, UINT64, POINTER(c_void_p))),
+ ('ReleaseFileFragment',
+ com.STDMETHOD(c_void_p, c_void_p)),
+ ('GetFileSize',
+ com.STDMETHOD(c_void_p, POINTER(UINT64))),
+ ('GetLastWriteTime',
+ com.STDMETHOD(c_void_p, POINTER(UINT64))),
+ ]
+
+
+class IDWriteFontFileLoader_LI(com.IUnknown): # Local implementation use only.
+ _methods_ = [
+ ('CreateStreamFromKey',
+ com.STDMETHOD(c_void_p, c_void_p, UINT32, POINTER(POINTER(IDWriteFontFileStream))))
+ ]
+
+
+class IDWriteFontFileLoader(com.pIUnknown):
+ _methods_ = [
+ ('CreateStreamFromKey',
+ com.STDMETHOD(c_void_p, c_void_p, UINT32, POINTER(POINTER(IDWriteFontFileStream))))
+ ]
+
+
+class IDWriteLocalFontFileLoader(IDWriteFontFileLoader, com.pIUnknown):
+ _methods_ = [
+ ('GetFilePathLengthFromKey',
+ com.STDMETHOD(c_void_p, UINT32, POINTER(UINT32))),
+ ('GetFilePathFromKey',
+ com.STDMETHOD(c_void_p, UINT32, c_wchar_p, UINT32)),
+ ('GetLastWriteTimeFromKey',
+ com.STDMETHOD())
+ ]
+
+
+IID_IDWriteLocalFontFileLoader = com.GUID(0xb2d9f3ec, 0xc9fe, 0x4a11, 0xa2, 0xec, 0xd8, 0x62, 0x08, 0xf7, 0xc0, 0xa2)
+
+
+class IDWriteFontFile(com.pIUnknown):
+ _methods_ = [
+ ('GetReferenceKey',
+ com.STDMETHOD(POINTER(c_void_p), POINTER(UINT32))),
+ ('GetLoader',
+ com.STDMETHOD(POINTER(IDWriteFontFileLoader))),
+ ('Analyze',
+ com.STDMETHOD()),
+ ]
+
+
+class IDWriteFontFace(com.pIUnknown):
+ _methods_ = [
+ ('GetType',
+ com.STDMETHOD()),
+ ('GetFiles',
+ com.STDMETHOD(POINTER(UINT32), POINTER(IDWriteFontFile))),
+ ('GetIndex',
+ com.STDMETHOD()),
+ ('GetSimulations',
+ com.STDMETHOD()),
+ ('IsSymbolFont',
+ com.STDMETHOD()),
+ ('GetMetrics',
+ com.METHOD(c_void, POINTER(DWRITE_FONT_METRICS))),
+ ('GetGlyphCount',
+ com.METHOD(UINT16)),
+ ('GetDesignGlyphMetrics',
+ com.STDMETHOD(POINTER(UINT16), UINT32, POINTER(DWRITE_GLYPH_METRICS), BOOL)),
+ ('GetGlyphIndices',
+ com.STDMETHOD(POINTER(UINT32), UINT32, POINTER(UINT16))),
+ ('TryGetFontTable',
+ com.STDMETHOD(UINT32, c_void_p, POINTER(UINT32), c_void_p, POINTER(BOOL))),
+ ('ReleaseFontTable',
+ com.METHOD(c_void)),
+ ('GetGlyphRunOutline',
+ com.STDMETHOD()),
+ ('GetRecommendedRenderingMode',
+ com.STDMETHOD()),
+ ('GetGdiCompatibleMetrics',
+ com.STDMETHOD()),
+ ('GetGdiCompatibleGlyphMetrics',
+ com.STDMETHOD()),
+ ]
+
+
+IID_IDWriteFontFace1 = com.GUID(0xa71efdb4, 0x9fdb, 0x4838, 0xad, 0x90, 0xcf, 0xc3, 0xbe, 0x8c, 0x3d, 0xaf)
+
+
+class IDWriteFontFace1(IDWriteFontFace, com.pIUnknown):
+ _methods_ = [
+ ('GetMetric1',
+ com.STDMETHOD()),
+ ('GetGdiCompatibleMetrics1',
+ com.STDMETHOD()),
+ ('GetCaretMetrics',
+ com.STDMETHOD()),
+ ('GetUnicodeRanges',
+ com.STDMETHOD()),
+ ('IsMonospacedFont',
+ com.STDMETHOD()),
+ ('GetDesignGlyphAdvances',
+ com.METHOD(c_void, POINTER(DWRITE_FONT_METRICS))),
+ ('GetGdiCompatibleGlyphAdvances',
+ com.STDMETHOD()),
+ ('GetKerningPairAdjustments',
+ com.STDMETHOD(UINT32, POINTER(UINT16), POINTER(INT32))),
+ ('HasKerningPairs',
+ com.METHOD(BOOL)),
+ ('GetRecommendedRenderingMode1',
+ com.STDMETHOD()),
+ ('GetVerticalGlyphVariants',
+ com.STDMETHOD()),
+ ('HasVerticalGlyphVariants',
+ com.STDMETHOD())
+ ]
+
+
+class DWRITE_GLYPH_RUN(ctypes.Structure):
+ _fields_ = (
+ ('fontFace', IDWriteFontFace),
+ ('fontEmSize', FLOAT),
+ ('glyphCount', UINT32),
+ ('glyphIndices', POINTER(UINT16)),
+ ('glyphAdvances', POINTER(FLOAT)),
+ ('glyphOffsets', POINTER(DWRITE_GLYPH_OFFSET)),
+ ('isSideways', BOOL),
+ ('bidiLevel', UINT32),
+ )
+
+
+DWRITE_SCRIPT_SHAPES = UINT
+DWRITE_SCRIPT_SHAPES_DEFAULT = 0
+
+
+class DWRITE_SCRIPT_ANALYSIS(ctypes.Structure):
+ _fields_ = (
+ ('script', UINT16),
+ ('shapes', DWRITE_SCRIPT_SHAPES),
+ )
+
+
+DWRITE_FONT_FEATURE_TAG = UINT
+
+
+class DWRITE_FONT_FEATURE(ctypes.Structure):
+ _fields_ = (
+ ('nameTag', DWRITE_FONT_FEATURE_TAG),
+ ('parameter', UINT32),
+ )
+
+
+class DWRITE_TYPOGRAPHIC_FEATURES(ctypes.Structure):
+ _fields_ = (
+ ('features', POINTER(DWRITE_FONT_FEATURE)),
+ ('featureCount', UINT32),
+ )
+
+
+class DWRITE_SHAPING_TEXT_PROPERTIES(ctypes.Structure):
+ _fields_ = (
+ ('isShapedAlone', UINT16, 1),
+ ('reserved1', UINT16, 1),
+ ('canBreakShapingAfter', UINT16, 1),
+ ('reserved', UINT16, 13),
+ )
+
+ def __repr__(self):
+ return f"DWRITE_SHAPING_TEXT_PROPERTIES({self.isShapedAlone}, {self.reserved1}, {self.canBreakShapingAfter})"
+
+
+class DWRITE_SHAPING_GLYPH_PROPERTIES(ctypes.Structure):
+ _fields_ = (
+ ('justification', UINT16, 4),
+ ('isClusterStart', UINT16, 1),
+ ('isDiacritic', UINT16, 1),
+ ('isZeroWidthSpace', UINT16, 1),
+ ('reserved', UINT16, 9),
+ )
+
+
+DWRITE_READING_DIRECTION = UINT
+DWRITE_READING_DIRECTION_LEFT_TO_RIGHT = 0
+
+
+class IDWriteTextAnalysisSource(com.IUnknown):
+ _methods_ = [
+ ('GetTextAtPosition',
+ com.METHOD(HRESULT, c_void_p, UINT32, POINTER(c_wchar_p), POINTER(UINT32))),
+ ('GetTextBeforePosition',
+ com.STDMETHOD(UINT32, c_wchar_p, POINTER(UINT32))),
+ ('GetParagraphReadingDirection',
+ com.METHOD(DWRITE_READING_DIRECTION)),
+ ('GetLocaleName',
+ com.STDMETHOD(c_void_p, UINT32, POINTER(UINT32), POINTER(c_wchar_p))),
+ ('GetNumberSubstitution',
+ com.STDMETHOD(UINT32, POINTER(UINT32), c_void_p)),
+ ]
+
+
+class IDWriteTextAnalysisSink(com.IUnknown):
+ _methods_ = [
+ ('SetScriptAnalysis',
+ com.STDMETHOD(c_void_p, UINT32, UINT32, POINTER(DWRITE_SCRIPT_ANALYSIS))),
+ ('SetLineBreakpoints',
+ com.STDMETHOD(UINT32, UINT32, c_void_p)),
+ ('SetBidiLevel',
+ com.STDMETHOD(UINT32, UINT32, UINT8, UINT8)),
+ ('SetNumberSubstitution',
+ com.STDMETHOD(UINT32, UINT32, c_void_p)),
+ ]
+
+
+class Run:
+ def __init__(self):
+ self.text_start = 0
+ self.text_length = 0
+ self.glyph_start = 0
+ self.glyph_count = 0
+ self.script = DWRITE_SCRIPT_ANALYSIS()
+ self.bidi = 0
+ self.isNumberSubstituted = False
+ self.isSideways = False
+
+ self.next_run = None
+
+ def ContainsTextPosition(self, textPosition):
+ return textPosition >= self.text_start and textPosition < self.text_start + self.text_length
+
+
+class TextAnalysis(com.COMObject):
+ _interfaces_ = [IDWriteTextAnalysisSource, IDWriteTextAnalysisSink]
+
+ def __init__(self):
+ super().__init__()
+ self._textstart = 0
+ self._textlength = 0
+ self._glyphstart = 0
+ self._glyphcount = 0
+ self._ptrs = []
+
+ self._script = None
+ self._bidi = 0
+ # self._sideways = False
+
+ def GenerateResults(self, analyzer, text, text_length):
+ self._text = text
+ self._textstart = 0
+ self._textlength = text_length
+ self._glyphstart = 0
+ self._glyphcount = 0
+ self._ptrs.clear()
+
+ self._start_run = Run()
+ self._start_run.text_length = text_length
+
+ self._current_run = self._start_run
+
+ analyzer.AnalyzeScript(self, 0, text_length, self)
+
+ def SetScriptAnalysis(self, this, textPosition, textLength, scriptAnalysis):
+ # textPosition - The index of the first character in the string that the result applies to
+ # textLength - How many characters of the string from the index that the result applies to
+ # scriptAnalysis - The analysis information for all glyphs starting at position for length.
+ self.SetCurrentRun(textPosition)
+ self.SplitCurrentRun(textPosition)
+
+ while textLength > 0:
+ run, textLength = self.FetchNextRun(textLength)
+
+ run.script.script = scriptAnalysis[0].script
+ run.script.shapes = scriptAnalysis[0].shapes
+
+ self._script = run.script
+
+ return 0
+ # return 0x80004001
+
+ def GetTextBeforePosition(self, this, textPosition, textString, textLength):
+ raise Exception("Currently not implemented.")
+
+ def GetTextAtPosition(self, this, textPosition, textString, textLength):
+ # This method will retrieve a substring of the text in this layout
+ # to be used in an analysis step.
+ # Arguments:
+ # textPosition - The index of the first character of the text to retrieve.
+ # textString - The pointer to the first character of text at the index requested.
+ # textLength - The characters available at/after the textString pointer (string length).
+
+ if textPosition >= self._textlength:
+ self._no_ptr = c_wchar_p(None)
+ textString[0] = self._no_ptr
+ textLength[0] = 0
+ else:
+ ptr = c_wchar_p(self._text[textPosition:])
+ self._ptrs.append(ptr)
+ textString[0] = ptr
+ textLength[0] = self._textlength - textPosition
+
+ return 0
+
+ def GetParagraphReadingDirection(self):
+ return 0
+
+ def GetLocaleName(self, this, textPosition, textLength, localeName):
+ self.__local_name = c_wchar_p("") # TODO: Add more locales.
+ localeName[0] = self.__local_name
+ textLength[0] = self._textlength - textPosition
+ return 0
+
+ def GetNumberSubstitution(self):
+ return 0
+
+ def SetCurrentRun(self, textPosition):
+ if self._current_run and self._current_run.ContainsTextPosition(textPosition):
+ return
+
+ def SplitCurrentRun(self, textPosition):
+ if not self._current_run:
+ return
+
+ if textPosition <= self._current_run.text_start:
+ # Already first start of the run.
+ return
+
+ new_run = copy.copy(self._current_run)
+
+ new_run.next_run = self._current_run.next_run
+ self._current_run.next_run = new_run
+
+ splitPoint = textPosition - self._current_run.text_start
+ new_run.text_start += splitPoint
+ new_run.text_length -= splitPoint
+
+ self._current_run.text_length = splitPoint
+ self._current_run = new_run
+
+ def FetchNextRun(self, textLength):
+ original_run = self._current_run
+
+ if (textLength < self._current_run.text_length):
+ self.SplitCurrentRun(self._current_run.text_start + textLength)
+ else:
+ self._current_run = self._current_run.next_run
+
+ textLength -= original_run.text_length
+
+ return original_run, textLength
+
+
+class IDWriteTextAnalyzer(com.pIUnknown):
+ _methods_ = [
+ ('AnalyzeScript',
+ com.STDMETHOD(POINTER(IDWriteTextAnalysisSource), UINT32, UINT32, POINTER(IDWriteTextAnalysisSink))),
+ ('AnalyzeBidi',
+ com.STDMETHOD()),
+ ('AnalyzeNumberSubstitution',
+ com.STDMETHOD()),
+ ('AnalyzeLineBreakpoints',
+ com.STDMETHOD()),
+ ('GetGlyphs',
+ com.STDMETHOD(c_wchar_p, UINT32, IDWriteFontFace, BOOL, BOOL, POINTER(DWRITE_SCRIPT_ANALYSIS),
+ c_wchar_p, c_void_p, POINTER(POINTER(DWRITE_TYPOGRAPHIC_FEATURES)), POINTER(UINT32),
+ UINT32, UINT32, POINTER(UINT16), POINTER(DWRITE_SHAPING_TEXT_PROPERTIES),
+ POINTER(UINT16), POINTER(DWRITE_SHAPING_GLYPH_PROPERTIES), POINTER(UINT32))),
+ ('GetGlyphPlacements',
+ com.STDMETHOD(c_wchar_p, POINTER(UINT16), POINTER(DWRITE_SHAPING_TEXT_PROPERTIES), UINT32, POINTER(UINT16),
+ POINTER(DWRITE_SHAPING_GLYPH_PROPERTIES), UINT32, IDWriteFontFace, FLOAT, BOOL, BOOL,
+ POINTER(DWRITE_SCRIPT_ANALYSIS), c_wchar_p, POINTER(DWRITE_TYPOGRAPHIC_FEATURES),
+ POINTER(UINT32), UINT32, POINTER(FLOAT), POINTER(DWRITE_GLYPH_OFFSET))),
+ ('GetGdiCompatibleGlyphPlacements',
+ com.STDMETHOD()),
+ ]
+
+
+class IDWriteLocalizedStrings(com.pIUnknown):
+ _methods_ = [
+ ('GetCount',
+ com.METHOD(UINT32)),
+ ('FindLocaleName',
+ com.STDMETHOD(c_wchar_p, POINTER(UINT32), POINTER(BOOL))),
+ ('GetLocaleNameLength',
+ com.STDMETHOD(UINT32, POINTER(UINT32))),
+ ('GetLocaleName',
+ com.STDMETHOD(UINT32, c_wchar_p, UINT32)),
+ ('GetStringLength',
+ com.STDMETHOD(UINT32, POINTER(UINT32))),
+ ('GetString',
+ com.STDMETHOD(UINT32, c_wchar_p, UINT32)),
+ ]
+
+
+class IDWriteFontList(com.pIUnknown):
+ _methods_ = [
+ ('GetFontCollection',
+ com.STDMETHOD()),
+ ('GetFontCount',
+ com.METHOD(UINT32)),
+ ('GetFont',
+ com.STDMETHOD(UINT32, c_void_p)), # IDWriteFont, use void because of forward ref.
+ ]
+
+
+class IDWriteFontFamily(IDWriteFontList, com.pIUnknown):
+ _methods_ = [
+ ('GetFamilyNames',
+ com.STDMETHOD(POINTER(IDWriteLocalizedStrings))),
+ ('GetFirstMatchingFont',
+ com.STDMETHOD(DWRITE_FONT_WEIGHT, DWRITE_FONT_STRETCH, DWRITE_FONT_STYLE, c_void_p)),
+ ('GetMatchingFonts',
+ com.STDMETHOD()),
+ ]
+
+
+class IDWriteFontFamily1(IDWriteFontFamily, IDWriteFontList, com.pIUnknown):
+ _methods_ = [
+ ('GetFontLocality',
+ com.STDMETHOD()),
+ ('GetFont1',
+ com.STDMETHOD()),
+ ('GetFontFaceReference',
+ com.STDMETHOD()),
+ ]
+
+
+class IDWriteFont(com.pIUnknown):
+ _methods_ = [
+ ('GetFontFamily',
+ com.STDMETHOD(POINTER(IDWriteFontFamily))),
+ ('GetWeight',
+ com.METHOD(DWRITE_FONT_WEIGHT)),
+ ('GetStretch',
+ com.METHOD(DWRITE_FONT_STRETCH)),
+ ('GetStyle',
+ com.METHOD(DWRITE_FONT_STYLE)),
+ ('IsSymbolFont',
+ com.METHOD(BOOL)),
+ ('GetFaceNames',
+ com.STDMETHOD(POINTER(IDWriteLocalizedStrings))),
+ ('GetInformationalStrings',
+ com.STDMETHOD(DWRITE_INFORMATIONAL_STRING_ID, POINTER(IDWriteLocalizedStrings), POINTER(BOOL))),
+ ('GetSimulations',
+ com.STDMETHOD()),
+ ('GetMetrics',
+ com.STDMETHOD()),
+ ('HasCharacter',
+ com.STDMETHOD(UINT32, POINTER(BOOL))),
+ ('CreateFontFace',
+ com.STDMETHOD(POINTER(IDWriteFontFace))),
+ ]
+
+
+class IDWriteFont1(IDWriteFont, com.pIUnknown):
+ _methods_ = [
+ ('GetMetrics1',
+ com.STDMETHOD()),
+ ('GetPanose',
+ com.STDMETHOD()),
+ ('GetUnicodeRanges',
+ com.STDMETHOD()),
+ ('IsMonospacedFont',
+ com.STDMETHOD())
+ ]
+
+
+class IDWriteFontCollection(com.pIUnknown):
+ _methods_ = [
+ ('GetFontFamilyCount',
+ com.METHOD(UINT32)),
+ ('GetFontFamily',
+ com.STDMETHOD(UINT32, POINTER(IDWriteFontFamily))),
+ ('FindFamilyName',
+ com.STDMETHOD(c_wchar_p, POINTER(UINT), POINTER(BOOL))),
+ ('GetFontFromFontFace',
+ com.STDMETHOD()),
+ ]
+
+
+class IDWriteFontCollection1(IDWriteFontCollection, com.pIUnknown):
+ _methods_ = [
+ ('GetFontSet',
+ com.STDMETHOD()),
+ ('GetFontFamily1',
+ com.STDMETHOD(POINTER(IDWriteFontFamily1))),
+ ]
+
+
+DWRITE_TEXT_ALIGNMENT = UINT
+DWRITE_TEXT_ALIGNMENT_LEADING = 1
+DWRITE_TEXT_ALIGNMENT_TRAILING = 2
+DWRITE_TEXT_ALIGNMENT_CENTER = 3
+DWRITE_TEXT_ALIGNMENT_JUSTIFIED = 4
+
+
+class IDWriteGdiInterop(com.pIUnknown):
+ _methods_ = [
+ ('CreateFontFromLOGFONT',
+ com.STDMETHOD(POINTER(LOGFONTW), POINTER(IDWriteFont))),
+ ('ConvertFontToLOGFONT',
+ com.STDMETHOD()),
+ ('ConvertFontFaceToLOGFONT',
+ com.STDMETHOD()),
+ ('CreateFontFaceFromHdc',
+ com.STDMETHOD(HDC, POINTER(IDWriteFontFace))),
+ ('CreateBitmapRenderTarget',
+ com.STDMETHOD())
+ ]
+
+
+class IDWriteTextFormat(com.pIUnknown):
+ _methods_ = [
+ ('SetTextAlignment',
+ com.STDMETHOD(DWRITE_TEXT_ALIGNMENT)),
+ ('SetParagraphAlignment',
+ com.STDMETHOD()),
+ ('SetWordWrapping',
+ com.STDMETHOD()),
+ ('SetReadingDirection',
+ com.STDMETHOD()),
+ ('SetFlowDirection',
+ com.STDMETHOD()),
+ ('SetIncrementalTabStop',
+ com.STDMETHOD()),
+ ('SetTrimming',
+ com.STDMETHOD()),
+ ('SetLineSpacing',
+ com.STDMETHOD()),
+ ('GetTextAlignment',
+ com.STDMETHOD()),
+ ('GetParagraphAlignment',
+ com.STDMETHOD()),
+ ('GetWordWrapping',
+ com.STDMETHOD()),
+ ('GetReadingDirection',
+ com.STDMETHOD()),
+ ('GetFlowDirection',
+ com.STDMETHOD()),
+ ('GetIncrementalTabStop',
+ com.STDMETHOD()),
+ ('GetTrimming',
+ com.STDMETHOD()),
+ ('GetLineSpacing',
+ com.STDMETHOD()),
+ ('GetFontCollection',
+ com.STDMETHOD()),
+ ('GetFontFamilyNameLength',
+ com.STDMETHOD(UINT32, POINTER(UINT32))),
+ ('GetFontFamilyName',
+ com.STDMETHOD(UINT32, c_wchar_p, UINT32)),
+ ('GetFontWeight',
+ com.STDMETHOD()),
+ ('GetFontStyle',
+ com.STDMETHOD()),
+ ('GetFontStretch',
+ com.STDMETHOD()),
+ ('GetFontSize',
+ com.STDMETHOD()),
+ ('GetLocaleNameLength',
+ com.STDMETHOD()),
+ ('GetLocaleName',
+ com.STDMETHOD()),
+ ]
+
+
+class IDWriteTypography(com.pIUnknown):
+ _methods_ = [
+ ('AddFontFeature',
+ com.STDMETHOD(DWRITE_FONT_FEATURE)),
+ ('GetFontFeatureCount',
+ com.METHOD(UINT32)),
+ ('GetFontFeature',
+ com.STDMETHOD())
+ ]
+
+
+class DWRITE_TEXT_RANGE(ctypes.Structure):
+ _fields_ = (
+ ('startPosition', UINT32),
+ ('length', UINT32),
+ )
+
+
+class DWRITE_OVERHANG_METRICS(ctypes.Structure):
+ _fields_ = (
+ ('left', FLOAT),
+ ('top', FLOAT),
+ ('right', FLOAT),
+ ('bottom', FLOAT),
+ )
+
+
+class IDWriteTextLayout(IDWriteTextFormat, com.pIUnknown):
+ _methods_ = [
+ ('SetMaxWidth',
+ com.STDMETHOD()),
+ ('SetMaxHeight',
+ com.STDMETHOD()),
+ ('SetFontCollection',
+ com.STDMETHOD()),
+ ('SetFontFamilyName',
+ com.STDMETHOD()),
+ ('SetFontWeight', # 30
+ com.STDMETHOD()),
+ ('SetFontStyle',
+ com.STDMETHOD()),
+ ('SetFontStretch',
+ com.STDMETHOD()),
+ ('SetFontSize',
+ com.STDMETHOD()),
+ ('SetUnderline',
+ com.STDMETHOD()),
+ ('SetStrikethrough',
+ com.STDMETHOD()),
+ ('SetDrawingEffect',
+ com.STDMETHOD()),
+ ('SetInlineObject',
+ com.STDMETHOD()),
+ ('SetTypography',
+ com.STDMETHOD(IDWriteTypography, DWRITE_TEXT_RANGE)),
+ ('SetLocaleName',
+ com.STDMETHOD()),
+ ('GetMaxWidth', # 40
+ com.METHOD(FLOAT)),
+ ('GetMaxHeight',
+ com.METHOD(FLOAT)),
+ ('GetFontCollection2',
+ com.STDMETHOD()),
+ ('GetFontFamilyNameLength2',
+ com.STDMETHOD(UINT32, POINTER(UINT32), c_void_p)),
+ ('GetFontFamilyName2',
+ com.STDMETHOD(UINT32, c_wchar_p, UINT32, c_void_p)),
+ ('GetFontWeight2',
+ com.STDMETHOD(UINT32, POINTER(DWRITE_FONT_WEIGHT), POINTER(DWRITE_TEXT_RANGE))),
+ ('GetFontStyle2',
+ com.STDMETHOD()),
+ ('GetFontStretch2',
+ com.STDMETHOD()),
+ ('GetFontSize2',
+ com.STDMETHOD()),
+ ('GetUnderline',
+ com.STDMETHOD()),
+ ('GetStrikethrough',
+ com.STDMETHOD(UINT32, POINTER(BOOL), POINTER(DWRITE_TEXT_RANGE))),
+ ('GetDrawingEffect',
+ com.STDMETHOD()),
+ ('GetInlineObject',
+ com.STDMETHOD()),
+ ('GetTypography', # Always returns NULL without SetTypography being called.
+ com.STDMETHOD(UINT32, POINTER(IDWriteTypography), POINTER(DWRITE_TEXT_RANGE))),
+ ('GetLocaleNameLength1',
+ com.STDMETHOD()),
+ ('GetLocaleName1',
+ com.STDMETHOD()),
+ ('Draw',
+ com.STDMETHOD()),
+ ('GetLineMetrics',
+ com.STDMETHOD()),
+ ('GetMetrics',
+ com.STDMETHOD(POINTER(DWRITE_TEXT_METRICS))),
+ ('GetOverhangMetrics',
+ com.STDMETHOD(POINTER(DWRITE_OVERHANG_METRICS))),
+ ('GetClusterMetrics',
+ com.STDMETHOD(POINTER(DWRITE_CLUSTER_METRICS), UINT32, POINTER(UINT32))),
+ ('DetermineMinWidth',
+ com.STDMETHOD(POINTER(FLOAT))),
+ ('HitTestPoint',
+ com.STDMETHOD()),
+ ('HitTestTextPosition',
+ com.STDMETHOD()),
+ ('HitTestTextRange',
+ com.STDMETHOD()),
+ ]
+
+
+class IDWriteTextLayout1(IDWriteTextLayout, IDWriteTextFormat, com.pIUnknown):
+ _methods_ = [
+ ('SetPairKerning',
+ com.STDMETHOD()),
+ ('GetPairKerning',
+ com.STDMETHOD()),
+ ('SetCharacterSpacing',
+ com.STDMETHOD()),
+ ('GetCharacterSpacing',
+ com.STDMETHOD(UINT32, POINTER(FLOAT), POINTER(FLOAT), POINTER(FLOAT), POINTER(DWRITE_TEXT_RANGE))),
+ ]
+
+
+class IDWriteFontFileEnumerator(com.IUnknown):
+ _methods_ = [
+ ('MoveNext',
+ com.STDMETHOD(c_void_p, POINTER(BOOL))),
+ ('GetCurrentFontFile',
+ com.STDMETHOD(c_void_p, c_void_p)),
+ ]
+
+
+class IDWriteFontCollectionLoader(com.IUnknown):
+ _methods_ = [
+ ('CreateEnumeratorFromKey',
+ com.STDMETHOD(c_void_p, c_void_p, c_void_p, UINT32, POINTER(POINTER(IDWriteFontFileEnumerator)))),
+ ]
+
+
+class MyFontFileStream(com.COMObject):
+ _interfaces_ = [IDWriteFontFileStream]
+
+ def __init__(self, data):
+ self._data = data
+ self._size = len(data)
+ self._ptrs = []
+
+ def AddRef(self, this):
+ return 1
+
+ def Release(self, this):
+ return 1
+
+ def QueryInterface(self, this, refiid, tester):
+ return 0
+
+ def ReadFileFragment(self, this, fragmentStart, fileOffset, fragmentSize, fragmentContext):
+ if fileOffset + fragmentSize > self._size:
+ return 0x80004005 # E_FAIL
+
+ fragment = self._data[fileOffset:]
+ buffer = (ctypes.c_ubyte * len(fragment)).from_buffer(bytearray(fragment))
+ ptr = cast(buffer, c_void_p)
+
+ self._ptrs.append(ptr)
+ fragmentStart[0] = ptr
+ fragmentContext[0] = None
+ return 0
+
+ def ReleaseFileFragment(self, this, fragmentContext):
+ return 0
+
+ def GetFileSize(self, this, fileSize):
+ fileSize[0] = self._size
+ return 0
+
+ def GetLastWriteTime(self, this, lastWriteTime):
+ return 0x80004001 # E_NOTIMPL
+
+
+class LegacyFontFileLoader(com.COMObject):
+ _interfaces_ = [IDWriteFontFileLoader_LI]
+
+ def __init__(self):
+ self._streams = {}
+
+ def QueryInterface(self, this, refiid, tester):
+ return 0
+
+ def AddRef(self, this):
+ return 1
+
+ def Release(self, this):
+ return 1
+
+ def CreateStreamFromKey(self, this, fontfileReferenceKey, fontFileReferenceKeySize, fontFileStream):
+ convert_index = cast(fontfileReferenceKey, POINTER(c_uint32))
+
+ self._ptr = ctypes.cast(self._streams[convert_index.contents.value]._pointers[IDWriteFontFileStream],
+ POINTER(IDWriteFontFileStream))
+ fontFileStream[0] = self._ptr
+ return 0
+
+ def SetCurrentFont(self, index, data):
+ self._streams[index] = MyFontFileStream(data)
+
+
+class MyEnumerator(com.COMObject):
+ _interfaces_ = [IDWriteFontFileEnumerator]
+
+ def __init__(self, factory, loader):
+ self.factory = cast(factory, IDWriteFactory)
+ self.key = "pyglet_dwrite"
+ self.size = len(self.key)
+ self.current_index = -1
+
+ self._keys = []
+ self._font_data = []
+ self._font_files = []
+ self._current_file = None
+
+ self._font_key_ref = create_unicode_buffer("none")
+ self._font_key_len = len(self._font_key_ref)
+
+ self._file_loader = loader
+
+ def AddFontData(self, fonts):
+ self._font_data = fonts
+
+ def MoveNext(self, this, hasCurrentFile):
+
+ self.current_index += 1
+ if self.current_index != len(self._font_data):
+ font_file = IDWriteFontFile()
+
+ self._file_loader.SetCurrentFont(self.current_index, self._font_data[self.current_index])
+
+ key = self.current_index
+
+ if not self.current_index in self._keys:
+ buffer = pointer(c_uint32(key))
+
+ ptr = cast(buffer, c_void_p)
+
+ self._keys.append(ptr)
+
+ self.factory.CreateCustomFontFileReference(self._keys[self.current_index],
+ sizeof(buffer),
+ self._file_loader,
+ byref(font_file))
+
+ self._font_files.append(font_file)
+
+ hasCurrentFile[0] = 1
+ else:
+ hasCurrentFile[0] = 0
+
+ pass
+
+ def GetCurrentFontFile(self, this, fontFile):
+ fontFile = cast(fontFile, POINTER(IDWriteFontFile))
+ fontFile[0] = self._font_files[self.current_index]
+ return 0
+
+
+class LegacyCollectionLoader(com.COMObject):
+ _interfaces_ = [IDWriteFontCollectionLoader]
+
+ def __init__(self, factory, loader):
+ self._enumerator = MyEnumerator(factory, loader)
+
+ def AddFontData(self, fonts):
+ self._enumerator.AddFontData(fonts)
+
+ def AddRef(self, this):
+ self._i = 1
+ return 1
+
+ def Release(self, this):
+ self._i = 0
+ return 1
+
+ def QueryInterface(self, this, refiid, tester):
+ return 0
+
+ def CreateEnumeratorFromKey(self, this, factory, key, key_size, enumerator):
+ self._ptr = ctypes.cast(self._enumerator._pointers[IDWriteFontFileEnumerator],
+ POINTER(IDWriteFontFileEnumerator))
+
+ enumerator[0] = self._ptr
+ return 0
+
+
+IID_IDWriteFactory = com.GUID(0xb859ee5a, 0xd838, 0x4b5b, 0xa2, 0xe8, 0x1a, 0xdc, 0x7d, 0x93, 0xdb, 0x48)
+
+
+class IDWriteRenderingParams(com.pIUnknown):
+ _methods_ = [
+ ('GetGamma',
+ com.METHOD(FLOAT)),
+ ('GetEnhancedContrast',
+ com.METHOD(FLOAT)),
+ ('GetClearTypeLevel',
+ com.METHOD(FLOAT)),
+ ('GetPixelGeometry',
+ com.METHOD(UINT)),
+ ('GetRenderingMode',
+ com.METHOD(UINT)),
+ ]
+
+
+class IDWriteFactory(com.pIUnknown):
+ _methods_ = [
+ ('GetSystemFontCollection',
+ com.STDMETHOD(POINTER(IDWriteFontCollection), BOOL)),
+ ('CreateCustomFontCollection',
+ com.STDMETHOD(POINTER(IDWriteFontCollectionLoader), c_void_p, UINT32, POINTER(IDWriteFontCollection))),
+ ('RegisterFontCollectionLoader',
+ com.STDMETHOD(POINTER(IDWriteFontCollectionLoader))),
+ ('UnregisterFontCollectionLoader',
+ com.STDMETHOD(POINTER(IDWriteFontCollectionLoader))),
+ ('CreateFontFileReference',
+ com.STDMETHOD(c_wchar_p, c_void_p, POINTER(IDWriteFontFile))),
+ ('CreateCustomFontFileReference',
+ com.STDMETHOD(c_void_p, UINT32, POINTER(IDWriteFontFileLoader_LI), POINTER(IDWriteFontFile))),
+ ('CreateFontFace',
+ com.STDMETHOD()),
+ ('CreateRenderingParams',
+ com.STDMETHOD(POINTER(IDWriteRenderingParams))),
+ ('CreateMonitorRenderingParams',
+ com.STDMETHOD()),
+ ('CreateCustomRenderingParams',
+ com.STDMETHOD(FLOAT, FLOAT, FLOAT, UINT, UINT, POINTER(IDWriteRenderingParams))),
+ ('RegisterFontFileLoader',
+ com.STDMETHOD(c_void_p)), # Ambigious as newer is a pIUnknown and legacy is IUnknown.
+ ('UnregisterFontFileLoader',
+ com.STDMETHOD(POINTER(IDWriteFontFileLoader_LI))),
+ ('CreateTextFormat',
+ com.STDMETHOD(c_wchar_p, IDWriteFontCollection, DWRITE_FONT_WEIGHT, DWRITE_FONT_STYLE, DWRITE_FONT_STRETCH,
+ FLOAT, c_wchar_p, POINTER(IDWriteTextFormat))),
+ ('CreateTypography',
+ com.STDMETHOD(POINTER(IDWriteTypography))),
+ ('GetGdiInterop',
+ com.STDMETHOD(POINTER(IDWriteGdiInterop))),
+ ('CreateTextLayout',
+ com.STDMETHOD(c_wchar_p, UINT32, IDWriteTextFormat, FLOAT, FLOAT, POINTER(IDWriteTextLayout))),
+ ('CreateGdiCompatibleTextLayout',
+ com.STDMETHOD()),
+ ('CreateEllipsisTrimmingSign',
+ com.STDMETHOD()),
+ ('CreateTextAnalyzer',
+ com.STDMETHOD(POINTER(IDWriteTextAnalyzer))),
+ ('CreateNumberSubstitution',
+ com.STDMETHOD()),
+ ('CreateGlyphRunAnalysis',
+ com.STDMETHOD()),
+ ]
+
+
+IID_IDWriteFactory1 = com.GUID(0x30572f99, 0xdac6, 0x41db, 0xa1, 0x6e, 0x04, 0x86, 0x30, 0x7e, 0x60, 0x6a)
+
+
+class IDWriteFactory1(IDWriteFactory, com.pIUnknown):
+ _methods_ = [
+ ('GetEudcFontCollection',
+ com.STDMETHOD()),
+ ('CreateCustomRenderingParams1',
+ com.STDMETHOD()),
+ ]
+
+
+class IDWriteFontFallback(com.pIUnknown):
+ _methods_ = [
+ ('MapCharacters',
+ com.STDMETHOD(POINTER(IDWriteTextAnalysisSource), UINT32, UINT32, IDWriteFontCollection, c_wchar_p,
+ DWRITE_FONT_WEIGHT, DWRITE_FONT_STYLE, DWRITE_FONT_STRETCH, POINTER(UINT32),
+ POINTER(IDWriteFont),
+ POINTER(FLOAT))),
+ ]
+
+
+class IDWriteColorGlyphRunEnumerator(com.pIUnknown):
+ _methods_ = [
+ ('MoveNext',
+ com.STDMETHOD()),
+ ('GetCurrentRun',
+ com.STDMETHOD()),
+ ]
+
+
+class IDWriteFactory2(IDWriteFactory1, IDWriteFactory, com.pIUnknown):
+ _methods_ = [
+ ('GetSystemFontFallback',
+ com.STDMETHOD(POINTER(IDWriteFontFallback))),
+ ('CreateFontFallbackBuilder',
+ com.STDMETHOD()),
+ ('TranslateColorGlyphRun',
+ com.STDMETHOD(FLOAT, FLOAT, POINTER(DWRITE_GLYPH_RUN), c_void_p, DWRITE_MEASURING_MODE, c_void_p, UINT32,
+ POINTER(IDWriteColorGlyphRunEnumerator))),
+ ('CreateCustomRenderingParams2',
+ com.STDMETHOD()),
+ ('CreateGlyphRunAnalysis',
+ com.STDMETHOD()),
+ ]
+
+
+IID_IDWriteFactory2 = com.GUID(0x0439fc60, 0xca44, 0x4994, 0x8d, 0xee, 0x3a, 0x9a, 0xf7, 0xb7, 0x32, 0xec)
+
+
+class IDWriteFontSet(com.pIUnknown):
+ _methods_ = [
+ ('GetFontCount',
+ com.STDMETHOD()),
+ ('GetFontFaceReference',
+ com.STDMETHOD()),
+ ('FindFontFaceReference',
+ com.STDMETHOD()),
+ ('FindFontFace',
+ com.STDMETHOD()),
+ ('GetPropertyValues',
+ com.STDMETHOD()),
+ ('GetPropertyOccurrenceCount',
+ com.STDMETHOD()),
+ ('GetMatchingFonts',
+ com.STDMETHOD()),
+ ('GetMatchingFonts',
+ com.STDMETHOD()),
+ ]
+
+
+class IDWriteFontSetBuilder(com.pIUnknown):
+ _methods_ = [
+ ('AddFontFaceReference',
+ com.STDMETHOD()),
+ ('AddFontFaceReference',
+ com.STDMETHOD()),
+ ('AddFontSet',
+ com.STDMETHOD()),
+ ('CreateFontSet',
+ com.STDMETHOD(POINTER(IDWriteFontSet))),
+ ]
+
+
+class IDWriteFontSetBuilder1(IDWriteFontSetBuilder, com.pIUnknown):
+ _methods_ = [
+ ('AddFontFile',
+ com.STDMETHOD(IDWriteFontFile)),
+ ]
+
+
+class IDWriteFactory3(IDWriteFactory2, com.pIUnknown):
+ _methods_ = [
+ ('CreateGlyphRunAnalysis',
+ com.STDMETHOD()),
+ ('CreateCustomRenderingParams3',
+ com.STDMETHOD()),
+ ('CreateFontFaceReference',
+ com.STDMETHOD()),
+ ('CreateFontFaceReference',
+ com.STDMETHOD()),
+ ('GetSystemFontSet',
+ com.STDMETHOD()),
+ ('CreateFontSetBuilder',
+ com.STDMETHOD(POINTER(IDWriteFontSetBuilder))),
+ ('CreateFontCollectionFromFontSet',
+ com.STDMETHOD(IDWriteFontSet, POINTER(IDWriteFontCollection1))),
+ ('GetSystemFontCollection3',
+ com.STDMETHOD()),
+ ('GetFontDownloadQueue',
+ com.STDMETHOD()),
+ # ('GetSystemFontSet',
+ # com.STDMETHOD()),
+ ]
+
+
+class IDWriteColorGlyphRunEnumerator1(IDWriteColorGlyphRunEnumerator, com.pIUnknown):
+ _methods_ = [
+ ('GetCurrentRun1',
+ com.STDMETHOD()),
+ ]
+
+class IDWriteFactory4(IDWriteFactory3, com.pIUnknown):
+ _methods_ = [
+ ('TranslateColorGlyphRun4', # Renamed to prevent clash from previous factories.
+ com.STDMETHOD(D2D_POINT_2F, POINTER(DWRITE_GLYPH_RUN), c_void_p, DWRITE_GLYPH_IMAGE_FORMATS,
+ DWRITE_MEASURING_MODE, c_void_p, UINT32, POINTER(IDWriteColorGlyphRunEnumerator1))),
+ ('ComputeGlyphOrigins_',
+ com.STDMETHOD()),
+ ('ComputeGlyphOrigins',
+ com.STDMETHOD()),
+ ]
+
+
+class IDWriteInMemoryFontFileLoader(com.pIUnknown):
+ _methods_ = [
+ ('CreateStreamFromKey',
+ com.STDMETHOD()),
+ ('CreateInMemoryFontFileReference',
+ com.STDMETHOD(IDWriteFactory, c_void_p, UINT, c_void_p, POINTER(IDWriteFontFile))),
+ ('GetFileCount',
+ com.STDMETHOD()),
+ ]
+
+
+IID_IDWriteFactory5 = com.GUID(0x958DB99A, 0xBE2A, 0x4F09, 0xAF, 0x7D, 0x65, 0x18, 0x98, 0x03, 0xD1, 0xD3)
+
+
+class IDWriteFactory5(IDWriteFactory4, IDWriteFactory3, IDWriteFactory2, IDWriteFactory1, IDWriteFactory,
+ com.pIUnknown):
+ _methods_ = [
+ ('CreateFontSetBuilder1',
+ com.STDMETHOD(POINTER(IDWriteFontSetBuilder1))),
+ ('CreateInMemoryFontFileLoader',
+ com.STDMETHOD(POINTER(IDWriteInMemoryFontFileLoader))),
+ ('CreateHttpFontFileLoader',
+ com.STDMETHOD()),
+ ('AnalyzeContainerType',
+ com.STDMETHOD())
+ ]
+
+
+DWriteCreateFactory = dwrite_lib.DWriteCreateFactory
+DWriteCreateFactory.restype = HRESULT
+DWriteCreateFactory.argtypes = [DWRITE_FACTORY_TYPE, com.REFIID, POINTER(com.pIUnknown)]
+
+
+class ID2D1Resource(com.pIUnknown):
+ _methods_ = [
+ ('GetFactory',
+ com.STDMETHOD()),
+ ]
+
+
+class ID2D1Brush(ID2D1Resource, com.pIUnknown):
+ _methods_ = [
+ ('SetOpacity',
+ com.STDMETHOD()),
+ ('SetTransform',
+ com.STDMETHOD()),
+ ('GetOpacity',
+ com.STDMETHOD()),
+ ('GetTransform',
+ com.STDMETHOD()),
+ ]
+
+
+class ID2D1SolidColorBrush(ID2D1Brush, ID2D1Resource, com.pIUnknown):
+ _methods_ = [
+ ('SetColor',
+ com.STDMETHOD()),
+ ('GetColor',
+ com.STDMETHOD()),
+ ]
+
+
+D2D1_TEXT_ANTIALIAS_MODE = UINT
+D2D1_TEXT_ANTIALIAS_MODE_DEFAULT = 0
+D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE = 1
+D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE = 2
+D2D1_TEXT_ANTIALIAS_MODE_ALIASED = 3
+
+D2D1_RENDER_TARGET_TYPE = UINT
+D2D1_RENDER_TARGET_TYPE_DEFAULT = 0
+D2D1_RENDER_TARGET_TYPE_SOFTWARE = 1
+D2D1_RENDER_TARGET_TYPE_HARDWARE = 2
+
+D2D1_FEATURE_LEVEL = UINT
+D2D1_FEATURE_LEVEL_DEFAULT = 0
+
+D2D1_RENDER_TARGET_USAGE = UINT
+D2D1_RENDER_TARGET_USAGE_NONE = 0
+D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING = 1
+D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE = 2
+
+DXGI_FORMAT = UINT
+DXGI_FORMAT_UNKNOWN = 0
+
+D2D1_ALPHA_MODE = UINT
+D2D1_ALPHA_MODE_UNKNOWN = 0
+D2D1_ALPHA_MODE_PREMULTIPLIED = 1
+D2D1_ALPHA_MODE_STRAIGHT = 2
+D2D1_ALPHA_MODE_IGNORE = 3
+
+D2D1_DRAW_TEXT_OPTIONS = UINT
+D2D1_DRAW_TEXT_OPTIONS_NO_SNAP = 0x00000001
+D2D1_DRAW_TEXT_OPTIONS_CLIP = 0x00000002
+D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT = 0x00000004
+D2D1_DRAW_TEXT_OPTIONS_DISABLE_COLOR_BITMAP_SNAPPING = 0x00000008
+D2D1_DRAW_TEXT_OPTIONS_NONE = 0x00000000
+D2D1_DRAW_TEXT_OPTIONS_FORCE_DWORD = 0xffffffff
+
+
+class D2D1_PIXEL_FORMAT(Structure):
+ _fields_ = (
+ ('format', DXGI_FORMAT),
+ ('alphaMode', D2D1_ALPHA_MODE),
+ )
+
+
+class D2D1_RENDER_TARGET_PROPERTIES(Structure):
+ _fields_ = (
+ ('type', D2D1_RENDER_TARGET_TYPE),
+ ('pixelFormat', D2D1_PIXEL_FORMAT),
+ ('dpiX', FLOAT),
+ ('dpiY', FLOAT),
+ ('usage', D2D1_RENDER_TARGET_USAGE),
+ ('minLevel', D2D1_FEATURE_LEVEL),
+ )
+
+
+DXGI_FORMAT_B8G8R8A8_UNORM = 87
+
+pixel_format = D2D1_PIXEL_FORMAT()
+pixel_format.format = DXGI_FORMAT_UNKNOWN
+pixel_format.alphaMode = D2D1_ALPHA_MODE_UNKNOWN
+
+default_target_properties = D2D1_RENDER_TARGET_PROPERTIES()
+default_target_properties.type = D2D1_RENDER_TARGET_TYPE_DEFAULT
+default_target_properties.pixelFormat = pixel_format
+default_target_properties.dpiX = 0.0
+default_target_properties.dpiY = 0.0
+default_target_properties.usage = D2D1_RENDER_TARGET_USAGE_NONE
+default_target_properties.minLevel = D2D1_FEATURE_LEVEL_DEFAULT
+
+
+class ID2D1RenderTarget(ID2D1Resource, com.pIUnknown):
+ _methods_ = [
+ ('CreateBitmap',
+ com.STDMETHOD()),
+ ('CreateBitmapFromWicBitmap',
+ com.STDMETHOD()),
+ ('CreateSharedBitmap',
+ com.STDMETHOD()),
+ ('CreateBitmapBrush',
+ com.STDMETHOD()),
+ ('CreateSolidColorBrush',
+ com.STDMETHOD(POINTER(D2D1_COLOR_F), c_void_p, POINTER(ID2D1SolidColorBrush))),
+ ('CreateGradientStopCollection',
+ com.STDMETHOD()),
+ ('CreateLinearGradientBrush',
+ com.STDMETHOD()),
+ ('CreateRadialGradientBrush',
+ com.STDMETHOD()),
+ ('CreateCompatibleRenderTarget',
+ com.STDMETHOD()),
+ ('CreateLayer',
+ com.STDMETHOD()),
+ ('CreateMesh',
+ com.STDMETHOD()),
+ ('DrawLine',
+ com.STDMETHOD()),
+ ('DrawRectangle',
+ com.STDMETHOD()),
+ ('FillRectangle',
+ com.STDMETHOD()),
+ ('DrawRoundedRectangle',
+ com.STDMETHOD()),
+ ('FillRoundedRectangle',
+ com.STDMETHOD()),
+ ('DrawEllipse',
+ com.STDMETHOD()),
+ ('FillEllipse',
+ com.STDMETHOD()),
+ ('DrawGeometry',
+ com.STDMETHOD()),
+ ('FillGeometry',
+ com.STDMETHOD()),
+ ('FillMesh',
+ com.STDMETHOD()),
+ ('FillOpacityMask',
+ com.STDMETHOD()),
+ ('DrawBitmap',
+ com.STDMETHOD()),
+ ('DrawText',
+ com.STDMETHOD(c_wchar_p, UINT, IDWriteTextFormat, POINTER(D2D1_RECT_F), ID2D1Brush, D2D1_DRAW_TEXT_OPTIONS,
+ DWRITE_MEASURING_MODE)),
+ ('DrawTextLayout',
+ com.METHOD(c_void, D2D_POINT_2F, IDWriteTextLayout, ID2D1Brush, UINT32)),
+ ('DrawGlyphRun',
+ com.METHOD(c_void, D2D_POINT_2F, POINTER(DWRITE_GLYPH_RUN), ID2D1Brush, UINT32)),
+ ('SetTransform',
+ com.METHOD(c_void)),
+ ('GetTransform',
+ com.STDMETHOD()),
+ ('SetAntialiasMode',
+ com.METHOD(c_void, D2D1_TEXT_ANTIALIAS_MODE)),
+ ('GetAntialiasMode',
+ com.STDMETHOD()),
+ ('SetTextAntialiasMode',
+ com.METHOD(c_void, D2D1_TEXT_ANTIALIAS_MODE)),
+ ('GetTextAntialiasMode',
+ com.STDMETHOD()),
+ ('SetTextRenderingParams',
+ com.STDMETHOD(IDWriteRenderingParams)),
+ ('GetTextRenderingParams',
+ com.STDMETHOD()),
+ ('SetTags',
+ com.STDMETHOD()),
+ ('GetTags',
+ com.STDMETHOD()),
+ ('PushLayer',
+ com.STDMETHOD()),
+ ('PopLayer',
+ com.STDMETHOD()),
+ ('Flush',
+ com.STDMETHOD(c_void_p, c_void_p)),
+ ('SaveDrawingState',
+ com.STDMETHOD()),
+ ('RestoreDrawingState',
+ com.STDMETHOD()),
+ ('PushAxisAlignedClip',
+ com.STDMETHOD()),
+ ('PopAxisAlignedClip',
+ com.STDMETHOD()),
+ ('Clear',
+ com.METHOD(c_void, POINTER(D2D1_COLOR_F))),
+ ('BeginDraw',
+ com.METHOD(c_void)),
+ ('EndDraw',
+ com.STDMETHOD(c_void_p, c_void_p)),
+ ('GetPixelFormat',
+ com.STDMETHOD()),
+ ('SetDpi',
+ com.STDMETHOD()),
+ ('GetDpi',
+ com.STDMETHOD()),
+ ('GetSize',
+ com.STDMETHOD()),
+ ('GetPixelSize',
+ com.STDMETHOD()),
+ ('GetMaximumBitmapSize',
+ com.STDMETHOD()),
+ ('IsSupported',
+ com.STDMETHOD()),
+ ]
+
+
+IID_ID2D1Factory = com.GUID(0x06152247, 0x6f50, 0x465a, 0x92, 0x45, 0x11, 0x8b, 0xfd, 0x3b, 0x60, 0x07)
+
+
+class ID2D1Factory(com.pIUnknown):
+ _methods_ = [
+ ('ReloadSystemMetrics',
+ com.STDMETHOD()),
+ ('GetDesktopDpi',
+ com.STDMETHOD()),
+ ('CreateRectangleGeometry',
+ com.STDMETHOD()),
+ ('CreateRoundedRectangleGeometry',
+ com.STDMETHOD()),
+ ('CreateEllipseGeometry',
+ com.STDMETHOD()),
+ ('CreateGeometryGroup',
+ com.STDMETHOD()),
+ ('CreateTransformedGeometry',
+ com.STDMETHOD()),
+ ('CreatePathGeometry',
+ com.STDMETHOD()),
+ ('CreateStrokeStyle',
+ com.STDMETHOD()),
+ ('CreateDrawingStateBlock',
+ com.STDMETHOD()),
+ ('CreateWicBitmapRenderTarget',
+ com.STDMETHOD(IWICBitmap, POINTER(D2D1_RENDER_TARGET_PROPERTIES), POINTER(ID2D1RenderTarget))),
+ ('CreateHwndRenderTarget',
+ com.STDMETHOD()),
+ ('CreateDxgiSurfaceRenderTarget',
+ com.STDMETHOD()),
+ ('CreateDCRenderTarget',
+ com.STDMETHOD()),
+ ]
+
+
+d2d_lib = ctypes.windll.d2d1
+
+D2D1_FACTORY_TYPE = UINT
+D2D1_FACTORY_TYPE_SINGLE_THREADED = 0
+D2D1_FACTORY_TYPE_MULTI_THREADED = 1
+
+D2D1CreateFactory = d2d_lib.D2D1CreateFactory
+D2D1CreateFactory.restype = HRESULT
+D2D1CreateFactory.argtypes = [D2D1_FACTORY_TYPE, com.REFIID, c_void_p, c_void_p]
+
+# We need a WIC factory to make this work. Make sure one is in the initialized decoders.
+wic_decoder = None
+for decoder in pyglet.image.codecs.get_decoders():
+ if isinstance(decoder, WICDecoder):
+ wic_decoder = decoder
+
+if not wic_decoder:
+ raise Exception("Cannot use DirectWrite without a WIC Decoder")
+
+
+def get_system_locale() -> str:
+ """Retrieve the string representing the system locale."""
+ local_name = create_unicode_buffer(LOCALE_NAME_MAX_LENGTH)
+ kernel32.GetUserDefaultLocaleName(local_name, LOCALE_NAME_MAX_LENGTH)
+ return local_name.value
+
+
+class DirectWriteGlyphRenderer(base.GlyphRenderer):
+ antialias_mode = D2D1_TEXT_ANTIALIAS_MODE_DEFAULT
+ draw_options = D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT if WINDOWS_8_1_OR_GREATER else D2D1_DRAW_TEXT_OPTIONS_NONE
+ measuring_mode = DWRITE_MEASURING_MODE_NATURAL
+
+ def __init__(self, font):
+ self._render_target = None
+ self._bitmap = None
+ self._brush = None
+ self._bitmap_dimensions = (0, 0)
+ super(DirectWriteGlyphRenderer, self).__init__(font)
+ self.font = font
+
+ self._analyzer = IDWriteTextAnalyzer()
+ self.font._write_factory.CreateTextAnalyzer(byref(self._analyzer))
+
+ self._text_analysis = TextAnalysis()
+
+ def render_to_image(self, text, width, height):
+ """This process takes Pyglet out of the equation and uses only DirectWrite to shape and render text.
+ This may allows more accurate fonts (bidi, rtl, etc) in very special circumstances."""
+ text_buffer = create_unicode_buffer(text)
+
+ text_layout = IDWriteTextLayout()
+ self.font._write_factory.CreateTextLayout(
+ text_buffer,
+ len(text_buffer),
+ self.font._text_format,
+ width, # Doesn't affect bitmap size.
+ height,
+ byref(text_layout)
+ )
+
+ layout_metrics = DWRITE_TEXT_METRICS()
+ text_layout.GetMetrics(byref(layout_metrics))
+
+ width, height = int(math.ceil(layout_metrics.width)), int(math.ceil(layout_metrics.height))
+
+ bitmap = IWICBitmap()
+ wic_decoder._factory.CreateBitmap(
+ width,
+ height,
+ GUID_WICPixelFormat32bppPBGRA,
+ WICBitmapCacheOnDemand,
+ byref(bitmap)
+ )
+
+ rt = ID2D1RenderTarget()
+ d2d_factory.CreateWicBitmapRenderTarget(bitmap, default_target_properties, byref(rt))
+
+ # Font aliasing rendering quality.
+ rt.SetTextAntialiasMode(self.antialias_mode)
+
+ if not self._brush:
+ self._brush = ID2D1SolidColorBrush()
+
+ rt.CreateSolidColorBrush(white, None, byref(self._brush))
+
+ rt.BeginDraw()
+
+ rt.Clear(transparent)
+
+ rt.DrawTextLayout(no_offset,
+ text_layout,
+ self._brush,
+ self.draw_options)
+
+ rt.EndDraw(None, None)
+
+ rt.Release()
+
+ image_data = wic_decoder.get_image(bitmap)
+
+ return image_data
+
+ def get_string_info(self, text, font_face):
+ """Converts a string of text into a list of indices and advances used for shaping."""
+ text_length = len(text.encode('utf-16-le')) // 2
+
+ # Unicode buffer splits each two byte chars into separate indices.
+ text_buffer = create_unicode_buffer(text, text_length)
+
+ # Analyze the text.
+ # noinspection PyTypeChecker
+ self._text_analysis.GenerateResults(self._analyzer, text_buffer, len(text_buffer))
+
+ # Formula for text buffer size from Microsoft.
+ max_glyph_size = int(3 * text_length / 2 + 16)
+
+ length = text_length
+ clusters = (UINT16 * length)()
+ text_props = (DWRITE_SHAPING_TEXT_PROPERTIES * length)()
+ indices = (UINT16 * max_glyph_size)()
+ glyph_props = (DWRITE_SHAPING_GLYPH_PROPERTIES * max_glyph_size)()
+ actual_count = UINT32()
+
+ self._analyzer.GetGlyphs(
+ text_buffer,
+ length,
+ font_face,
+ False, # sideways
+ False, # righttoleft
+ self._text_analysis._script, # scriptAnalysis
+ None, # localName
+ None, # numberSub
+ None, # typo features
+ None, # feature range length
+ 0, # feature range
+ max_glyph_size, # max glyph size
+ clusters, # cluster map
+ text_props, # text props
+ indices, # glyph indices
+ glyph_props, # glyph pops
+ byref(actual_count) # glyph count
+ )
+
+ advances = (FLOAT * length)()
+ offsets = (DWRITE_GLYPH_OFFSET * length)()
+ self._analyzer.GetGlyphPlacements(
+ text_buffer,
+ clusters,
+ text_props,
+ text_length,
+ indices,
+ glyph_props,
+ actual_count,
+ font_face,
+ self.font._font_metrics.designUnitsPerEm,
+ False, False,
+ self._text_analysis._script,
+ self.font.locale,
+ None,
+ None,
+ 0,
+ advances,
+ offsets
+ )
+
+ return text_buffer, actual_count.value, indices, advances, offsets, clusters
+
+ def get_glyph_metrics(self, font_face, indices, count):
+ """Returns a list of tuples with the following metrics per indice:
+ (glyph width, glyph height, lsb, advanceWidth)
+ """
+ glyph_metrics = (DWRITE_GLYPH_METRICS * count)()
+ font_face.GetDesignGlyphMetrics(indices, count, glyph_metrics, False)
+
+ metrics_out = []
+ for metric in glyph_metrics:
+ glyph_width = (metric.advanceWidth - metric.leftSideBearing - metric.rightSideBearing)
+
+ # width must have a minimum of 1. For example, spaces are actually 0 width, still need glyph bitmap size.
+ if glyph_width == 0:
+ glyph_width = 1
+
+ glyph_height = (metric.advanceHeight - metric.topSideBearing - metric.bottomSideBearing)
+
+ lsb = metric.leftSideBearing
+
+ bsb = metric.bottomSideBearing
+
+ advance_width = metric.advanceWidth
+
+ metrics_out.append((glyph_width, glyph_height, lsb, advance_width, bsb))
+
+ return metrics_out
+
+ def _get_single_glyph_run(self, font_face, size, indices, advances, offsets, sideways, bidi):
+ run = DWRITE_GLYPH_RUN(
+ font_face,
+ size,
+ 1,
+ indices,
+ advances,
+ offsets,
+ sideways,
+ bidi
+ )
+ return run
+
+ def is_color_run(self, run):
+ """Will return True if the run contains a colored glyph."""
+ try:
+ if WINDOWS_10_CREATORS_UPDATE_OR_GREATER:
+ enumerator = IDWriteColorGlyphRunEnumerator1()
+ color = self.font._write_factory.TranslateColorGlyphRun4(
+ no_offset,
+ run,
+ None,
+ DWRITE_GLYPH_IMAGE_FORMATS_ALL,
+ self.measuring_mode,
+ None,
+ 0,
+ byref(enumerator)
+ )
+ elif WINDOWS_8_1_OR_GREATER:
+ enumerator = IDWriteColorGlyphRunEnumerator()
+ color = self.font._write_factory.TranslateColorGlyphRun(
+ 0.0, 0.0,
+ run,
+ None,
+ self.measuring_mode,
+ None,
+ 0,
+ byref(enumerator)
+ )
+ else:
+ return False
+
+ return True
+ except OSError as dw_err:
+ # HRESULT returns -2003283956 (DWRITE_E_NOCOLOR) if no color run is detected. Anything else is unexpected.
+ if dw_err.winerror != -2003283956:
+ raise dw_err
+
+ return False
+
+ def render_single_glyph(self, font_face, indice, advance, offset, metrics):
+ """Renders a single glyph using D2D DrawGlyphRun"""
+ glyph_width, glyph_height, glyph_lsb, glyph_advance, glyph_bsb = metrics # We use a shaped advance instead of the fonts.
+
+ # Slicing an array turns it into a python object. Maybe a better way to keep it a ctypes value?
+ new_indice = (UINT16 * 1)(indice)
+ new_advance = (FLOAT * 1)(advance)
+
+ run = self._get_single_glyph_run(
+ font_face,
+ self.font._real_size,
+ new_indice, # indice,
+ new_advance, # advance,
+ pointer(offset), # offset,
+ False,
+ 0
+ )
+
+ # If it's colored, return to render it using layout.
+ if self.draw_options & D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT and self.is_color_run(run):
+ return None
+
+ # Use the glyph's advance as a width as bitmap width.
+ # Some characters such as diacritics (̃) may have 0 advance width. In that case, just use glyph_width
+ if glyph_advance:
+ render_width = int(math.ceil(glyph_advance * self.font.font_scale_ratio))
+ else:
+ render_width = int(math.ceil(glyph_width * self.font.font_scale_ratio))
+
+ render_offset_x = 0
+ if glyph_lsb < 0:
+ # Negative LSB: we shift the offset, otherwise the glyph will be cut off.
+ render_offset_x = glyph_lsb * self.font.font_scale_ratio
+
+ # Increase width by arbitrary amount to accommodate size of italic.
+ # No way to get actual size of italics outside of rendering to larger texture and checking pixels.
+ if self.font.italic:
+ render_width += (render_width // 2)
+
+ # Create new bitmap.
+ # TODO: We can probably adjust bitmap/baseline to reduce the whitespace and save a lot of texture space.
+ # Note: Floating point precision makes this a giant headache, will need to be solved for this approach.
+ self._create_bitmap(render_width + 1, # Add 1, sometimes AA can add an extra pixel or so.
+ int(math.ceil(self.font.max_glyph_height)))
+
+ # Glyphs are drawn at the baseline, and with LSB, so we need to offset it based on top left position.
+ baseline_offset = D2D_POINT_2F(-render_offset_x - offset.advanceOffset,
+ self.font.ascent + offset.ascenderOffset)
+
+ self._render_target.BeginDraw()
+
+ self._render_target.Clear(transparent)
+
+ self._render_target.DrawGlyphRun(baseline_offset,
+ run,
+ self._brush,
+ self.measuring_mode)
+
+ self._render_target.EndDraw(None, None)
+ image = wic_decoder.get_image(self._bitmap)
+
+ glyph = self.font.create_glyph(image)
+
+ glyph.set_bearings(-self.font.descent, render_offset_x,
+ advance,
+ offset.advanceOffset,
+ offset.ascenderOffset)
+
+ return glyph
+
+ def render_using_layout(self, text):
+ """This will render text given the built in DirectWrite layout. This process allows us to take
+ advantage of color glyphs and fallback handling that is built into DirectWrite.
+ This can also handle shaping and many other features if you want to render directly to a texture."""
+ text_layout = self.font.create_text_layout(text)
+
+ layout_metrics = DWRITE_TEXT_METRICS()
+ text_layout.GetMetrics(byref(layout_metrics))
+
+ width = int(math.ceil(layout_metrics.width))
+ height = int(math.ceil(layout_metrics.height))
+
+ if width == 0 or height == 0:
+ return None
+
+ self._create_bitmap(width, height)
+
+ # This offsets the characters if needed.
+ point = D2D_POINT_2F(0, 0)
+
+ self._render_target.BeginDraw()
+
+ self._render_target.Clear(transparent)
+
+ self._render_target.DrawTextLayout(point,
+ text_layout,
+ self._brush,
+ self.draw_options)
+
+ self._render_target.EndDraw(None, None)
+
+ image = wic_decoder.get_image(self._bitmap)
+
+ glyph = self.font.create_glyph(image)
+ glyph.set_bearings(-self.font.descent, 0, int(math.ceil(layout_metrics.width)))
+ return glyph
+
+ def create_zero_glyph(self):
+ """Zero glyph is a 1x1 image that has a -1 advance. This is to fill in for ligature substitutions since
+ font system requires 1 glyph per character in a string."""
+ self._create_bitmap(1, 1)
+ image = wic_decoder.get_image(self._bitmap)
+
+ glyph = self.font.create_glyph(image)
+ glyph.set_bearings(-self.font.descent, 0, -1)
+ return glyph
+
+ def _create_bitmap(self, width, height):
+ """Creates a bitmap using Direct2D and WIC."""
+ # Create a new bitmap, try to re-use the bitmap as much as we can to minimize creations.
+ if self._bitmap_dimensions[0] != width or self._bitmap_dimensions[1] != height:
+ # If dimensions aren't the same, release bitmap to create new ones.
+ if self._bitmap:
+ self._bitmap.Release()
+
+ self._bitmap = IWICBitmap()
+ wic_decoder._factory.CreateBitmap(width, height,
+ GUID_WICPixelFormat32bppPBGRA,
+ WICBitmapCacheOnDemand,
+ byref(self._bitmap))
+
+ self._render_target = ID2D1RenderTarget()
+ d2d_factory.CreateWicBitmapRenderTarget(self._bitmap, default_target_properties, byref(self._render_target))
+
+ # Font aliasing rendering quality.
+ self._render_target.SetTextAntialiasMode(self.antialias_mode)
+
+ if not self._brush:
+ self._brush = ID2D1SolidColorBrush()
+ self._render_target.CreateSolidColorBrush(white, None, byref(self._brush))
+
+
+class Win32DirectWriteFont(base.Font):
+ # To load fonts from files, we need to produce a custom collection.
+ _custom_collection = None
+
+ # Shared loader values
+ _write_factory = None # Factory required to run any DirectWrite interfaces.
+ _font_loader = None
+
+ # Windows 10 loader values.
+ _font_builder = None
+ _font_set = None
+
+ # Legacy loader values
+ _font_collection_loader = None
+ _font_cache = []
+ _font_loader_key = None
+
+ _default_name = 'Segoe UI' # Default font for Win7/10.
+
+ _glyph_renderer = None
+ _empty_glyph = None
+ _zero_glyph = None
+
+ glyph_renderer_class = DirectWriteGlyphRenderer
+ texture_internalformat = pyglet.gl.GL_RGBA
+
+ def __init__(self, name, size, bold=False, italic=False, stretch=False, dpi=None, locale=None):
+ self._filename: Optional[str] = None
+ self._advance_cache = {} # Stores glyph's by the indice and advance.
+
+ super(Win32DirectWriteFont, self).__init__()
+
+ if not name:
+ name = self._default_name
+
+ self._name = name
+ self.bold = bold
+ self.size = size
+ self.italic = italic
+ self.stretch = stretch
+ self.dpi = dpi
+ self.locale = locale
+
+ if self.locale is None:
+ self.locale = ""
+ self.rtl = False # Right to left should be handled by pyglet?
+ # TODO: Use system locale string?
+
+ if self.dpi is None:
+ self.dpi = 96
+
+ # From DPI to DIP (Device Independent Pixels) which is what the fonts rely on.
+ self._real_size = (self.size * self.dpi) // 72
+
+ if self.bold:
+ if type(self.bold) is str:
+ self._weight = name_to_weight[self.bold]
+ else:
+ self._weight = DWRITE_FONT_WEIGHT_BOLD
+ else:
+ self._weight = DWRITE_FONT_WEIGHT_NORMAL
+
+ if self.italic:
+ if type(self.italic) is str:
+ self._style = name_to_style[self.italic]
+ else:
+ self._style = DWRITE_FONT_STYLE_ITALIC
+ else:
+ self._style = DWRITE_FONT_STYLE_NORMAL
+
+ if self.stretch:
+ if type(self.stretch) is str:
+ self._stretch = name_to_stretch[self.stretch]
+ else:
+ self._stretch = DWRITE_FONT_STRETCH_EXPANDED
+ else:
+ self._stretch = DWRITE_FONT_STRETCH_NORMAL
+
+ self._font_index, self._collection = self.get_collection(name)
+ write_font = None
+ # If not font found, search all collections for legacy GDI naming.
+ if pyglet.options["dw_legacy_naming"]:
+ if self._font_index is None and self._collection is None:
+ write_font, self._collection = self.find_font_face(name, self._weight, self._style, self._stretch)
+
+ assert self._collection is not None, f"Font: '{name}' not found in loaded or system font collection."
+
+ if self._font_index is not None:
+ font_family = IDWriteFontFamily1()
+ self._collection.GetFontFamily(self._font_index, byref(font_family))
+
+ write_font = IDWriteFont()
+ font_family.GetFirstMatchingFont(
+ self._weight,
+ self._stretch,
+ self._style,
+ byref(write_font)
+ )
+
+ # Create the text format this font will use permanently.
+ # Could technically be recreated, but will keep to be inline with other font objects.
+ self._text_format = IDWriteTextFormat()
+ self._write_factory.CreateTextFormat(
+ self._name,
+ self._collection,
+ self._weight,
+ self._style,
+ self._stretch,
+ self._real_size,
+ create_unicode_buffer(self.locale),
+ byref(self._text_format)
+ )
+
+ font_face = IDWriteFontFace()
+ write_font.CreateFontFace(byref(font_face))
+
+ self.font_face = IDWriteFontFace1()
+ font_face.QueryInterface(IID_IDWriteFontFace1, byref(self.font_face))
+
+ self._font_metrics = DWRITE_FONT_METRICS()
+ self.font_face.GetMetrics(byref(self._font_metrics))
+
+ self.font_scale_ratio = (self._real_size / self._font_metrics.designUnitsPerEm)
+
+ self.ascent = math.ceil(self._font_metrics.ascent * self.font_scale_ratio)
+ self.descent = -round(self._font_metrics.descent * self.font_scale_ratio)
+ self.max_glyph_height = (self._font_metrics.ascent + self._font_metrics.descent) * self.font_scale_ratio
+
+ self.line_gap = self._font_metrics.lineGap * self.font_scale_ratio
+
+ self._fallback = None
+ if WINDOWS_8_1_OR_GREATER:
+ self._fallback = IDWriteFontFallback()
+ self._write_factory.GetSystemFontFallback(byref(self._fallback))
+ else:
+ assert _debug_print("Windows 8.1+ is required for font fallback. Colored glyphs cannot be omitted.")
+
+ @property
+ def filename(self):
+ """Returns a filename associated with the font face.
+ Note: Capable of returning more than 1 file in the future, but will do just one for now."""
+ if self._filename is not None:
+ return self._filename
+
+ file_ct = UINT32()
+ self.font_face.GetFiles(byref(file_ct), None)
+
+ font_files = (IDWriteFontFile * file_ct.value)()
+
+ self.font_face.GetFiles(byref(file_ct), font_files)
+
+ self._filename = "Not Available"
+
+ pff = font_files[0]
+
+ key_data = c_void_p()
+ ff_key_size = UINT32()
+
+ pff.GetReferenceKey(byref(key_data), byref(ff_key_size))
+
+ loader = IDWriteFontFileLoader()
+ pff.GetLoader(byref(loader))
+
+ try:
+ local_loader = IDWriteLocalFontFileLoader()
+ loader.QueryInterface(IID_IDWriteLocalFontFileLoader, byref(local_loader))
+ except OSError: # E_NOTIMPL
+ loader.Release()
+ pff.Release()
+ return self._filename
+
+ path_len = UINT32()
+ local_loader.GetFilePathLengthFromKey(key_data, ff_key_size, byref(path_len))
+
+ buffer = create_unicode_buffer(path_len.value + 1)
+ local_loader.GetFilePathFromKey(key_data, ff_key_size, buffer, len(buffer))
+
+ loader.Release()
+ local_loader.Release()
+ pff.Release()
+
+ self._filename = pathlib.PureWindowsPath(buffer.value).as_posix() # Convert to forward slashes.
+ return self._filename
+
+ @property
+ def name(self):
+ return self._name
+
+ def render_to_image(self, text, width=10000, height=80):
+ """This process takes Pyglet out of the equation and uses only DirectWrite to shape and render text.
+ This may allow more accurate fonts (bidi, rtl, etc) in very special circumstances at the cost of
+ additional texture space.
+
+ :Parameters:
+ `text` : str
+ String of text to render.
+
+ :rtype: `ImageData`
+ :return: An image of the text.
+ """
+ if not self._glyph_renderer:
+ self._glyph_renderer = self.glyph_renderer_class(self)
+
+ return self._glyph_renderer.render_to_image(text, width, height)
+
+ def copy_glyph(self, glyph, advance, offset):
+ """This takes the existing glyph texture and puts it into a new Glyph with a new advance.
+ Texture memory is shared between both glyphs."""
+ new_glyph = base.Glyph(glyph.x, glyph.y, glyph.z, glyph.width, glyph.height, glyph.owner)
+ new_glyph.set_bearings(
+ glyph.baseline,
+ glyph.lsb,
+ advance,
+ offset.advanceOffset,
+ offset.ascenderOffset
+ )
+ return new_glyph
+
+ def _render_layout_glyph(self, text_buffer, i, clusters, check_color=True):
+ # Some glyphs can be more than 1 char. We use the clusters to determine how many of an index exist.
+ text_length = clusters.count(i)
+
+ # Amount of glyphs don't always match 1:1 with text as some can be substituted or omitted. Get
+ # actual text buffer index.
+ text_index = clusters.index(i)
+
+ # Get actual text based on the index and length.
+ actual_text = text_buffer[text_index:text_index + text_length]
+
+ # Since we can't store as indice 0 without overriding, we have to store as text
+ if actual_text not in self.glyphs:
+ glyph = self._glyph_renderer.render_using_layout(text_buffer[text_index:text_index + text_length])
+ if glyph:
+ if check_color and self._glyph_renderer.draw_options & D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT:
+ fb_ff = self._get_fallback_font_face(text_index, text_length)
+ if fb_ff:
+ glyph.colored = self.is_fallback_str_colored(fb_ff, actual_text)
+ else:
+ glyph = self._empty_glyph
+
+ self.glyphs[actual_text] = glyph
+
+ return self.glyphs[actual_text]
+
+ def is_fallback_str_colored(self, font_face, text):
+ indice = UINT16()
+ code_points = (UINT32 * len(text))(*[ord(c) for c in text])
+
+ font_face.GetGlyphIndices(code_points, len(text), byref(indice))
+
+ new_indice = (UINT16 * 1)(indice)
+ new_advance = (FLOAT * 1)(100) # dummy
+ offset = (DWRITE_GLYPH_OFFSET * 1)()
+
+ run = self._glyph_renderer._get_single_glyph_run(
+ font_face,
+ self._real_size,
+ new_indice, # indice,
+ new_advance, # advance,
+ offset, # offset,
+ False,
+ False
+ )
+
+ return self._glyph_renderer.is_color_run(run)
+
+ def _get_fallback_font_face(self, text_index, text_length):
+ if WINDOWS_8_1_OR_GREATER:
+ out_length = UINT32()
+ fb_font = IDWriteFont()
+ scale = FLOAT()
+
+ self._fallback.MapCharacters(
+ self._glyph_renderer._text_analysis,
+ text_index,
+ text_length,
+ None,
+ None,
+ self._weight,
+ self._style,
+ self._stretch,
+ byref(out_length),
+ byref(fb_font),
+ byref(scale)
+ )
+
+ if fb_font:
+ fb_font_face = IDWriteFontFace()
+ fb_font.CreateFontFace(byref(fb_font_face))
+
+ return fb_font_face
+
+ return None
+
+ def get_glyphs_no_shape(self, text):
+ """This differs in that it does not attempt to shape the text at all. May be useful in cases where your font
+ has no special shaping requirements, spacing is the same, or some other reason where faster performance is
+ wanted and you can get away with this."""
+ if not self._glyph_renderer:
+ self._glyph_renderer = self.glyph_renderer_class(self)
+ self._empty_glyph = self._glyph_renderer.render_using_layout(" ")
+
+ glyphs = []
+ for c in text:
+ if c == '\t':
+ c = ' '
+
+ if c not in self.glyphs:
+ self.glyphs[c] = self._glyph_renderer.render_using_layout(c)
+ if not self.glyphs[c]:
+ self.glyphs[c] = self._empty_glyph
+
+ glyphs.append(self.glyphs[c])
+
+ return glyphs
+
+ def get_glyphs(self, text):
+ if not self._glyph_renderer:
+ self._glyph_renderer = self.glyph_renderer_class(self)
+ self._empty_glyph = self._glyph_renderer.render_using_layout(" ")
+ self._zero_glyph = self._glyph_renderer.create_zero_glyph()
+
+ text_buffer, actual_count, indices, advances, offsets, clusters = self._glyph_renderer.get_string_info(text,
+ self.font_face)
+
+ metrics = self._glyph_renderer.get_glyph_metrics(self.font_face, indices, actual_count)
+
+ formatted_clusters = list(clusters)
+
+ # Convert to real sizes.
+ for i in range(actual_count):
+ advances[i] *= self.font_scale_ratio
+
+ for i in range(actual_count):
+ offsets[i].advanceOffset *= self.font_scale_ratio
+ offsets[i].ascenderOffset *= self.font_scale_ratio
+
+ glyphs = []
+
+ # Pyglet expects 1 glyph for every string. However, ligatures can combine 1 or more glyphs, leading
+ # to issues with multilines producing wrong output.
+ substitutions = {}
+ for idx in clusters:
+ ct = formatted_clusters.count(idx)
+ if ct > 1:
+ substitutions[idx] = ct - 1
+
+ for i in range(actual_count):
+ indice = indices[i]
+
+ if indice == 0:
+ # If an indice is 0, it will return no glyph. In this case we attempt to render leveraging
+ # the built in text layout from MS. Which depending on version can use fallback fonts and other tricks
+ # to possibly get something of use.
+ glyph = self._render_layout_glyph(text_buffer, i, formatted_clusters)
+ glyphs.append(glyph)
+ else:
+ advance_key = (indice, advances[i], offsets[i].advanceOffset, offsets[i].ascenderOffset)
+
+ # Glyphs can vary depending on shaping. We will cache it by indice, advance, and offset.
+ # Possible to just cache without offset and set them each time. This may be faster?
+ if indice in self.glyphs:
+ if advance_key in self._advance_cache:
+ glyph = self._advance_cache[advance_key]
+ else:
+ glyph = self.copy_glyph(self.glyphs[indice], advances[i], offsets[i])
+ self._advance_cache[advance_key] = glyph
+ else:
+ glyph = self._glyph_renderer.render_single_glyph(self.font_face, indice, advances[i], offsets[i],
+ metrics[i])
+ if glyph is None: # Will only return None if a color glyph is found. Use DW to render it directly.
+ glyph = self._render_layout_glyph(text_buffer, i, formatted_clusters, check_color=False)
+ glyph.colored = True
+
+ self.glyphs[indice] = glyph
+ self._advance_cache[advance_key] = glyph
+
+ glyphs.append(glyph)
+
+ if i in substitutions:
+ for _ in range(substitutions[i]):
+ glyphs.append(self._zero_glyph)
+
+ return glyphs
+
+ def create_text_layout(self, text):
+ text_buffer = create_unicode_buffer(text)
+
+ text_layout = IDWriteTextLayout()
+ hr = self._write_factory.CreateTextLayout(text_buffer,
+ len(text_buffer),
+ self._text_format,
+ 10000, # Doesn't affect bitmap size.
+ 80,
+ byref(text_layout)
+ )
+
+ return text_layout
+
+ @classmethod
+ def _initialize_direct_write(cls):
+ """ All direct write fonts needs factory access as well as the loaders."""
+ if WINDOWS_10_CREATORS_UPDATE_OR_GREATER:
+ cls._write_factory = IDWriteFactory5()
+ guid = IID_IDWriteFactory5
+ elif WINDOWS_8_1_OR_GREATER:
+ cls._write_factory = IDWriteFactory2()
+ guid = IID_IDWriteFactory2
+ else:
+ cls._write_factory = IDWriteFactory()
+ guid = IID_IDWriteFactory
+
+ DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, guid, byref(cls._write_factory))
+
+ @classmethod
+ def _initialize_custom_loaders(cls):
+ """Initialize the loaders needed to load custom fonts."""
+ if WINDOWS_10_CREATORS_UPDATE_OR_GREATER:
+ # Windows 10 finally has a built in loader that can take data and make a font out of it w/ COMs.
+ cls._font_loader = IDWriteInMemoryFontFileLoader()
+ cls._write_factory.CreateInMemoryFontFileLoader(byref(cls._font_loader))
+ cls._write_factory.RegisterFontFileLoader(cls._font_loader)
+
+ # Used for grouping fonts together.
+ cls._font_builder = IDWriteFontSetBuilder1()
+ cls._write_factory.CreateFontSetBuilder1(byref(cls._font_builder))
+ else:
+ cls._font_loader = LegacyFontFileLoader()
+
+ # Note: RegisterFontLoader takes a pointer. However, for legacy we implement our own callback interface.
+ # Therefore we need to pass to the actual pointer directly.
+ cls._write_factory.RegisterFontFileLoader(cls._font_loader.pointers[IDWriteFontFileLoader_LI])
+
+ cls._font_collection_loader = LegacyCollectionLoader(cls._write_factory, cls._font_loader)
+ cls._write_factory.RegisterFontCollectionLoader(cls._font_collection_loader)
+
+ cls._font_loader_key = cast(create_unicode_buffer("legacy_font_loader"), c_void_p)
+
+ @classmethod
+ def add_font_data(cls, data):
+ if not cls._write_factory:
+ cls._initialize_direct_write()
+
+ if not cls._font_loader:
+ cls._initialize_custom_loaders()
+
+ if WINDOWS_10_CREATORS_UPDATE_OR_GREATER:
+ font_file = IDWriteFontFile()
+ hr = cls._font_loader.CreateInMemoryFontFileReference(cls._write_factory,
+ data,
+ len(data),
+ None,
+ byref(font_file))
+
+ hr = cls._font_builder.AddFontFile(font_file)
+ if hr != 0:
+ raise Exception("This font file data is not not a font or unsupported.")
+
+ # We have to rebuild collection everytime we add a font.
+ # No way to add fonts to the collection once the FontSet and Collection are created.
+ # Release old one and renew.
+ if cls._custom_collection:
+ cls._font_set.Release()
+ cls._custom_collection.Release()
+
+ cls._font_set = IDWriteFontSet()
+ cls._font_builder.CreateFontSet(byref(cls._font_set))
+
+ cls._custom_collection = IDWriteFontCollection1()
+ cls._write_factory.CreateFontCollectionFromFontSet(cls._font_set, byref(cls._custom_collection))
+
+ else:
+ cls._font_cache.append(data)
+
+ # If a collection exists, we need to completely remake the collection, delete everything and start over.
+ if cls._custom_collection:
+ cls._custom_collection = None
+
+ cls._write_factory.UnregisterFontCollectionLoader(cls._font_collection_loader)
+ cls._write_factory.UnregisterFontFileLoader(cls._font_loader)
+
+ cls._font_loader = LegacyFontFileLoader()
+ cls._font_collection_loader = LegacyCollectionLoader(cls._write_factory, cls._font_loader)
+
+ cls._write_factory.RegisterFontCollectionLoader(cls._font_collection_loader)
+ cls._write_factory.RegisterFontFileLoader(cls._font_loader.pointers[IDWriteFontFileLoader_LI])
+
+ cls._font_collection_loader.AddFontData(cls._font_cache)
+
+ cls._custom_collection = IDWriteFontCollection()
+
+ cls._write_factory.CreateCustomFontCollection(cls._font_collection_loader,
+ cls._font_loader_key,
+ sizeof(cls._font_loader_key),
+ byref(cls._custom_collection))
+
+ @classmethod
+ def get_collection(cls, font_name) -> Tuple[Optional[int], Optional[IDWriteFontCollection1]]:
+ """Returns which collection this font belongs to (system or custom collection), as well as its index in the
+ collection."""
+ if not cls._write_factory:
+ cls._initialize_direct_write()
+
+ """Returns a collection the font_name belongs to."""
+ font_index = UINT()
+ font_exists = BOOL()
+
+ # Check custom loaded font collections.
+ if cls._custom_collection:
+ cls._custom_collection.FindFamilyName(create_unicode_buffer(font_name),
+ byref(font_index),
+ byref(font_exists))
+
+ if font_exists.value:
+ return font_index.value, cls._custom_collection
+
+ # Check if font is in the system collection.
+ # Do not cache these values permanently as system font collection can be updated during runtime.
+ sys_collection = IDWriteFontCollection()
+ if not font_exists.value:
+ cls._write_factory.GetSystemFontCollection(byref(sys_collection), 1)
+ sys_collection.FindFamilyName(create_unicode_buffer(font_name),
+ byref(font_index),
+ byref(font_exists))
+
+ if font_exists.value:
+ return font_index.value, sys_collection
+
+ return None, None
+
+ @classmethod
+ def find_font_face(cls, font_name, bold, italic, stretch) -> Tuple[
+ Optional[IDWriteFont], Optional[IDWriteFontCollection]]:
+ """This will search font collections for legacy RBIZ names. However, matching to bold, italic, stretch is
+ problematic in that there are many values. We parse the font name looking for matches to the name database,
+ and attempt to pick the closest match.
+ This will search all fonts on the system and custom loaded, and all of their font faces. Returns a collection
+ and IDWriteFont if successful.
+ """
+ p_bold, p_italic, p_stretch = cls.parse_name(font_name, bold, italic, stretch)
+
+ _debug_print(f"directwrite: '{font_name}' not found. Attempting legacy name lookup in all collections.")
+ collection_idx = cls.find_legacy_font(cls._custom_collection, font_name, p_bold, p_italic, p_stretch)
+ if collection_idx is not None:
+ return collection_idx, cls._custom_collection
+
+ sys_collection = IDWriteFontCollection()
+ cls._write_factory.GetSystemFontCollection(byref(sys_collection), 1)
+
+ collection_idx = cls.find_legacy_font(sys_collection, font_name, p_bold, p_italic, p_stretch)
+ if collection_idx is not None:
+ return collection_idx, sys_collection
+
+ return None, None
+
+ @classmethod
+ def have_font(cls, name: str):
+ if cls.get_collection(name)[0] is not None:
+ return True
+
+ return False
+
+ @staticmethod
+ def parse_name(font_name: str, weight: int, style: int, stretch: int):
+ """Attempt at parsing any special names in a font for legacy checks. Takes the first found."""
+
+ font_name = font_name.lower()
+ split_name = font_name.split(' ')
+
+ found_weight = weight
+ found_style = style
+ found_stretch = stretch
+
+ # Only search if name is split more than once.
+ if len(split_name) > 1:
+ for name, value in name_to_weight.items():
+ if name in split_name:
+ found_weight = value
+ break
+
+ for name, value in name_to_style.items():
+ if name in split_name:
+ found_style = value
+ break
+
+ for name, value in name_to_stretch.items():
+ if name in split_name:
+ found_stretch = value
+ break
+
+ return found_weight, found_style, found_stretch
+
+ @staticmethod
+ def find_legacy_font(collection: IDWriteFontCollection, font_name: str, bold, italic, stretch, full_debug=False) -> \
+ Optional[IDWriteFont]:
+ coll_count = collection.GetFontFamilyCount()
+
+ assert _debug_print(f"directwrite: Found {coll_count} fonts in collection.")
+
+ locale = get_system_locale()
+
+ for i in range(coll_count):
+ family = IDWriteFontFamily()
+ collection.GetFontFamily(i, byref(family))
+
+ # Just check the first character in Family Names to reduce search time. Arial -> A's only.
+ family_name_str = IDWriteLocalizedStrings()
+ family.GetFamilyNames(byref(family_name_str))
+
+ family_names = Win32DirectWriteFont.unpack_localized_string(family_name_str, locale)
+ family_name = family_names[0]
+
+ if family_name[0] != font_name[0]:
+ family.Release()
+ continue
+
+ assert _debug_print(f"directwrite: Inspecting family name: {family_name}")
+
+ # Fonts in the family. Full search to search all font faces, typically the first will be good enough to tell
+ ft_ct = family.GetFontCount()
+
+ face_names = []
+ matches = []
+ for j in range(ft_ct):
+ temp_ft = IDWriteFont()
+ family.GetFont(j, byref(temp_ft))
+
+ if _debug_font and full_debug:
+ fc_str = IDWriteLocalizedStrings()
+ temp_ft.GetFaceNames(byref(fc_str))
+
+ strings = Win32DirectWriteFont.unpack_localized_string(fc_str, locale)
+ face_names.extend(strings)
+
+ print(f"directwrite: Face names found: {strings}")
+
+ # Check for GDI compatibility name
+ compat_names = IDWriteLocalizedStrings()
+ exists = BOOL()
+ temp_ft.GetInformationalStrings(DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES,
+ byref(compat_names),
+ byref(exists))
+
+ # Successful in finding GDI name.
+ match_found = False
+ if exists.value != 0:
+ for compat_name in Win32DirectWriteFont.unpack_localized_string(compat_names, locale):
+ if compat_name == font_name:
+ assert _debug_print(
+ f"Found legacy name '{font_name}' as '{family_name}' in font face '{j}' (collection id #{i}).")
+
+ match_found = True
+ matches.append((temp_ft.GetWeight(), temp_ft.GetStyle(), temp_ft.GetStretch(), temp_ft))
+ break
+
+ # Release resource if not a match.
+ if not match_found:
+ temp_ft.Release()
+
+ family.Release()
+
+ # If we have matches, we've already parsed through the proper family. Now try to match.
+ if matches:
+ write_font = Win32DirectWriteFont.match_closest_font(matches, bold, italic, stretch)
+
+ # Cleanup other matches not used.
+ for match in matches:
+ if match[3] != write_font:
+ match[3].Release() # Release all other matches.
+
+ return write_font
+
+ return None
+
+ @staticmethod
+ def match_closest_font(font_list: List[Tuple[int, int, int, IDWriteFont]], bold: int, italic: int, stretch: int) -> \
+ Optional[IDWriteFont]:
+ """Match the closest font to the parameters specified. If a full match is not found, a secondary match will be
+ found based on similar features. This can probably be improved, but it is possible you could get a different
+ font style than expected."""
+ closest = []
+ for match in font_list:
+ (f_weight, f_style, f_stretch, writefont) = match
+
+ # Found perfect match, no need for the rest.
+ if f_weight == bold and f_style == italic and f_stretch == stretch:
+ _debug_print(
+ f"directwrite: full match found. (bold: {f_weight}, italic: {f_style}, stretch: {f_stretch})")
+ return writefont
+
+ prop_match = 0
+ similar_match = 0
+ # Look for a full match, otherwise look for close enough.
+ # For example, Arial Black only has Oblique, not Italic, but good enough if you want slanted text.
+ if f_weight == bold:
+ prop_match += 1
+ elif bold != DWRITE_FONT_WEIGHT_NORMAL and f_weight != DWRITE_FONT_WEIGHT_NORMAL:
+ similar_match += 1
+
+ if f_style == italic:
+ prop_match += 1
+ elif italic != DWRITE_FONT_STYLE_NORMAL and f_style != DWRITE_FONT_STYLE_NORMAL:
+ similar_match += 1
+
+ if stretch == f_stretch:
+ prop_match += 1
+ elif stretch != DWRITE_FONT_STRETCH_NORMAL and f_stretch != DWRITE_FONT_STRETCH_NORMAL:
+ similar_match += 1
+
+ closest.append((prop_match, similar_match, *match))
+
+ # If we get here, no perfect match, sort by highest perfect match, to secondary matches.
+ closest.sort(key=lambda fts: (fts[0], fts[1]), reverse=True)
+
+ if closest:
+ # Take the first match after sorting.
+ closest_match = closest[0]
+ _debug_print(f"directwrite: falling back to partial match. "
+ f"(bold: {closest_match[2]}, italic: {closest_match[3]}, stretch: {closest_match[4]})")
+ return closest_match[5]
+
+ return None
+
+ @staticmethod
+ def unpack_localized_string(local_string: IDWriteLocalizedStrings, locale: str) -> List[str]:
+ """Takes IDWriteLocalizedStrings and unpacks the strings inside of it into a list."""
+ str_array_len = local_string.GetCount()
+
+ strings = []
+ for _ in range(str_array_len):
+ string_size = UINT32()
+
+ idx = Win32DirectWriteFont.get_localized_index(local_string, locale)
+
+ local_string.GetStringLength(idx, byref(string_size))
+
+ buffer_size = string_size.value
+
+ buffer = create_unicode_buffer(buffer_size + 1)
+
+ local_string.GetString(idx, buffer, len(buffer))
+
+ strings.append(buffer.value)
+
+ local_string.Release()
+
+ return strings
+
+ @staticmethod
+ def get_localized_index(strings: IDWriteLocalizedStrings, locale: str):
+ idx = UINT32()
+ exists = BOOL()
+
+ if locale:
+ strings.FindLocaleName(locale, byref(idx), byref(exists))
+
+ if not exists.value:
+ # fallback to english.
+ strings.FindLocaleName('en-us', byref(idx), byref(exists))
+
+ if not exists:
+ return 0
+
+ return idx.value
+
+ return 0
+
+
+d2d_factory = ID2D1Factory()
+hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, IID_ID2D1Factory, None, byref(d2d_factory))
+
+WICBitmapCreateCacheOption = UINT
+WICBitmapNoCache = 0
+WICBitmapCacheOnDemand = 0x1
+WICBitmapCacheOnLoad = 0x2
+
+transparent = D2D1_COLOR_F(0.0, 0.0, 0.0, 0.0)
+white = D2D1_COLOR_F(1.0, 1.0, 1.0, 1.0)
+no_offset = D2D_POINT_2F(0, 0)
+
+# If we are not shaping, monkeypatch to no shape function.
+if pyglet.options["win32_disable_shaping"]:
+ Win32DirectWriteFont.get_glyphs = Win32DirectWriteFont.get_glyphs_no_shape
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/fontconfig.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/fontconfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..a15f617d246e908373fa50cb73e6581b4157087f
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/fontconfig.py
@@ -0,0 +1,362 @@
+"""
+Wrapper around the Linux FontConfig library. Used to find available fonts.
+"""
+
+from collections import OrderedDict
+from ctypes import *
+
+import pyglet.lib
+from pyglet.util import asbytes, asstr
+from pyglet.font.base import FontException
+
+
+# fontconfig library definitions
+
+(FcResultMatch,
+ FcResultNoMatch,
+ FcResultTypeMismatch,
+ FcResultNoId,
+ FcResultOutOfMemory) = range(5)
+FcResult = c_int
+
+FC_FAMILY = asbytes('family')
+FC_SIZE = asbytes('size')
+FC_SLANT = asbytes('slant')
+FC_WEIGHT = asbytes('weight')
+FC_FT_FACE = asbytes('ftface')
+FC_FILE = asbytes('file')
+
+FC_WEIGHT_REGULAR = 80
+FC_WEIGHT_BOLD = 200
+
+FC_SLANT_ROMAN = 0
+FC_SLANT_ITALIC = 100
+
+(FcTypeVoid,
+ FcTypeInteger,
+ FcTypeDouble,
+ FcTypeString,
+ FcTypeBool,
+ FcTypeMatrix,
+ FcTypeCharSet,
+ FcTypeFTFace,
+ FcTypeLangSet) = range(9)
+FcType = c_int
+
+(FcMatchPattern,
+ FcMatchFont) = range(2)
+FcMatchKind = c_int
+
+
+class _FcValueUnion(Union):
+ _fields_ = [
+ ('s', c_char_p),
+ ('i', c_int),
+ ('b', c_int),
+ ('d', c_double),
+ ('m', c_void_p),
+ ('c', c_void_p),
+ ('f', c_void_p),
+ ('p', c_void_p),
+ ('l', c_void_p),
+ ]
+
+
+class FcValue(Structure):
+ _fields_ = [
+ ('type', FcType),
+ ('u', _FcValueUnion)
+ ]
+
+# End of library definitions
+
+
+class FontConfig:
+ def __init__(self):
+ self._fontconfig = self._load_fontconfig_library()
+ self._search_cache = OrderedDict()
+ self._cache_size = 20
+
+ def dispose(self):
+ while len(self._search_cache) > 0:
+ self._search_cache.popitem().dispose()
+
+ self._fontconfig.FcFini()
+ self._fontconfig = None
+
+ def create_search_pattern(self):
+ return FontConfigSearchPattern(self._fontconfig)
+
+ def find_font(self, name, size=12, bold=False, italic=False):
+ result = self._get_from_search_cache(name, size, bold, italic)
+ if result:
+ return result
+
+ search_pattern = self.create_search_pattern()
+ search_pattern.name = name
+ search_pattern.size = size
+ search_pattern.bold = bold
+ search_pattern.italic = italic
+
+ result = search_pattern.match()
+ self._add_to_search_cache(search_pattern, result)
+ search_pattern.dispose()
+ return result
+
+ def have_font(self, name):
+ result = self.find_font(name)
+ if result:
+ # Check the name matches, fontconfig can return a default
+ if name and result.name and result.name.lower() != name.lower():
+ return False
+ return True
+ else:
+ return False
+
+ def char_index(self, ft_face, character):
+ return self._fontconfig.FcFreeTypeCharIndex(ft_face, ord(character))
+
+ def _add_to_search_cache(self, search_pattern, result_pattern):
+ self._search_cache[(search_pattern.name,
+ search_pattern.size,
+ search_pattern.bold,
+ search_pattern.italic)] = result_pattern
+ if len(self._search_cache) > self._cache_size:
+ self._search_cache.popitem(last=False)[1].dispose()
+
+ def _get_from_search_cache(self, name, size, bold, italic):
+ result = self._search_cache.get((name, size, bold, italic), None)
+
+ if result and result.is_valid:
+ return result
+ else:
+ return None
+
+ @staticmethod
+ def _load_fontconfig_library():
+ fontconfig = pyglet.lib.load_library('fontconfig')
+ fontconfig.FcInit()
+
+ fontconfig.FcPatternBuild.restype = c_void_p
+ fontconfig.FcPatternCreate.restype = c_void_p
+ fontconfig.FcFontMatch.restype = c_void_p
+ fontconfig.FcFreeTypeCharIndex.restype = c_uint
+
+ fontconfig.FcPatternAddDouble.argtypes = [c_void_p, c_char_p, c_double]
+ fontconfig.FcPatternAddInteger.argtypes = [c_void_p, c_char_p, c_int]
+ fontconfig.FcPatternAddString.argtypes = [c_void_p, c_char_p, c_char_p]
+ fontconfig.FcConfigSubstitute.argtypes = [c_void_p, c_void_p, c_int]
+ fontconfig.FcDefaultSubstitute.argtypes = [c_void_p]
+ fontconfig.FcFontMatch.argtypes = [c_void_p, c_void_p, c_void_p]
+ fontconfig.FcPatternDestroy.argtypes = [c_void_p]
+
+ fontconfig.FcPatternGetFTFace.argtypes = [c_void_p, c_char_p, c_int, c_void_p]
+ fontconfig.FcPatternGet.argtypes = [c_void_p, c_char_p, c_int, c_void_p]
+
+ return fontconfig
+
+
+class FontConfigPattern:
+ def __init__(self, fontconfig, pattern=None):
+ self._fontconfig = fontconfig
+ self._pattern = pattern
+
+ @property
+ def is_valid(self):
+ return self._fontconfig and self._pattern
+
+ def _create(self):
+ assert not self._pattern
+ assert self._fontconfig
+ self._pattern = self._fontconfig.FcPatternCreate()
+
+ def _destroy(self):
+ assert self._pattern
+ assert self._fontconfig
+ self._fontconfig.FcPatternDestroy(self._pattern)
+ self._pattern = None
+
+ @staticmethod
+ def _bold_to_weight(bold):
+ return FC_WEIGHT_BOLD if bold else FC_WEIGHT_REGULAR
+
+ @staticmethod
+ def _italic_to_slant(italic):
+ return FC_SLANT_ITALIC if italic else FC_SLANT_ROMAN
+
+ def _set_string(self, name, value):
+ assert self._pattern
+ assert name
+ assert self._fontconfig
+
+ if not value:
+ return
+
+ value = value.encode('utf8')
+
+ self._fontconfig.FcPatternAddString(self._pattern, name, asbytes(value))
+
+ def _set_double(self, name, value):
+ assert self._pattern
+ assert name
+ assert self._fontconfig
+
+ if not value:
+ return
+
+ self._fontconfig.FcPatternAddDouble(self._pattern, name, c_double(value))
+
+ def _set_integer(self, name, value):
+ assert self._pattern
+ assert name
+ assert self._fontconfig
+
+ if not value:
+ return
+
+ self._fontconfig.FcPatternAddInteger(self._pattern, name, c_int(value))
+
+ def _get_value(self, name):
+ assert self._pattern
+ assert name
+ assert self._fontconfig
+
+ value = FcValue()
+ result = self._fontconfig.FcPatternGet(self._pattern, name, 0, byref(value))
+ if _handle_fcresult(result):
+ return value
+ else:
+ return None
+
+ def _get_string(self, name):
+ value = self._get_value(name)
+
+ if value and value.type == FcTypeString:
+ return asstr(value.u.s)
+ else:
+ return None
+
+ def _get_face(self, name):
+ value = self._get_value(name)
+
+ if value and value.type == FcTypeFTFace:
+ return value.u.f
+ else:
+ return None
+
+ def _get_integer(self, name):
+ value = self._get_value(name)
+
+ if value and value.type == FcTypeInteger:
+ return value.u.i
+ else:
+ return None
+
+ def _get_double(self, name):
+ value = self._get_value(name)
+
+ if value and value.type == FcTypeDouble:
+ return value.u.d
+ else:
+ return None
+
+
+class FontConfigSearchPattern(FontConfigPattern):
+ def __init__(self, fontconfig):
+ super(FontConfigSearchPattern, self).__init__(fontconfig)
+
+ self.name = None
+ self.bold = False
+ self.italic = False
+ self.size = None
+
+ def match(self):
+ self._prepare_search_pattern()
+ result_pattern = self._get_match()
+
+ if result_pattern:
+ return FontConfigSearchResult(self._fontconfig, result_pattern)
+ else:
+ return None
+
+ def _prepare_search_pattern(self):
+ self._create()
+ self._set_string(FC_FAMILY, self.name)
+ self._set_double(FC_SIZE, self.size)
+ self._set_integer(FC_WEIGHT, self._bold_to_weight(self.bold))
+ self._set_integer(FC_SLANT, self._italic_to_slant(self.italic))
+
+ self._substitute_defaults()
+
+ def _substitute_defaults(self):
+ assert self._pattern
+ assert self._fontconfig
+
+ self._fontconfig.FcConfigSubstitute(None, self._pattern, FcMatchPattern)
+ self._fontconfig.FcDefaultSubstitute(self._pattern)
+
+ def _get_match(self):
+ assert self._pattern
+ assert self._fontconfig
+
+ match_result = FcResult()
+ match_pattern = self._fontconfig.FcFontMatch(0, self._pattern, byref(match_result))
+
+ if _handle_fcresult(match_result.value):
+ return match_pattern
+ else:
+ return None
+
+ def dispose(self):
+ self._destroy()
+
+
+class FontConfigSearchResult(FontConfigPattern):
+ def __init__(self, fontconfig, result_pattern):
+ super(FontConfigSearchResult, self).__init__(fontconfig, result_pattern)
+
+ @property
+ def name(self):
+ return self._get_string(FC_FAMILY)
+
+ @property
+ def size(self):
+ return self._get_double(FC_SIZE)
+
+ @property
+ def bold(self):
+ return self._get_integer(FC_WEIGHT) == FC_WEIGHT_BOLD
+
+ @property
+ def italic(self):
+ return self._get_integer(FC_SLANT) == FC_SLANT_ITALIC
+
+ @property
+ def face(self):
+ return self._get_face(FC_FT_FACE)
+
+ @property
+ def file(self):
+ return self._get_string(FC_FILE)
+
+ def dispose(self):
+ self._destroy()
+
+
+def _handle_fcresult(result):
+ if result == FcResultMatch:
+ return True
+ elif result in (FcResultNoMatch, FcResultTypeMismatch, FcResultNoId):
+ return False
+ elif result == FcResultOutOfMemory:
+ raise FontException('FontConfig ran out of memory.')
+
+
+_fontconfig_instance = None
+
+
+def get_fontconfig():
+ global _fontconfig_instance
+ if not _fontconfig_instance:
+ _fontconfig_instance = FontConfig()
+ return _fontconfig_instance
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/freetype.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/freetype.py
new file mode 100644
index 0000000000000000000000000000000000000000..e6d3d7cf856e91644a559f5fad292da839483709
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/freetype.py
@@ -0,0 +1,350 @@
+import ctypes
+import warnings
+from collections import namedtuple
+
+from pyglet.util import asbytes, asstr
+from pyglet.font import base
+from pyglet import image
+from pyglet.font.fontconfig import get_fontconfig
+from pyglet.font.freetype_lib import *
+
+
+class FreeTypeGlyphRenderer(base.GlyphRenderer):
+ def __init__(self, font):
+ super().__init__(font)
+ self.font = font
+
+ self._glyph_slot = None
+ self._bitmap = None
+
+ self._width = None
+ self._height = None
+ self._mode = None
+ self._pitch = None
+
+ self._baseline = None
+ self._lsb = None
+ self._advance_x = None
+
+ self._data = None
+
+ def _get_glyph(self, character):
+ assert self.font
+ assert len(character) == 1
+
+ self._glyph_slot = self.font.get_glyph_slot(character)
+ self._bitmap = self._glyph_slot.bitmap
+
+ def _get_glyph_metrics(self):
+ self._width = self._glyph_slot.bitmap.width
+ self._height = self._glyph_slot.bitmap.rows
+ self._mode = self._glyph_slot.bitmap.pixel_mode
+ self._pitch = self._glyph_slot.bitmap.pitch
+
+ self._baseline = self._height - self._glyph_slot.bitmap_top
+ self._lsb = self._glyph_slot.bitmap_left
+ self._advance_x = int(f26p6_to_float(self._glyph_slot.advance.x))
+
+ def _get_bitmap_data(self):
+ if self._mode == FT_PIXEL_MODE_MONO:
+ # BCF fonts always render to 1 bit mono, regardless of render
+ # flags. (freetype 2.3.5)
+ self._convert_mono_to_gray_bitmap()
+ elif self._mode == FT_PIXEL_MODE_GRAY:
+ # Usual case
+ assert self._glyph_slot.bitmap.num_grays == 256
+ self._data = self._glyph_slot.bitmap.buffer
+ else:
+ raise base.FontException('Unsupported render mode for this glyph')
+
+ def _convert_mono_to_gray_bitmap(self):
+ bitmap_data = cast(self._bitmap.buffer,
+ POINTER(c_ubyte * (self._pitch * self._height))).contents
+ data = (c_ubyte * (self._pitch * 8 * self._height))()
+ data_i = 0
+ for byte in bitmap_data:
+ # Data is MSB; left-most pixel in a byte has value 128.
+ data[data_i + 0] = (byte & 0x80) and 255 or 0
+ data[data_i + 1] = (byte & 0x40) and 255 or 0
+ data[data_i + 2] = (byte & 0x20) and 255 or 0
+ data[data_i + 3] = (byte & 0x10) and 255 or 0
+ data[data_i + 4] = (byte & 0x08) and 255 or 0
+ data[data_i + 5] = (byte & 0x04) and 255 or 0
+ data[data_i + 6] = (byte & 0x02) and 255 or 0
+ data[data_i + 7] = (byte & 0x01) and 255 or 0
+ data_i += 8
+ self._data = data
+ self._pitch <<= 3
+
+ def _create_glyph(self):
+ # In FT positive pitch means `down` flow, in Pyglet ImageData
+ # negative values indicate a top-to-bottom arrangement. So pitch must be inverted.
+ # Using negative pitch causes conversions, so much faster to just swap tex_coords
+ img = image.ImageData(self._width,
+ self._height,
+ 'A',
+ self._data,
+ abs(self._pitch))
+
+ # HACK: Get text working in GLES until image data can be converted properly
+ # GLES don't support coversion during pixel transfer so we have to
+ # force specify the glyph format to be GL_ALPHA. This format is not
+ # supported in 3.3+ core, but are present in ES because of pixel transfer
+ # limitations.
+ if pyglet.gl.current_context.get_info().get_opengl_api() == "gles":
+ GL_ALPHA = 0x1906
+ glyph = self.font.create_glyph(img, fmt=GL_ALPHA)
+ else:
+ glyph = self.font.create_glyph(img)
+
+ glyph.set_bearings(self._baseline, self._lsb, self._advance_x)
+ if self._pitch > 0:
+ t = list(glyph.tex_coords)
+ glyph.tex_coords = t[9:12] + t[6:9] + t[3:6] + t[:3]
+
+ return glyph
+
+ def render(self, text):
+ self._get_glyph(text[0])
+ self._get_glyph_metrics()
+ self._get_bitmap_data()
+ return self._create_glyph()
+
+
+FreeTypeFontMetrics = namedtuple('FreeTypeFontMetrics', ['ascent', 'descent'])
+
+
+class MemoryFaceStore:
+ def __init__(self):
+ self._dict = {}
+
+ def add(self, face):
+ self._dict[face.name.lower(), face.bold, face.italic] = face
+
+ def contains(self, name):
+ lname = name and name.lower() or ''
+ return len([name for name, _, _ in self._dict.keys() if name == lname]) > 0
+
+ def get(self, name, bold, italic):
+ lname = name and name.lower() or ''
+ return self._dict.get((lname, bold, italic), None)
+
+
+class FreeTypeFont(base.Font):
+ glyph_renderer_class = FreeTypeGlyphRenderer
+
+ # Map font (name, bold, italic) to FreeTypeMemoryFace
+ _memory_faces = MemoryFaceStore()
+
+ def __init__(self, name, size, bold=False, italic=False, stretch=False, dpi=None):
+ # assert type(bold) is bool, "Only a boolean value is supported for bold in the current font renderer."
+ # assert type(italic) is bool, "Only a boolean value is supported for bold in the current font renderer."
+
+ if stretch:
+ warnings.warn("The current font render does not support stretching.")
+
+ super().__init__()
+ self._name = name
+ self.size = size
+ self.bold = bold
+ self.italic = italic
+ self.dpi = dpi or 96
+
+ self._load_font_face()
+ self.metrics = self.face.get_font_metrics(self.size, self.dpi)
+
+ @property
+ def name(self):
+ return self.face.family_name
+
+ @property
+ def ascent(self):
+ return self.metrics.ascent
+
+ @property
+ def descent(self):
+ return self.metrics.descent
+
+ def get_glyph_slot(self, character):
+ glyph_index = self.face.get_character_index(character)
+ self.face.set_char_size(self.size, self.dpi)
+ return self.face.get_glyph_slot(glyph_index)
+
+ def _load_font_face(self):
+ self.face = self._memory_faces.get(self._name, self.bold, self.italic)
+ if self.face is None:
+ self._load_font_face_from_system()
+
+ def _load_font_face_from_system(self):
+ match = get_fontconfig().find_font(self._name, self.size, self.bold, self.italic)
+ if not match:
+ raise base.FontException(f"Could not match font '{self._name}'")
+ self.filename = match.file
+ self.face = FreeTypeFace.from_fontconfig(match)
+
+ @classmethod
+ def have_font(cls, name):
+ if cls._memory_faces.contains(name):
+ return True
+ else:
+ return get_fontconfig().have_font(name)
+
+ @classmethod
+ def add_font_data(cls, data):
+ face = FreeTypeMemoryFace(data)
+ cls._memory_faces.add(face)
+
+
+class FreeTypeFace:
+ """FreeType typographic face object.
+
+ Keeps the reference count to the face at +1 as long as this object exists. If other objects
+ want to keep a face without a reference to this object, they should increase the reference
+ counter themselves and decrease it again when done.
+ """
+ def __init__(self, ft_face):
+ assert ft_face is not None
+ self.ft_face = ft_face
+ self._get_best_name()
+
+ @classmethod
+ def from_file(cls, file_name):
+ ft_library = ft_get_library()
+ ft_face = FT_Face()
+ FT_New_Face(ft_library,
+ asbytes(file_name),
+ 0,
+ byref(ft_face))
+ return cls(ft_face)
+
+ @classmethod
+ def from_fontconfig(cls, match):
+ if match.face is not None:
+ FT_Reference_Face(match.face)
+ return cls(match.face)
+ else:
+ if not match.file:
+ raise base.FontException(f'No filename for "{match.name}"')
+ return cls.from_file(match.file)
+
+ @property
+ def name(self):
+ return self._name
+
+ @property
+ def family_name(self):
+ return asstr(self.ft_face.contents.family_name)
+
+ @property
+ def style_flags(self):
+ return self.ft_face.contents.style_flags
+
+ @property
+ def bold(self):
+ return self.style_flags & FT_STYLE_FLAG_BOLD != 0
+
+ @property
+ def italic(self):
+ return self.style_flags & FT_STYLE_FLAG_ITALIC != 0
+
+ @property
+ def face_flags(self):
+ return self.ft_face.contents.face_flags
+
+ def __del__(self):
+ if self.ft_face is not None:
+ FT_Done_Face(self.ft_face)
+ self.ft_face = None
+
+ def set_char_size(self, size, dpi):
+ face_size = float_to_f26p6(size)
+ try:
+ FT_Set_Char_Size(self.ft_face,
+ 0,
+ face_size,
+ dpi,
+ dpi)
+ return True
+ except FreeTypeError as e:
+ # Error 0x17 indicates invalid pixel size, so font size cannot be changed
+ # TODO Warn the user?
+ if e.errcode == 0x17:
+ return False
+ else:
+ raise
+
+ def get_character_index(self, character):
+ return get_fontconfig().char_index(self.ft_face, character)
+
+ def get_glyph_slot(self, glyph_index):
+ FT_Load_Glyph(self.ft_face, glyph_index, FT_LOAD_RENDER)
+ return self.ft_face.contents.glyph.contents
+
+ def get_font_metrics(self, size, dpi):
+ if self.set_char_size(size, dpi):
+ metrics = self.ft_face.contents.size.contents.metrics
+ if metrics.ascender == 0 and metrics.descender == 0:
+ return self._get_font_metrics_workaround()
+ else:
+ return FreeTypeFontMetrics(ascent=int(f26p6_to_float(metrics.ascender)),
+ descent=int(f26p6_to_float(metrics.descender)))
+ else:
+ return self._get_font_metrics_workaround()
+
+ def _get_font_metrics_workaround(self):
+ # Workaround broken fonts with no metrics. Has been observed with
+ # courR12-ISO8859-1.pcf.gz: "Courier" "Regular"
+ #
+ # None of the metrics fields are filled in, so render a glyph and
+ # grab its height as the ascent, and make up an arbitrary
+ # descent.
+ i = self.get_character_index('X')
+ self.get_glyph_slot(i)
+ ascent=self.ft_face.contents.available_sizes.contents.height
+ return FreeTypeFontMetrics(ascent=ascent,
+ descent=-ascent // 4) # arbitrary.
+
+ def _get_best_name(self):
+ self._name = asstr(self.ft_face.contents.family_name)
+ self._get_font_family_from_ttf
+
+ def _get_font_family_from_ttf(self):
+ # Replace Freetype's generic family name with TTF/OpenType specific
+ # name if we can find one; there are some instances where Freetype
+ # gets it wrong.
+
+ return # FIXME: This is broken
+
+ if self.face_flags & FT_FACE_FLAG_SFNT:
+ name = FT_SfntName()
+ for i in range(FT_Get_Sfnt_Name_Count(self.ft_face)):
+ try:
+ FT_Get_Sfnt_Name(self.ft_face, i, name)
+ if not (name.platform_id == TT_PLATFORM_MICROSOFT and
+ name.encoding_id == TT_MS_ID_UNICODE_CS):
+ continue
+ # name.string is not 0 terminated! use name.string_len
+ self._name = name.string.decode('utf-16be', 'ignore')
+ except:
+ continue
+
+
+class FreeTypeMemoryFace(FreeTypeFace):
+ def __init__(self, data):
+ self._copy_font_data(data)
+ super().__init__(self._create_font_face())
+
+ def _copy_font_data(self, data):
+ self.font_data = (FT_Byte * len(data))()
+ ctypes.memmove(self.font_data, data, len(data))
+
+ def _create_font_face(self):
+ ft_library = ft_get_library()
+ ft_face = FT_Face()
+ FT_New_Memory_Face(ft_library,
+ self.font_data,
+ len(self.font_data),
+ 0,
+ byref(ft_face))
+ return ft_face
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/freetype_lib.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/freetype_lib.py
new file mode 100644
index 0000000000000000000000000000000000000000..7672eb8cd8cb0cd2925165e91c5bc0f0a8977ca2
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/freetype_lib.py
@@ -0,0 +1,558 @@
+from ctypes import *
+from .base import FontException
+import pyglet.lib
+
+_libfreetype = pyglet.lib.load_library('freetype')
+
+_font_data = {}
+
+
+def _get_function(name, argtypes, rtype):
+ try:
+ func = getattr(_libfreetype, name)
+ func.argtypes = argtypes
+ func.restype = rtype
+ return func
+ except AttributeError as e:
+ raise ImportError(e)
+
+
+FT_Byte = c_char
+FT_Bytes = POINTER(FT_Byte)
+FT_Char = c_byte
+FT_Int = c_int
+FT_UInt = c_uint
+FT_Int16 = c_int16
+FT_UInt16 = c_uint16
+FT_Int32 = c_int32
+FT_UInt32 = c_uint32
+FT_Int64 = c_int64
+FT_UInt64 = c_uint64
+FT_Short = c_short
+FT_UShort = c_ushort
+FT_Long = c_long
+FT_ULong = c_ulong
+FT_Bool = c_char
+FT_Offset = c_size_t
+# FT_PtrDist = ?
+FT_String = c_char
+FT_String_Ptr = c_char_p
+FT_Tag = FT_UInt32
+FT_Error = c_int
+FT_Fixed = c_long
+FT_Pointer = c_void_p
+FT_Pos = c_long
+
+
+class FT_Vector(Structure):
+ _fields_ = [
+ ('x', FT_Pos),
+ ('y', FT_Pos)
+ ]
+
+
+class FT_BBox(Structure):
+ _fields_ = [
+ ('xMin', FT_Pos),
+ ('yMin', FT_Pos),
+ ('xMax', FT_Pos),
+ ('yMax', FT_Pos)
+ ]
+
+
+class FT_Matrix(Structure):
+ _fields_ = [
+ ('xx', FT_Fixed),
+ ('xy', FT_Fixed),
+ ('yx', FT_Fixed),
+ ('yy', FT_Fixed)
+ ]
+
+FT_FWord = c_short
+FT_UFWord = c_ushort
+FT_F2Dot14 = c_short
+
+
+class FT_UnitVector(Structure):
+ _fields_ = [
+ ('x', FT_F2Dot14),
+ ('y', FT_F2Dot14),
+ ]
+
+FT_F26Dot6 = c_long
+
+
+class FT_Data(Structure):
+ _fields_ = [
+ ('pointer', POINTER(FT_Byte)),
+ ('length', FT_Int),
+ ]
+
+FT_Generic_Finalizer = CFUNCTYPE(None, (c_void_p))
+
+
+class FT_Generic(Structure):
+ _fields_ = [
+ ('data', c_void_p),
+ ('finalizer', FT_Generic_Finalizer)
+ ]
+
+
+class FT_Bitmap(Structure):
+ _fields_ = [
+ ('rows', c_uint),
+ ('width', c_uint),
+ ('pitch', c_int),
+ ('buffer', POINTER(c_ubyte)),
+ ('num_grays', c_short),
+ ('pixel_mode', c_ubyte),
+ ('palette_mode', c_ubyte),
+ ('palette', c_void_p),
+ ]
+
+FT_PIXEL_MODE_NONE = 0
+FT_PIXEL_MODE_MONO = 1
+FT_PIXEL_MODE_GRAY = 2
+FT_PIXEL_MODE_GRAY2 = 3
+FT_PIXEL_MODE_GRAY4 = 4
+FT_PIXEL_MODE_LCD = 5
+FT_PIXEL_MODE_LCD_V = 6
+FT_PIXEL_MODE_BGRA = 7
+
+
+class FT_LibraryRec(Structure):
+ _fields_ = [
+ ('dummy', c_int),
+ ]
+
+ def __del__(self):
+ global _library
+ try:
+ print('FT_LibraryRec.__del__')
+ FT_Done_FreeType(byref(self))
+ _library = None
+ except:
+ pass
+FT_Library = POINTER(FT_LibraryRec)
+
+
+class FT_Bitmap_Size(Structure):
+ _fields_ = [
+ ('height', c_ushort),
+ ('width', c_ushort),
+ ('size', c_long),
+ ('x_ppem', c_long),
+ ('y_ppem', c_long),
+ ]
+
+
+class FT_Glyph_Metrics(Structure):
+ _fields_ = [
+ ('width', FT_Pos),
+ ('height', FT_Pos),
+
+ ('horiBearingX', FT_Pos),
+ ('horiBearingY', FT_Pos),
+ ('horiAdvance', FT_Pos),
+
+ ('vertBearingX', FT_Pos),
+ ('vertBearingY', FT_Pos),
+ ('vertAdvance', FT_Pos),
+ ]
+
+ def dump(self):
+ for (name, type) in self._fields_:
+ print('FT_Glyph_Metrics', name, repr(getattr(self, name)))
+
+FT_Glyph_Format = c_ulong
+
+
+def FT_IMAGE_TAG(tag):
+ return (ord(tag[0]) << 24) | (ord(tag[1]) << 16) | (ord(tag[2]) << 8) | ord(tag[3])
+
+FT_GLYPH_FORMAT_NONE = 0
+FT_GLYPH_FORMAT_COMPOSITE = FT_IMAGE_TAG('comp')
+FT_GLYPH_FORMAT_BITMAP = FT_IMAGE_TAG('bits')
+FT_GLYPH_FORMAT_OUTLINE = FT_IMAGE_TAG('outl')
+FT_GLYPH_FORMAT_PLOTTER = FT_IMAGE_TAG('plot')
+
+
+class FT_Outline(Structure):
+ _fields_ = [
+ ('n_contours', c_short), # number of contours in glyph
+ ('n_points', c_short), # number of points in the glyph
+ ('points', POINTER(FT_Vector)), # the outline's points
+ ('tags', c_char_p), # the points flags
+ ('contours', POINTER(c_short)), # the contour end points
+ ('flags', c_int), # outline masks
+ ]
+
+
+FT_SubGlyph = c_void_p
+
+
+class FT_GlyphSlotRec(Structure):
+ _fields_ = [
+ ('library', FT_Library),
+ ('face', c_void_p),
+ ('next', c_void_p),
+ ('reserved', FT_UInt),
+ ('generic', FT_Generic),
+
+ ('metrics', FT_Glyph_Metrics),
+ ('linearHoriAdvance', FT_Fixed),
+ ('linearVertAdvance', FT_Fixed),
+ ('advance', FT_Vector),
+
+ ('format', FT_Glyph_Format),
+
+ ('bitmap', FT_Bitmap),
+ ('bitmap_left', FT_Int),
+ ('bitmap_top', FT_Int),
+
+ ('outline', FT_Outline),
+ ('num_subglyphs', FT_UInt),
+ ('subglyphs', FT_SubGlyph),
+
+ ('control_data', c_void_p),
+ ('control_len', c_long),
+
+ ('lsb_delta', FT_Pos),
+ ('rsb_delta', FT_Pos),
+
+ ('other', c_void_p),
+
+ ('internal', c_void_p),
+ ]
+FT_GlyphSlot = POINTER(FT_GlyphSlotRec)
+
+
+class FT_Size_Metrics(Structure):
+ _fields_ = [
+ ('x_ppem', FT_UShort), # horizontal pixels per EM
+ ('y_ppem', FT_UShort), # vertical pixels per EM
+
+ ('x_scale', FT_Fixed), # two scales used to convert font units
+ ('y_scale', FT_Fixed), # to 26.6 frac. pixel coordinates
+
+ ('ascender', FT_Pos), # ascender in 26.6 frac. pixels
+ ('descender', FT_Pos), # descender in 26.6 frac. pixels
+ ('height', FT_Pos), # text height in 26.6 frac. pixels
+ ('max_advance', FT_Pos), # max horizontal advance, in 26.6 pixels
+ ]
+
+
+class FT_SizeRec(Structure):
+ _fields_ = [
+ ('face', c_void_p),
+ ('generic', FT_Generic),
+ ('metrics', FT_Size_Metrics),
+ ('internal', c_void_p),
+ ]
+FT_Size = POINTER(FT_SizeRec)
+
+
+class FT_FaceRec(Structure):
+ _fields_ = [
+ ('num_faces', FT_Long),
+ ('face_index', FT_Long),
+
+ ('face_flags', FT_Long),
+ ('style_flags', FT_Long),
+
+ ('num_glyphs', FT_Long),
+
+ ('family_name', FT_String_Ptr),
+ ('style_name', FT_String_Ptr),
+
+ ('num_fixed_sizes', FT_Int),
+ ('available_sizes', POINTER(FT_Bitmap_Size)),
+
+ ('num_charmaps', FT_Int),
+ ('charmaps', c_void_p),
+
+ ('generic', FT_Generic),
+
+ ('bbox', FT_BBox),
+
+ ('units_per_EM', FT_UShort),
+ ('ascender', FT_Short),
+ ('descender', FT_Short),
+ ('height', FT_Short),
+
+ ('max_advance_width', FT_Short),
+ ('max_advance_height', FT_Short),
+
+ ('underline_position', FT_Short),
+ ('underline_thickness', FT_Short),
+
+ ('glyph', FT_GlyphSlot),
+ ('size', FT_Size),
+ ('charmap', c_void_p),
+
+ ('driver', c_void_p),
+ ('memory', c_void_p),
+ ('stream', c_void_p),
+
+ ('sizes_list', c_void_p),
+
+ ('autohint', FT_Generic),
+ ('extensions', c_void_p),
+ ('internal', c_void_p),
+ ]
+
+ def dump(self):
+ for (name, type) in self._fields_:
+ print('FT_FaceRec', name, repr(getattr(self, name)))
+
+ def has_kerning(self):
+ return self.face_flags & FT_FACE_FLAG_KERNING
+FT_Face = POINTER(FT_FaceRec)
+
+
+# face_flags values
+FT_FACE_FLAG_SCALABLE = 1 << 0
+FT_FACE_FLAG_FIXED_SIZES = 1 << 1
+FT_FACE_FLAG_FIXED_WIDTH = 1 << 2
+FT_FACE_FLAG_SFNT = 1 << 3
+FT_FACE_FLAG_HORIZONTAL = 1 << 4
+FT_FACE_FLAG_VERTICAL = 1 << 5
+FT_FACE_FLAG_KERNING = 1 << 6
+FT_FACE_FLAG_FAST_GLYPHS = 1 << 7
+FT_FACE_FLAG_MULTIPLE_MASTERS = 1 << 8
+FT_FACE_FLAG_GLYPH_NAMES = 1 << 9
+FT_FACE_FLAG_EXTERNAL_STREAM = 1 << 10
+FT_FACE_FLAG_HINTER = 1 << 11
+
+FT_STYLE_FLAG_ITALIC = 1
+FT_STYLE_FLAG_BOLD = 2
+
+
+(FT_RENDER_MODE_NORMAL,
+ FT_RENDER_MODE_LIGHT,
+ FT_RENDER_MODE_MONO,
+ FT_RENDER_MODE_LCD,
+ FT_RENDER_MODE_LCD_V) = range(5)
+
+
+def FT_LOAD_TARGET_(x):
+ return (x & 15) << 16
+
+FT_LOAD_TARGET_NORMAL = FT_LOAD_TARGET_(FT_RENDER_MODE_NORMAL)
+FT_LOAD_TARGET_LIGHT = FT_LOAD_TARGET_(FT_RENDER_MODE_LIGHT)
+FT_LOAD_TARGET_MONO = FT_LOAD_TARGET_(FT_RENDER_MODE_MONO)
+FT_LOAD_TARGET_LCD = FT_LOAD_TARGET_(FT_RENDER_MODE_LCD)
+FT_LOAD_TARGET_LCD_V = FT_LOAD_TARGET_(FT_RENDER_MODE_LCD_V)
+
+(FT_PIXEL_MODE_NONE,
+ FT_PIXEL_MODE_MONO,
+ FT_PIXEL_MODE_GRAY,
+ FT_PIXEL_MODE_GRAY2,
+ FT_PIXEL_MODE_GRAY4,
+ FT_PIXEL_MODE_LCD,
+ FT_PIXEL_MODE_LCD_V) = range(7)
+
+
+def f16p16_to_float(value):
+ return float(value) / (1 << 16)
+
+
+def float_to_f16p16(value):
+ return int(value * (1 << 16))
+
+
+def f26p6_to_float(value):
+ return float(value) / (1 << 6)
+
+
+def float_to_f26p6(value):
+ return int(value * (1 << 6))
+
+
+class FreeTypeError(FontException):
+ def __init__(self, message, errcode):
+ self.message = message
+ self.errcode = errcode
+
+ def __str__(self):
+ return '%s: %s (%s)'%(self.__class__.__name__, self.message,
+ self._ft_errors.get(self.errcode, 'unknown error'))
+
+ @classmethod
+ def check_and_raise_on_error(cls, errcode):
+ if errcode != 0:
+ raise cls(None, errcode)
+
+ _ft_errors = {
+ 0x00: "no error" ,
+ 0x01: "cannot open resource" ,
+ 0x02: "unknown file format" ,
+ 0x03: "broken file" ,
+ 0x04: "invalid FreeType version" ,
+ 0x05: "module version is too low" ,
+ 0x06: "invalid argument" ,
+ 0x07: "unimplemented feature" ,
+ 0x08: "broken table" ,
+ 0x09: "broken offset within table" ,
+ 0x10: "invalid glyph index" ,
+ 0x11: "invalid character code" ,
+ 0x12: "unsupported glyph image format" ,
+ 0x13: "cannot render this glyph format" ,
+ 0x14: "invalid outline" ,
+ 0x15: "invalid composite glyph" ,
+ 0x16: "too many hints" ,
+ 0x17: "invalid pixel size" ,
+ 0x20: "invalid object handle" ,
+ 0x21: "invalid library handle" ,
+ 0x22: "invalid module handle" ,
+ 0x23: "invalid face handle" ,
+ 0x24: "invalid size handle" ,
+ 0x25: "invalid glyph slot handle" ,
+ 0x26: "invalid charmap handle" ,
+ 0x27: "invalid cache manager handle" ,
+ 0x28: "invalid stream handle" ,
+ 0x30: "too many modules" ,
+ 0x31: "too many extensions" ,
+ 0x40: "out of memory" ,
+ 0x41: "unlisted object" ,
+ 0x51: "cannot open stream" ,
+ 0x52: "invalid stream seek" ,
+ 0x53: "invalid stream skip" ,
+ 0x54: "invalid stream read" ,
+ 0x55: "invalid stream operation" ,
+ 0x56: "invalid frame operation" ,
+ 0x57: "nested frame access" ,
+ 0x58: "invalid frame read" ,
+ 0x60: "raster uninitialized" ,
+ 0x61: "raster corrupted" ,
+ 0x62: "raster overflow" ,
+ 0x63: "negative height while rastering" ,
+ 0x70: "too many registered caches" ,
+ 0x80: "invalid opcode" ,
+ 0x81: "too few arguments" ,
+ 0x82: "stack overflow" ,
+ 0x83: "code overflow" ,
+ 0x84: "bad argument" ,
+ 0x85: "division by zero" ,
+ 0x86: "invalid reference" ,
+ 0x87: "found debug opcode" ,
+ 0x88: "found ENDF opcode in execution stream" ,
+ 0x89: "nested DEFS" ,
+ 0x8A: "invalid code range" ,
+ 0x8B: "execution context too long" ,
+ 0x8C: "too many function definitions" ,
+ 0x8D: "too many instruction definitions" ,
+ 0x8E: "SFNT font table missing" ,
+ 0x8F: "horizontal header (hhea, table missing" ,
+ 0x90: "locations (loca, table missing" ,
+ 0x91: "name table missing" ,
+ 0x92: "character map (cmap, table missing" ,
+ 0x93: "horizontal metrics (hmtx, table missing" ,
+ 0x94: "PostScript (post, table missing" ,
+ 0x95: "invalid horizontal metrics" ,
+ 0x96: "invalid character map (cmap, format" ,
+ 0x97: "invalid ppem value" ,
+ 0x98: "invalid vertical metrics" ,
+ 0x99: "could not find context" ,
+ 0x9A: "invalid PostScript (post, table format" ,
+ 0x9B: "invalid PostScript (post, table" ,
+ 0xA0: "opcode syntax error" ,
+ 0xA1: "argument stack underflow" ,
+ 0xA2: "ignore" ,
+ 0xB0: "`STARTFONT' field missing" ,
+ 0xB1: "`FONT' field missing" ,
+ 0xB2: "`SIZE' field missing" ,
+ 0xB3: "`CHARS' field missing" ,
+ 0xB4: "`STARTCHAR' field missing" ,
+ 0xB5: "`ENCODING' field missing" ,
+ 0xB6: "`BBX' field missing" ,
+ 0xB7: "`BBX' too big" ,
+ }
+
+
+def _get_function_with_error_handling(name, argtypes, rtype):
+ func = _get_function(name, argtypes, rtype)
+ def _error_handling(*args, **kwargs):
+ err = func(*args, **kwargs)
+ FreeTypeError.check_and_raise_on_error(err)
+ return _error_handling
+
+
+FT_LOAD_RENDER = 0x4
+
+FT_Init_FreeType = _get_function_with_error_handling('FT_Init_FreeType',
+ [POINTER(FT_Library)], FT_Error)
+FT_Done_FreeType = _get_function_with_error_handling('FT_Done_FreeType',
+ [FT_Library], FT_Error)
+
+FT_New_Face = _get_function_with_error_handling('FT_New_Face',
+ [FT_Library, c_char_p, FT_Long, POINTER(FT_Face)], FT_Error)
+FT_Done_Face = _get_function_with_error_handling('FT_Done_Face',
+ [FT_Face], FT_Error)
+FT_Reference_Face = _get_function_with_error_handling('FT_Reference_Face',
+ [FT_Face], FT_Error)
+FT_New_Memory_Face = _get_function_with_error_handling('FT_New_Memory_Face',
+ [FT_Library, POINTER(FT_Byte), FT_Long, FT_Long, POINTER(FT_Face)], FT_Error)
+
+FT_Set_Char_Size = _get_function_with_error_handling('FT_Set_Char_Size',
+ [FT_Face, FT_F26Dot6, FT_F26Dot6, FT_UInt, FT_UInt], FT_Error)
+FT_Set_Pixel_Sizes = _get_function_with_error_handling('FT_Set_Pixel_Sizes',
+ [FT_Face, FT_UInt, FT_UInt], FT_Error)
+FT_Load_Glyph = _get_function_with_error_handling('FT_Load_Glyph',
+ [FT_Face, FT_UInt, FT_Int32], FT_Error)
+FT_Get_Char_Index = _get_function_with_error_handling('FT_Get_Char_Index',
+ [FT_Face, FT_ULong], FT_Error)
+FT_Load_Char = _get_function_with_error_handling('FT_Load_Char',
+ [FT_Face, FT_ULong, FT_Int32], FT_Error)
+FT_Get_Kerning = _get_function_with_error_handling('FT_Get_Kerning',
+ [FT_Face, FT_UInt, FT_UInt, FT_UInt, POINTER(FT_Vector)], FT_Error)
+
+# SFNT interface
+
+class FT_SfntName(Structure):
+ _fields_ = [
+ ('platform_id', FT_UShort),
+ ('encoding_id', FT_UShort),
+ ('language_id', FT_UShort),
+ ('name_id', FT_UShort),
+ ('string', POINTER(FT_Byte)),
+ ('string_len', FT_UInt)
+ ]
+
+FT_Get_Sfnt_Name_Count = _get_function('FT_Get_Sfnt_Name_Count',
+ [FT_Face], FT_UInt)
+FT_Get_Sfnt_Name = _get_function_with_error_handling('FT_Get_Sfnt_Name',
+ [FT_Face, FT_UInt, POINTER(FT_SfntName)], FT_Error)
+
+TT_PLATFORM_MICROSOFT = 3
+TT_MS_ID_UNICODE_CS = 1
+TT_NAME_ID_COPYRIGHT = 0
+TT_NAME_ID_FONT_FAMILY = 1
+TT_NAME_ID_FONT_SUBFAMILY = 2
+TT_NAME_ID_UNIQUE_ID = 3
+TT_NAME_ID_FULL_NAME = 4
+TT_NAME_ID_VERSION_STRING = 5
+TT_NAME_ID_PS_NAME = 6
+TT_NAME_ID_TRADEMARK = 7
+TT_NAME_ID_MANUFACTURER = 8
+TT_NAME_ID_DESIGNER = 9
+TT_NAME_ID_DESCRIPTION = 10
+TT_NAME_ID_VENDOR_URL = 11
+TT_NAME_ID_DESIGNER_URL = 12
+TT_NAME_ID_LICENSE = 13
+TT_NAME_ID_LICENSE_URL = 14
+TT_NAME_ID_PREFERRED_FAMILY = 16
+TT_NAME_ID_PREFERRED_SUBFAMILY= 17
+TT_NAME_ID_MAC_FULL_NAME = 18
+TT_NAME_ID_CID_FINDFONT_NAME = 20
+
+_library = None
+def ft_get_library():
+ global _library
+ if not _library:
+ _library = FT_Library()
+ error = FT_Init_FreeType(byref(_library))
+ if error:
+ raise FontException(
+ 'an error occurred during library initialization', error)
+ return _library
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/quartz.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/quartz.py
new file mode 100644
index 0000000000000000000000000000000000000000..26b9d967edcc60a400aef29ccf2557e5ebffe301
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/quartz.py
@@ -0,0 +1,265 @@
+# TODO Tiger and later: need to set kWindowApplicationScaledAttribute for DPI independence?
+
+import math
+import warnings
+from ctypes import c_void_p, c_int32, byref, c_byte
+
+from pyglet.font import base
+import pyglet.image
+
+from pyglet.libs.darwin import cocoapy
+
+cf = cocoapy.cf
+ct = cocoapy.ct
+quartz = cocoapy.quartz
+
+
+class QuartzGlyphRenderer(base.GlyphRenderer):
+ def __init__(self, font):
+ super().__init__(font)
+ self.font = font
+
+ def render(self, text):
+ # Using CTLineDraw seems to be the only way to make sure that the text
+ # is drawn with the specified font when that font is a graphics font loaded from
+ # memory. For whatever reason, [NSAttributedString drawAtPoint:] ignores
+ # the graphics font if it not registered with the font manager.
+ # So we just use CTLineDraw for both graphics fonts and installed fonts.
+
+ ctFont = self.font.ctFont
+
+ # Create an attributed string using text and font.
+ attributes = c_void_p(cf.CFDictionaryCreateMutable(None, 1, cf.kCFTypeDictionaryKeyCallBacks, cf.kCFTypeDictionaryValueCallBacks))
+ cf.CFDictionaryAddValue(attributes, cocoapy.kCTFontAttributeName, ctFont)
+ string = c_void_p(cf.CFAttributedStringCreate(None, cocoapy.CFSTR(text), attributes))
+
+ # Create a CTLine object to render the string.
+ line = c_void_p(ct.CTLineCreateWithAttributedString(string))
+ cf.CFRelease(string)
+ cf.CFRelease(attributes)
+
+ # Get a bounding rectangle for glyphs in string.
+ count = len(text)
+ chars = (cocoapy.UniChar * count)(*list(map(ord,str(text))))
+ glyphs = (cocoapy.CGGlyph * count)()
+ ct.CTFontGetGlyphsForCharacters(ctFont, chars, glyphs, count)
+ rect = ct.CTFontGetBoundingRectsForGlyphs(ctFont, 0, glyphs, None, count)
+
+ # Get advance for all glyphs in string.
+ advance = ct.CTFontGetAdvancesForGlyphs(ctFont, 0, glyphs, None, count)
+
+ # Set image parameters:
+ # We add 2 pixels to the bitmap width and height so that there will be a 1-pixel border
+ # around the glyph image when it is placed in the texture atlas. This prevents
+ # weird artifacts from showing up around the edges of the rendered glyph textures.
+ # We adjust the baseline and lsb of the glyph by 1 pixel accordingly.
+ width = max(int(math.ceil(rect.size.width) + 2), 1)
+ height = max(int(math.ceil(rect.size.height) + 2), 1)
+ baseline = -int(math.floor(rect.origin.y)) + 1
+ lsb = int(math.floor(rect.origin.x)) - 1
+ advance = int(round(advance))
+
+ # Create bitmap context.
+ bitsPerComponent = 8
+ bytesPerRow = 4*width
+ colorSpace = c_void_p(quartz.CGColorSpaceCreateDeviceRGB())
+ bitmap = c_void_p(quartz.CGBitmapContextCreate(
+ None,
+ width,
+ height,
+ bitsPerComponent,
+ bytesPerRow,
+ colorSpace,
+ cocoapy.kCGImageAlphaPremultipliedLast))
+
+ # Draw text to bitmap context.
+ quartz.CGContextSetShouldAntialias(bitmap, True)
+ quartz.CGContextSetTextPosition(bitmap, -lsb, baseline)
+ ct.CTLineDraw(line, bitmap)
+ cf.CFRelease(line)
+
+ # Create an image to get the data out.
+ imageRef = c_void_p(quartz.CGBitmapContextCreateImage(bitmap))
+
+ bytesPerRow = quartz.CGImageGetBytesPerRow(imageRef)
+ dataProvider = c_void_p(quartz.CGImageGetDataProvider(imageRef))
+ imageData = c_void_p(quartz.CGDataProviderCopyData(dataProvider))
+ buffersize = cf.CFDataGetLength(imageData)
+ buffer = (c_byte * buffersize)()
+ byteRange = cocoapy.CFRange(0, buffersize)
+ cf.CFDataGetBytes(imageData, byteRange, buffer)
+
+ quartz.CGImageRelease(imageRef)
+ quartz.CGDataProviderRelease(imageData)
+ cf.CFRelease(bitmap)
+ cf.CFRelease(colorSpace)
+
+ glyph_image = pyglet.image.ImageData(width, height, 'RGBA', buffer, bytesPerRow)
+
+ glyph = self.font.create_glyph(glyph_image)
+ glyph.set_bearings(baseline, lsb, advance)
+ t = list(glyph.tex_coords)
+ glyph.tex_coords = t[9:12] + t[6:9] + t[3:6] + t[:3]
+
+ return glyph
+
+
+class QuartzFont(base.Font):
+ glyph_renderer_class = QuartzGlyphRenderer
+ _loaded_CGFont_table = {}
+
+ def _lookup_font_with_family_and_traits(self, family, traits):
+ # This method searches the _loaded_CGFont_table to find a loaded
+ # font of the given family with the desired traits. If it can't find
+ # anything with the exact traits, it tries to fall back to whatever
+ # we have loaded that's close. If it can't find anything in the
+ # given family at all, it returns None.
+
+ # Check if we've loaded the font with the specified family.
+ if family not in self._loaded_CGFont_table:
+ return None
+ # Grab a dictionary of all fonts in the family, keyed by traits.
+ fonts = self._loaded_CGFont_table[family]
+ if not fonts:
+ return None
+ # Return font with desired traits if it is available.
+ if traits in fonts:
+ return fonts[traits]
+ # Otherwise try to find a font with some of the traits.
+ for (t, f) in fonts.items():
+ if traits & t:
+ return f
+ # Otherwise try to return a regular font.
+ if 0 in fonts:
+ return fonts[0]
+ # Otherwise return whatever we have.
+ return list(fonts.values())[0]
+
+ def _create_font_descriptor(self, family_name, traits):
+ # Create an attribute dictionary.
+ attributes = c_void_p(cf.CFDictionaryCreateMutable(None, 0, cf.kCFTypeDictionaryKeyCallBacks, cf.kCFTypeDictionaryValueCallBacks))
+ # Add family name to attributes.
+ cfname = cocoapy.CFSTR(family_name)
+ cf.CFDictionaryAddValue(attributes, cocoapy.kCTFontFamilyNameAttribute, cfname)
+ cf.CFRelease(cfname)
+ # Construct a CFNumber to represent the traits.
+ itraits = c_int32(traits)
+ symTraits = c_void_p(cf.CFNumberCreate(None, cocoapy.kCFNumberSInt32Type, byref(itraits)))
+ if symTraits:
+ # Construct a dictionary to hold the traits values.
+ traitsDict = c_void_p(cf.CFDictionaryCreateMutable(None, 0, cf.kCFTypeDictionaryKeyCallBacks, cf.kCFTypeDictionaryValueCallBacks))
+ if traitsDict:
+ # Add CFNumber traits to traits dictionary.
+ cf.CFDictionaryAddValue(traitsDict, cocoapy.kCTFontSymbolicTrait, symTraits)
+ # Add traits dictionary to attributes.
+ cf.CFDictionaryAddValue(attributes, cocoapy.kCTFontTraitsAttribute, traitsDict)
+ cf.CFRelease(traitsDict)
+ cf.CFRelease(symTraits)
+ # Create font descriptor with attributes.
+ descriptor = c_void_p(ct.CTFontDescriptorCreateWithAttributes(attributes))
+ cf.CFRelease(attributes)
+ return descriptor
+
+ def __init__(self, name, size, bold=False, italic=False, stretch=False, dpi=None):
+ # assert type(bold) is bool, "Only a boolean value is supported for bold in the current font renderer."
+ # assert type(italic) is bool, "Only a boolean value is supported for bold in the current font renderer."
+
+ if stretch:
+ warnings.warn("The current font render does not support stretching.")
+
+ super().__init__()
+
+ name = name or 'Helvetica'
+
+ # I don't know what is the right thing to do here.
+ dpi = dpi or 96
+ size = size * dpi / 72.0
+
+ # Construct traits value.
+ traits = 0
+ if bold:
+ traits |= cocoapy.kCTFontBoldTrait
+ if italic:
+ traits |= cocoapy.kCTFontItalicTrait
+
+ name = str(name)
+ # First see if we can find an appropriate font from our table of loaded fonts.
+ cgFont = self._lookup_font_with_family_and_traits(name, traits)
+ if cgFont:
+ # Use cgFont from table to create a CTFont object with the specified size.
+ self.ctFont = c_void_p(ct.CTFontCreateWithGraphicsFont(cgFont, size, None, None))
+ else:
+ # Create a font descriptor for given name and traits and use it to create font.
+ descriptor = self._create_font_descriptor(name, traits)
+ self.ctFont = c_void_p(ct.CTFontCreateWithFontDescriptor(descriptor, size, None))
+
+ cf.CFRelease(descriptor)
+ assert self.ctFont, "Couldn't load font: " + name
+
+ string = c_void_p(ct.CTFontCopyFamilyName(self.ctFont))
+ self._family_name = str(cocoapy.cfstring_to_string(string))
+ cf.CFRelease(string)
+
+ self.ascent = int(math.ceil(ct.CTFontGetAscent(self.ctFont)))
+ self.descent = -int(math.ceil(ct.CTFontGetDescent(self.ctFont)))
+
+ @property
+ def name(self):
+ return self._family_name
+
+ def __del__(self):
+ cf.CFRelease(self.ctFont)
+
+ @classmethod
+ def have_font(cls, name):
+ name = str(name)
+ if name in cls._loaded_CGFont_table: return True
+ # Try to create the font to see if it exists.
+ # TODO: Find a better way to check.
+ cfstring = cocoapy.CFSTR(name)
+ cgfont = c_void_p(quartz.CGFontCreateWithFontName(cfstring))
+ cf.CFRelease(cfstring)
+ if cgfont:
+ cf.CFRelease(cgfont)
+ return True
+ return False
+
+ @classmethod
+ def add_font_data(cls, data):
+ # Create a cgFont with the data. There doesn't seem to be a way to
+ # register a font loaded from memory such that the operating system will
+ # find it later. So instead we just store the cgFont in a table where
+ # it can be found by our __init__ method.
+ # Note that the iOS CTFontManager *is* able to register graphics fonts,
+ # however this method is missing from CTFontManager on MacOS 10.6
+ dataRef = c_void_p(cf.CFDataCreate(None, data, len(data)))
+ provider = c_void_p(quartz.CGDataProviderCreateWithCFData(dataRef))
+ cgFont = c_void_p(quartz.CGFontCreateWithDataProvider(provider))
+
+ cf.CFRelease(dataRef)
+ quartz.CGDataProviderRelease(provider)
+
+ # Create a template CTFont from the graphics font so that we can get font info.
+ ctFont = c_void_p(ct.CTFontCreateWithGraphicsFont(cgFont, 1, None, None))
+
+ # Get info about the font to use as key in our font table.
+ string = c_void_p(ct.CTFontCopyFamilyName(ctFont))
+ familyName = str(cocoapy.cfstring_to_string(string))
+ cf.CFRelease(string)
+
+ string = c_void_p(ct.CTFontCopyFullName(ctFont))
+ fullName = str(cocoapy.cfstring_to_string(string))
+ cf.CFRelease(string)
+
+ traits = ct.CTFontGetSymbolicTraits(ctFont)
+ cf.CFRelease(ctFont)
+
+ # Store font in table. We store it under both its family name and its
+ # full name, since its not always clear which one will be looked up.
+ if familyName not in cls._loaded_CGFont_table:
+ cls._loaded_CGFont_table[familyName] = {}
+ cls._loaded_CGFont_table[familyName][traits] = cgFont
+
+ if fullName not in cls._loaded_CGFont_table:
+ cls._loaded_CGFont_table[fullName] = {}
+ cls._loaded_CGFont_table[fullName][traits] = cgFont
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/ttf.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/ttf.py
new file mode 100644
index 0000000000000000000000000000000000000000..df319da22416c7cc5e3585bc0a90e64af77ded73
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/ttf.py
@@ -0,0 +1,602 @@
+"""
+Implementation of the Truetype file format.
+
+Typical applications will not need to use this module directly; look at
+`pyglet.font` instead.
+
+References:
+ * http://developer.apple.com/fonts/TTRefMan/RM06
+ * http://www.microsoft.com/typography/otspec
+"""
+
+import os
+import mmap
+import struct
+import codecs
+
+
+class TruetypeInfo:
+ """Information about a single Truetype face.
+
+ The class memory-maps the font file to read the tables, so
+ it is vital that you call the `close` method to avoid large memory
+ leaks. Once closed, you cannot call any of the ``get_*`` methods.
+
+ Not all tables have been implemented yet (or likely ever will).
+ Currently only the name and metric tables are read; in particular
+ there is no glyph or hinting information.
+ """
+
+ _name_id_lookup = {
+ 'copyright': 0,
+ 'family': 1,
+ 'subfamily': 2,
+ 'identifier': 3,
+ 'name': 4,
+ 'version': 5,
+ 'postscript': 6,
+ 'trademark': 7,
+ 'manufacturer': 8,
+ 'designer': 9,
+ 'description': 10,
+ 'vendor-url': 11,
+ 'designer-url': 12,
+ 'license': 13,
+ 'license-url': 14,
+ 'preferred-family': 16,
+ 'preferred-subfamily': 17,
+ 'compatible-name': 18,
+ 'sample': 19,
+ }
+
+ _platform_id_lookup = {
+ 'unicode': 0,
+ 'macintosh': 1,
+ 'iso': 2,
+ 'microsoft': 3,
+ 'custom': 4
+ }
+
+ _microsoft_encoding_lookup = {
+ 1: 'utf_16_be',
+ 2: 'shift_jis',
+ 4: 'big5',
+ 6: 'johab',
+ 10: 'utf_16_be'
+ }
+
+ _macintosh_encoding_lookup = {
+ 0: 'mac_roman'
+ }
+
+ def __init__(self, filename):
+ """Read the given TrueType file.
+
+ :Parameters:
+ `filename`
+ The name of any Windows, OS2 or Macintosh Truetype file.
+
+ The object must be closed (see `close`) after use.
+
+ An exception will be raised if the file does not exist or cannot
+ be read.
+ """
+ assert filename, "must provide a font file name"
+ length = os.stat(filename).st_size
+ self._fileno = os.open(filename, os.O_RDONLY)
+ if hasattr(mmap, 'MAP_SHARED'):
+ self._data = mmap.mmap(self._fileno, length, mmap.MAP_SHARED, mmap.PROT_READ)
+ else:
+ self._data = mmap.mmap(self._fileno, length, None, mmap.ACCESS_READ)
+
+ self._closed = False
+
+ offsets = _read_offset_table(self._data, 0)
+ self._tables = {}
+ for table in _read_table_directory_entry.array(self._data, offsets.size, offsets.num_tables):
+ self._tables[table.tag] = table
+
+ self._names = None
+ self._horizontal_metrics = None
+ self._character_advances = None
+ self._character_kernings = None
+ self._glyph_kernings = None
+ self._character_map = None
+ self._glyph_map = None
+ self._font_selection_flags = None
+
+ self.header = _read_head_table(self._data, self._tables['head'].offset)
+ self.horizontal_header = _read_horizontal_header(self._data, self._tables['hhea'].offset)
+
+ def get_font_selection_flags(self):
+ """Return the font selection flags, as defined in OS/2 table"""
+ if not self._font_selection_flags:
+ OS2_table = _read_OS2_table(self._data, self._tables['OS/2'].offset)
+ self._font_selection_flags = OS2_table.fs_selection
+ return self._font_selection_flags
+
+ def is_bold(self):
+ """Returns True iff the font describes itself as bold."""
+ return bool(self.get_font_selection_flags() & 0x20)
+
+ def is_italic(self):
+ """Returns True iff the font describes itself as italic."""
+ return bool(self.get_font_selection_flags() & 0x1)
+
+ def get_names(self):
+ """Returns a dictionary of names defined in the file.
+
+ The key of each item is a tuple of ``platform_id``, ``name_id``,
+ where each ID is the number as described in the Truetype format.
+
+ The value of each item is a tuple of
+ ``encoding_id``, ``language_id``, ``value``, where ``value`` is
+ an encoded string.
+ """
+ if self._names:
+ return self._names
+ naming_table = _read_naming_table(self._data, self._tables['name'].offset)
+ name_records = _read_name_record.array(
+ self._data, self._tables['name'].offset + naming_table.size, naming_table.count)
+ storage = naming_table.string_offset + self._tables['name'].offset
+ self._names = {}
+ for record in name_records:
+ value = self._data[record.offset + storage: record.offset + storage + record.length]
+ key = record.platform_id, record.name_id
+ value = (record.encoding_id, record.language_id, value)
+ if key not in self._names:
+ self._names[key] = []
+ self._names[key].append(value)
+ return self._names
+
+ def get_name(self, name, platform=None, languages=None):
+ """Returns the value of the given name in this font.
+
+ :Parameters:
+ `name`
+ Either an integer, representing the name_id desired (see
+ font format); or a string describing it, see below for
+ valid names.
+ `platform`
+ Platform for the requested name. Can be the integer ID,
+ or a string describing it. By default, the Microsoft
+ platform is searched first, then Macintosh.
+ `languages`
+ A list of language IDs to search. The first language
+ which defines the requested name will be used. By default,
+ all English dialects are searched.
+
+ If the name is not found, ``None`` is returned. If the name
+ is found, the value will be decoded and returned as a unicode
+ string. Currently only some common encodings are supported.
+
+ Valid names to request are (supply as a string)::
+
+ 'copyright'
+ 'family'
+ 'subfamily'
+ 'identifier'
+ 'name'
+ 'version'
+ 'postscript'
+ 'trademark'
+ 'manufacturer'
+ 'designer'
+ 'description'
+ 'vendor-url'
+ 'designer-url'
+ 'license'
+ 'license-url'
+ 'preferred-family'
+ 'preferred-subfamily'
+ 'compatible-name'
+ 'sample'
+
+ Valid platforms to request are (supply as a string)::
+
+ 'unicode'
+ 'macintosh'
+ 'iso'
+ 'microsoft'
+ 'custom'
+ """
+
+ names = self.get_names()
+ if type(name) == str:
+ name = self._name_id_lookup[name]
+ if not platform:
+ for platform in ('microsoft', 'macintosh'):
+ value = self.get_name(name, platform, languages)
+ if value:
+ return value
+ if type(platform) == str:
+ platform = self._platform_id_lookup[platform]
+ if not (platform, name) in names:
+ return None
+
+ if platform == 3: # setup for microsoft
+ encodings = self._microsoft_encoding_lookup
+ if not languages:
+ # Default to english languages for microsoft
+ languages = (0x409, 0x809, 0xc09, 0x1009, 0x1409, 0x1809)
+ elif platform == 1: # setup for macintosh
+ encodings = self.__macintosh_encoding_lookup
+ if not languages:
+ # Default to english for macintosh
+ languages = (0,)
+
+ for record in names[(platform, name)]:
+ if record[1] in languages and record[0] in encodings:
+ decoder = codecs.getdecoder(encodings[record[0]])
+ return decoder(record[2])[0]
+ return None
+
+ def get_horizontal_metrics(self):
+ """Return all horizontal metric entries in table format."""
+ if not self._horizontal_metrics:
+ ar = _read_long_hor_metric.array(self._data,
+ self._tables['hmtx'].offset,
+ self.horizontal_header.number_of_h_metrics)
+ self._horizontal_metrics = ar
+ return self._horizontal_metrics
+
+ def get_character_advances(self):
+ """Return a dictionary of character->advance.
+
+ They key of the dictionary is a unit-length unicode string,
+ and the value is a float giving the horizontal advance in
+ em.
+ """
+ if self._character_advances:
+ return self._character_advances
+ ga = self.get_glyph_advances()
+ gmap = self.get_glyph_map()
+ self._character_advances = {}
+ for i in range(len(ga)):
+ if i in gmap and not gmap[i] in self._character_advances:
+ self._character_advances[gmap[i]] = ga[i]
+ return self._character_advances
+
+ def get_glyph_advances(self):
+ """Return a dictionary of glyph->advance.
+
+ They key of the dictionary is the glyph index and the value is a float
+ giving the horizontal advance in em.
+ """
+ hm = self.get_horizontal_metrics()
+ return [float(m.advance_width) / self.header.units_per_em for m in hm]
+
+ def get_character_kernings(self):
+ """Return a dictionary of (left,right)->kerning
+
+ The key of the dictionary is a tuple of ``(left, right)``
+ where each element is a unit-length unicode string. The
+ value of the dictionary is the horizontal pairwise kerning
+ in em.
+ """
+ if not self._character_kernings:
+ gmap = self.get_glyph_map()
+ kerns = self.get_glyph_kernings()
+ self._character_kernings = {}
+ for pair, value in kerns.items():
+ lglyph, rglyph = pair
+ lchar = lglyph in gmap and gmap[lglyph] or None
+ rchar = rglyph in gmap and gmap[rglyph] or None
+ if lchar and rchar:
+ self._character_kernings[(lchar, rchar)] = value
+ return self._character_kernings
+
+ def get_glyph_kernings(self):
+ """Return a dictionary of (left,right)->kerning
+
+ The key of the dictionary is a tuple of ``(left, right)``
+ where each element is a glyph index. The value of the dictionary is
+ the horizontal pairwise kerning in em.
+ """
+ if self._glyph_kernings:
+ return self._glyph_kernings
+ header = \
+ _read_kern_header_table(self._data, self._tables['kern'].offset)
+ offset = self._tables['kern'].offset + header.size
+ kernings = {}
+ for i in range(header.n_tables):
+ header = _read_kern_subtable_header(self._data, offset)
+ if header.coverage & header.horizontal_mask \
+ and not header.coverage & header.minimum_mask \
+ and not header.coverage & header.perpendicular_mask:
+ if header.coverage & header.format_mask == 0:
+ self._add_kernings_format0(kernings, offset + header.size)
+ offset += header.length
+ self._glyph_kernings = kernings
+ return kernings
+
+ def _add_kernings_format0(self, kernings, offset):
+ header = _read_kern_subtable_format0(self._data, offset)
+ kerning_pairs = _read_kern_subtable_format0Pair.array(self._data,
+ offset + header.size, header.n_pairs)
+ for pair in kerning_pairs:
+ if (pair.left, pair.right) in kernings:
+ kernings[(pair.left, pair.right)] += pair.value \
+ / float(self.header.units_per_em)
+ else:
+ kernings[(pair.left, pair.right)] = pair.value \
+ / float(self.header.units_per_em)
+
+ def get_glyph_map(self):
+ """Calculate and return a reverse character map.
+
+ Returns a dictionary where the key is a glyph index and the
+ value is a unit-length unicode string.
+ """
+ if self._glyph_map:
+ return self._glyph_map
+ cmap = self.get_character_map()
+ self._glyph_map = {}
+ for ch, glyph in cmap.items():
+ if not glyph in self._glyph_map:
+ self._glyph_map[glyph] = ch
+ return self._glyph_map
+
+ def get_character_map(self):
+ """Return the character map.
+
+ Returns a dictionary where the key is a unit-length unicode
+ string and the value is a glyph index. Currently only
+ format 4 character maps are read.
+ """
+ if self._character_map:
+ return self._character_map
+ cmap = _read_cmap_header(self._data, self._tables['cmap'].offset)
+ records = _read_cmap_encoding_record.array(self._data,
+ self._tables['cmap'].offset + cmap.size, cmap.num_tables)
+ self._character_map = {}
+ for record in records:
+ if record.platform_id == 3 and record.encoding_id == 1:
+ # Look at Windows Unicode charmaps only
+ offset = self._tables['cmap'].offset + record.offset
+ format_header = _read_cmap_format_header(self._data, offset)
+ if format_header.format == 4:
+ self._character_map = \
+ self._get_character_map_format4(offset)
+ break
+ return self._character_map
+
+ def _get_character_map_format4(self, offset):
+ # This is absolutely, without question, the *worst* file
+ # format ever. Whoever the fuckwit is that thought this up is
+ # a fuckwit.
+ header = _read_cmap_format4Header(self._data, offset)
+ seg_count = header.seg_count_x2 // 2
+ array_size = struct.calcsize(f'>{seg_count}')
+ end_count = self._read_array(f'>{seg_count}',
+ offset + header.size)
+ start_count = self._read_array(f'>{seg_count}',
+ offset + header.size + array_size + 2)
+ id_delta = self._read_array(f'>{seg_count}',
+ offset + header.size + array_size + 2 + array_size)
+ id_range_offset_address = \
+ offset + header.size + array_size + 2 + array_size + array_size
+ id_range_offset = self._read_array(f'>{seg_count}',
+ id_range_offset_address)
+ character_map = {}
+ for i in range(0, seg_count):
+ if id_range_offset[i] != 0:
+ if id_range_offset[i] == 65535:
+ continue # Hack around a dodgy font (babelfish.ttf)
+ for c in range(start_count[i], end_count[i] + 1):
+ addr = id_range_offset[i] + 2 * (c - start_count[i]) + \
+ id_range_offset_address + 2 * i
+ g = struct.unpack('>H', self._data[addr:addr + 2])[0]
+ if g != 0:
+ character_map[chr(c)] = (g + id_delta[i]) % 65536
+ else:
+ for c in range(start_count[i], end_count[i] + 1):
+ g = (c + id_delta[i]) % 65536
+ if g != 0:
+ character_map[chr(c)] = g
+ return character_map
+
+ def _read_array(self, format, offset):
+ size = struct.calcsize(format)
+ return struct.unpack(format, self._data[offset:offset + size])
+
+ def close(self):
+ """Close the font file.
+
+ This is a good idea, since the entire file is memory mapped in
+ until this method is called. After closing cannot rely on the
+ ``get_*`` methods.
+ """
+
+ self._data.close()
+ os.close(self._fileno)
+ self._closed = True
+
+ def __del__(self):
+ if not self._closed:
+ self.close()
+
+
+def _read_table(*entries):
+ """ Generic table constructor used for table formats listed at
+ end of file."""
+
+ fmt = '>'
+ names = []
+ for entry in entries:
+ name, entry_type = entry.split(':')
+ names.append(name)
+ fmt += entry_type
+
+ class TableClass:
+ size = struct.calcsize(fmt)
+
+ def __init__(self, data, offset):
+ items = struct.unpack(fmt, data[offset:offset + self.size])
+ self.pairs = list(zip(names, items))
+ for pname, pvalue in self.pairs:
+ if isinstance(pvalue, bytes):
+ pvalue = pvalue.decode('utf-8')
+ setattr(self, pname, pvalue)
+
+ def __repr__(self):
+ return '{'+', '.join([f'{pname} = {pvalue}' for pname, pvalue in self.pairs])+'}'
+
+ @staticmethod
+ def array(data, offset, count):
+ tables = []
+ for i in range(count):
+ tables.append(TableClass(data, offset))
+ offset += TableClass.size
+ return tables
+
+ return TableClass
+
+
+# Table formats (see references)
+
+_read_offset_table = _read_table('scalertype:I',
+ 'num_tables:H',
+ 'search_range:H',
+ 'entry_selector:H',
+ 'range_shift:H')
+
+_read_table_directory_entry = _read_table('tag:4s',
+ 'check_sum:I',
+ 'offset:I',
+ 'length:I')
+
+_read_head_table = _read_table('version:i',
+ 'font_revision:i',
+ 'check_sum_adjustment:L',
+ 'magic_number:L',
+ 'flags:H',
+ 'units_per_em:H',
+ 'created:Q',
+ 'modified:Q',
+ 'x_min:h',
+ 'y_min:h',
+ 'x_max:h',
+ 'y_max:h',
+ 'mac_style:H',
+ 'lowest_rec_p_pEM:H',
+ 'font_direction_hint:h',
+ 'index_to_loc_format:h',
+ 'glyph_data_format:h')
+
+_read_OS2_table = _read_table('version:H',
+ 'x_avg_char_width:h',
+ 'us_weight_class:H',
+ 'us_width_class:H',
+ 'fs_type:H',
+ 'y_subscript_x_size:h',
+ 'y_subscript_y_size:h',
+ 'y_subscript_x_offset:h',
+ 'y_subscript_y_offset:h',
+ 'y_superscript_x_size:h',
+ 'y_superscript_y_size:h',
+ 'y_superscript_x_offset:h',
+ 'y_superscript_y_offset:h',
+ 'y_strikeout_size:h',
+ 'y_strikeout_position:h',
+ 's_family_class:h',
+ 'panose1:B',
+ 'panose2:B',
+ 'panose3:B',
+ 'panose4:B',
+ 'panose5:B',
+ 'panose6:B',
+ 'panose7:B',
+ 'panose8:B',
+ 'panose9:B',
+ 'panose10:B',
+ 'ul_unicode_range1:L',
+ 'ul_unicode_range2:L',
+ 'ul_unicode_range3:L',
+ 'ul_unicode_range4:L',
+ 'ach_vend_id:I',
+ 'fs_selection:H',
+ 'us_first_char_index:H',
+ 'us_last_char_index:H',
+ 's_typo_ascender:h',
+ 's_typo_descender:h',
+ 's_typo_line_gap:h',
+ 'us_win_ascent:H',
+ 'us_win_descent:H',
+ 'ul_code_page_range1:L',
+ 'ul_code_page_range2:L',
+ 'sx_height:h',
+ 's_cap_height:h',
+ 'us_default_char:H',
+ 'us_break_char:H',
+ 'us_max_context:H')
+
+_read_kern_header_table = _read_table('version_num:H',
+ 'n_tables:H')
+
+_read_kern_subtable_header = _read_table('version:H',
+ 'length:H',
+ 'coverage:H')
+
+_read_kern_subtable_header.horizontal_mask = 0x1
+_read_kern_subtable_header.minimum_mask = 0x2
+_read_kern_subtable_header.perpendicular_mask = 0x4
+_read_kern_subtable_header.override_mask = 0x5
+_read_kern_subtable_header.format_mask = 0xf0
+
+_read_kern_subtable_format0 = _read_table('n_pairs:H',
+ 'search_range:H',
+ 'entry_selector:H',
+ 'range_shift:H')
+_read_kern_subtable_format0Pair = _read_table('left:H',
+ 'right:H',
+ 'value:h')
+
+_read_cmap_header = _read_table('version:H',
+ 'num_tables:H')
+
+_read_cmap_encoding_record = _read_table('platform_id:H',
+ 'encoding_id:H',
+ 'offset:L')
+
+_read_cmap_format_header = _read_table('format:H',
+ 'length:H')
+_read_cmap_format4Header = _read_table('format:H',
+ 'length:H',
+ 'language:H',
+ 'seg_count_x2:H',
+ 'search_range:H',
+ 'entry_selector:H',
+ 'range_shift:H')
+
+_read_horizontal_header = _read_table('version:i',
+ 'Advance:h',
+ 'Descender:h',
+ 'LineGap:h',
+ 'advance_width_max:H',
+ 'min_left_side_bearing:h',
+ 'min_right_side_bearing:h',
+ 'x_max_extent:h',
+ 'caret_slope_rise:h',
+ 'caret_slope_run:h',
+ 'caret_offset:h',
+ 'reserved1:h',
+ 'reserved2:h',
+ 'reserved3:h',
+ 'reserved4:h',
+ 'metric_data_format:h',
+ 'number_of_h_metrics:H')
+
+_read_long_hor_metric = _read_table('advance_width:H',
+ 'lsb:h')
+
+_read_naming_table = _read_table('format:H',
+ 'count:H',
+ 'string_offset:H')
+
+_read_name_record = _read_table('platform_id:H',
+ 'encoding_id:H',
+ 'language_id:H',
+ 'name_id:H',
+ 'length:H',
+ 'offset:H')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/win32.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/win32.py
new file mode 100644
index 0000000000000000000000000000000000000000..be7b2251b3dfcac675787b5d51806d8dfe8009af
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/win32.py
@@ -0,0 +1,549 @@
+# TODO Windows Vista: need to call SetProcessDPIAware? May affect GDI+ calls as well as font.
+
+import math
+import warnings
+
+from sys import byteorder
+import pyglet
+from pyglet.font import base
+from pyglet.font import win32query
+import pyglet.image
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+from pyglet.libs.win32 import _gdi32 as gdi32, _user32 as user32
+from pyglet.libs.win32 import _kernel32 as kernel32
+from pyglet.util import asbytes
+
+_debug_font = pyglet.options['debug_font']
+
+
+def str_ucs2(text):
+ if byteorder == 'big':
+ text = text.encode('utf_16_be')
+ else:
+ text = text.encode('utf_16_le') # explicit endian avoids BOM
+ return create_string_buffer(text + '\0')
+
+_debug_dir = 'debug_font'
+def _debug_filename(base, extension):
+ import os
+ if not os.path.exists(_debug_dir):
+ os.makedirs(_debug_dir)
+ name = f'{os.path.join(_debug_dir, base)}-{{0}}.{{1}}'
+ num = 1
+ while os.path.exists(name.format(num, extension)):
+ num += 1
+ return name.format(num, extension)
+
+def _debug_image(image, name):
+ filename = _debug_filename(name, 'png')
+ image.save(filename)
+ _debug(f'Saved image {image} to {filename}')
+
+_debug_logfile = None
+def _debug(msg):
+ global _debug_logfile
+ if not _debug_logfile:
+ _debug_logfile = open(_debug_filename('log', 'txt'), 'wt')
+ _debug_logfile.write(msg + '\n')
+
+class Win32GlyphRenderer(base.GlyphRenderer):
+
+
+ def __init__(self, font):
+ self._bitmap = None
+ self._dc = None
+ self._bitmap_rect = None
+ super(Win32GlyphRenderer, self).__init__(font)
+ self.font = font
+
+ # Pessimistically round up width and height to 4 byte alignment
+ width = font.max_glyph_width
+ height = font.ascent - font.descent
+ width = (width | 0x3) + 1
+ height = (height | 0x3) + 1
+ self._create_bitmap(width, height)
+
+ gdi32.SelectObject(self._dc, self.font.hfont)
+
+ def _create_bitmap(self, width, height):
+ pass
+
+ def render(self, text):
+ raise NotImplementedError('abstract')
+
+class GDIGlyphRenderer(Win32GlyphRenderer):
+ def __del__(self):
+ try:
+ if self._dc:
+ gdi32.DeleteDC(self._dc)
+ if self._bitmap:
+ gdi32.DeleteObject(self._bitmap)
+ except:
+ pass
+
+ def render(self, text):
+ # Attempt to get ABC widths (only for TrueType)
+ abc = ABC()
+ if gdi32.GetCharABCWidthsW(self._dc,
+ ord(text), ord(text), byref(abc)):
+ width = abc.abcB
+ lsb = abc.abcA
+ advance = abc.abcA + abc.abcB + abc.abcC
+ else:
+ width_buf = c_int()
+ gdi32.GetCharWidth32W(self._dc,
+ ord(text), ord(text), byref(width_buf))
+ width = width_buf.value
+ lsb = 0
+ advance = width
+
+ # Can't get glyph-specific dimensions, use whole line-height.
+ height = self._bitmap_height
+ image = self._get_image(text, width, height, lsb)
+
+ glyph = self.font.create_glyph(image)
+ glyph.set_bearings(-self.font.descent, lsb, advance)
+
+ if _debug_font:
+ _debug(f'{self}.render({text})')
+ _debug(f'abc.abcA = {abc.abcA}')
+ _debug(f'abc.abcB = {abc.abcB}')
+ _debug(f'abc.abcC = {abc.abcC}')
+ _debug(f'width = {width}')
+ _debug(f'height = {height}')
+ _debug(f'lsb = {lsb}')
+ _debug(f'advance = {advance}')
+ _debug_image(image, f'glyph_{text}')
+ _debug_image(self.font.textures[0], f'tex_{text}')
+
+ return glyph
+
+ def _get_image(self, text, width, height, lsb):
+ # There's no such thing as a greyscale bitmap format in GDI. We can
+ # create an 8-bit palette bitmap with 256 shades of grey, but
+ # unfortunately antialiasing will not work on such a bitmap. So, we
+ # use a 32-bit bitmap and use the red channel as OpenGL's alpha.
+
+ gdi32.SelectObject(self._dc, self._bitmap)
+ gdi32.SelectObject(self._dc, self.font.hfont)
+ gdi32.SetBkColor(self._dc, 0x0)
+ gdi32.SetTextColor(self._dc, 0x00ffffff)
+ gdi32.SetBkMode(self._dc, OPAQUE)
+
+ # Draw to DC
+ user32.FillRect(self._dc, byref(self._bitmap_rect), self._black)
+ gdi32.ExtTextOutA(self._dc, -lsb, 0, 0, None, text,
+ len(text), None)
+ gdi32.GdiFlush()
+
+ # Create glyph object and copy bitmap data to texture
+ image = pyglet.image.ImageData(width, height,
+ 'AXXX', self._bitmap_data, self._bitmap_rect.right * 4)
+ return image
+
+ def _create_bitmap(self, width, height):
+ self._black = gdi32.GetStockObject(BLACK_BRUSH)
+ self._white = gdi32.GetStockObject(WHITE_BRUSH)
+
+ if self._dc:
+ gdi32.ReleaseDC(self._dc)
+ if self._bitmap:
+ gdi32.DeleteObject(self._bitmap)
+
+ pitch = width * 4
+ data = POINTER(c_byte * (height * pitch))()
+ info = BITMAPINFO()
+ info.bmiHeader.biSize = sizeof(info.bmiHeader)
+ info.bmiHeader.biWidth = width
+ info.bmiHeader.biHeight = height
+ info.bmiHeader.biPlanes = 1
+ info.bmiHeader.biBitCount = 32
+ info.bmiHeader.biCompression = BI_RGB
+
+ self._dc = gdi32.CreateCompatibleDC(None)
+ self._bitmap = gdi32.CreateDIBSection(None,
+ byref(info), DIB_RGB_COLORS, byref(data), None,
+ 0)
+ # Spookiness: the above line causes a "not enough storage" error,
+ # even though that error cannot be generated according to docs,
+ # and everything works fine anyway. Call SetLastError to clear it.
+ kernel32.SetLastError(0)
+
+ self._bitmap_data = data.contents
+ self._bitmap_rect = RECT()
+ self._bitmap_rect.left = 0
+ self._bitmap_rect.right = width
+ self._bitmap_rect.top = 0
+ self._bitmap_rect.bottom = height
+ self._bitmap_height = height
+
+ if _debug_font:
+ _debug(f'{self}._create_dc({width}, {height})')
+ _debug(f'_dc = {self._dc}')
+ _debug(f'_bitmap = {self._bitmap}')
+ _debug(f'pitch = {pitch}')
+ _debug(f'info.bmiHeader.biSize = {info.bmiHeader.biSize}')
+
+class Win32Font(base.Font):
+ glyph_renderer_class = GDIGlyphRenderer
+
+ def __init__(self, name, size, bold=False, italic=False, stretch=False, dpi=None):
+ super(Win32Font, self).__init__()
+
+ self.logfont = self.get_logfont(name, size, bold, italic, dpi)
+ self.hfont = gdi32.CreateFontIndirectW(byref(self.logfont))
+
+ # Create a dummy DC for coordinate mapping
+ dc = user32.GetDC(0)
+ metrics = TEXTMETRIC()
+ gdi32.SelectObject(dc, self.hfont)
+ gdi32.GetTextMetricsA(dc, byref(metrics))
+ self.ascent = metrics.tmAscent
+ self.descent = -metrics.tmDescent
+ self.max_glyph_width = metrics.tmMaxCharWidth
+ user32.ReleaseDC(0, dc)
+
+ def __del__(self):
+ gdi32.DeleteObject(self.hfont)
+
+ @staticmethod
+ def get_logfont(name, size, bold, italic, dpi):
+ # Create a dummy DC for coordinate mapping
+ dc = user32.GetDC(0)
+ if dpi is None:
+ dpi = 96
+ logpixelsy = dpi
+
+ logfont = LOGFONTW()
+ # Conversion of point size to device pixels
+ logfont.lfHeight = int(-size * logpixelsy // 72)
+ if bold:
+ logfont.lfWeight = FW_BOLD
+ else:
+ logfont.lfWeight = FW_NORMAL
+ logfont.lfItalic = italic
+ logfont.lfFaceName = name
+ logfont.lfQuality = ANTIALIASED_QUALITY
+ user32.ReleaseDC(0, dc)
+ return logfont
+
+ @classmethod
+ def have_font(cls, name):
+ # [ ] add support for loading raster fonts
+ return win32query.have_font(name)
+
+ @classmethod
+ def add_font_data(cls, data):
+ numfonts = c_uint32()
+ gdi32.AddFontMemResourceEx(data, len(data), 0, byref(numfonts))
+
+# --- GDI+ font rendering ---
+
+from pyglet.image.codecs.gdiplus import PixelFormat32bppARGB, gdiplus, Rect
+from pyglet.image.codecs.gdiplus import ImageLockModeRead, BitmapData
+
+DriverStringOptionsCmapLookup = 1
+DriverStringOptionsRealizedAdvance = 4
+TextRenderingHintAntiAlias = 4
+TextRenderingHintAntiAliasGridFit = 3
+
+StringFormatFlagsDirectionRightToLeft = 0x00000001
+StringFormatFlagsDirectionVertical = 0x00000002
+StringFormatFlagsNoFitBlackBox = 0x00000004
+StringFormatFlagsDisplayFormatControl = 0x00000020
+StringFormatFlagsNoFontFallback = 0x00000400
+StringFormatFlagsMeasureTrailingSpaces = 0x00000800
+StringFormatFlagsNoWrap = 0x00001000
+StringFormatFlagsLineLimit = 0x00002000
+StringFormatFlagsNoClip = 0x00004000
+
+class Rectf(ctypes.Structure):
+ _fields_ = [
+ ('x', ctypes.c_float),
+ ('y', ctypes.c_float),
+ ('width', ctypes.c_float),
+ ('height', ctypes.c_float),
+ ]
+
+class GDIPlusGlyphRenderer(Win32GlyphRenderer):
+ def __del__(self):
+ try:
+ if self._matrix:
+ res = gdiplus.GdipDeleteMatrix(self._matrix)
+ if self._brush:
+ res = gdiplus.GdipDeleteBrush(self._brush)
+ if self._graphics:
+ res = gdiplus.GdipDeleteGraphics(self._graphics)
+ if self._bitmap:
+ res = gdiplus.GdipDisposeImage(self._bitmap)
+ if self._dc:
+ res = user32.ReleaseDC(0, self._dc)
+ except:
+ pass
+
+ def _create_bitmap(self, width, height):
+ self._data = (ctypes.c_byte * (4 * width * height))()
+ self._bitmap = ctypes.c_void_p()
+ self._format = PixelFormat32bppARGB
+ gdiplus.GdipCreateBitmapFromScan0(width, height, width * 4,
+ self._format, self._data, ctypes.byref(self._bitmap))
+
+ self._graphics = ctypes.c_void_p()
+ gdiplus.GdipGetImageGraphicsContext(self._bitmap,
+ ctypes.byref(self._graphics))
+ gdiplus.GdipSetPageUnit(self._graphics, UnitPixel)
+
+ self._dc = user32.GetDC(0)
+ gdi32.SelectObject(self._dc, self.font.hfont)
+
+ gdiplus.GdipSetTextRenderingHint(self._graphics,
+ TextRenderingHintAntiAliasGridFit)
+
+
+ self._brush = ctypes.c_void_p()
+ gdiplus.GdipCreateSolidFill(0xffffffff, ctypes.byref(self._brush))
+
+
+ self._matrix = ctypes.c_void_p()
+ gdiplus.GdipCreateMatrix(ctypes.byref(self._matrix))
+
+ self._flags = (DriverStringOptionsCmapLookup |
+ DriverStringOptionsRealizedAdvance)
+
+ self._rect = Rect(0, 0, width, height)
+
+ self._bitmap_height = height
+
+ def render(self, text):
+ ch = ctypes.create_unicode_buffer(text)
+ len_ch = len(text)
+
+ # Layout rectangle; not clipped against so not terribly important.
+ width = 10000
+ height = self._bitmap_height
+ rect = Rectf(0, self._bitmap_height
+ - self.font.ascent + self.font.descent,
+ width, height)
+
+ # Set up GenericTypographic with 1 character measure range
+ generic = ctypes.c_void_p()
+ gdiplus.GdipStringFormatGetGenericTypographic(ctypes.byref(generic))
+ fmt = ctypes.c_void_p()
+ gdiplus.GdipCloneStringFormat(generic, ctypes.byref(fmt))
+ gdiplus.GdipDeleteStringFormat(generic)
+
+ # --- Measure advance
+
+ # XXX HACK HACK HACK
+ # Windows GDI+ is a filthy broken toy. No way to measure the bounding
+ # box of a string, or to obtain LSB. What a joke.
+ #
+ # For historical note, GDI cannot be used because it cannot composite
+ # into a bitmap with alpha.
+ #
+ # It looks like MS have abandoned GDI and GDI+ and are finally
+ # supporting accurate text measurement with alpha composition in .NET
+ # 2.0 (WinForms) via the TextRenderer class; this has no C interface
+ # though, so we're entirely screwed.
+ #
+ # So anyway, we first try to get the width with GdipMeasureString.
+ # Then if it's a TrueType font, we use GetCharABCWidthsW to get the
+ # correct LSB. If it's a negative LSB, we move the layoutRect `rect`
+ # to the right so that the whole glyph is rendered on the surface.
+ # For positive LSB, we let the renderer render the correct white
+ # space and we don't pass the LSB info to the Glyph.set_bearings
+
+ bbox = Rectf()
+ flags = (StringFormatFlagsMeasureTrailingSpaces |
+ StringFormatFlagsNoClip |
+ StringFormatFlagsNoFitBlackBox)
+ gdiplus.GdipSetStringFormatFlags(fmt, flags)
+ gdiplus.GdipMeasureString(self._graphics,
+ ch,
+ len_ch,
+ self.font._gdipfont,
+ ctypes.byref(rect),
+ fmt,
+ ctypes.byref(bbox),
+ None,
+ None)
+
+ # We only care about the advance from this whole thing.
+ advance = int(math.ceil(bbox.width))
+
+ # GDI functions only work for a single character so we transform
+ # grapheme \r\n into \r
+ if text == '\r\n':
+ text = '\r'
+
+ # XXX END HACK HACK HACK
+
+ abc = ABC()
+ width = 0
+ lsb = 0
+ ttf_font = True
+ # Use GDI to get code points for the text passed. This is almost always 1.
+ # For special unicode characters it may be comprised of 2+ codepoints. Get the width/lsb of each.
+ # Function only works on TTF fonts.
+ for codepoint in [ord(c) for c in text]:
+ if gdi32.GetCharABCWidthsW(self._dc, codepoint, codepoint, byref(abc)):
+ lsb += abc.abcA
+ width += abc.abcB
+
+ if lsb < 0:
+ # Negative LSB: we shift the layout rect to the right
+ # Otherwise we will cut the left part of the glyph
+ rect.x = -lsb
+ width -= lsb
+ else:
+ width += lsb
+ else:
+ ttf_font = False
+ break
+
+ # Almost always a TTF font. Haven't seen a modern font that GetCharABCWidthsW fails on.
+ # For safety, just use the advance as the width.
+ if not ttf_font:
+ width = advance
+
+ # This hack bumps up the width if the font is italic;
+ # this compensates for some common fonts. It's also a stupid
+ # waste of texture memory.
+ if self.font.italic:
+ width += width // 2
+ # Do not enlarge more than the _rect width.
+ width = min(width, self._rect.Width)
+
+ # Draw character to bitmap
+ gdiplus.GdipGraphicsClear(self._graphics, 0x00000000)
+ gdiplus.GdipDrawString(self._graphics,
+ ch,
+ len_ch,
+ self.font._gdipfont,
+ ctypes.byref(rect),
+ fmt,
+ self._brush)
+ gdiplus.GdipFlush(self._graphics, 1)
+ gdiplus.GdipDeleteStringFormat(fmt)
+
+ bitmap_data = BitmapData()
+ gdiplus.GdipBitmapLockBits(self._bitmap,
+ byref(self._rect), ImageLockModeRead, self._format,
+ byref(bitmap_data))
+
+ # Create buffer for RawImage
+ buffer = create_string_buffer(
+ bitmap_data.Stride * bitmap_data.Height)
+ memmove(buffer, bitmap_data.Scan0, len(buffer))
+
+ # Unlock data
+ gdiplus.GdipBitmapUnlockBits(self._bitmap, byref(bitmap_data))
+
+ image = pyglet.image.ImageData(width, height,
+ 'BGRA', buffer, -bitmap_data.Stride)
+
+ glyph = self.font.create_glyph(image)
+ # Only pass negative LSB info
+ lsb = min(lsb, 0)
+ glyph.set_bearings(-self.font.descent, lsb, advance)
+ return glyph
+
+FontStyleBold = 1
+FontStyleItalic = 2
+UnitPixel = 2
+UnitPoint = 3
+
+class GDIPlusFont(Win32Font):
+ glyph_renderer_class = GDIPlusGlyphRenderer
+
+ _private_fonts = None
+
+ _default_name = 'Arial'
+
+ def __init__(self, name, size, bold=False, italic=False, stretch=False, dpi=None):
+ if not name:
+ name = self._default_name
+
+ # assert type(bold) is bool, "Only a boolean value is supported for bold in the current font renderer."
+ # assert type(italic) is bool, "Only a boolean value is supported for bold in the current font renderer."
+
+ if stretch:
+ warnings.warn("The current font render does not support stretching.")
+
+ super().__init__(name, size, bold, italic, stretch, dpi)
+
+ self._name = name
+
+ family = ctypes.c_void_p()
+ name = ctypes.c_wchar_p(name)
+
+ # Look in private collection first:
+ if self._private_fonts:
+ gdiplus.GdipCreateFontFamilyFromName(name, self._private_fonts, ctypes.byref(family))
+
+ # Then in system collection:
+ if not family:
+ gdiplus.GdipCreateFontFamilyFromName(name, None, ctypes.byref(family))
+
+ # Nothing found, use default font.
+ if not family:
+ self._name = self._default_name
+ gdiplus.GdipCreateFontFamilyFromName(ctypes.c_wchar_p(self._name), None, ctypes.byref(family))
+
+ if dpi is None:
+ unit = UnitPoint
+ self.dpi = 96
+ else:
+ unit = UnitPixel
+ size = (size * dpi) // 72
+ self.dpi = dpi
+
+ style = 0
+ if bold:
+ style |= FontStyleBold
+ if italic:
+ style |= FontStyleItalic
+ self._gdipfont = ctypes.c_void_p()
+ gdiplus.GdipCreateFont(family, ctypes.c_float(size), style, unit, ctypes.byref(self._gdipfont))
+ gdiplus.GdipDeleteFontFamily(family)
+
+ @property
+ def name(self):
+ return self._name
+
+ def __del__(self):
+ super(GDIPlusFont, self).__del__()
+ gdiplus.GdipDeleteFont(self._gdipfont)
+
+ @classmethod
+ def add_font_data(cls, data):
+ super(GDIPlusFont, cls).add_font_data(data)
+
+ if not cls._private_fonts:
+ cls._private_fonts = ctypes.c_void_p()
+ gdiplus.GdipNewPrivateFontCollection(
+ ctypes.byref(cls._private_fonts))
+ gdiplus.GdipPrivateAddMemoryFont(cls._private_fonts, data, len(data))
+
+ @classmethod
+ def have_font(cls, name):
+ family = ctypes.c_void_p()
+
+ # Look in private collection first:
+ num_count = ctypes.c_int()
+ gdiplus.GdipGetFontCollectionFamilyCount(
+ cls._private_fonts, ctypes.byref(num_count))
+ gpfamilies = (ctypes.c_void_p * num_count.value)()
+ numFound = ctypes.c_int()
+ gdiplus.GdipGetFontCollectionFamilyList(
+ cls._private_fonts, num_count, gpfamilies, ctypes.byref(numFound))
+
+ font_name = ctypes.create_unicode_buffer(32)
+ for gpfamily in gpfamilies:
+ gdiplus.GdipGetFamilyName(gpfamily, font_name, '\0')
+ if font_name.value == name:
+ return True
+
+ # Else call parent class for system fonts
+ return super(GDIPlusFont, cls).have_font(name)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/win32query.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/win32query.py
new file mode 100644
index 0000000000000000000000000000000000000000..ace9975eb7c9872149ffa2264fd7a2488345f528
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/font/win32query.py
@@ -0,0 +1,523 @@
+"""
+Query system Windows fonts with pure Python.
+
+Public domain work by anatoly techtonik
+Use MIT License if public domain doesn't make sense for you.
+
+
+
+The task: Get monospace font for an application in the order of
+preference.
+
+A problem: Font ID in Windows is its name. Windows doesn't provide
+any information about filenames they contained in. From two different
+files with the same font name you can get only one.
+
+Windows also doesn't have a clear concept of _generic font family_
+familiar from CSS specification. Here is how fontquery maps Windows
+LOGFONT properties to generic CSS font families:
+
+ serif - (LOGFONT.lfPitchAndFamily >> 4) == FF_ROMAN
+ sans-serif - (LOGFONT.lfPitchAndFamily >> 4) == FF_SWISS
+ cursive - (LOGFONT.lfPitchAndFamily >> 4) == FF_SCRIPT
+ fantasy - (LOGFONT.lfPitchAndFamily >> 4) == FF_DECORATIVE
+ monospace - (lf.lfPitchAndFamily & 0b11) == FIXED_PITCH
+
+NOTE: ATM, May 2015, the Microsoft documentation related to monospace
+is misleading due to poor wording:
+ - FF_MODERN in the description of LOGFONT structure tells
+ "Fonts with constant stroke width (monospace), with or without serifs.
+ Monospace fonts are usually modern.
+ Pica, Elite, and CourierNew are examples.
+ "
+
+ Stroke width is the 'pen width', not glyph width. It should read
+
+ "Fonts with constant stroke width, with or without serifs.
+ Monospace fonts are usually modern, but not all modern are monospace
+ "
+
+PYGLET NOTE:
+Examination of all fonts in a windows xp machine shows that all fonts
+with
+
+ fontentry.vector and fontentry.family != FF_DONTCARE
+
+are rendered fine.
+
+
+Use cases:
+ [x] get the list of all available system font names
+ [ ] get the list of all fonts for generic family
+ [ ] get the list of all fonts for specific charset
+ [ ] check if specific font is available
+
+Considerations:
+ - performance of querying all system fonts is not measured
+ - Windows doesn't allow to get filenames of the fonts, so if there
+ are two fonts with the same name, one will be missing
+
+MSDN:
+
+ If you request a font named Palatino, but no such font is available
+on the system, the font mapper will substitute a font that has similar
+attributes but a different name.
+
+ [ ] check if font chosen by the system has required family
+
+ To get the appropriate font, call EnumFontFamiliesEx with the
+desired font characteristics in the LOGFONT structure, then retrieve the
+appropriate typeface name and create the font using CreateFont or
+CreateFontIndirect.
+
+"""
+
+DEBUG = False
+
+__all__ = ['have_font', 'font_list']
+
+__version__ = '0.3'
+__url__ = 'https://bitbucket.org/techtonik/fontquery'
+
+
+# -- INTRO: MAINTAIN CACHED FONTS DB --
+
+# [ ] make it Django/NDB style model definition
+class FontEntry:
+ """
+ Font classification.
+ Level 0:
+ - name
+ - vector (True if font is vector, False for raster fonts)
+ - format: ttf | ...
+ """
+
+ def __init__(self, name, vector, format, monospace, family):
+ self.name = name
+ self.vector = vector
+ self.format = format
+ self.monospace = monospace
+ self.family = family
+
+
+# List of FontEntry objects
+FONTDB = []
+
+# -- CHAPTER 1: GET ALL SYSTEM FONTS USING EnumFontFamiliesEx FROM GDI --
+
+"""
+Q: Why GDI? Why not GDI+?
+A: Wikipedia:
+
+ Because of the additional text processing and resolution independence
+capabilities in GDI+, text rendering is performed by the CPU [2] and it
+is nearly an order of magnitude slower than in hardware accelerated GDI.[3]
+Chris Jackson published some tests indicating that a piece of text
+rendering code he had written could render 99,000 glyphs per second in GDI,
+but the same code using GDI+ rendered 16,600 glyphs per second.
+"""
+
+import ctypes
+from ctypes import wintypes
+from pyglet.libs.win32 import LOGFONT, LOGFONTW
+
+user32 = ctypes.windll.user32
+gdi32 = ctypes.windll.gdi32
+
+# --- define necessary data structures from wingdi.h
+
+# for calling ANSI functions of Windows API (end with A) TCHAR is
+# defined as single char, for Unicode ones (end witn W) it is WCHAR
+CHAR = ctypes.c_char # Python 2.7 compatibility
+TCHAR = CHAR
+BYTE = ctypes.c_ubyte # http://bugs.python.org/issue16376
+
+# charset codes for LOGFONT structure
+ANSI_CHARSET = 0
+ARABIC_CHARSET = 178
+BALTIC_CHARSET = 186
+CHINESEBIG5_CHARSET = 136
+DEFAULT_CHARSET = 1
+# - charset for current system locale -
+# means function can be called several times
+# for the single font (for each charset)
+EASTEUROPE_CHARSET = 238
+GB2312_CHARSET = 134
+GREEK_CHARSET = 161
+HANGUL_CHARSET = 129
+HEBREW_CHARSET = 177
+JOHAB_CHARSET = 130
+MAC_CHARSET = 77
+OEM_CHARSET = 255 # OS dependent system charset
+RUSSIAN_CHARSET = 204
+SHIFTJIS_CHARSET = 128
+SYMBOL_CHARSET = 2
+THAI_CHARSET = 222
+TURKISH_CHARSET = 162
+VIETNAMESE_CHARSET = 163
+
+# build lookup dictionary to get charset name from its code
+CHARSET_NAMES = {}
+for (name, value) in locals().copy().items():
+ if name.endswith('_CHARSET'):
+ CHARSET_NAMES[value] = name
+
+# font pitch constants ('fixed pitch' means 'monospace')
+DEFAULT_PITCH = 0
+FIXED_PITCH = 1
+VARIABLE_PITCH = 2
+
+# Windows font family constants
+FF_DONTCARE = 0 # Don't care or don't know
+FF_ROMAN = 1 # with serifs, proportional
+FF_SWISS = 2 # w/out serifs, proportional
+FF_MODERN = 3 # constant stroke width
+FF_SCRIPT = 4 # handwritten
+FF_DECORATIVE = 5 # novelty
+
+
+class FONTSIGNATURE(ctypes.Structure):
+ # supported code pages and Unicode subranges for the font
+ # needed for NEWTEXTMETRICEX structure
+ _fields_ = [
+ ('sUsb', wintypes.DWORD * 4), # 128-bit Unicode subset bitfield (USB)
+ ('sCsb', wintypes.DWORD * 2)] # 64-bit, code-page bitfield (CPB)
+
+
+class NEWTEXTMETRIC(ctypes.Structure):
+ # physical font attributes for True Type fonts
+ # needed for NEWTEXTMETRICEX structure
+ _fields_ = [
+ ('tmHeight', wintypes.LONG),
+ ('tmAscent', wintypes.LONG),
+ ('tmDescent', wintypes.LONG),
+ ('tmInternalLeading', wintypes.LONG),
+ ('tmExternalLeading', wintypes.LONG),
+ ('tmAveCharWidth', wintypes.LONG),
+ ('tmMaxCharWidth', wintypes.LONG),
+ ('tmWeight', wintypes.LONG),
+ ('tmOverhang', wintypes.LONG),
+ ('tmDigitizedAspectX', wintypes.LONG),
+ ('tmDigitizedAspectY', wintypes.LONG),
+ ('mFirstChar', TCHAR),
+ ('mLastChar', TCHAR),
+ ('mDefaultChar', TCHAR),
+ ('mBreakChar', TCHAR),
+ ('tmItalic', BYTE),
+ ('tmUnderlined', BYTE),
+ ('tmStruckOut', BYTE),
+ ('tmPitchAndFamily', BYTE),
+ ('tmCharSet', BYTE),
+ ('tmFlags', wintypes.DWORD),
+ ('ntmSizeEM', wintypes.UINT),
+ ('ntmCellHeight', wintypes.UINT),
+ ('ntmAvgWidth', wintypes.UINT)]
+
+class NEWTEXTMETRICW(ctypes.Structure):
+ _fields_ = [
+ ('tmHeight', wintypes.LONG),
+ ('tmAscent', wintypes.LONG),
+ ('tmDescent', wintypes.LONG),
+ ('tmInternalLeading', wintypes.LONG),
+ ('tmExternalLeading', wintypes.LONG),
+ ('tmAveCharWidth', wintypes.LONG),
+ ('tmMaxCharWidth', wintypes.LONG),
+ ('tmWeight', wintypes.LONG),
+ ('tmOverhang', wintypes.LONG),
+ ('tmDigitizedAspectX', wintypes.LONG),
+ ('tmDigitizedAspectY', wintypes.LONG),
+ ('mFirstChar', wintypes.WCHAR),
+ ('mLastChar', wintypes.WCHAR),
+ ('mDefaultChar', wintypes.WCHAR),
+ ('mBreakChar', wintypes.WCHAR),
+ ('tmItalic', BYTE),
+ ('tmUnderlined', BYTE),
+ ('tmStruckOut', BYTE),
+ ('tmPitchAndFamily', BYTE),
+ ('tmCharSet', BYTE),
+ ('tmFlags', wintypes.DWORD),
+ ('ntmSizeEM', wintypes.UINT),
+ ('ntmCellHeight', wintypes.UINT),
+ ('ntmAvgWidth', wintypes.UINT)]
+
+class NEWTEXTMETRICEX(ctypes.Structure):
+ # physical font attributes for True Type fonts
+ # needed for FONTENUMPROC callback function
+ _fields_ = [
+ ('ntmTm', NEWTEXTMETRIC),
+ ('ntmFontSig', FONTSIGNATURE)]
+
+class NEWTEXTMETRICEXW(ctypes.Structure):
+ _fields_ = [
+ ('ntmTm', NEWTEXTMETRICW),
+ ('ntmFontSig', FONTSIGNATURE)]
+
+# type for a function that is called by the system for
+# each font during execution of EnumFontFamiliesEx
+FONTENUMPROC = ctypes.WINFUNCTYPE(
+ ctypes.c_int, # return non-0 to continue enumeration, 0 to stop
+ ctypes.POINTER(LOGFONT),
+ ctypes.POINTER(NEWTEXTMETRICEX),
+ wintypes.DWORD, # font type, a combination of
+ # DEVICE_FONTTYPE
+ # RASTER_FONTTYPE
+ # TRUETYPE_FONTTYPE
+ wintypes.LPARAM
+)
+
+FONTENUMPROCW = ctypes.WINFUNCTYPE(
+ ctypes.c_int, # return non-0 to continue enumeration, 0 to stop
+ ctypes.POINTER(LOGFONTW),
+ ctypes.POINTER(NEWTEXTMETRICEXW),
+ wintypes.DWORD,
+ wintypes.LPARAM
+)
+
+
+# When running 64 bit windows, some types are not 32 bit, so Python/ctypes guesses wrong
+gdi32.EnumFontFamiliesExA.argtypes = [
+ wintypes.HDC,
+ ctypes.POINTER(LOGFONT),
+ FONTENUMPROC,
+ wintypes.LPARAM,
+ wintypes.DWORD]
+
+
+gdi32.EnumFontFamiliesExW.argtypes = [
+ wintypes.HDC,
+ ctypes.POINTER(LOGFONTW),
+ FONTENUMPROCW,
+ wintypes.LPARAM,
+ wintypes.DWORD]
+
+def _enum_font_names(logfont, textmetricex, fonttype, param):
+ """callback function to be executed during EnumFontFamiliesEx
+ call for each font name. it stores names in global variable
+ """
+ global FONTDB
+
+ lf = logfont.contents
+ name = lf.lfFaceName
+
+ # detect font type (vector|raster) and format (ttf)
+ # [ ] use Windows constant TRUETYPE_FONTTYPE
+ if fonttype & 4:
+ vector = True
+ fmt = 'ttf'
+ else:
+ vector = False
+ # [ ] research Windows raster format structure
+ fmt = 'unknown'
+
+ pitch = lf.lfPitchAndFamily & 0b11
+ family = lf.lfPitchAndFamily >> 4
+
+ # [ ] check FIXED_PITCH, VARIABLE_PITCH and FF_MODERN
+ # combination
+ #
+ # FP T NM 400 CHARSET: 0 DFKai-SB
+ # FP T NM 400 CHARSET: 136 DFKai-SB
+ # FP T NM 400 CHARSET: 0 @DFKai-SB
+ # FP T NM 400 CHARSET: 136 @DFKai-SB
+ # VP T M 400 CHARSET: 0 OCR A Extended
+
+ monospace = (pitch == FIXED_PITCH)
+
+ charset = lf.lfCharSet
+
+ FONTDB.append(FontEntry(name, vector, fmt, monospace, family))
+
+ if DEBUG:
+ info = ''
+
+ if pitch == FIXED_PITCH:
+ info += 'FP '
+ elif pitch == VARIABLE_PITCH:
+ info += 'VP '
+ else:
+ info += ' '
+
+ # [ ] check exact fonttype values meaning
+ info += '%s ' % {0: 'U', 1: 'R', 4: 'T'}[fonttype]
+
+ if monospace:
+ info += 'M '
+ else:
+ info += 'NM '
+
+ style = [' '] * 3
+ if lf.lfItalic:
+ style[0] = 'I'
+ if lf.lfUnderline:
+ style[1] = 'U'
+ if lf.lfStrikeOut:
+ style[2] = 'S'
+ info += ''.join(style)
+
+ info += ' %s' % lf.lfWeight
+
+ # if pitch == FIXED_PITCH:
+ if 1:
+ # print('%s CHARSET: %3s %s' % (info, lf.lfCharSet, lf.lfFaceName))
+ print(f'{info} CHARSET: {lf.lfCharSet} {lf.lfFaceName}')
+
+ return 1 # non-0 to continue enumeration
+
+
+enum_font_names = FONTENUMPROCW(_enum_font_names)
+
+
+# --- /define
+
+
+# --- prepare and call EnumFontFamiliesEx
+
+def query(charset=DEFAULT_CHARSET):
+ """
+ Prepare and call EnumFontFamiliesEx.
+
+ query()
+ - return tuple with sorted list of all available system fonts
+ query(charset=ANSI_CHARSET)
+ - return tuple sorted list of system fonts supporting ANSI charset
+
+ """
+ global FONTDB
+
+ # 1. Get device context of the entire screen
+ hdc = user32.GetDC(None)
+
+ # 2. Call EnumFontFamiliesExA (ANSI version)
+
+ # 2a. Call with empty font name to query all available fonts
+ # (or fonts for the specified charset)
+ #
+ # NOTES:
+ #
+ # * there are fonts that don't support ANSI charset
+ # * for DEFAULT_CHARSET font is passed to callback function as
+ # many times as charsets it supports
+
+ # [ ] font name should be less than 32 symbols with terminating \0
+ # [ ] check double purpose - enumerate all available font names
+ # - enumerate all available charsets for a single font
+ # - other params?
+
+ logfont = LOGFONTW(0, 0, 0, 0, 0, 0, 0, 0, charset, 0, 0, 0, 0, '')
+ FONTDB = [] # clear cached FONTDB for enum_font_names callback
+ res = gdi32.EnumFontFamiliesExW(
+ hdc, # handle to device context
+ ctypes.byref(logfont),
+ enum_font_names, # pointer to callback function
+ 0, # lParam - application-supplied data
+ 0) # dwFlags - reserved = 0
+ # res here is the last value returned by callback function
+
+ # 3. Release DC
+ user32.ReleaseDC(None, hdc)
+
+ return FONTDB
+
+
+# --- Public API ---
+
+def have_font(name, refresh=False):
+ """
+ Return True if font with specified `name` is present. The result
+ of querying system font names is cached. Set `refresh` parameter
+ to True to purge cache and reload font information.
+ """
+ if not FONTDB or refresh:
+ query()
+ if any(f.name == name for f in FONTDB):
+ return True
+ else:
+ return False
+
+
+def font_list(vector_only=False, monospace_only=False):
+ """Return list of system installed font names."""
+
+ if not FONTDB:
+ query()
+
+ fonts = FONTDB
+ if vector_only:
+ fonts = [f for f in fonts if f.vector]
+ if monospace_only:
+ fonts = [f for f in fonts if f.monospace]
+
+ return sorted([f.name for f in fonts])
+
+
+# TODO: move this into tests/
+if __name__ == '__main__':
+ import sys
+
+ if sys.argv[1:] == ['debug']:
+ DEBUG = True
+
+ if sys.argv[1:] == ['test'] or DEBUG:
+ print('Running tests..')
+ # test have_font (Windows)
+ test_arial = have_font('Arial')
+ print('Have font "Arial"? %s' % test_arial)
+ print('Have font "missing-one"? %s' % have_font('missing-one'))
+ # test cache is not rebuilt
+ FONTDB = [FontEntry('stub', False, '', False, FF_MODERN)]
+ assert (have_font('Arial') != test_arial)
+ # test cache is rebiult
+ assert (have_font('Arial', refresh=True) == test_arial)
+ if not DEBUG:
+ sys.exit()
+
+ if sys.argv[1:] == ['vector']:
+ fonts = font_list(vector_only=True)
+ elif sys.argv[1:] == ['mono']:
+ fonts = font_list(monospace_only=True)
+ elif sys.argv[1:] == ['vector', 'mono']:
+ fonts = font_list(vector_only=True, monospace_only=True)
+ else:
+ fonts = font_list()
+ print('\n'.join(fonts))
+
+ if DEBUG:
+ print(f"Total: {len(font_list())}")
+
+
+# -- CHAPTER 2: WORK WITH FONT DIMENSIONS --
+#
+# Essential info about font metrics http://support.microsoft.com/kb/32667
+# And about logical units at http://www.winprog.org/tutorial/fonts.html
+
+# x. Convert desired font size from points into logical units (pixels)
+
+# By default logical for the screen units are pixels. This is defined
+# by default MM_TEXT mapping mode.
+
+# Point is ancient unit of measurement for physical size of a font.
+# 10pt is equal to 3.527mm. To make sure a char on screen has physical
+# size equal to 3.527mm, we need to know display size to calculate how
+# many pixels are in 3.527mm, and then fetch font that best matches
+# this size.
+
+# Essential info about conversion http://support.microsoft.com/kb/74299
+
+# x.1 Get pixels per inch using GetDeviceCaps() or ...
+
+
+# -- CHAPTER 3: LAYERED FONT API --
+#
+# y. Font object with several layers of info
+
+# Font object should contains normalized font information. This
+# information is split according to usage. For example, level 0 property
+# is font id - its name. Level 1 can be information about loaded font
+# characters - in pyglet it could be cached/used glyphs and video memory
+# taken by those glyphs.
+
+# [ ] (pyglet) investigate if it is possible to get video memory size
+# occupied by the font glyphs
+
+# [ ] (pyglet) investigate if it is possible to unload font from video
+# memory if its unused
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..a9ca9278e2ff3639e9d4c306d6c4c8e8ead8c658
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/__init__.py
@@ -0,0 +1,191 @@
+"""OpenGL interface.
+
+This package imports all OpenGL and registered OpenGL extension
+functions. Functions have identical signatures to their C counterparts.
+
+OpenGL is documented in full at the `OpenGL Reference Pages`_.
+
+The `OpenGL Programming Guide`_, also known as "The Red Book", is a popular
+reference manual organised by topic. It is available in digital and paper
+editions.
+
+.. _OpenGL Reference Pages: https://www.khronos.org/registry/OpenGL-Refpages/
+.. _OpenGL Programming Guide: http://opengl-redbook.com/
+
+The following subpackages are imported into this "mega" package already
+(and so are available by importing ``pyglet.gl``):
+
+``pyglet.gl.gl``
+ OpenGL
+``pyglet.gl.gl.glext_arb``
+ ARB registered OpenGL extension functions
+
+These subpackages are also available, but are not imported into this namespace
+by default:
+
+``pyglet.gl.glext_nv``
+ nVidia OpenGL extension functions
+``pyglet.gl.agl``
+ AGL (Mac OS X OpenGL context functions)
+``pyglet.gl.glx``
+ GLX (Linux OpenGL context functions)
+``pyglet.gl.glxext_arb``
+ ARB registered GLX extension functions
+``pyglet.gl.glxext_nv``
+ nvidia GLX extension functions
+``pyglet.gl.wgl``
+ WGL (Windows OpenGL context functions)
+``pyglet.gl.wglext_arb``
+ ARB registered WGL extension functions
+``pyglet.gl.wglext_nv``
+ nvidia WGL extension functions
+
+The information modules are provided for convenience, and are documented below.
+"""
+import pyglet as _pyglet
+
+from pyglet.gl.gl import *
+from pyglet.gl.lib import GLException
+from pyglet.gl import gl_info
+from pyglet.gl.gl_compat import GL_LUMINANCE, GL_INTENSITY
+
+from pyglet import compat_platform
+from .base import ObjectSpace, CanvasConfig, Context
+
+import sys as _sys
+_is_pyglet_doc_run = hasattr(_sys, "is_pyglet_doc_run") and _sys.is_pyglet_doc_run
+
+#: The active OpenGL context.
+#:
+#: You can change the current context by calling `Context.set_current`;
+#: do not modify this global.
+#:
+#: :type: `Context`
+#:
+#: .. versionadded:: 1.1
+current_context = None
+
+
+class ContextException(Exception):
+ pass
+
+
+class ConfigException(Exception):
+ pass
+
+
+if _pyglet.options['debug_texture']:
+ _debug_texture_total = 0
+ _debug_texture_sizes = {}
+ _debug_texture = None
+
+
+ def _debug_texture_alloc(texture, size):
+ global _debug_texture_total
+
+ _debug_texture_sizes[texture] = size
+ _debug_texture_total += size
+
+ print(f'{_debug_texture_total} (+{size})')
+
+
+ def _debug_texture_dealloc(texture):
+ global _debug_texture_total
+
+ size = _debug_texture_sizes[texture]
+ del _debug_texture_sizes[texture]
+ _debug_texture_total -= size
+
+ print(f'{_debug_texture_total} (-{size})')
+
+
+ _glBindTexture = glBindTexture
+
+
+ def glBindTexture(target, texture):
+ global _debug_texture
+ _debug_texture = texture
+ return _glBindTexture(target, texture)
+
+
+ _glTexImage2D = glTexImage2D
+
+
+ def glTexImage2D(target, level, internalformat, width, height, border,
+ format, type, pixels):
+ try:
+ _debug_texture_dealloc(_debug_texture)
+ except KeyError:
+ pass
+
+ if internalformat in (1, GL_ALPHA, GL_INTENSITY, GL_LUMINANCE):
+ depth = 1
+ elif internalformat in (2, GL_RGB16, GL_RGBA16):
+ depth = 2
+ elif internalformat in (3, GL_RGB):
+ depth = 3
+ else:
+ depth = 4 # Pretty crap assumption
+ size = (width + 2 * border) * (height + 2 * border) * depth
+ _debug_texture_alloc(_debug_texture, size)
+
+ return _glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels)
+
+
+ _glDeleteTextures = glDeleteTextures
+
+
+ def glDeleteTextures(n, textures):
+ if not hasattr(textures, '__len__'):
+ _debug_texture_dealloc(textures.value)
+ else:
+ for i in range(n):
+ _debug_texture_dealloc(textures[i].value)
+
+ return _glDeleteTextures(n, textures)
+
+
+def _create_shadow_window():
+ global _shadow_window
+
+ import pyglet
+ if not pyglet.options['shadow_window'] or _is_pyglet_doc_run:
+ return
+
+ from pyglet.window import Window
+
+ class ShadowWindow(Window):
+ def __init__(self):
+ super().__init__(width=1, height=1, visible=False)
+
+ def _create_projection(self):
+ """Shadow window does not need a projection."""
+ pass
+
+ _shadow_window = ShadowWindow()
+ _shadow_window.switch_to()
+
+ from pyglet import app
+ app.windows.remove(_shadow_window)
+
+
+if _is_pyglet_doc_run:
+ from .base import Config
+
+elif _pyglet.options['headless']:
+ from .headless import HeadlessConfig as Config
+elif compat_platform in ('win32', 'cygwin'):
+ from .win32 import Win32Config as Config
+elif compat_platform.startswith('linux'):
+ from .xlib import XlibConfig as Config
+elif compat_platform == 'darwin':
+ from .cocoa import CocoaConfig as Config
+
+
+_shadow_window = None
+
+# Import pyglet.window now if it isn't currently being imported (this creates the shadow window).
+if not _is_pyglet_doc_run and 'pyglet.window' not in _sys.modules and _pyglet.options['shadow_window']:
+ # trickery is for circular import
+ _pyglet.gl = _sys.modules[__name__]
+ import pyglet.window
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/agl.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/agl.py
new file mode 100644
index 0000000000000000000000000000000000000000..2ea771c3570599b218390d8c68fa2da8d66593ef
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/agl.py
@@ -0,0 +1,414 @@
+"""Wrapper for /System/Library/Frameworks/AGL.framework/Headers/agl.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+"""
+
+from ctypes import *
+from pyglet.gl.lib import link_AGL as _link_function
+
+if not _link_function:
+ raise ImportError('AGL framework is not available.')
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for /System/Library/Frameworks/AGL.framework/Headers/agl.h
+
+
+AGL_VERSION_2_0 = 1 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:41
+class struct_GDevice(Structure):
+ __slots__ = [
+ ]
+struct_GDevice._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GDevice = struct_GDevice # /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:1347
+GDPtr = POINTER(GDevice) # /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:1348
+GDHandle = POINTER(GDPtr) # /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:1349
+AGLDevice = GDHandle # /System/Library/Frameworks/AGL.framework/Headers/agl.h:46
+class struct_OpaqueGrafPtr(Structure):
+ __slots__ = [
+ ]
+struct_OpaqueGrafPtr._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GrafPtr = POINTER(struct_OpaqueGrafPtr) # /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:1009
+CGrafPtr = GrafPtr # /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:1392
+AGLDrawable = CGrafPtr # /System/Library/Frameworks/AGL.framework/Headers/agl.h:51
+class struct___AGLRendererInfoRec(Structure):
+ __slots__ = [
+ ]
+struct___AGLRendererInfoRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+AGLRendererInfo = POINTER(struct___AGLRendererInfoRec) # /System/Library/Frameworks/AGL.framework/Headers/agl.h:56
+class struct___AGLPixelFormatRec(Structure):
+ __slots__ = [
+ ]
+struct___AGLPixelFormatRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+AGLPixelFormat = POINTER(struct___AGLPixelFormatRec) # /System/Library/Frameworks/AGL.framework/Headers/agl.h:57
+class struct___AGLContextRec(Structure):
+ __slots__ = [
+ ]
+struct___AGLContextRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+AGLContext = POINTER(struct___AGLContextRec) # /System/Library/Frameworks/AGL.framework/Headers/agl.h:58
+class struct___AGLPBufferRec(Structure):
+ __slots__ = [
+ ]
+struct___AGLPBufferRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+AGLPbuffer = POINTER(struct___AGLPBufferRec) # /System/Library/Frameworks/AGL.framework/Headers/agl.h:59
+AGL_NONE = 0 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:66
+AGL_ALL_RENDERERS = 1 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:67
+AGL_BUFFER_SIZE = 2 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:68
+AGL_LEVEL = 3 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:69
+AGL_RGBA = 4 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:70
+AGL_DOUBLEBUFFER = 5 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:71
+AGL_STEREO = 6 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:72
+AGL_AUX_BUFFERS = 7 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:73
+AGL_RED_SIZE = 8 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:74
+AGL_GREEN_SIZE = 9 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:75
+AGL_BLUE_SIZE = 10 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:76
+AGL_ALPHA_SIZE = 11 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:77
+AGL_DEPTH_SIZE = 12 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:78
+AGL_STENCIL_SIZE = 13 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:79
+AGL_ACCUM_RED_SIZE = 14 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:80
+AGL_ACCUM_GREEN_SIZE = 15 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:81
+AGL_ACCUM_BLUE_SIZE = 16 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:82
+AGL_ACCUM_ALPHA_SIZE = 17 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:83
+AGL_PIXEL_SIZE = 50 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:88
+AGL_MINIMUM_POLICY = 51 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:89
+AGL_MAXIMUM_POLICY = 52 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:90
+AGL_OFFSCREEN = 53 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:91
+AGL_FULLSCREEN = 54 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:92
+AGL_SAMPLE_BUFFERS_ARB = 55 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:93
+AGL_SAMPLES_ARB = 56 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:94
+AGL_AUX_DEPTH_STENCIL = 57 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:95
+AGL_COLOR_FLOAT = 58 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:96
+AGL_MULTISAMPLE = 59 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:97
+AGL_SUPERSAMPLE = 60 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:98
+AGL_SAMPLE_ALPHA = 61 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:99
+AGL_RENDERER_ID = 70 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:104
+AGL_SINGLE_RENDERER = 71 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:105
+AGL_NO_RECOVERY = 72 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:106
+AGL_ACCELERATED = 73 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:107
+AGL_CLOSEST_POLICY = 74 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:108
+AGL_ROBUST = 75 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:109
+AGL_BACKING_STORE = 76 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:110
+AGL_MP_SAFE = 78 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:111
+AGL_WINDOW = 80 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:113
+AGL_MULTISCREEN = 81 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:114
+AGL_VIRTUAL_SCREEN = 82 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:115
+AGL_COMPLIANT = 83 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:116
+AGL_PBUFFER = 90 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:118
+AGL_BUFFER_MODES = 100 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:135
+AGL_MIN_LEVEL = 101 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:136
+AGL_MAX_LEVEL = 102 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:137
+AGL_COLOR_MODES = 103 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:138
+AGL_ACCUM_MODES = 104 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:139
+AGL_DEPTH_MODES = 105 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:140
+AGL_STENCIL_MODES = 106 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:141
+AGL_MAX_AUX_BUFFERS = 107 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:142
+AGL_VIDEO_MEMORY = 120 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:143
+AGL_TEXTURE_MEMORY = 121 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:144
+AGL_RENDERER_COUNT = 128 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:145
+AGL_SWAP_RECT = 200 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:150
+AGL_BUFFER_RECT = 202 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:151
+AGL_SWAP_LIMIT = 203 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:152
+AGL_COLORMAP_TRACKING = 210 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:153
+AGL_COLORMAP_ENTRY = 212 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:154
+AGL_RASTERIZATION = 220 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:155
+AGL_SWAP_INTERVAL = 222 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:156
+AGL_STATE_VALIDATION = 230 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:157
+AGL_BUFFER_NAME = 231 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:158
+AGL_ORDER_CONTEXT_TO_FRONT = 232 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:159
+AGL_CONTEXT_SURFACE_ID = 233 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:160
+AGL_CONTEXT_DISPLAY_ID = 234 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:161
+AGL_SURFACE_ORDER = 235 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:162
+AGL_SURFACE_OPACITY = 236 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:163
+AGL_CLIP_REGION = 254 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:164
+AGL_FS_CAPTURE_SINGLE = 255 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:165
+AGL_SURFACE_BACKING_SIZE = 304 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:166
+AGL_ENABLE_SURFACE_BACKING_SIZE = 305 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:167
+AGL_SURFACE_VOLATILE = 306 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:168
+AGL_FORMAT_CACHE_SIZE = 501 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:172
+AGL_CLEAR_FORMAT_CACHE = 502 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:173
+AGL_RETAIN_RENDERERS = 503 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:174
+AGL_MONOSCOPIC_BIT = 1 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:177
+AGL_STEREOSCOPIC_BIT = 2 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:178
+AGL_SINGLEBUFFER_BIT = 4 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:179
+AGL_DOUBLEBUFFER_BIT = 8 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:180
+AGL_0_BIT = 1 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:183
+AGL_1_BIT = 2 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:184
+AGL_2_BIT = 4 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:185
+AGL_3_BIT = 8 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:186
+AGL_4_BIT = 16 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:187
+AGL_5_BIT = 32 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:188
+AGL_6_BIT = 64 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:189
+AGL_8_BIT = 128 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:190
+AGL_10_BIT = 256 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:191
+AGL_12_BIT = 512 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:192
+AGL_16_BIT = 1024 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:193
+AGL_24_BIT = 2048 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:194
+AGL_32_BIT = 4096 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:195
+AGL_48_BIT = 8192 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:196
+AGL_64_BIT = 16384 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:197
+AGL_96_BIT = 32768 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:198
+AGL_128_BIT = 65536 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:199
+AGL_RGB8_BIT = 1 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:202
+AGL_RGB8_A8_BIT = 2 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:203
+AGL_BGR233_BIT = 4 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:204
+AGL_BGR233_A8_BIT = 8 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:205
+AGL_RGB332_BIT = 16 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:206
+AGL_RGB332_A8_BIT = 32 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:207
+AGL_RGB444_BIT = 64 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:208
+AGL_ARGB4444_BIT = 128 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:209
+AGL_RGB444_A8_BIT = 256 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:210
+AGL_RGB555_BIT = 512 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:211
+AGL_ARGB1555_BIT = 1024 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:212
+AGL_RGB555_A8_BIT = 2048 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:213
+AGL_RGB565_BIT = 4096 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:214
+AGL_RGB565_A8_BIT = 8192 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:215
+AGL_RGB888_BIT = 16384 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:216
+AGL_ARGB8888_BIT = 32768 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:217
+AGL_RGB888_A8_BIT = 65536 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:218
+AGL_RGB101010_BIT = 131072 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:219
+AGL_ARGB2101010_BIT = 262144 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:220
+AGL_RGB101010_A8_BIT = 524288 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:221
+AGL_RGB121212_BIT = 1048576 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:222
+AGL_ARGB12121212_BIT = 2097152 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:223
+AGL_RGB161616_BIT = 4194304 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:224
+AGL_ARGB16161616_BIT = 8388608 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:225
+AGL_INDEX8_BIT = 536870912 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:226
+AGL_INDEX16_BIT = 1073741824 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:227
+AGL_RGBFLOAT64_BIT = 16777216 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:228
+AGL_RGBAFLOAT64_BIT = 33554432 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:229
+AGL_RGBFLOAT128_BIT = 67108864 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:230
+AGL_RGBAFLOAT128_BIT = 134217728 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:231
+AGL_RGBFLOAT256_BIT = 268435456 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:232
+AGL_RGBAFLOAT256_BIT = 536870912 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:233
+AGL_NO_ERROR = 0 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:238
+AGL_BAD_ATTRIBUTE = 10000 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:240
+AGL_BAD_PROPERTY = 10001 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:241
+AGL_BAD_PIXELFMT = 10002 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:242
+AGL_BAD_RENDINFO = 10003 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:243
+AGL_BAD_CONTEXT = 10004 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:244
+AGL_BAD_DRAWABLE = 10005 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:245
+AGL_BAD_GDEV = 10006 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:246
+AGL_BAD_STATE = 10007 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:247
+AGL_BAD_VALUE = 10008 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:248
+AGL_BAD_MATCH = 10009 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:249
+AGL_BAD_ENUM = 10010 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:250
+AGL_BAD_OFFSCREEN = 10011 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:251
+AGL_BAD_FULLSCREEN = 10012 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:252
+AGL_BAD_WINDOW = 10013 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:253
+AGL_BAD_POINTER = 10014 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:254
+AGL_BAD_MODULE = 10015 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:255
+AGL_BAD_ALLOC = 10016 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:256
+AGL_BAD_CONNECTION = 10017 # /System/Library/Frameworks/AGL.framework/Headers/agl.h:257
+GLint = c_long # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:47
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:264
+aglChoosePixelFormat = _link_function('aglChoosePixelFormat', AGLPixelFormat, [POINTER(AGLDevice), GLint, POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:265
+aglDestroyPixelFormat = _link_function('aglDestroyPixelFormat', None, [AGLPixelFormat], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:266
+aglNextPixelFormat = _link_function('aglNextPixelFormat', AGLPixelFormat, [AGLPixelFormat], None)
+
+GLboolean = c_ubyte # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:43
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:267
+aglDescribePixelFormat = _link_function('aglDescribePixelFormat', GLboolean, [AGLPixelFormat, GLint, POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:268
+aglDevicesOfPixelFormat = _link_function('aglDevicesOfPixelFormat', POINTER(AGLDevice), [AGLPixelFormat, POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:273
+aglQueryRendererInfo = _link_function('aglQueryRendererInfo', AGLRendererInfo, [POINTER(AGLDevice), GLint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:274
+aglDestroyRendererInfo = _link_function('aglDestroyRendererInfo', None, [AGLRendererInfo], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:275
+aglNextRendererInfo = _link_function('aglNextRendererInfo', AGLRendererInfo, [AGLRendererInfo], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:276
+aglDescribeRenderer = _link_function('aglDescribeRenderer', GLboolean, [AGLRendererInfo, GLint, POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:281
+aglCreateContext = _link_function('aglCreateContext', AGLContext, [AGLPixelFormat, AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:282
+aglDestroyContext = _link_function('aglDestroyContext', GLboolean, [AGLContext], None)
+
+GLuint = c_ulong # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:51
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:283
+aglCopyContext = _link_function('aglCopyContext', GLboolean, [AGLContext, AGLContext, GLuint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:284
+aglUpdateContext = _link_function('aglUpdateContext', GLboolean, [AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:289
+aglSetCurrentContext = _link_function('aglSetCurrentContext', GLboolean, [AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:290
+aglGetCurrentContext = _link_function('aglGetCurrentContext', AGLContext, [], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:295
+aglSetDrawable = _link_function('aglSetDrawable', GLboolean, [AGLContext, AGLDrawable], None)
+
+GLsizei = c_long # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:48
+GLvoid = None # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:56
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:296
+aglSetOffScreen = _link_function('aglSetOffScreen', GLboolean, [AGLContext, GLsizei, GLsizei, GLsizei, POINTER(GLvoid)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:297
+aglSetFullScreen = _link_function('aglSetFullScreen', GLboolean, [AGLContext, GLsizei, GLsizei, GLsizei, GLint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:298
+aglGetDrawable = _link_function('aglGetDrawable', AGLDrawable, [AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:303
+aglSetVirtualScreen = _link_function('aglSetVirtualScreen', GLboolean, [AGLContext, GLint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:304
+aglGetVirtualScreen = _link_function('aglGetVirtualScreen', GLint, [AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:309
+aglGetVersion = _link_function('aglGetVersion', None, [POINTER(GLint), POINTER(GLint)], None)
+
+GLenum = c_ulong # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:42
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:314
+aglConfigure = _link_function('aglConfigure', GLboolean, [GLenum, GLuint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:319
+aglSwapBuffers = _link_function('aglSwapBuffers', None, [AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:324
+aglEnable = _link_function('aglEnable', GLboolean, [AGLContext, GLenum], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:325
+aglDisable = _link_function('aglDisable', GLboolean, [AGLContext, GLenum], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:326
+aglIsEnabled = _link_function('aglIsEnabled', GLboolean, [AGLContext, GLenum], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:327
+aglSetInteger = _link_function('aglSetInteger', GLboolean, [AGLContext, GLenum, POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:328
+aglGetInteger = _link_function('aglGetInteger', GLboolean, [AGLContext, GLenum, POINTER(GLint)], None)
+
+Style = c_ubyte # /System/Library/Frameworks/CoreServices.framework/Headers/../Frameworks/CarbonCore.framework/Headers/MacTypes.h:524
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:333
+aglUseFont = _link_function('aglUseFont', GLboolean, [AGLContext, GLint, Style, GLint, GLint, GLint, GLint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:338
+aglGetError = _link_function('aglGetError', GLenum, [], None)
+
+GLubyte = c_ubyte # /System/Library/Frameworks/OpenGL.framework/Headers/gl.h:49
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:339
+aglErrorString = _link_function('aglErrorString', POINTER(GLubyte), [GLenum], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:344
+aglResetLibrary = _link_function('aglResetLibrary', None, [], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:349
+aglSurfaceTexture = _link_function('aglSurfaceTexture', None, [AGLContext, GLenum, GLenum, AGLContext], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:354
+aglCreatePBuffer = _link_function('aglCreatePBuffer', GLboolean, [GLint, GLint, GLenum, GLenum, c_long, POINTER(AGLPbuffer)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:355
+aglDestroyPBuffer = _link_function('aglDestroyPBuffer', GLboolean, [AGLPbuffer], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:356
+aglDescribePBuffer = _link_function('aglDescribePBuffer', GLboolean, [AGLPbuffer, POINTER(GLint), POINTER(GLint), POINTER(GLenum), POINTER(GLenum), POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:357
+aglTexImagePBuffer = _link_function('aglTexImagePBuffer', GLboolean, [AGLContext, AGLPbuffer, GLint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:362
+aglSetPBuffer = _link_function('aglSetPBuffer', GLboolean, [AGLContext, AGLPbuffer, GLint, GLint, GLint], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:363
+aglGetPBuffer = _link_function('aglGetPBuffer', GLboolean, [AGLContext, POINTER(AGLPbuffer), POINTER(GLint), POINTER(GLint), POINTER(GLint)], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:368
+aglGetCGLContext = _link_function('aglGetCGLContext', GLboolean, [AGLContext, POINTER(POINTER(None))], None)
+
+# /System/Library/Frameworks/AGL.framework/Headers/agl.h:369
+aglGetCGLPixelFormat = _link_function('aglGetCGLPixelFormat', GLboolean, [AGLPixelFormat, POINTER(POINTER(None))], None)
+
+__all__ = ['AGL_VERSION_2_0', 'AGLDevice', 'AGLDrawable', 'AGLRendererInfo',
+'AGLPixelFormat', 'AGLContext', 'AGLPbuffer', 'AGL_NONE', 'AGL_ALL_RENDERERS',
+'AGL_BUFFER_SIZE', 'AGL_LEVEL', 'AGL_RGBA', 'AGL_DOUBLEBUFFER', 'AGL_STEREO',
+'AGL_AUX_BUFFERS', 'AGL_RED_SIZE', 'AGL_GREEN_SIZE', 'AGL_BLUE_SIZE',
+'AGL_ALPHA_SIZE', 'AGL_DEPTH_SIZE', 'AGL_STENCIL_SIZE', 'AGL_ACCUM_RED_SIZE',
+'AGL_ACCUM_GREEN_SIZE', 'AGL_ACCUM_BLUE_SIZE', 'AGL_ACCUM_ALPHA_SIZE',
+'AGL_PIXEL_SIZE', 'AGL_MINIMUM_POLICY', 'AGL_MAXIMUM_POLICY', 'AGL_OFFSCREEN',
+'AGL_FULLSCREEN', 'AGL_SAMPLE_BUFFERS_ARB', 'AGL_SAMPLES_ARB',
+'AGL_AUX_DEPTH_STENCIL', 'AGL_COLOR_FLOAT', 'AGL_MULTISAMPLE',
+'AGL_SUPERSAMPLE', 'AGL_SAMPLE_ALPHA', 'AGL_RENDERER_ID',
+'AGL_SINGLE_RENDERER', 'AGL_NO_RECOVERY', 'AGL_ACCELERATED',
+'AGL_CLOSEST_POLICY', 'AGL_ROBUST', 'AGL_BACKING_STORE', 'AGL_MP_SAFE',
+'AGL_WINDOW', 'AGL_MULTISCREEN', 'AGL_VIRTUAL_SCREEN', 'AGL_COMPLIANT',
+'AGL_PBUFFER', 'AGL_BUFFER_MODES', 'AGL_MIN_LEVEL', 'AGL_MAX_LEVEL',
+'AGL_COLOR_MODES', 'AGL_ACCUM_MODES', 'AGL_DEPTH_MODES', 'AGL_STENCIL_MODES',
+'AGL_MAX_AUX_BUFFERS', 'AGL_VIDEO_MEMORY', 'AGL_TEXTURE_MEMORY',
+'AGL_RENDERER_COUNT', 'AGL_SWAP_RECT', 'AGL_BUFFER_RECT', 'AGL_SWAP_LIMIT',
+'AGL_COLORMAP_TRACKING', 'AGL_COLORMAP_ENTRY', 'AGL_RASTERIZATION',
+'AGL_SWAP_INTERVAL', 'AGL_STATE_VALIDATION', 'AGL_BUFFER_NAME',
+'AGL_ORDER_CONTEXT_TO_FRONT', 'AGL_CONTEXT_SURFACE_ID',
+'AGL_CONTEXT_DISPLAY_ID', 'AGL_SURFACE_ORDER', 'AGL_SURFACE_OPACITY',
+'AGL_CLIP_REGION', 'AGL_FS_CAPTURE_SINGLE', 'AGL_SURFACE_BACKING_SIZE',
+'AGL_ENABLE_SURFACE_BACKING_SIZE', 'AGL_SURFACE_VOLATILE',
+'AGL_FORMAT_CACHE_SIZE', 'AGL_CLEAR_FORMAT_CACHE', 'AGL_RETAIN_RENDERERS',
+'AGL_MONOSCOPIC_BIT', 'AGL_STEREOSCOPIC_BIT', 'AGL_SINGLEBUFFER_BIT',
+'AGL_DOUBLEBUFFER_BIT', 'AGL_0_BIT', 'AGL_1_BIT', 'AGL_2_BIT', 'AGL_3_BIT',
+'AGL_4_BIT', 'AGL_5_BIT', 'AGL_6_BIT', 'AGL_8_BIT', 'AGL_10_BIT',
+'AGL_12_BIT', 'AGL_16_BIT', 'AGL_24_BIT', 'AGL_32_BIT', 'AGL_48_BIT',
+'AGL_64_BIT', 'AGL_96_BIT', 'AGL_128_BIT', 'AGL_RGB8_BIT', 'AGL_RGB8_A8_BIT',
+'AGL_BGR233_BIT', 'AGL_BGR233_A8_BIT', 'AGL_RGB332_BIT', 'AGL_RGB332_A8_BIT',
+'AGL_RGB444_BIT', 'AGL_ARGB4444_BIT', 'AGL_RGB444_A8_BIT', 'AGL_RGB555_BIT',
+'AGL_ARGB1555_BIT', 'AGL_RGB555_A8_BIT', 'AGL_RGB565_BIT',
+'AGL_RGB565_A8_BIT', 'AGL_RGB888_BIT', 'AGL_ARGB8888_BIT',
+'AGL_RGB888_A8_BIT', 'AGL_RGB101010_BIT', 'AGL_ARGB2101010_BIT',
+'AGL_RGB101010_A8_BIT', 'AGL_RGB121212_BIT', 'AGL_ARGB12121212_BIT',
+'AGL_RGB161616_BIT', 'AGL_ARGB16161616_BIT', 'AGL_INDEX8_BIT',
+'AGL_INDEX16_BIT', 'AGL_RGBFLOAT64_BIT', 'AGL_RGBAFLOAT64_BIT',
+'AGL_RGBFLOAT128_BIT', 'AGL_RGBAFLOAT128_BIT', 'AGL_RGBFLOAT256_BIT',
+'AGL_RGBAFLOAT256_BIT', 'AGL_NO_ERROR', 'AGL_BAD_ATTRIBUTE',
+'AGL_BAD_PROPERTY', 'AGL_BAD_PIXELFMT', 'AGL_BAD_RENDINFO', 'AGL_BAD_CONTEXT',
+'AGL_BAD_DRAWABLE', 'AGL_BAD_GDEV', 'AGL_BAD_STATE', 'AGL_BAD_VALUE',
+'AGL_BAD_MATCH', 'AGL_BAD_ENUM', 'AGL_BAD_OFFSCREEN', 'AGL_BAD_FULLSCREEN',
+'AGL_BAD_WINDOW', 'AGL_BAD_POINTER', 'AGL_BAD_MODULE', 'AGL_BAD_ALLOC',
+'AGL_BAD_CONNECTION', 'aglChoosePixelFormat', 'aglDestroyPixelFormat',
+'aglNextPixelFormat', 'aglDescribePixelFormat', 'aglDevicesOfPixelFormat',
+'aglQueryRendererInfo', 'aglDestroyRendererInfo', 'aglNextRendererInfo',
+'aglDescribeRenderer', 'aglCreateContext', 'aglDestroyContext',
+'aglCopyContext', 'aglUpdateContext', 'aglSetCurrentContext',
+'aglGetCurrentContext', 'aglSetDrawable', 'aglSetOffScreen',
+'aglSetFullScreen', 'aglGetDrawable', 'aglSetVirtualScreen',
+'aglGetVirtualScreen', 'aglGetVersion', 'aglConfigure', 'aglSwapBuffers',
+'aglEnable', 'aglDisable', 'aglIsEnabled', 'aglSetInteger', 'aglGetInteger',
+'aglUseFont', 'aglGetError', 'aglErrorString', 'aglResetLibrary',
+'aglSurfaceTexture', 'aglCreatePBuffer', 'aglDestroyPBuffer',
+'aglDescribePBuffer', 'aglTexImagePBuffer', 'aglSetPBuffer', 'aglGetPBuffer',
+'aglGetCGLContext', 'aglGetCGLPixelFormat']
+# END GENERATED CONTENT (do not edit above this line)
+
+
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/base.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..3771010ae6f13c8bfe807a276a43ccdab329402d
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/base.py
@@ -0,0 +1,383 @@
+from enum import Enum
+
+from pyglet import gl
+from pyglet.gl import gl_info
+
+
+class OpenGLAPI(Enum):
+ OPENGL = 1
+ OPENGL_ES = 2
+
+
+class Config:
+ """Graphics configuration.
+
+ A Config stores the preferences for OpenGL attributes such as the
+ number of auxiliary buffers, size of the colour and depth buffers,
+ double buffering, stencilling, multi- and super-sampling, and so on.
+
+ Different platforms support a different set of attributes, so these
+ are set with a string key and a value which is integer or boolean.
+
+ :Ivariables:
+ `double_buffer` : bool
+ Specify the presence of a back-buffer for every color buffer.
+ `stereo` : bool
+ Specify the presence of separate left and right buffer sets.
+ `buffer_size` : int
+ Total bits per sample per color buffer.
+ `aux_buffers` : int
+ The number of auxiliary color buffers.
+ `sample_buffers` : int
+ The number of multisample buffers.
+ `samples` : int
+ The number of samples per pixel, or 0 if there are no multisample
+ buffers.
+ `red_size` : int
+ Bits per sample per buffer devoted to the red component.
+ `green_size` : int
+ Bits per sample per buffer devoted to the green component.
+ `blue_size` : int
+ Bits per sample per buffer devoted to the blue component.
+ `alpha_size` : int
+ Bits per sample per buffer devoted to the alpha component.
+ `depth_size` : int
+ Bits per sample in the depth buffer.
+ `stencil_size` : int
+ Bits per sample in the stencil buffer.
+ `accum_red_size` : int
+ Bits per pixel devoted to the red component in the accumulation
+ buffer.
+ `accum_green_size` : int
+ Bits per pixel devoted to the green component in the accumulation
+ buffer.
+ `accum_blue_size` : int
+ Bits per pixel devoted to the blue component in the accumulation
+ buffer.
+ `accum_alpha_size` : int
+ Bits per pixel devoted to the alpha component in the accumulation
+ buffer.
+ """
+
+ _attribute_names = [
+ 'double_buffer',
+ 'stereo',
+ 'buffer_size',
+ 'aux_buffers',
+ 'sample_buffers',
+ 'samples',
+ 'red_size',
+ 'green_size',
+ 'blue_size',
+ 'alpha_size',
+ 'depth_size',
+ 'stencil_size',
+ 'accum_red_size',
+ 'accum_green_size',
+ 'accum_blue_size',
+ 'accum_alpha_size',
+ 'major_version',
+ 'minor_version',
+ 'forward_compatible',
+ 'opengl_api',
+ 'debug'
+ ]
+
+ major_version = None
+ minor_version = None
+ forward_compatible = None
+ opengl_api = None
+ debug = None
+
+ def __init__(self, **kwargs):
+ """Create a template config with the given attributes.
+
+ Specify attributes as keyword arguments, for example::
+
+ template = Config(double_buffer=True)
+
+ """
+ for name in self._attribute_names:
+ if name in kwargs:
+ setattr(self, name, kwargs[name])
+ else:
+ setattr(self, name, None)
+
+ self.opengl_api = self.opengl_api or "gl"
+
+ def get_gl_attributes(self):
+ """Return a list of attributes set on this config.
+
+ :rtype: list of tuple (name, value)
+ :return: All attributes, with unset attributes having a value of
+ ``None``.
+ """
+ return [(name, getattr(self, name)) for name in self._attribute_names]
+
+ def match(self, canvas):
+ """Return a list of matching complete configs for the given canvas.
+
+ .. versionadded:: 1.2
+
+ :Parameters:
+ `canvas` : `Canvas`
+ Display to host contexts created from the config.
+
+ :rtype: list of `CanvasConfig`
+ """
+ raise NotImplementedError('abstract')
+
+ def create_context(self, share):
+ """Create a GL context that satisifies this configuration.
+
+ :deprecated: Use `CanvasConfig.create_context`.
+
+ :Parameters:
+ `share` : `Context`
+ If not None, a context with which to share objects with.
+
+ :rtype: `Context`
+ :return: The new context.
+ """
+ raise gl.ConfigException('This config cannot be used to create contexts. '
+ 'Use Config.match to created a CanvasConfig')
+
+ def is_complete(self):
+ """Determine if this config is complete and able to create a context.
+
+ Configs created directly are not complete, they can only serve
+ as templates for retrieving a supported config from the system.
+ For example, `pyglet.window.Screen.get_matching_configs` returns
+ complete configs.
+
+ :deprecated: Use ``isinstance(config, CanvasConfig)``.
+
+ :rtype: bool
+ :return: True if the config is complete and can create a context.
+ """
+ return isinstance(self, CanvasConfig)
+
+ def __repr__(self):
+ return f"{self.__class__.__name__}({self.get_gl_attributes()})"
+
+
+class CanvasConfig(Config):
+ """OpenGL configuration for a particular canvas.
+
+ Use `Config.match` to obtain an instance of this class.
+
+ .. versionadded:: 1.2
+
+ :Ivariables:
+ `canvas` : `Canvas`
+ The canvas this config is valid on.
+
+ """
+
+ def __init__(self, canvas, base_config):
+ self.canvas = canvas
+
+ self.major_version = base_config.major_version
+ self.minor_version = base_config.minor_version
+ self.forward_compatible = base_config.forward_compatible
+ self.opengl_api = base_config.opengl_api or self.opengl_api
+ self.debug = base_config.debug
+
+ def compatible(self, canvas):
+ raise NotImplementedError('abstract')
+
+ def create_context(self, share):
+ """Create a GL context that satisifies this configuration.
+
+ :Parameters:
+ `share` : `Context`
+ If not None, a context with which to share objects with.
+
+ :rtype: `Context`
+ :return: The new context.
+ """
+ raise NotImplementedError('abstract')
+
+ def is_complete(self):
+ return True
+
+
+class ObjectSpace:
+ def __init__(self):
+ # Textures and buffers scheduled for deletion
+ # the next time this object space is active.
+ self.doomed_textures = []
+ self.doomed_buffers = []
+ self.doomed_vaos = []
+ self.doomed_shader_programs = []
+
+
+class Context:
+ """OpenGL context for drawing.
+
+ Use `CanvasConfig.create_context` to create a context.
+
+ :Ivariables:
+ `object_space` : `ObjectSpace`
+ An object which is shared between all contexts that share
+ GL objects.
+
+ """
+ # gl_info.GLInfo instance, filled in on first set_current
+ _info = None
+
+ def __init__(self, config, context_share=None):
+ self.config = config
+ self.context_share = context_share
+ self.canvas = None
+
+ if context_share:
+ self.object_space = context_share.object_space
+ else:
+ self.object_space = ObjectSpace()
+
+ def __repr__(self):
+ return f"{self.__class__.__name__}(id={id(self)}, share={self.context_share})"
+
+ def attach(self, canvas):
+ if self.canvas is not None:
+ self.detach()
+ if not self.config.compatible(canvas):
+ raise RuntimeError(f'Cannot attach {canvas} to {self}')
+ self.canvas = canvas
+
+ def detach(self):
+ self.canvas = None
+
+ def set_current(self):
+ if not self.canvas:
+ raise RuntimeError('Canvas has not been attached')
+
+ # XXX not per-thread
+ gl.current_context = self
+
+ # XXX
+ gl_info.set_active_context()
+
+ if not self._info:
+ self._info = gl_info.GLInfo()
+ self._info.set_active_context()
+
+ # Release Textures, Buffers, and VAOs on this context scheduled for
+ # deletion. Note that the garbage collector may introduce a race
+ # condition, so operate on a copy, and clear the list afterwards.
+ if self.object_space.doomed_textures:
+ textures = self.object_space.doomed_textures[:]
+ textures = (gl.GLuint * len(textures))(*textures)
+ gl.glDeleteTextures(len(textures), textures)
+ self.object_space.doomed_textures.clear()
+ if self.object_space.doomed_buffers:
+ buffers = self.object_space.doomed_buffers[:]
+ buffers = (gl.GLuint * len(buffers))(*buffers)
+ gl.glDeleteBuffers(len(buffers), buffers)
+ self.object_space.doomed_buffers.clear()
+ if self.object_space.doomed_vaos:
+ vaos = self.object_space.doomed_vaos[:]
+ vaos = (gl.GLuint * len(vaos))(*vaos)
+ gl.glDeleteVertexArrays(len(vaos), vaos)
+ self.object_space.doomed_vaos.clear()
+ if self.object_space.doomed_shader_programs:
+ for program_id in self.object_space.doomed_shader_programs:
+ gl.glDeleteProgram(program_id)
+ self.object_space.doomed_shader_programs.clear()
+
+ def destroy(self):
+ """Release the context.
+
+ The context will not be useable after being destroyed. Each platform
+ has its own convention for releasing the context and the buffer(s)
+ that depend on it in the correct order; this should never be called
+ by an application.
+ """
+ self.detach()
+
+ if gl.current_context is self:
+ gl.current_context = None
+ gl_info.remove_active_context()
+
+ # Switch back to shadow context.
+ if gl._shadow_window is not None:
+ gl._shadow_window.switch_to()
+
+ def delete_texture(self, texture_id):
+ """Safely delete a Texture belonging to this context.
+
+ Usually, the Texture is released immediately using
+ ``glDeleteTextures``, however if another context that does not share
+ this context's object space is currently active, the deletion will
+ be deferred until an appropriate context is activated.
+
+ :Parameters:
+ `texture_id` : int
+ The OpenGL name of the Texture to delete.
+
+ """
+ if self.object_space is gl.current_context.object_space:
+ gl.glDeleteTextures(1, gl.GLuint(texture_id))
+ else:
+ self.object_space.doomed_textures.append(texture_id)
+
+ def delete_buffer(self, buffer_id):
+ """Safely delete a Buffer object belonging to this context.
+
+ This method behaves similarly to `delete_texture`, though for
+ ``glDeleteBuffers`` instead of ``glDeleteTextures``.
+
+ :Parameters:
+ `buffer_id` : int
+ The OpenGL name of the buffer to delete.
+
+ .. versionadded:: 1.1
+ """
+ if self.object_space is gl.current_context.object_space and False:
+ gl.glDeleteBuffers(1, gl.GLuint(buffer_id))
+ else:
+ self.object_space.doomed_buffers.append(buffer_id)
+
+ def delete_vao(self, vao_id):
+ """Safely delete a Vertex Array Object belonging to this context.
+
+ This method behaves similarly to `delete_texture`, though for
+ ``glDeleteVertexArrays`` instead of ``glDeleteTextures``.
+
+ :Parameters:
+ `vao_id` : int
+ The OpenGL name of the Vertex Array to delete.
+
+ .. versionadded:: 2.0
+ """
+ if gl.current_context and self.object_space is gl.current_context.object_space and False:
+ gl.glDeleteVertexArrays(1, gl.GLuint(vao_id))
+ else:
+ self.object_space.doomed_vaos.append(vao_id)
+
+ def delete_shader_program(self, program_id):
+ """Safely delete a Shader Program belonging to this context.
+
+ This method behaves similarly to `delete_texture`, though for
+ ``glDeleteProgram`` instead of ``glDeleteTextures``.
+
+ :Parameters:
+ `program_id` : int
+ The OpenGL name of the Shader Program to delete.
+
+ .. versionadded:: 2.0
+ """
+ if gl.current_context is self:
+ gl.glDeleteProgram(program_id)
+ else:
+ self.object_space.doomed_shader_programs.append(program_id)
+
+ def get_info(self):
+ """Get the OpenGL information for this context.
+
+ .. versionadded:: 1.2
+
+ :rtype: `GLInfo`
+ """
+ return self._info
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/cocoa.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/cocoa.py
new file mode 100644
index 0000000000000000000000000000000000000000..6f423879ef511fe4018a3c0a8a057a4753b13c7a
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/cocoa.py
@@ -0,0 +1,298 @@
+import platform
+from ctypes import c_uint32, c_int, byref
+
+from pyglet.gl.base import Config, CanvasConfig, Context
+
+from pyglet.gl import ContextException
+
+from pyglet.canvas.cocoa import CocoaCanvas
+
+from pyglet.libs.darwin import cocoapy, quartz
+
+
+NSOpenGLPixelFormat = cocoapy.ObjCClass('NSOpenGLPixelFormat')
+NSOpenGLContext = cocoapy.ObjCClass('NSOpenGLContext')
+
+# Version info, needed as OpenGL different Lion and onward
+"""Version is based on Darwin kernel, not OS-X version.
+OS-X / Darwin version history
+http://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
+pre-release: 0.1, 0.2, 1.0, 1.1,
+kodiak: 1.2.1,
+cheetah: 1.3.1,
+puma: 1.4.1, 5.1 -> 5.5
+jaguar: 6.0.1 -> 6.8
+panther: 7.0 -> 7.9
+tiger: 8.0 -> 8.11
+leopard: 9.0 -> 9.8
+snow_leopard: 10.0 -> 10.8
+lion: 11.0 -> 11.4
+mountain_lion: 12.0 -> 12.5
+mavericks: 13.0 -> 13.4
+yosemite: 14.0 -> 14.5
+el_capitan: 15.0 -> 15.6
+sierra: 16.0 -> 16.6
+high_sierra: 17.0 -> 17.7
+mojave: 18.0 -> 18.2
+catalina: 19.0 -> 19.6
+big_sur: 20.0 ->
+"""
+os_x_release = {
+ 'pre-release': (0,1),
+ 'kodiak': (1,2,1),
+ 'cheetah': (1,3,1),
+ 'puma': (1,4.1),
+ 'jaguar': (6,0,1),
+ 'panther': (7,),
+ 'tiger': (8,),
+ 'leopard': (9,),
+ 'snow_leopard': (10,),
+ 'lion': (11,),
+ 'mountain_lion': (12,),
+ 'mavericks': (13,),
+ 'yosemite': (14,),
+ 'el_capitan': (15,),
+ 'sierra': (16,),
+ 'high_sierra': (17,),
+ 'mojave': (18,),
+ 'catalina': (19,),
+ 'big_sur': (20,)
+}
+
+def os_x_version():
+ version = tuple([int(v) for v in platform.release().split('.')])
+
+ # ensure we return a tuple
+ if len(version) > 0:
+ return version
+ return (version,)
+
+_os_x_version = os_x_version()
+
+# Valid names for GL attributes and their corresponding NSOpenGL constant.
+_gl_attributes = {
+ 'double_buffer': cocoapy.NSOpenGLPFADoubleBuffer,
+ 'stereo': cocoapy.NSOpenGLPFAStereo,
+ 'buffer_size': cocoapy.NSOpenGLPFAColorSize,
+ 'sample_buffers': cocoapy.NSOpenGLPFASampleBuffers,
+ 'samples': cocoapy.NSOpenGLPFASamples,
+ 'aux_buffers': cocoapy.NSOpenGLPFAAuxBuffers,
+ 'alpha_size': cocoapy.NSOpenGLPFAAlphaSize,
+ 'depth_size': cocoapy.NSOpenGLPFADepthSize,
+ 'stencil_size': cocoapy.NSOpenGLPFAStencilSize,
+
+ # Not exposed by pyglet API (set internally)
+ 'all_renderers': cocoapy.NSOpenGLPFAAllRenderers,
+ 'fullscreen': cocoapy.NSOpenGLPFAFullScreen,
+ 'minimum_policy': cocoapy.NSOpenGLPFAMinimumPolicy,
+ 'maximum_policy': cocoapy.NSOpenGLPFAMaximumPolicy,
+ 'screen_mask' : cocoapy.NSOpenGLPFAScreenMask,
+
+ # Not supported in current pyglet API
+ 'color_float': cocoapy.NSOpenGLPFAColorFloat,
+ 'offscreen': cocoapy.NSOpenGLPFAOffScreen,
+ 'sample_alpha': cocoapy.NSOpenGLPFASampleAlpha,
+ 'multisample': cocoapy.NSOpenGLPFAMultisample,
+ 'supersample': cocoapy.NSOpenGLPFASupersample,
+}
+
+# NSOpenGL constants which do not require a value.
+_boolean_gl_attributes = frozenset([
+ cocoapy.NSOpenGLPFAAllRenderers,
+ cocoapy.NSOpenGLPFADoubleBuffer,
+ cocoapy.NSOpenGLPFAStereo,
+ cocoapy.NSOpenGLPFAMinimumPolicy,
+ cocoapy.NSOpenGLPFAMaximumPolicy,
+ cocoapy.NSOpenGLPFAOffScreen,
+ cocoapy.NSOpenGLPFAFullScreen,
+ cocoapy.NSOpenGLPFAColorFloat,
+ cocoapy.NSOpenGLPFAMultisample,
+ cocoapy.NSOpenGLPFASupersample,
+ cocoapy.NSOpenGLPFASampleAlpha,
+])
+
+# Attributes for which no NSOpenGLPixelFormatAttribute name exists.
+# We could probably compute actual values for these using
+# NSOpenGLPFAColorSize / 4 and NSOpenGLFAAccumSize / 4, but I'm not that
+# confident I know what I'm doing.
+_fake_gl_attributes = {
+ 'red_size': 0,
+ 'green_size': 0,
+ 'blue_size': 0,
+ 'accum_red_size': 0,
+ 'accum_green_size': 0,
+ 'accum_blue_size': 0,
+ 'accum_alpha_size': 0
+}
+
+class CocoaConfig(Config):
+
+ def match(self, canvas):
+ # Construct array of attributes for NSOpenGLPixelFormat
+ attrs = []
+ for name, value in self.get_gl_attributes():
+ attr = _gl_attributes.get(name)
+ if not attr or not value:
+ continue
+ attrs.append(attr)
+ if attr not in _boolean_gl_attributes:
+ attrs.append(int(value))
+
+ # Support for RAGE-II, which is not compliant.
+ attrs.append(cocoapy.NSOpenGLPFAAllRenderers)
+
+ # Force selection policy.
+ attrs.append(cocoapy.NSOpenGLPFAMaximumPolicy)
+
+ # NSOpenGLPFAFullScreen is always supplied so we can switch to and
+ # from fullscreen without losing the context. Also must supply the
+ # NSOpenGLPFAScreenMask attribute with appropriate display ID.
+ # Note that these attributes aren't necessary to render in fullscreen
+ # on Mac OS X 10.6, because there we are simply rendering into a
+ # screen sized window. See:
+ # http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_fullscreen/opengl_cgl.html%23//apple_ref/doc/uid/TP40001987-CH210-SW6
+ # Otherwise, make sure we refer to the correct Profile for OpenGL (Core or
+ # Legacy) on Lion and afterwards
+ if _os_x_version < os_x_release['snow_leopard']:
+ attrs.append(cocoapy.NSOpenGLPFAFullScreen)
+ attrs.append(cocoapy.NSOpenGLPFAScreenMask)
+ attrs.append(quartz.CGDisplayIDToOpenGLDisplayMask(quartz.CGMainDisplayID()))
+ elif _os_x_version >= os_x_release['lion']:
+ # check for opengl profile
+ # This requires OS-X Lion (Darwin 11) or higher
+ version = (getattr(self, 'major_version', None) or 3,
+ getattr(self, 'minor_version', None) or 3)
+
+ # tell os-x we want to request a profile
+ attrs.append(cocoapy.NSOpenGLPFAOpenGLProfile)
+
+ # check if we're wanting core or legacy
+ # Mavericks (Darwin 13) and up are capable of the Core 4.1 profile,
+ # while Lion and up are only capable of Core 3.2
+ if version[0] >= 4 and _os_x_version >= os_x_release['mavericks']:
+ attrs.append(int(cocoapy.NSOpenGLProfileVersion4_1Core))
+ elif version[0] >= 3:
+ attrs.append(int(cocoapy.NSOpenGLProfileVersion3_2Core))
+ else:
+ attrs.append(int(cocoapy.NSOpenGLProfileVersionLegacy))
+ # Terminate the list.
+ attrs.append(0)
+
+ # Create the pixel format.
+ attrsArrayType = c_uint32 * len(attrs)
+ attrsArray = attrsArrayType(*attrs)
+ pixel_format = NSOpenGLPixelFormat.alloc().initWithAttributes_(attrsArray)
+
+ # Return the match list.
+ if pixel_format is None:
+ return []
+ else:
+ return [CocoaCanvasConfig(canvas, self, pixel_format)]
+
+
+class CocoaCanvasConfig(CanvasConfig):
+
+ def __init__(self, canvas, config, pixel_format):
+ super(CocoaCanvasConfig, self).__init__(canvas, config)
+ self._pixel_format = pixel_format
+
+ # Query values for the attributes of the pixel format, and then set the
+ # corresponding attributes of the canvas config.
+ for name, attr in _gl_attributes.items():
+ vals = c_int()
+ self._pixel_format.getValues_forAttribute_forVirtualScreen_(byref(vals), attr, 0)
+ setattr(self, name, vals.value)
+
+ # Set these attributes so that we can run pyglet.info.
+ for name, value in _fake_gl_attributes.items():
+ setattr(self, name, value)
+
+ # Update the minor/major version from profile if (Mountain)Lion
+ if _os_x_version >= os_x_release['lion']:
+ vals = c_int()
+ profile = self._pixel_format.getValues_forAttribute_forVirtualScreen_(
+ byref(vals),
+ cocoapy.NSOpenGLPFAOpenGLProfile,
+ 0
+ )
+
+ if vals.value == cocoapy.NSOpenGLProfileVersion4_1Core:
+ setattr(self, "major_version", 4)
+ setattr(self, "minor_version", 1)
+ elif vals.value == cocoapy.NSOpenGLProfileVersion3_2Core:
+ setattr(self, "major_version", 3)
+ setattr(self, "minor_version", 2)
+ else:
+ setattr(self, "major_version", 2)
+ setattr(self, "minor_version", 1)
+
+ def create_context(self, share):
+ # Determine the shared NSOpenGLContext.
+ if share:
+ share_context = share._nscontext
+ else:
+ share_context = None
+
+ # Create a new NSOpenGLContext.
+ nscontext = NSOpenGLContext.alloc().initWithFormat_shareContext_(
+ self._pixel_format,
+ share_context)
+
+ return CocoaContext(self, nscontext, share)
+
+ def compatible(self, canvas):
+ return isinstance(canvas, CocoaCanvas)
+
+
+class CocoaContext(Context):
+
+ def __init__(self, config, nscontext, share):
+ super(CocoaContext, self).__init__(config, share)
+ self.config = config
+ self._nscontext = nscontext
+
+ def attach(self, canvas):
+ # See if we want OpenGL 3 in a non-Lion OS
+ if _os_x_version < os_x_release['lion']:
+ raise ContextException('OpenGL 3 not supported')
+
+ super(CocoaContext, self).attach(canvas)
+ # The NSView instance should be attached to a nondeferred window before calling
+ # setView, otherwise you get an "invalid drawable" message.
+ self._nscontext.setView_(canvas.nsview)
+ self._nscontext.view().setWantsBestResolutionOpenGLSurface_(1)
+ self.set_current()
+
+ def detach(self):
+ super(CocoaContext, self).detach()
+ self._nscontext.clearDrawable()
+
+ def set_current(self):
+ self._nscontext.makeCurrentContext()
+ super(CocoaContext, self).set_current()
+
+ def update_geometry(self):
+ # Need to call this method whenever the context drawable (an NSView)
+ # changes size or location.
+ self._nscontext.update()
+
+ def set_full_screen(self):
+ self._nscontext.makeCurrentContext()
+ self._nscontext.setFullScreen()
+
+ def destroy(self):
+ super(CocoaContext, self).destroy()
+ self._nscontext.release()
+ self._nscontext = None
+
+ def set_vsync(self, vsync=True):
+ vals = c_int(vsync)
+ self._nscontext.setValues_forParameter_(byref(vals), cocoapy.NSOpenGLCPSwapInterval)
+
+ def get_vsync(self):
+ vals = c_int()
+ self._nscontext.getValues_forParameter_(byref(vals), cocoapy.NSOpenGLCPSwapInterval)
+ return vals.value
+
+ def flip(self):
+ self._nscontext.flushBuffer()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/gl.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/gl.py
new file mode 100644
index 0000000000000000000000000000000000000000..0a9e1171b36ccd9eb3f85af85147d979fd11cc5b
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/gl.py
@@ -0,0 +1,4395 @@
+"""Wrapper for https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/master/xml/gl.xml
+Generated by tools/gengl.py.
+Do not modify this file.
+"""
+
+from ctypes import *
+from pyglet.gl.lib import link_GL as _link_function
+from pyglet.gl.lib import c_ptrdiff_t
+
+class struct___GLsync(Structure):
+ __slots__ = [
+ ]
+struct___GLsync._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# END OF gl.template
+
+# GL type definitions
+GLenum = c_uint
+GLboolean = c_ubyte
+GLbitfield = c_uint
+GLvoid = None
+GLbyte = c_char
+GLubyte = c_ubyte
+GLshort = c_short
+GLushort = c_ushort
+GLint = c_int
+GLuint = c_uint
+GLclampx = c_uint
+GLsizei = c_int
+GLfloat = c_float
+GLclampf = c_float
+GLdouble = c_double
+GLclampd = c_double
+GLchar = c_char
+GLintptr = c_ptrdiff_t
+GLsizeiptr = c_ptrdiff_t
+GLint64 = c_int64
+GLuint64 = c_uint64
+GLsync = POINTER(struct___GLsync)
+GLDEBUGPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLenum, GLsizei, POINTER(GLchar), POINTER(GLvoid))
+
+# GL enumerant (token) definitions
+GL_FALSE = 0
+GL_POINTS = 0
+GL_ZERO = 0
+GL_NONE = 0
+GL_NO_ERROR = 0
+GL_TRUE = 1
+GL_LINES = 1
+GL_ONE = 1
+GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 1
+GL_MAP_READ_BIT = 1
+GL_CONTEXT_CORE_PROFILE_BIT = 1
+GL_SYNC_FLUSH_COMMANDS_BIT = 1
+GL_VERTEX_SHADER_BIT = 1
+GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT = 1
+GL_LINE_LOOP = 2
+GL_MAP_WRITE_BIT = 2
+GL_CONTEXT_COMPATIBILITY_PROFILE_BIT = 2
+GL_FRAGMENT_SHADER_BIT = 2
+GL_ELEMENT_ARRAY_BARRIER_BIT = 2
+GL_CONTEXT_FLAG_DEBUG_BIT = 2
+GL_LINE_STRIP = 3
+GL_TRIANGLES = 4
+GL_MAP_INVALIDATE_RANGE_BIT = 4
+GL_GEOMETRY_SHADER_BIT = 4
+GL_UNIFORM_BARRIER_BIT = 4
+GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT = 4
+GL_TRIANGLE_STRIP = 5
+GL_TRIANGLE_FAN = 6
+GL_QUADS = 7
+GL_MAP_INVALIDATE_BUFFER_BIT = 8
+GL_TESS_CONTROL_SHADER_BIT = 8
+GL_TEXTURE_FETCH_BARRIER_BIT = 8
+GL_CONTEXT_FLAG_NO_ERROR_BIT = 8
+GL_LINES_ADJACENCY = 10
+GL_LINE_STRIP_ADJACENCY = 11
+GL_TRIANGLES_ADJACENCY = 12
+GL_TRIANGLE_STRIP_ADJACENCY = 13
+GL_PATCHES = 14
+GL_MAP_FLUSH_EXPLICIT_BIT = 16
+GL_TESS_EVALUATION_SHADER_BIT = 16
+GL_MAP_UNSYNCHRONIZED_BIT = 32
+GL_SHADER_IMAGE_ACCESS_BARRIER_BIT = 32
+GL_COMPUTE_SHADER_BIT = 32
+GL_COMMAND_BARRIER_BIT = 64
+GL_MAP_PERSISTENT_BIT = 64
+GL_PIXEL_BUFFER_BARRIER_BIT = 128
+GL_MAP_COHERENT_BIT = 128
+GL_DEPTH_BUFFER_BIT = 256
+GL_TEXTURE_UPDATE_BARRIER_BIT = 256
+GL_DYNAMIC_STORAGE_BIT = 256
+GL_NEVER = 512
+GL_BUFFER_UPDATE_BARRIER_BIT = 512
+GL_CLIENT_STORAGE_BIT = 512
+GL_LESS = 513
+GL_EQUAL = 514
+GL_LEQUAL = 515
+GL_GREATER = 516
+GL_NOTEQUAL = 517
+GL_GEQUAL = 518
+GL_ALWAYS = 519
+GL_SRC_COLOR = 768
+GL_ONE_MINUS_SRC_COLOR = 769
+GL_SRC_ALPHA = 770
+GL_ONE_MINUS_SRC_ALPHA = 771
+GL_DST_ALPHA = 772
+GL_ONE_MINUS_DST_ALPHA = 773
+GL_DST_COLOR = 774
+GL_ONE_MINUS_DST_COLOR = 775
+GL_SRC_ALPHA_SATURATE = 776
+GL_STENCIL_BUFFER_BIT = 1024
+GL_FRONT_LEFT = 1024
+GL_FRAMEBUFFER_BARRIER_BIT = 1024
+GL_FRONT_RIGHT = 1025
+GL_BACK_LEFT = 1026
+GL_BACK_RIGHT = 1027
+GL_FRONT = 1028
+GL_BACK = 1029
+GL_LEFT = 1030
+GL_RIGHT = 1031
+GL_FRONT_AND_BACK = 1032
+GL_INVALID_ENUM = 1280
+GL_INVALID_VALUE = 1281
+GL_INVALID_OPERATION = 1282
+GL_STACK_OVERFLOW = 1283
+GL_STACK_UNDERFLOW = 1284
+GL_OUT_OF_MEMORY = 1285
+GL_INVALID_FRAMEBUFFER_OPERATION = 1286
+GL_INVALID_FRAMEBUFFER_OPERATION_EXT = 1286
+GL_CONTEXT_LOST = 1287
+GL_TRANSFORM_FEEDBACK_BARRIER_BIT = 2048
+GL_CW = 2304
+GL_CCW = 2305
+GL_POINT_SIZE = 2833
+GL_POINT_SIZE_RANGE = 2834
+GL_SMOOTH_POINT_SIZE_RANGE = 2834
+GL_POINT_SIZE_GRANULARITY = 2835
+GL_SMOOTH_POINT_SIZE_GRANULARITY = 2835
+GL_LINE_SMOOTH = 2848
+GL_LINE_WIDTH = 2849
+GL_LINE_WIDTH_RANGE = 2850
+GL_SMOOTH_LINE_WIDTH_RANGE = 2850
+GL_LINE_WIDTH_GRANULARITY = 2851
+GL_SMOOTH_LINE_WIDTH_GRANULARITY = 2851
+GL_POLYGON_MODE = 2880
+GL_POLYGON_SMOOTH = 2881
+GL_CULL_FACE = 2884
+GL_CULL_FACE_MODE = 2885
+GL_FRONT_FACE = 2886
+GL_DEPTH_RANGE = 2928
+GL_DEPTH_TEST = 2929
+GL_DEPTH_WRITEMASK = 2930
+GL_DEPTH_CLEAR_VALUE = 2931
+GL_DEPTH_FUNC = 2932
+GL_STENCIL_TEST = 2960
+GL_STENCIL_CLEAR_VALUE = 2961
+GL_STENCIL_FUNC = 2962
+GL_STENCIL_VALUE_MASK = 2963
+GL_STENCIL_FAIL = 2964
+GL_STENCIL_PASS_DEPTH_FAIL = 2965
+GL_STENCIL_PASS_DEPTH_PASS = 2966
+GL_STENCIL_REF = 2967
+GL_STENCIL_WRITEMASK = 2968
+GL_VIEWPORT = 2978
+GL_DITHER = 3024
+GL_BLEND_DST = 3040
+GL_BLEND_SRC = 3041
+GL_BLEND = 3042
+GL_LOGIC_OP_MODE = 3056
+GL_COLOR_LOGIC_OP = 3058
+GL_DRAW_BUFFER = 3073
+GL_READ_BUFFER = 3074
+GL_SCISSOR_BOX = 3088
+GL_SCISSOR_TEST = 3089
+GL_COLOR_CLEAR_VALUE = 3106
+GL_COLOR_WRITEMASK = 3107
+GL_DOUBLEBUFFER = 3122
+GL_STEREO = 3123
+GL_LINE_SMOOTH_HINT = 3154
+GL_POLYGON_SMOOTH_HINT = 3155
+GL_UNPACK_SWAP_BYTES = 3312
+GL_UNPACK_LSB_FIRST = 3313
+GL_UNPACK_ROW_LENGTH = 3314
+GL_UNPACK_SKIP_ROWS = 3315
+GL_UNPACK_SKIP_PIXELS = 3316
+GL_UNPACK_ALIGNMENT = 3317
+GL_PACK_SWAP_BYTES = 3328
+GL_PACK_LSB_FIRST = 3329
+GL_PACK_ROW_LENGTH = 3330
+GL_PACK_SKIP_ROWS = 3331
+GL_PACK_SKIP_PIXELS = 3332
+GL_PACK_ALIGNMENT = 3333
+GL_MAX_CLIP_DISTANCES = 3378
+GL_MAX_TEXTURE_SIZE = 3379
+GL_MAX_VIEWPORT_DIMS = 3386
+GL_SUBPIXEL_BITS = 3408
+GL_TEXTURE_1D = 3552
+GL_TEXTURE_2D = 3553
+GL_TEXTURE_WIDTH = 4096
+GL_ATOMIC_COUNTER_BARRIER_BIT = 4096
+GL_TEXTURE_HEIGHT = 4097
+GL_TEXTURE_INTERNAL_FORMAT = 4099
+GL_TEXTURE_BORDER_COLOR = 4100
+GL_TEXTURE_TARGET = 4102
+GL_DONT_CARE = 4352
+GL_FASTEST = 4353
+GL_NICEST = 4354
+GL_BYTE = 5120
+GL_UNSIGNED_BYTE = 5121
+GL_SHORT = 5122
+GL_UNSIGNED_SHORT = 5123
+GL_INT = 5124
+GL_UNSIGNED_INT = 5125
+GL_FLOAT = 5126
+GL_DOUBLE = 5130
+GL_HALF_FLOAT = 5131
+GL_FIXED = 5132
+GL_CLEAR = 5376
+GL_AND = 5377
+GL_AND_REVERSE = 5378
+GL_COPY = 5379
+GL_AND_INVERTED = 5380
+GL_NOOP = 5381
+GL_XOR = 5382
+GL_OR = 5383
+GL_NOR = 5384
+GL_EQUIV = 5385
+GL_INVERT = 5386
+GL_OR_REVERSE = 5387
+GL_COPY_INVERTED = 5388
+GL_OR_INVERTED = 5389
+GL_NAND = 5390
+GL_SET = 5391
+GL_TEXTURE = 5890
+GL_COLOR = 6144
+GL_DEPTH = 6145
+GL_STENCIL = 6146
+GL_STENCIL_INDEX = 6401
+GL_DEPTH_COMPONENT = 6402
+GL_RED = 6403
+GL_GREEN = 6404
+GL_BLUE = 6405
+GL_ALPHA = 6406
+GL_RGB = 6407
+GL_RGBA = 6408
+GL_POINT = 6912
+GL_LINE = 6913
+GL_FILL = 6914
+GL_KEEP = 7680
+GL_REPLACE = 7681
+GL_INCR = 7682
+GL_DECR = 7683
+GL_VENDOR = 7936
+GL_RENDERER = 7937
+GL_VERSION = 7938
+GL_EXTENSIONS = 7939
+GL_SHADER_STORAGE_BARRIER_BIT = 8192
+GL_NEAREST = 9728
+GL_LINEAR = 9729
+GL_NEAREST_MIPMAP_NEAREST = 9984
+GL_LINEAR_MIPMAP_NEAREST = 9985
+GL_NEAREST_MIPMAP_LINEAR = 9986
+GL_LINEAR_MIPMAP_LINEAR = 9987
+GL_TEXTURE_MAG_FILTER = 10240
+GL_TEXTURE_MIN_FILTER = 10241
+GL_TEXTURE_WRAP_S = 10242
+GL_TEXTURE_WRAP_T = 10243
+GL_REPEAT = 10497
+GL_POLYGON_OFFSET_UNITS = 10752
+GL_POLYGON_OFFSET_POINT = 10753
+GL_POLYGON_OFFSET_LINE = 10754
+GL_R3_G3_B2 = 10768
+GL_CLIP_DISTANCE0 = 12288
+GL_CLIP_DISTANCE1 = 12289
+GL_CLIP_DISTANCE2 = 12290
+GL_CLIP_DISTANCE3 = 12291
+GL_CLIP_DISTANCE4 = 12292
+GL_CLIP_DISTANCE5 = 12293
+GL_CLIP_DISTANCE6 = 12294
+GL_CLIP_DISTANCE7 = 12295
+GL_COLOR_BUFFER_BIT = 16384
+GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT = 16384
+GL_QUERY_BUFFER_BARRIER_BIT = 32768
+GL_CONSTANT_COLOR = 32769
+GL_ONE_MINUS_CONSTANT_COLOR = 32770
+GL_CONSTANT_ALPHA = 32771
+GL_ONE_MINUS_CONSTANT_ALPHA = 32772
+GL_BLEND_COLOR = 32773
+GL_FUNC_ADD = 32774
+GL_MIN = 32775
+GL_MAX = 32776
+GL_BLEND_EQUATION = 32777
+GL_BLEND_EQUATION_RGB = 32777
+GL_FUNC_SUBTRACT = 32778
+GL_FUNC_REVERSE_SUBTRACT = 32779
+GL_CONVOLUTION_1D = 32784
+GL_CONVOLUTION_2D = 32785
+GL_SEPARABLE_2D = 32786
+GL_HISTOGRAM = 32804
+GL_PROXY_HISTOGRAM = 32805
+GL_MINMAX = 32814
+GL_UNSIGNED_BYTE_3_3_2 = 32818
+GL_UNSIGNED_SHORT_4_4_4_4 = 32819
+GL_UNSIGNED_SHORT_5_5_5_1 = 32820
+GL_UNSIGNED_INT_8_8_8_8 = 32821
+GL_UNSIGNED_INT_10_10_10_2 = 32822
+GL_POLYGON_OFFSET_FILL = 32823
+GL_POLYGON_OFFSET_FACTOR = 32824
+GL_RGB4 = 32847
+GL_RGB5 = 32848
+GL_RGB8 = 32849
+GL_RGB10 = 32850
+GL_RGB12 = 32851
+GL_RGB16 = 32852
+GL_RGBA2 = 32853
+GL_RGBA4 = 32854
+GL_RGB5_A1 = 32855
+GL_RGBA8 = 32856
+GL_RGB10_A2 = 32857
+GL_RGBA12 = 32858
+GL_RGBA16 = 32859
+GL_TEXTURE_RED_SIZE = 32860
+GL_TEXTURE_GREEN_SIZE = 32861
+GL_TEXTURE_BLUE_SIZE = 32862
+GL_TEXTURE_ALPHA_SIZE = 32863
+GL_PROXY_TEXTURE_1D = 32867
+GL_PROXY_TEXTURE_2D = 32868
+GL_TEXTURE_BINDING_1D = 32872
+GL_TEXTURE_BINDING_2D = 32873
+GL_TEXTURE_BINDING_3D = 32874
+GL_PACK_SKIP_IMAGES = 32875
+GL_PACK_IMAGE_HEIGHT = 32876
+GL_UNPACK_SKIP_IMAGES = 32877
+GL_UNPACK_IMAGE_HEIGHT = 32878
+GL_TEXTURE_3D = 32879
+GL_PROXY_TEXTURE_3D = 32880
+GL_TEXTURE_DEPTH = 32881
+GL_TEXTURE_WRAP_R = 32882
+GL_MAX_3D_TEXTURE_SIZE = 32883
+GL_VERTEX_ARRAY = 32884
+GL_MULTISAMPLE = 32925
+GL_MULTISAMPLE_ARB = 32925
+GL_SAMPLE_ALPHA_TO_COVERAGE = 32926
+GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = 32926
+GL_SAMPLE_ALPHA_TO_ONE = 32927
+GL_SAMPLE_ALPHA_TO_ONE_ARB = 32927
+GL_SAMPLE_COVERAGE = 32928
+GL_SAMPLE_COVERAGE_ARB = 32928
+GL_SAMPLE_BUFFERS = 32936
+GL_SAMPLE_BUFFERS_ARB = 32936
+GL_SAMPLES = 32937
+GL_SAMPLES_ARB = 32937
+GL_SAMPLE_COVERAGE_VALUE = 32938
+GL_SAMPLE_COVERAGE_VALUE_ARB = 32938
+GL_SAMPLE_COVERAGE_INVERT = 32939
+GL_SAMPLE_COVERAGE_INVERT_ARB = 32939
+GL_BLEND_DST_RGB = 32968
+GL_BLEND_SRC_RGB = 32969
+GL_BLEND_DST_ALPHA = 32970
+GL_BLEND_SRC_ALPHA = 32971
+GL_COLOR_TABLE = 32976
+GL_POST_CONVOLUTION_COLOR_TABLE = 32977
+GL_POST_COLOR_MATRIX_COLOR_TABLE = 32978
+GL_PROXY_COLOR_TABLE = 32979
+GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = 32980
+GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = 32981
+GL_BGR = 32992
+GL_BGRA = 32993
+GL_MAX_ELEMENTS_VERTICES = 33000
+GL_MAX_ELEMENTS_INDICES = 33001
+GL_PARAMETER_BUFFER = 33006
+GL_PARAMETER_BUFFER_BINDING = 33007
+GL_POINT_FADE_THRESHOLD_SIZE = 33064
+GL_CLAMP_TO_BORDER = 33069
+GL_CLAMP_TO_EDGE = 33071
+GL_TEXTURE_MIN_LOD = 33082
+GL_TEXTURE_MAX_LOD = 33083
+GL_TEXTURE_BASE_LEVEL = 33084
+GL_TEXTURE_MAX_LEVEL = 33085
+GL_DEPTH_COMPONENT16 = 33189
+GL_DEPTH_COMPONENT24 = 33190
+GL_DEPTH_COMPONENT32 = 33191
+GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 33296
+GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 33297
+GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 33298
+GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 33299
+GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 33300
+GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 33301
+GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 33302
+GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 33303
+GL_FRAMEBUFFER_DEFAULT = 33304
+GL_FRAMEBUFFER_UNDEFINED = 33305
+GL_DEPTH_STENCIL_ATTACHMENT = 33306
+GL_MAJOR_VERSION = 33307
+GL_MINOR_VERSION = 33308
+GL_NUM_EXTENSIONS = 33309
+GL_CONTEXT_FLAGS = 33310
+GL_BUFFER_IMMUTABLE_STORAGE = 33311
+GL_BUFFER_STORAGE_FLAGS = 33312
+GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED = 33313
+GL_COMPRESSED_RED = 33317
+GL_COMPRESSED_RG = 33318
+GL_RG = 33319
+GL_RG_INTEGER = 33320
+GL_R8 = 33321
+GL_R16 = 33322
+GL_RG8 = 33323
+GL_RG16 = 33324
+GL_R16F = 33325
+GL_R32F = 33326
+GL_RG16F = 33327
+GL_RG32F = 33328
+GL_R8I = 33329
+GL_R8UI = 33330
+GL_R16I = 33331
+GL_R16UI = 33332
+GL_R32I = 33333
+GL_R32UI = 33334
+GL_RG8I = 33335
+GL_RG8UI = 33336
+GL_RG16I = 33337
+GL_RG16UI = 33338
+GL_RG32I = 33339
+GL_RG32UI = 33340
+GL_DEBUG_OUTPUT_SYNCHRONOUS = 33346
+GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH = 33347
+GL_DEBUG_CALLBACK_FUNCTION = 33348
+GL_DEBUG_CALLBACK_USER_PARAM = 33349
+GL_DEBUG_SOURCE_API = 33350
+GL_DEBUG_SOURCE_WINDOW_SYSTEM = 33351
+GL_DEBUG_SOURCE_SHADER_COMPILER = 33352
+GL_DEBUG_SOURCE_THIRD_PARTY = 33353
+GL_DEBUG_SOURCE_APPLICATION = 33354
+GL_DEBUG_SOURCE_OTHER = 33355
+GL_DEBUG_TYPE_ERROR = 33356
+GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR = 33357
+GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR = 33358
+GL_DEBUG_TYPE_PORTABILITY = 33359
+GL_DEBUG_TYPE_PERFORMANCE = 33360
+GL_DEBUG_TYPE_OTHER = 33361
+GL_LOSE_CONTEXT_ON_RESET = 33362
+GL_GUILTY_CONTEXT_RESET = 33363
+GL_INNOCENT_CONTEXT_RESET = 33364
+GL_UNKNOWN_CONTEXT_RESET = 33365
+GL_RESET_NOTIFICATION_STRATEGY = 33366
+GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 33367
+GL_PROGRAM_SEPARABLE = 33368
+GL_ACTIVE_PROGRAM = 33369
+GL_PROGRAM_PIPELINE_BINDING = 33370
+GL_MAX_VIEWPORTS = 33371
+GL_VIEWPORT_SUBPIXEL_BITS = 33372
+GL_VIEWPORT_BOUNDS_RANGE = 33373
+GL_LAYER_PROVOKING_VERTEX = 33374
+GL_VIEWPORT_INDEX_PROVOKING_VERTEX = 33375
+GL_UNDEFINED_VERTEX = 33376
+GL_NO_RESET_NOTIFICATION = 33377
+GL_MAX_COMPUTE_SHARED_MEMORY_SIZE = 33378
+GL_MAX_COMPUTE_UNIFORM_COMPONENTS = 33379
+GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 33380
+GL_MAX_COMPUTE_ATOMIC_COUNTERS = 33381
+GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 33382
+GL_COMPUTE_WORK_GROUP_SIZE = 33383
+GL_DEBUG_TYPE_MARKER = 33384
+GL_DEBUG_TYPE_PUSH_GROUP = 33385
+GL_DEBUG_TYPE_POP_GROUP = 33386
+GL_DEBUG_SEVERITY_NOTIFICATION = 33387
+GL_MAX_DEBUG_GROUP_STACK_DEPTH = 33388
+GL_DEBUG_GROUP_STACK_DEPTH = 33389
+GL_MAX_UNIFORM_LOCATIONS = 33390
+GL_INTERNALFORMAT_SUPPORTED = 33391
+GL_INTERNALFORMAT_PREFERRED = 33392
+GL_INTERNALFORMAT_RED_SIZE = 33393
+GL_INTERNALFORMAT_GREEN_SIZE = 33394
+GL_INTERNALFORMAT_BLUE_SIZE = 33395
+GL_INTERNALFORMAT_ALPHA_SIZE = 33396
+GL_INTERNALFORMAT_DEPTH_SIZE = 33397
+GL_INTERNALFORMAT_STENCIL_SIZE = 33398
+GL_INTERNALFORMAT_SHARED_SIZE = 33399
+GL_INTERNALFORMAT_RED_TYPE = 33400
+GL_INTERNALFORMAT_GREEN_TYPE = 33401
+GL_INTERNALFORMAT_BLUE_TYPE = 33402
+GL_INTERNALFORMAT_ALPHA_TYPE = 33403
+GL_INTERNALFORMAT_DEPTH_TYPE = 33404
+GL_INTERNALFORMAT_STENCIL_TYPE = 33405
+GL_MAX_WIDTH = 33406
+GL_MAX_HEIGHT = 33407
+GL_MAX_DEPTH = 33408
+GL_MAX_LAYERS = 33409
+GL_MAX_COMBINED_DIMENSIONS = 33410
+GL_COLOR_COMPONENTS = 33411
+GL_DEPTH_COMPONENTS = 33412
+GL_STENCIL_COMPONENTS = 33413
+GL_COLOR_RENDERABLE = 33414
+GL_DEPTH_RENDERABLE = 33415
+GL_STENCIL_RENDERABLE = 33416
+GL_FRAMEBUFFER_RENDERABLE = 33417
+GL_FRAMEBUFFER_RENDERABLE_LAYERED = 33418
+GL_FRAMEBUFFER_BLEND = 33419
+GL_READ_PIXELS = 33420
+GL_READ_PIXELS_FORMAT = 33421
+GL_READ_PIXELS_TYPE = 33422
+GL_TEXTURE_IMAGE_FORMAT = 33423
+GL_TEXTURE_IMAGE_TYPE = 33424
+GL_GET_TEXTURE_IMAGE_FORMAT = 33425
+GL_GET_TEXTURE_IMAGE_TYPE = 33426
+GL_MIPMAP = 33427
+GL_MANUAL_GENERATE_MIPMAP = 33428
+GL_AUTO_GENERATE_MIPMAP = 33429
+GL_COLOR_ENCODING = 33430
+GL_SRGB_READ = 33431
+GL_SRGB_WRITE = 33432
+GL_FILTER = 33434
+GL_VERTEX_TEXTURE = 33435
+GL_TESS_CONTROL_TEXTURE = 33436
+GL_TESS_EVALUATION_TEXTURE = 33437
+GL_GEOMETRY_TEXTURE = 33438
+GL_FRAGMENT_TEXTURE = 33439
+GL_COMPUTE_TEXTURE = 33440
+GL_TEXTURE_SHADOW = 33441
+GL_TEXTURE_GATHER = 33442
+GL_TEXTURE_GATHER_SHADOW = 33443
+GL_SHADER_IMAGE_LOAD = 33444
+GL_SHADER_IMAGE_STORE = 33445
+GL_SHADER_IMAGE_ATOMIC = 33446
+GL_IMAGE_TEXEL_SIZE = 33447
+GL_IMAGE_COMPATIBILITY_CLASS = 33448
+GL_IMAGE_PIXEL_FORMAT = 33449
+GL_IMAGE_PIXEL_TYPE = 33450
+GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST = 33452
+GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST = 33453
+GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE = 33454
+GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE = 33455
+GL_TEXTURE_COMPRESSED_BLOCK_WIDTH = 33457
+GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT = 33458
+GL_TEXTURE_COMPRESSED_BLOCK_SIZE = 33459
+GL_CLEAR_BUFFER = 33460
+GL_TEXTURE_VIEW = 33461
+GL_VIEW_COMPATIBILITY_CLASS = 33462
+GL_FULL_SUPPORT = 33463
+GL_CAVEAT_SUPPORT = 33464
+GL_IMAGE_CLASS_4_X_32 = 33465
+GL_IMAGE_CLASS_2_X_32 = 33466
+GL_IMAGE_CLASS_1_X_32 = 33467
+GL_IMAGE_CLASS_4_X_16 = 33468
+GL_IMAGE_CLASS_2_X_16 = 33469
+GL_IMAGE_CLASS_1_X_16 = 33470
+GL_IMAGE_CLASS_4_X_8 = 33471
+GL_IMAGE_CLASS_2_X_8 = 33472
+GL_IMAGE_CLASS_1_X_8 = 33473
+GL_IMAGE_CLASS_11_11_10 = 33474
+GL_IMAGE_CLASS_10_10_10_2 = 33475
+GL_VIEW_CLASS_128_BITS = 33476
+GL_VIEW_CLASS_96_BITS = 33477
+GL_VIEW_CLASS_64_BITS = 33478
+GL_VIEW_CLASS_48_BITS = 33479
+GL_VIEW_CLASS_32_BITS = 33480
+GL_VIEW_CLASS_24_BITS = 33481
+GL_VIEW_CLASS_16_BITS = 33482
+GL_VIEW_CLASS_8_BITS = 33483
+GL_VIEW_CLASS_S3TC_DXT1_RGB = 33484
+GL_VIEW_CLASS_S3TC_DXT1_RGBA = 33485
+GL_VIEW_CLASS_S3TC_DXT3_RGBA = 33486
+GL_VIEW_CLASS_S3TC_DXT5_RGBA = 33487
+GL_VIEW_CLASS_RGTC1_RED = 33488
+GL_VIEW_CLASS_RGTC2_RG = 33489
+GL_VIEW_CLASS_BPTC_UNORM = 33490
+GL_VIEW_CLASS_BPTC_FLOAT = 33491
+GL_VERTEX_ATTRIB_BINDING = 33492
+GL_VERTEX_ATTRIB_RELATIVE_OFFSET = 33493
+GL_VERTEX_BINDING_DIVISOR = 33494
+GL_VERTEX_BINDING_OFFSET = 33495
+GL_VERTEX_BINDING_STRIDE = 33496
+GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET = 33497
+GL_MAX_VERTEX_ATTRIB_BINDINGS = 33498
+GL_TEXTURE_VIEW_MIN_LEVEL = 33499
+GL_TEXTURE_VIEW_NUM_LEVELS = 33500
+GL_TEXTURE_VIEW_MIN_LAYER = 33501
+GL_TEXTURE_VIEW_NUM_LAYERS = 33502
+GL_TEXTURE_IMMUTABLE_LEVELS = 33503
+GL_BUFFER = 33504
+GL_SHADER = 33505
+GL_PROGRAM = 33506
+GL_QUERY = 33507
+GL_PROGRAM_PIPELINE = 33508
+GL_MAX_VERTEX_ATTRIB_STRIDE = 33509
+GL_SAMPLER = 33510
+GL_DISPLAY_LIST = 33511
+GL_MAX_LABEL_LENGTH = 33512
+GL_NUM_SHADING_LANGUAGE_VERSIONS = 33513
+GL_QUERY_TARGET = 33514
+GL_TRANSFORM_FEEDBACK_OVERFLOW = 33516
+GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW = 33517
+GL_VERTICES_SUBMITTED = 33518
+GL_PRIMITIVES_SUBMITTED = 33519
+GL_VERTEX_SHADER_INVOCATIONS = 33520
+GL_TESS_CONTROL_SHADER_PATCHES = 33521
+GL_TESS_EVALUATION_SHADER_INVOCATIONS = 33522
+GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED = 33523
+GL_FRAGMENT_SHADER_INVOCATIONS = 33524
+GL_COMPUTE_SHADER_INVOCATIONS = 33525
+GL_CLIPPING_INPUT_PRIMITIVES = 33526
+GL_CLIPPING_OUTPUT_PRIMITIVES = 33527
+GL_MAX_CULL_DISTANCES = 33529
+GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES = 33530
+GL_CONTEXT_RELEASE_BEHAVIOR = 33531
+GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 33532
+GL_UNSIGNED_BYTE_2_3_3_REV = 33634
+GL_UNSIGNED_SHORT_5_6_5 = 33635
+GL_UNSIGNED_SHORT_5_6_5_REV = 33636
+GL_UNSIGNED_SHORT_4_4_4_4_REV = 33637
+GL_UNSIGNED_SHORT_1_5_5_5_REV = 33638
+GL_UNSIGNED_INT_8_8_8_8_REV = 33639
+GL_UNSIGNED_INT_2_10_10_10_REV = 33640
+GL_MIRRORED_REPEAT = 33648
+GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776
+GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777
+GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778
+GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779
+GL_ALIASED_LINE_WIDTH_RANGE = 33902
+GL_TEXTURE0 = 33984
+GL_TEXTURE1 = 33985
+GL_TEXTURE2 = 33986
+GL_TEXTURE3 = 33987
+GL_TEXTURE4 = 33988
+GL_TEXTURE5 = 33989
+GL_TEXTURE6 = 33990
+GL_TEXTURE7 = 33991
+GL_TEXTURE8 = 33992
+GL_TEXTURE9 = 33993
+GL_TEXTURE10 = 33994
+GL_TEXTURE11 = 33995
+GL_TEXTURE12 = 33996
+GL_TEXTURE13 = 33997
+GL_TEXTURE14 = 33998
+GL_TEXTURE15 = 33999
+GL_TEXTURE16 = 34000
+GL_TEXTURE17 = 34001
+GL_TEXTURE18 = 34002
+GL_TEXTURE19 = 34003
+GL_TEXTURE20 = 34004
+GL_TEXTURE21 = 34005
+GL_TEXTURE22 = 34006
+GL_TEXTURE23 = 34007
+GL_TEXTURE24 = 34008
+GL_TEXTURE25 = 34009
+GL_TEXTURE26 = 34010
+GL_TEXTURE27 = 34011
+GL_TEXTURE28 = 34012
+GL_TEXTURE29 = 34013
+GL_TEXTURE30 = 34014
+GL_TEXTURE31 = 34015
+GL_ACTIVE_TEXTURE = 34016
+GL_MAX_RENDERBUFFER_SIZE = 34024
+GL_MAX_RENDERBUFFER_SIZE_EXT = 34024
+GL_COMPRESSED_RGB = 34029
+GL_COMPRESSED_RGBA = 34030
+GL_TEXTURE_COMPRESSION_HINT = 34031
+GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER = 34032
+GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER = 34033
+GL_TEXTURE_RECTANGLE = 34037
+GL_TEXTURE_BINDING_RECTANGLE = 34038
+GL_PROXY_TEXTURE_RECTANGLE = 34039
+GL_MAX_RECTANGLE_TEXTURE_SIZE = 34040
+GL_DEPTH_STENCIL = 34041
+GL_UNSIGNED_INT_24_8 = 34042
+GL_MAX_TEXTURE_LOD_BIAS = 34045
+GL_TEXTURE_MAX_ANISOTROPY = 34046
+GL_MAX_TEXTURE_MAX_ANISOTROPY = 34047
+GL_TEXTURE_LOD_BIAS = 34049
+GL_INCR_WRAP = 34055
+GL_DECR_WRAP = 34056
+GL_TEXTURE_CUBE_MAP = 34067
+GL_TEXTURE_BINDING_CUBE_MAP = 34068
+GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069
+GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 34070
+GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 34071
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072
+GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 34073
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074
+GL_PROXY_TEXTURE_CUBE_MAP = 34075
+GL_MAX_CUBE_MAP_TEXTURE_SIZE = 34076
+GL_SRC1_ALPHA = 34185
+GL_VERTEX_ARRAY_BINDING = 34229
+GL_VERTEX_ATTRIB_ARRAY_ENABLED = 34338
+GL_VERTEX_ATTRIB_ARRAY_SIZE = 34339
+GL_VERTEX_ATTRIB_ARRAY_STRIDE = 34340
+GL_VERTEX_ATTRIB_ARRAY_TYPE = 34341
+GL_CURRENT_VERTEX_ATTRIB = 34342
+GL_VERTEX_PROGRAM_POINT_SIZE = 34370
+GL_PROGRAM_POINT_SIZE = 34370
+GL_VERTEX_ATTRIB_ARRAY_POINTER = 34373
+GL_DEPTH_CLAMP = 34383
+GL_TEXTURE_COMPRESSED_IMAGE_SIZE = 34464
+GL_TEXTURE_COMPRESSED = 34465
+GL_NUM_COMPRESSED_TEXTURE_FORMATS = 34466
+GL_COMPRESSED_TEXTURE_FORMATS = 34467
+GL_PROGRAM_BINARY_LENGTH = 34625
+GL_MIRROR_CLAMP_TO_EDGE = 34627
+GL_VERTEX_ATTRIB_ARRAY_LONG = 34638
+GL_BUFFER_SIZE = 34660
+GL_BUFFER_USAGE = 34661
+GL_NUM_PROGRAM_BINARY_FORMATS = 34814
+GL_PROGRAM_BINARY_FORMATS = 34815
+GL_STENCIL_BACK_FUNC = 34816
+GL_STENCIL_BACK_FAIL = 34817
+GL_STENCIL_BACK_PASS_DEPTH_FAIL = 34818
+GL_STENCIL_BACK_PASS_DEPTH_PASS = 34819
+GL_RGBA32F = 34836
+GL_RGB32F = 34837
+GL_RGBA16F = 34842
+GL_RGB16F = 34843
+GL_MAX_DRAW_BUFFERS = 34852
+GL_DRAW_BUFFER0 = 34853
+GL_DRAW_BUFFER1 = 34854
+GL_DRAW_BUFFER2 = 34855
+GL_DRAW_BUFFER3 = 34856
+GL_DRAW_BUFFER4 = 34857
+GL_DRAW_BUFFER5 = 34858
+GL_DRAW_BUFFER6 = 34859
+GL_DRAW_BUFFER7 = 34860
+GL_DRAW_BUFFER8 = 34861
+GL_DRAW_BUFFER9 = 34862
+GL_DRAW_BUFFER10 = 34863
+GL_DRAW_BUFFER11 = 34864
+GL_DRAW_BUFFER12 = 34865
+GL_DRAW_BUFFER13 = 34866
+GL_DRAW_BUFFER14 = 34867
+GL_DRAW_BUFFER15 = 34868
+GL_BLEND_EQUATION_ALPHA = 34877
+GL_TEXTURE_DEPTH_SIZE = 34890
+GL_TEXTURE_COMPARE_MODE = 34892
+GL_TEXTURE_COMPARE_FUNC = 34893
+GL_COMPARE_REF_TO_TEXTURE = 34894
+GL_TEXTURE_CUBE_MAP_SEAMLESS = 34895
+GL_QUERY_COUNTER_BITS = 34916
+GL_CURRENT_QUERY = 34917
+GL_QUERY_RESULT = 34918
+GL_QUERY_RESULT_AVAILABLE = 34919
+GL_MAX_VERTEX_ATTRIBS = 34921
+GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 34922
+GL_MAX_TESS_CONTROL_INPUT_COMPONENTS = 34924
+GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS = 34925
+GL_MAX_TEXTURE_IMAGE_UNITS = 34930
+GL_GEOMETRY_SHADER_INVOCATIONS = 34943
+GL_ARRAY_BUFFER = 34962
+GL_ELEMENT_ARRAY_BUFFER = 34963
+GL_ARRAY_BUFFER_BINDING = 34964
+GL_ELEMENT_ARRAY_BUFFER_BINDING = 34965
+GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 34975
+GL_READ_ONLY = 35000
+GL_WRITE_ONLY = 35001
+GL_READ_WRITE = 35002
+GL_BUFFER_ACCESS = 35003
+GL_BUFFER_MAPPED = 35004
+GL_BUFFER_MAP_POINTER = 35005
+GL_TIME_ELAPSED = 35007
+GL_STREAM_DRAW = 35040
+GL_STREAM_READ = 35041
+GL_STREAM_COPY = 35042
+GL_STATIC_DRAW = 35044
+GL_STATIC_READ = 35045
+GL_STATIC_COPY = 35046
+GL_DYNAMIC_DRAW = 35048
+GL_DYNAMIC_READ = 35049
+GL_DYNAMIC_COPY = 35050
+GL_PIXEL_PACK_BUFFER = 35051
+GL_PIXEL_UNPACK_BUFFER = 35052
+GL_PIXEL_PACK_BUFFER_BINDING = 35053
+GL_PIXEL_UNPACK_BUFFER_BINDING = 35055
+GL_DEPTH24_STENCIL8 = 35056
+GL_TEXTURE_STENCIL_SIZE = 35057
+GL_SRC1_COLOR = 35065
+GL_ONE_MINUS_SRC1_COLOR = 35066
+GL_ONE_MINUS_SRC1_ALPHA = 35067
+GL_MAX_DUAL_SOURCE_DRAW_BUFFERS = 35068
+GL_VERTEX_ATTRIB_ARRAY_INTEGER = 35069
+GL_VERTEX_ATTRIB_ARRAY_DIVISOR = 35070
+GL_MAX_ARRAY_TEXTURE_LAYERS = 35071
+GL_MIN_PROGRAM_TEXEL_OFFSET = 35076
+GL_MAX_PROGRAM_TEXEL_OFFSET = 35077
+GL_SAMPLES_PASSED = 35092
+GL_GEOMETRY_VERTICES_OUT = 35094
+GL_GEOMETRY_INPUT_TYPE = 35095
+GL_GEOMETRY_OUTPUT_TYPE = 35096
+GL_SAMPLER_BINDING = 35097
+GL_CLAMP_READ_COLOR = 35100
+GL_FIXED_ONLY = 35101
+GL_UNIFORM_BUFFER = 35345
+GL_UNIFORM_BUFFER_BINDING = 35368
+GL_UNIFORM_BUFFER_START = 35369
+GL_UNIFORM_BUFFER_SIZE = 35370
+GL_MAX_VERTEX_UNIFORM_BLOCKS = 35371
+GL_MAX_GEOMETRY_UNIFORM_BLOCKS = 35372
+GL_MAX_FRAGMENT_UNIFORM_BLOCKS = 35373
+GL_MAX_COMBINED_UNIFORM_BLOCKS = 35374
+GL_MAX_UNIFORM_BUFFER_BINDINGS = 35375
+GL_MAX_UNIFORM_BLOCK_SIZE = 35376
+GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 35377
+GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS = 35378
+GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 35379
+GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 35380
+GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 35381
+GL_ACTIVE_UNIFORM_BLOCKS = 35382
+GL_UNIFORM_TYPE = 35383
+GL_UNIFORM_SIZE = 35384
+GL_UNIFORM_NAME_LENGTH = 35385
+GL_UNIFORM_BLOCK_INDEX = 35386
+GL_UNIFORM_OFFSET = 35387
+GL_UNIFORM_ARRAY_STRIDE = 35388
+GL_UNIFORM_MATRIX_STRIDE = 35389
+GL_UNIFORM_IS_ROW_MAJOR = 35390
+GL_UNIFORM_BLOCK_BINDING = 35391
+GL_UNIFORM_BLOCK_DATA_SIZE = 35392
+GL_UNIFORM_BLOCK_NAME_LENGTH = 35393
+GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS = 35394
+GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 35395
+GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 35396
+GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER = 35397
+GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 35398
+GL_FRAGMENT_SHADER = 35632
+GL_VERTEX_SHADER = 35633
+GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = 35657
+GL_MAX_VERTEX_UNIFORM_COMPONENTS = 35658
+GL_MAX_VARYING_FLOATS = 35659
+GL_MAX_VARYING_COMPONENTS = 35659
+GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660
+GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661
+GL_SHADER_TYPE = 35663
+GL_FLOAT_VEC2 = 35664
+GL_FLOAT_VEC3 = 35665
+GL_FLOAT_VEC4 = 35666
+GL_INT_VEC2 = 35667
+GL_INT_VEC3 = 35668
+GL_INT_VEC4 = 35669
+GL_BOOL = 35670
+GL_BOOL_VEC2 = 35671
+GL_BOOL_VEC3 = 35672
+GL_BOOL_VEC4 = 35673
+GL_FLOAT_MAT2 = 35674
+GL_FLOAT_MAT3 = 35675
+GL_FLOAT_MAT4 = 35676
+GL_SAMPLER_1D = 35677
+GL_SAMPLER_2D = 35678
+GL_SAMPLER_3D = 35679
+GL_SAMPLER_CUBE = 35680
+GL_SAMPLER_1D_SHADOW = 35681
+GL_SAMPLER_2D_SHADOW = 35682
+GL_SAMPLER_2D_RECT = 35683
+GL_SAMPLER_2D_RECT_SHADOW = 35684
+GL_FLOAT_MAT2x3 = 35685
+GL_FLOAT_MAT2x4 = 35686
+GL_FLOAT_MAT3x2 = 35687
+GL_FLOAT_MAT3x4 = 35688
+GL_FLOAT_MAT4x2 = 35689
+GL_FLOAT_MAT4x3 = 35690
+GL_DELETE_STATUS = 35712
+GL_COMPILE_STATUS = 35713
+GL_LINK_STATUS = 35714
+GL_VALIDATE_STATUS = 35715
+GL_INFO_LOG_LENGTH = 35716
+GL_ATTACHED_SHADERS = 35717
+GL_ACTIVE_UNIFORMS = 35718
+GL_ACTIVE_UNIFORM_MAX_LENGTH = 35719
+GL_SHADER_SOURCE_LENGTH = 35720
+GL_ACTIVE_ATTRIBUTES = 35721
+GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 35722
+GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 35723
+GL_SHADING_LANGUAGE_VERSION = 35724
+GL_CURRENT_PROGRAM = 35725
+GL_IMPLEMENTATION_COLOR_READ_TYPE = 35738
+GL_IMPLEMENTATION_COLOR_READ_FORMAT = 35739
+GL_TEXTURE_RED_TYPE = 35856
+GL_TEXTURE_GREEN_TYPE = 35857
+GL_TEXTURE_BLUE_TYPE = 35858
+GL_TEXTURE_ALPHA_TYPE = 35859
+GL_TEXTURE_DEPTH_TYPE = 35862
+GL_UNSIGNED_NORMALIZED = 35863
+GL_TEXTURE_1D_ARRAY = 35864
+GL_PROXY_TEXTURE_1D_ARRAY = 35865
+GL_TEXTURE_2D_ARRAY = 35866
+GL_PROXY_TEXTURE_2D_ARRAY = 35867
+GL_TEXTURE_BINDING_1D_ARRAY = 35868
+GL_TEXTURE_BINDING_2D_ARRAY = 35869
+GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 35881
+GL_TEXTURE_BUFFER = 35882
+GL_TEXTURE_BUFFER_BINDING = 35882
+GL_MAX_TEXTURE_BUFFER_SIZE = 35883
+GL_TEXTURE_BINDING_BUFFER = 35884
+GL_TEXTURE_BUFFER_DATA_STORE_BINDING = 35885
+GL_ANY_SAMPLES_PASSED = 35887
+GL_SAMPLE_SHADING = 35894
+GL_MIN_SAMPLE_SHADING_VALUE = 35895
+GL_R11F_G11F_B10F = 35898
+GL_UNSIGNED_INT_10F_11F_11F_REV = 35899
+GL_RGB9_E5 = 35901
+GL_UNSIGNED_INT_5_9_9_9_REV = 35902
+GL_TEXTURE_SHARED_SIZE = 35903
+GL_SRGB = 35904
+GL_SRGB8 = 35905
+GL_SRGB_ALPHA = 35906
+GL_SRGB8_ALPHA8 = 35907
+GL_COMPRESSED_SRGB = 35912
+GL_COMPRESSED_SRGB_ALPHA = 35913
+GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 35958
+GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 35967
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 35968
+GL_TRANSFORM_FEEDBACK_VARYINGS = 35971
+GL_TRANSFORM_FEEDBACK_BUFFER_START = 35972
+GL_TRANSFORM_FEEDBACK_BUFFER_SIZE = 35973
+GL_PRIMITIVES_GENERATED = 35975
+GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 35976
+GL_RASTERIZER_DISCARD = 35977
+GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 35978
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 35979
+GL_INTERLEAVED_ATTRIBS = 35980
+GL_SEPARATE_ATTRIBS = 35981
+GL_TRANSFORM_FEEDBACK_BUFFER = 35982
+GL_TRANSFORM_FEEDBACK_BUFFER_BINDING = 35983
+GL_POINT_SPRITE_COORD_ORIGIN = 36000
+GL_LOWER_LEFT = 36001
+GL_UPPER_LEFT = 36002
+GL_STENCIL_BACK_REF = 36003
+GL_STENCIL_BACK_VALUE_MASK = 36004
+GL_STENCIL_BACK_WRITEMASK = 36005
+GL_FRAMEBUFFER_BINDING = 36006
+GL_DRAW_FRAMEBUFFER_BINDING = 36006
+GL_FRAMEBUFFER_BINDING_EXT = 36006
+GL_RENDERBUFFER_BINDING = 36007
+GL_RENDERBUFFER_BINDING_EXT = 36007
+GL_READ_FRAMEBUFFER = 36008
+GL_DRAW_FRAMEBUFFER = 36009
+GL_READ_FRAMEBUFFER_BINDING = 36010
+GL_RENDERBUFFER_SAMPLES = 36011
+GL_DEPTH_COMPONENT32F = 36012
+GL_DEPTH32F_STENCIL8 = 36013
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 36048
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = 36048
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 36049
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT = 36049
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 36050
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT = 36050
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 36051
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT = 36051
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 36052
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT = 36052
+GL_FRAMEBUFFER_COMPLETE = 36053
+GL_FRAMEBUFFER_COMPLETE_EXT = 36053
+GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054
+GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT = 36054
+GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055
+GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT = 36055
+GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT = 36057
+GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT = 36058
+GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 36059
+GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT = 36059
+GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 36060
+GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT = 36060
+GL_FRAMEBUFFER_UNSUPPORTED = 36061
+GL_FRAMEBUFFER_UNSUPPORTED_EXT = 36061
+GL_MAX_COLOR_ATTACHMENTS = 36063
+GL_MAX_COLOR_ATTACHMENTS_EXT = 36063
+GL_COLOR_ATTACHMENT0 = 36064
+GL_COLOR_ATTACHMENT0_EXT = 36064
+GL_COLOR_ATTACHMENT1 = 36065
+GL_COLOR_ATTACHMENT1_EXT = 36065
+GL_COLOR_ATTACHMENT2 = 36066
+GL_COLOR_ATTACHMENT2_EXT = 36066
+GL_COLOR_ATTACHMENT3 = 36067
+GL_COLOR_ATTACHMENT3_EXT = 36067
+GL_COLOR_ATTACHMENT4 = 36068
+GL_COLOR_ATTACHMENT4_EXT = 36068
+GL_COLOR_ATTACHMENT5 = 36069
+GL_COLOR_ATTACHMENT5_EXT = 36069
+GL_COLOR_ATTACHMENT6 = 36070
+GL_COLOR_ATTACHMENT6_EXT = 36070
+GL_COLOR_ATTACHMENT7 = 36071
+GL_COLOR_ATTACHMENT7_EXT = 36071
+GL_COLOR_ATTACHMENT8 = 36072
+GL_COLOR_ATTACHMENT8_EXT = 36072
+GL_COLOR_ATTACHMENT9 = 36073
+GL_COLOR_ATTACHMENT9_EXT = 36073
+GL_COLOR_ATTACHMENT10 = 36074
+GL_COLOR_ATTACHMENT10_EXT = 36074
+GL_COLOR_ATTACHMENT11 = 36075
+GL_COLOR_ATTACHMENT11_EXT = 36075
+GL_COLOR_ATTACHMENT12 = 36076
+GL_COLOR_ATTACHMENT12_EXT = 36076
+GL_COLOR_ATTACHMENT13 = 36077
+GL_COLOR_ATTACHMENT13_EXT = 36077
+GL_COLOR_ATTACHMENT14 = 36078
+GL_COLOR_ATTACHMENT14_EXT = 36078
+GL_COLOR_ATTACHMENT15 = 36079
+GL_COLOR_ATTACHMENT15_EXT = 36079
+GL_COLOR_ATTACHMENT16 = 36080
+GL_COLOR_ATTACHMENT17 = 36081
+GL_COLOR_ATTACHMENT18 = 36082
+GL_COLOR_ATTACHMENT19 = 36083
+GL_COLOR_ATTACHMENT20 = 36084
+GL_COLOR_ATTACHMENT21 = 36085
+GL_COLOR_ATTACHMENT22 = 36086
+GL_COLOR_ATTACHMENT23 = 36087
+GL_COLOR_ATTACHMENT24 = 36088
+GL_COLOR_ATTACHMENT25 = 36089
+GL_COLOR_ATTACHMENT26 = 36090
+GL_COLOR_ATTACHMENT27 = 36091
+GL_COLOR_ATTACHMENT28 = 36092
+GL_COLOR_ATTACHMENT29 = 36093
+GL_COLOR_ATTACHMENT30 = 36094
+GL_COLOR_ATTACHMENT31 = 36095
+GL_DEPTH_ATTACHMENT = 36096
+GL_DEPTH_ATTACHMENT_EXT = 36096
+GL_STENCIL_ATTACHMENT = 36128
+GL_STENCIL_ATTACHMENT_EXT = 36128
+GL_FRAMEBUFFER = 36160
+GL_FRAMEBUFFER_EXT = 36160
+GL_RENDERBUFFER = 36161
+GL_RENDERBUFFER_EXT = 36161
+GL_RENDERBUFFER_WIDTH = 36162
+GL_RENDERBUFFER_WIDTH_EXT = 36162
+GL_RENDERBUFFER_HEIGHT = 36163
+GL_RENDERBUFFER_HEIGHT_EXT = 36163
+GL_RENDERBUFFER_INTERNAL_FORMAT = 36164
+GL_RENDERBUFFER_INTERNAL_FORMAT_EXT = 36164
+GL_STENCIL_INDEX1 = 36166
+GL_STENCIL_INDEX1_EXT = 36166
+GL_STENCIL_INDEX4 = 36167
+GL_STENCIL_INDEX4_EXT = 36167
+GL_STENCIL_INDEX8 = 36168
+GL_STENCIL_INDEX8_EXT = 36168
+GL_STENCIL_INDEX16 = 36169
+GL_STENCIL_INDEX16_EXT = 36169
+GL_RENDERBUFFER_RED_SIZE = 36176
+GL_RENDERBUFFER_RED_SIZE_EXT = 36176
+GL_RENDERBUFFER_GREEN_SIZE = 36177
+GL_RENDERBUFFER_GREEN_SIZE_EXT = 36177
+GL_RENDERBUFFER_BLUE_SIZE = 36178
+GL_RENDERBUFFER_BLUE_SIZE_EXT = 36178
+GL_RENDERBUFFER_ALPHA_SIZE = 36179
+GL_RENDERBUFFER_ALPHA_SIZE_EXT = 36179
+GL_RENDERBUFFER_DEPTH_SIZE = 36180
+GL_RENDERBUFFER_DEPTH_SIZE_EXT = 36180
+GL_RENDERBUFFER_STENCIL_SIZE = 36181
+GL_RENDERBUFFER_STENCIL_SIZE_EXT = 36181
+GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 36182
+GL_MAX_SAMPLES = 36183
+GL_RGB565 = 36194
+GL_PRIMITIVE_RESTART_FIXED_INDEX = 36201
+GL_ANY_SAMPLES_PASSED_CONSERVATIVE = 36202
+GL_MAX_ELEMENT_INDEX = 36203
+GL_RGBA32UI = 36208
+GL_RGB32UI = 36209
+GL_RGBA16UI = 36214
+GL_RGB16UI = 36215
+GL_RGBA8UI = 36220
+GL_RGB8UI = 36221
+GL_RGBA32I = 36226
+GL_RGB32I = 36227
+GL_RGBA16I = 36232
+GL_RGB16I = 36233
+GL_RGBA8I = 36238
+GL_RGB8I = 36239
+GL_RED_INTEGER = 36244
+GL_GREEN_INTEGER = 36245
+GL_BLUE_INTEGER = 36246
+GL_RGB_INTEGER = 36248
+GL_RGBA_INTEGER = 36249
+GL_BGR_INTEGER = 36250
+GL_BGRA_INTEGER = 36251
+GL_INT_2_10_10_10_REV = 36255
+GL_FRAMEBUFFER_ATTACHMENT_LAYERED = 36263
+GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 36264
+GL_FLOAT_32_UNSIGNED_INT_24_8_REV = 36269
+GL_FRAMEBUFFER_SRGB = 36281
+GL_COMPRESSED_RED_RGTC1 = 36283
+GL_COMPRESSED_SIGNED_RED_RGTC1 = 36284
+GL_COMPRESSED_RG_RGTC2 = 36285
+GL_COMPRESSED_SIGNED_RG_RGTC2 = 36286
+GL_SAMPLER_1D_ARRAY = 36288
+GL_SAMPLER_2D_ARRAY = 36289
+GL_SAMPLER_BUFFER = 36290
+GL_SAMPLER_1D_ARRAY_SHADOW = 36291
+GL_SAMPLER_2D_ARRAY_SHADOW = 36292
+GL_SAMPLER_CUBE_SHADOW = 36293
+GL_UNSIGNED_INT_VEC2 = 36294
+GL_UNSIGNED_INT_VEC3 = 36295
+GL_UNSIGNED_INT_VEC4 = 36296
+GL_INT_SAMPLER_1D = 36297
+GL_INT_SAMPLER_2D = 36298
+GL_INT_SAMPLER_3D = 36299
+GL_INT_SAMPLER_CUBE = 36300
+GL_INT_SAMPLER_2D_RECT = 36301
+GL_INT_SAMPLER_1D_ARRAY = 36302
+GL_INT_SAMPLER_2D_ARRAY = 36303
+GL_INT_SAMPLER_BUFFER = 36304
+GL_UNSIGNED_INT_SAMPLER_1D = 36305
+GL_UNSIGNED_INT_SAMPLER_2D = 36306
+GL_UNSIGNED_INT_SAMPLER_3D = 36307
+GL_UNSIGNED_INT_SAMPLER_CUBE = 36308
+GL_UNSIGNED_INT_SAMPLER_2D_RECT = 36309
+GL_UNSIGNED_INT_SAMPLER_1D_ARRAY = 36310
+GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 36311
+GL_UNSIGNED_INT_SAMPLER_BUFFER = 36312
+GL_GEOMETRY_SHADER = 36313
+GL_MAX_GEOMETRY_UNIFORM_COMPONENTS = 36319
+GL_MAX_GEOMETRY_OUTPUT_VERTICES = 36320
+GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 36321
+GL_ACTIVE_SUBROUTINES = 36325
+GL_ACTIVE_SUBROUTINE_UNIFORMS = 36326
+GL_MAX_SUBROUTINES = 36327
+GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS = 36328
+GL_LOW_FLOAT = 36336
+GL_MEDIUM_FLOAT = 36337
+GL_HIGH_FLOAT = 36338
+GL_LOW_INT = 36339
+GL_MEDIUM_INT = 36340
+GL_HIGH_INT = 36341
+GL_SHADER_BINARY_FORMATS = 36344
+GL_NUM_SHADER_BINARY_FORMATS = 36345
+GL_SHADER_COMPILER = 36346
+GL_MAX_VERTEX_UNIFORM_VECTORS = 36347
+GL_MAX_VARYING_VECTORS = 36348
+GL_MAX_FRAGMENT_UNIFORM_VECTORS = 36349
+GL_QUERY_WAIT = 36371
+GL_QUERY_NO_WAIT = 36372
+GL_QUERY_BY_REGION_WAIT = 36373
+GL_QUERY_BY_REGION_NO_WAIT = 36374
+GL_QUERY_WAIT_INVERTED = 36375
+GL_QUERY_NO_WAIT_INVERTED = 36376
+GL_QUERY_BY_REGION_WAIT_INVERTED = 36377
+GL_QUERY_BY_REGION_NO_WAIT_INVERTED = 36378
+GL_POLYGON_OFFSET_CLAMP = 36379
+GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS = 36382
+GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS = 36383
+GL_TRANSFORM_FEEDBACK = 36386
+GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED = 36387
+GL_TRANSFORM_FEEDBACK_PAUSED = 36387
+GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE = 36388
+GL_TRANSFORM_FEEDBACK_ACTIVE = 36388
+GL_TRANSFORM_FEEDBACK_BINDING = 36389
+GL_TIMESTAMP = 36392
+GL_TEXTURE_SWIZZLE_R = 36418
+GL_TEXTURE_SWIZZLE_G = 36419
+GL_TEXTURE_SWIZZLE_B = 36420
+GL_TEXTURE_SWIZZLE_A = 36421
+GL_TEXTURE_SWIZZLE_RGBA = 36422
+GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS = 36423
+GL_ACTIVE_SUBROUTINE_MAX_LENGTH = 36424
+GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH = 36425
+GL_NUM_COMPATIBLE_SUBROUTINES = 36426
+GL_COMPATIBLE_SUBROUTINES = 36427
+GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION = 36428
+GL_FIRST_VERTEX_CONVENTION = 36429
+GL_LAST_VERTEX_CONVENTION = 36430
+GL_PROVOKING_VERTEX = 36431
+GL_SAMPLE_POSITION = 36432
+GL_SAMPLE_MASK = 36433
+GL_SAMPLE_MASK_VALUE = 36434
+GL_MAX_SAMPLE_MASK_WORDS = 36441
+GL_MAX_GEOMETRY_SHADER_INVOCATIONS = 36442
+GL_MIN_FRAGMENT_INTERPOLATION_OFFSET = 36443
+GL_MAX_FRAGMENT_INTERPOLATION_OFFSET = 36444
+GL_FRAGMENT_INTERPOLATION_OFFSET_BITS = 36445
+GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET = 36446
+GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET = 36447
+GL_MAX_TRANSFORM_FEEDBACK_BUFFERS = 36464
+GL_MAX_VERTEX_STREAMS = 36465
+GL_PATCH_VERTICES = 36466
+GL_PATCH_DEFAULT_INNER_LEVEL = 36467
+GL_PATCH_DEFAULT_OUTER_LEVEL = 36468
+GL_TESS_CONTROL_OUTPUT_VERTICES = 36469
+GL_TESS_GEN_MODE = 36470
+GL_TESS_GEN_SPACING = 36471
+GL_TESS_GEN_VERTEX_ORDER = 36472
+GL_TESS_GEN_POINT_MODE = 36473
+GL_ISOLINES = 36474
+GL_FRACTIONAL_ODD = 36475
+GL_FRACTIONAL_EVEN = 36476
+GL_MAX_PATCH_VERTICES = 36477
+GL_MAX_TESS_GEN_LEVEL = 36478
+GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS = 36479
+GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS = 36480
+GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS = 36481
+GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS = 36482
+GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS = 36483
+GL_MAX_TESS_PATCH_COMPONENTS = 36484
+GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS = 36485
+GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS = 36486
+GL_TESS_EVALUATION_SHADER = 36487
+GL_TESS_CONTROL_SHADER = 36488
+GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS = 36489
+GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS = 36490
+GL_COMPRESSED_RGBA_BPTC_UNORM = 36492
+GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 36493
+GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 36494
+GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 36495
+GL_COPY_READ_BUFFER = 36662
+GL_COPY_READ_BUFFER_BINDING = 36662
+GL_COPY_WRITE_BUFFER = 36663
+GL_COPY_WRITE_BUFFER_BINDING = 36663
+GL_MAX_IMAGE_UNITS = 36664
+GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS = 36665
+GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES = 36665
+GL_IMAGE_BINDING_NAME = 36666
+GL_IMAGE_BINDING_LEVEL = 36667
+GL_IMAGE_BINDING_LAYERED = 36668
+GL_IMAGE_BINDING_LAYER = 36669
+GL_IMAGE_BINDING_ACCESS = 36670
+GL_DRAW_INDIRECT_BUFFER = 36671
+GL_DRAW_INDIRECT_BUFFER_BINDING = 36675
+GL_DOUBLE_MAT2 = 36678
+GL_DOUBLE_MAT3 = 36679
+GL_DOUBLE_MAT4 = 36680
+GL_DOUBLE_MAT2x3 = 36681
+GL_DOUBLE_MAT2x4 = 36682
+GL_DOUBLE_MAT3x2 = 36683
+GL_DOUBLE_MAT3x4 = 36684
+GL_DOUBLE_MAT4x2 = 36685
+GL_DOUBLE_MAT4x3 = 36686
+GL_VERTEX_BINDING_BUFFER = 36687
+GL_R8_SNORM = 36756
+GL_RG8_SNORM = 36757
+GL_RGB8_SNORM = 36758
+GL_RGBA8_SNORM = 36759
+GL_R16_SNORM = 36760
+GL_RG16_SNORM = 36761
+GL_RGB16_SNORM = 36762
+GL_RGBA16_SNORM = 36763
+GL_SIGNED_NORMALIZED = 36764
+GL_PRIMITIVE_RESTART = 36765
+GL_PRIMITIVE_RESTART_INDEX = 36766
+GL_DOUBLE_VEC2 = 36860
+GL_DOUBLE_VEC3 = 36861
+GL_DOUBLE_VEC4 = 36862
+GL_TEXTURE_CUBE_MAP_ARRAY = 36873
+GL_TEXTURE_BINDING_CUBE_MAP_ARRAY = 36874
+GL_PROXY_TEXTURE_CUBE_MAP_ARRAY = 36875
+GL_SAMPLER_CUBE_MAP_ARRAY = 36876
+GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW = 36877
+GL_INT_SAMPLER_CUBE_MAP_ARRAY = 36878
+GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = 36879
+GL_IMAGE_1D = 36940
+GL_IMAGE_2D = 36941
+GL_IMAGE_3D = 36942
+GL_IMAGE_2D_RECT = 36943
+GL_IMAGE_CUBE = 36944
+GL_IMAGE_BUFFER = 36945
+GL_IMAGE_1D_ARRAY = 36946
+GL_IMAGE_2D_ARRAY = 36947
+GL_IMAGE_CUBE_MAP_ARRAY = 36948
+GL_IMAGE_2D_MULTISAMPLE = 36949
+GL_IMAGE_2D_MULTISAMPLE_ARRAY = 36950
+GL_INT_IMAGE_1D = 36951
+GL_INT_IMAGE_2D = 36952
+GL_INT_IMAGE_3D = 36953
+GL_INT_IMAGE_2D_RECT = 36954
+GL_INT_IMAGE_CUBE = 36955
+GL_INT_IMAGE_BUFFER = 36956
+GL_INT_IMAGE_1D_ARRAY = 36957
+GL_INT_IMAGE_2D_ARRAY = 36958
+GL_INT_IMAGE_CUBE_MAP_ARRAY = 36959
+GL_INT_IMAGE_2D_MULTISAMPLE = 36960
+GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 36961
+GL_UNSIGNED_INT_IMAGE_1D = 36962
+GL_UNSIGNED_INT_IMAGE_2D = 36963
+GL_UNSIGNED_INT_IMAGE_3D = 36964
+GL_UNSIGNED_INT_IMAGE_2D_RECT = 36965
+GL_UNSIGNED_INT_IMAGE_CUBE = 36966
+GL_UNSIGNED_INT_IMAGE_BUFFER = 36967
+GL_UNSIGNED_INT_IMAGE_1D_ARRAY = 36968
+GL_UNSIGNED_INT_IMAGE_2D_ARRAY = 36969
+GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY = 36970
+GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE = 36971
+GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 36972
+GL_MAX_IMAGE_SAMPLES = 36973
+GL_IMAGE_BINDING_FORMAT = 36974
+GL_RGB10_A2UI = 36975
+GL_MIN_MAP_BUFFER_ALIGNMENT = 37052
+GL_IMAGE_FORMAT_COMPATIBILITY_TYPE = 37063
+GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE = 37064
+GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS = 37065
+GL_MAX_VERTEX_IMAGE_UNIFORMS = 37066
+GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS = 37067
+GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS = 37068
+GL_MAX_GEOMETRY_IMAGE_UNIFORMS = 37069
+GL_MAX_FRAGMENT_IMAGE_UNIFORMS = 37070
+GL_MAX_COMBINED_IMAGE_UNIFORMS = 37071
+GL_SHADER_STORAGE_BUFFER = 37074
+GL_SHADER_STORAGE_BUFFER_BINDING = 37075
+GL_SHADER_STORAGE_BUFFER_START = 37076
+GL_SHADER_STORAGE_BUFFER_SIZE = 37077
+GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS = 37078
+GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS = 37079
+GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS = 37080
+GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS = 37081
+GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS = 37082
+GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS = 37083
+GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS = 37084
+GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS = 37085
+GL_MAX_SHADER_STORAGE_BLOCK_SIZE = 37086
+GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT = 37087
+GL_DEPTH_STENCIL_TEXTURE_MODE = 37098
+GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS = 37099
+GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER = 37100
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER = 37101
+GL_DISPATCH_INDIRECT_BUFFER = 37102
+GL_DISPATCH_INDIRECT_BUFFER_BINDING = 37103
+GL_TEXTURE_2D_MULTISAMPLE = 37120
+GL_PROXY_TEXTURE_2D_MULTISAMPLE = 37121
+GL_TEXTURE_2D_MULTISAMPLE_ARRAY = 37122
+GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY = 37123
+GL_TEXTURE_BINDING_2D_MULTISAMPLE = 37124
+GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY = 37125
+GL_TEXTURE_SAMPLES = 37126
+GL_TEXTURE_FIXED_SAMPLE_LOCATIONS = 37127
+GL_SAMPLER_2D_MULTISAMPLE = 37128
+GL_INT_SAMPLER_2D_MULTISAMPLE = 37129
+GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE = 37130
+GL_SAMPLER_2D_MULTISAMPLE_ARRAY = 37131
+GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 37132
+GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 37133
+GL_MAX_COLOR_TEXTURE_SAMPLES = 37134
+GL_MAX_DEPTH_TEXTURE_SAMPLES = 37135
+GL_MAX_INTEGER_SAMPLES = 37136
+GL_MAX_SERVER_WAIT_TIMEOUT = 37137
+GL_OBJECT_TYPE = 37138
+GL_SYNC_CONDITION = 37139
+GL_SYNC_STATUS = 37140
+GL_SYNC_FLAGS = 37141
+GL_SYNC_FENCE = 37142
+GL_SYNC_GPU_COMMANDS_COMPLETE = 37143
+GL_UNSIGNALED = 37144
+GL_SIGNALED = 37145
+GL_ALREADY_SIGNALED = 37146
+GL_TIMEOUT_EXPIRED = 37147
+GL_CONDITION_SATISFIED = 37148
+GL_WAIT_FAILED = 37149
+GL_BUFFER_ACCESS_FLAGS = 37151
+GL_BUFFER_MAP_LENGTH = 37152
+GL_BUFFER_MAP_OFFSET = 37153
+GL_MAX_VERTEX_OUTPUT_COMPONENTS = 37154
+GL_MAX_GEOMETRY_INPUT_COMPONENTS = 37155
+GL_MAX_GEOMETRY_OUTPUT_COMPONENTS = 37156
+GL_MAX_FRAGMENT_INPUT_COMPONENTS = 37157
+GL_CONTEXT_PROFILE_MASK = 37158
+GL_UNPACK_COMPRESSED_BLOCK_WIDTH = 37159
+GL_UNPACK_COMPRESSED_BLOCK_HEIGHT = 37160
+GL_UNPACK_COMPRESSED_BLOCK_DEPTH = 37161
+GL_UNPACK_COMPRESSED_BLOCK_SIZE = 37162
+GL_PACK_COMPRESSED_BLOCK_WIDTH = 37163
+GL_PACK_COMPRESSED_BLOCK_HEIGHT = 37164
+GL_PACK_COMPRESSED_BLOCK_DEPTH = 37165
+GL_PACK_COMPRESSED_BLOCK_SIZE = 37166
+GL_TEXTURE_IMMUTABLE_FORMAT = 37167
+GL_MAX_DEBUG_MESSAGE_LENGTH = 37187
+GL_MAX_DEBUG_LOGGED_MESSAGES = 37188
+GL_DEBUG_LOGGED_MESSAGES = 37189
+GL_DEBUG_SEVERITY_HIGH = 37190
+GL_DEBUG_SEVERITY_MEDIUM = 37191
+GL_DEBUG_SEVERITY_LOW = 37192
+GL_QUERY_BUFFER = 37266
+GL_QUERY_BUFFER_BINDING = 37267
+GL_QUERY_RESULT_NO_WAIT = 37268
+GL_TEXTURE_BUFFER_OFFSET = 37277
+GL_TEXTURE_BUFFER_SIZE = 37278
+GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT = 37279
+GL_COMPUTE_SHADER = 37305
+GL_MAX_COMPUTE_UNIFORM_BLOCKS = 37307
+GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS = 37308
+GL_MAX_COMPUTE_IMAGE_UNIFORMS = 37309
+GL_MAX_COMPUTE_WORK_GROUP_COUNT = 37310
+GL_MAX_COMPUTE_WORK_GROUP_SIZE = 37311
+GL_COMPRESSED_R11_EAC = 37488
+GL_COMPRESSED_SIGNED_R11_EAC = 37489
+GL_COMPRESSED_RG11_EAC = 37490
+GL_COMPRESSED_SIGNED_RG11_EAC = 37491
+GL_COMPRESSED_RGB8_ETC2 = 37492
+GL_COMPRESSED_SRGB8_ETC2 = 37493
+GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494
+GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495
+GL_COMPRESSED_RGBA8_ETC2_EAC = 37496
+GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497
+GL_ATOMIC_COUNTER_BUFFER = 37568
+GL_ATOMIC_COUNTER_BUFFER_BINDING = 37569
+GL_ATOMIC_COUNTER_BUFFER_START = 37570
+GL_ATOMIC_COUNTER_BUFFER_SIZE = 37571
+GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE = 37572
+GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS = 37573
+GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES = 37574
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER = 37575
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER = 37576
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER = 37577
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER = 37578
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER = 37579
+GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS = 37580
+GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS = 37581
+GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS = 37582
+GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS = 37583
+GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS = 37584
+GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS = 37585
+GL_MAX_VERTEX_ATOMIC_COUNTERS = 37586
+GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS = 37587
+GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS = 37588
+GL_MAX_GEOMETRY_ATOMIC_COUNTERS = 37589
+GL_MAX_FRAGMENT_ATOMIC_COUNTERS = 37590
+GL_MAX_COMBINED_ATOMIC_COUNTERS = 37591
+GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE = 37592
+GL_ACTIVE_ATOMIC_COUNTER_BUFFERS = 37593
+GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX = 37594
+GL_UNSIGNED_INT_ATOMIC_COUNTER = 37595
+GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS = 37596
+GL_DEBUG_OUTPUT = 37600
+GL_UNIFORM = 37601
+GL_UNIFORM_BLOCK = 37602
+GL_PROGRAM_INPUT = 37603
+GL_PROGRAM_OUTPUT = 37604
+GL_BUFFER_VARIABLE = 37605
+GL_SHADER_STORAGE_BLOCK = 37606
+GL_IS_PER_PATCH = 37607
+GL_VERTEX_SUBROUTINE = 37608
+GL_TESS_CONTROL_SUBROUTINE = 37609
+GL_TESS_EVALUATION_SUBROUTINE = 37610
+GL_GEOMETRY_SUBROUTINE = 37611
+GL_FRAGMENT_SUBROUTINE = 37612
+GL_COMPUTE_SUBROUTINE = 37613
+GL_VERTEX_SUBROUTINE_UNIFORM = 37614
+GL_TESS_CONTROL_SUBROUTINE_UNIFORM = 37615
+GL_TESS_EVALUATION_SUBROUTINE_UNIFORM = 37616
+GL_GEOMETRY_SUBROUTINE_UNIFORM = 37617
+GL_FRAGMENT_SUBROUTINE_UNIFORM = 37618
+GL_COMPUTE_SUBROUTINE_UNIFORM = 37619
+GL_TRANSFORM_FEEDBACK_VARYING = 37620
+GL_ACTIVE_RESOURCES = 37621
+GL_MAX_NAME_LENGTH = 37622
+GL_MAX_NUM_ACTIVE_VARIABLES = 37623
+GL_MAX_NUM_COMPATIBLE_SUBROUTINES = 37624
+GL_NAME_LENGTH = 37625
+GL_TYPE = 37626
+GL_ARRAY_SIZE = 37627
+GL_OFFSET = 37628
+GL_BLOCK_INDEX = 37629
+GL_ARRAY_STRIDE = 37630
+GL_MATRIX_STRIDE = 37631
+GL_IS_ROW_MAJOR = 37632
+GL_ATOMIC_COUNTER_BUFFER_INDEX = 37633
+GL_BUFFER_BINDING = 37634
+GL_BUFFER_DATA_SIZE = 37635
+GL_NUM_ACTIVE_VARIABLES = 37636
+GL_ACTIVE_VARIABLES = 37637
+GL_REFERENCED_BY_VERTEX_SHADER = 37638
+GL_REFERENCED_BY_TESS_CONTROL_SHADER = 37639
+GL_REFERENCED_BY_TESS_EVALUATION_SHADER = 37640
+GL_REFERENCED_BY_GEOMETRY_SHADER = 37641
+GL_REFERENCED_BY_FRAGMENT_SHADER = 37642
+GL_REFERENCED_BY_COMPUTE_SHADER = 37643
+GL_TOP_LEVEL_ARRAY_SIZE = 37644
+GL_TOP_LEVEL_ARRAY_STRIDE = 37645
+GL_LOCATION = 37646
+GL_LOCATION_INDEX = 37647
+GL_FRAMEBUFFER_DEFAULT_WIDTH = 37648
+GL_FRAMEBUFFER_DEFAULT_HEIGHT = 37649
+GL_FRAMEBUFFER_DEFAULT_LAYERS = 37650
+GL_FRAMEBUFFER_DEFAULT_SAMPLES = 37651
+GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS = 37652
+GL_MAX_FRAMEBUFFER_WIDTH = 37653
+GL_MAX_FRAMEBUFFER_HEIGHT = 37654
+GL_MAX_FRAMEBUFFER_LAYERS = 37655
+GL_MAX_FRAMEBUFFER_SAMPLES = 37656
+GL_LOCATION_COMPONENT = 37706
+GL_TRANSFORM_FEEDBACK_BUFFER_INDEX = 37707
+GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE = 37708
+GL_CLIP_ORIGIN = 37724
+GL_CLIP_DEPTH_MODE = 37725
+GL_NEGATIVE_ONE_TO_ONE = 37726
+GL_ZERO_TO_ONE = 37727
+GL_CLEAR_TEXTURE = 37733
+GL_NUM_SAMPLE_COUNTS = 37760
+GL_SHADER_BINARY_FORMAT_SPIR_V = 38225
+GL_SPIR_V_BINARY = 38226
+GL_SPIR_V_EXTENSIONS = 38227
+GL_NUM_SPIR_V_EXTENSIONS = 38228
+GL_MULTISAMPLE_BIT_ARB = 536870912
+GL_INVALID_INDEX = 4294967295
+GL_ALL_SHADER_BITS = 4294967295
+GL_ALL_BARRIER_BITS = 4294967295
+GL_TIMEOUT_IGNORED = 18446744073709551615
+
+# GL command definitions
+glActiveShaderProgram = _link_function('glActiveShaderProgram', None, [GLuint, GLuint], requires='OpenGL 4.1')
+glActiveTexture = _link_function('glActiveTexture', None, [GLenum], requires='OpenGL 1.3')
+glAttachShader = _link_function('glAttachShader', None, [GLuint, GLuint], requires='OpenGL 2.0')
+glBeginConditionalRender = _link_function('glBeginConditionalRender', None, [GLuint, GLenum], requires='OpenGL 3.0')
+glBeginQuery = _link_function('glBeginQuery', None, [GLenum, GLuint], requires='OpenGL 1.5')
+glBeginQueryIndexed = _link_function('glBeginQueryIndexed', None, [GLenum, GLuint, GLuint], requires='OpenGL 4.0')
+glBeginTransformFeedback = _link_function('glBeginTransformFeedback', None, [GLenum], requires='OpenGL 3.0')
+glBindAttribLocation = _link_function('glBindAttribLocation', None, [GLuint, GLuint, POINTER(GLchar)], requires='OpenGL 2.0')
+glBindBuffer = _link_function('glBindBuffer', None, [GLenum, GLuint], requires='OpenGL 1.5')
+glBindBufferBase = _link_function('glBindBufferBase', None, [GLenum, GLuint, GLuint], requires='OpenGL 3.1')
+glBindBufferRange = _link_function('glBindBufferRange', None, [GLenum, GLuint, GLuint, GLintptr, GLsizeiptr], requires='OpenGL 3.1')
+glBindBuffersBase = _link_function('glBindBuffersBase', None, [GLenum, GLuint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.4')
+glBindBuffersRange = _link_function('glBindBuffersRange', None, [GLenum, GLuint, GLsizei, POINTER(GLuint), POINTER(GLintptr), POINTER(GLsizeiptr)], requires='OpenGL 4.4')
+glBindFragDataLocation = _link_function('glBindFragDataLocation', None, [GLuint, GLuint, POINTER(GLchar)], requires='OpenGL 3.0')
+glBindFragDataLocationIndexed = _link_function('glBindFragDataLocationIndexed', None, [GLuint, GLuint, GLuint, POINTER(GLchar)], requires='OpenGL 3.3')
+glBindFramebuffer = _link_function('glBindFramebuffer', None, [GLenum, GLuint], requires='OpenGL 3.0')
+glBindFramebufferEXT = _link_function('glBindFramebufferEXT', None, [GLenum, GLuint], requires='None')
+glBindImageTexture = _link_function('glBindImageTexture', None, [GLuint, GLuint, GLint, GLboolean, GLint, GLenum, GLenum], requires='OpenGL 4.2')
+glBindImageTextures = _link_function('glBindImageTextures', None, [GLuint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.4')
+glBindProgramPipeline = _link_function('glBindProgramPipeline', None, [GLuint], requires='OpenGL 4.1')
+glBindRenderbuffer = _link_function('glBindRenderbuffer', None, [GLenum, GLuint], requires='OpenGL 3.0')
+glBindRenderbufferEXT = _link_function('glBindRenderbufferEXT', None, [GLenum, GLuint], requires='None')
+glBindSampler = _link_function('glBindSampler', None, [GLuint, GLuint], requires='OpenGL 3.3')
+glBindSamplers = _link_function('glBindSamplers', None, [GLuint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.4')
+glBindTexture = _link_function('glBindTexture', None, [GLenum, GLuint], requires='OpenGL 1.1')
+glBindTextureUnit = _link_function('glBindTextureUnit', None, [GLuint, GLuint], requires='OpenGL 4.5')
+glBindTextures = _link_function('glBindTextures', None, [GLuint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.4')
+glBindTransformFeedback = _link_function('glBindTransformFeedback', None, [GLenum, GLuint], requires='OpenGL 4.0')
+glBindVertexArray = _link_function('glBindVertexArray', None, [GLuint], requires='OpenGL 3.0')
+glBindVertexBuffer = _link_function('glBindVertexBuffer', None, [GLuint, GLuint, GLintptr, GLsizei], requires='OpenGL 4.3')
+glBindVertexBuffers = _link_function('glBindVertexBuffers', None, [GLuint, GLsizei, POINTER(GLuint), POINTER(GLintptr), POINTER(GLsizei)], requires='OpenGL 4.4')
+glBlendColor = _link_function('glBlendColor', None, [GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.4')
+glBlendEquation = _link_function('glBlendEquation', None, [GLenum], requires='OpenGL 1.4')
+glBlendEquationSeparate = _link_function('glBlendEquationSeparate', None, [GLenum, GLenum], requires='OpenGL 2.0')
+glBlendEquationSeparatei = _link_function('glBlendEquationSeparatei', None, [GLuint, GLenum, GLenum], requires='OpenGL 4.0')
+glBlendEquationi = _link_function('glBlendEquationi', None, [GLuint, GLenum], requires='OpenGL 4.0')
+glBlendFunc = _link_function('glBlendFunc', None, [GLenum, GLenum], requires='OpenGL 1.0')
+glBlendFuncSeparate = _link_function('glBlendFuncSeparate', None, [GLenum, GLenum, GLenum, GLenum], requires='OpenGL 1.4')
+glBlendFuncSeparatei = _link_function('glBlendFuncSeparatei', None, [GLuint, GLenum, GLenum, GLenum, GLenum], requires='OpenGL 4.0')
+glBlendFunci = _link_function('glBlendFunci', None, [GLuint, GLenum, GLenum], requires='OpenGL 4.0')
+glBlitFramebuffer = _link_function('glBlitFramebuffer', None, [GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum], requires='OpenGL 3.0')
+glBlitNamedFramebuffer = _link_function('glBlitNamedFramebuffer', None, [GLuint, GLuint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum], requires='OpenGL 4.5')
+glBufferData = _link_function('glBufferData', None, [GLenum, GLsizeiptr, POINTER(GLvoid), GLenum], requires='OpenGL 1.5')
+glBufferStorage = _link_function('glBufferStorage', None, [GLenum, GLsizeiptr, POINTER(GLvoid), GLbitfield], requires='OpenGL 4.4')
+glBufferSubData = _link_function('glBufferSubData', None, [GLenum, GLintptr, GLsizeiptr, POINTER(GLvoid)], requires='OpenGL 1.5')
+glCheckFramebufferStatus = _link_function('glCheckFramebufferStatus', GLenum, [GLenum], requires='OpenGL 3.0')
+glCheckFramebufferStatusEXT = _link_function('glCheckFramebufferStatusEXT', GLenum, [GLenum], requires='None')
+glCheckNamedFramebufferStatus = _link_function('glCheckNamedFramebufferStatus', GLenum, [GLuint, GLenum], requires='OpenGL 4.5')
+glClampColor = _link_function('glClampColor', None, [GLenum, GLenum], requires='OpenGL 3.0')
+glClear = _link_function('glClear', None, [GLbitfield], requires='OpenGL 1.0')
+glClearBufferData = _link_function('glClearBufferData', None, [GLenum, GLenum, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.3')
+glClearBufferSubData = _link_function('glClearBufferSubData', None, [GLenum, GLenum, GLintptr, GLsizeiptr, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.3')
+glClearBufferfi = _link_function('glClearBufferfi', None, [GLenum, GLint, GLfloat, GLint], requires='OpenGL 3.0')
+glClearBufferfv = _link_function('glClearBufferfv', None, [GLenum, GLint, POINTER(GLfloat)], requires='OpenGL 3.0')
+glClearBufferiv = _link_function('glClearBufferiv', None, [GLenum, GLint, POINTER(GLint)], requires='OpenGL 3.0')
+glClearBufferuiv = _link_function('glClearBufferuiv', None, [GLenum, GLint, POINTER(GLuint)], requires='OpenGL 3.0')
+glClearColor = _link_function('glClearColor', None, [GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glClearDepth = _link_function('glClearDepth', None, [GLdouble], requires='OpenGL 1.0')
+glClearDepthf = _link_function('glClearDepthf', None, [GLfloat], requires='OpenGL 4.1')
+glClearNamedBufferData = _link_function('glClearNamedBufferData', None, [GLuint, GLenum, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.5')
+glClearNamedBufferSubData = _link_function('glClearNamedBufferSubData', None, [GLuint, GLenum, GLintptr, GLsizeiptr, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.5')
+glClearNamedFramebufferfi = _link_function('glClearNamedFramebufferfi', None, [GLuint, GLenum, GLint, GLfloat, GLint], requires='OpenGL 4.5')
+glClearNamedFramebufferfv = _link_function('glClearNamedFramebufferfv', None, [GLuint, GLenum, GLint, POINTER(GLfloat)], requires='OpenGL 4.5')
+glClearNamedFramebufferiv = _link_function('glClearNamedFramebufferiv', None, [GLuint, GLenum, GLint, POINTER(GLint)], requires='OpenGL 4.5')
+glClearNamedFramebufferuiv = _link_function('glClearNamedFramebufferuiv', None, [GLuint, GLenum, GLint, POINTER(GLuint)], requires='OpenGL 4.5')
+glClearStencil = _link_function('glClearStencil', None, [GLint], requires='OpenGL 1.0')
+glClearTexImage = _link_function('glClearTexImage', None, [GLuint, GLint, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.4')
+glClearTexSubImage = _link_function('glClearTexSubImage', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.4')
+glClientWaitSync = _link_function('glClientWaitSync', GLenum, [GLsync, GLbitfield, GLuint64], requires='OpenGL 3.2')
+glClipControl = _link_function('glClipControl', None, [GLenum, GLenum], requires='OpenGL 4.5')
+glColorMask = _link_function('glColorMask', None, [GLboolean, GLboolean, GLboolean, GLboolean], requires='OpenGL 1.0')
+glColorMaski = _link_function('glColorMaski', None, [GLuint, GLboolean, GLboolean, GLboolean, GLboolean], requires='OpenGL 3.0')
+glColorP3ui = _link_function('glColorP3ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glColorP3uiv = _link_function('glColorP3uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glColorP4ui = _link_function('glColorP4ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glColorP4uiv = _link_function('glColorP4uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glCompileShader = _link_function('glCompileShader', None, [GLuint], requires='OpenGL 2.0')
+glCompressedTexImage1D = _link_function('glCompressedTexImage1D', None, [GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.3')
+glCompressedTexImage2D = _link_function('glCompressedTexImage2D', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.3')
+glCompressedTexImage3D = _link_function('glCompressedTexImage3D', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.3')
+glCompressedTexSubImage1D = _link_function('glCompressedTexSubImage1D', None, [GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.3')
+glCompressedTexSubImage2D = _link_function('glCompressedTexSubImage2D', None, [GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.3')
+glCompressedTexSubImage3D = _link_function('glCompressedTexSubImage3D', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.3')
+glCompressedTextureSubImage1D = _link_function('glCompressedTextureSubImage1D', None, [GLuint, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glCompressedTextureSubImage2D = _link_function('glCompressedTextureSubImage2D', None, [GLuint, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glCompressedTextureSubImage3D = _link_function('glCompressedTextureSubImage3D', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glCopyBufferSubData = _link_function('glCopyBufferSubData', None, [GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr], requires='OpenGL 3.1')
+glCopyImageSubData = _link_function('glCopyImageSubData', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei], requires='OpenGL 4.3')
+glCopyNamedBufferSubData = _link_function('glCopyNamedBufferSubData', None, [GLuint, GLuint, GLintptr, GLintptr, GLsizeiptr], requires='OpenGL 4.5')
+glCopyTexImage1D = _link_function('glCopyTexImage1D', None, [GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint], requires='OpenGL 1.1')
+glCopyTexImage2D = _link_function('glCopyTexImage2D', None, [GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint], requires='OpenGL 1.1')
+glCopyTexSubImage1D = _link_function('glCopyTexSubImage1D', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei], requires='OpenGL 1.1')
+glCopyTexSubImage2D = _link_function('glCopyTexSubImage2D', None, [GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], requires='OpenGL 1.1')
+glCopyTexSubImage3D = _link_function('glCopyTexSubImage3D', None, [GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], requires='OpenGL 1.2')
+glCopyTextureSubImage1D = _link_function('glCopyTextureSubImage1D', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei], requires='OpenGL 4.5')
+glCopyTextureSubImage2D = _link_function('glCopyTextureSubImage2D', None, [GLuint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], requires='OpenGL 4.5')
+glCopyTextureSubImage3D = _link_function('glCopyTextureSubImage3D', None, [GLuint, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], requires='OpenGL 4.5')
+glCreateBuffers = _link_function('glCreateBuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateFramebuffers = _link_function('glCreateFramebuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateProgram = _link_function('glCreateProgram', GLuint, [], requires='OpenGL 2.0')
+glCreateProgramPipelines = _link_function('glCreateProgramPipelines', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateQueries = _link_function('glCreateQueries', None, [GLenum, GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateRenderbuffers = _link_function('glCreateRenderbuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateSamplers = _link_function('glCreateSamplers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateShader = _link_function('glCreateShader', GLuint, [GLenum], requires='OpenGL 2.0')
+glCreateShaderProgramv = _link_function('glCreateShaderProgramv', GLuint, [GLenum, GLsizei, POINTER(POINTER(GLchar))], requires='OpenGL 4.1')
+glCreateTextures = _link_function('glCreateTextures', None, [GLenum, GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateTransformFeedbacks = _link_function('glCreateTransformFeedbacks', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateVertexArrays = _link_function('glCreateVertexArrays', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCullFace = _link_function('glCullFace', None, [GLenum], requires='OpenGL 1.0')
+glDebugMessageCallback = _link_function('glDebugMessageCallback', None, [GLDEBUGPROC, POINTER(GLvoid)], requires='OpenGL 4.3')
+glDebugMessageControl = _link_function('glDebugMessageControl', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLuint), GLboolean], requires='OpenGL 4.3')
+glDebugMessageInsert = _link_function('glDebugMessageInsert', None, [GLenum, GLenum, GLuint, GLenum, GLsizei, POINTER(GLchar)], requires='OpenGL 4.3')
+glDeleteBuffers = _link_function('glDeleteBuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.5')
+glDeleteFramebuffers = _link_function('glDeleteFramebuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glDeleteFramebuffersEXT = _link_function('glDeleteFramebuffersEXT', None, [GLsizei, POINTER(GLuint)], requires='None')
+glDeleteProgram = _link_function('glDeleteProgram', None, [GLuint], requires='OpenGL 2.0')
+glDeleteProgramPipelines = _link_function('glDeleteProgramPipelines', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.1')
+glDeleteQueries = _link_function('glDeleteQueries', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.5')
+glDeleteRenderbuffers = _link_function('glDeleteRenderbuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glDeleteRenderbuffersEXT = _link_function('glDeleteRenderbuffersEXT', None, [GLsizei, POINTER(GLuint)], requires='None')
+glDeleteSamplers = _link_function('glDeleteSamplers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.3')
+glDeleteShader = _link_function('glDeleteShader', None, [GLuint], requires='OpenGL 2.0')
+glDeleteSync = _link_function('glDeleteSync', None, [GLsync], requires='OpenGL 3.2')
+glDeleteTextures = _link_function('glDeleteTextures', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.1')
+glDeleteTransformFeedbacks = _link_function('glDeleteTransformFeedbacks', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.0')
+glDeleteVertexArrays = _link_function('glDeleteVertexArrays', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glDepthFunc = _link_function('glDepthFunc', None, [GLenum], requires='OpenGL 1.0')
+glDepthMask = _link_function('glDepthMask', None, [GLboolean], requires='OpenGL 1.0')
+glDepthRange = _link_function('glDepthRange', None, [GLdouble, GLdouble], requires='OpenGL 1.0')
+glDepthRangeArrayv = _link_function('glDepthRangeArrayv', None, [GLuint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.1')
+glDepthRangeIndexed = _link_function('glDepthRangeIndexed', None, [GLuint, GLdouble, GLdouble], requires='OpenGL 4.1')
+glDepthRangef = _link_function('glDepthRangef', None, [GLfloat, GLfloat], requires='OpenGL 4.1')
+glDetachShader = _link_function('glDetachShader', None, [GLuint, GLuint], requires='OpenGL 2.0')
+glDisable = _link_function('glDisable', None, [GLenum], requires='OpenGL 1.0')
+glDisableVertexArrayAttrib = _link_function('glDisableVertexArrayAttrib', None, [GLuint, GLuint], requires='OpenGL 4.5')
+glDisableVertexAttribArray = _link_function('glDisableVertexAttribArray', None, [GLuint], requires='OpenGL 2.0')
+glDisablei = _link_function('glDisablei', None, [GLenum, GLuint], requires='OpenGL 3.0')
+glDispatchCompute = _link_function('glDispatchCompute', None, [GLuint, GLuint, GLuint], requires='OpenGL 4.3')
+glDispatchComputeIndirect = _link_function('glDispatchComputeIndirect', None, [GLintptr], requires='OpenGL 4.3')
+glDrawArrays = _link_function('glDrawArrays', None, [GLenum, GLint, GLsizei], requires='OpenGL 1.1')
+glDrawArraysIndirect = _link_function('glDrawArraysIndirect', None, [GLenum, POINTER(GLvoid)], requires='OpenGL 4.0')
+glDrawArraysInstanced = _link_function('glDrawArraysInstanced', None, [GLenum, GLint, GLsizei, GLsizei], requires='OpenGL 3.1')
+glDrawArraysInstancedBaseInstance = _link_function('glDrawArraysInstancedBaseInstance', None, [GLenum, GLint, GLsizei, GLsizei, GLuint], requires='OpenGL 4.2')
+glDrawBuffer = _link_function('glDrawBuffer', None, [GLenum], requires='OpenGL 1.0')
+glDrawBuffers = _link_function('glDrawBuffers', None, [GLsizei, POINTER(GLenum)], requires='OpenGL 2.0')
+glDrawElements = _link_function('glDrawElements', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid)], requires='OpenGL 1.1')
+glDrawElementsBaseVertex = _link_function('glDrawElementsBaseVertex', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLint], requires='OpenGL 3.2')
+glDrawElementsIndirect = _link_function('glDrawElementsIndirect', None, [GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.0')
+glDrawElementsInstanced = _link_function('glDrawElementsInstanced', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei], requires='OpenGL 3.1')
+glDrawElementsInstancedBaseInstance = _link_function('glDrawElementsInstancedBaseInstance', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei, GLuint], requires='OpenGL 4.2')
+glDrawElementsInstancedBaseVertex = _link_function('glDrawElementsInstancedBaseVertex', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei, GLint], requires='OpenGL 3.2')
+glDrawElementsInstancedBaseVertexBaseInstance = _link_function('glDrawElementsInstancedBaseVertexBaseInstance', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei, GLint, GLuint], requires='OpenGL 4.2')
+glDrawRangeElements = _link_function('glDrawRangeElements', None, [GLenum, GLuint, GLuint, GLsizei, GLenum, POINTER(GLvoid)], requires='OpenGL 1.2')
+glDrawRangeElementsBaseVertex = _link_function('glDrawRangeElementsBaseVertex', None, [GLenum, GLuint, GLuint, GLsizei, GLenum, POINTER(GLvoid), GLint], requires='OpenGL 3.2')
+glDrawTransformFeedback = _link_function('glDrawTransformFeedback', None, [GLenum, GLuint], requires='OpenGL 4.0')
+glDrawTransformFeedbackInstanced = _link_function('glDrawTransformFeedbackInstanced', None, [GLenum, GLuint, GLsizei], requires='OpenGL 4.2')
+glDrawTransformFeedbackStream = _link_function('glDrawTransformFeedbackStream', None, [GLenum, GLuint, GLuint], requires='OpenGL 4.0')
+glDrawTransformFeedbackStreamInstanced = _link_function('glDrawTransformFeedbackStreamInstanced', None, [GLenum, GLuint, GLuint, GLsizei], requires='OpenGL 4.2')
+glEnable = _link_function('glEnable', None, [GLenum], requires='OpenGL 1.0')
+glEnableVertexArrayAttrib = _link_function('glEnableVertexArrayAttrib', None, [GLuint, GLuint], requires='OpenGL 4.5')
+glEnableVertexAttribArray = _link_function('glEnableVertexAttribArray', None, [GLuint], requires='OpenGL 2.0')
+glEnablei = _link_function('glEnablei', None, [GLenum, GLuint], requires='OpenGL 3.0')
+glEndConditionalRender = _link_function('glEndConditionalRender', None, [], requires='OpenGL 3.0')
+glEndQuery = _link_function('glEndQuery', None, [GLenum], requires='OpenGL 1.5')
+glEndQueryIndexed = _link_function('glEndQueryIndexed', None, [GLenum, GLuint], requires='OpenGL 4.0')
+glEndTransformFeedback = _link_function('glEndTransformFeedback', None, [], requires='OpenGL 3.0')
+glFenceSync = _link_function('glFenceSync', GLsync, [GLenum, GLbitfield], requires='OpenGL 3.2')
+glFinish = _link_function('glFinish', None, [], requires='OpenGL 1.0')
+glFlush = _link_function('glFlush', None, [], requires='OpenGL 1.0')
+glFlushMappedBufferRange = _link_function('glFlushMappedBufferRange', None, [GLenum, GLintptr, GLsizeiptr], requires='OpenGL 3.0')
+glFlushMappedNamedBufferRange = _link_function('glFlushMappedNamedBufferRange', None, [GLuint, GLintptr, GLsizeiptr], requires='OpenGL 4.5')
+glFramebufferParameteri = _link_function('glFramebufferParameteri', None, [GLenum, GLenum, GLint], requires='OpenGL 4.3')
+glFramebufferRenderbuffer = _link_function('glFramebufferRenderbuffer', None, [GLenum, GLenum, GLenum, GLuint], requires='OpenGL 3.0')
+glFramebufferRenderbufferEXT = _link_function('glFramebufferRenderbufferEXT', None, [GLenum, GLenum, GLenum, GLuint], requires='None')
+glFramebufferTexture = _link_function('glFramebufferTexture', None, [GLenum, GLenum, GLuint, GLint], requires='OpenGL 3.2')
+glFramebufferTexture1D = _link_function('glFramebufferTexture1D', None, [GLenum, GLenum, GLenum, GLuint, GLint], requires='OpenGL 3.0')
+glFramebufferTexture1DEXT = _link_function('glFramebufferTexture1DEXT', None, [GLenum, GLenum, GLenum, GLuint, GLint], requires='None')
+glFramebufferTexture2D = _link_function('glFramebufferTexture2D', None, [GLenum, GLenum, GLenum, GLuint, GLint], requires='OpenGL 3.0')
+glFramebufferTexture2DEXT = _link_function('glFramebufferTexture2DEXT', None, [GLenum, GLenum, GLenum, GLuint, GLint], requires='None')
+glFramebufferTexture3D = _link_function('glFramebufferTexture3D', None, [GLenum, GLenum, GLenum, GLuint, GLint, GLint], requires='OpenGL 3.0')
+glFramebufferTexture3DEXT = _link_function('glFramebufferTexture3DEXT', None, [GLenum, GLenum, GLenum, GLuint, GLint, GLint], requires='None')
+glFramebufferTextureLayer = _link_function('glFramebufferTextureLayer', None, [GLenum, GLenum, GLuint, GLint, GLint], requires='OpenGL 3.0')
+glFrontFace = _link_function('glFrontFace', None, [GLenum], requires='OpenGL 1.0')
+glGenBuffers = _link_function('glGenBuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.5')
+glGenFramebuffers = _link_function('glGenFramebuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glGenFramebuffersEXT = _link_function('glGenFramebuffersEXT', None, [GLsizei, POINTER(GLuint)], requires='None')
+glGenProgramPipelines = _link_function('glGenProgramPipelines', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.1')
+glGenQueries = _link_function('glGenQueries', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.5')
+glGenRenderbuffers = _link_function('glGenRenderbuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glGenRenderbuffersEXT = _link_function('glGenRenderbuffersEXT', None, [GLsizei, POINTER(GLuint)], requires='None')
+glGenSamplers = _link_function('glGenSamplers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.3')
+glGenTextures = _link_function('glGenTextures', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.1')
+glGenTransformFeedbacks = _link_function('glGenTransformFeedbacks', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.0')
+glGenVertexArrays = _link_function('glGenVertexArrays', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glGenerateMipmap = _link_function('glGenerateMipmap', None, [GLenum], requires='OpenGL 3.0')
+glGenerateMipmapEXT = _link_function('glGenerateMipmapEXT', None, [GLenum], requires='None')
+glGenerateTextureMipmap = _link_function('glGenerateTextureMipmap', None, [GLuint], requires='OpenGL 4.5')
+glGetActiveAtomicCounterBufferiv = _link_function('glGetActiveAtomicCounterBufferiv', None, [GLuint, GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.2')
+glGetActiveAttrib = _link_function('glGetActiveAttrib', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLchar)], requires='OpenGL 2.0')
+glGetActiveSubroutineName = _link_function('glGetActiveSubroutineName', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.0')
+glGetActiveSubroutineUniformName = _link_function('glGetActiveSubroutineUniformName', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.0')
+glGetActiveSubroutineUniformiv = _link_function('glGetActiveSubroutineUniformiv', None, [GLuint, GLenum, GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.0')
+glGetActiveUniform = _link_function('glGetActiveUniform', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLchar)], requires='OpenGL 2.0')
+glGetActiveUniformBlockName = _link_function('glGetActiveUniformBlockName', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 3.1')
+glGetActiveUniformBlockiv = _link_function('glGetActiveUniformBlockiv', None, [GLuint, GLuint, GLenum, POINTER(GLint)], requires='OpenGL 3.1')
+glGetActiveUniformName = _link_function('glGetActiveUniformName', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 3.1')
+glGetActiveUniformsiv = _link_function('glGetActiveUniformsiv', None, [GLuint, GLsizei, POINTER(GLuint), GLenum, POINTER(GLint)], requires='OpenGL 3.1')
+glGetAttachedShaders = _link_function('glGetAttachedShaders', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLuint)], requires='OpenGL 2.0')
+glGetAttribLocation = _link_function('glGetAttribLocation', GLint, [GLuint, POINTER(GLchar)], requires='OpenGL 2.0')
+glGetBooleani_v = _link_function('glGetBooleani_v', None, [GLenum, GLuint, POINTER(GLboolean)], requires='OpenGL 3.0')
+glGetBooleanv = _link_function('glGetBooleanv', None, [GLenum, POINTER(GLboolean)], requires='OpenGL 1.0')
+glGetBufferParameteri64v = _link_function('glGetBufferParameteri64v', None, [GLenum, GLenum, POINTER(GLint64)], requires='OpenGL 3.2')
+glGetBufferParameteriv = _link_function('glGetBufferParameteriv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.5')
+glGetBufferPointerv = _link_function('glGetBufferPointerv', None, [GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.5')
+glGetBufferSubData = _link_function('glGetBufferSubData', None, [GLenum, GLintptr, GLsizeiptr, POINTER(GLvoid)], requires='OpenGL 1.5')
+glGetCompressedTexImage = _link_function('glGetCompressedTexImage', None, [GLenum, GLint, POINTER(GLvoid)], requires='OpenGL 1.3')
+glGetCompressedTextureImage = _link_function('glGetCompressedTextureImage', None, [GLuint, GLint, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetCompressedTextureSubImage = _link_function('glGetCompressedTextureSubImage', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetDebugMessageLog = _link_function('glGetDebugMessageLog', GLuint, [GLuint, GLsizei, POINTER(GLenum), POINTER(GLenum), POINTER(GLuint), POINTER(GLenum), POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.3')
+glGetDoublei_v = _link_function('glGetDoublei_v', None, [GLenum, GLuint, POINTER(GLdouble)], requires='OpenGL 4.1')
+glGetDoublev = _link_function('glGetDoublev', None, [GLenum, POINTER(GLdouble)], requires='OpenGL 1.0')
+glGetError = _link_function('glGetError', GLenum, [], requires='OpenGL 1.0')
+glGetFloati_v = _link_function('glGetFloati_v', None, [GLenum, GLuint, POINTER(GLfloat)], requires='OpenGL 4.1')
+glGetFloatv = _link_function('glGetFloatv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glGetFragDataIndex = _link_function('glGetFragDataIndex', GLint, [GLuint, POINTER(GLchar)], requires='OpenGL 3.3')
+glGetFragDataLocation = _link_function('glGetFragDataLocation', GLint, [GLuint, POINTER(GLchar)], requires='OpenGL 3.0')
+glGetFramebufferAttachmentParameteriv = _link_function('glGetFramebufferAttachmentParameteriv', None, [GLenum, GLenum, GLenum, POINTER(GLint)], requires='OpenGL 3.0')
+glGetFramebufferAttachmentParameterivEXT = _link_function('glGetFramebufferAttachmentParameterivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], requires='None')
+glGetFramebufferParameteriv = _link_function('glGetFramebufferParameteriv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 4.3')
+glGetGraphicsResetStatus = _link_function('glGetGraphicsResetStatus', GLenum, [], requires='OpenGL 4.5')
+glGetInteger64i_v = _link_function('glGetInteger64i_v', None, [GLenum, GLuint, POINTER(GLint64)], requires='OpenGL 3.2')
+glGetInteger64v = _link_function('glGetInteger64v', None, [GLenum, POINTER(GLint64)], requires='OpenGL 3.2')
+glGetIntegeri_v = _link_function('glGetIntegeri_v', None, [GLenum, GLuint, POINTER(GLint)], requires='OpenGL 3.1')
+glGetIntegerv = _link_function('glGetIntegerv', None, [GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glGetInternalformati64v = _link_function('glGetInternalformati64v', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLint64)], requires='OpenGL 4.3')
+glGetInternalformativ = _link_function('glGetInternalformativ', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLint)], requires='OpenGL 4.2')
+glGetMultisamplefv = _link_function('glGetMultisamplefv', None, [GLenum, GLuint, POINTER(GLfloat)], requires='OpenGL 3.2')
+glGetNamedBufferParameteri64v = _link_function('glGetNamedBufferParameteri64v', None, [GLuint, GLenum, POINTER(GLint64)], requires='OpenGL 4.5')
+glGetNamedBufferParameteriv = _link_function('glGetNamedBufferParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetNamedBufferPointerv = _link_function('glGetNamedBufferPointerv', None, [GLuint, GLenum, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetNamedBufferSubData = _link_function('glGetNamedBufferSubData', None, [GLuint, GLintptr, GLsizeiptr, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetNamedFramebufferAttachmentParameteriv = _link_function('glGetNamedFramebufferAttachmentParameteriv', None, [GLuint, GLenum, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetNamedFramebufferParameteriv = _link_function('glGetNamedFramebufferParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetNamedRenderbufferParameteriv = _link_function('glGetNamedRenderbufferParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetObjectLabel = _link_function('glGetObjectLabel', None, [GLenum, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.3')
+glGetObjectPtrLabel = _link_function('glGetObjectPtrLabel', None, [POINTER(GLvoid), GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.3')
+glGetPointerv = _link_function('glGetPointerv', None, [GLenum, POINTER(GLvoid)], requires='OpenGL 4.3')
+glGetProgramBinary = _link_function('glGetProgramBinary', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLenum), POINTER(GLvoid)], requires='OpenGL 4.1')
+glGetProgramInfoLog = _link_function('glGetProgramInfoLog', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 2.0')
+glGetProgramInterfaceiv = _link_function('glGetProgramInterfaceiv', None, [GLuint, GLenum, GLenum, POINTER(GLint)], requires='OpenGL 4.3')
+glGetProgramPipelineInfoLog = _link_function('glGetProgramPipelineInfoLog', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.1')
+glGetProgramPipelineiv = _link_function('glGetProgramPipelineiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.1')
+glGetProgramResourceIndex = _link_function('glGetProgramResourceIndex', GLuint, [GLuint, GLenum, POINTER(GLchar)], requires='OpenGL 4.3')
+glGetProgramResourceLocation = _link_function('glGetProgramResourceLocation', GLint, [GLuint, GLenum, POINTER(GLchar)], requires='OpenGL 4.3')
+glGetProgramResourceLocationIndex = _link_function('glGetProgramResourceLocationIndex', GLint, [GLuint, GLenum, POINTER(GLchar)], requires='OpenGL 4.3')
+glGetProgramResourceName = _link_function('glGetProgramResourceName', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.3')
+glGetProgramResourceiv = _link_function('glGetProgramResourceiv', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLenum), GLsizei, POINTER(GLsizei), POINTER(GLint)], requires='OpenGL 4.3')
+glGetProgramStageiv = _link_function('glGetProgramStageiv', None, [GLuint, GLenum, GLenum, POINTER(GLint)], requires='OpenGL 4.0')
+glGetProgramiv = _link_function('glGetProgramiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 2.0')
+glGetQueryBufferObjecti64v = _link_function('glGetQueryBufferObjecti64v', None, [GLuint, GLuint, GLenum, GLintptr], requires='OpenGL 4.5')
+glGetQueryBufferObjectiv = _link_function('glGetQueryBufferObjectiv', None, [GLuint, GLuint, GLenum, GLintptr], requires='OpenGL 4.5')
+glGetQueryBufferObjectui64v = _link_function('glGetQueryBufferObjectui64v', None, [GLuint, GLuint, GLenum, GLintptr], requires='OpenGL 4.5')
+glGetQueryBufferObjectuiv = _link_function('glGetQueryBufferObjectuiv', None, [GLuint, GLuint, GLenum, GLintptr], requires='OpenGL 4.5')
+glGetQueryIndexediv = _link_function('glGetQueryIndexediv', None, [GLenum, GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.0')
+glGetQueryObjecti64v = _link_function('glGetQueryObjecti64v', None, [GLuint, GLenum, POINTER(GLint64)], requires='OpenGL 3.3')
+glGetQueryObjectiv = _link_function('glGetQueryObjectiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 1.5')
+glGetQueryObjectui64v = _link_function('glGetQueryObjectui64v', None, [GLuint, GLenum, POINTER(GLuint64)], requires='OpenGL 3.3')
+glGetQueryObjectuiv = _link_function('glGetQueryObjectuiv', None, [GLuint, GLenum, POINTER(GLuint)], requires='OpenGL 1.5')
+glGetQueryiv = _link_function('glGetQueryiv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.5')
+glGetRenderbufferParameteriv = _link_function('glGetRenderbufferParameteriv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 3.0')
+glGetRenderbufferParameterivEXT = _link_function('glGetRenderbufferParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], requires='None')
+glGetSamplerParameterIiv = _link_function('glGetSamplerParameterIiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 3.3')
+glGetSamplerParameterIuiv = _link_function('glGetSamplerParameterIuiv', None, [GLuint, GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glGetSamplerParameterfv = _link_function('glGetSamplerParameterfv', None, [GLuint, GLenum, POINTER(GLfloat)], requires='OpenGL 3.3')
+glGetSamplerParameteriv = _link_function('glGetSamplerParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 3.3')
+glGetShaderInfoLog = _link_function('glGetShaderInfoLog', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 2.0')
+glGetShaderPrecisionFormat = _link_function('glGetShaderPrecisionFormat', None, [GLenum, GLenum, POINTER(GLint), POINTER(GLint)], requires='OpenGL 4.1')
+glGetShaderSource = _link_function('glGetShaderSource', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 2.0')
+glGetShaderiv = _link_function('glGetShaderiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 2.0')
+glGetString = _link_function('glGetString', POINTER(GLubyte), [GLenum], requires='OpenGL 1.0')
+glGetStringi = _link_function('glGetStringi', POINTER(GLubyte), [GLenum, GLuint], requires='OpenGL 3.0')
+glGetSubroutineIndex = _link_function('glGetSubroutineIndex', GLuint, [GLuint, GLenum, POINTER(GLchar)], requires='OpenGL 4.0')
+glGetSubroutineUniformLocation = _link_function('glGetSubroutineUniformLocation', GLint, [GLuint, GLenum, POINTER(GLchar)], requires='OpenGL 4.0')
+glGetSynciv = _link_function('glGetSynciv', None, [GLsync, GLenum, GLsizei, POINTER(GLsizei), POINTER(GLint)], requires='OpenGL 3.2')
+glGetTexImage = _link_function('glGetTexImage', None, [GLenum, GLint, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.0')
+glGetTexLevelParameterfv = _link_function('glGetTexLevelParameterfv', None, [GLenum, GLint, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glGetTexLevelParameteriv = _link_function('glGetTexLevelParameteriv', None, [GLenum, GLint, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glGetTexParameterIiv = _link_function('glGetTexParameterIiv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 3.0')
+glGetTexParameterIuiv = _link_function('glGetTexParameterIuiv', None, [GLenum, GLenum, POINTER(GLuint)], requires='OpenGL 3.0')
+glGetTexParameterfv = _link_function('glGetTexParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glGetTexParameteriv = _link_function('glGetTexParameteriv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glGetTextureImage = _link_function('glGetTextureImage', None, [GLuint, GLint, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetTextureLevelParameterfv = _link_function('glGetTextureLevelParameterfv', None, [GLuint, GLint, GLenum, POINTER(GLfloat)], requires='OpenGL 4.5')
+glGetTextureLevelParameteriv = _link_function('glGetTextureLevelParameteriv', None, [GLuint, GLint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetTextureParameterIiv = _link_function('glGetTextureParameterIiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetTextureParameterIuiv = _link_function('glGetTextureParameterIuiv', None, [GLuint, GLenum, POINTER(GLuint)], requires='OpenGL 4.5')
+glGetTextureParameterfv = _link_function('glGetTextureParameterfv', None, [GLuint, GLenum, POINTER(GLfloat)], requires='OpenGL 4.5')
+glGetTextureParameteriv = _link_function('glGetTextureParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetTextureSubImage = _link_function('glGetTextureSubImage', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetTransformFeedbackVarying = _link_function('glGetTransformFeedbackVarying', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLsizei), POINTER(GLenum), POINTER(GLchar)], requires='OpenGL 3.0')
+glGetTransformFeedbacki64_v = _link_function('glGetTransformFeedbacki64_v', None, [GLuint, GLenum, GLuint, POINTER(GLint64)], requires='OpenGL 4.5')
+glGetTransformFeedbacki_v = _link_function('glGetTransformFeedbacki_v', None, [GLuint, GLenum, GLuint, POINTER(GLint)], requires='OpenGL 4.5')
+glGetTransformFeedbackiv = _link_function('glGetTransformFeedbackiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetUniformBlockIndex = _link_function('glGetUniformBlockIndex', GLuint, [GLuint, POINTER(GLchar)], requires='OpenGL 3.1')
+glGetUniformIndices = _link_function('glGetUniformIndices', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), POINTER(GLuint)], requires='OpenGL 3.1')
+glGetUniformLocation = _link_function('glGetUniformLocation', GLint, [GLuint, POINTER(GLchar)], requires='OpenGL 2.0')
+glGetUniformSubroutineuiv = _link_function('glGetUniformSubroutineuiv', None, [GLenum, GLint, POINTER(GLuint)], requires='OpenGL 4.0')
+glGetUniformdv = _link_function('glGetUniformdv', None, [GLuint, GLint, POINTER(GLdouble)], requires='OpenGL 4.0')
+glGetUniformfv = _link_function('glGetUniformfv', None, [GLuint, GLint, POINTER(GLfloat)], requires='OpenGL 2.0')
+glGetUniformiv = _link_function('glGetUniformiv', None, [GLuint, GLint, POINTER(GLint)], requires='OpenGL 2.0')
+glGetUniformuiv = _link_function('glGetUniformuiv', None, [GLuint, GLint, POINTER(GLuint)], requires='OpenGL 3.0')
+glGetVertexArrayIndexed64iv = _link_function('glGetVertexArrayIndexed64iv', None, [GLuint, GLuint, GLenum, POINTER(GLint64)], requires='OpenGL 4.5')
+glGetVertexArrayIndexediv = _link_function('glGetVertexArrayIndexediv', None, [GLuint, GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetVertexArrayiv = _link_function('glGetVertexArrayiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetVertexAttribIiv = _link_function('glGetVertexAttribIiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 3.0')
+glGetVertexAttribIuiv = _link_function('glGetVertexAttribIuiv', None, [GLuint, GLenum, POINTER(GLuint)], requires='OpenGL 3.0')
+glGetVertexAttribLdv = _link_function('glGetVertexAttribLdv', None, [GLuint, GLenum, POINTER(GLdouble)], requires='OpenGL 4.1')
+glGetVertexAttribPointerv = _link_function('glGetVertexAttribPointerv', None, [GLuint, GLenum, POINTER(GLvoid)], requires='OpenGL 2.0')
+glGetVertexAttribdv = _link_function('glGetVertexAttribdv', None, [GLuint, GLenum, POINTER(GLdouble)], requires='OpenGL 2.0')
+glGetVertexAttribfv = _link_function('glGetVertexAttribfv', None, [GLuint, GLenum, POINTER(GLfloat)], requires='OpenGL 2.0')
+glGetVertexAttribiv = _link_function('glGetVertexAttribiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 2.0')
+glGetnColorTable = _link_function('glGetnColorTable', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnCompressedTexImage = _link_function('glGetnCompressedTexImage', None, [GLenum, GLint, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnConvolutionFilter = _link_function('glGetnConvolutionFilter', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnHistogram = _link_function('glGetnHistogram', None, [GLenum, GLboolean, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnMapdv = _link_function('glGetnMapdv', None, [GLenum, GLenum, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.5')
+glGetnMapfv = _link_function('glGetnMapfv', None, [GLenum, GLenum, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.5')
+glGetnMapiv = _link_function('glGetnMapiv', None, [GLenum, GLenum, GLsizei, POINTER(GLint)], requires='OpenGL 4.5')
+glGetnMinmax = _link_function('glGetnMinmax', None, [GLenum, GLboolean, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnPixelMapfv = _link_function('glGetnPixelMapfv', None, [GLenum, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.5')
+glGetnPixelMapuiv = _link_function('glGetnPixelMapuiv', None, [GLenum, GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glGetnPixelMapusv = _link_function('glGetnPixelMapusv', None, [GLenum, GLsizei, POINTER(GLushort)], requires='OpenGL 4.5')
+glGetnPolygonStipple = _link_function('glGetnPolygonStipple', None, [GLsizei, POINTER(GLubyte)], requires='OpenGL 4.5')
+glGetnSeparableFilter = _link_function('glGetnSeparableFilter', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLvoid), GLsizei, POINTER(GLvoid), POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnTexImage = _link_function('glGetnTexImage', None, [GLenum, GLint, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnUniformdv = _link_function('glGetnUniformdv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.5')
+glGetnUniformfv = _link_function('glGetnUniformfv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.5')
+glGetnUniformiv = _link_function('glGetnUniformiv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], requires='OpenGL 4.5')
+glGetnUniformuiv = _link_function('glGetnUniformuiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glHint = _link_function('glHint', None, [GLenum, GLenum], requires='OpenGL 1.0')
+glInvalidateBufferData = _link_function('glInvalidateBufferData', None, [GLuint], requires='OpenGL 4.3')
+glInvalidateBufferSubData = _link_function('glInvalidateBufferSubData', None, [GLuint, GLintptr, GLsizeiptr], requires='OpenGL 4.3')
+glInvalidateFramebuffer = _link_function('glInvalidateFramebuffer', None, [GLenum, GLsizei, POINTER(GLenum)], requires='OpenGL 4.3')
+glInvalidateNamedFramebufferData = _link_function('glInvalidateNamedFramebufferData', None, [GLuint, GLsizei, POINTER(GLenum)], requires='OpenGL 4.5')
+glInvalidateNamedFramebufferSubData = _link_function('glInvalidateNamedFramebufferSubData', None, [GLuint, GLsizei, POINTER(GLenum), GLint, GLint, GLsizei, GLsizei], requires='OpenGL 4.5')
+glInvalidateSubFramebuffer = _link_function('glInvalidateSubFramebuffer', None, [GLenum, GLsizei, POINTER(GLenum), GLint, GLint, GLsizei, GLsizei], requires='OpenGL 4.3')
+glInvalidateTexImage = _link_function('glInvalidateTexImage', None, [GLuint, GLint], requires='OpenGL 4.3')
+glInvalidateTexSubImage = _link_function('glInvalidateTexSubImage', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei], requires='OpenGL 4.3')
+glIsBuffer = _link_function('glIsBuffer', GLboolean, [GLuint], requires='OpenGL 1.5')
+glIsEnabled = _link_function('glIsEnabled', GLboolean, [GLenum], requires='OpenGL 1.0')
+glIsEnabledi = _link_function('glIsEnabledi', GLboolean, [GLenum, GLuint], requires='OpenGL 3.0')
+glIsFramebuffer = _link_function('glIsFramebuffer', GLboolean, [GLuint], requires='OpenGL 3.0')
+glIsFramebufferEXT = _link_function('glIsFramebufferEXT', GLboolean, [GLuint], requires='None')
+glIsProgram = _link_function('glIsProgram', GLboolean, [GLuint], requires='OpenGL 2.0')
+glIsProgramPipeline = _link_function('glIsProgramPipeline', GLboolean, [GLuint], requires='OpenGL 4.1')
+glIsQuery = _link_function('glIsQuery', GLboolean, [GLuint], requires='OpenGL 1.5')
+glIsRenderbuffer = _link_function('glIsRenderbuffer', GLboolean, [GLuint], requires='OpenGL 3.0')
+glIsRenderbufferEXT = _link_function('glIsRenderbufferEXT', GLboolean, [GLuint], requires='None')
+glIsSampler = _link_function('glIsSampler', GLboolean, [GLuint], requires='OpenGL 3.3')
+glIsShader = _link_function('glIsShader', GLboolean, [GLuint], requires='OpenGL 2.0')
+glIsSync = _link_function('glIsSync', GLboolean, [GLsync], requires='OpenGL 3.2')
+glIsTexture = _link_function('glIsTexture', GLboolean, [GLuint], requires='OpenGL 1.1')
+glIsTransformFeedback = _link_function('glIsTransformFeedback', GLboolean, [GLuint], requires='OpenGL 4.0')
+glIsVertexArray = _link_function('glIsVertexArray', GLboolean, [GLuint], requires='OpenGL 3.0')
+glLineWidth = _link_function('glLineWidth', None, [GLfloat], requires='OpenGL 1.0')
+glLinkProgram = _link_function('glLinkProgram', None, [GLuint], requires='OpenGL 2.0')
+glLogicOp = _link_function('glLogicOp', None, [GLenum], requires='OpenGL 1.0')
+glMapBuffer = _link_function('glMapBuffer', POINTER(None), [GLenum, GLenum], requires='OpenGL 1.5')
+glMapBufferRange = _link_function('glMapBufferRange', POINTER(None), [GLenum, GLintptr, GLsizeiptr, GLbitfield], requires='OpenGL 3.0')
+glMapNamedBuffer = _link_function('glMapNamedBuffer', POINTER(None), [GLuint, GLenum], requires='OpenGL 4.5')
+glMapNamedBufferRange = _link_function('glMapNamedBufferRange', POINTER(None), [GLuint, GLintptr, GLsizeiptr, GLbitfield], requires='OpenGL 4.5')
+glMemoryBarrier = _link_function('glMemoryBarrier', None, [GLbitfield], requires='OpenGL 4.2')
+glMemoryBarrierByRegion = _link_function('glMemoryBarrierByRegion', None, [GLbitfield], requires='OpenGL 4.5')
+glMinSampleShading = _link_function('glMinSampleShading', None, [GLfloat], requires='OpenGL 4.0')
+glMultiDrawArrays = _link_function('glMultiDrawArrays', None, [GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei], requires='OpenGL 1.4')
+glMultiDrawArraysIndirect = _link_function('glMultiDrawArraysIndirect', None, [GLenum, POINTER(GLvoid), GLsizei, GLsizei], requires='OpenGL 4.3')
+glMultiDrawArraysIndirectCount = _link_function('glMultiDrawArraysIndirectCount', None, [GLenum, POINTER(GLvoid), GLintptr, GLsizei, GLsizei], requires='OpenGL 4.6')
+glMultiDrawElements = _link_function('glMultiDrawElements', None, [GLenum, POINTER(GLsizei), GLenum, POINTER(GLvoid), GLsizei], requires='OpenGL 1.4')
+glMultiDrawElementsBaseVertex = _link_function('glMultiDrawElementsBaseVertex', None, [GLenum, POINTER(GLsizei), GLenum, POINTER(GLvoid), GLsizei, POINTER(GLint)], requires='OpenGL 3.2')
+glMultiDrawElementsIndirect = _link_function('glMultiDrawElementsIndirect', None, [GLenum, GLenum, POINTER(GLvoid), GLsizei, GLsizei], requires='OpenGL 4.3')
+glMultiDrawElementsIndirectCount = _link_function('glMultiDrawElementsIndirectCount', None, [GLenum, GLenum, POINTER(GLvoid), GLintptr, GLsizei, GLsizei], requires='OpenGL 4.6')
+glMultiTexCoordP1ui = _link_function('glMultiTexCoordP1ui', None, [GLenum, GLenum, GLuint], requires='OpenGL 3.3')
+glMultiTexCoordP1uiv = _link_function('glMultiTexCoordP1uiv', None, [GLenum, GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glMultiTexCoordP2ui = _link_function('glMultiTexCoordP2ui', None, [GLenum, GLenum, GLuint], requires='OpenGL 3.3')
+glMultiTexCoordP2uiv = _link_function('glMultiTexCoordP2uiv', None, [GLenum, GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glMultiTexCoordP3ui = _link_function('glMultiTexCoordP3ui', None, [GLenum, GLenum, GLuint], requires='OpenGL 3.3')
+glMultiTexCoordP3uiv = _link_function('glMultiTexCoordP3uiv', None, [GLenum, GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glMultiTexCoordP4ui = _link_function('glMultiTexCoordP4ui', None, [GLenum, GLenum, GLuint], requires='OpenGL 3.3')
+glMultiTexCoordP4uiv = _link_function('glMultiTexCoordP4uiv', None, [GLenum, GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glNamedBufferData = _link_function('glNamedBufferData', None, [GLuint, GLsizeiptr, POINTER(GLvoid), GLenum], requires='OpenGL 4.5')
+glNamedBufferStorage = _link_function('glNamedBufferStorage', None, [GLuint, GLsizeiptr, POINTER(GLvoid), GLbitfield], requires='OpenGL 4.5')
+glNamedBufferSubData = _link_function('glNamedBufferSubData', None, [GLuint, GLintptr, GLsizeiptr, POINTER(GLvoid)], requires='OpenGL 4.5')
+glNamedFramebufferDrawBuffer = _link_function('glNamedFramebufferDrawBuffer', None, [GLuint, GLenum], requires='OpenGL 4.5')
+glNamedFramebufferDrawBuffers = _link_function('glNamedFramebufferDrawBuffers', None, [GLuint, GLsizei, POINTER(GLenum)], requires='OpenGL 4.5')
+glNamedFramebufferParameteri = _link_function('glNamedFramebufferParameteri', None, [GLuint, GLenum, GLint], requires='OpenGL 4.5')
+glNamedFramebufferReadBuffer = _link_function('glNamedFramebufferReadBuffer', None, [GLuint, GLenum], requires='OpenGL 4.5')
+glNamedFramebufferRenderbuffer = _link_function('glNamedFramebufferRenderbuffer', None, [GLuint, GLenum, GLenum, GLuint], requires='OpenGL 4.5')
+glNamedFramebufferTexture = _link_function('glNamedFramebufferTexture', None, [GLuint, GLenum, GLuint, GLint], requires='OpenGL 4.5')
+glNamedFramebufferTextureLayer = _link_function('glNamedFramebufferTextureLayer', None, [GLuint, GLenum, GLuint, GLint, GLint], requires='OpenGL 4.5')
+glNamedRenderbufferStorage = _link_function('glNamedRenderbufferStorage', None, [GLuint, GLenum, GLsizei, GLsizei], requires='OpenGL 4.5')
+glNamedRenderbufferStorageMultisample = _link_function('glNamedRenderbufferStorageMultisample', None, [GLuint, GLsizei, GLenum, GLsizei, GLsizei], requires='OpenGL 4.5')
+glNormalP3ui = _link_function('glNormalP3ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glNormalP3uiv = _link_function('glNormalP3uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glObjectLabel = _link_function('glObjectLabel', None, [GLenum, GLuint, GLsizei, POINTER(GLchar)], requires='OpenGL 4.3')
+glObjectPtrLabel = _link_function('glObjectPtrLabel', None, [POINTER(GLvoid), GLsizei, POINTER(GLchar)], requires='OpenGL 4.3')
+glPatchParameterfv = _link_function('glPatchParameterfv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 4.0')
+glPatchParameteri = _link_function('glPatchParameteri', None, [GLenum, GLint], requires='OpenGL 4.0')
+glPauseTransformFeedback = _link_function('glPauseTransformFeedback', None, [], requires='OpenGL 4.0')
+glPixelStoref = _link_function('glPixelStoref', None, [GLenum, GLfloat], requires='OpenGL 1.0')
+glPixelStorei = _link_function('glPixelStorei', None, [GLenum, GLint], requires='OpenGL 1.0')
+glPointParameterf = _link_function('glPointParameterf', None, [GLenum, GLfloat], requires='OpenGL 1.4')
+glPointParameterfv = _link_function('glPointParameterfv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 1.4')
+glPointParameteri = _link_function('glPointParameteri', None, [GLenum, GLint], requires='OpenGL 1.4')
+glPointParameteriv = _link_function('glPointParameteriv', None, [GLenum, POINTER(GLint)], requires='OpenGL 1.4')
+glPointSize = _link_function('glPointSize', None, [GLfloat], requires='OpenGL 1.0')
+glPolygonMode = _link_function('glPolygonMode', None, [GLenum, GLenum], requires='OpenGL 1.0')
+glPolygonOffset = _link_function('glPolygonOffset', None, [GLfloat, GLfloat], requires='OpenGL 1.1')
+glPolygonOffsetClamp = _link_function('glPolygonOffsetClamp', None, [GLfloat, GLfloat, GLfloat], requires='OpenGL 4.6')
+glPopDebugGroup = _link_function('glPopDebugGroup', None, [], requires='OpenGL 4.3')
+glPrimitiveRestartIndex = _link_function('glPrimitiveRestartIndex', None, [GLuint], requires='OpenGL 3.1')
+glProgramBinary = _link_function('glProgramBinary', None, [GLuint, GLenum, POINTER(GLvoid), GLsizei], requires='OpenGL 4.1')
+glProgramParameteri = _link_function('glProgramParameteri', None, [GLuint, GLenum, GLint], requires='OpenGL 4.1')
+glProgramUniform1d = _link_function('glProgramUniform1d', None, [GLuint, GLint, GLdouble], requires='OpenGL 4.1')
+glProgramUniform1dv = _link_function('glProgramUniform1dv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniform1f = _link_function('glProgramUniform1f', None, [GLuint, GLint, GLfloat], requires='OpenGL 4.1')
+glProgramUniform1fv = _link_function('glProgramUniform1fv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniform1i = _link_function('glProgramUniform1i', None, [GLuint, GLint, GLint], requires='OpenGL 4.1')
+glProgramUniform1iv = _link_function('glProgramUniform1iv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], requires='OpenGL 4.1')
+glProgramUniform1ui = _link_function('glProgramUniform1ui', None, [GLuint, GLint, GLuint], requires='OpenGL 4.1')
+glProgramUniform1uiv = _link_function('glProgramUniform1uiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.1')
+glProgramUniform2d = _link_function('glProgramUniform2d', None, [GLuint, GLint, GLdouble, GLdouble], requires='OpenGL 4.1')
+glProgramUniform2dv = _link_function('glProgramUniform2dv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniform2f = _link_function('glProgramUniform2f', None, [GLuint, GLint, GLfloat, GLfloat], requires='OpenGL 4.1')
+glProgramUniform2fv = _link_function('glProgramUniform2fv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniform2i = _link_function('glProgramUniform2i', None, [GLuint, GLint, GLint, GLint], requires='OpenGL 4.1')
+glProgramUniform2iv = _link_function('glProgramUniform2iv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], requires='OpenGL 4.1')
+glProgramUniform2ui = _link_function('glProgramUniform2ui', None, [GLuint, GLint, GLuint, GLuint], requires='OpenGL 4.1')
+glProgramUniform2uiv = _link_function('glProgramUniform2uiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.1')
+glProgramUniform3d = _link_function('glProgramUniform3d', None, [GLuint, GLint, GLdouble, GLdouble, GLdouble], requires='OpenGL 4.1')
+glProgramUniform3dv = _link_function('glProgramUniform3dv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniform3f = _link_function('glProgramUniform3f', None, [GLuint, GLint, GLfloat, GLfloat, GLfloat], requires='OpenGL 4.1')
+glProgramUniform3fv = _link_function('glProgramUniform3fv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniform3i = _link_function('glProgramUniform3i', None, [GLuint, GLint, GLint, GLint, GLint], requires='OpenGL 4.1')
+glProgramUniform3iv = _link_function('glProgramUniform3iv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], requires='OpenGL 4.1')
+glProgramUniform3ui = _link_function('glProgramUniform3ui', None, [GLuint, GLint, GLuint, GLuint, GLuint], requires='OpenGL 4.1')
+glProgramUniform3uiv = _link_function('glProgramUniform3uiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.1')
+glProgramUniform4d = _link_function('glProgramUniform4d', None, [GLuint, GLint, GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 4.1')
+glProgramUniform4dv = _link_function('glProgramUniform4dv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniform4f = _link_function('glProgramUniform4f', None, [GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 4.1')
+glProgramUniform4fv = _link_function('glProgramUniform4fv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniform4i = _link_function('glProgramUniform4i', None, [GLuint, GLint, GLint, GLint, GLint, GLint], requires='OpenGL 4.1')
+glProgramUniform4iv = _link_function('glProgramUniform4iv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], requires='OpenGL 4.1')
+glProgramUniform4ui = _link_function('glProgramUniform4ui', None, [GLuint, GLint, GLuint, GLuint, GLuint, GLuint], requires='OpenGL 4.1')
+glProgramUniform4uiv = _link_function('glProgramUniform4uiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.1')
+glProgramUniformMatrix2dv = _link_function('glProgramUniformMatrix2dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix2fv = _link_function('glProgramUniformMatrix2fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix2x3dv = _link_function('glProgramUniformMatrix2x3dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix2x3fv = _link_function('glProgramUniformMatrix2x3fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix2x4dv = _link_function('glProgramUniformMatrix2x4dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix2x4fv = _link_function('glProgramUniformMatrix2x4fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix3dv = _link_function('glProgramUniformMatrix3dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix3fv = _link_function('glProgramUniformMatrix3fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix3x2dv = _link_function('glProgramUniformMatrix3x2dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix3x2fv = _link_function('glProgramUniformMatrix3x2fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix3x4dv = _link_function('glProgramUniformMatrix3x4dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix3x4fv = _link_function('glProgramUniformMatrix3x4fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix4dv = _link_function('glProgramUniformMatrix4dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix4fv = _link_function('glProgramUniformMatrix4fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix4x2dv = _link_function('glProgramUniformMatrix4x2dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix4x2fv = _link_function('glProgramUniformMatrix4x2fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix4x3dv = _link_function('glProgramUniformMatrix4x3dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix4x3fv = _link_function('glProgramUniformMatrix4x3fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProvokingVertex = _link_function('glProvokingVertex', None, [GLenum], requires='OpenGL 3.2')
+glPushDebugGroup = _link_function('glPushDebugGroup', None, [GLenum, GLuint, GLsizei, POINTER(GLchar)], requires='OpenGL 4.3')
+glQueryCounter = _link_function('glQueryCounter', None, [GLuint, GLenum], requires='OpenGL 3.3')
+glReadBuffer = _link_function('glReadBuffer', None, [GLenum], requires='OpenGL 1.0')
+glReadPixels = _link_function('glReadPixels', None, [GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.0')
+glReadnPixels = _link_function('glReadnPixels', None, [GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glReleaseShaderCompiler = _link_function('glReleaseShaderCompiler', None, [], requires='OpenGL 4.1')
+glRenderbufferStorage = _link_function('glRenderbufferStorage', None, [GLenum, GLenum, GLsizei, GLsizei], requires='OpenGL 3.0')
+glRenderbufferStorageEXT = _link_function('glRenderbufferStorageEXT', None, [GLenum, GLenum, GLsizei, GLsizei], requires='None')
+glRenderbufferStorageMultisample = _link_function('glRenderbufferStorageMultisample', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei], requires='OpenGL 3.0')
+glResumeTransformFeedback = _link_function('glResumeTransformFeedback', None, [], requires='OpenGL 4.0')
+glSampleCoverage = _link_function('glSampleCoverage', None, [GLfloat, GLboolean], requires='OpenGL 1.3')
+glSampleCoverageARB = _link_function('glSampleCoverageARB', None, [GLfloat, GLboolean], requires='None')
+glSampleMaski = _link_function('glSampleMaski', None, [GLuint, GLbitfield], requires='OpenGL 3.2')
+glSamplerParameterIiv = _link_function('glSamplerParameterIiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 3.3')
+glSamplerParameterIuiv = _link_function('glSamplerParameterIuiv', None, [GLuint, GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glSamplerParameterf = _link_function('glSamplerParameterf', None, [GLuint, GLenum, GLfloat], requires='OpenGL 3.3')
+glSamplerParameterfv = _link_function('glSamplerParameterfv', None, [GLuint, GLenum, POINTER(GLfloat)], requires='OpenGL 3.3')
+glSamplerParameteri = _link_function('glSamplerParameteri', None, [GLuint, GLenum, GLint], requires='OpenGL 3.3')
+glSamplerParameteriv = _link_function('glSamplerParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 3.3')
+glScissor = _link_function('glScissor', None, [GLint, GLint, GLsizei, GLsizei], requires='OpenGL 1.0')
+glScissorArrayv = _link_function('glScissorArrayv', None, [GLuint, GLsizei, POINTER(GLint)], requires='OpenGL 4.1')
+glScissorIndexed = _link_function('glScissorIndexed', None, [GLuint, GLint, GLint, GLsizei, GLsizei], requires='OpenGL 4.1')
+glScissorIndexedv = _link_function('glScissorIndexedv', None, [GLuint, POINTER(GLint)], requires='OpenGL 4.1')
+glSecondaryColorP3ui = _link_function('glSecondaryColorP3ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glSecondaryColorP3uiv = _link_function('glSecondaryColorP3uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glShaderBinary = _link_function('glShaderBinary', None, [GLsizei, POINTER(GLuint), GLenum, POINTER(GLvoid), GLsizei], requires='OpenGL 4.1')
+glShaderSource = _link_function('glShaderSource', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), POINTER(GLint)], requires='OpenGL 2.0')
+glShaderStorageBlockBinding = _link_function('glShaderStorageBlockBinding', None, [GLuint, GLuint, GLuint], requires='OpenGL 4.3')
+glSpecializeShader = _link_function('glSpecializeShader', None, [GLuint, POINTER(GLchar), GLuint, POINTER(GLuint), POINTER(GLuint)], requires='OpenGL 4.6')
+glStencilFunc = _link_function('glStencilFunc', None, [GLenum, GLint, GLuint], requires='OpenGL 1.0')
+glStencilFuncSeparate = _link_function('glStencilFuncSeparate', None, [GLenum, GLenum, GLint, GLuint], requires='OpenGL 2.0')
+glStencilMask = _link_function('glStencilMask', None, [GLuint], requires='OpenGL 1.0')
+glStencilMaskSeparate = _link_function('glStencilMaskSeparate', None, [GLenum, GLuint], requires='OpenGL 2.0')
+glStencilOp = _link_function('glStencilOp', None, [GLenum, GLenum, GLenum], requires='OpenGL 1.0')
+glStencilOpSeparate = _link_function('glStencilOpSeparate', None, [GLenum, GLenum, GLenum, GLenum], requires='OpenGL 2.0')
+glTexBuffer = _link_function('glTexBuffer', None, [GLenum, GLenum, GLuint], requires='OpenGL 3.1')
+glTexBufferRange = _link_function('glTexBufferRange', None, [GLenum, GLenum, GLuint, GLintptr, GLsizeiptr], requires='OpenGL 4.3')
+glTexCoordP1ui = _link_function('glTexCoordP1ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glTexCoordP1uiv = _link_function('glTexCoordP1uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glTexCoordP2ui = _link_function('glTexCoordP2ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glTexCoordP2uiv = _link_function('glTexCoordP2uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glTexCoordP3ui = _link_function('glTexCoordP3ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glTexCoordP3uiv = _link_function('glTexCoordP3uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glTexCoordP4ui = _link_function('glTexCoordP4ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glTexCoordP4uiv = _link_function('glTexCoordP4uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glTexImage1D = _link_function('glTexImage1D', None, [GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.0')
+glTexImage2D = _link_function('glTexImage2D', None, [GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.0')
+glTexImage2DMultisample = _link_function('glTexImage2DMultisample', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean], requires='OpenGL 3.2')
+glTexImage3D = _link_function('glTexImage3D', None, [GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.2')
+glTexImage3DMultisample = _link_function('glTexImage3DMultisample', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean], requires='OpenGL 3.2')
+glTexParameterIiv = _link_function('glTexParameterIiv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 3.0')
+glTexParameterIuiv = _link_function('glTexParameterIuiv', None, [GLenum, GLenum, POINTER(GLuint)], requires='OpenGL 3.0')
+glTexParameterf = _link_function('glTexParameterf', None, [GLenum, GLenum, GLfloat], requires='OpenGL 1.0')
+glTexParameterfv = _link_function('glTexParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glTexParameteri = _link_function('glTexParameteri', None, [GLenum, GLenum, GLint], requires='OpenGL 1.0')
+glTexParameteriv = _link_function('glTexParameteriv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glTexStorage1D = _link_function('glTexStorage1D', None, [GLenum, GLsizei, GLenum, GLsizei], requires='OpenGL 4.2')
+glTexStorage2D = _link_function('glTexStorage2D', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei], requires='OpenGL 4.2')
+glTexStorage2DMultisample = _link_function('glTexStorage2DMultisample', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean], requires='OpenGL 4.3')
+glTexStorage3D = _link_function('glTexStorage3D', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei], requires='OpenGL 4.2')
+glTexStorage3DMultisample = _link_function('glTexStorage3DMultisample', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean], requires='OpenGL 4.3')
+glTexSubImage1D = _link_function('glTexSubImage1D', None, [GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.1')
+glTexSubImage2D = _link_function('glTexSubImage2D', None, [GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.1')
+glTexSubImage3D = _link_function('glTexSubImage3D', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.2')
+glTextureBarrier = _link_function('glTextureBarrier', None, [], requires='OpenGL 4.5')
+glTextureBuffer = _link_function('glTextureBuffer', None, [GLuint, GLenum, GLuint], requires='OpenGL 4.5')
+glTextureBufferRange = _link_function('glTextureBufferRange', None, [GLuint, GLenum, GLuint, GLintptr, GLsizeiptr], requires='OpenGL 4.5')
+glTextureParameterIiv = _link_function('glTextureParameterIiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glTextureParameterIuiv = _link_function('glTextureParameterIuiv', None, [GLuint, GLenum, POINTER(GLuint)], requires='OpenGL 4.5')
+glTextureParameterf = _link_function('glTextureParameterf', None, [GLuint, GLenum, GLfloat], requires='OpenGL 4.5')
+glTextureParameterfv = _link_function('glTextureParameterfv', None, [GLuint, GLenum, POINTER(GLfloat)], requires='OpenGL 4.5')
+glTextureParameteri = _link_function('glTextureParameteri', None, [GLuint, GLenum, GLint], requires='OpenGL 4.5')
+glTextureParameteriv = _link_function('glTextureParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glTextureStorage1D = _link_function('glTextureStorage1D', None, [GLuint, GLsizei, GLenum, GLsizei], requires='OpenGL 4.5')
+glTextureStorage2D = _link_function('glTextureStorage2D', None, [GLuint, GLsizei, GLenum, GLsizei, GLsizei], requires='OpenGL 4.5')
+glTextureStorage2DMultisample = _link_function('glTextureStorage2DMultisample', None, [GLuint, GLsizei, GLenum, GLsizei, GLsizei, GLboolean], requires='OpenGL 4.5')
+glTextureStorage3D = _link_function('glTextureStorage3D', None, [GLuint, GLsizei, GLenum, GLsizei, GLsizei, GLsizei], requires='OpenGL 4.5')
+glTextureStorage3DMultisample = _link_function('glTextureStorage3DMultisample', None, [GLuint, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean], requires='OpenGL 4.5')
+glTextureSubImage1D = _link_function('glTextureSubImage1D', None, [GLuint, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.5')
+glTextureSubImage2D = _link_function('glTextureSubImage2D', None, [GLuint, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.5')
+glTextureSubImage3D = _link_function('glTextureSubImage3D', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.5')
+glTextureView = _link_function('glTextureView', None, [GLuint, GLenum, GLuint, GLenum, GLuint, GLuint, GLuint, GLuint], requires='OpenGL 4.3')
+glTransformFeedbackBufferBase = _link_function('glTransformFeedbackBufferBase', None, [GLuint, GLuint, GLuint], requires='OpenGL 4.5')
+glTransformFeedbackBufferRange = _link_function('glTransformFeedbackBufferRange', None, [GLuint, GLuint, GLuint, GLintptr, GLsizeiptr], requires='OpenGL 4.5')
+glTransformFeedbackVaryings = _link_function('glTransformFeedbackVaryings', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), GLenum], requires='OpenGL 3.0')
+glUniform1d = _link_function('glUniform1d', None, [GLint, GLdouble], requires='OpenGL 4.0')
+glUniform1dv = _link_function('glUniform1dv', None, [GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniform1f = _link_function('glUniform1f', None, [GLint, GLfloat], requires='OpenGL 2.0')
+glUniform1fv = _link_function('glUniform1fv', None, [GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniform1i = _link_function('glUniform1i', None, [GLint, GLint], requires='OpenGL 2.0')
+glUniform1iv = _link_function('glUniform1iv', None, [GLint, GLsizei, POINTER(GLint)], requires='OpenGL 2.0')
+glUniform1ui = _link_function('glUniform1ui', None, [GLint, GLuint], requires='OpenGL 3.0')
+glUniform1uiv = _link_function('glUniform1uiv', None, [GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glUniform2d = _link_function('glUniform2d', None, [GLint, GLdouble, GLdouble], requires='OpenGL 4.0')
+glUniform2dv = _link_function('glUniform2dv', None, [GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniform2f = _link_function('glUniform2f', None, [GLint, GLfloat, GLfloat], requires='OpenGL 2.0')
+glUniform2fv = _link_function('glUniform2fv', None, [GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniform2i = _link_function('glUniform2i', None, [GLint, GLint, GLint], requires='OpenGL 2.0')
+glUniform2iv = _link_function('glUniform2iv', None, [GLint, GLsizei, POINTER(GLint)], requires='OpenGL 2.0')
+glUniform2ui = _link_function('glUniform2ui', None, [GLint, GLuint, GLuint], requires='OpenGL 3.0')
+glUniform2uiv = _link_function('glUniform2uiv', None, [GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glUniform3d = _link_function('glUniform3d', None, [GLint, GLdouble, GLdouble, GLdouble], requires='OpenGL 4.0')
+glUniform3dv = _link_function('glUniform3dv', None, [GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniform3f = _link_function('glUniform3f', None, [GLint, GLfloat, GLfloat, GLfloat], requires='OpenGL 2.0')
+glUniform3fv = _link_function('glUniform3fv', None, [GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniform3i = _link_function('glUniform3i', None, [GLint, GLint, GLint, GLint], requires='OpenGL 2.0')
+glUniform3iv = _link_function('glUniform3iv', None, [GLint, GLsizei, POINTER(GLint)], requires='OpenGL 2.0')
+glUniform3ui = _link_function('glUniform3ui', None, [GLint, GLuint, GLuint, GLuint], requires='OpenGL 3.0')
+glUniform3uiv = _link_function('glUniform3uiv', None, [GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glUniform4d = _link_function('glUniform4d', None, [GLint, GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 4.0')
+glUniform4dv = _link_function('glUniform4dv', None, [GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniform4f = _link_function('glUniform4f', None, [GLint, GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 2.0')
+glUniform4fv = _link_function('glUniform4fv', None, [GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniform4i = _link_function('glUniform4i', None, [GLint, GLint, GLint, GLint, GLint], requires='OpenGL 2.0')
+glUniform4iv = _link_function('glUniform4iv', None, [GLint, GLsizei, POINTER(GLint)], requires='OpenGL 2.0')
+glUniform4ui = _link_function('glUniform4ui', None, [GLint, GLuint, GLuint, GLuint, GLuint], requires='OpenGL 3.0')
+glUniform4uiv = _link_function('glUniform4uiv', None, [GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glUniformBlockBinding = _link_function('glUniformBlockBinding', None, [GLuint, GLuint, GLuint], requires='OpenGL 3.1')
+glUniformMatrix2dv = _link_function('glUniformMatrix2dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix2fv = _link_function('glUniformMatrix2fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniformMatrix2x3dv = _link_function('glUniformMatrix2x3dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix2x3fv = _link_function('glUniformMatrix2x3fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.1')
+glUniformMatrix2x4dv = _link_function('glUniformMatrix2x4dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix2x4fv = _link_function('glUniformMatrix2x4fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.1')
+glUniformMatrix3dv = _link_function('glUniformMatrix3dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix3fv = _link_function('glUniformMatrix3fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniformMatrix3x2dv = _link_function('glUniformMatrix3x2dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix3x2fv = _link_function('glUniformMatrix3x2fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.1')
+glUniformMatrix3x4dv = _link_function('glUniformMatrix3x4dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix3x4fv = _link_function('glUniformMatrix3x4fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.1')
+glUniformMatrix4dv = _link_function('glUniformMatrix4dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix4fv = _link_function('glUniformMatrix4fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniformMatrix4x2dv = _link_function('glUniformMatrix4x2dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix4x2fv = _link_function('glUniformMatrix4x2fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.1')
+glUniformMatrix4x3dv = _link_function('glUniformMatrix4x3dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix4x3fv = _link_function('glUniformMatrix4x3fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.1')
+glUniformSubroutinesuiv = _link_function('glUniformSubroutinesuiv', None, [GLenum, GLsizei, POINTER(GLuint)], requires='OpenGL 4.0')
+glUnmapBuffer = _link_function('glUnmapBuffer', GLboolean, [GLenum], requires='OpenGL 1.5')
+glUnmapNamedBuffer = _link_function('glUnmapNamedBuffer', GLboolean, [GLuint], requires='OpenGL 4.5')
+glUseProgram = _link_function('glUseProgram', None, [GLuint], requires='OpenGL 2.0')
+glUseProgramStages = _link_function('glUseProgramStages', None, [GLuint, GLbitfield, GLuint], requires='OpenGL 4.1')
+glValidateProgram = _link_function('glValidateProgram', None, [GLuint], requires='OpenGL 2.0')
+glValidateProgramPipeline = _link_function('glValidateProgramPipeline', None, [GLuint], requires='OpenGL 4.1')
+glVertexArrayAttribBinding = _link_function('glVertexArrayAttribBinding', None, [GLuint, GLuint, GLuint], requires='OpenGL 4.5')
+glVertexArrayAttribFormat = _link_function('glVertexArrayAttribFormat', None, [GLuint, GLuint, GLint, GLenum, GLboolean, GLuint], requires='OpenGL 4.5')
+glVertexArrayAttribIFormat = _link_function('glVertexArrayAttribIFormat', None, [GLuint, GLuint, GLint, GLenum, GLuint], requires='OpenGL 4.5')
+glVertexArrayAttribLFormat = _link_function('glVertexArrayAttribLFormat', None, [GLuint, GLuint, GLint, GLenum, GLuint], requires='OpenGL 4.5')
+glVertexArrayBindingDivisor = _link_function('glVertexArrayBindingDivisor', None, [GLuint, GLuint, GLuint], requires='OpenGL 4.5')
+glVertexArrayElementBuffer = _link_function('glVertexArrayElementBuffer', None, [GLuint, GLuint], requires='OpenGL 4.5')
+glVertexArrayVertexBuffer = _link_function('glVertexArrayVertexBuffer', None, [GLuint, GLuint, GLuint, GLintptr, GLsizei], requires='OpenGL 4.5')
+glVertexArrayVertexBuffers = _link_function('glVertexArrayVertexBuffers', None, [GLuint, GLuint, GLsizei, POINTER(GLuint), POINTER(GLintptr), POINTER(GLsizei)], requires='OpenGL 4.5')
+glVertexAttrib1d = _link_function('glVertexAttrib1d', None, [GLuint, GLdouble], requires='OpenGL 2.0')
+glVertexAttrib1dv = _link_function('glVertexAttrib1dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 2.0')
+glVertexAttrib1f = _link_function('glVertexAttrib1f', None, [GLuint, GLfloat], requires='OpenGL 2.0')
+glVertexAttrib1fv = _link_function('glVertexAttrib1fv', None, [GLuint, POINTER(GLfloat)], requires='OpenGL 2.0')
+glVertexAttrib1s = _link_function('glVertexAttrib1s', None, [GLuint, GLshort], requires='OpenGL 2.0')
+glVertexAttrib1sv = _link_function('glVertexAttrib1sv', None, [GLuint, POINTER(GLshort)], requires='OpenGL 2.0')
+glVertexAttrib2d = _link_function('glVertexAttrib2d', None, [GLuint, GLdouble, GLdouble], requires='OpenGL 2.0')
+glVertexAttrib2dv = _link_function('glVertexAttrib2dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 2.0')
+glVertexAttrib2f = _link_function('glVertexAttrib2f', None, [GLuint, GLfloat, GLfloat], requires='OpenGL 2.0')
+glVertexAttrib2fv = _link_function('glVertexAttrib2fv', None, [GLuint, POINTER(GLfloat)], requires='OpenGL 2.0')
+glVertexAttrib2s = _link_function('glVertexAttrib2s', None, [GLuint, GLshort, GLshort], requires='OpenGL 2.0')
+glVertexAttrib2sv = _link_function('glVertexAttrib2sv', None, [GLuint, POINTER(GLshort)], requires='OpenGL 2.0')
+glVertexAttrib3d = _link_function('glVertexAttrib3d', None, [GLuint, GLdouble, GLdouble, GLdouble], requires='OpenGL 2.0')
+glVertexAttrib3dv = _link_function('glVertexAttrib3dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 2.0')
+glVertexAttrib3f = _link_function('glVertexAttrib3f', None, [GLuint, GLfloat, GLfloat, GLfloat], requires='OpenGL 2.0')
+glVertexAttrib3fv = _link_function('glVertexAttrib3fv', None, [GLuint, POINTER(GLfloat)], requires='OpenGL 2.0')
+glVertexAttrib3s = _link_function('glVertexAttrib3s', None, [GLuint, GLshort, GLshort, GLshort], requires='OpenGL 2.0')
+glVertexAttrib3sv = _link_function('glVertexAttrib3sv', None, [GLuint, POINTER(GLshort)], requires='OpenGL 2.0')
+glVertexAttrib4Nbv = _link_function('glVertexAttrib4Nbv', None, [GLuint, POINTER(GLbyte)], requires='OpenGL 2.0')
+glVertexAttrib4Niv = _link_function('glVertexAttrib4Niv', None, [GLuint, POINTER(GLint)], requires='OpenGL 2.0')
+glVertexAttrib4Nsv = _link_function('glVertexAttrib4Nsv', None, [GLuint, POINTER(GLshort)], requires='OpenGL 2.0')
+glVertexAttrib4Nub = _link_function('glVertexAttrib4Nub', None, [GLuint, GLubyte, GLubyte, GLubyte, GLubyte], requires='OpenGL 2.0')
+glVertexAttrib4Nubv = _link_function('glVertexAttrib4Nubv', None, [GLuint, POINTER(GLubyte)], requires='OpenGL 2.0')
+glVertexAttrib4Nuiv = _link_function('glVertexAttrib4Nuiv', None, [GLuint, POINTER(GLuint)], requires='OpenGL 2.0')
+glVertexAttrib4Nusv = _link_function('glVertexAttrib4Nusv', None, [GLuint, POINTER(GLushort)], requires='OpenGL 2.0')
+glVertexAttrib4bv = _link_function('glVertexAttrib4bv', None, [GLuint, POINTER(GLbyte)], requires='OpenGL 2.0')
+glVertexAttrib4d = _link_function('glVertexAttrib4d', None, [GLuint, GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 2.0')
+glVertexAttrib4dv = _link_function('glVertexAttrib4dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 2.0')
+glVertexAttrib4f = _link_function('glVertexAttrib4f', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 2.0')
+glVertexAttrib4fv = _link_function('glVertexAttrib4fv', None, [GLuint, POINTER(GLfloat)], requires='OpenGL 2.0')
+glVertexAttrib4iv = _link_function('glVertexAttrib4iv', None, [GLuint, POINTER(GLint)], requires='OpenGL 2.0')
+glVertexAttrib4s = _link_function('glVertexAttrib4s', None, [GLuint, GLshort, GLshort, GLshort, GLshort], requires='OpenGL 2.0')
+glVertexAttrib4sv = _link_function('glVertexAttrib4sv', None, [GLuint, POINTER(GLshort)], requires='OpenGL 2.0')
+glVertexAttrib4ubv = _link_function('glVertexAttrib4ubv', None, [GLuint, POINTER(GLubyte)], requires='OpenGL 2.0')
+glVertexAttrib4uiv = _link_function('glVertexAttrib4uiv', None, [GLuint, POINTER(GLuint)], requires='OpenGL 2.0')
+glVertexAttrib4usv = _link_function('glVertexAttrib4usv', None, [GLuint, POINTER(GLushort)], requires='OpenGL 2.0')
+glVertexAttribBinding = _link_function('glVertexAttribBinding', None, [GLuint, GLuint], requires='OpenGL 4.3')
+glVertexAttribDivisor = _link_function('glVertexAttribDivisor', None, [GLuint, GLuint], requires='OpenGL 3.3')
+glVertexAttribFormat = _link_function('glVertexAttribFormat', None, [GLuint, GLint, GLenum, GLboolean, GLuint], requires='OpenGL 4.3')
+glVertexAttribI1i = _link_function('glVertexAttribI1i', None, [GLuint, GLint], requires='OpenGL 3.0')
+glVertexAttribI1iv = _link_function('glVertexAttribI1iv', None, [GLuint, POINTER(GLint)], requires='OpenGL 3.0')
+glVertexAttribI1ui = _link_function('glVertexAttribI1ui', None, [GLuint, GLuint], requires='OpenGL 3.0')
+glVertexAttribI1uiv = _link_function('glVertexAttribI1uiv', None, [GLuint, POINTER(GLuint)], requires='OpenGL 3.0')
+glVertexAttribI2i = _link_function('glVertexAttribI2i', None, [GLuint, GLint, GLint], requires='OpenGL 3.0')
+glVertexAttribI2iv = _link_function('glVertexAttribI2iv', None, [GLuint, POINTER(GLint)], requires='OpenGL 3.0')
+glVertexAttribI2ui = _link_function('glVertexAttribI2ui', None, [GLuint, GLuint, GLuint], requires='OpenGL 3.0')
+glVertexAttribI2uiv = _link_function('glVertexAttribI2uiv', None, [GLuint, POINTER(GLuint)], requires='OpenGL 3.0')
+glVertexAttribI3i = _link_function('glVertexAttribI3i', None, [GLuint, GLint, GLint, GLint], requires='OpenGL 3.0')
+glVertexAttribI3iv = _link_function('glVertexAttribI3iv', None, [GLuint, POINTER(GLint)], requires='OpenGL 3.0')
+glVertexAttribI3ui = _link_function('glVertexAttribI3ui', None, [GLuint, GLuint, GLuint, GLuint], requires='OpenGL 3.0')
+glVertexAttribI3uiv = _link_function('glVertexAttribI3uiv', None, [GLuint, POINTER(GLuint)], requires='OpenGL 3.0')
+glVertexAttribI4bv = _link_function('glVertexAttribI4bv', None, [GLuint, POINTER(GLbyte)], requires='OpenGL 3.0')
+glVertexAttribI4i = _link_function('glVertexAttribI4i', None, [GLuint, GLint, GLint, GLint, GLint], requires='OpenGL 3.0')
+glVertexAttribI4iv = _link_function('glVertexAttribI4iv', None, [GLuint, POINTER(GLint)], requires='OpenGL 3.0')
+glVertexAttribI4sv = _link_function('glVertexAttribI4sv', None, [GLuint, POINTER(GLshort)], requires='OpenGL 3.0')
+glVertexAttribI4ubv = _link_function('glVertexAttribI4ubv', None, [GLuint, POINTER(GLubyte)], requires='OpenGL 3.0')
+glVertexAttribI4ui = _link_function('glVertexAttribI4ui', None, [GLuint, GLuint, GLuint, GLuint, GLuint], requires='OpenGL 3.0')
+glVertexAttribI4uiv = _link_function('glVertexAttribI4uiv', None, [GLuint, POINTER(GLuint)], requires='OpenGL 3.0')
+glVertexAttribI4usv = _link_function('glVertexAttribI4usv', None, [GLuint, POINTER(GLushort)], requires='OpenGL 3.0')
+glVertexAttribIFormat = _link_function('glVertexAttribIFormat', None, [GLuint, GLint, GLenum, GLuint], requires='OpenGL 4.3')
+glVertexAttribIPointer = _link_function('glVertexAttribIPointer', None, [GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 3.0')
+glVertexAttribL1d = _link_function('glVertexAttribL1d', None, [GLuint, GLdouble], requires='OpenGL 4.1')
+glVertexAttribL1dv = _link_function('glVertexAttribL1dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 4.1')
+glVertexAttribL2d = _link_function('glVertexAttribL2d', None, [GLuint, GLdouble, GLdouble], requires='OpenGL 4.1')
+glVertexAttribL2dv = _link_function('glVertexAttribL2dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 4.1')
+glVertexAttribL3d = _link_function('glVertexAttribL3d', None, [GLuint, GLdouble, GLdouble, GLdouble], requires='OpenGL 4.1')
+glVertexAttribL3dv = _link_function('glVertexAttribL3dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 4.1')
+glVertexAttribL4d = _link_function('glVertexAttribL4d', None, [GLuint, GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 4.1')
+glVertexAttribL4dv = _link_function('glVertexAttribL4dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 4.1')
+glVertexAttribLFormat = _link_function('glVertexAttribLFormat', None, [GLuint, GLint, GLenum, GLuint], requires='OpenGL 4.3')
+glVertexAttribLPointer = _link_function('glVertexAttribLPointer', None, [GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.1')
+glVertexAttribP1ui = _link_function('glVertexAttribP1ui', None, [GLuint, GLenum, GLboolean, GLuint], requires='OpenGL 3.3')
+glVertexAttribP1uiv = _link_function('glVertexAttribP1uiv', None, [GLuint, GLenum, GLboolean, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexAttribP2ui = _link_function('glVertexAttribP2ui', None, [GLuint, GLenum, GLboolean, GLuint], requires='OpenGL 3.3')
+glVertexAttribP2uiv = _link_function('glVertexAttribP2uiv', None, [GLuint, GLenum, GLboolean, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexAttribP3ui = _link_function('glVertexAttribP3ui', None, [GLuint, GLenum, GLboolean, GLuint], requires='OpenGL 3.3')
+glVertexAttribP3uiv = _link_function('glVertexAttribP3uiv', None, [GLuint, GLenum, GLboolean, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexAttribP4ui = _link_function('glVertexAttribP4ui', None, [GLuint, GLenum, GLboolean, GLuint], requires='OpenGL 3.3')
+glVertexAttribP4uiv = _link_function('glVertexAttribP4uiv', None, [GLuint, GLenum, GLboolean, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexAttribPointer = _link_function('glVertexAttribPointer', None, [GLuint, GLint, GLenum, GLboolean, GLsizei, POINTER(GLvoid)], requires='OpenGL 2.0')
+glVertexBindingDivisor = _link_function('glVertexBindingDivisor', None, [GLuint, GLuint], requires='OpenGL 4.3')
+glVertexP2ui = _link_function('glVertexP2ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glVertexP2uiv = _link_function('glVertexP2uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexP3ui = _link_function('glVertexP3ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glVertexP3uiv = _link_function('glVertexP3uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexP4ui = _link_function('glVertexP4ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glVertexP4uiv = _link_function('glVertexP4uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glViewport = _link_function('glViewport', None, [GLint, GLint, GLsizei, GLsizei], requires='OpenGL 1.0')
+glViewportArrayv = _link_function('glViewportArrayv', None, [GLuint, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.1')
+glViewportIndexedf = _link_function('glViewportIndexedf', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 4.1')
+glViewportIndexedfv = _link_function('glViewportIndexedfv', None, [GLuint, POINTER(GLfloat)], requires='OpenGL 4.1')
+glWaitSync = _link_function('glWaitSync', None, [GLsync, GLbitfield, GLuint64], requires='OpenGL 3.2')
+
+
+__all__ = [
+ 'GLenum',
+ 'GLboolean',
+ 'GLbitfield',
+ 'GLvoid',
+ 'GLbyte',
+ 'GLubyte',
+ 'GLshort',
+ 'GLushort',
+ 'GLint',
+ 'GLuint',
+ 'GLclampx',
+ 'GLsizei',
+ 'GLfloat',
+ 'GLclampf',
+ 'GLdouble',
+ 'GLclampd',
+ 'GLchar',
+ 'GLintptr',
+ 'GLsizeiptr',
+ 'GLint64',
+ 'GLuint64',
+ 'GLsync',
+ 'GLDEBUGPROC',
+ 'GL_DEPTH_BUFFER_BIT',
+ 'GL_STENCIL_BUFFER_BIT',
+ 'GL_COLOR_BUFFER_BIT',
+ 'GL_FALSE',
+ 'GL_TRUE',
+ 'GL_POINTS',
+ 'GL_LINES',
+ 'GL_LINE_LOOP',
+ 'GL_LINE_STRIP',
+ 'GL_TRIANGLES',
+ 'GL_TRIANGLE_STRIP',
+ 'GL_TRIANGLE_FAN',
+ 'GL_NEVER',
+ 'GL_LESS',
+ 'GL_EQUAL',
+ 'GL_LEQUAL',
+ 'GL_GREATER',
+ 'GL_NOTEQUAL',
+ 'GL_GEQUAL',
+ 'GL_ALWAYS',
+ 'GL_ZERO',
+ 'GL_ONE',
+ 'GL_SRC_COLOR',
+ 'GL_ONE_MINUS_SRC_COLOR',
+ 'GL_SRC_ALPHA',
+ 'GL_ONE_MINUS_SRC_ALPHA',
+ 'GL_DST_ALPHA',
+ 'GL_ONE_MINUS_DST_ALPHA',
+ 'GL_DST_COLOR',
+ 'GL_ONE_MINUS_DST_COLOR',
+ 'GL_SRC_ALPHA_SATURATE',
+ 'GL_NONE',
+ 'GL_FRONT_LEFT',
+ 'GL_FRONT_RIGHT',
+ 'GL_BACK_LEFT',
+ 'GL_BACK_RIGHT',
+ 'GL_FRONT',
+ 'GL_BACK',
+ 'GL_LEFT',
+ 'GL_RIGHT',
+ 'GL_FRONT_AND_BACK',
+ 'GL_NO_ERROR',
+ 'GL_INVALID_ENUM',
+ 'GL_INVALID_VALUE',
+ 'GL_INVALID_OPERATION',
+ 'GL_OUT_OF_MEMORY',
+ 'GL_CW',
+ 'GL_CCW',
+ 'GL_POINT_SIZE',
+ 'GL_POINT_SIZE_RANGE',
+ 'GL_POINT_SIZE_GRANULARITY',
+ 'GL_LINE_SMOOTH',
+ 'GL_LINE_WIDTH',
+ 'GL_LINE_WIDTH_RANGE',
+ 'GL_LINE_WIDTH_GRANULARITY',
+ 'GL_POLYGON_MODE',
+ 'GL_POLYGON_SMOOTH',
+ 'GL_CULL_FACE',
+ 'GL_CULL_FACE_MODE',
+ 'GL_FRONT_FACE',
+ 'GL_DEPTH_RANGE',
+ 'GL_DEPTH_TEST',
+ 'GL_DEPTH_WRITEMASK',
+ 'GL_DEPTH_CLEAR_VALUE',
+ 'GL_DEPTH_FUNC',
+ 'GL_STENCIL_TEST',
+ 'GL_STENCIL_CLEAR_VALUE',
+ 'GL_STENCIL_FUNC',
+ 'GL_STENCIL_VALUE_MASK',
+ 'GL_STENCIL_FAIL',
+ 'GL_STENCIL_PASS_DEPTH_FAIL',
+ 'GL_STENCIL_PASS_DEPTH_PASS',
+ 'GL_STENCIL_REF',
+ 'GL_STENCIL_WRITEMASK',
+ 'GL_VIEWPORT',
+ 'GL_DITHER',
+ 'GL_BLEND_DST',
+ 'GL_BLEND_SRC',
+ 'GL_BLEND',
+ 'GL_LOGIC_OP_MODE',
+ 'GL_DRAW_BUFFER',
+ 'GL_READ_BUFFER',
+ 'GL_SCISSOR_BOX',
+ 'GL_SCISSOR_TEST',
+ 'GL_COLOR_CLEAR_VALUE',
+ 'GL_COLOR_WRITEMASK',
+ 'GL_DOUBLEBUFFER',
+ 'GL_STEREO',
+ 'GL_LINE_SMOOTH_HINT',
+ 'GL_POLYGON_SMOOTH_HINT',
+ 'GL_UNPACK_SWAP_BYTES',
+ 'GL_UNPACK_LSB_FIRST',
+ 'GL_UNPACK_ROW_LENGTH',
+ 'GL_UNPACK_SKIP_ROWS',
+ 'GL_UNPACK_SKIP_PIXELS',
+ 'GL_UNPACK_ALIGNMENT',
+ 'GL_PACK_SWAP_BYTES',
+ 'GL_PACK_LSB_FIRST',
+ 'GL_PACK_ROW_LENGTH',
+ 'GL_PACK_SKIP_ROWS',
+ 'GL_PACK_SKIP_PIXELS',
+ 'GL_PACK_ALIGNMENT',
+ 'GL_MAX_TEXTURE_SIZE',
+ 'GL_MAX_VIEWPORT_DIMS',
+ 'GL_SUBPIXEL_BITS',
+ 'GL_TEXTURE_1D',
+ 'GL_TEXTURE_2D',
+ 'GL_TEXTURE_WIDTH',
+ 'GL_TEXTURE_HEIGHT',
+ 'GL_TEXTURE_BORDER_COLOR',
+ 'GL_DONT_CARE',
+ 'GL_FASTEST',
+ 'GL_NICEST',
+ 'GL_BYTE',
+ 'GL_UNSIGNED_BYTE',
+ 'GL_SHORT',
+ 'GL_UNSIGNED_SHORT',
+ 'GL_INT',
+ 'GL_UNSIGNED_INT',
+ 'GL_FLOAT',
+ 'GL_CLEAR',
+ 'GL_AND',
+ 'GL_AND_REVERSE',
+ 'GL_COPY',
+ 'GL_AND_INVERTED',
+ 'GL_NOOP',
+ 'GL_XOR',
+ 'GL_OR',
+ 'GL_NOR',
+ 'GL_EQUIV',
+ 'GL_INVERT',
+ 'GL_OR_REVERSE',
+ 'GL_COPY_INVERTED',
+ 'GL_OR_INVERTED',
+ 'GL_NAND',
+ 'GL_SET',
+ 'GL_TEXTURE',
+ 'GL_COLOR',
+ 'GL_DEPTH',
+ 'GL_STENCIL',
+ 'GL_STENCIL_INDEX',
+ 'GL_DEPTH_COMPONENT',
+ 'GL_RED',
+ 'GL_GREEN',
+ 'GL_BLUE',
+ 'GL_ALPHA',
+ 'GL_RGB',
+ 'GL_RGBA',
+ 'GL_POINT',
+ 'GL_LINE',
+ 'GL_FILL',
+ 'GL_KEEP',
+ 'GL_REPLACE',
+ 'GL_INCR',
+ 'GL_DECR',
+ 'GL_VENDOR',
+ 'GL_RENDERER',
+ 'GL_VERSION',
+ 'GL_EXTENSIONS',
+ 'GL_NEAREST',
+ 'GL_LINEAR',
+ 'GL_NEAREST_MIPMAP_NEAREST',
+ 'GL_LINEAR_MIPMAP_NEAREST',
+ 'GL_NEAREST_MIPMAP_LINEAR',
+ 'GL_LINEAR_MIPMAP_LINEAR',
+ 'GL_TEXTURE_MAG_FILTER',
+ 'GL_TEXTURE_MIN_FILTER',
+ 'GL_TEXTURE_WRAP_S',
+ 'GL_TEXTURE_WRAP_T',
+ 'GL_REPEAT',
+ 'GL_COLOR_LOGIC_OP',
+ 'GL_POLYGON_OFFSET_UNITS',
+ 'GL_POLYGON_OFFSET_POINT',
+ 'GL_POLYGON_OFFSET_LINE',
+ 'GL_POLYGON_OFFSET_FILL',
+ 'GL_POLYGON_OFFSET_FACTOR',
+ 'GL_TEXTURE_BINDING_1D',
+ 'GL_TEXTURE_BINDING_2D',
+ 'GL_TEXTURE_INTERNAL_FORMAT',
+ 'GL_TEXTURE_RED_SIZE',
+ 'GL_TEXTURE_GREEN_SIZE',
+ 'GL_TEXTURE_BLUE_SIZE',
+ 'GL_TEXTURE_ALPHA_SIZE',
+ 'GL_DOUBLE',
+ 'GL_PROXY_TEXTURE_1D',
+ 'GL_PROXY_TEXTURE_2D',
+ 'GL_R3_G3_B2',
+ 'GL_RGB4',
+ 'GL_RGB5',
+ 'GL_RGB8',
+ 'GL_RGB10',
+ 'GL_RGB12',
+ 'GL_RGB16',
+ 'GL_RGBA2',
+ 'GL_RGBA4',
+ 'GL_RGB5_A1',
+ 'GL_RGBA8',
+ 'GL_RGB10_A2',
+ 'GL_RGBA12',
+ 'GL_RGBA16',
+ 'GL_UNSIGNED_BYTE_3_3_2',
+ 'GL_UNSIGNED_SHORT_4_4_4_4',
+ 'GL_UNSIGNED_SHORT_5_5_5_1',
+ 'GL_UNSIGNED_INT_8_8_8_8',
+ 'GL_UNSIGNED_INT_10_10_10_2',
+ 'GL_TEXTURE_BINDING_3D',
+ 'GL_PACK_SKIP_IMAGES',
+ 'GL_PACK_IMAGE_HEIGHT',
+ 'GL_UNPACK_SKIP_IMAGES',
+ 'GL_UNPACK_IMAGE_HEIGHT',
+ 'GL_TEXTURE_3D',
+ 'GL_PROXY_TEXTURE_3D',
+ 'GL_TEXTURE_DEPTH',
+ 'GL_TEXTURE_WRAP_R',
+ 'GL_MAX_3D_TEXTURE_SIZE',
+ 'GL_UNSIGNED_BYTE_2_3_3_REV',
+ 'GL_UNSIGNED_SHORT_5_6_5',
+ 'GL_UNSIGNED_SHORT_5_6_5_REV',
+ 'GL_UNSIGNED_SHORT_4_4_4_4_REV',
+ 'GL_UNSIGNED_SHORT_1_5_5_5_REV',
+ 'GL_UNSIGNED_INT_8_8_8_8_REV',
+ 'GL_UNSIGNED_INT_2_10_10_10_REV',
+ 'GL_BGR',
+ 'GL_BGRA',
+ 'GL_MAX_ELEMENTS_VERTICES',
+ 'GL_MAX_ELEMENTS_INDICES',
+ 'GL_CLAMP_TO_EDGE',
+ 'GL_TEXTURE_MIN_LOD',
+ 'GL_TEXTURE_MAX_LOD',
+ 'GL_TEXTURE_BASE_LEVEL',
+ 'GL_TEXTURE_MAX_LEVEL',
+ 'GL_SMOOTH_POINT_SIZE_RANGE',
+ 'GL_SMOOTH_POINT_SIZE_GRANULARITY',
+ 'GL_SMOOTH_LINE_WIDTH_RANGE',
+ 'GL_SMOOTH_LINE_WIDTH_GRANULARITY',
+ 'GL_ALIASED_LINE_WIDTH_RANGE',
+ 'GL_TEXTURE0',
+ 'GL_TEXTURE1',
+ 'GL_TEXTURE2',
+ 'GL_TEXTURE3',
+ 'GL_TEXTURE4',
+ 'GL_TEXTURE5',
+ 'GL_TEXTURE6',
+ 'GL_TEXTURE7',
+ 'GL_TEXTURE8',
+ 'GL_TEXTURE9',
+ 'GL_TEXTURE10',
+ 'GL_TEXTURE11',
+ 'GL_TEXTURE12',
+ 'GL_TEXTURE13',
+ 'GL_TEXTURE14',
+ 'GL_TEXTURE15',
+ 'GL_TEXTURE16',
+ 'GL_TEXTURE17',
+ 'GL_TEXTURE18',
+ 'GL_TEXTURE19',
+ 'GL_TEXTURE20',
+ 'GL_TEXTURE21',
+ 'GL_TEXTURE22',
+ 'GL_TEXTURE23',
+ 'GL_TEXTURE24',
+ 'GL_TEXTURE25',
+ 'GL_TEXTURE26',
+ 'GL_TEXTURE27',
+ 'GL_TEXTURE28',
+ 'GL_TEXTURE29',
+ 'GL_TEXTURE30',
+ 'GL_TEXTURE31',
+ 'GL_ACTIVE_TEXTURE',
+ 'GL_MULTISAMPLE',
+ 'GL_SAMPLE_ALPHA_TO_COVERAGE',
+ 'GL_SAMPLE_ALPHA_TO_ONE',
+ 'GL_SAMPLE_COVERAGE',
+ 'GL_SAMPLE_BUFFERS',
+ 'GL_SAMPLES',
+ 'GL_SAMPLE_COVERAGE_VALUE',
+ 'GL_SAMPLE_COVERAGE_INVERT',
+ 'GL_TEXTURE_CUBE_MAP',
+ 'GL_TEXTURE_BINDING_CUBE_MAP',
+ 'GL_TEXTURE_CUBE_MAP_POSITIVE_X',
+ 'GL_TEXTURE_CUBE_MAP_NEGATIVE_X',
+ 'GL_TEXTURE_CUBE_MAP_POSITIVE_Y',
+ 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y',
+ 'GL_TEXTURE_CUBE_MAP_POSITIVE_Z',
+ 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z',
+ 'GL_PROXY_TEXTURE_CUBE_MAP',
+ 'GL_MAX_CUBE_MAP_TEXTURE_SIZE',
+ 'GL_COMPRESSED_RGB',
+ 'GL_COMPRESSED_RGBA',
+ 'GL_TEXTURE_COMPRESSION_HINT',
+ 'GL_TEXTURE_COMPRESSED_IMAGE_SIZE',
+ 'GL_TEXTURE_COMPRESSED',
+ 'GL_NUM_COMPRESSED_TEXTURE_FORMATS',
+ 'GL_COMPRESSED_TEXTURE_FORMATS',
+ 'GL_CLAMP_TO_BORDER',
+ 'GL_BLEND_DST_RGB',
+ 'GL_BLEND_SRC_RGB',
+ 'GL_BLEND_DST_ALPHA',
+ 'GL_BLEND_SRC_ALPHA',
+ 'GL_POINT_FADE_THRESHOLD_SIZE',
+ 'GL_DEPTH_COMPONENT16',
+ 'GL_DEPTH_COMPONENT24',
+ 'GL_DEPTH_COMPONENT32',
+ 'GL_MIRRORED_REPEAT',
+ 'GL_MAX_TEXTURE_LOD_BIAS',
+ 'GL_TEXTURE_LOD_BIAS',
+ 'GL_INCR_WRAP',
+ 'GL_DECR_WRAP',
+ 'GL_TEXTURE_DEPTH_SIZE',
+ 'GL_TEXTURE_COMPARE_MODE',
+ 'GL_TEXTURE_COMPARE_FUNC',
+ 'GL_BLEND_COLOR',
+ 'GL_BLEND_EQUATION',
+ 'GL_CONSTANT_COLOR',
+ 'GL_ONE_MINUS_CONSTANT_COLOR',
+ 'GL_CONSTANT_ALPHA',
+ 'GL_ONE_MINUS_CONSTANT_ALPHA',
+ 'GL_FUNC_ADD',
+ 'GL_FUNC_REVERSE_SUBTRACT',
+ 'GL_FUNC_SUBTRACT',
+ 'GL_MIN',
+ 'GL_MAX',
+ 'GL_BUFFER_SIZE',
+ 'GL_BUFFER_USAGE',
+ 'GL_QUERY_COUNTER_BITS',
+ 'GL_CURRENT_QUERY',
+ 'GL_QUERY_RESULT',
+ 'GL_QUERY_RESULT_AVAILABLE',
+ 'GL_ARRAY_BUFFER',
+ 'GL_ELEMENT_ARRAY_BUFFER',
+ 'GL_ARRAY_BUFFER_BINDING',
+ 'GL_ELEMENT_ARRAY_BUFFER_BINDING',
+ 'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING',
+ 'GL_READ_ONLY',
+ 'GL_WRITE_ONLY',
+ 'GL_READ_WRITE',
+ 'GL_BUFFER_ACCESS',
+ 'GL_BUFFER_MAPPED',
+ 'GL_BUFFER_MAP_POINTER',
+ 'GL_STREAM_DRAW',
+ 'GL_STREAM_READ',
+ 'GL_STREAM_COPY',
+ 'GL_STATIC_DRAW',
+ 'GL_STATIC_READ',
+ 'GL_STATIC_COPY',
+ 'GL_DYNAMIC_DRAW',
+ 'GL_DYNAMIC_READ',
+ 'GL_DYNAMIC_COPY',
+ 'GL_SAMPLES_PASSED',
+ 'GL_SRC1_ALPHA',
+ 'GL_BLEND_EQUATION_RGB',
+ 'GL_VERTEX_ATTRIB_ARRAY_ENABLED',
+ 'GL_VERTEX_ATTRIB_ARRAY_SIZE',
+ 'GL_VERTEX_ATTRIB_ARRAY_STRIDE',
+ 'GL_VERTEX_ATTRIB_ARRAY_TYPE',
+ 'GL_CURRENT_VERTEX_ATTRIB',
+ 'GL_VERTEX_PROGRAM_POINT_SIZE',
+ 'GL_VERTEX_ATTRIB_ARRAY_POINTER',
+ 'GL_STENCIL_BACK_FUNC',
+ 'GL_STENCIL_BACK_FAIL',
+ 'GL_STENCIL_BACK_PASS_DEPTH_FAIL',
+ 'GL_STENCIL_BACK_PASS_DEPTH_PASS',
+ 'GL_MAX_DRAW_BUFFERS',
+ 'GL_DRAW_BUFFER0',
+ 'GL_DRAW_BUFFER1',
+ 'GL_DRAW_BUFFER2',
+ 'GL_DRAW_BUFFER3',
+ 'GL_DRAW_BUFFER4',
+ 'GL_DRAW_BUFFER5',
+ 'GL_DRAW_BUFFER6',
+ 'GL_DRAW_BUFFER7',
+ 'GL_DRAW_BUFFER8',
+ 'GL_DRAW_BUFFER9',
+ 'GL_DRAW_BUFFER10',
+ 'GL_DRAW_BUFFER11',
+ 'GL_DRAW_BUFFER12',
+ 'GL_DRAW_BUFFER13',
+ 'GL_DRAW_BUFFER14',
+ 'GL_DRAW_BUFFER15',
+ 'GL_BLEND_EQUATION_ALPHA',
+ 'GL_MAX_VERTEX_ATTRIBS',
+ 'GL_VERTEX_ATTRIB_ARRAY_NORMALIZED',
+ 'GL_MAX_TEXTURE_IMAGE_UNITS',
+ 'GL_FRAGMENT_SHADER',
+ 'GL_VERTEX_SHADER',
+ 'GL_MAX_FRAGMENT_UNIFORM_COMPONENTS',
+ 'GL_MAX_VERTEX_UNIFORM_COMPONENTS',
+ 'GL_MAX_VARYING_FLOATS',
+ 'GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS',
+ 'GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS',
+ 'GL_SHADER_TYPE',
+ 'GL_FLOAT_VEC2',
+ 'GL_FLOAT_VEC3',
+ 'GL_FLOAT_VEC4',
+ 'GL_INT_VEC2',
+ 'GL_INT_VEC3',
+ 'GL_INT_VEC4',
+ 'GL_BOOL',
+ 'GL_BOOL_VEC2',
+ 'GL_BOOL_VEC3',
+ 'GL_BOOL_VEC4',
+ 'GL_FLOAT_MAT2',
+ 'GL_FLOAT_MAT3',
+ 'GL_FLOAT_MAT4',
+ 'GL_SAMPLER_1D',
+ 'GL_SAMPLER_2D',
+ 'GL_SAMPLER_3D',
+ 'GL_SAMPLER_CUBE',
+ 'GL_SAMPLER_1D_SHADOW',
+ 'GL_SAMPLER_2D_SHADOW',
+ 'GL_DELETE_STATUS',
+ 'GL_COMPILE_STATUS',
+ 'GL_LINK_STATUS',
+ 'GL_VALIDATE_STATUS',
+ 'GL_INFO_LOG_LENGTH',
+ 'GL_ATTACHED_SHADERS',
+ 'GL_ACTIVE_UNIFORMS',
+ 'GL_ACTIVE_UNIFORM_MAX_LENGTH',
+ 'GL_SHADER_SOURCE_LENGTH',
+ 'GL_ACTIVE_ATTRIBUTES',
+ 'GL_ACTIVE_ATTRIBUTE_MAX_LENGTH',
+ 'GL_FRAGMENT_SHADER_DERIVATIVE_HINT',
+ 'GL_SHADING_LANGUAGE_VERSION',
+ 'GL_CURRENT_PROGRAM',
+ 'GL_POINT_SPRITE_COORD_ORIGIN',
+ 'GL_LOWER_LEFT',
+ 'GL_UPPER_LEFT',
+ 'GL_STENCIL_BACK_REF',
+ 'GL_STENCIL_BACK_VALUE_MASK',
+ 'GL_STENCIL_BACK_WRITEMASK',
+ 'GL_PIXEL_PACK_BUFFER',
+ 'GL_PIXEL_UNPACK_BUFFER',
+ 'GL_PIXEL_PACK_BUFFER_BINDING',
+ 'GL_PIXEL_UNPACK_BUFFER_BINDING',
+ 'GL_FLOAT_MAT2x3',
+ 'GL_FLOAT_MAT2x4',
+ 'GL_FLOAT_MAT3x2',
+ 'GL_FLOAT_MAT3x4',
+ 'GL_FLOAT_MAT4x2',
+ 'GL_FLOAT_MAT4x3',
+ 'GL_SRGB',
+ 'GL_SRGB8',
+ 'GL_SRGB_ALPHA',
+ 'GL_SRGB8_ALPHA8',
+ 'GL_COMPRESSED_SRGB',
+ 'GL_COMPRESSED_SRGB_ALPHA',
+ 'GL_COMPARE_REF_TO_TEXTURE',
+ 'GL_CLIP_DISTANCE0',
+ 'GL_CLIP_DISTANCE1',
+ 'GL_CLIP_DISTANCE2',
+ 'GL_CLIP_DISTANCE3',
+ 'GL_CLIP_DISTANCE4',
+ 'GL_CLIP_DISTANCE5',
+ 'GL_CLIP_DISTANCE6',
+ 'GL_CLIP_DISTANCE7',
+ 'GL_MAX_CLIP_DISTANCES',
+ 'GL_MAJOR_VERSION',
+ 'GL_MINOR_VERSION',
+ 'GL_NUM_EXTENSIONS',
+ 'GL_CONTEXT_FLAGS',
+ 'GL_COMPRESSED_RED',
+ 'GL_COMPRESSED_RG',
+ 'GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT',
+ 'GL_RGBA32F',
+ 'GL_RGB32F',
+ 'GL_RGBA16F',
+ 'GL_RGB16F',
+ 'GL_VERTEX_ATTRIB_ARRAY_INTEGER',
+ 'GL_MAX_ARRAY_TEXTURE_LAYERS',
+ 'GL_MIN_PROGRAM_TEXEL_OFFSET',
+ 'GL_MAX_PROGRAM_TEXEL_OFFSET',
+ 'GL_CLAMP_READ_COLOR',
+ 'GL_FIXED_ONLY',
+ 'GL_MAX_VARYING_COMPONENTS',
+ 'GL_TEXTURE_1D_ARRAY',
+ 'GL_PROXY_TEXTURE_1D_ARRAY',
+ 'GL_TEXTURE_2D_ARRAY',
+ 'GL_PROXY_TEXTURE_2D_ARRAY',
+ 'GL_TEXTURE_BINDING_1D_ARRAY',
+ 'GL_TEXTURE_BINDING_2D_ARRAY',
+ 'GL_R11F_G11F_B10F',
+ 'GL_UNSIGNED_INT_10F_11F_11F_REV',
+ 'GL_RGB9_E5',
+ 'GL_UNSIGNED_INT_5_9_9_9_REV',
+ 'GL_TEXTURE_SHARED_SIZE',
+ 'GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_MODE',
+ 'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS',
+ 'GL_TRANSFORM_FEEDBACK_VARYINGS',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_START',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_SIZE',
+ 'GL_PRIMITIVES_GENERATED',
+ 'GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN',
+ 'GL_RASTERIZER_DISCARD',
+ 'GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS',
+ 'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS',
+ 'GL_INTERLEAVED_ATTRIBS',
+ 'GL_SEPARATE_ATTRIBS',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_BINDING',
+ 'GL_RGBA32UI',
+ 'GL_RGB32UI',
+ 'GL_RGBA16UI',
+ 'GL_RGB16UI',
+ 'GL_RGBA8UI',
+ 'GL_RGB8UI',
+ 'GL_RGBA32I',
+ 'GL_RGB32I',
+ 'GL_RGBA16I',
+ 'GL_RGB16I',
+ 'GL_RGBA8I',
+ 'GL_RGB8I',
+ 'GL_RED_INTEGER',
+ 'GL_GREEN_INTEGER',
+ 'GL_BLUE_INTEGER',
+ 'GL_RGB_INTEGER',
+ 'GL_RGBA_INTEGER',
+ 'GL_BGR_INTEGER',
+ 'GL_BGRA_INTEGER',
+ 'GL_SAMPLER_1D_ARRAY',
+ 'GL_SAMPLER_2D_ARRAY',
+ 'GL_SAMPLER_1D_ARRAY_SHADOW',
+ 'GL_SAMPLER_2D_ARRAY_SHADOW',
+ 'GL_SAMPLER_CUBE_SHADOW',
+ 'GL_UNSIGNED_INT_VEC2',
+ 'GL_UNSIGNED_INT_VEC3',
+ 'GL_UNSIGNED_INT_VEC4',
+ 'GL_INT_SAMPLER_1D',
+ 'GL_INT_SAMPLER_2D',
+ 'GL_INT_SAMPLER_3D',
+ 'GL_INT_SAMPLER_CUBE',
+ 'GL_INT_SAMPLER_1D_ARRAY',
+ 'GL_INT_SAMPLER_2D_ARRAY',
+ 'GL_UNSIGNED_INT_SAMPLER_1D',
+ 'GL_UNSIGNED_INT_SAMPLER_2D',
+ 'GL_UNSIGNED_INT_SAMPLER_3D',
+ 'GL_UNSIGNED_INT_SAMPLER_CUBE',
+ 'GL_UNSIGNED_INT_SAMPLER_1D_ARRAY',
+ 'GL_UNSIGNED_INT_SAMPLER_2D_ARRAY',
+ 'GL_QUERY_WAIT',
+ 'GL_QUERY_NO_WAIT',
+ 'GL_QUERY_BY_REGION_WAIT',
+ 'GL_QUERY_BY_REGION_NO_WAIT',
+ 'GL_BUFFER_ACCESS_FLAGS',
+ 'GL_BUFFER_MAP_LENGTH',
+ 'GL_BUFFER_MAP_OFFSET',
+ 'GL_DEPTH_COMPONENT32F',
+ 'GL_DEPTH32F_STENCIL8',
+ 'GL_FLOAT_32_UNSIGNED_INT_24_8_REV',
+ 'GL_INVALID_FRAMEBUFFER_OPERATION',
+ 'GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING',
+ 'GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE',
+ 'GL_FRAMEBUFFER_DEFAULT',
+ 'GL_FRAMEBUFFER_UNDEFINED',
+ 'GL_DEPTH_STENCIL_ATTACHMENT',
+ 'GL_MAX_RENDERBUFFER_SIZE',
+ 'GL_DEPTH_STENCIL',
+ 'GL_UNSIGNED_INT_24_8',
+ 'GL_DEPTH24_STENCIL8',
+ 'GL_TEXTURE_STENCIL_SIZE',
+ 'GL_TEXTURE_RED_TYPE',
+ 'GL_TEXTURE_GREEN_TYPE',
+ 'GL_TEXTURE_BLUE_TYPE',
+ 'GL_TEXTURE_ALPHA_TYPE',
+ 'GL_TEXTURE_DEPTH_TYPE',
+ 'GL_UNSIGNED_NORMALIZED',
+ 'GL_FRAMEBUFFER_BINDING',
+ 'GL_DRAW_FRAMEBUFFER_BINDING',
+ 'GL_RENDERBUFFER_BINDING',
+ 'GL_READ_FRAMEBUFFER',
+ 'GL_DRAW_FRAMEBUFFER',
+ 'GL_READ_FRAMEBUFFER_BINDING',
+ 'GL_RENDERBUFFER_SAMPLES',
+ 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER',
+ 'GL_FRAMEBUFFER_COMPLETE',
+ 'GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER',
+ 'GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER',
+ 'GL_FRAMEBUFFER_UNSUPPORTED',
+ 'GL_MAX_COLOR_ATTACHMENTS',
+ 'GL_COLOR_ATTACHMENT0',
+ 'GL_COLOR_ATTACHMENT1',
+ 'GL_COLOR_ATTACHMENT2',
+ 'GL_COLOR_ATTACHMENT3',
+ 'GL_COLOR_ATTACHMENT4',
+ 'GL_COLOR_ATTACHMENT5',
+ 'GL_COLOR_ATTACHMENT6',
+ 'GL_COLOR_ATTACHMENT7',
+ 'GL_COLOR_ATTACHMENT8',
+ 'GL_COLOR_ATTACHMENT9',
+ 'GL_COLOR_ATTACHMENT10',
+ 'GL_COLOR_ATTACHMENT11',
+ 'GL_COLOR_ATTACHMENT12',
+ 'GL_COLOR_ATTACHMENT13',
+ 'GL_COLOR_ATTACHMENT14',
+ 'GL_COLOR_ATTACHMENT15',
+ 'GL_COLOR_ATTACHMENT16',
+ 'GL_COLOR_ATTACHMENT17',
+ 'GL_COLOR_ATTACHMENT18',
+ 'GL_COLOR_ATTACHMENT19',
+ 'GL_COLOR_ATTACHMENT20',
+ 'GL_COLOR_ATTACHMENT21',
+ 'GL_COLOR_ATTACHMENT22',
+ 'GL_COLOR_ATTACHMENT23',
+ 'GL_COLOR_ATTACHMENT24',
+ 'GL_COLOR_ATTACHMENT25',
+ 'GL_COLOR_ATTACHMENT26',
+ 'GL_COLOR_ATTACHMENT27',
+ 'GL_COLOR_ATTACHMENT28',
+ 'GL_COLOR_ATTACHMENT29',
+ 'GL_COLOR_ATTACHMENT30',
+ 'GL_COLOR_ATTACHMENT31',
+ 'GL_DEPTH_ATTACHMENT',
+ 'GL_STENCIL_ATTACHMENT',
+ 'GL_FRAMEBUFFER',
+ 'GL_RENDERBUFFER',
+ 'GL_RENDERBUFFER_WIDTH',
+ 'GL_RENDERBUFFER_HEIGHT',
+ 'GL_RENDERBUFFER_INTERNAL_FORMAT',
+ 'GL_STENCIL_INDEX1',
+ 'GL_STENCIL_INDEX4',
+ 'GL_STENCIL_INDEX8',
+ 'GL_STENCIL_INDEX16',
+ 'GL_RENDERBUFFER_RED_SIZE',
+ 'GL_RENDERBUFFER_GREEN_SIZE',
+ 'GL_RENDERBUFFER_BLUE_SIZE',
+ 'GL_RENDERBUFFER_ALPHA_SIZE',
+ 'GL_RENDERBUFFER_DEPTH_SIZE',
+ 'GL_RENDERBUFFER_STENCIL_SIZE',
+ 'GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE',
+ 'GL_MAX_SAMPLES',
+ 'GL_FRAMEBUFFER_SRGB',
+ 'GL_HALF_FLOAT',
+ 'GL_MAP_READ_BIT',
+ 'GL_MAP_WRITE_BIT',
+ 'GL_MAP_INVALIDATE_RANGE_BIT',
+ 'GL_MAP_INVALIDATE_BUFFER_BIT',
+ 'GL_MAP_FLUSH_EXPLICIT_BIT',
+ 'GL_MAP_UNSYNCHRONIZED_BIT',
+ 'GL_COMPRESSED_RED_RGTC1',
+ 'GL_COMPRESSED_SIGNED_RED_RGTC1',
+ 'GL_COMPRESSED_RG_RGTC2',
+ 'GL_COMPRESSED_SIGNED_RG_RGTC2',
+ 'GL_RG',
+ 'GL_RG_INTEGER',
+ 'GL_R8',
+ 'GL_R16',
+ 'GL_RG8',
+ 'GL_RG16',
+ 'GL_R16F',
+ 'GL_R32F',
+ 'GL_RG16F',
+ 'GL_RG32F',
+ 'GL_R8I',
+ 'GL_R8UI',
+ 'GL_R16I',
+ 'GL_R16UI',
+ 'GL_R32I',
+ 'GL_R32UI',
+ 'GL_RG8I',
+ 'GL_RG8UI',
+ 'GL_RG16I',
+ 'GL_RG16UI',
+ 'GL_RG32I',
+ 'GL_RG32UI',
+ 'GL_VERTEX_ARRAY_BINDING',
+ 'GL_SAMPLER_2D_RECT',
+ 'GL_SAMPLER_2D_RECT_SHADOW',
+ 'GL_SAMPLER_BUFFER',
+ 'GL_INT_SAMPLER_2D_RECT',
+ 'GL_INT_SAMPLER_BUFFER',
+ 'GL_UNSIGNED_INT_SAMPLER_2D_RECT',
+ 'GL_UNSIGNED_INT_SAMPLER_BUFFER',
+ 'GL_TEXTURE_BUFFER',
+ 'GL_MAX_TEXTURE_BUFFER_SIZE',
+ 'GL_TEXTURE_BINDING_BUFFER',
+ 'GL_TEXTURE_BUFFER_DATA_STORE_BINDING',
+ 'GL_TEXTURE_RECTANGLE',
+ 'GL_TEXTURE_BINDING_RECTANGLE',
+ 'GL_PROXY_TEXTURE_RECTANGLE',
+ 'GL_MAX_RECTANGLE_TEXTURE_SIZE',
+ 'GL_R8_SNORM',
+ 'GL_RG8_SNORM',
+ 'GL_RGB8_SNORM',
+ 'GL_RGBA8_SNORM',
+ 'GL_R16_SNORM',
+ 'GL_RG16_SNORM',
+ 'GL_RGB16_SNORM',
+ 'GL_RGBA16_SNORM',
+ 'GL_SIGNED_NORMALIZED',
+ 'GL_PRIMITIVE_RESTART',
+ 'GL_PRIMITIVE_RESTART_INDEX',
+ 'GL_COPY_READ_BUFFER',
+ 'GL_COPY_WRITE_BUFFER',
+ 'GL_UNIFORM_BUFFER',
+ 'GL_UNIFORM_BUFFER_BINDING',
+ 'GL_UNIFORM_BUFFER_START',
+ 'GL_UNIFORM_BUFFER_SIZE',
+ 'GL_MAX_VERTEX_UNIFORM_BLOCKS',
+ 'GL_MAX_GEOMETRY_UNIFORM_BLOCKS',
+ 'GL_MAX_FRAGMENT_UNIFORM_BLOCKS',
+ 'GL_MAX_COMBINED_UNIFORM_BLOCKS',
+ 'GL_MAX_UNIFORM_BUFFER_BINDINGS',
+ 'GL_MAX_UNIFORM_BLOCK_SIZE',
+ 'GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS',
+ 'GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS',
+ 'GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS',
+ 'GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT',
+ 'GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH',
+ 'GL_ACTIVE_UNIFORM_BLOCKS',
+ 'GL_UNIFORM_TYPE',
+ 'GL_UNIFORM_SIZE',
+ 'GL_UNIFORM_NAME_LENGTH',
+ 'GL_UNIFORM_BLOCK_INDEX',
+ 'GL_UNIFORM_OFFSET',
+ 'GL_UNIFORM_ARRAY_STRIDE',
+ 'GL_UNIFORM_MATRIX_STRIDE',
+ 'GL_UNIFORM_IS_ROW_MAJOR',
+ 'GL_UNIFORM_BLOCK_BINDING',
+ 'GL_UNIFORM_BLOCK_DATA_SIZE',
+ 'GL_UNIFORM_BLOCK_NAME_LENGTH',
+ 'GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS',
+ 'GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES',
+ 'GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER',
+ 'GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER',
+ 'GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER',
+ 'GL_INVALID_INDEX',
+ 'GL_CONTEXT_CORE_PROFILE_BIT',
+ 'GL_CONTEXT_COMPATIBILITY_PROFILE_BIT',
+ 'GL_LINES_ADJACENCY',
+ 'GL_LINE_STRIP_ADJACENCY',
+ 'GL_TRIANGLES_ADJACENCY',
+ 'GL_TRIANGLE_STRIP_ADJACENCY',
+ 'GL_PROGRAM_POINT_SIZE',
+ 'GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS',
+ 'GL_FRAMEBUFFER_ATTACHMENT_LAYERED',
+ 'GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS',
+ 'GL_GEOMETRY_SHADER',
+ 'GL_GEOMETRY_VERTICES_OUT',
+ 'GL_GEOMETRY_INPUT_TYPE',
+ 'GL_GEOMETRY_OUTPUT_TYPE',
+ 'GL_MAX_GEOMETRY_UNIFORM_COMPONENTS',
+ 'GL_MAX_GEOMETRY_OUTPUT_VERTICES',
+ 'GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS',
+ 'GL_MAX_VERTEX_OUTPUT_COMPONENTS',
+ 'GL_MAX_GEOMETRY_INPUT_COMPONENTS',
+ 'GL_MAX_GEOMETRY_OUTPUT_COMPONENTS',
+ 'GL_MAX_FRAGMENT_INPUT_COMPONENTS',
+ 'GL_CONTEXT_PROFILE_MASK',
+ 'GL_DEPTH_CLAMP',
+ 'GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION',
+ 'GL_FIRST_VERTEX_CONVENTION',
+ 'GL_LAST_VERTEX_CONVENTION',
+ 'GL_PROVOKING_VERTEX',
+ 'GL_TEXTURE_CUBE_MAP_SEAMLESS',
+ 'GL_MAX_SERVER_WAIT_TIMEOUT',
+ 'GL_OBJECT_TYPE',
+ 'GL_SYNC_CONDITION',
+ 'GL_SYNC_STATUS',
+ 'GL_SYNC_FLAGS',
+ 'GL_SYNC_FENCE',
+ 'GL_SYNC_GPU_COMMANDS_COMPLETE',
+ 'GL_UNSIGNALED',
+ 'GL_SIGNALED',
+ 'GL_ALREADY_SIGNALED',
+ 'GL_TIMEOUT_EXPIRED',
+ 'GL_CONDITION_SATISFIED',
+ 'GL_WAIT_FAILED',
+ 'GL_TIMEOUT_IGNORED',
+ 'GL_SYNC_FLUSH_COMMANDS_BIT',
+ 'GL_SAMPLE_POSITION',
+ 'GL_SAMPLE_MASK',
+ 'GL_SAMPLE_MASK_VALUE',
+ 'GL_MAX_SAMPLE_MASK_WORDS',
+ 'GL_TEXTURE_2D_MULTISAMPLE',
+ 'GL_PROXY_TEXTURE_2D_MULTISAMPLE',
+ 'GL_TEXTURE_2D_MULTISAMPLE_ARRAY',
+ 'GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY',
+ 'GL_TEXTURE_BINDING_2D_MULTISAMPLE',
+ 'GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY',
+ 'GL_TEXTURE_SAMPLES',
+ 'GL_TEXTURE_FIXED_SAMPLE_LOCATIONS',
+ 'GL_SAMPLER_2D_MULTISAMPLE',
+ 'GL_INT_SAMPLER_2D_MULTISAMPLE',
+ 'GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE',
+ 'GL_SAMPLER_2D_MULTISAMPLE_ARRAY',
+ 'GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY',
+ 'GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY',
+ 'GL_MAX_COLOR_TEXTURE_SAMPLES',
+ 'GL_MAX_DEPTH_TEXTURE_SAMPLES',
+ 'GL_MAX_INTEGER_SAMPLES',
+ 'GL_VERTEX_ATTRIB_ARRAY_DIVISOR',
+ 'GL_SRC1_COLOR',
+ 'GL_ONE_MINUS_SRC1_COLOR',
+ 'GL_ONE_MINUS_SRC1_ALPHA',
+ 'GL_MAX_DUAL_SOURCE_DRAW_BUFFERS',
+ 'GL_ANY_SAMPLES_PASSED',
+ 'GL_SAMPLER_BINDING',
+ 'GL_RGB10_A2UI',
+ 'GL_TEXTURE_SWIZZLE_R',
+ 'GL_TEXTURE_SWIZZLE_G',
+ 'GL_TEXTURE_SWIZZLE_B',
+ 'GL_TEXTURE_SWIZZLE_A',
+ 'GL_TEXTURE_SWIZZLE_RGBA',
+ 'GL_TIME_ELAPSED',
+ 'GL_TIMESTAMP',
+ 'GL_INT_2_10_10_10_REV',
+ 'GL_SAMPLE_SHADING',
+ 'GL_MIN_SAMPLE_SHADING_VALUE',
+ 'GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET',
+ 'GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET',
+ 'GL_TEXTURE_CUBE_MAP_ARRAY',
+ 'GL_TEXTURE_BINDING_CUBE_MAP_ARRAY',
+ 'GL_PROXY_TEXTURE_CUBE_MAP_ARRAY',
+ 'GL_SAMPLER_CUBE_MAP_ARRAY',
+ 'GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW',
+ 'GL_INT_SAMPLER_CUBE_MAP_ARRAY',
+ 'GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY',
+ 'GL_DRAW_INDIRECT_BUFFER',
+ 'GL_DRAW_INDIRECT_BUFFER_BINDING',
+ 'GL_GEOMETRY_SHADER_INVOCATIONS',
+ 'GL_MAX_GEOMETRY_SHADER_INVOCATIONS',
+ 'GL_MIN_FRAGMENT_INTERPOLATION_OFFSET',
+ 'GL_MAX_FRAGMENT_INTERPOLATION_OFFSET',
+ 'GL_FRAGMENT_INTERPOLATION_OFFSET_BITS',
+ 'GL_MAX_VERTEX_STREAMS',
+ 'GL_DOUBLE_VEC2',
+ 'GL_DOUBLE_VEC3',
+ 'GL_DOUBLE_VEC4',
+ 'GL_DOUBLE_MAT2',
+ 'GL_DOUBLE_MAT3',
+ 'GL_DOUBLE_MAT4',
+ 'GL_DOUBLE_MAT2x3',
+ 'GL_DOUBLE_MAT2x4',
+ 'GL_DOUBLE_MAT3x2',
+ 'GL_DOUBLE_MAT3x4',
+ 'GL_DOUBLE_MAT4x2',
+ 'GL_DOUBLE_MAT4x3',
+ 'GL_ACTIVE_SUBROUTINES',
+ 'GL_ACTIVE_SUBROUTINE_UNIFORMS',
+ 'GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS',
+ 'GL_ACTIVE_SUBROUTINE_MAX_LENGTH',
+ 'GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH',
+ 'GL_MAX_SUBROUTINES',
+ 'GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS',
+ 'GL_NUM_COMPATIBLE_SUBROUTINES',
+ 'GL_COMPATIBLE_SUBROUTINES',
+ 'GL_PATCHES',
+ 'GL_PATCH_VERTICES',
+ 'GL_PATCH_DEFAULT_INNER_LEVEL',
+ 'GL_PATCH_DEFAULT_OUTER_LEVEL',
+ 'GL_TESS_CONTROL_OUTPUT_VERTICES',
+ 'GL_TESS_GEN_MODE',
+ 'GL_TESS_GEN_SPACING',
+ 'GL_TESS_GEN_VERTEX_ORDER',
+ 'GL_TESS_GEN_POINT_MODE',
+ 'GL_ISOLINES',
+ 'GL_QUADS',
+ 'GL_FRACTIONAL_ODD',
+ 'GL_FRACTIONAL_EVEN',
+ 'GL_MAX_PATCH_VERTICES',
+ 'GL_MAX_TESS_GEN_LEVEL',
+ 'GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS',
+ 'GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS',
+ 'GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS',
+ 'GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS',
+ 'GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS',
+ 'GL_MAX_TESS_PATCH_COMPONENTS',
+ 'GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS',
+ 'GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS',
+ 'GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS',
+ 'GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS',
+ 'GL_MAX_TESS_CONTROL_INPUT_COMPONENTS',
+ 'GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS',
+ 'GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS',
+ 'GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS',
+ 'GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER',
+ 'GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER',
+ 'GL_TESS_EVALUATION_SHADER',
+ 'GL_TESS_CONTROL_SHADER',
+ 'GL_TRANSFORM_FEEDBACK',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE',
+ 'GL_TRANSFORM_FEEDBACK_BINDING',
+ 'GL_MAX_TRANSFORM_FEEDBACK_BUFFERS',
+ 'GL_FIXED',
+ 'GL_IMPLEMENTATION_COLOR_READ_TYPE',
+ 'GL_IMPLEMENTATION_COLOR_READ_FORMAT',
+ 'GL_LOW_FLOAT',
+ 'GL_MEDIUM_FLOAT',
+ 'GL_HIGH_FLOAT',
+ 'GL_LOW_INT',
+ 'GL_MEDIUM_INT',
+ 'GL_HIGH_INT',
+ 'GL_SHADER_COMPILER',
+ 'GL_SHADER_BINARY_FORMATS',
+ 'GL_NUM_SHADER_BINARY_FORMATS',
+ 'GL_MAX_VERTEX_UNIFORM_VECTORS',
+ 'GL_MAX_VARYING_VECTORS',
+ 'GL_MAX_FRAGMENT_UNIFORM_VECTORS',
+ 'GL_RGB565',
+ 'GL_PROGRAM_BINARY_RETRIEVABLE_HINT',
+ 'GL_PROGRAM_BINARY_LENGTH',
+ 'GL_NUM_PROGRAM_BINARY_FORMATS',
+ 'GL_PROGRAM_BINARY_FORMATS',
+ 'GL_VERTEX_SHADER_BIT',
+ 'GL_FRAGMENT_SHADER_BIT',
+ 'GL_GEOMETRY_SHADER_BIT',
+ 'GL_TESS_CONTROL_SHADER_BIT',
+ 'GL_TESS_EVALUATION_SHADER_BIT',
+ 'GL_ALL_SHADER_BITS',
+ 'GL_PROGRAM_SEPARABLE',
+ 'GL_ACTIVE_PROGRAM',
+ 'GL_PROGRAM_PIPELINE_BINDING',
+ 'GL_MAX_VIEWPORTS',
+ 'GL_VIEWPORT_SUBPIXEL_BITS',
+ 'GL_VIEWPORT_BOUNDS_RANGE',
+ 'GL_LAYER_PROVOKING_VERTEX',
+ 'GL_VIEWPORT_INDEX_PROVOKING_VERTEX',
+ 'GL_UNDEFINED_VERTEX',
+ 'GL_COPY_READ_BUFFER_BINDING',
+ 'GL_COPY_WRITE_BUFFER_BINDING',
+ 'GL_TRANSFORM_FEEDBACK_ACTIVE',
+ 'GL_TRANSFORM_FEEDBACK_PAUSED',
+ 'GL_UNPACK_COMPRESSED_BLOCK_WIDTH',
+ 'GL_UNPACK_COMPRESSED_BLOCK_HEIGHT',
+ 'GL_UNPACK_COMPRESSED_BLOCK_DEPTH',
+ 'GL_UNPACK_COMPRESSED_BLOCK_SIZE',
+ 'GL_PACK_COMPRESSED_BLOCK_WIDTH',
+ 'GL_PACK_COMPRESSED_BLOCK_HEIGHT',
+ 'GL_PACK_COMPRESSED_BLOCK_DEPTH',
+ 'GL_PACK_COMPRESSED_BLOCK_SIZE',
+ 'GL_NUM_SAMPLE_COUNTS',
+ 'GL_MIN_MAP_BUFFER_ALIGNMENT',
+ 'GL_ATOMIC_COUNTER_BUFFER',
+ 'GL_ATOMIC_COUNTER_BUFFER_BINDING',
+ 'GL_ATOMIC_COUNTER_BUFFER_START',
+ 'GL_ATOMIC_COUNTER_BUFFER_SIZE',
+ 'GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE',
+ 'GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS',
+ 'GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES',
+ 'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER',
+ 'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER',
+ 'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER',
+ 'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER',
+ 'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER',
+ 'GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_VERTEX_ATOMIC_COUNTERS',
+ 'GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS',
+ 'GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS',
+ 'GL_MAX_GEOMETRY_ATOMIC_COUNTERS',
+ 'GL_MAX_FRAGMENT_ATOMIC_COUNTERS',
+ 'GL_MAX_COMBINED_ATOMIC_COUNTERS',
+ 'GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE',
+ 'GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS',
+ 'GL_ACTIVE_ATOMIC_COUNTER_BUFFERS',
+ 'GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX',
+ 'GL_UNSIGNED_INT_ATOMIC_COUNTER',
+ 'GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT',
+ 'GL_ELEMENT_ARRAY_BARRIER_BIT',
+ 'GL_UNIFORM_BARRIER_BIT',
+ 'GL_TEXTURE_FETCH_BARRIER_BIT',
+ 'GL_SHADER_IMAGE_ACCESS_BARRIER_BIT',
+ 'GL_COMMAND_BARRIER_BIT',
+ 'GL_PIXEL_BUFFER_BARRIER_BIT',
+ 'GL_TEXTURE_UPDATE_BARRIER_BIT',
+ 'GL_BUFFER_UPDATE_BARRIER_BIT',
+ 'GL_FRAMEBUFFER_BARRIER_BIT',
+ 'GL_TRANSFORM_FEEDBACK_BARRIER_BIT',
+ 'GL_ATOMIC_COUNTER_BARRIER_BIT',
+ 'GL_ALL_BARRIER_BITS',
+ 'GL_MAX_IMAGE_UNITS',
+ 'GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS',
+ 'GL_IMAGE_BINDING_NAME',
+ 'GL_IMAGE_BINDING_LEVEL',
+ 'GL_IMAGE_BINDING_LAYERED',
+ 'GL_IMAGE_BINDING_LAYER',
+ 'GL_IMAGE_BINDING_ACCESS',
+ 'GL_IMAGE_1D',
+ 'GL_IMAGE_2D',
+ 'GL_IMAGE_3D',
+ 'GL_IMAGE_2D_RECT',
+ 'GL_IMAGE_CUBE',
+ 'GL_IMAGE_BUFFER',
+ 'GL_IMAGE_1D_ARRAY',
+ 'GL_IMAGE_2D_ARRAY',
+ 'GL_IMAGE_CUBE_MAP_ARRAY',
+ 'GL_IMAGE_2D_MULTISAMPLE',
+ 'GL_IMAGE_2D_MULTISAMPLE_ARRAY',
+ 'GL_INT_IMAGE_1D',
+ 'GL_INT_IMAGE_2D',
+ 'GL_INT_IMAGE_3D',
+ 'GL_INT_IMAGE_2D_RECT',
+ 'GL_INT_IMAGE_CUBE',
+ 'GL_INT_IMAGE_BUFFER',
+ 'GL_INT_IMAGE_1D_ARRAY',
+ 'GL_INT_IMAGE_2D_ARRAY',
+ 'GL_INT_IMAGE_CUBE_MAP_ARRAY',
+ 'GL_INT_IMAGE_2D_MULTISAMPLE',
+ 'GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY',
+ 'GL_UNSIGNED_INT_IMAGE_1D',
+ 'GL_UNSIGNED_INT_IMAGE_2D',
+ 'GL_UNSIGNED_INT_IMAGE_3D',
+ 'GL_UNSIGNED_INT_IMAGE_2D_RECT',
+ 'GL_UNSIGNED_INT_IMAGE_CUBE',
+ 'GL_UNSIGNED_INT_IMAGE_BUFFER',
+ 'GL_UNSIGNED_INT_IMAGE_1D_ARRAY',
+ 'GL_UNSIGNED_INT_IMAGE_2D_ARRAY',
+ 'GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY',
+ 'GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE',
+ 'GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY',
+ 'GL_MAX_IMAGE_SAMPLES',
+ 'GL_IMAGE_BINDING_FORMAT',
+ 'GL_IMAGE_FORMAT_COMPATIBILITY_TYPE',
+ 'GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE',
+ 'GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS',
+ 'GL_MAX_VERTEX_IMAGE_UNIFORMS',
+ 'GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS',
+ 'GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS',
+ 'GL_MAX_GEOMETRY_IMAGE_UNIFORMS',
+ 'GL_MAX_FRAGMENT_IMAGE_UNIFORMS',
+ 'GL_MAX_COMBINED_IMAGE_UNIFORMS',
+ 'GL_COMPRESSED_RGBA_BPTC_UNORM',
+ 'GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM',
+ 'GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT',
+ 'GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT',
+ 'GL_TEXTURE_IMMUTABLE_FORMAT',
+ 'GL_NUM_SHADING_LANGUAGE_VERSIONS',
+ 'GL_VERTEX_ATTRIB_ARRAY_LONG',
+ 'GL_COMPRESSED_RGB8_ETC2',
+ 'GL_COMPRESSED_SRGB8_ETC2',
+ 'GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2',
+ 'GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2',
+ 'GL_COMPRESSED_RGBA8_ETC2_EAC',
+ 'GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC',
+ 'GL_COMPRESSED_R11_EAC',
+ 'GL_COMPRESSED_SIGNED_R11_EAC',
+ 'GL_COMPRESSED_RG11_EAC',
+ 'GL_COMPRESSED_SIGNED_RG11_EAC',
+ 'GL_PRIMITIVE_RESTART_FIXED_INDEX',
+ 'GL_ANY_SAMPLES_PASSED_CONSERVATIVE',
+ 'GL_MAX_ELEMENT_INDEX',
+ 'GL_COMPUTE_SHADER',
+ 'GL_MAX_COMPUTE_UNIFORM_BLOCKS',
+ 'GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS',
+ 'GL_MAX_COMPUTE_IMAGE_UNIFORMS',
+ 'GL_MAX_COMPUTE_SHARED_MEMORY_SIZE',
+ 'GL_MAX_COMPUTE_UNIFORM_COMPONENTS',
+ 'GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_COMPUTE_ATOMIC_COUNTERS',
+ 'GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS',
+ 'GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS',
+ 'GL_MAX_COMPUTE_WORK_GROUP_COUNT',
+ 'GL_MAX_COMPUTE_WORK_GROUP_SIZE',
+ 'GL_COMPUTE_WORK_GROUP_SIZE',
+ 'GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER',
+ 'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER',
+ 'GL_DISPATCH_INDIRECT_BUFFER',
+ 'GL_DISPATCH_INDIRECT_BUFFER_BINDING',
+ 'GL_COMPUTE_SHADER_BIT',
+ 'GL_DEBUG_OUTPUT_SYNCHRONOUS',
+ 'GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH',
+ 'GL_DEBUG_CALLBACK_FUNCTION',
+ 'GL_DEBUG_CALLBACK_USER_PARAM',
+ 'GL_DEBUG_SOURCE_API',
+ 'GL_DEBUG_SOURCE_WINDOW_SYSTEM',
+ 'GL_DEBUG_SOURCE_SHADER_COMPILER',
+ 'GL_DEBUG_SOURCE_THIRD_PARTY',
+ 'GL_DEBUG_SOURCE_APPLICATION',
+ 'GL_DEBUG_SOURCE_OTHER',
+ 'GL_DEBUG_TYPE_ERROR',
+ 'GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR',
+ 'GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR',
+ 'GL_DEBUG_TYPE_PORTABILITY',
+ 'GL_DEBUG_TYPE_PERFORMANCE',
+ 'GL_DEBUG_TYPE_OTHER',
+ 'GL_MAX_DEBUG_MESSAGE_LENGTH',
+ 'GL_MAX_DEBUG_LOGGED_MESSAGES',
+ 'GL_DEBUG_LOGGED_MESSAGES',
+ 'GL_DEBUG_SEVERITY_HIGH',
+ 'GL_DEBUG_SEVERITY_MEDIUM',
+ 'GL_DEBUG_SEVERITY_LOW',
+ 'GL_DEBUG_TYPE_MARKER',
+ 'GL_DEBUG_TYPE_PUSH_GROUP',
+ 'GL_DEBUG_TYPE_POP_GROUP',
+ 'GL_DEBUG_SEVERITY_NOTIFICATION',
+ 'GL_MAX_DEBUG_GROUP_STACK_DEPTH',
+ 'GL_DEBUG_GROUP_STACK_DEPTH',
+ 'GL_BUFFER',
+ 'GL_SHADER',
+ 'GL_PROGRAM',
+ 'GL_VERTEX_ARRAY',
+ 'GL_QUERY',
+ 'GL_PROGRAM_PIPELINE',
+ 'GL_SAMPLER',
+ 'GL_MAX_LABEL_LENGTH',
+ 'GL_DEBUG_OUTPUT',
+ 'GL_CONTEXT_FLAG_DEBUG_BIT',
+ 'GL_MAX_UNIFORM_LOCATIONS',
+ 'GL_FRAMEBUFFER_DEFAULT_WIDTH',
+ 'GL_FRAMEBUFFER_DEFAULT_HEIGHT',
+ 'GL_FRAMEBUFFER_DEFAULT_LAYERS',
+ 'GL_FRAMEBUFFER_DEFAULT_SAMPLES',
+ 'GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS',
+ 'GL_MAX_FRAMEBUFFER_WIDTH',
+ 'GL_MAX_FRAMEBUFFER_HEIGHT',
+ 'GL_MAX_FRAMEBUFFER_LAYERS',
+ 'GL_MAX_FRAMEBUFFER_SAMPLES',
+ 'GL_INTERNALFORMAT_SUPPORTED',
+ 'GL_INTERNALFORMAT_PREFERRED',
+ 'GL_INTERNALFORMAT_RED_SIZE',
+ 'GL_INTERNALFORMAT_GREEN_SIZE',
+ 'GL_INTERNALFORMAT_BLUE_SIZE',
+ 'GL_INTERNALFORMAT_ALPHA_SIZE',
+ 'GL_INTERNALFORMAT_DEPTH_SIZE',
+ 'GL_INTERNALFORMAT_STENCIL_SIZE',
+ 'GL_INTERNALFORMAT_SHARED_SIZE',
+ 'GL_INTERNALFORMAT_RED_TYPE',
+ 'GL_INTERNALFORMAT_GREEN_TYPE',
+ 'GL_INTERNALFORMAT_BLUE_TYPE',
+ 'GL_INTERNALFORMAT_ALPHA_TYPE',
+ 'GL_INTERNALFORMAT_DEPTH_TYPE',
+ 'GL_INTERNALFORMAT_STENCIL_TYPE',
+ 'GL_MAX_WIDTH',
+ 'GL_MAX_HEIGHT',
+ 'GL_MAX_DEPTH',
+ 'GL_MAX_LAYERS',
+ 'GL_MAX_COMBINED_DIMENSIONS',
+ 'GL_COLOR_COMPONENTS',
+ 'GL_DEPTH_COMPONENTS',
+ 'GL_STENCIL_COMPONENTS',
+ 'GL_COLOR_RENDERABLE',
+ 'GL_DEPTH_RENDERABLE',
+ 'GL_STENCIL_RENDERABLE',
+ 'GL_FRAMEBUFFER_RENDERABLE',
+ 'GL_FRAMEBUFFER_RENDERABLE_LAYERED',
+ 'GL_FRAMEBUFFER_BLEND',
+ 'GL_READ_PIXELS',
+ 'GL_READ_PIXELS_FORMAT',
+ 'GL_READ_PIXELS_TYPE',
+ 'GL_TEXTURE_IMAGE_FORMAT',
+ 'GL_TEXTURE_IMAGE_TYPE',
+ 'GL_GET_TEXTURE_IMAGE_FORMAT',
+ 'GL_GET_TEXTURE_IMAGE_TYPE',
+ 'GL_MIPMAP',
+ 'GL_MANUAL_GENERATE_MIPMAP',
+ 'GL_AUTO_GENERATE_MIPMAP',
+ 'GL_COLOR_ENCODING',
+ 'GL_SRGB_READ',
+ 'GL_SRGB_WRITE',
+ 'GL_FILTER',
+ 'GL_VERTEX_TEXTURE',
+ 'GL_TESS_CONTROL_TEXTURE',
+ 'GL_TESS_EVALUATION_TEXTURE',
+ 'GL_GEOMETRY_TEXTURE',
+ 'GL_FRAGMENT_TEXTURE',
+ 'GL_COMPUTE_TEXTURE',
+ 'GL_TEXTURE_SHADOW',
+ 'GL_TEXTURE_GATHER',
+ 'GL_TEXTURE_GATHER_SHADOW',
+ 'GL_SHADER_IMAGE_LOAD',
+ 'GL_SHADER_IMAGE_STORE',
+ 'GL_SHADER_IMAGE_ATOMIC',
+ 'GL_IMAGE_TEXEL_SIZE',
+ 'GL_IMAGE_COMPATIBILITY_CLASS',
+ 'GL_IMAGE_PIXEL_FORMAT',
+ 'GL_IMAGE_PIXEL_TYPE',
+ 'GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST',
+ 'GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST',
+ 'GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE',
+ 'GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE',
+ 'GL_TEXTURE_COMPRESSED_BLOCK_WIDTH',
+ 'GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT',
+ 'GL_TEXTURE_COMPRESSED_BLOCK_SIZE',
+ 'GL_CLEAR_BUFFER',
+ 'GL_TEXTURE_VIEW',
+ 'GL_VIEW_COMPATIBILITY_CLASS',
+ 'GL_FULL_SUPPORT',
+ 'GL_CAVEAT_SUPPORT',
+ 'GL_IMAGE_CLASS_4_X_32',
+ 'GL_IMAGE_CLASS_2_X_32',
+ 'GL_IMAGE_CLASS_1_X_32',
+ 'GL_IMAGE_CLASS_4_X_16',
+ 'GL_IMAGE_CLASS_2_X_16',
+ 'GL_IMAGE_CLASS_1_X_16',
+ 'GL_IMAGE_CLASS_4_X_8',
+ 'GL_IMAGE_CLASS_2_X_8',
+ 'GL_IMAGE_CLASS_1_X_8',
+ 'GL_IMAGE_CLASS_11_11_10',
+ 'GL_IMAGE_CLASS_10_10_10_2',
+ 'GL_VIEW_CLASS_128_BITS',
+ 'GL_VIEW_CLASS_96_BITS',
+ 'GL_VIEW_CLASS_64_BITS',
+ 'GL_VIEW_CLASS_48_BITS',
+ 'GL_VIEW_CLASS_32_BITS',
+ 'GL_VIEW_CLASS_24_BITS',
+ 'GL_VIEW_CLASS_16_BITS',
+ 'GL_VIEW_CLASS_8_BITS',
+ 'GL_VIEW_CLASS_S3TC_DXT1_RGB',
+ 'GL_VIEW_CLASS_S3TC_DXT1_RGBA',
+ 'GL_VIEW_CLASS_S3TC_DXT3_RGBA',
+ 'GL_VIEW_CLASS_S3TC_DXT5_RGBA',
+ 'GL_VIEW_CLASS_RGTC1_RED',
+ 'GL_VIEW_CLASS_RGTC2_RG',
+ 'GL_VIEW_CLASS_BPTC_UNORM',
+ 'GL_VIEW_CLASS_BPTC_FLOAT',
+ 'GL_UNIFORM',
+ 'GL_UNIFORM_BLOCK',
+ 'GL_PROGRAM_INPUT',
+ 'GL_PROGRAM_OUTPUT',
+ 'GL_BUFFER_VARIABLE',
+ 'GL_SHADER_STORAGE_BLOCK',
+ 'GL_VERTEX_SUBROUTINE',
+ 'GL_TESS_CONTROL_SUBROUTINE',
+ 'GL_TESS_EVALUATION_SUBROUTINE',
+ 'GL_GEOMETRY_SUBROUTINE',
+ 'GL_FRAGMENT_SUBROUTINE',
+ 'GL_COMPUTE_SUBROUTINE',
+ 'GL_VERTEX_SUBROUTINE_UNIFORM',
+ 'GL_TESS_CONTROL_SUBROUTINE_UNIFORM',
+ 'GL_TESS_EVALUATION_SUBROUTINE_UNIFORM',
+ 'GL_GEOMETRY_SUBROUTINE_UNIFORM',
+ 'GL_FRAGMENT_SUBROUTINE_UNIFORM',
+ 'GL_COMPUTE_SUBROUTINE_UNIFORM',
+ 'GL_TRANSFORM_FEEDBACK_VARYING',
+ 'GL_ACTIVE_RESOURCES',
+ 'GL_MAX_NAME_LENGTH',
+ 'GL_MAX_NUM_ACTIVE_VARIABLES',
+ 'GL_MAX_NUM_COMPATIBLE_SUBROUTINES',
+ 'GL_NAME_LENGTH',
+ 'GL_TYPE',
+ 'GL_ARRAY_SIZE',
+ 'GL_OFFSET',
+ 'GL_BLOCK_INDEX',
+ 'GL_ARRAY_STRIDE',
+ 'GL_MATRIX_STRIDE',
+ 'GL_IS_ROW_MAJOR',
+ 'GL_ATOMIC_COUNTER_BUFFER_INDEX',
+ 'GL_BUFFER_BINDING',
+ 'GL_BUFFER_DATA_SIZE',
+ 'GL_NUM_ACTIVE_VARIABLES',
+ 'GL_ACTIVE_VARIABLES',
+ 'GL_REFERENCED_BY_VERTEX_SHADER',
+ 'GL_REFERENCED_BY_TESS_CONTROL_SHADER',
+ 'GL_REFERENCED_BY_TESS_EVALUATION_SHADER',
+ 'GL_REFERENCED_BY_GEOMETRY_SHADER',
+ 'GL_REFERENCED_BY_FRAGMENT_SHADER',
+ 'GL_REFERENCED_BY_COMPUTE_SHADER',
+ 'GL_TOP_LEVEL_ARRAY_SIZE',
+ 'GL_TOP_LEVEL_ARRAY_STRIDE',
+ 'GL_LOCATION',
+ 'GL_LOCATION_INDEX',
+ 'GL_IS_PER_PATCH',
+ 'GL_SHADER_STORAGE_BUFFER',
+ 'GL_SHADER_STORAGE_BUFFER_BINDING',
+ 'GL_SHADER_STORAGE_BUFFER_START',
+ 'GL_SHADER_STORAGE_BUFFER_SIZE',
+ 'GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS',
+ 'GL_MAX_SHADER_STORAGE_BLOCK_SIZE',
+ 'GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT',
+ 'GL_SHADER_STORAGE_BARRIER_BIT',
+ 'GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES',
+ 'GL_DEPTH_STENCIL_TEXTURE_MODE',
+ 'GL_TEXTURE_BUFFER_OFFSET',
+ 'GL_TEXTURE_BUFFER_SIZE',
+ 'GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT',
+ 'GL_TEXTURE_VIEW_MIN_LEVEL',
+ 'GL_TEXTURE_VIEW_NUM_LEVELS',
+ 'GL_TEXTURE_VIEW_MIN_LAYER',
+ 'GL_TEXTURE_VIEW_NUM_LAYERS',
+ 'GL_TEXTURE_IMMUTABLE_LEVELS',
+ 'GL_VERTEX_ATTRIB_BINDING',
+ 'GL_VERTEX_ATTRIB_RELATIVE_OFFSET',
+ 'GL_VERTEX_BINDING_DIVISOR',
+ 'GL_VERTEX_BINDING_OFFSET',
+ 'GL_VERTEX_BINDING_STRIDE',
+ 'GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET',
+ 'GL_MAX_VERTEX_ATTRIB_BINDINGS',
+ 'GL_VERTEX_BINDING_BUFFER',
+ 'GL_DISPLAY_LIST',
+ 'GL_STACK_UNDERFLOW',
+ 'GL_STACK_OVERFLOW',
+ 'GL_MAX_VERTEX_ATTRIB_STRIDE',
+ 'GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED',
+ 'GL_TEXTURE_BUFFER_BINDING',
+ 'GL_MAP_PERSISTENT_BIT',
+ 'GL_MAP_COHERENT_BIT',
+ 'GL_DYNAMIC_STORAGE_BIT',
+ 'GL_CLIENT_STORAGE_BIT',
+ 'GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT',
+ 'GL_BUFFER_IMMUTABLE_STORAGE',
+ 'GL_BUFFER_STORAGE_FLAGS',
+ 'GL_CLEAR_TEXTURE',
+ 'GL_LOCATION_COMPONENT',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_INDEX',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE',
+ 'GL_QUERY_BUFFER',
+ 'GL_QUERY_BUFFER_BARRIER_BIT',
+ 'GL_QUERY_BUFFER_BINDING',
+ 'GL_QUERY_RESULT_NO_WAIT',
+ 'GL_MIRROR_CLAMP_TO_EDGE',
+ 'GL_CONTEXT_LOST',
+ 'GL_NEGATIVE_ONE_TO_ONE',
+ 'GL_ZERO_TO_ONE',
+ 'GL_CLIP_ORIGIN',
+ 'GL_CLIP_DEPTH_MODE',
+ 'GL_QUERY_WAIT_INVERTED',
+ 'GL_QUERY_NO_WAIT_INVERTED',
+ 'GL_QUERY_BY_REGION_WAIT_INVERTED',
+ 'GL_QUERY_BY_REGION_NO_WAIT_INVERTED',
+ 'GL_MAX_CULL_DISTANCES',
+ 'GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES',
+ 'GL_TEXTURE_TARGET',
+ 'GL_QUERY_TARGET',
+ 'GL_GUILTY_CONTEXT_RESET',
+ 'GL_INNOCENT_CONTEXT_RESET',
+ 'GL_UNKNOWN_CONTEXT_RESET',
+ 'GL_RESET_NOTIFICATION_STRATEGY',
+ 'GL_LOSE_CONTEXT_ON_RESET',
+ 'GL_NO_RESET_NOTIFICATION',
+ 'GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT',
+ 'GL_COLOR_TABLE',
+ 'GL_POST_CONVOLUTION_COLOR_TABLE',
+ 'GL_POST_COLOR_MATRIX_COLOR_TABLE',
+ 'GL_PROXY_COLOR_TABLE',
+ 'GL_PROXY_POST_CONVOLUTION_COLOR_TABLE',
+ 'GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE',
+ 'GL_CONVOLUTION_1D',
+ 'GL_CONVOLUTION_2D',
+ 'GL_SEPARABLE_2D',
+ 'GL_HISTOGRAM',
+ 'GL_PROXY_HISTOGRAM',
+ 'GL_MINMAX',
+ 'GL_CONTEXT_RELEASE_BEHAVIOR',
+ 'GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH',
+ 'GL_SHADER_BINARY_FORMAT_SPIR_V',
+ 'GL_SPIR_V_BINARY',
+ 'GL_PARAMETER_BUFFER',
+ 'GL_PARAMETER_BUFFER_BINDING',
+ 'GL_CONTEXT_FLAG_NO_ERROR_BIT',
+ 'GL_VERTICES_SUBMITTED',
+ 'GL_PRIMITIVES_SUBMITTED',
+ 'GL_VERTEX_SHADER_INVOCATIONS',
+ 'GL_TESS_CONTROL_SHADER_PATCHES',
+ 'GL_TESS_EVALUATION_SHADER_INVOCATIONS',
+ 'GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED',
+ 'GL_FRAGMENT_SHADER_INVOCATIONS',
+ 'GL_COMPUTE_SHADER_INVOCATIONS',
+ 'GL_CLIPPING_INPUT_PRIMITIVES',
+ 'GL_CLIPPING_OUTPUT_PRIMITIVES',
+ 'GL_POLYGON_OFFSET_CLAMP',
+ 'GL_SPIR_V_EXTENSIONS',
+ 'GL_NUM_SPIR_V_EXTENSIONS',
+ 'GL_TEXTURE_MAX_ANISOTROPY',
+ 'GL_MAX_TEXTURE_MAX_ANISOTROPY',
+ 'GL_TRANSFORM_FEEDBACK_OVERFLOW',
+ 'GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW',
+ 'GL_MULTISAMPLE_ARB',
+ 'GL_SAMPLE_ALPHA_TO_COVERAGE_ARB',
+ 'GL_SAMPLE_ALPHA_TO_ONE_ARB',
+ 'GL_SAMPLE_COVERAGE_ARB',
+ 'GL_SAMPLE_BUFFERS_ARB',
+ 'GL_SAMPLES_ARB',
+ 'GL_SAMPLE_COVERAGE_VALUE_ARB',
+ 'GL_SAMPLE_COVERAGE_INVERT_ARB',
+ 'GL_MULTISAMPLE_BIT_ARB',
+ 'GL_COMPRESSED_RGB_S3TC_DXT1_EXT',
+ 'GL_COMPRESSED_RGBA_S3TC_DXT1_EXT',
+ 'GL_COMPRESSED_RGBA_S3TC_DXT3_EXT',
+ 'GL_COMPRESSED_RGBA_S3TC_DXT5_EXT',
+ 'GL_INVALID_FRAMEBUFFER_OPERATION_EXT',
+ 'GL_MAX_RENDERBUFFER_SIZE_EXT',
+ 'GL_FRAMEBUFFER_BINDING_EXT',
+ 'GL_RENDERBUFFER_BINDING_EXT',
+ 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT',
+ 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT',
+ 'GL_FRAMEBUFFER_COMPLETE_EXT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT',
+ 'GL_FRAMEBUFFER_UNSUPPORTED_EXT',
+ 'GL_MAX_COLOR_ATTACHMENTS_EXT',
+ 'GL_COLOR_ATTACHMENT0_EXT',
+ 'GL_COLOR_ATTACHMENT1_EXT',
+ 'GL_COLOR_ATTACHMENT2_EXT',
+ 'GL_COLOR_ATTACHMENT3_EXT',
+ 'GL_COLOR_ATTACHMENT4_EXT',
+ 'GL_COLOR_ATTACHMENT5_EXT',
+ 'GL_COLOR_ATTACHMENT6_EXT',
+ 'GL_COLOR_ATTACHMENT7_EXT',
+ 'GL_COLOR_ATTACHMENT8_EXT',
+ 'GL_COLOR_ATTACHMENT9_EXT',
+ 'GL_COLOR_ATTACHMENT10_EXT',
+ 'GL_COLOR_ATTACHMENT11_EXT',
+ 'GL_COLOR_ATTACHMENT12_EXT',
+ 'GL_COLOR_ATTACHMENT13_EXT',
+ 'GL_COLOR_ATTACHMENT14_EXT',
+ 'GL_COLOR_ATTACHMENT15_EXT',
+ 'GL_DEPTH_ATTACHMENT_EXT',
+ 'GL_STENCIL_ATTACHMENT_EXT',
+ 'GL_FRAMEBUFFER_EXT',
+ 'GL_RENDERBUFFER_EXT',
+ 'GL_RENDERBUFFER_WIDTH_EXT',
+ 'GL_RENDERBUFFER_HEIGHT_EXT',
+ 'GL_RENDERBUFFER_INTERNAL_FORMAT_EXT',
+ 'GL_STENCIL_INDEX1_EXT',
+ 'GL_STENCIL_INDEX4_EXT',
+ 'GL_STENCIL_INDEX8_EXT',
+ 'GL_STENCIL_INDEX16_EXT',
+ 'GL_RENDERBUFFER_RED_SIZE_EXT',
+ 'GL_RENDERBUFFER_GREEN_SIZE_EXT',
+ 'GL_RENDERBUFFER_BLUE_SIZE_EXT',
+ 'GL_RENDERBUFFER_ALPHA_SIZE_EXT',
+ 'GL_RENDERBUFFER_DEPTH_SIZE_EXT',
+ 'GL_RENDERBUFFER_STENCIL_SIZE_EXT',
+ 'glActiveShaderProgram',
+ 'glActiveTexture',
+ 'glAttachShader',
+ 'glBeginConditionalRender',
+ 'glBeginQuery',
+ 'glBeginQueryIndexed',
+ 'glBeginTransformFeedback',
+ 'glBindAttribLocation',
+ 'glBindBuffer',
+ 'glBindBufferBase',
+ 'glBindBufferRange',
+ 'glBindBuffersBase',
+ 'glBindBuffersRange',
+ 'glBindFragDataLocation',
+ 'glBindFragDataLocationIndexed',
+ 'glBindFramebuffer',
+ 'glBindFramebufferEXT',
+ 'glBindImageTexture',
+ 'glBindImageTextures',
+ 'glBindProgramPipeline',
+ 'glBindRenderbuffer',
+ 'glBindRenderbufferEXT',
+ 'glBindSampler',
+ 'glBindSamplers',
+ 'glBindTexture',
+ 'glBindTextureUnit',
+ 'glBindTextures',
+ 'glBindTransformFeedback',
+ 'glBindVertexArray',
+ 'glBindVertexBuffer',
+ 'glBindVertexBuffers',
+ 'glBlendColor',
+ 'glBlendEquation',
+ 'glBlendEquationSeparate',
+ 'glBlendEquationSeparatei',
+ 'glBlendEquationi',
+ 'glBlendFunc',
+ 'glBlendFuncSeparate',
+ 'glBlendFuncSeparatei',
+ 'glBlendFunci',
+ 'glBlitFramebuffer',
+ 'glBlitNamedFramebuffer',
+ 'glBufferData',
+ 'glBufferStorage',
+ 'glBufferSubData',
+ 'glCheckFramebufferStatus',
+ 'glCheckFramebufferStatusEXT',
+ 'glCheckNamedFramebufferStatus',
+ 'glClampColor',
+ 'glClear',
+ 'glClearBufferData',
+ 'glClearBufferSubData',
+ 'glClearBufferfi',
+ 'glClearBufferfv',
+ 'glClearBufferiv',
+ 'glClearBufferuiv',
+ 'glClearColor',
+ 'glClearDepth',
+ 'glClearDepthf',
+ 'glClearNamedBufferData',
+ 'glClearNamedBufferSubData',
+ 'glClearNamedFramebufferfi',
+ 'glClearNamedFramebufferfv',
+ 'glClearNamedFramebufferiv',
+ 'glClearNamedFramebufferuiv',
+ 'glClearStencil',
+ 'glClearTexImage',
+ 'glClearTexSubImage',
+ 'glClientWaitSync',
+ 'glClipControl',
+ 'glColorMask',
+ 'glColorMaski',
+ 'glColorP3ui',
+ 'glColorP3uiv',
+ 'glColorP4ui',
+ 'glColorP4uiv',
+ 'glCompileShader',
+ 'glCompressedTexImage1D',
+ 'glCompressedTexImage2D',
+ 'glCompressedTexImage3D',
+ 'glCompressedTexSubImage1D',
+ 'glCompressedTexSubImage2D',
+ 'glCompressedTexSubImage3D',
+ 'glCompressedTextureSubImage1D',
+ 'glCompressedTextureSubImage2D',
+ 'glCompressedTextureSubImage3D',
+ 'glCopyBufferSubData',
+ 'glCopyImageSubData',
+ 'glCopyNamedBufferSubData',
+ 'glCopyTexImage1D',
+ 'glCopyTexImage2D',
+ 'glCopyTexSubImage1D',
+ 'glCopyTexSubImage2D',
+ 'glCopyTexSubImage3D',
+ 'glCopyTextureSubImage1D',
+ 'glCopyTextureSubImage2D',
+ 'glCopyTextureSubImage3D',
+ 'glCreateBuffers',
+ 'glCreateFramebuffers',
+ 'glCreateProgram',
+ 'glCreateProgramPipelines',
+ 'glCreateQueries',
+ 'glCreateRenderbuffers',
+ 'glCreateSamplers',
+ 'glCreateShader',
+ 'glCreateShaderProgramv',
+ 'glCreateTextures',
+ 'glCreateTransformFeedbacks',
+ 'glCreateVertexArrays',
+ 'glCullFace',
+ 'glDebugMessageCallback',
+ 'glDebugMessageControl',
+ 'glDebugMessageInsert',
+ 'glDeleteBuffers',
+ 'glDeleteFramebuffers',
+ 'glDeleteFramebuffersEXT',
+ 'glDeleteProgram',
+ 'glDeleteProgramPipelines',
+ 'glDeleteQueries',
+ 'glDeleteRenderbuffers',
+ 'glDeleteRenderbuffersEXT',
+ 'glDeleteSamplers',
+ 'glDeleteShader',
+ 'glDeleteSync',
+ 'glDeleteTextures',
+ 'glDeleteTransformFeedbacks',
+ 'glDeleteVertexArrays',
+ 'glDepthFunc',
+ 'glDepthMask',
+ 'glDepthRange',
+ 'glDepthRangeArrayv',
+ 'glDepthRangeIndexed',
+ 'glDepthRangef',
+ 'glDetachShader',
+ 'glDisable',
+ 'glDisableVertexArrayAttrib',
+ 'glDisableVertexAttribArray',
+ 'glDisablei',
+ 'glDispatchCompute',
+ 'glDispatchComputeIndirect',
+ 'glDrawArrays',
+ 'glDrawArraysIndirect',
+ 'glDrawArraysInstanced',
+ 'glDrawArraysInstancedBaseInstance',
+ 'glDrawBuffer',
+ 'glDrawBuffers',
+ 'glDrawElements',
+ 'glDrawElementsBaseVertex',
+ 'glDrawElementsIndirect',
+ 'glDrawElementsInstanced',
+ 'glDrawElementsInstancedBaseInstance',
+ 'glDrawElementsInstancedBaseVertex',
+ 'glDrawElementsInstancedBaseVertexBaseInstance',
+ 'glDrawRangeElements',
+ 'glDrawRangeElementsBaseVertex',
+ 'glDrawTransformFeedback',
+ 'glDrawTransformFeedbackInstanced',
+ 'glDrawTransformFeedbackStream',
+ 'glDrawTransformFeedbackStreamInstanced',
+ 'glEnable',
+ 'glEnableVertexArrayAttrib',
+ 'glEnableVertexAttribArray',
+ 'glEnablei',
+ 'glEndConditionalRender',
+ 'glEndQuery',
+ 'glEndQueryIndexed',
+ 'glEndTransformFeedback',
+ 'glFenceSync',
+ 'glFinish',
+ 'glFlush',
+ 'glFlushMappedBufferRange',
+ 'glFlushMappedNamedBufferRange',
+ 'glFramebufferParameteri',
+ 'glFramebufferRenderbuffer',
+ 'glFramebufferRenderbufferEXT',
+ 'glFramebufferTexture',
+ 'glFramebufferTexture1D',
+ 'glFramebufferTexture1DEXT',
+ 'glFramebufferTexture2D',
+ 'glFramebufferTexture2DEXT',
+ 'glFramebufferTexture3D',
+ 'glFramebufferTexture3DEXT',
+ 'glFramebufferTextureLayer',
+ 'glFrontFace',
+ 'glGenBuffers',
+ 'glGenFramebuffers',
+ 'glGenFramebuffersEXT',
+ 'glGenProgramPipelines',
+ 'glGenQueries',
+ 'glGenRenderbuffers',
+ 'glGenRenderbuffersEXT',
+ 'glGenSamplers',
+ 'glGenTextures',
+ 'glGenTransformFeedbacks',
+ 'glGenVertexArrays',
+ 'glGenerateMipmap',
+ 'glGenerateMipmapEXT',
+ 'glGenerateTextureMipmap',
+ 'glGetActiveAtomicCounterBufferiv',
+ 'glGetActiveAttrib',
+ 'glGetActiveSubroutineName',
+ 'glGetActiveSubroutineUniformName',
+ 'glGetActiveSubroutineUniformiv',
+ 'glGetActiveUniform',
+ 'glGetActiveUniformBlockName',
+ 'glGetActiveUniformBlockiv',
+ 'glGetActiveUniformName',
+ 'glGetActiveUniformsiv',
+ 'glGetAttachedShaders',
+ 'glGetAttribLocation',
+ 'glGetBooleani_v',
+ 'glGetBooleanv',
+ 'glGetBufferParameteri64v',
+ 'glGetBufferParameteriv',
+ 'glGetBufferPointerv',
+ 'glGetBufferSubData',
+ 'glGetCompressedTexImage',
+ 'glGetCompressedTextureImage',
+ 'glGetCompressedTextureSubImage',
+ 'glGetDebugMessageLog',
+ 'glGetDoublei_v',
+ 'glGetDoublev',
+ 'glGetError',
+ 'glGetFloati_v',
+ 'glGetFloatv',
+ 'glGetFragDataIndex',
+ 'glGetFragDataLocation',
+ 'glGetFramebufferAttachmentParameteriv',
+ 'glGetFramebufferAttachmentParameterivEXT',
+ 'glGetFramebufferParameteriv',
+ 'glGetGraphicsResetStatus',
+ 'glGetInteger64i_v',
+ 'glGetInteger64v',
+ 'glGetIntegeri_v',
+ 'glGetIntegerv',
+ 'glGetInternalformati64v',
+ 'glGetInternalformativ',
+ 'glGetMultisamplefv',
+ 'glGetNamedBufferParameteri64v',
+ 'glGetNamedBufferParameteriv',
+ 'glGetNamedBufferPointerv',
+ 'glGetNamedBufferSubData',
+ 'glGetNamedFramebufferAttachmentParameteriv',
+ 'glGetNamedFramebufferParameteriv',
+ 'glGetNamedRenderbufferParameteriv',
+ 'glGetObjectLabel',
+ 'glGetObjectPtrLabel',
+ 'glGetPointerv',
+ 'glGetProgramBinary',
+ 'glGetProgramInfoLog',
+ 'glGetProgramInterfaceiv',
+ 'glGetProgramPipelineInfoLog',
+ 'glGetProgramPipelineiv',
+ 'glGetProgramResourceIndex',
+ 'glGetProgramResourceLocation',
+ 'glGetProgramResourceLocationIndex',
+ 'glGetProgramResourceName',
+ 'glGetProgramResourceiv',
+ 'glGetProgramStageiv',
+ 'glGetProgramiv',
+ 'glGetQueryBufferObjecti64v',
+ 'glGetQueryBufferObjectiv',
+ 'glGetQueryBufferObjectui64v',
+ 'glGetQueryBufferObjectuiv',
+ 'glGetQueryIndexediv',
+ 'glGetQueryObjecti64v',
+ 'glGetQueryObjectiv',
+ 'glGetQueryObjectui64v',
+ 'glGetQueryObjectuiv',
+ 'glGetQueryiv',
+ 'glGetRenderbufferParameteriv',
+ 'glGetRenderbufferParameterivEXT',
+ 'glGetSamplerParameterIiv',
+ 'glGetSamplerParameterIuiv',
+ 'glGetSamplerParameterfv',
+ 'glGetSamplerParameteriv',
+ 'glGetShaderInfoLog',
+ 'glGetShaderPrecisionFormat',
+ 'glGetShaderSource',
+ 'glGetShaderiv',
+ 'glGetString',
+ 'glGetStringi',
+ 'glGetSubroutineIndex',
+ 'glGetSubroutineUniformLocation',
+ 'glGetSynciv',
+ 'glGetTexImage',
+ 'glGetTexLevelParameterfv',
+ 'glGetTexLevelParameteriv',
+ 'glGetTexParameterIiv',
+ 'glGetTexParameterIuiv',
+ 'glGetTexParameterfv',
+ 'glGetTexParameteriv',
+ 'glGetTextureImage',
+ 'glGetTextureLevelParameterfv',
+ 'glGetTextureLevelParameteriv',
+ 'glGetTextureParameterIiv',
+ 'glGetTextureParameterIuiv',
+ 'glGetTextureParameterfv',
+ 'glGetTextureParameteriv',
+ 'glGetTextureSubImage',
+ 'glGetTransformFeedbackVarying',
+ 'glGetTransformFeedbacki64_v',
+ 'glGetTransformFeedbacki_v',
+ 'glGetTransformFeedbackiv',
+ 'glGetUniformBlockIndex',
+ 'glGetUniformIndices',
+ 'glGetUniformLocation',
+ 'glGetUniformSubroutineuiv',
+ 'glGetUniformdv',
+ 'glGetUniformfv',
+ 'glGetUniformiv',
+ 'glGetUniformuiv',
+ 'glGetVertexArrayIndexed64iv',
+ 'glGetVertexArrayIndexediv',
+ 'glGetVertexArrayiv',
+ 'glGetVertexAttribIiv',
+ 'glGetVertexAttribIuiv',
+ 'glGetVertexAttribLdv',
+ 'glGetVertexAttribPointerv',
+ 'glGetVertexAttribdv',
+ 'glGetVertexAttribfv',
+ 'glGetVertexAttribiv',
+ 'glGetnColorTable',
+ 'glGetnCompressedTexImage',
+ 'glGetnConvolutionFilter',
+ 'glGetnHistogram',
+ 'glGetnMapdv',
+ 'glGetnMapfv',
+ 'glGetnMapiv',
+ 'glGetnMinmax',
+ 'glGetnPixelMapfv',
+ 'glGetnPixelMapuiv',
+ 'glGetnPixelMapusv',
+ 'glGetnPolygonStipple',
+ 'glGetnSeparableFilter',
+ 'glGetnTexImage',
+ 'glGetnUniformdv',
+ 'glGetnUniformfv',
+ 'glGetnUniformiv',
+ 'glGetnUniformuiv',
+ 'glHint',
+ 'glInvalidateBufferData',
+ 'glInvalidateBufferSubData',
+ 'glInvalidateFramebuffer',
+ 'glInvalidateNamedFramebufferData',
+ 'glInvalidateNamedFramebufferSubData',
+ 'glInvalidateSubFramebuffer',
+ 'glInvalidateTexImage',
+ 'glInvalidateTexSubImage',
+ 'glIsBuffer',
+ 'glIsEnabled',
+ 'glIsEnabledi',
+ 'glIsFramebuffer',
+ 'glIsFramebufferEXT',
+ 'glIsProgram',
+ 'glIsProgramPipeline',
+ 'glIsQuery',
+ 'glIsRenderbuffer',
+ 'glIsRenderbufferEXT',
+ 'glIsSampler',
+ 'glIsShader',
+ 'glIsSync',
+ 'glIsTexture',
+ 'glIsTransformFeedback',
+ 'glIsVertexArray',
+ 'glLineWidth',
+ 'glLinkProgram',
+ 'glLogicOp',
+ 'glMapBuffer',
+ 'glMapBufferRange',
+ 'glMapNamedBuffer',
+ 'glMapNamedBufferRange',
+ 'glMemoryBarrier',
+ 'glMemoryBarrierByRegion',
+ 'glMinSampleShading',
+ 'glMultiDrawArrays',
+ 'glMultiDrawArraysIndirect',
+ 'glMultiDrawArraysIndirectCount',
+ 'glMultiDrawElements',
+ 'glMultiDrawElementsBaseVertex',
+ 'glMultiDrawElementsIndirect',
+ 'glMultiDrawElementsIndirectCount',
+ 'glMultiTexCoordP1ui',
+ 'glMultiTexCoordP1uiv',
+ 'glMultiTexCoordP2ui',
+ 'glMultiTexCoordP2uiv',
+ 'glMultiTexCoordP3ui',
+ 'glMultiTexCoordP3uiv',
+ 'glMultiTexCoordP4ui',
+ 'glMultiTexCoordP4uiv',
+ 'glNamedBufferData',
+ 'glNamedBufferStorage',
+ 'glNamedBufferSubData',
+ 'glNamedFramebufferDrawBuffer',
+ 'glNamedFramebufferDrawBuffers',
+ 'glNamedFramebufferParameteri',
+ 'glNamedFramebufferReadBuffer',
+ 'glNamedFramebufferRenderbuffer',
+ 'glNamedFramebufferTexture',
+ 'glNamedFramebufferTextureLayer',
+ 'glNamedRenderbufferStorage',
+ 'glNamedRenderbufferStorageMultisample',
+ 'glNormalP3ui',
+ 'glNormalP3uiv',
+ 'glObjectLabel',
+ 'glObjectPtrLabel',
+ 'glPatchParameterfv',
+ 'glPatchParameteri',
+ 'glPauseTransformFeedback',
+ 'glPixelStoref',
+ 'glPixelStorei',
+ 'glPointParameterf',
+ 'glPointParameterfv',
+ 'glPointParameteri',
+ 'glPointParameteriv',
+ 'glPointSize',
+ 'glPolygonMode',
+ 'glPolygonOffset',
+ 'glPolygonOffsetClamp',
+ 'glPopDebugGroup',
+ 'glPrimitiveRestartIndex',
+ 'glProgramBinary',
+ 'glProgramParameteri',
+ 'glProgramUniform1d',
+ 'glProgramUniform1dv',
+ 'glProgramUniform1f',
+ 'glProgramUniform1fv',
+ 'glProgramUniform1i',
+ 'glProgramUniform1iv',
+ 'glProgramUniform1ui',
+ 'glProgramUniform1uiv',
+ 'glProgramUniform2d',
+ 'glProgramUniform2dv',
+ 'glProgramUniform2f',
+ 'glProgramUniform2fv',
+ 'glProgramUniform2i',
+ 'glProgramUniform2iv',
+ 'glProgramUniform2ui',
+ 'glProgramUniform2uiv',
+ 'glProgramUniform3d',
+ 'glProgramUniform3dv',
+ 'glProgramUniform3f',
+ 'glProgramUniform3fv',
+ 'glProgramUniform3i',
+ 'glProgramUniform3iv',
+ 'glProgramUniform3ui',
+ 'glProgramUniform3uiv',
+ 'glProgramUniform4d',
+ 'glProgramUniform4dv',
+ 'glProgramUniform4f',
+ 'glProgramUniform4fv',
+ 'glProgramUniform4i',
+ 'glProgramUniform4iv',
+ 'glProgramUniform4ui',
+ 'glProgramUniform4uiv',
+ 'glProgramUniformMatrix2dv',
+ 'glProgramUniformMatrix2fv',
+ 'glProgramUniformMatrix2x3dv',
+ 'glProgramUniformMatrix2x3fv',
+ 'glProgramUniformMatrix2x4dv',
+ 'glProgramUniformMatrix2x4fv',
+ 'glProgramUniformMatrix3dv',
+ 'glProgramUniformMatrix3fv',
+ 'glProgramUniformMatrix3x2dv',
+ 'glProgramUniformMatrix3x2fv',
+ 'glProgramUniformMatrix3x4dv',
+ 'glProgramUniformMatrix3x4fv',
+ 'glProgramUniformMatrix4dv',
+ 'glProgramUniformMatrix4fv',
+ 'glProgramUniformMatrix4x2dv',
+ 'glProgramUniformMatrix4x2fv',
+ 'glProgramUniformMatrix4x3dv',
+ 'glProgramUniformMatrix4x3fv',
+ 'glProvokingVertex',
+ 'glPushDebugGroup',
+ 'glQueryCounter',
+ 'glReadBuffer',
+ 'glReadPixels',
+ 'glReadnPixels',
+ 'glReleaseShaderCompiler',
+ 'glRenderbufferStorage',
+ 'glRenderbufferStorageEXT',
+ 'glRenderbufferStorageMultisample',
+ 'glResumeTransformFeedback',
+ 'glSampleCoverage',
+ 'glSampleCoverageARB',
+ 'glSampleMaski',
+ 'glSamplerParameterIiv',
+ 'glSamplerParameterIuiv',
+ 'glSamplerParameterf',
+ 'glSamplerParameterfv',
+ 'glSamplerParameteri',
+ 'glSamplerParameteriv',
+ 'glScissor',
+ 'glScissorArrayv',
+ 'glScissorIndexed',
+ 'glScissorIndexedv',
+ 'glSecondaryColorP3ui',
+ 'glSecondaryColorP3uiv',
+ 'glShaderBinary',
+ 'glShaderSource',
+ 'glShaderStorageBlockBinding',
+ 'glSpecializeShader',
+ 'glStencilFunc',
+ 'glStencilFuncSeparate',
+ 'glStencilMask',
+ 'glStencilMaskSeparate',
+ 'glStencilOp',
+ 'glStencilOpSeparate',
+ 'glTexBuffer',
+ 'glTexBufferRange',
+ 'glTexCoordP1ui',
+ 'glTexCoordP1uiv',
+ 'glTexCoordP2ui',
+ 'glTexCoordP2uiv',
+ 'glTexCoordP3ui',
+ 'glTexCoordP3uiv',
+ 'glTexCoordP4ui',
+ 'glTexCoordP4uiv',
+ 'glTexImage1D',
+ 'glTexImage2D',
+ 'glTexImage2DMultisample',
+ 'glTexImage3D',
+ 'glTexImage3DMultisample',
+ 'glTexParameterIiv',
+ 'glTexParameterIuiv',
+ 'glTexParameterf',
+ 'glTexParameterfv',
+ 'glTexParameteri',
+ 'glTexParameteriv',
+ 'glTexStorage1D',
+ 'glTexStorage2D',
+ 'glTexStorage2DMultisample',
+ 'glTexStorage3D',
+ 'glTexStorage3DMultisample',
+ 'glTexSubImage1D',
+ 'glTexSubImage2D',
+ 'glTexSubImage3D',
+ 'glTextureBarrier',
+ 'glTextureBuffer',
+ 'glTextureBufferRange',
+ 'glTextureParameterIiv',
+ 'glTextureParameterIuiv',
+ 'glTextureParameterf',
+ 'glTextureParameterfv',
+ 'glTextureParameteri',
+ 'glTextureParameteriv',
+ 'glTextureStorage1D',
+ 'glTextureStorage2D',
+ 'glTextureStorage2DMultisample',
+ 'glTextureStorage3D',
+ 'glTextureStorage3DMultisample',
+ 'glTextureSubImage1D',
+ 'glTextureSubImage2D',
+ 'glTextureSubImage3D',
+ 'glTextureView',
+ 'glTransformFeedbackBufferBase',
+ 'glTransformFeedbackBufferRange',
+ 'glTransformFeedbackVaryings',
+ 'glUniform1d',
+ 'glUniform1dv',
+ 'glUniform1f',
+ 'glUniform1fv',
+ 'glUniform1i',
+ 'glUniform1iv',
+ 'glUniform1ui',
+ 'glUniform1uiv',
+ 'glUniform2d',
+ 'glUniform2dv',
+ 'glUniform2f',
+ 'glUniform2fv',
+ 'glUniform2i',
+ 'glUniform2iv',
+ 'glUniform2ui',
+ 'glUniform2uiv',
+ 'glUniform3d',
+ 'glUniform3dv',
+ 'glUniform3f',
+ 'glUniform3fv',
+ 'glUniform3i',
+ 'glUniform3iv',
+ 'glUniform3ui',
+ 'glUniform3uiv',
+ 'glUniform4d',
+ 'glUniform4dv',
+ 'glUniform4f',
+ 'glUniform4fv',
+ 'glUniform4i',
+ 'glUniform4iv',
+ 'glUniform4ui',
+ 'glUniform4uiv',
+ 'glUniformBlockBinding',
+ 'glUniformMatrix2dv',
+ 'glUniformMatrix2fv',
+ 'glUniformMatrix2x3dv',
+ 'glUniformMatrix2x3fv',
+ 'glUniformMatrix2x4dv',
+ 'glUniformMatrix2x4fv',
+ 'glUniformMatrix3dv',
+ 'glUniformMatrix3fv',
+ 'glUniformMatrix3x2dv',
+ 'glUniformMatrix3x2fv',
+ 'glUniformMatrix3x4dv',
+ 'glUniformMatrix3x4fv',
+ 'glUniformMatrix4dv',
+ 'glUniformMatrix4fv',
+ 'glUniformMatrix4x2dv',
+ 'glUniformMatrix4x2fv',
+ 'glUniformMatrix4x3dv',
+ 'glUniformMatrix4x3fv',
+ 'glUniformSubroutinesuiv',
+ 'glUnmapBuffer',
+ 'glUnmapNamedBuffer',
+ 'glUseProgram',
+ 'glUseProgramStages',
+ 'glValidateProgram',
+ 'glValidateProgramPipeline',
+ 'glVertexArrayAttribBinding',
+ 'glVertexArrayAttribFormat',
+ 'glVertexArrayAttribIFormat',
+ 'glVertexArrayAttribLFormat',
+ 'glVertexArrayBindingDivisor',
+ 'glVertexArrayElementBuffer',
+ 'glVertexArrayVertexBuffer',
+ 'glVertexArrayVertexBuffers',
+ 'glVertexAttrib1d',
+ 'glVertexAttrib1dv',
+ 'glVertexAttrib1f',
+ 'glVertexAttrib1fv',
+ 'glVertexAttrib1s',
+ 'glVertexAttrib1sv',
+ 'glVertexAttrib2d',
+ 'glVertexAttrib2dv',
+ 'glVertexAttrib2f',
+ 'glVertexAttrib2fv',
+ 'glVertexAttrib2s',
+ 'glVertexAttrib2sv',
+ 'glVertexAttrib3d',
+ 'glVertexAttrib3dv',
+ 'glVertexAttrib3f',
+ 'glVertexAttrib3fv',
+ 'glVertexAttrib3s',
+ 'glVertexAttrib3sv',
+ 'glVertexAttrib4Nbv',
+ 'glVertexAttrib4Niv',
+ 'glVertexAttrib4Nsv',
+ 'glVertexAttrib4Nub',
+ 'glVertexAttrib4Nubv',
+ 'glVertexAttrib4Nuiv',
+ 'glVertexAttrib4Nusv',
+ 'glVertexAttrib4bv',
+ 'glVertexAttrib4d',
+ 'glVertexAttrib4dv',
+ 'glVertexAttrib4f',
+ 'glVertexAttrib4fv',
+ 'glVertexAttrib4iv',
+ 'glVertexAttrib4s',
+ 'glVertexAttrib4sv',
+ 'glVertexAttrib4ubv',
+ 'glVertexAttrib4uiv',
+ 'glVertexAttrib4usv',
+ 'glVertexAttribBinding',
+ 'glVertexAttribDivisor',
+ 'glVertexAttribFormat',
+ 'glVertexAttribI1i',
+ 'glVertexAttribI1iv',
+ 'glVertexAttribI1ui',
+ 'glVertexAttribI1uiv',
+ 'glVertexAttribI2i',
+ 'glVertexAttribI2iv',
+ 'glVertexAttribI2ui',
+ 'glVertexAttribI2uiv',
+ 'glVertexAttribI3i',
+ 'glVertexAttribI3iv',
+ 'glVertexAttribI3ui',
+ 'glVertexAttribI3uiv',
+ 'glVertexAttribI4bv',
+ 'glVertexAttribI4i',
+ 'glVertexAttribI4iv',
+ 'glVertexAttribI4sv',
+ 'glVertexAttribI4ubv',
+ 'glVertexAttribI4ui',
+ 'glVertexAttribI4uiv',
+ 'glVertexAttribI4usv',
+ 'glVertexAttribIFormat',
+ 'glVertexAttribIPointer',
+ 'glVertexAttribL1d',
+ 'glVertexAttribL1dv',
+ 'glVertexAttribL2d',
+ 'glVertexAttribL2dv',
+ 'glVertexAttribL3d',
+ 'glVertexAttribL3dv',
+ 'glVertexAttribL4d',
+ 'glVertexAttribL4dv',
+ 'glVertexAttribLFormat',
+ 'glVertexAttribLPointer',
+ 'glVertexAttribP1ui',
+ 'glVertexAttribP1uiv',
+ 'glVertexAttribP2ui',
+ 'glVertexAttribP2uiv',
+ 'glVertexAttribP3ui',
+ 'glVertexAttribP3uiv',
+ 'glVertexAttribP4ui',
+ 'glVertexAttribP4uiv',
+ 'glVertexAttribPointer',
+ 'glVertexBindingDivisor',
+ 'glVertexP2ui',
+ 'glVertexP2uiv',
+ 'glVertexP3ui',
+ 'glVertexP3uiv',
+ 'glVertexP4ui',
+ 'glVertexP4uiv',
+ 'glViewport',
+ 'glViewportArrayv',
+ 'glViewportIndexedf',
+ 'glViewportIndexedfv',
+ 'glWaitSync',
+]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/gl_compat.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/gl_compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..10e1af6893a05042c394de19e8a7589e82684bc2
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/gl_compat.py
@@ -0,0 +1,5949 @@
+"""Wrapper for https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/master/xml/gl.xml
+Generated by tools/gengl.py.
+Do not modify this file.
+"""
+
+from ctypes import *
+from pyglet.gl.lib import link_GL as _link_function
+from pyglet.gl.lib import c_ptrdiff_t
+
+class struct___GLsync(Structure):
+ __slots__ = [
+ ]
+struct___GLsync._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# END OF gl.template
+
+# GL type definitions
+GLenum = c_uint
+GLboolean = c_ubyte
+GLbitfield = c_uint
+GLvoid = None
+GLbyte = c_char
+GLubyte = c_ubyte
+GLshort = c_short
+GLushort = c_ushort
+GLint = c_int
+GLuint = c_uint
+GLclampx = c_uint
+GLsizei = c_int
+GLfloat = c_float
+GLclampf = c_float
+GLdouble = c_double
+GLclampd = c_double
+GLchar = c_char
+GLintptr = c_ptrdiff_t
+GLsizeiptr = c_ptrdiff_t
+GLint64 = c_int64
+GLuint64 = c_uint64
+GLsync = POINTER(struct___GLsync)
+GLDEBUGPROC = CFUNCTYPE(None, GLenum, GLenum, GLuint, GLenum, GLsizei, POINTER(GLchar), POINTER(GLvoid))
+
+# GL enumerant (token) definitions
+GL_FALSE = 0
+GL_POINTS = 0
+GL_ZERO = 0
+GL_NONE = 0
+GL_NO_ERROR = 0
+GL_TRUE = 1
+GL_LINES = 1
+GL_ONE = 1
+GL_CURRENT_BIT = 1
+GL_CLIENT_PIXEL_STORE_BIT = 1
+GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 1
+GL_MAP_READ_BIT = 1
+GL_CONTEXT_CORE_PROFILE_BIT = 1
+GL_SYNC_FLUSH_COMMANDS_BIT = 1
+GL_VERTEX_SHADER_BIT = 1
+GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT = 1
+GL_LINE_LOOP = 2
+GL_POINT_BIT = 2
+GL_CLIENT_VERTEX_ARRAY_BIT = 2
+GL_MAP_WRITE_BIT = 2
+GL_CONTEXT_COMPATIBILITY_PROFILE_BIT = 2
+GL_FRAGMENT_SHADER_BIT = 2
+GL_ELEMENT_ARRAY_BARRIER_BIT = 2
+GL_CONTEXT_FLAG_DEBUG_BIT = 2
+GL_LINE_STRIP = 3
+GL_TRIANGLES = 4
+GL_LINE_BIT = 4
+GL_MAP_INVALIDATE_RANGE_BIT = 4
+GL_GEOMETRY_SHADER_BIT = 4
+GL_UNIFORM_BARRIER_BIT = 4
+GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT = 4
+GL_TRIANGLE_STRIP = 5
+GL_TRIANGLE_FAN = 6
+GL_QUADS = 7
+GL_POLYGON_BIT = 8
+GL_QUAD_STRIP = 8
+GL_MAP_INVALIDATE_BUFFER_BIT = 8
+GL_TESS_CONTROL_SHADER_BIT = 8
+GL_TEXTURE_FETCH_BARRIER_BIT = 8
+GL_CONTEXT_FLAG_NO_ERROR_BIT = 8
+GL_POLYGON = 9
+GL_LINES_ADJACENCY = 10
+GL_LINE_STRIP_ADJACENCY = 11
+GL_TRIANGLES_ADJACENCY = 12
+GL_TRIANGLE_STRIP_ADJACENCY = 13
+GL_PATCHES = 14
+GL_POLYGON_STIPPLE_BIT = 16
+GL_MAP_FLUSH_EXPLICIT_BIT = 16
+GL_TESS_EVALUATION_SHADER_BIT = 16
+GL_PIXEL_MODE_BIT = 32
+GL_MAP_UNSYNCHRONIZED_BIT = 32
+GL_SHADER_IMAGE_ACCESS_BARRIER_BIT = 32
+GL_COMPUTE_SHADER_BIT = 32
+GL_LIGHTING_BIT = 64
+GL_COMMAND_BARRIER_BIT = 64
+GL_MAP_PERSISTENT_BIT = 64
+GL_FOG_BIT = 128
+GL_PIXEL_BUFFER_BARRIER_BIT = 128
+GL_MAP_COHERENT_BIT = 128
+GL_DEPTH_BUFFER_BIT = 256
+GL_ACCUM = 256
+GL_TEXTURE_UPDATE_BARRIER_BIT = 256
+GL_DYNAMIC_STORAGE_BIT = 256
+GL_LOAD = 257
+GL_RETURN = 258
+GL_MULT = 259
+GL_ADD = 260
+GL_NEVER = 512
+GL_ACCUM_BUFFER_BIT = 512
+GL_BUFFER_UPDATE_BARRIER_BIT = 512
+GL_CLIENT_STORAGE_BIT = 512
+GL_LESS = 513
+GL_EQUAL = 514
+GL_LEQUAL = 515
+GL_GREATER = 516
+GL_NOTEQUAL = 517
+GL_GEQUAL = 518
+GL_ALWAYS = 519
+GL_SRC_COLOR = 768
+GL_ONE_MINUS_SRC_COLOR = 769
+GL_SRC_ALPHA = 770
+GL_ONE_MINUS_SRC_ALPHA = 771
+GL_DST_ALPHA = 772
+GL_ONE_MINUS_DST_ALPHA = 773
+GL_DST_COLOR = 774
+GL_ONE_MINUS_DST_COLOR = 775
+GL_SRC_ALPHA_SATURATE = 776
+GL_STENCIL_BUFFER_BIT = 1024
+GL_FRONT_LEFT = 1024
+GL_FRAMEBUFFER_BARRIER_BIT = 1024
+GL_FRONT_RIGHT = 1025
+GL_BACK_LEFT = 1026
+GL_BACK_RIGHT = 1027
+GL_FRONT = 1028
+GL_BACK = 1029
+GL_LEFT = 1030
+GL_RIGHT = 1031
+GL_FRONT_AND_BACK = 1032
+GL_AUX0 = 1033
+GL_AUX1 = 1034
+GL_AUX2 = 1035
+GL_AUX3 = 1036
+GL_INVALID_ENUM = 1280
+GL_INVALID_VALUE = 1281
+GL_INVALID_OPERATION = 1282
+GL_STACK_OVERFLOW = 1283
+GL_STACK_UNDERFLOW = 1284
+GL_OUT_OF_MEMORY = 1285
+GL_INVALID_FRAMEBUFFER_OPERATION = 1286
+GL_INVALID_FRAMEBUFFER_OPERATION_EXT = 1286
+GL_CONTEXT_LOST = 1287
+GL_2D = 1536
+GL_3D = 1537
+GL_3D_COLOR = 1538
+GL_3D_COLOR_TEXTURE = 1539
+GL_4D_COLOR_TEXTURE = 1540
+GL_PASS_THROUGH_TOKEN = 1792
+GL_POINT_TOKEN = 1793
+GL_LINE_TOKEN = 1794
+GL_POLYGON_TOKEN = 1795
+GL_BITMAP_TOKEN = 1796
+GL_DRAW_PIXEL_TOKEN = 1797
+GL_COPY_PIXEL_TOKEN = 1798
+GL_LINE_RESET_TOKEN = 1799
+GL_VIEWPORT_BIT = 2048
+GL_EXP = 2048
+GL_TRANSFORM_FEEDBACK_BARRIER_BIT = 2048
+GL_EXP2 = 2049
+GL_CW = 2304
+GL_CCW = 2305
+GL_COEFF = 2560
+GL_ORDER = 2561
+GL_DOMAIN = 2562
+GL_CURRENT_COLOR = 2816
+GL_CURRENT_INDEX = 2817
+GL_CURRENT_NORMAL = 2818
+GL_CURRENT_TEXTURE_COORDS = 2819
+GL_CURRENT_RASTER_COLOR = 2820
+GL_CURRENT_RASTER_INDEX = 2821
+GL_CURRENT_RASTER_TEXTURE_COORDS = 2822
+GL_CURRENT_RASTER_POSITION = 2823
+GL_CURRENT_RASTER_POSITION_VALID = 2824
+GL_CURRENT_RASTER_DISTANCE = 2825
+GL_POINT_SMOOTH = 2832
+GL_POINT_SIZE = 2833
+GL_POINT_SIZE_RANGE = 2834
+GL_SMOOTH_POINT_SIZE_RANGE = 2834
+GL_POINT_SIZE_GRANULARITY = 2835
+GL_SMOOTH_POINT_SIZE_GRANULARITY = 2835
+GL_LINE_SMOOTH = 2848
+GL_LINE_WIDTH = 2849
+GL_LINE_WIDTH_RANGE = 2850
+GL_SMOOTH_LINE_WIDTH_RANGE = 2850
+GL_LINE_WIDTH_GRANULARITY = 2851
+GL_SMOOTH_LINE_WIDTH_GRANULARITY = 2851
+GL_LINE_STIPPLE = 2852
+GL_LINE_STIPPLE_PATTERN = 2853
+GL_LINE_STIPPLE_REPEAT = 2854
+GL_LIST_MODE = 2864
+GL_MAX_LIST_NESTING = 2865
+GL_LIST_BASE = 2866
+GL_LIST_INDEX = 2867
+GL_POLYGON_MODE = 2880
+GL_POLYGON_SMOOTH = 2881
+GL_POLYGON_STIPPLE = 2882
+GL_EDGE_FLAG = 2883
+GL_CULL_FACE = 2884
+GL_CULL_FACE_MODE = 2885
+GL_FRONT_FACE = 2886
+GL_LIGHTING = 2896
+GL_LIGHT_MODEL_LOCAL_VIEWER = 2897
+GL_LIGHT_MODEL_TWO_SIDE = 2898
+GL_LIGHT_MODEL_AMBIENT = 2899
+GL_SHADE_MODEL = 2900
+GL_COLOR_MATERIAL_FACE = 2901
+GL_COLOR_MATERIAL_PARAMETER = 2902
+GL_COLOR_MATERIAL = 2903
+GL_FOG = 2912
+GL_FOG_INDEX = 2913
+GL_FOG_DENSITY = 2914
+GL_FOG_START = 2915
+GL_FOG_END = 2916
+GL_FOG_MODE = 2917
+GL_FOG_COLOR = 2918
+GL_DEPTH_RANGE = 2928
+GL_DEPTH_TEST = 2929
+GL_DEPTH_WRITEMASK = 2930
+GL_DEPTH_CLEAR_VALUE = 2931
+GL_DEPTH_FUNC = 2932
+GL_ACCUM_CLEAR_VALUE = 2944
+GL_STENCIL_TEST = 2960
+GL_STENCIL_CLEAR_VALUE = 2961
+GL_STENCIL_FUNC = 2962
+GL_STENCIL_VALUE_MASK = 2963
+GL_STENCIL_FAIL = 2964
+GL_STENCIL_PASS_DEPTH_FAIL = 2965
+GL_STENCIL_PASS_DEPTH_PASS = 2966
+GL_STENCIL_REF = 2967
+GL_STENCIL_WRITEMASK = 2968
+GL_MATRIX_MODE = 2976
+GL_NORMALIZE = 2977
+GL_VIEWPORT = 2978
+GL_MODELVIEW_STACK_DEPTH = 2979
+GL_PROJECTION_STACK_DEPTH = 2980
+GL_TEXTURE_STACK_DEPTH = 2981
+GL_MODELVIEW_MATRIX = 2982
+GL_PROJECTION_MATRIX = 2983
+GL_TEXTURE_MATRIX = 2984
+GL_ATTRIB_STACK_DEPTH = 2992
+GL_CLIENT_ATTRIB_STACK_DEPTH = 2993
+GL_ALPHA_TEST = 3008
+GL_ALPHA_TEST_FUNC = 3009
+GL_ALPHA_TEST_REF = 3010
+GL_DITHER = 3024
+GL_BLEND_DST = 3040
+GL_BLEND_SRC = 3041
+GL_BLEND = 3042
+GL_LOGIC_OP_MODE = 3056
+GL_LOGIC_OP = 3057
+GL_INDEX_LOGIC_OP = 3057
+GL_COLOR_LOGIC_OP = 3058
+GL_AUX_BUFFERS = 3072
+GL_DRAW_BUFFER = 3073
+GL_READ_BUFFER = 3074
+GL_SCISSOR_BOX = 3088
+GL_SCISSOR_TEST = 3089
+GL_INDEX_CLEAR_VALUE = 3104
+GL_INDEX_WRITEMASK = 3105
+GL_COLOR_CLEAR_VALUE = 3106
+GL_COLOR_WRITEMASK = 3107
+GL_INDEX_MODE = 3120
+GL_RGBA_MODE = 3121
+GL_DOUBLEBUFFER = 3122
+GL_STEREO = 3123
+GL_RENDER_MODE = 3136
+GL_PERSPECTIVE_CORRECTION_HINT = 3152
+GL_POINT_SMOOTH_HINT = 3153
+GL_LINE_SMOOTH_HINT = 3154
+GL_POLYGON_SMOOTH_HINT = 3155
+GL_FOG_HINT = 3156
+GL_TEXTURE_GEN_S = 3168
+GL_TEXTURE_GEN_T = 3169
+GL_TEXTURE_GEN_R = 3170
+GL_TEXTURE_GEN_Q = 3171
+GL_PIXEL_MAP_I_TO_I = 3184
+GL_PIXEL_MAP_S_TO_S = 3185
+GL_PIXEL_MAP_I_TO_R = 3186
+GL_PIXEL_MAP_I_TO_G = 3187
+GL_PIXEL_MAP_I_TO_B = 3188
+GL_PIXEL_MAP_I_TO_A = 3189
+GL_PIXEL_MAP_R_TO_R = 3190
+GL_PIXEL_MAP_G_TO_G = 3191
+GL_PIXEL_MAP_B_TO_B = 3192
+GL_PIXEL_MAP_A_TO_A = 3193
+GL_PIXEL_MAP_I_TO_I_SIZE = 3248
+GL_PIXEL_MAP_S_TO_S_SIZE = 3249
+GL_PIXEL_MAP_I_TO_R_SIZE = 3250
+GL_PIXEL_MAP_I_TO_G_SIZE = 3251
+GL_PIXEL_MAP_I_TO_B_SIZE = 3252
+GL_PIXEL_MAP_I_TO_A_SIZE = 3253
+GL_PIXEL_MAP_R_TO_R_SIZE = 3254
+GL_PIXEL_MAP_G_TO_G_SIZE = 3255
+GL_PIXEL_MAP_B_TO_B_SIZE = 3256
+GL_PIXEL_MAP_A_TO_A_SIZE = 3257
+GL_UNPACK_SWAP_BYTES = 3312
+GL_UNPACK_LSB_FIRST = 3313
+GL_UNPACK_ROW_LENGTH = 3314
+GL_UNPACK_SKIP_ROWS = 3315
+GL_UNPACK_SKIP_PIXELS = 3316
+GL_UNPACK_ALIGNMENT = 3317
+GL_PACK_SWAP_BYTES = 3328
+GL_PACK_LSB_FIRST = 3329
+GL_PACK_ROW_LENGTH = 3330
+GL_PACK_SKIP_ROWS = 3331
+GL_PACK_SKIP_PIXELS = 3332
+GL_PACK_ALIGNMENT = 3333
+GL_MAP_COLOR = 3344
+GL_MAP_STENCIL = 3345
+GL_INDEX_SHIFT = 3346
+GL_INDEX_OFFSET = 3347
+GL_RED_SCALE = 3348
+GL_RED_BIAS = 3349
+GL_ZOOM_X = 3350
+GL_ZOOM_Y = 3351
+GL_GREEN_SCALE = 3352
+GL_GREEN_BIAS = 3353
+GL_BLUE_SCALE = 3354
+GL_BLUE_BIAS = 3355
+GL_ALPHA_SCALE = 3356
+GL_ALPHA_BIAS = 3357
+GL_DEPTH_SCALE = 3358
+GL_DEPTH_BIAS = 3359
+GL_MAX_EVAL_ORDER = 3376
+GL_MAX_LIGHTS = 3377
+GL_MAX_CLIP_PLANES = 3378
+GL_MAX_CLIP_DISTANCES = 3378
+GL_MAX_TEXTURE_SIZE = 3379
+GL_MAX_PIXEL_MAP_TABLE = 3380
+GL_MAX_ATTRIB_STACK_DEPTH = 3381
+GL_MAX_MODELVIEW_STACK_DEPTH = 3382
+GL_MAX_NAME_STACK_DEPTH = 3383
+GL_MAX_PROJECTION_STACK_DEPTH = 3384
+GL_MAX_TEXTURE_STACK_DEPTH = 3385
+GL_MAX_VIEWPORT_DIMS = 3386
+GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = 3387
+GL_SUBPIXEL_BITS = 3408
+GL_INDEX_BITS = 3409
+GL_RED_BITS = 3410
+GL_GREEN_BITS = 3411
+GL_BLUE_BITS = 3412
+GL_ALPHA_BITS = 3413
+GL_DEPTH_BITS = 3414
+GL_STENCIL_BITS = 3415
+GL_ACCUM_RED_BITS = 3416
+GL_ACCUM_GREEN_BITS = 3417
+GL_ACCUM_BLUE_BITS = 3418
+GL_ACCUM_ALPHA_BITS = 3419
+GL_NAME_STACK_DEPTH = 3440
+GL_AUTO_NORMAL = 3456
+GL_MAP1_COLOR_4 = 3472
+GL_MAP1_INDEX = 3473
+GL_MAP1_NORMAL = 3474
+GL_MAP1_TEXTURE_COORD_1 = 3475
+GL_MAP1_TEXTURE_COORD_2 = 3476
+GL_MAP1_TEXTURE_COORD_3 = 3477
+GL_MAP1_TEXTURE_COORD_4 = 3478
+GL_MAP1_VERTEX_3 = 3479
+GL_MAP1_VERTEX_4 = 3480
+GL_MAP2_COLOR_4 = 3504
+GL_MAP2_INDEX = 3505
+GL_MAP2_NORMAL = 3506
+GL_MAP2_TEXTURE_COORD_1 = 3507
+GL_MAP2_TEXTURE_COORD_2 = 3508
+GL_MAP2_TEXTURE_COORD_3 = 3509
+GL_MAP2_TEXTURE_COORD_4 = 3510
+GL_MAP2_VERTEX_3 = 3511
+GL_MAP2_VERTEX_4 = 3512
+GL_MAP1_GRID_DOMAIN = 3536
+GL_MAP1_GRID_SEGMENTS = 3537
+GL_MAP2_GRID_DOMAIN = 3538
+GL_MAP2_GRID_SEGMENTS = 3539
+GL_TEXTURE_1D = 3552
+GL_TEXTURE_2D = 3553
+GL_FEEDBACK_BUFFER_POINTER = 3568
+GL_FEEDBACK_BUFFER_SIZE = 3569
+GL_FEEDBACK_BUFFER_TYPE = 3570
+GL_SELECTION_BUFFER_POINTER = 3571
+GL_SELECTION_BUFFER_SIZE = 3572
+GL_TEXTURE_WIDTH = 4096
+GL_TRANSFORM_BIT = 4096
+GL_ATOMIC_COUNTER_BARRIER_BIT = 4096
+GL_TEXTURE_HEIGHT = 4097
+GL_TEXTURE_COMPONENTS = 4099
+GL_TEXTURE_INTERNAL_FORMAT = 4099
+GL_TEXTURE_BORDER_COLOR = 4100
+GL_TEXTURE_BORDER = 4101
+GL_TEXTURE_TARGET = 4102
+GL_DONT_CARE = 4352
+GL_FASTEST = 4353
+GL_NICEST = 4354
+GL_AMBIENT = 4608
+GL_DIFFUSE = 4609
+GL_SPECULAR = 4610
+GL_POSITION = 4611
+GL_SPOT_DIRECTION = 4612
+GL_SPOT_EXPONENT = 4613
+GL_SPOT_CUTOFF = 4614
+GL_CONSTANT_ATTENUATION = 4615
+GL_LINEAR_ATTENUATION = 4616
+GL_QUADRATIC_ATTENUATION = 4617
+GL_COMPILE = 4864
+GL_COMPILE_AND_EXECUTE = 4865
+GL_BYTE = 5120
+GL_UNSIGNED_BYTE = 5121
+GL_SHORT = 5122
+GL_UNSIGNED_SHORT = 5123
+GL_INT = 5124
+GL_UNSIGNED_INT = 5125
+GL_FLOAT = 5126
+GL_2_BYTES = 5127
+GL_3_BYTES = 5128
+GL_4_BYTES = 5129
+GL_DOUBLE = 5130
+GL_HALF_FLOAT = 5131
+GL_FIXED = 5132
+GL_CLEAR = 5376
+GL_AND = 5377
+GL_AND_REVERSE = 5378
+GL_COPY = 5379
+GL_AND_INVERTED = 5380
+GL_NOOP = 5381
+GL_XOR = 5382
+GL_OR = 5383
+GL_NOR = 5384
+GL_EQUIV = 5385
+GL_INVERT = 5386
+GL_OR_REVERSE = 5387
+GL_COPY_INVERTED = 5388
+GL_OR_INVERTED = 5389
+GL_NAND = 5390
+GL_SET = 5391
+GL_EMISSION = 5632
+GL_SHININESS = 5633
+GL_AMBIENT_AND_DIFFUSE = 5634
+GL_COLOR_INDEXES = 5635
+GL_MODELVIEW = 5888
+GL_PROJECTION = 5889
+GL_TEXTURE = 5890
+GL_COLOR = 6144
+GL_DEPTH = 6145
+GL_STENCIL = 6146
+GL_COLOR_INDEX = 6400
+GL_STENCIL_INDEX = 6401
+GL_DEPTH_COMPONENT = 6402
+GL_RED = 6403
+GL_GREEN = 6404
+GL_BLUE = 6405
+GL_ALPHA = 6406
+GL_RGB = 6407
+GL_RGBA = 6408
+GL_LUMINANCE = 6409
+GL_LUMINANCE_ALPHA = 6410
+GL_BITMAP = 6656
+GL_POINT = 6912
+GL_LINE = 6913
+GL_FILL = 6914
+GL_RENDER = 7168
+GL_FEEDBACK = 7169
+GL_SELECT = 7170
+GL_FLAT = 7424
+GL_SMOOTH = 7425
+GL_KEEP = 7680
+GL_REPLACE = 7681
+GL_INCR = 7682
+GL_DECR = 7683
+GL_VENDOR = 7936
+GL_RENDERER = 7937
+GL_VERSION = 7938
+GL_EXTENSIONS = 7939
+GL_ENABLE_BIT = 8192
+GL_S = 8192
+GL_SHADER_STORAGE_BARRIER_BIT = 8192
+GL_T = 8193
+GL_R = 8194
+GL_Q = 8195
+GL_MODULATE = 8448
+GL_DECAL = 8449
+GL_TEXTURE_ENV_MODE = 8704
+GL_TEXTURE_ENV_COLOR = 8705
+GL_TEXTURE_ENV = 8960
+GL_EYE_LINEAR = 9216
+GL_OBJECT_LINEAR = 9217
+GL_SPHERE_MAP = 9218
+GL_TEXTURE_GEN_MODE = 9472
+GL_OBJECT_PLANE = 9473
+GL_EYE_PLANE = 9474
+GL_NEAREST = 9728
+GL_LINEAR = 9729
+GL_NEAREST_MIPMAP_NEAREST = 9984
+GL_LINEAR_MIPMAP_NEAREST = 9985
+GL_NEAREST_MIPMAP_LINEAR = 9986
+GL_LINEAR_MIPMAP_LINEAR = 9987
+GL_TEXTURE_MAG_FILTER = 10240
+GL_TEXTURE_MIN_FILTER = 10241
+GL_TEXTURE_WRAP_S = 10242
+GL_TEXTURE_WRAP_T = 10243
+GL_CLAMP = 10496
+GL_REPEAT = 10497
+GL_POLYGON_OFFSET_UNITS = 10752
+GL_POLYGON_OFFSET_POINT = 10753
+GL_POLYGON_OFFSET_LINE = 10754
+GL_R3_G3_B2 = 10768
+GL_V2F = 10784
+GL_V3F = 10785
+GL_C4UB_V2F = 10786
+GL_C4UB_V3F = 10787
+GL_C3F_V3F = 10788
+GL_N3F_V3F = 10789
+GL_C4F_N3F_V3F = 10790
+GL_T2F_V3F = 10791
+GL_T4F_V4F = 10792
+GL_T2F_C4UB_V3F = 10793
+GL_T2F_C3F_V3F = 10794
+GL_T2F_N3F_V3F = 10795
+GL_T2F_C4F_N3F_V3F = 10796
+GL_T4F_C4F_N3F_V4F = 10797
+GL_CLIP_PLANE0 = 12288
+GL_CLIP_DISTANCE0 = 12288
+GL_CLIP_PLANE1 = 12289
+GL_CLIP_DISTANCE1 = 12289
+GL_CLIP_PLANE2 = 12290
+GL_CLIP_DISTANCE2 = 12290
+GL_CLIP_PLANE3 = 12291
+GL_CLIP_DISTANCE3 = 12291
+GL_CLIP_PLANE4 = 12292
+GL_CLIP_DISTANCE4 = 12292
+GL_CLIP_PLANE5 = 12293
+GL_CLIP_DISTANCE5 = 12293
+GL_CLIP_DISTANCE6 = 12294
+GL_CLIP_DISTANCE7 = 12295
+GL_COLOR_BUFFER_BIT = 16384
+GL_LIGHT0 = 16384
+GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT = 16384
+GL_LIGHT1 = 16385
+GL_LIGHT2 = 16386
+GL_LIGHT3 = 16387
+GL_LIGHT4 = 16388
+GL_LIGHT5 = 16389
+GL_LIGHT6 = 16390
+GL_LIGHT7 = 16391
+GL_HINT_BIT = 32768
+GL_QUERY_BUFFER_BARRIER_BIT = 32768
+GL_CONSTANT_COLOR = 32769
+GL_ONE_MINUS_CONSTANT_COLOR = 32770
+GL_CONSTANT_ALPHA = 32771
+GL_ONE_MINUS_CONSTANT_ALPHA = 32772
+GL_BLEND_COLOR = 32773
+GL_FUNC_ADD = 32774
+GL_MIN = 32775
+GL_MAX = 32776
+GL_BLEND_EQUATION = 32777
+GL_BLEND_EQUATION_RGB = 32777
+GL_FUNC_SUBTRACT = 32778
+GL_FUNC_REVERSE_SUBTRACT = 32779
+GL_CONVOLUTION_1D = 32784
+GL_CONVOLUTION_2D = 32785
+GL_SEPARABLE_2D = 32786
+GL_HISTOGRAM = 32804
+GL_PROXY_HISTOGRAM = 32805
+GL_MINMAX = 32814
+GL_UNSIGNED_BYTE_3_3_2 = 32818
+GL_UNSIGNED_SHORT_4_4_4_4 = 32819
+GL_UNSIGNED_SHORT_5_5_5_1 = 32820
+GL_UNSIGNED_INT_8_8_8_8 = 32821
+GL_UNSIGNED_INT_10_10_10_2 = 32822
+GL_POLYGON_OFFSET_FILL = 32823
+GL_POLYGON_OFFSET_FACTOR = 32824
+GL_RESCALE_NORMAL = 32826
+GL_ALPHA4 = 32827
+GL_ALPHA8 = 32828
+GL_ALPHA12 = 32829
+GL_ALPHA16 = 32830
+GL_LUMINANCE4 = 32831
+GL_LUMINANCE8 = 32832
+GL_LUMINANCE12 = 32833
+GL_LUMINANCE16 = 32834
+GL_LUMINANCE4_ALPHA4 = 32835
+GL_LUMINANCE6_ALPHA2 = 32836
+GL_LUMINANCE8_ALPHA8 = 32837
+GL_LUMINANCE12_ALPHA4 = 32838
+GL_LUMINANCE12_ALPHA12 = 32839
+GL_LUMINANCE16_ALPHA16 = 32840
+GL_INTENSITY = 32841
+GL_INTENSITY4 = 32842
+GL_INTENSITY8 = 32843
+GL_INTENSITY12 = 32844
+GL_INTENSITY16 = 32845
+GL_RGB4 = 32847
+GL_RGB5 = 32848
+GL_RGB8 = 32849
+GL_RGB10 = 32850
+GL_RGB12 = 32851
+GL_RGB16 = 32852
+GL_RGBA2 = 32853
+GL_RGBA4 = 32854
+GL_RGB5_A1 = 32855
+GL_RGBA8 = 32856
+GL_RGB10_A2 = 32857
+GL_RGBA12 = 32858
+GL_RGBA16 = 32859
+GL_TEXTURE_RED_SIZE = 32860
+GL_TEXTURE_GREEN_SIZE = 32861
+GL_TEXTURE_BLUE_SIZE = 32862
+GL_TEXTURE_ALPHA_SIZE = 32863
+GL_TEXTURE_LUMINANCE_SIZE = 32864
+GL_TEXTURE_INTENSITY_SIZE = 32865
+GL_PROXY_TEXTURE_1D = 32867
+GL_PROXY_TEXTURE_2D = 32868
+GL_TEXTURE_PRIORITY = 32870
+GL_TEXTURE_RESIDENT = 32871
+GL_TEXTURE_BINDING_1D = 32872
+GL_TEXTURE_BINDING_2D = 32873
+GL_TEXTURE_BINDING_3D = 32874
+GL_PACK_SKIP_IMAGES = 32875
+GL_PACK_IMAGE_HEIGHT = 32876
+GL_UNPACK_SKIP_IMAGES = 32877
+GL_UNPACK_IMAGE_HEIGHT = 32878
+GL_TEXTURE_3D = 32879
+GL_PROXY_TEXTURE_3D = 32880
+GL_TEXTURE_DEPTH = 32881
+GL_TEXTURE_WRAP_R = 32882
+GL_MAX_3D_TEXTURE_SIZE = 32883
+GL_VERTEX_ARRAY = 32884
+GL_NORMAL_ARRAY = 32885
+GL_COLOR_ARRAY = 32886
+GL_INDEX_ARRAY = 32887
+GL_TEXTURE_COORD_ARRAY = 32888
+GL_EDGE_FLAG_ARRAY = 32889
+GL_VERTEX_ARRAY_SIZE = 32890
+GL_VERTEX_ARRAY_TYPE = 32891
+GL_VERTEX_ARRAY_STRIDE = 32892
+GL_NORMAL_ARRAY_TYPE = 32894
+GL_NORMAL_ARRAY_STRIDE = 32895
+GL_COLOR_ARRAY_SIZE = 32897
+GL_COLOR_ARRAY_TYPE = 32898
+GL_COLOR_ARRAY_STRIDE = 32899
+GL_INDEX_ARRAY_TYPE = 32901
+GL_INDEX_ARRAY_STRIDE = 32902
+GL_TEXTURE_COORD_ARRAY_SIZE = 32904
+GL_TEXTURE_COORD_ARRAY_TYPE = 32905
+GL_TEXTURE_COORD_ARRAY_STRIDE = 32906
+GL_EDGE_FLAG_ARRAY_STRIDE = 32908
+GL_VERTEX_ARRAY_POINTER = 32910
+GL_NORMAL_ARRAY_POINTER = 32911
+GL_COLOR_ARRAY_POINTER = 32912
+GL_INDEX_ARRAY_POINTER = 32913
+GL_TEXTURE_COORD_ARRAY_POINTER = 32914
+GL_EDGE_FLAG_ARRAY_POINTER = 32915
+GL_MULTISAMPLE = 32925
+GL_MULTISAMPLE_ARB = 32925
+GL_SAMPLE_ALPHA_TO_COVERAGE = 32926
+GL_SAMPLE_ALPHA_TO_COVERAGE_ARB = 32926
+GL_SAMPLE_ALPHA_TO_ONE = 32927
+GL_SAMPLE_ALPHA_TO_ONE_ARB = 32927
+GL_SAMPLE_COVERAGE = 32928
+GL_SAMPLE_COVERAGE_ARB = 32928
+GL_SAMPLE_BUFFERS = 32936
+GL_SAMPLE_BUFFERS_ARB = 32936
+GL_SAMPLES = 32937
+GL_SAMPLES_ARB = 32937
+GL_SAMPLE_COVERAGE_VALUE = 32938
+GL_SAMPLE_COVERAGE_VALUE_ARB = 32938
+GL_SAMPLE_COVERAGE_INVERT = 32939
+GL_SAMPLE_COVERAGE_INVERT_ARB = 32939
+GL_BLEND_DST_RGB = 32968
+GL_BLEND_SRC_RGB = 32969
+GL_BLEND_DST_ALPHA = 32970
+GL_BLEND_SRC_ALPHA = 32971
+GL_COLOR_TABLE = 32976
+GL_POST_CONVOLUTION_COLOR_TABLE = 32977
+GL_POST_COLOR_MATRIX_COLOR_TABLE = 32978
+GL_PROXY_COLOR_TABLE = 32979
+GL_PROXY_POST_CONVOLUTION_COLOR_TABLE = 32980
+GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE = 32981
+GL_BGR = 32992
+GL_BGRA = 32993
+GL_MAX_ELEMENTS_VERTICES = 33000
+GL_MAX_ELEMENTS_INDICES = 33001
+GL_PARAMETER_BUFFER = 33006
+GL_PARAMETER_BUFFER_BINDING = 33007
+GL_POINT_SIZE_MIN = 33062
+GL_POINT_SIZE_MAX = 33063
+GL_POINT_FADE_THRESHOLD_SIZE = 33064
+GL_POINT_DISTANCE_ATTENUATION = 33065
+GL_CLAMP_TO_BORDER = 33069
+GL_CLAMP_TO_EDGE = 33071
+GL_TEXTURE_MIN_LOD = 33082
+GL_TEXTURE_MAX_LOD = 33083
+GL_TEXTURE_BASE_LEVEL = 33084
+GL_TEXTURE_MAX_LEVEL = 33085
+GL_GENERATE_MIPMAP = 33169
+GL_GENERATE_MIPMAP_HINT = 33170
+GL_DEPTH_COMPONENT16 = 33189
+GL_DEPTH_COMPONENT24 = 33190
+GL_DEPTH_COMPONENT32 = 33191
+GL_LIGHT_MODEL_COLOR_CONTROL = 33272
+GL_SINGLE_COLOR = 33273
+GL_SEPARATE_SPECULAR_COLOR = 33274
+GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 33296
+GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 33297
+GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 33298
+GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 33299
+GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 33300
+GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 33301
+GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 33302
+GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 33303
+GL_FRAMEBUFFER_DEFAULT = 33304
+GL_FRAMEBUFFER_UNDEFINED = 33305
+GL_DEPTH_STENCIL_ATTACHMENT = 33306
+GL_MAJOR_VERSION = 33307
+GL_MINOR_VERSION = 33308
+GL_NUM_EXTENSIONS = 33309
+GL_CONTEXT_FLAGS = 33310
+GL_BUFFER_IMMUTABLE_STORAGE = 33311
+GL_BUFFER_STORAGE_FLAGS = 33312
+GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED = 33313
+GL_INDEX = 33314
+GL_COMPRESSED_RED = 33317
+GL_COMPRESSED_RG = 33318
+GL_RG = 33319
+GL_RG_INTEGER = 33320
+GL_R8 = 33321
+GL_R16 = 33322
+GL_RG8 = 33323
+GL_RG16 = 33324
+GL_R16F = 33325
+GL_R32F = 33326
+GL_RG16F = 33327
+GL_RG32F = 33328
+GL_R8I = 33329
+GL_R8UI = 33330
+GL_R16I = 33331
+GL_R16UI = 33332
+GL_R32I = 33333
+GL_R32UI = 33334
+GL_RG8I = 33335
+GL_RG8UI = 33336
+GL_RG16I = 33337
+GL_RG16UI = 33338
+GL_RG32I = 33339
+GL_RG32UI = 33340
+GL_DEBUG_OUTPUT_SYNCHRONOUS = 33346
+GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH = 33347
+GL_DEBUG_CALLBACK_FUNCTION = 33348
+GL_DEBUG_CALLBACK_USER_PARAM = 33349
+GL_DEBUG_SOURCE_API = 33350
+GL_DEBUG_SOURCE_WINDOW_SYSTEM = 33351
+GL_DEBUG_SOURCE_SHADER_COMPILER = 33352
+GL_DEBUG_SOURCE_THIRD_PARTY = 33353
+GL_DEBUG_SOURCE_APPLICATION = 33354
+GL_DEBUG_SOURCE_OTHER = 33355
+GL_DEBUG_TYPE_ERROR = 33356
+GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR = 33357
+GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR = 33358
+GL_DEBUG_TYPE_PORTABILITY = 33359
+GL_DEBUG_TYPE_PERFORMANCE = 33360
+GL_DEBUG_TYPE_OTHER = 33361
+GL_LOSE_CONTEXT_ON_RESET = 33362
+GL_GUILTY_CONTEXT_RESET = 33363
+GL_INNOCENT_CONTEXT_RESET = 33364
+GL_UNKNOWN_CONTEXT_RESET = 33365
+GL_RESET_NOTIFICATION_STRATEGY = 33366
+GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 33367
+GL_PROGRAM_SEPARABLE = 33368
+GL_ACTIVE_PROGRAM = 33369
+GL_PROGRAM_PIPELINE_BINDING = 33370
+GL_MAX_VIEWPORTS = 33371
+GL_VIEWPORT_SUBPIXEL_BITS = 33372
+GL_VIEWPORT_BOUNDS_RANGE = 33373
+GL_LAYER_PROVOKING_VERTEX = 33374
+GL_VIEWPORT_INDEX_PROVOKING_VERTEX = 33375
+GL_UNDEFINED_VERTEX = 33376
+GL_NO_RESET_NOTIFICATION = 33377
+GL_MAX_COMPUTE_SHARED_MEMORY_SIZE = 33378
+GL_MAX_COMPUTE_UNIFORM_COMPONENTS = 33379
+GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 33380
+GL_MAX_COMPUTE_ATOMIC_COUNTERS = 33381
+GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 33382
+GL_COMPUTE_WORK_GROUP_SIZE = 33383
+GL_DEBUG_TYPE_MARKER = 33384
+GL_DEBUG_TYPE_PUSH_GROUP = 33385
+GL_DEBUG_TYPE_POP_GROUP = 33386
+GL_DEBUG_SEVERITY_NOTIFICATION = 33387
+GL_MAX_DEBUG_GROUP_STACK_DEPTH = 33388
+GL_DEBUG_GROUP_STACK_DEPTH = 33389
+GL_MAX_UNIFORM_LOCATIONS = 33390
+GL_INTERNALFORMAT_SUPPORTED = 33391
+GL_INTERNALFORMAT_PREFERRED = 33392
+GL_INTERNALFORMAT_RED_SIZE = 33393
+GL_INTERNALFORMAT_GREEN_SIZE = 33394
+GL_INTERNALFORMAT_BLUE_SIZE = 33395
+GL_INTERNALFORMAT_ALPHA_SIZE = 33396
+GL_INTERNALFORMAT_DEPTH_SIZE = 33397
+GL_INTERNALFORMAT_STENCIL_SIZE = 33398
+GL_INTERNALFORMAT_SHARED_SIZE = 33399
+GL_INTERNALFORMAT_RED_TYPE = 33400
+GL_INTERNALFORMAT_GREEN_TYPE = 33401
+GL_INTERNALFORMAT_BLUE_TYPE = 33402
+GL_INTERNALFORMAT_ALPHA_TYPE = 33403
+GL_INTERNALFORMAT_DEPTH_TYPE = 33404
+GL_INTERNALFORMAT_STENCIL_TYPE = 33405
+GL_MAX_WIDTH = 33406
+GL_MAX_HEIGHT = 33407
+GL_MAX_DEPTH = 33408
+GL_MAX_LAYERS = 33409
+GL_MAX_COMBINED_DIMENSIONS = 33410
+GL_COLOR_COMPONENTS = 33411
+GL_DEPTH_COMPONENTS = 33412
+GL_STENCIL_COMPONENTS = 33413
+GL_COLOR_RENDERABLE = 33414
+GL_DEPTH_RENDERABLE = 33415
+GL_STENCIL_RENDERABLE = 33416
+GL_FRAMEBUFFER_RENDERABLE = 33417
+GL_FRAMEBUFFER_RENDERABLE_LAYERED = 33418
+GL_FRAMEBUFFER_BLEND = 33419
+GL_READ_PIXELS = 33420
+GL_READ_PIXELS_FORMAT = 33421
+GL_READ_PIXELS_TYPE = 33422
+GL_TEXTURE_IMAGE_FORMAT = 33423
+GL_TEXTURE_IMAGE_TYPE = 33424
+GL_GET_TEXTURE_IMAGE_FORMAT = 33425
+GL_GET_TEXTURE_IMAGE_TYPE = 33426
+GL_MIPMAP = 33427
+GL_MANUAL_GENERATE_MIPMAP = 33428
+GL_AUTO_GENERATE_MIPMAP = 33429
+GL_COLOR_ENCODING = 33430
+GL_SRGB_READ = 33431
+GL_SRGB_WRITE = 33432
+GL_FILTER = 33434
+GL_VERTEX_TEXTURE = 33435
+GL_TESS_CONTROL_TEXTURE = 33436
+GL_TESS_EVALUATION_TEXTURE = 33437
+GL_GEOMETRY_TEXTURE = 33438
+GL_FRAGMENT_TEXTURE = 33439
+GL_COMPUTE_TEXTURE = 33440
+GL_TEXTURE_SHADOW = 33441
+GL_TEXTURE_GATHER = 33442
+GL_TEXTURE_GATHER_SHADOW = 33443
+GL_SHADER_IMAGE_LOAD = 33444
+GL_SHADER_IMAGE_STORE = 33445
+GL_SHADER_IMAGE_ATOMIC = 33446
+GL_IMAGE_TEXEL_SIZE = 33447
+GL_IMAGE_COMPATIBILITY_CLASS = 33448
+GL_IMAGE_PIXEL_FORMAT = 33449
+GL_IMAGE_PIXEL_TYPE = 33450
+GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST = 33452
+GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST = 33453
+GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE = 33454
+GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE = 33455
+GL_TEXTURE_COMPRESSED_BLOCK_WIDTH = 33457
+GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT = 33458
+GL_TEXTURE_COMPRESSED_BLOCK_SIZE = 33459
+GL_CLEAR_BUFFER = 33460
+GL_TEXTURE_VIEW = 33461
+GL_VIEW_COMPATIBILITY_CLASS = 33462
+GL_FULL_SUPPORT = 33463
+GL_CAVEAT_SUPPORT = 33464
+GL_IMAGE_CLASS_4_X_32 = 33465
+GL_IMAGE_CLASS_2_X_32 = 33466
+GL_IMAGE_CLASS_1_X_32 = 33467
+GL_IMAGE_CLASS_4_X_16 = 33468
+GL_IMAGE_CLASS_2_X_16 = 33469
+GL_IMAGE_CLASS_1_X_16 = 33470
+GL_IMAGE_CLASS_4_X_8 = 33471
+GL_IMAGE_CLASS_2_X_8 = 33472
+GL_IMAGE_CLASS_1_X_8 = 33473
+GL_IMAGE_CLASS_11_11_10 = 33474
+GL_IMAGE_CLASS_10_10_10_2 = 33475
+GL_VIEW_CLASS_128_BITS = 33476
+GL_VIEW_CLASS_96_BITS = 33477
+GL_VIEW_CLASS_64_BITS = 33478
+GL_VIEW_CLASS_48_BITS = 33479
+GL_VIEW_CLASS_32_BITS = 33480
+GL_VIEW_CLASS_24_BITS = 33481
+GL_VIEW_CLASS_16_BITS = 33482
+GL_VIEW_CLASS_8_BITS = 33483
+GL_VIEW_CLASS_S3TC_DXT1_RGB = 33484
+GL_VIEW_CLASS_S3TC_DXT1_RGBA = 33485
+GL_VIEW_CLASS_S3TC_DXT3_RGBA = 33486
+GL_VIEW_CLASS_S3TC_DXT5_RGBA = 33487
+GL_VIEW_CLASS_RGTC1_RED = 33488
+GL_VIEW_CLASS_RGTC2_RG = 33489
+GL_VIEW_CLASS_BPTC_UNORM = 33490
+GL_VIEW_CLASS_BPTC_FLOAT = 33491
+GL_VERTEX_ATTRIB_BINDING = 33492
+GL_VERTEX_ATTRIB_RELATIVE_OFFSET = 33493
+GL_VERTEX_BINDING_DIVISOR = 33494
+GL_VERTEX_BINDING_OFFSET = 33495
+GL_VERTEX_BINDING_STRIDE = 33496
+GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET = 33497
+GL_MAX_VERTEX_ATTRIB_BINDINGS = 33498
+GL_TEXTURE_VIEW_MIN_LEVEL = 33499
+GL_TEXTURE_VIEW_NUM_LEVELS = 33500
+GL_TEXTURE_VIEW_MIN_LAYER = 33501
+GL_TEXTURE_VIEW_NUM_LAYERS = 33502
+GL_TEXTURE_IMMUTABLE_LEVELS = 33503
+GL_BUFFER = 33504
+GL_SHADER = 33505
+GL_PROGRAM = 33506
+GL_QUERY = 33507
+GL_PROGRAM_PIPELINE = 33508
+GL_MAX_VERTEX_ATTRIB_STRIDE = 33509
+GL_SAMPLER = 33510
+GL_DISPLAY_LIST = 33511
+GL_MAX_LABEL_LENGTH = 33512
+GL_NUM_SHADING_LANGUAGE_VERSIONS = 33513
+GL_QUERY_TARGET = 33514
+GL_TRANSFORM_FEEDBACK_OVERFLOW = 33516
+GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW = 33517
+GL_VERTICES_SUBMITTED = 33518
+GL_PRIMITIVES_SUBMITTED = 33519
+GL_VERTEX_SHADER_INVOCATIONS = 33520
+GL_TESS_CONTROL_SHADER_PATCHES = 33521
+GL_TESS_EVALUATION_SHADER_INVOCATIONS = 33522
+GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED = 33523
+GL_FRAGMENT_SHADER_INVOCATIONS = 33524
+GL_COMPUTE_SHADER_INVOCATIONS = 33525
+GL_CLIPPING_INPUT_PRIMITIVES = 33526
+GL_CLIPPING_OUTPUT_PRIMITIVES = 33527
+GL_MAX_CULL_DISTANCES = 33529
+GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES = 33530
+GL_CONTEXT_RELEASE_BEHAVIOR = 33531
+GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 33532
+GL_UNSIGNED_BYTE_2_3_3_REV = 33634
+GL_UNSIGNED_SHORT_5_6_5 = 33635
+GL_UNSIGNED_SHORT_5_6_5_REV = 33636
+GL_UNSIGNED_SHORT_4_4_4_4_REV = 33637
+GL_UNSIGNED_SHORT_1_5_5_5_REV = 33638
+GL_UNSIGNED_INT_8_8_8_8_REV = 33639
+GL_UNSIGNED_INT_2_10_10_10_REV = 33640
+GL_MIRRORED_REPEAT = 33648
+GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776
+GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777
+GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778
+GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779
+GL_FOG_COORDINATE_SOURCE = 33872
+GL_FOG_COORD_SRC = 33872
+GL_FOG_COORDINATE = 33873
+GL_FOG_COORD = 33873
+GL_FRAGMENT_DEPTH = 33874
+GL_CURRENT_FOG_COORDINATE = 33875
+GL_CURRENT_FOG_COORD = 33875
+GL_FOG_COORDINATE_ARRAY_TYPE = 33876
+GL_FOG_COORD_ARRAY_TYPE = 33876
+GL_FOG_COORDINATE_ARRAY_STRIDE = 33877
+GL_FOG_COORD_ARRAY_STRIDE = 33877
+GL_FOG_COORDINATE_ARRAY_POINTER = 33878
+GL_FOG_COORD_ARRAY_POINTER = 33878
+GL_FOG_COORDINATE_ARRAY = 33879
+GL_FOG_COORD_ARRAY = 33879
+GL_COLOR_SUM = 33880
+GL_CURRENT_SECONDARY_COLOR = 33881
+GL_SECONDARY_COLOR_ARRAY_SIZE = 33882
+GL_SECONDARY_COLOR_ARRAY_TYPE = 33883
+GL_SECONDARY_COLOR_ARRAY_STRIDE = 33884
+GL_SECONDARY_COLOR_ARRAY_POINTER = 33885
+GL_SECONDARY_COLOR_ARRAY = 33886
+GL_CURRENT_RASTER_SECONDARY_COLOR = 33887
+GL_ALIASED_POINT_SIZE_RANGE = 33901
+GL_ALIASED_LINE_WIDTH_RANGE = 33902
+GL_TEXTURE0 = 33984
+GL_TEXTURE1 = 33985
+GL_TEXTURE2 = 33986
+GL_TEXTURE3 = 33987
+GL_TEXTURE4 = 33988
+GL_TEXTURE5 = 33989
+GL_TEXTURE6 = 33990
+GL_TEXTURE7 = 33991
+GL_TEXTURE8 = 33992
+GL_TEXTURE9 = 33993
+GL_TEXTURE10 = 33994
+GL_TEXTURE11 = 33995
+GL_TEXTURE12 = 33996
+GL_TEXTURE13 = 33997
+GL_TEXTURE14 = 33998
+GL_TEXTURE15 = 33999
+GL_TEXTURE16 = 34000
+GL_TEXTURE17 = 34001
+GL_TEXTURE18 = 34002
+GL_TEXTURE19 = 34003
+GL_TEXTURE20 = 34004
+GL_TEXTURE21 = 34005
+GL_TEXTURE22 = 34006
+GL_TEXTURE23 = 34007
+GL_TEXTURE24 = 34008
+GL_TEXTURE25 = 34009
+GL_TEXTURE26 = 34010
+GL_TEXTURE27 = 34011
+GL_TEXTURE28 = 34012
+GL_TEXTURE29 = 34013
+GL_TEXTURE30 = 34014
+GL_TEXTURE31 = 34015
+GL_ACTIVE_TEXTURE = 34016
+GL_CLIENT_ACTIVE_TEXTURE = 34017
+GL_MAX_TEXTURE_UNITS = 34018
+GL_TRANSPOSE_MODELVIEW_MATRIX = 34019
+GL_TRANSPOSE_PROJECTION_MATRIX = 34020
+GL_TRANSPOSE_TEXTURE_MATRIX = 34021
+GL_TRANSPOSE_COLOR_MATRIX = 34022
+GL_SUBTRACT = 34023
+GL_MAX_RENDERBUFFER_SIZE = 34024
+GL_MAX_RENDERBUFFER_SIZE_EXT = 34024
+GL_COMPRESSED_ALPHA = 34025
+GL_COMPRESSED_LUMINANCE = 34026
+GL_COMPRESSED_LUMINANCE_ALPHA = 34027
+GL_COMPRESSED_INTENSITY = 34028
+GL_COMPRESSED_RGB = 34029
+GL_COMPRESSED_RGBA = 34030
+GL_TEXTURE_COMPRESSION_HINT = 34031
+GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER = 34032
+GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER = 34033
+GL_TEXTURE_RECTANGLE = 34037
+GL_TEXTURE_BINDING_RECTANGLE = 34038
+GL_PROXY_TEXTURE_RECTANGLE = 34039
+GL_MAX_RECTANGLE_TEXTURE_SIZE = 34040
+GL_DEPTH_STENCIL = 34041
+GL_UNSIGNED_INT_24_8 = 34042
+GL_MAX_TEXTURE_LOD_BIAS = 34045
+GL_TEXTURE_MAX_ANISOTROPY = 34046
+GL_MAX_TEXTURE_MAX_ANISOTROPY = 34047
+GL_TEXTURE_FILTER_CONTROL = 34048
+GL_TEXTURE_LOD_BIAS = 34049
+GL_INCR_WRAP = 34055
+GL_DECR_WRAP = 34056
+GL_NORMAL_MAP = 34065
+GL_REFLECTION_MAP = 34066
+GL_TEXTURE_CUBE_MAP = 34067
+GL_TEXTURE_BINDING_CUBE_MAP = 34068
+GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069
+GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 34070
+GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 34071
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072
+GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 34073
+GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074
+GL_PROXY_TEXTURE_CUBE_MAP = 34075
+GL_MAX_CUBE_MAP_TEXTURE_SIZE = 34076
+GL_COMBINE = 34160
+GL_COMBINE_RGB = 34161
+GL_COMBINE_ALPHA = 34162
+GL_RGB_SCALE = 34163
+GL_ADD_SIGNED = 34164
+GL_INTERPOLATE = 34165
+GL_CONSTANT = 34166
+GL_PRIMARY_COLOR = 34167
+GL_PREVIOUS = 34168
+GL_SOURCE0_RGB = 34176
+GL_SRC0_RGB = 34176
+GL_SOURCE1_RGB = 34177
+GL_SRC1_RGB = 34177
+GL_SOURCE2_RGB = 34178
+GL_SRC2_RGB = 34178
+GL_SOURCE0_ALPHA = 34184
+GL_SRC0_ALPHA = 34184
+GL_SOURCE1_ALPHA = 34185
+GL_SRC1_ALPHA = 34185
+GL_SOURCE2_ALPHA = 34186
+GL_SRC2_ALPHA = 34186
+GL_OPERAND0_RGB = 34192
+GL_OPERAND1_RGB = 34193
+GL_OPERAND2_RGB = 34194
+GL_OPERAND0_ALPHA = 34200
+GL_OPERAND1_ALPHA = 34201
+GL_OPERAND2_ALPHA = 34202
+GL_VERTEX_ARRAY_BINDING = 34229
+GL_VERTEX_ATTRIB_ARRAY_ENABLED = 34338
+GL_VERTEX_ATTRIB_ARRAY_SIZE = 34339
+GL_VERTEX_ATTRIB_ARRAY_STRIDE = 34340
+GL_VERTEX_ATTRIB_ARRAY_TYPE = 34341
+GL_CURRENT_VERTEX_ATTRIB = 34342
+GL_VERTEX_PROGRAM_POINT_SIZE = 34370
+GL_PROGRAM_POINT_SIZE = 34370
+GL_VERTEX_PROGRAM_TWO_SIDE = 34371
+GL_VERTEX_ATTRIB_ARRAY_POINTER = 34373
+GL_DEPTH_CLAMP = 34383
+GL_TEXTURE_COMPRESSED_IMAGE_SIZE = 34464
+GL_TEXTURE_COMPRESSED = 34465
+GL_NUM_COMPRESSED_TEXTURE_FORMATS = 34466
+GL_COMPRESSED_TEXTURE_FORMATS = 34467
+GL_DOT3_RGB = 34478
+GL_DOT3_RGBA = 34479
+GL_PROGRAM_BINARY_LENGTH = 34625
+GL_MIRROR_CLAMP_TO_EDGE = 34627
+GL_VERTEX_ATTRIB_ARRAY_LONG = 34638
+GL_BUFFER_SIZE = 34660
+GL_BUFFER_USAGE = 34661
+GL_NUM_PROGRAM_BINARY_FORMATS = 34814
+GL_PROGRAM_BINARY_FORMATS = 34815
+GL_STENCIL_BACK_FUNC = 34816
+GL_STENCIL_BACK_FAIL = 34817
+GL_STENCIL_BACK_PASS_DEPTH_FAIL = 34818
+GL_STENCIL_BACK_PASS_DEPTH_PASS = 34819
+GL_RGBA32F = 34836
+GL_RGB32F = 34837
+GL_RGBA16F = 34842
+GL_RGB16F = 34843
+GL_MAX_DRAW_BUFFERS = 34852
+GL_DRAW_BUFFER0 = 34853
+GL_DRAW_BUFFER1 = 34854
+GL_DRAW_BUFFER2 = 34855
+GL_DRAW_BUFFER3 = 34856
+GL_DRAW_BUFFER4 = 34857
+GL_DRAW_BUFFER5 = 34858
+GL_DRAW_BUFFER6 = 34859
+GL_DRAW_BUFFER7 = 34860
+GL_DRAW_BUFFER8 = 34861
+GL_DRAW_BUFFER9 = 34862
+GL_DRAW_BUFFER10 = 34863
+GL_DRAW_BUFFER11 = 34864
+GL_DRAW_BUFFER12 = 34865
+GL_DRAW_BUFFER13 = 34866
+GL_DRAW_BUFFER14 = 34867
+GL_DRAW_BUFFER15 = 34868
+GL_BLEND_EQUATION_ALPHA = 34877
+GL_TEXTURE_DEPTH_SIZE = 34890
+GL_DEPTH_TEXTURE_MODE = 34891
+GL_TEXTURE_COMPARE_MODE = 34892
+GL_TEXTURE_COMPARE_FUNC = 34893
+GL_COMPARE_R_TO_TEXTURE = 34894
+GL_COMPARE_REF_TO_TEXTURE = 34894
+GL_TEXTURE_CUBE_MAP_SEAMLESS = 34895
+GL_POINT_SPRITE = 34913
+GL_COORD_REPLACE = 34914
+GL_QUERY_COUNTER_BITS = 34916
+GL_CURRENT_QUERY = 34917
+GL_QUERY_RESULT = 34918
+GL_QUERY_RESULT_AVAILABLE = 34919
+GL_MAX_VERTEX_ATTRIBS = 34921
+GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 34922
+GL_MAX_TESS_CONTROL_INPUT_COMPONENTS = 34924
+GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS = 34925
+GL_MAX_TEXTURE_COORDS = 34929
+GL_MAX_TEXTURE_IMAGE_UNITS = 34930
+GL_GEOMETRY_SHADER_INVOCATIONS = 34943
+GL_ARRAY_BUFFER = 34962
+GL_ELEMENT_ARRAY_BUFFER = 34963
+GL_ARRAY_BUFFER_BINDING = 34964
+GL_ELEMENT_ARRAY_BUFFER_BINDING = 34965
+GL_VERTEX_ARRAY_BUFFER_BINDING = 34966
+GL_NORMAL_ARRAY_BUFFER_BINDING = 34967
+GL_COLOR_ARRAY_BUFFER_BINDING = 34968
+GL_INDEX_ARRAY_BUFFER_BINDING = 34969
+GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 34970
+GL_EDGE_FLAG_ARRAY_BUFFER_BINDING = 34971
+GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING = 34972
+GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING = 34973
+GL_FOG_COORD_ARRAY_BUFFER_BINDING = 34973
+GL_WEIGHT_ARRAY_BUFFER_BINDING = 34974
+GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 34975
+GL_READ_ONLY = 35000
+GL_WRITE_ONLY = 35001
+GL_READ_WRITE = 35002
+GL_BUFFER_ACCESS = 35003
+GL_BUFFER_MAPPED = 35004
+GL_BUFFER_MAP_POINTER = 35005
+GL_TIME_ELAPSED = 35007
+GL_STREAM_DRAW = 35040
+GL_STREAM_READ = 35041
+GL_STREAM_COPY = 35042
+GL_STATIC_DRAW = 35044
+GL_STATIC_READ = 35045
+GL_STATIC_COPY = 35046
+GL_DYNAMIC_DRAW = 35048
+GL_DYNAMIC_READ = 35049
+GL_DYNAMIC_COPY = 35050
+GL_PIXEL_PACK_BUFFER = 35051
+GL_PIXEL_UNPACK_BUFFER = 35052
+GL_PIXEL_PACK_BUFFER_BINDING = 35053
+GL_PIXEL_UNPACK_BUFFER_BINDING = 35055
+GL_DEPTH24_STENCIL8 = 35056
+GL_TEXTURE_STENCIL_SIZE = 35057
+GL_SRC1_COLOR = 35065
+GL_ONE_MINUS_SRC1_COLOR = 35066
+GL_ONE_MINUS_SRC1_ALPHA = 35067
+GL_MAX_DUAL_SOURCE_DRAW_BUFFERS = 35068
+GL_VERTEX_ATTRIB_ARRAY_INTEGER = 35069
+GL_VERTEX_ATTRIB_ARRAY_DIVISOR = 35070
+GL_MAX_ARRAY_TEXTURE_LAYERS = 35071
+GL_MIN_PROGRAM_TEXEL_OFFSET = 35076
+GL_MAX_PROGRAM_TEXEL_OFFSET = 35077
+GL_SAMPLES_PASSED = 35092
+GL_GEOMETRY_VERTICES_OUT = 35094
+GL_GEOMETRY_INPUT_TYPE = 35095
+GL_GEOMETRY_OUTPUT_TYPE = 35096
+GL_SAMPLER_BINDING = 35097
+GL_CLAMP_VERTEX_COLOR = 35098
+GL_CLAMP_FRAGMENT_COLOR = 35099
+GL_CLAMP_READ_COLOR = 35100
+GL_FIXED_ONLY = 35101
+GL_UNIFORM_BUFFER = 35345
+GL_UNIFORM_BUFFER_BINDING = 35368
+GL_UNIFORM_BUFFER_START = 35369
+GL_UNIFORM_BUFFER_SIZE = 35370
+GL_MAX_VERTEX_UNIFORM_BLOCKS = 35371
+GL_MAX_GEOMETRY_UNIFORM_BLOCKS = 35372
+GL_MAX_FRAGMENT_UNIFORM_BLOCKS = 35373
+GL_MAX_COMBINED_UNIFORM_BLOCKS = 35374
+GL_MAX_UNIFORM_BUFFER_BINDINGS = 35375
+GL_MAX_UNIFORM_BLOCK_SIZE = 35376
+GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 35377
+GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS = 35378
+GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 35379
+GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 35380
+GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 35381
+GL_ACTIVE_UNIFORM_BLOCKS = 35382
+GL_UNIFORM_TYPE = 35383
+GL_UNIFORM_SIZE = 35384
+GL_UNIFORM_NAME_LENGTH = 35385
+GL_UNIFORM_BLOCK_INDEX = 35386
+GL_UNIFORM_OFFSET = 35387
+GL_UNIFORM_ARRAY_STRIDE = 35388
+GL_UNIFORM_MATRIX_STRIDE = 35389
+GL_UNIFORM_IS_ROW_MAJOR = 35390
+GL_UNIFORM_BLOCK_BINDING = 35391
+GL_UNIFORM_BLOCK_DATA_SIZE = 35392
+GL_UNIFORM_BLOCK_NAME_LENGTH = 35393
+GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS = 35394
+GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 35395
+GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 35396
+GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER = 35397
+GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 35398
+GL_FRAGMENT_SHADER = 35632
+GL_VERTEX_SHADER = 35633
+GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = 35657
+GL_MAX_VERTEX_UNIFORM_COMPONENTS = 35658
+GL_MAX_VARYING_FLOATS = 35659
+GL_MAX_VARYING_COMPONENTS = 35659
+GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660
+GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661
+GL_SHADER_TYPE = 35663
+GL_FLOAT_VEC2 = 35664
+GL_FLOAT_VEC3 = 35665
+GL_FLOAT_VEC4 = 35666
+GL_INT_VEC2 = 35667
+GL_INT_VEC3 = 35668
+GL_INT_VEC4 = 35669
+GL_BOOL = 35670
+GL_BOOL_VEC2 = 35671
+GL_BOOL_VEC3 = 35672
+GL_BOOL_VEC4 = 35673
+GL_FLOAT_MAT2 = 35674
+GL_FLOAT_MAT3 = 35675
+GL_FLOAT_MAT4 = 35676
+GL_SAMPLER_1D = 35677
+GL_SAMPLER_2D = 35678
+GL_SAMPLER_3D = 35679
+GL_SAMPLER_CUBE = 35680
+GL_SAMPLER_1D_SHADOW = 35681
+GL_SAMPLER_2D_SHADOW = 35682
+GL_SAMPLER_2D_RECT = 35683
+GL_SAMPLER_2D_RECT_SHADOW = 35684
+GL_FLOAT_MAT2x3 = 35685
+GL_FLOAT_MAT2x4 = 35686
+GL_FLOAT_MAT3x2 = 35687
+GL_FLOAT_MAT3x4 = 35688
+GL_FLOAT_MAT4x2 = 35689
+GL_FLOAT_MAT4x3 = 35690
+GL_DELETE_STATUS = 35712
+GL_COMPILE_STATUS = 35713
+GL_LINK_STATUS = 35714
+GL_VALIDATE_STATUS = 35715
+GL_INFO_LOG_LENGTH = 35716
+GL_ATTACHED_SHADERS = 35717
+GL_ACTIVE_UNIFORMS = 35718
+GL_ACTIVE_UNIFORM_MAX_LENGTH = 35719
+GL_SHADER_SOURCE_LENGTH = 35720
+GL_ACTIVE_ATTRIBUTES = 35721
+GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 35722
+GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 35723
+GL_SHADING_LANGUAGE_VERSION = 35724
+GL_CURRENT_PROGRAM = 35725
+GL_IMPLEMENTATION_COLOR_READ_TYPE = 35738
+GL_IMPLEMENTATION_COLOR_READ_FORMAT = 35739
+GL_TEXTURE_RED_TYPE = 35856
+GL_TEXTURE_GREEN_TYPE = 35857
+GL_TEXTURE_BLUE_TYPE = 35858
+GL_TEXTURE_ALPHA_TYPE = 35859
+GL_TEXTURE_LUMINANCE_TYPE = 35860
+GL_TEXTURE_INTENSITY_TYPE = 35861
+GL_TEXTURE_DEPTH_TYPE = 35862
+GL_UNSIGNED_NORMALIZED = 35863
+GL_TEXTURE_1D_ARRAY = 35864
+GL_PROXY_TEXTURE_1D_ARRAY = 35865
+GL_TEXTURE_2D_ARRAY = 35866
+GL_PROXY_TEXTURE_2D_ARRAY = 35867
+GL_TEXTURE_BINDING_1D_ARRAY = 35868
+GL_TEXTURE_BINDING_2D_ARRAY = 35869
+GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 35881
+GL_TEXTURE_BUFFER = 35882
+GL_TEXTURE_BUFFER_BINDING = 35882
+GL_MAX_TEXTURE_BUFFER_SIZE = 35883
+GL_TEXTURE_BINDING_BUFFER = 35884
+GL_TEXTURE_BUFFER_DATA_STORE_BINDING = 35885
+GL_ANY_SAMPLES_PASSED = 35887
+GL_SAMPLE_SHADING = 35894
+GL_MIN_SAMPLE_SHADING_VALUE = 35895
+GL_R11F_G11F_B10F = 35898
+GL_UNSIGNED_INT_10F_11F_11F_REV = 35899
+GL_RGB9_E5 = 35901
+GL_UNSIGNED_INT_5_9_9_9_REV = 35902
+GL_TEXTURE_SHARED_SIZE = 35903
+GL_SRGB = 35904
+GL_SRGB8 = 35905
+GL_SRGB_ALPHA = 35906
+GL_SRGB8_ALPHA8 = 35907
+GL_SLUMINANCE_ALPHA = 35908
+GL_SLUMINANCE8_ALPHA8 = 35909
+GL_SLUMINANCE = 35910
+GL_SLUMINANCE8 = 35911
+GL_COMPRESSED_SRGB = 35912
+GL_COMPRESSED_SRGB_ALPHA = 35913
+GL_COMPRESSED_SLUMINANCE = 35914
+GL_COMPRESSED_SLUMINANCE_ALPHA = 35915
+GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 35958
+GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 35967
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 35968
+GL_TRANSFORM_FEEDBACK_VARYINGS = 35971
+GL_TRANSFORM_FEEDBACK_BUFFER_START = 35972
+GL_TRANSFORM_FEEDBACK_BUFFER_SIZE = 35973
+GL_PRIMITIVES_GENERATED = 35975
+GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 35976
+GL_RASTERIZER_DISCARD = 35977
+GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 35978
+GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 35979
+GL_INTERLEAVED_ATTRIBS = 35980
+GL_SEPARATE_ATTRIBS = 35981
+GL_TRANSFORM_FEEDBACK_BUFFER = 35982
+GL_TRANSFORM_FEEDBACK_BUFFER_BINDING = 35983
+GL_POINT_SPRITE_COORD_ORIGIN = 36000
+GL_LOWER_LEFT = 36001
+GL_UPPER_LEFT = 36002
+GL_STENCIL_BACK_REF = 36003
+GL_STENCIL_BACK_VALUE_MASK = 36004
+GL_STENCIL_BACK_WRITEMASK = 36005
+GL_FRAMEBUFFER_BINDING = 36006
+GL_DRAW_FRAMEBUFFER_BINDING = 36006
+GL_FRAMEBUFFER_BINDING_EXT = 36006
+GL_RENDERBUFFER_BINDING = 36007
+GL_RENDERBUFFER_BINDING_EXT = 36007
+GL_READ_FRAMEBUFFER = 36008
+GL_DRAW_FRAMEBUFFER = 36009
+GL_READ_FRAMEBUFFER_BINDING = 36010
+GL_RENDERBUFFER_SAMPLES = 36011
+GL_DEPTH_COMPONENT32F = 36012
+GL_DEPTH32F_STENCIL8 = 36013
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 36048
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = 36048
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 36049
+GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT = 36049
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 36050
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT = 36050
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 36051
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT = 36051
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 36052
+GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT = 36052
+GL_FRAMEBUFFER_COMPLETE = 36053
+GL_FRAMEBUFFER_COMPLETE_EXT = 36053
+GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054
+GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT = 36054
+GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055
+GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT = 36055
+GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT = 36057
+GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT = 36058
+GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 36059
+GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT = 36059
+GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 36060
+GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT = 36060
+GL_FRAMEBUFFER_UNSUPPORTED = 36061
+GL_FRAMEBUFFER_UNSUPPORTED_EXT = 36061
+GL_MAX_COLOR_ATTACHMENTS = 36063
+GL_MAX_COLOR_ATTACHMENTS_EXT = 36063
+GL_COLOR_ATTACHMENT0 = 36064
+GL_COLOR_ATTACHMENT0_EXT = 36064
+GL_COLOR_ATTACHMENT1 = 36065
+GL_COLOR_ATTACHMENT1_EXT = 36065
+GL_COLOR_ATTACHMENT2 = 36066
+GL_COLOR_ATTACHMENT2_EXT = 36066
+GL_COLOR_ATTACHMENT3 = 36067
+GL_COLOR_ATTACHMENT3_EXT = 36067
+GL_COLOR_ATTACHMENT4 = 36068
+GL_COLOR_ATTACHMENT4_EXT = 36068
+GL_COLOR_ATTACHMENT5 = 36069
+GL_COLOR_ATTACHMENT5_EXT = 36069
+GL_COLOR_ATTACHMENT6 = 36070
+GL_COLOR_ATTACHMENT6_EXT = 36070
+GL_COLOR_ATTACHMENT7 = 36071
+GL_COLOR_ATTACHMENT7_EXT = 36071
+GL_COLOR_ATTACHMENT8 = 36072
+GL_COLOR_ATTACHMENT8_EXT = 36072
+GL_COLOR_ATTACHMENT9 = 36073
+GL_COLOR_ATTACHMENT9_EXT = 36073
+GL_COLOR_ATTACHMENT10 = 36074
+GL_COLOR_ATTACHMENT10_EXT = 36074
+GL_COLOR_ATTACHMENT11 = 36075
+GL_COLOR_ATTACHMENT11_EXT = 36075
+GL_COLOR_ATTACHMENT12 = 36076
+GL_COLOR_ATTACHMENT12_EXT = 36076
+GL_COLOR_ATTACHMENT13 = 36077
+GL_COLOR_ATTACHMENT13_EXT = 36077
+GL_COLOR_ATTACHMENT14 = 36078
+GL_COLOR_ATTACHMENT14_EXT = 36078
+GL_COLOR_ATTACHMENT15 = 36079
+GL_COLOR_ATTACHMENT15_EXT = 36079
+GL_COLOR_ATTACHMENT16 = 36080
+GL_COLOR_ATTACHMENT17 = 36081
+GL_COLOR_ATTACHMENT18 = 36082
+GL_COLOR_ATTACHMENT19 = 36083
+GL_COLOR_ATTACHMENT20 = 36084
+GL_COLOR_ATTACHMENT21 = 36085
+GL_COLOR_ATTACHMENT22 = 36086
+GL_COLOR_ATTACHMENT23 = 36087
+GL_COLOR_ATTACHMENT24 = 36088
+GL_COLOR_ATTACHMENT25 = 36089
+GL_COLOR_ATTACHMENT26 = 36090
+GL_COLOR_ATTACHMENT27 = 36091
+GL_COLOR_ATTACHMENT28 = 36092
+GL_COLOR_ATTACHMENT29 = 36093
+GL_COLOR_ATTACHMENT30 = 36094
+GL_COLOR_ATTACHMENT31 = 36095
+GL_DEPTH_ATTACHMENT = 36096
+GL_DEPTH_ATTACHMENT_EXT = 36096
+GL_STENCIL_ATTACHMENT = 36128
+GL_STENCIL_ATTACHMENT_EXT = 36128
+GL_FRAMEBUFFER = 36160
+GL_FRAMEBUFFER_EXT = 36160
+GL_RENDERBUFFER = 36161
+GL_RENDERBUFFER_EXT = 36161
+GL_RENDERBUFFER_WIDTH = 36162
+GL_RENDERBUFFER_WIDTH_EXT = 36162
+GL_RENDERBUFFER_HEIGHT = 36163
+GL_RENDERBUFFER_HEIGHT_EXT = 36163
+GL_RENDERBUFFER_INTERNAL_FORMAT = 36164
+GL_RENDERBUFFER_INTERNAL_FORMAT_EXT = 36164
+GL_STENCIL_INDEX1 = 36166
+GL_STENCIL_INDEX1_EXT = 36166
+GL_STENCIL_INDEX4 = 36167
+GL_STENCIL_INDEX4_EXT = 36167
+GL_STENCIL_INDEX8 = 36168
+GL_STENCIL_INDEX8_EXT = 36168
+GL_STENCIL_INDEX16 = 36169
+GL_STENCIL_INDEX16_EXT = 36169
+GL_RENDERBUFFER_RED_SIZE = 36176
+GL_RENDERBUFFER_RED_SIZE_EXT = 36176
+GL_RENDERBUFFER_GREEN_SIZE = 36177
+GL_RENDERBUFFER_GREEN_SIZE_EXT = 36177
+GL_RENDERBUFFER_BLUE_SIZE = 36178
+GL_RENDERBUFFER_BLUE_SIZE_EXT = 36178
+GL_RENDERBUFFER_ALPHA_SIZE = 36179
+GL_RENDERBUFFER_ALPHA_SIZE_EXT = 36179
+GL_RENDERBUFFER_DEPTH_SIZE = 36180
+GL_RENDERBUFFER_DEPTH_SIZE_EXT = 36180
+GL_RENDERBUFFER_STENCIL_SIZE = 36181
+GL_RENDERBUFFER_STENCIL_SIZE_EXT = 36181
+GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 36182
+GL_MAX_SAMPLES = 36183
+GL_RGB565 = 36194
+GL_PRIMITIVE_RESTART_FIXED_INDEX = 36201
+GL_ANY_SAMPLES_PASSED_CONSERVATIVE = 36202
+GL_MAX_ELEMENT_INDEX = 36203
+GL_RGBA32UI = 36208
+GL_RGB32UI = 36209
+GL_RGBA16UI = 36214
+GL_RGB16UI = 36215
+GL_RGBA8UI = 36220
+GL_RGB8UI = 36221
+GL_RGBA32I = 36226
+GL_RGB32I = 36227
+GL_RGBA16I = 36232
+GL_RGB16I = 36233
+GL_RGBA8I = 36238
+GL_RGB8I = 36239
+GL_RED_INTEGER = 36244
+GL_GREEN_INTEGER = 36245
+GL_BLUE_INTEGER = 36246
+GL_ALPHA_INTEGER = 36247
+GL_RGB_INTEGER = 36248
+GL_RGBA_INTEGER = 36249
+GL_BGR_INTEGER = 36250
+GL_BGRA_INTEGER = 36251
+GL_INT_2_10_10_10_REV = 36255
+GL_FRAMEBUFFER_ATTACHMENT_LAYERED = 36263
+GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 36264
+GL_FLOAT_32_UNSIGNED_INT_24_8_REV = 36269
+GL_FRAMEBUFFER_SRGB = 36281
+GL_COMPRESSED_RED_RGTC1 = 36283
+GL_COMPRESSED_SIGNED_RED_RGTC1 = 36284
+GL_COMPRESSED_RG_RGTC2 = 36285
+GL_COMPRESSED_SIGNED_RG_RGTC2 = 36286
+GL_SAMPLER_1D_ARRAY = 36288
+GL_SAMPLER_2D_ARRAY = 36289
+GL_SAMPLER_BUFFER = 36290
+GL_SAMPLER_1D_ARRAY_SHADOW = 36291
+GL_SAMPLER_2D_ARRAY_SHADOW = 36292
+GL_SAMPLER_CUBE_SHADOW = 36293
+GL_UNSIGNED_INT_VEC2 = 36294
+GL_UNSIGNED_INT_VEC3 = 36295
+GL_UNSIGNED_INT_VEC4 = 36296
+GL_INT_SAMPLER_1D = 36297
+GL_INT_SAMPLER_2D = 36298
+GL_INT_SAMPLER_3D = 36299
+GL_INT_SAMPLER_CUBE = 36300
+GL_INT_SAMPLER_2D_RECT = 36301
+GL_INT_SAMPLER_1D_ARRAY = 36302
+GL_INT_SAMPLER_2D_ARRAY = 36303
+GL_INT_SAMPLER_BUFFER = 36304
+GL_UNSIGNED_INT_SAMPLER_1D = 36305
+GL_UNSIGNED_INT_SAMPLER_2D = 36306
+GL_UNSIGNED_INT_SAMPLER_3D = 36307
+GL_UNSIGNED_INT_SAMPLER_CUBE = 36308
+GL_UNSIGNED_INT_SAMPLER_2D_RECT = 36309
+GL_UNSIGNED_INT_SAMPLER_1D_ARRAY = 36310
+GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 36311
+GL_UNSIGNED_INT_SAMPLER_BUFFER = 36312
+GL_GEOMETRY_SHADER = 36313
+GL_MAX_GEOMETRY_UNIFORM_COMPONENTS = 36319
+GL_MAX_GEOMETRY_OUTPUT_VERTICES = 36320
+GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 36321
+GL_ACTIVE_SUBROUTINES = 36325
+GL_ACTIVE_SUBROUTINE_UNIFORMS = 36326
+GL_MAX_SUBROUTINES = 36327
+GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS = 36328
+GL_LOW_FLOAT = 36336
+GL_MEDIUM_FLOAT = 36337
+GL_HIGH_FLOAT = 36338
+GL_LOW_INT = 36339
+GL_MEDIUM_INT = 36340
+GL_HIGH_INT = 36341
+GL_SHADER_BINARY_FORMATS = 36344
+GL_NUM_SHADER_BINARY_FORMATS = 36345
+GL_SHADER_COMPILER = 36346
+GL_MAX_VERTEX_UNIFORM_VECTORS = 36347
+GL_MAX_VARYING_VECTORS = 36348
+GL_MAX_FRAGMENT_UNIFORM_VECTORS = 36349
+GL_QUERY_WAIT = 36371
+GL_QUERY_NO_WAIT = 36372
+GL_QUERY_BY_REGION_WAIT = 36373
+GL_QUERY_BY_REGION_NO_WAIT = 36374
+GL_QUERY_WAIT_INVERTED = 36375
+GL_QUERY_NO_WAIT_INVERTED = 36376
+GL_QUERY_BY_REGION_WAIT_INVERTED = 36377
+GL_QUERY_BY_REGION_NO_WAIT_INVERTED = 36378
+GL_POLYGON_OFFSET_CLAMP = 36379
+GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS = 36382
+GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS = 36383
+GL_TRANSFORM_FEEDBACK = 36386
+GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED = 36387
+GL_TRANSFORM_FEEDBACK_PAUSED = 36387
+GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE = 36388
+GL_TRANSFORM_FEEDBACK_ACTIVE = 36388
+GL_TRANSFORM_FEEDBACK_BINDING = 36389
+GL_TIMESTAMP = 36392
+GL_TEXTURE_SWIZZLE_R = 36418
+GL_TEXTURE_SWIZZLE_G = 36419
+GL_TEXTURE_SWIZZLE_B = 36420
+GL_TEXTURE_SWIZZLE_A = 36421
+GL_TEXTURE_SWIZZLE_RGBA = 36422
+GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS = 36423
+GL_ACTIVE_SUBROUTINE_MAX_LENGTH = 36424
+GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH = 36425
+GL_NUM_COMPATIBLE_SUBROUTINES = 36426
+GL_COMPATIBLE_SUBROUTINES = 36427
+GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION = 36428
+GL_FIRST_VERTEX_CONVENTION = 36429
+GL_LAST_VERTEX_CONVENTION = 36430
+GL_PROVOKING_VERTEX = 36431
+GL_SAMPLE_POSITION = 36432
+GL_SAMPLE_MASK = 36433
+GL_SAMPLE_MASK_VALUE = 36434
+GL_MAX_SAMPLE_MASK_WORDS = 36441
+GL_MAX_GEOMETRY_SHADER_INVOCATIONS = 36442
+GL_MIN_FRAGMENT_INTERPOLATION_OFFSET = 36443
+GL_MAX_FRAGMENT_INTERPOLATION_OFFSET = 36444
+GL_FRAGMENT_INTERPOLATION_OFFSET_BITS = 36445
+GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET = 36446
+GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET = 36447
+GL_MAX_TRANSFORM_FEEDBACK_BUFFERS = 36464
+GL_MAX_VERTEX_STREAMS = 36465
+GL_PATCH_VERTICES = 36466
+GL_PATCH_DEFAULT_INNER_LEVEL = 36467
+GL_PATCH_DEFAULT_OUTER_LEVEL = 36468
+GL_TESS_CONTROL_OUTPUT_VERTICES = 36469
+GL_TESS_GEN_MODE = 36470
+GL_TESS_GEN_SPACING = 36471
+GL_TESS_GEN_VERTEX_ORDER = 36472
+GL_TESS_GEN_POINT_MODE = 36473
+GL_ISOLINES = 36474
+GL_FRACTIONAL_ODD = 36475
+GL_FRACTIONAL_EVEN = 36476
+GL_MAX_PATCH_VERTICES = 36477
+GL_MAX_TESS_GEN_LEVEL = 36478
+GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS = 36479
+GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS = 36480
+GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS = 36481
+GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS = 36482
+GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS = 36483
+GL_MAX_TESS_PATCH_COMPONENTS = 36484
+GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS = 36485
+GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS = 36486
+GL_TESS_EVALUATION_SHADER = 36487
+GL_TESS_CONTROL_SHADER = 36488
+GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS = 36489
+GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS = 36490
+GL_COMPRESSED_RGBA_BPTC_UNORM = 36492
+GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 36493
+GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 36494
+GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 36495
+GL_COPY_READ_BUFFER = 36662
+GL_COPY_READ_BUFFER_BINDING = 36662
+GL_COPY_WRITE_BUFFER = 36663
+GL_COPY_WRITE_BUFFER_BINDING = 36663
+GL_MAX_IMAGE_UNITS = 36664
+GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS = 36665
+GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES = 36665
+GL_IMAGE_BINDING_NAME = 36666
+GL_IMAGE_BINDING_LEVEL = 36667
+GL_IMAGE_BINDING_LAYERED = 36668
+GL_IMAGE_BINDING_LAYER = 36669
+GL_IMAGE_BINDING_ACCESS = 36670
+GL_DRAW_INDIRECT_BUFFER = 36671
+GL_DRAW_INDIRECT_BUFFER_BINDING = 36675
+GL_DOUBLE_MAT2 = 36678
+GL_DOUBLE_MAT3 = 36679
+GL_DOUBLE_MAT4 = 36680
+GL_DOUBLE_MAT2x3 = 36681
+GL_DOUBLE_MAT2x4 = 36682
+GL_DOUBLE_MAT3x2 = 36683
+GL_DOUBLE_MAT3x4 = 36684
+GL_DOUBLE_MAT4x2 = 36685
+GL_DOUBLE_MAT4x3 = 36686
+GL_VERTEX_BINDING_BUFFER = 36687
+GL_R8_SNORM = 36756
+GL_RG8_SNORM = 36757
+GL_RGB8_SNORM = 36758
+GL_RGBA8_SNORM = 36759
+GL_R16_SNORM = 36760
+GL_RG16_SNORM = 36761
+GL_RGB16_SNORM = 36762
+GL_RGBA16_SNORM = 36763
+GL_SIGNED_NORMALIZED = 36764
+GL_PRIMITIVE_RESTART = 36765
+GL_PRIMITIVE_RESTART_INDEX = 36766
+GL_DOUBLE_VEC2 = 36860
+GL_DOUBLE_VEC3 = 36861
+GL_DOUBLE_VEC4 = 36862
+GL_TEXTURE_CUBE_MAP_ARRAY = 36873
+GL_TEXTURE_BINDING_CUBE_MAP_ARRAY = 36874
+GL_PROXY_TEXTURE_CUBE_MAP_ARRAY = 36875
+GL_SAMPLER_CUBE_MAP_ARRAY = 36876
+GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW = 36877
+GL_INT_SAMPLER_CUBE_MAP_ARRAY = 36878
+GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = 36879
+GL_IMAGE_1D = 36940
+GL_IMAGE_2D = 36941
+GL_IMAGE_3D = 36942
+GL_IMAGE_2D_RECT = 36943
+GL_IMAGE_CUBE = 36944
+GL_IMAGE_BUFFER = 36945
+GL_IMAGE_1D_ARRAY = 36946
+GL_IMAGE_2D_ARRAY = 36947
+GL_IMAGE_CUBE_MAP_ARRAY = 36948
+GL_IMAGE_2D_MULTISAMPLE = 36949
+GL_IMAGE_2D_MULTISAMPLE_ARRAY = 36950
+GL_INT_IMAGE_1D = 36951
+GL_INT_IMAGE_2D = 36952
+GL_INT_IMAGE_3D = 36953
+GL_INT_IMAGE_2D_RECT = 36954
+GL_INT_IMAGE_CUBE = 36955
+GL_INT_IMAGE_BUFFER = 36956
+GL_INT_IMAGE_1D_ARRAY = 36957
+GL_INT_IMAGE_2D_ARRAY = 36958
+GL_INT_IMAGE_CUBE_MAP_ARRAY = 36959
+GL_INT_IMAGE_2D_MULTISAMPLE = 36960
+GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 36961
+GL_UNSIGNED_INT_IMAGE_1D = 36962
+GL_UNSIGNED_INT_IMAGE_2D = 36963
+GL_UNSIGNED_INT_IMAGE_3D = 36964
+GL_UNSIGNED_INT_IMAGE_2D_RECT = 36965
+GL_UNSIGNED_INT_IMAGE_CUBE = 36966
+GL_UNSIGNED_INT_IMAGE_BUFFER = 36967
+GL_UNSIGNED_INT_IMAGE_1D_ARRAY = 36968
+GL_UNSIGNED_INT_IMAGE_2D_ARRAY = 36969
+GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY = 36970
+GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE = 36971
+GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 36972
+GL_MAX_IMAGE_SAMPLES = 36973
+GL_IMAGE_BINDING_FORMAT = 36974
+GL_RGB10_A2UI = 36975
+GL_MIN_MAP_BUFFER_ALIGNMENT = 37052
+GL_IMAGE_FORMAT_COMPATIBILITY_TYPE = 37063
+GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE = 37064
+GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS = 37065
+GL_MAX_VERTEX_IMAGE_UNIFORMS = 37066
+GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS = 37067
+GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS = 37068
+GL_MAX_GEOMETRY_IMAGE_UNIFORMS = 37069
+GL_MAX_FRAGMENT_IMAGE_UNIFORMS = 37070
+GL_MAX_COMBINED_IMAGE_UNIFORMS = 37071
+GL_SHADER_STORAGE_BUFFER = 37074
+GL_SHADER_STORAGE_BUFFER_BINDING = 37075
+GL_SHADER_STORAGE_BUFFER_START = 37076
+GL_SHADER_STORAGE_BUFFER_SIZE = 37077
+GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS = 37078
+GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS = 37079
+GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS = 37080
+GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS = 37081
+GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS = 37082
+GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS = 37083
+GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS = 37084
+GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS = 37085
+GL_MAX_SHADER_STORAGE_BLOCK_SIZE = 37086
+GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT = 37087
+GL_DEPTH_STENCIL_TEXTURE_MODE = 37098
+GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS = 37099
+GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER = 37100
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER = 37101
+GL_DISPATCH_INDIRECT_BUFFER = 37102
+GL_DISPATCH_INDIRECT_BUFFER_BINDING = 37103
+GL_TEXTURE_2D_MULTISAMPLE = 37120
+GL_PROXY_TEXTURE_2D_MULTISAMPLE = 37121
+GL_TEXTURE_2D_MULTISAMPLE_ARRAY = 37122
+GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY = 37123
+GL_TEXTURE_BINDING_2D_MULTISAMPLE = 37124
+GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY = 37125
+GL_TEXTURE_SAMPLES = 37126
+GL_TEXTURE_FIXED_SAMPLE_LOCATIONS = 37127
+GL_SAMPLER_2D_MULTISAMPLE = 37128
+GL_INT_SAMPLER_2D_MULTISAMPLE = 37129
+GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE = 37130
+GL_SAMPLER_2D_MULTISAMPLE_ARRAY = 37131
+GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 37132
+GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 37133
+GL_MAX_COLOR_TEXTURE_SAMPLES = 37134
+GL_MAX_DEPTH_TEXTURE_SAMPLES = 37135
+GL_MAX_INTEGER_SAMPLES = 37136
+GL_MAX_SERVER_WAIT_TIMEOUT = 37137
+GL_OBJECT_TYPE = 37138
+GL_SYNC_CONDITION = 37139
+GL_SYNC_STATUS = 37140
+GL_SYNC_FLAGS = 37141
+GL_SYNC_FENCE = 37142
+GL_SYNC_GPU_COMMANDS_COMPLETE = 37143
+GL_UNSIGNALED = 37144
+GL_SIGNALED = 37145
+GL_ALREADY_SIGNALED = 37146
+GL_TIMEOUT_EXPIRED = 37147
+GL_CONDITION_SATISFIED = 37148
+GL_WAIT_FAILED = 37149
+GL_BUFFER_ACCESS_FLAGS = 37151
+GL_BUFFER_MAP_LENGTH = 37152
+GL_BUFFER_MAP_OFFSET = 37153
+GL_MAX_VERTEX_OUTPUT_COMPONENTS = 37154
+GL_MAX_GEOMETRY_INPUT_COMPONENTS = 37155
+GL_MAX_GEOMETRY_OUTPUT_COMPONENTS = 37156
+GL_MAX_FRAGMENT_INPUT_COMPONENTS = 37157
+GL_CONTEXT_PROFILE_MASK = 37158
+GL_UNPACK_COMPRESSED_BLOCK_WIDTH = 37159
+GL_UNPACK_COMPRESSED_BLOCK_HEIGHT = 37160
+GL_UNPACK_COMPRESSED_BLOCK_DEPTH = 37161
+GL_UNPACK_COMPRESSED_BLOCK_SIZE = 37162
+GL_PACK_COMPRESSED_BLOCK_WIDTH = 37163
+GL_PACK_COMPRESSED_BLOCK_HEIGHT = 37164
+GL_PACK_COMPRESSED_BLOCK_DEPTH = 37165
+GL_PACK_COMPRESSED_BLOCK_SIZE = 37166
+GL_TEXTURE_IMMUTABLE_FORMAT = 37167
+GL_MAX_DEBUG_MESSAGE_LENGTH = 37187
+GL_MAX_DEBUG_LOGGED_MESSAGES = 37188
+GL_DEBUG_LOGGED_MESSAGES = 37189
+GL_DEBUG_SEVERITY_HIGH = 37190
+GL_DEBUG_SEVERITY_MEDIUM = 37191
+GL_DEBUG_SEVERITY_LOW = 37192
+GL_QUERY_BUFFER = 37266
+GL_QUERY_BUFFER_BINDING = 37267
+GL_QUERY_RESULT_NO_WAIT = 37268
+GL_TEXTURE_BUFFER_OFFSET = 37277
+GL_TEXTURE_BUFFER_SIZE = 37278
+GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT = 37279
+GL_COMPUTE_SHADER = 37305
+GL_MAX_COMPUTE_UNIFORM_BLOCKS = 37307
+GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS = 37308
+GL_MAX_COMPUTE_IMAGE_UNIFORMS = 37309
+GL_MAX_COMPUTE_WORK_GROUP_COUNT = 37310
+GL_MAX_COMPUTE_WORK_GROUP_SIZE = 37311
+GL_COMPRESSED_R11_EAC = 37488
+GL_COMPRESSED_SIGNED_R11_EAC = 37489
+GL_COMPRESSED_RG11_EAC = 37490
+GL_COMPRESSED_SIGNED_RG11_EAC = 37491
+GL_COMPRESSED_RGB8_ETC2 = 37492
+GL_COMPRESSED_SRGB8_ETC2 = 37493
+GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494
+GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495
+GL_COMPRESSED_RGBA8_ETC2_EAC = 37496
+GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497
+GL_ATOMIC_COUNTER_BUFFER = 37568
+GL_ATOMIC_COUNTER_BUFFER_BINDING = 37569
+GL_ATOMIC_COUNTER_BUFFER_START = 37570
+GL_ATOMIC_COUNTER_BUFFER_SIZE = 37571
+GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE = 37572
+GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS = 37573
+GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES = 37574
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER = 37575
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER = 37576
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER = 37577
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER = 37578
+GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER = 37579
+GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS = 37580
+GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS = 37581
+GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS = 37582
+GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS = 37583
+GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS = 37584
+GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS = 37585
+GL_MAX_VERTEX_ATOMIC_COUNTERS = 37586
+GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS = 37587
+GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS = 37588
+GL_MAX_GEOMETRY_ATOMIC_COUNTERS = 37589
+GL_MAX_FRAGMENT_ATOMIC_COUNTERS = 37590
+GL_MAX_COMBINED_ATOMIC_COUNTERS = 37591
+GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE = 37592
+GL_ACTIVE_ATOMIC_COUNTER_BUFFERS = 37593
+GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX = 37594
+GL_UNSIGNED_INT_ATOMIC_COUNTER = 37595
+GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS = 37596
+GL_DEBUG_OUTPUT = 37600
+GL_UNIFORM = 37601
+GL_UNIFORM_BLOCK = 37602
+GL_PROGRAM_INPUT = 37603
+GL_PROGRAM_OUTPUT = 37604
+GL_BUFFER_VARIABLE = 37605
+GL_SHADER_STORAGE_BLOCK = 37606
+GL_IS_PER_PATCH = 37607
+GL_VERTEX_SUBROUTINE = 37608
+GL_TESS_CONTROL_SUBROUTINE = 37609
+GL_TESS_EVALUATION_SUBROUTINE = 37610
+GL_GEOMETRY_SUBROUTINE = 37611
+GL_FRAGMENT_SUBROUTINE = 37612
+GL_COMPUTE_SUBROUTINE = 37613
+GL_VERTEX_SUBROUTINE_UNIFORM = 37614
+GL_TESS_CONTROL_SUBROUTINE_UNIFORM = 37615
+GL_TESS_EVALUATION_SUBROUTINE_UNIFORM = 37616
+GL_GEOMETRY_SUBROUTINE_UNIFORM = 37617
+GL_FRAGMENT_SUBROUTINE_UNIFORM = 37618
+GL_COMPUTE_SUBROUTINE_UNIFORM = 37619
+GL_TRANSFORM_FEEDBACK_VARYING = 37620
+GL_ACTIVE_RESOURCES = 37621
+GL_MAX_NAME_LENGTH = 37622
+GL_MAX_NUM_ACTIVE_VARIABLES = 37623
+GL_MAX_NUM_COMPATIBLE_SUBROUTINES = 37624
+GL_NAME_LENGTH = 37625
+GL_TYPE = 37626
+GL_ARRAY_SIZE = 37627
+GL_OFFSET = 37628
+GL_BLOCK_INDEX = 37629
+GL_ARRAY_STRIDE = 37630
+GL_MATRIX_STRIDE = 37631
+GL_IS_ROW_MAJOR = 37632
+GL_ATOMIC_COUNTER_BUFFER_INDEX = 37633
+GL_BUFFER_BINDING = 37634
+GL_BUFFER_DATA_SIZE = 37635
+GL_NUM_ACTIVE_VARIABLES = 37636
+GL_ACTIVE_VARIABLES = 37637
+GL_REFERENCED_BY_VERTEX_SHADER = 37638
+GL_REFERENCED_BY_TESS_CONTROL_SHADER = 37639
+GL_REFERENCED_BY_TESS_EVALUATION_SHADER = 37640
+GL_REFERENCED_BY_GEOMETRY_SHADER = 37641
+GL_REFERENCED_BY_FRAGMENT_SHADER = 37642
+GL_REFERENCED_BY_COMPUTE_SHADER = 37643
+GL_TOP_LEVEL_ARRAY_SIZE = 37644
+GL_TOP_LEVEL_ARRAY_STRIDE = 37645
+GL_LOCATION = 37646
+GL_LOCATION_INDEX = 37647
+GL_FRAMEBUFFER_DEFAULT_WIDTH = 37648
+GL_FRAMEBUFFER_DEFAULT_HEIGHT = 37649
+GL_FRAMEBUFFER_DEFAULT_LAYERS = 37650
+GL_FRAMEBUFFER_DEFAULT_SAMPLES = 37651
+GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS = 37652
+GL_MAX_FRAMEBUFFER_WIDTH = 37653
+GL_MAX_FRAMEBUFFER_HEIGHT = 37654
+GL_MAX_FRAMEBUFFER_LAYERS = 37655
+GL_MAX_FRAMEBUFFER_SAMPLES = 37656
+GL_LOCATION_COMPONENT = 37706
+GL_TRANSFORM_FEEDBACK_BUFFER_INDEX = 37707
+GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE = 37708
+GL_CLIP_ORIGIN = 37724
+GL_CLIP_DEPTH_MODE = 37725
+GL_NEGATIVE_ONE_TO_ONE = 37726
+GL_ZERO_TO_ONE = 37727
+GL_CLEAR_TEXTURE = 37733
+GL_NUM_SAMPLE_COUNTS = 37760
+GL_SHADER_BINARY_FORMAT_SPIR_V = 38225
+GL_SPIR_V_BINARY = 38226
+GL_SPIR_V_EXTENSIONS = 38227
+GL_NUM_SPIR_V_EXTENSIONS = 38228
+GL_EVAL_BIT = 65536
+GL_LIST_BIT = 131072
+GL_TEXTURE_BIT = 262144
+GL_SCISSOR_BIT = 524288
+GL_MULTISAMPLE_BIT = 536870912
+GL_MULTISAMPLE_BIT_ARB = 536870912
+GL_ALL_ATTRIB_BITS = 4294967295
+GL_CLIENT_ALL_ATTRIB_BITS = 4294967295
+GL_INVALID_INDEX = 4294967295
+GL_ALL_SHADER_BITS = 4294967295
+GL_ALL_BARRIER_BITS = 4294967295
+GL_TIMEOUT_IGNORED = 18446744073709551615
+
+# GL command definitions
+glAccum = _link_function('glAccum', None, [GLenum, GLfloat], requires='OpenGL 1.0')
+glActiveShaderProgram = _link_function('glActiveShaderProgram', None, [GLuint, GLuint], requires='OpenGL 4.1')
+glActiveTexture = _link_function('glActiveTexture', None, [GLenum], requires='OpenGL 1.3')
+glAlphaFunc = _link_function('glAlphaFunc', None, [GLenum, GLfloat], requires='OpenGL 1.0')
+glAreTexturesResident = _link_function('glAreTexturesResident', GLboolean, [GLsizei, POINTER(GLuint), POINTER(GLboolean)], requires='OpenGL 1.1')
+glArrayElement = _link_function('glArrayElement', None, [GLint], requires='OpenGL 1.1')
+glAttachShader = _link_function('glAttachShader', None, [GLuint, GLuint], requires='OpenGL 2.0')
+glBegin = _link_function('glBegin', None, [GLenum], requires='OpenGL 1.0')
+glBeginConditionalRender = _link_function('glBeginConditionalRender', None, [GLuint, GLenum], requires='OpenGL 3.0')
+glBeginQuery = _link_function('glBeginQuery', None, [GLenum, GLuint], requires='OpenGL 1.5')
+glBeginQueryIndexed = _link_function('glBeginQueryIndexed', None, [GLenum, GLuint, GLuint], requires='OpenGL 4.0')
+glBeginTransformFeedback = _link_function('glBeginTransformFeedback', None, [GLenum], requires='OpenGL 3.0')
+glBindAttribLocation = _link_function('glBindAttribLocation', None, [GLuint, GLuint, POINTER(GLchar)], requires='OpenGL 2.0')
+glBindBuffer = _link_function('glBindBuffer', None, [GLenum, GLuint], requires='OpenGL 1.5')
+glBindBufferBase = _link_function('glBindBufferBase', None, [GLenum, GLuint, GLuint], requires='OpenGL 3.1')
+glBindBufferRange = _link_function('glBindBufferRange', None, [GLenum, GLuint, GLuint, GLintptr, GLsizeiptr], requires='OpenGL 3.1')
+glBindBuffersBase = _link_function('glBindBuffersBase', None, [GLenum, GLuint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.4')
+glBindBuffersRange = _link_function('glBindBuffersRange', None, [GLenum, GLuint, GLsizei, POINTER(GLuint), POINTER(GLintptr), POINTER(GLsizeiptr)], requires='OpenGL 4.4')
+glBindFragDataLocation = _link_function('glBindFragDataLocation', None, [GLuint, GLuint, POINTER(GLchar)], requires='OpenGL 3.0')
+glBindFragDataLocationIndexed = _link_function('glBindFragDataLocationIndexed', None, [GLuint, GLuint, GLuint, POINTER(GLchar)], requires='OpenGL 3.3')
+glBindFramebuffer = _link_function('glBindFramebuffer', None, [GLenum, GLuint], requires='OpenGL 3.0')
+glBindFramebufferEXT = _link_function('glBindFramebufferEXT', None, [GLenum, GLuint], requires='None')
+glBindImageTexture = _link_function('glBindImageTexture', None, [GLuint, GLuint, GLint, GLboolean, GLint, GLenum, GLenum], requires='OpenGL 4.2')
+glBindImageTextures = _link_function('glBindImageTextures', None, [GLuint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.4')
+glBindProgramPipeline = _link_function('glBindProgramPipeline', None, [GLuint], requires='OpenGL 4.1')
+glBindRenderbuffer = _link_function('glBindRenderbuffer', None, [GLenum, GLuint], requires='OpenGL 3.0')
+glBindRenderbufferEXT = _link_function('glBindRenderbufferEXT', None, [GLenum, GLuint], requires='None')
+glBindSampler = _link_function('glBindSampler', None, [GLuint, GLuint], requires='OpenGL 3.3')
+glBindSamplers = _link_function('glBindSamplers', None, [GLuint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.4')
+glBindTexture = _link_function('glBindTexture', None, [GLenum, GLuint], requires='OpenGL 1.1')
+glBindTextureUnit = _link_function('glBindTextureUnit', None, [GLuint, GLuint], requires='OpenGL 4.5')
+glBindTextures = _link_function('glBindTextures', None, [GLuint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.4')
+glBindTransformFeedback = _link_function('glBindTransformFeedback', None, [GLenum, GLuint], requires='OpenGL 4.0')
+glBindVertexArray = _link_function('glBindVertexArray', None, [GLuint], requires='OpenGL 3.0')
+glBindVertexBuffer = _link_function('glBindVertexBuffer', None, [GLuint, GLuint, GLintptr, GLsizei], requires='OpenGL 4.3')
+glBindVertexBuffers = _link_function('glBindVertexBuffers', None, [GLuint, GLsizei, POINTER(GLuint), POINTER(GLintptr), POINTER(GLsizei)], requires='OpenGL 4.4')
+glBitmap = _link_function('glBitmap', None, [GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, POINTER(GLubyte)], requires='OpenGL 1.0')
+glBlendColor = _link_function('glBlendColor', None, [GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.4')
+glBlendEquation = _link_function('glBlendEquation', None, [GLenum], requires='OpenGL 1.4')
+glBlendEquationSeparate = _link_function('glBlendEquationSeparate', None, [GLenum, GLenum], requires='OpenGL 2.0')
+glBlendEquationSeparatei = _link_function('glBlendEquationSeparatei', None, [GLuint, GLenum, GLenum], requires='OpenGL 4.0')
+glBlendEquationi = _link_function('glBlendEquationi', None, [GLuint, GLenum], requires='OpenGL 4.0')
+glBlendFunc = _link_function('glBlendFunc', None, [GLenum, GLenum], requires='OpenGL 1.0')
+glBlendFuncSeparate = _link_function('glBlendFuncSeparate', None, [GLenum, GLenum, GLenum, GLenum], requires='OpenGL 1.4')
+glBlendFuncSeparatei = _link_function('glBlendFuncSeparatei', None, [GLuint, GLenum, GLenum, GLenum, GLenum], requires='OpenGL 4.0')
+glBlendFunci = _link_function('glBlendFunci', None, [GLuint, GLenum, GLenum], requires='OpenGL 4.0')
+glBlitFramebuffer = _link_function('glBlitFramebuffer', None, [GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum], requires='OpenGL 3.0')
+glBlitNamedFramebuffer = _link_function('glBlitNamedFramebuffer', None, [GLuint, GLuint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum], requires='OpenGL 4.5')
+glBufferData = _link_function('glBufferData', None, [GLenum, GLsizeiptr, POINTER(GLvoid), GLenum], requires='OpenGL 1.5')
+glBufferStorage = _link_function('glBufferStorage', None, [GLenum, GLsizeiptr, POINTER(GLvoid), GLbitfield], requires='OpenGL 4.4')
+glBufferSubData = _link_function('glBufferSubData', None, [GLenum, GLintptr, GLsizeiptr, POINTER(GLvoid)], requires='OpenGL 1.5')
+glCallList = _link_function('glCallList', None, [GLuint], requires='OpenGL 1.0')
+glCallLists = _link_function('glCallLists', None, [GLsizei, GLenum, POINTER(GLvoid)], requires='OpenGL 1.0')
+glCheckFramebufferStatus = _link_function('glCheckFramebufferStatus', GLenum, [GLenum], requires='OpenGL 3.0')
+glCheckFramebufferStatusEXT = _link_function('glCheckFramebufferStatusEXT', GLenum, [GLenum], requires='None')
+glCheckNamedFramebufferStatus = _link_function('glCheckNamedFramebufferStatus', GLenum, [GLuint, GLenum], requires='OpenGL 4.5')
+glClampColor = _link_function('glClampColor', None, [GLenum, GLenum], requires='OpenGL 3.0')
+glClear = _link_function('glClear', None, [GLbitfield], requires='OpenGL 1.0')
+glClearAccum = _link_function('glClearAccum', None, [GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glClearBufferData = _link_function('glClearBufferData', None, [GLenum, GLenum, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.3')
+glClearBufferSubData = _link_function('glClearBufferSubData', None, [GLenum, GLenum, GLintptr, GLsizeiptr, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.3')
+glClearBufferfi = _link_function('glClearBufferfi', None, [GLenum, GLint, GLfloat, GLint], requires='OpenGL 3.0')
+glClearBufferfv = _link_function('glClearBufferfv', None, [GLenum, GLint, POINTER(GLfloat)], requires='OpenGL 3.0')
+glClearBufferiv = _link_function('glClearBufferiv', None, [GLenum, GLint, POINTER(GLint)], requires='OpenGL 3.0')
+glClearBufferuiv = _link_function('glClearBufferuiv', None, [GLenum, GLint, POINTER(GLuint)], requires='OpenGL 3.0')
+glClearColor = _link_function('glClearColor', None, [GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glClearDepth = _link_function('glClearDepth', None, [GLdouble], requires='OpenGL 1.0')
+glClearDepthf = _link_function('glClearDepthf', None, [GLfloat], requires='OpenGL 4.1')
+glClearIndex = _link_function('glClearIndex', None, [GLfloat], requires='OpenGL 1.0')
+glClearNamedBufferData = _link_function('glClearNamedBufferData', None, [GLuint, GLenum, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.5')
+glClearNamedBufferSubData = _link_function('glClearNamedBufferSubData', None, [GLuint, GLenum, GLintptr, GLsizeiptr, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.5')
+glClearNamedFramebufferfi = _link_function('glClearNamedFramebufferfi', None, [GLuint, GLenum, GLint, GLfloat, GLint], requires='OpenGL 4.5')
+glClearNamedFramebufferfv = _link_function('glClearNamedFramebufferfv', None, [GLuint, GLenum, GLint, POINTER(GLfloat)], requires='OpenGL 4.5')
+glClearNamedFramebufferiv = _link_function('glClearNamedFramebufferiv', None, [GLuint, GLenum, GLint, POINTER(GLint)], requires='OpenGL 4.5')
+glClearNamedFramebufferuiv = _link_function('glClearNamedFramebufferuiv', None, [GLuint, GLenum, GLint, POINTER(GLuint)], requires='OpenGL 4.5')
+glClearStencil = _link_function('glClearStencil', None, [GLint], requires='OpenGL 1.0')
+glClearTexImage = _link_function('glClearTexImage', None, [GLuint, GLint, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.4')
+glClearTexSubImage = _link_function('glClearTexSubImage', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.4')
+glClientActiveTexture = _link_function('glClientActiveTexture', None, [GLenum], requires='OpenGL 1.3')
+glClientWaitSync = _link_function('glClientWaitSync', GLenum, [GLsync, GLbitfield, GLuint64], requires='OpenGL 3.2')
+glClipControl = _link_function('glClipControl', None, [GLenum, GLenum], requires='OpenGL 4.5')
+glClipPlane = _link_function('glClipPlane', None, [GLenum, POINTER(GLdouble)], requires='OpenGL 1.0')
+glColor3b = _link_function('glColor3b', None, [GLbyte, GLbyte, GLbyte], requires='OpenGL 1.0')
+glColor3bv = _link_function('glColor3bv', None, [POINTER(GLbyte)], requires='OpenGL 1.0')
+glColor3d = _link_function('glColor3d', None, [GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glColor3dv = _link_function('glColor3dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glColor3f = _link_function('glColor3f', None, [GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glColor3fv = _link_function('glColor3fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glColor3i = _link_function('glColor3i', None, [GLint, GLint, GLint], requires='OpenGL 1.0')
+glColor3iv = _link_function('glColor3iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glColor3s = _link_function('glColor3s', None, [GLshort, GLshort, GLshort], requires='OpenGL 1.0')
+glColor3sv = _link_function('glColor3sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glColor3ub = _link_function('glColor3ub', None, [GLubyte, GLubyte, GLubyte], requires='OpenGL 1.0')
+glColor3ubv = _link_function('glColor3ubv', None, [POINTER(GLubyte)], requires='OpenGL 1.0')
+glColor3ui = _link_function('glColor3ui', None, [GLuint, GLuint, GLuint], requires='OpenGL 1.0')
+glColor3uiv = _link_function('glColor3uiv', None, [POINTER(GLuint)], requires='OpenGL 1.0')
+glColor3us = _link_function('glColor3us', None, [GLushort, GLushort, GLushort], requires='OpenGL 1.0')
+glColor3usv = _link_function('glColor3usv', None, [POINTER(GLushort)], requires='OpenGL 1.0')
+glColor4b = _link_function('glColor4b', None, [GLbyte, GLbyte, GLbyte, GLbyte], requires='OpenGL 1.0')
+glColor4bv = _link_function('glColor4bv', None, [POINTER(GLbyte)], requires='OpenGL 1.0')
+glColor4d = _link_function('glColor4d', None, [GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glColor4dv = _link_function('glColor4dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glColor4f = _link_function('glColor4f', None, [GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glColor4fv = _link_function('glColor4fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glColor4i = _link_function('glColor4i', None, [GLint, GLint, GLint, GLint], requires='OpenGL 1.0')
+glColor4iv = _link_function('glColor4iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glColor4s = _link_function('glColor4s', None, [GLshort, GLshort, GLshort, GLshort], requires='OpenGL 1.0')
+glColor4sv = _link_function('glColor4sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glColor4ub = _link_function('glColor4ub', None, [GLubyte, GLubyte, GLubyte, GLubyte], requires='OpenGL 1.0')
+glColor4ubv = _link_function('glColor4ubv', None, [POINTER(GLubyte)], requires='OpenGL 1.0')
+glColor4ui = _link_function('glColor4ui', None, [GLuint, GLuint, GLuint, GLuint], requires='OpenGL 1.0')
+glColor4uiv = _link_function('glColor4uiv', None, [POINTER(GLuint)], requires='OpenGL 1.0')
+glColor4us = _link_function('glColor4us', None, [GLushort, GLushort, GLushort, GLushort], requires='OpenGL 1.0')
+glColor4usv = _link_function('glColor4usv', None, [POINTER(GLushort)], requires='OpenGL 1.0')
+glColorMask = _link_function('glColorMask', None, [GLboolean, GLboolean, GLboolean, GLboolean], requires='OpenGL 1.0')
+glColorMaski = _link_function('glColorMaski', None, [GLuint, GLboolean, GLboolean, GLboolean, GLboolean], requires='OpenGL 3.0')
+glColorMaterial = _link_function('glColorMaterial', None, [GLenum, GLenum], requires='OpenGL 1.0')
+glColorP3ui = _link_function('glColorP3ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glColorP3uiv = _link_function('glColorP3uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glColorP4ui = _link_function('glColorP4ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glColorP4uiv = _link_function('glColorP4uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glColorPointer = _link_function('glColorPointer', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.1')
+glCompileShader = _link_function('glCompileShader', None, [GLuint], requires='OpenGL 2.0')
+glCompressedTexImage1D = _link_function('glCompressedTexImage1D', None, [GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.3')
+glCompressedTexImage2D = _link_function('glCompressedTexImage2D', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.3')
+glCompressedTexImage3D = _link_function('glCompressedTexImage3D', None, [GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.3')
+glCompressedTexSubImage1D = _link_function('glCompressedTexSubImage1D', None, [GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.3')
+glCompressedTexSubImage2D = _link_function('glCompressedTexSubImage2D', None, [GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.3')
+glCompressedTexSubImage3D = _link_function('glCompressedTexSubImage3D', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.3')
+glCompressedTextureSubImage1D = _link_function('glCompressedTextureSubImage1D', None, [GLuint, GLint, GLint, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glCompressedTextureSubImage2D = _link_function('glCompressedTextureSubImage2D', None, [GLuint, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glCompressedTextureSubImage3D = _link_function('glCompressedTextureSubImage3D', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glCopyBufferSubData = _link_function('glCopyBufferSubData', None, [GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr], requires='OpenGL 3.1')
+glCopyImageSubData = _link_function('glCopyImageSubData', None, [GLuint, GLenum, GLint, GLint, GLint, GLint, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei], requires='OpenGL 4.3')
+glCopyNamedBufferSubData = _link_function('glCopyNamedBufferSubData', None, [GLuint, GLuint, GLintptr, GLintptr, GLsizeiptr], requires='OpenGL 4.5')
+glCopyPixels = _link_function('glCopyPixels', None, [GLint, GLint, GLsizei, GLsizei, GLenum], requires='OpenGL 1.0')
+glCopyTexImage1D = _link_function('glCopyTexImage1D', None, [GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint], requires='OpenGL 1.1')
+glCopyTexImage2D = _link_function('glCopyTexImage2D', None, [GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint], requires='OpenGL 1.1')
+glCopyTexSubImage1D = _link_function('glCopyTexSubImage1D', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei], requires='OpenGL 1.1')
+glCopyTexSubImage2D = _link_function('glCopyTexSubImage2D', None, [GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], requires='OpenGL 1.1')
+glCopyTexSubImage3D = _link_function('glCopyTexSubImage3D', None, [GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], requires='OpenGL 1.2')
+glCopyTextureSubImage1D = _link_function('glCopyTextureSubImage1D', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei], requires='OpenGL 4.5')
+glCopyTextureSubImage2D = _link_function('glCopyTextureSubImage2D', None, [GLuint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], requires='OpenGL 4.5')
+glCopyTextureSubImage3D = _link_function('glCopyTextureSubImage3D', None, [GLuint, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei], requires='OpenGL 4.5')
+glCreateBuffers = _link_function('glCreateBuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateFramebuffers = _link_function('glCreateFramebuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateProgram = _link_function('glCreateProgram', GLuint, [], requires='OpenGL 2.0')
+glCreateProgramPipelines = _link_function('glCreateProgramPipelines', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateQueries = _link_function('glCreateQueries', None, [GLenum, GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateRenderbuffers = _link_function('glCreateRenderbuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateSamplers = _link_function('glCreateSamplers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateShader = _link_function('glCreateShader', GLuint, [GLenum], requires='OpenGL 2.0')
+glCreateShaderProgramv = _link_function('glCreateShaderProgramv', GLuint, [GLenum, GLsizei, POINTER(POINTER(GLchar))], requires='OpenGL 4.1')
+glCreateTextures = _link_function('glCreateTextures', None, [GLenum, GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateTransformFeedbacks = _link_function('glCreateTransformFeedbacks', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCreateVertexArrays = _link_function('glCreateVertexArrays', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glCullFace = _link_function('glCullFace', None, [GLenum], requires='OpenGL 1.0')
+glDebugMessageCallback = _link_function('glDebugMessageCallback', None, [GLDEBUGPROC, POINTER(GLvoid)], requires='OpenGL 4.3')
+glDebugMessageControl = _link_function('glDebugMessageControl', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLuint), GLboolean], requires='OpenGL 4.3')
+glDebugMessageInsert = _link_function('glDebugMessageInsert', None, [GLenum, GLenum, GLuint, GLenum, GLsizei, POINTER(GLchar)], requires='OpenGL 4.3')
+glDeleteBuffers = _link_function('glDeleteBuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.5')
+glDeleteFramebuffers = _link_function('glDeleteFramebuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glDeleteFramebuffersEXT = _link_function('glDeleteFramebuffersEXT', None, [GLsizei, POINTER(GLuint)], requires='None')
+glDeleteLists = _link_function('glDeleteLists', None, [GLuint, GLsizei], requires='OpenGL 1.0')
+glDeleteProgram = _link_function('glDeleteProgram', None, [GLuint], requires='OpenGL 2.0')
+glDeleteProgramPipelines = _link_function('glDeleteProgramPipelines', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.1')
+glDeleteQueries = _link_function('glDeleteQueries', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.5')
+glDeleteRenderbuffers = _link_function('glDeleteRenderbuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glDeleteRenderbuffersEXT = _link_function('glDeleteRenderbuffersEXT', None, [GLsizei, POINTER(GLuint)], requires='None')
+glDeleteSamplers = _link_function('glDeleteSamplers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.3')
+glDeleteShader = _link_function('glDeleteShader', None, [GLuint], requires='OpenGL 2.0')
+glDeleteSync = _link_function('glDeleteSync', None, [GLsync], requires='OpenGL 3.2')
+glDeleteTextures = _link_function('glDeleteTextures', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.1')
+glDeleteTransformFeedbacks = _link_function('glDeleteTransformFeedbacks', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.0')
+glDeleteVertexArrays = _link_function('glDeleteVertexArrays', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glDepthFunc = _link_function('glDepthFunc', None, [GLenum], requires='OpenGL 1.0')
+glDepthMask = _link_function('glDepthMask', None, [GLboolean], requires='OpenGL 1.0')
+glDepthRange = _link_function('glDepthRange', None, [GLdouble, GLdouble], requires='OpenGL 1.0')
+glDepthRangeArrayv = _link_function('glDepthRangeArrayv', None, [GLuint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.1')
+glDepthRangeIndexed = _link_function('glDepthRangeIndexed', None, [GLuint, GLdouble, GLdouble], requires='OpenGL 4.1')
+glDepthRangef = _link_function('glDepthRangef', None, [GLfloat, GLfloat], requires='OpenGL 4.1')
+glDetachShader = _link_function('glDetachShader', None, [GLuint, GLuint], requires='OpenGL 2.0')
+glDisable = _link_function('glDisable', None, [GLenum], requires='OpenGL 1.0')
+glDisableClientState = _link_function('glDisableClientState', None, [GLenum], requires='OpenGL 1.1')
+glDisableVertexArrayAttrib = _link_function('glDisableVertexArrayAttrib', None, [GLuint, GLuint], requires='OpenGL 4.5')
+glDisableVertexAttribArray = _link_function('glDisableVertexAttribArray', None, [GLuint], requires='OpenGL 2.0')
+glDisablei = _link_function('glDisablei', None, [GLenum, GLuint], requires='OpenGL 3.0')
+glDispatchCompute = _link_function('glDispatchCompute', None, [GLuint, GLuint, GLuint], requires='OpenGL 4.3')
+glDispatchComputeIndirect = _link_function('glDispatchComputeIndirect', None, [GLintptr], requires='OpenGL 4.3')
+glDrawArrays = _link_function('glDrawArrays', None, [GLenum, GLint, GLsizei], requires='OpenGL 1.1')
+glDrawArraysIndirect = _link_function('glDrawArraysIndirect', None, [GLenum, POINTER(GLvoid)], requires='OpenGL 4.0')
+glDrawArraysInstanced = _link_function('glDrawArraysInstanced', None, [GLenum, GLint, GLsizei, GLsizei], requires='OpenGL 3.1')
+glDrawArraysInstancedBaseInstance = _link_function('glDrawArraysInstancedBaseInstance', None, [GLenum, GLint, GLsizei, GLsizei, GLuint], requires='OpenGL 4.2')
+glDrawBuffer = _link_function('glDrawBuffer', None, [GLenum], requires='OpenGL 1.0')
+glDrawBuffers = _link_function('glDrawBuffers', None, [GLsizei, POINTER(GLenum)], requires='OpenGL 2.0')
+glDrawElements = _link_function('glDrawElements', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid)], requires='OpenGL 1.1')
+glDrawElementsBaseVertex = _link_function('glDrawElementsBaseVertex', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLint], requires='OpenGL 3.2')
+glDrawElementsIndirect = _link_function('glDrawElementsIndirect', None, [GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.0')
+glDrawElementsInstanced = _link_function('glDrawElementsInstanced', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei], requires='OpenGL 3.1')
+glDrawElementsInstancedBaseInstance = _link_function('glDrawElementsInstancedBaseInstance', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei, GLuint], requires='OpenGL 4.2')
+glDrawElementsInstancedBaseVertex = _link_function('glDrawElementsInstancedBaseVertex', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei, GLint], requires='OpenGL 3.2')
+glDrawElementsInstancedBaseVertexBaseInstance = _link_function('glDrawElementsInstancedBaseVertexBaseInstance', None, [GLenum, GLsizei, GLenum, POINTER(GLvoid), GLsizei, GLint, GLuint], requires='OpenGL 4.2')
+glDrawPixels = _link_function('glDrawPixels', None, [GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.0')
+glDrawRangeElements = _link_function('glDrawRangeElements', None, [GLenum, GLuint, GLuint, GLsizei, GLenum, POINTER(GLvoid)], requires='OpenGL 1.2')
+glDrawRangeElementsBaseVertex = _link_function('glDrawRangeElementsBaseVertex', None, [GLenum, GLuint, GLuint, GLsizei, GLenum, POINTER(GLvoid), GLint], requires='OpenGL 3.2')
+glDrawTransformFeedback = _link_function('glDrawTransformFeedback', None, [GLenum, GLuint], requires='OpenGL 4.0')
+glDrawTransformFeedbackInstanced = _link_function('glDrawTransformFeedbackInstanced', None, [GLenum, GLuint, GLsizei], requires='OpenGL 4.2')
+glDrawTransformFeedbackStream = _link_function('glDrawTransformFeedbackStream', None, [GLenum, GLuint, GLuint], requires='OpenGL 4.0')
+glDrawTransformFeedbackStreamInstanced = _link_function('glDrawTransformFeedbackStreamInstanced', None, [GLenum, GLuint, GLuint, GLsizei], requires='OpenGL 4.2')
+glEdgeFlag = _link_function('glEdgeFlag', None, [GLboolean], requires='OpenGL 1.0')
+glEdgeFlagPointer = _link_function('glEdgeFlagPointer', None, [GLsizei, POINTER(GLvoid)], requires='OpenGL 1.1')
+glEdgeFlagv = _link_function('glEdgeFlagv', None, [POINTER(GLboolean)], requires='OpenGL 1.0')
+glEnable = _link_function('glEnable', None, [GLenum], requires='OpenGL 1.0')
+glEnableClientState = _link_function('glEnableClientState', None, [GLenum], requires='OpenGL 1.1')
+glEnableVertexArrayAttrib = _link_function('glEnableVertexArrayAttrib', None, [GLuint, GLuint], requires='OpenGL 4.5')
+glEnableVertexAttribArray = _link_function('glEnableVertexAttribArray', None, [GLuint], requires='OpenGL 2.0')
+glEnablei = _link_function('glEnablei', None, [GLenum, GLuint], requires='OpenGL 3.0')
+glEnd = _link_function('glEnd', None, [], requires='OpenGL 1.0')
+glEndConditionalRender = _link_function('glEndConditionalRender', None, [], requires='OpenGL 3.0')
+glEndList = _link_function('glEndList', None, [], requires='OpenGL 1.0')
+glEndQuery = _link_function('glEndQuery', None, [GLenum], requires='OpenGL 1.5')
+glEndQueryIndexed = _link_function('glEndQueryIndexed', None, [GLenum, GLuint], requires='OpenGL 4.0')
+glEndTransformFeedback = _link_function('glEndTransformFeedback', None, [], requires='OpenGL 3.0')
+glEvalCoord1d = _link_function('glEvalCoord1d', None, [GLdouble], requires='OpenGL 1.0')
+glEvalCoord1dv = _link_function('glEvalCoord1dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glEvalCoord1f = _link_function('glEvalCoord1f', None, [GLfloat], requires='OpenGL 1.0')
+glEvalCoord1fv = _link_function('glEvalCoord1fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glEvalCoord2d = _link_function('glEvalCoord2d', None, [GLdouble, GLdouble], requires='OpenGL 1.0')
+glEvalCoord2dv = _link_function('glEvalCoord2dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glEvalCoord2f = _link_function('glEvalCoord2f', None, [GLfloat, GLfloat], requires='OpenGL 1.0')
+glEvalCoord2fv = _link_function('glEvalCoord2fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glEvalMesh1 = _link_function('glEvalMesh1', None, [GLenum, GLint, GLint], requires='OpenGL 1.0')
+glEvalMesh2 = _link_function('glEvalMesh2', None, [GLenum, GLint, GLint, GLint, GLint], requires='OpenGL 1.0')
+glEvalPoint1 = _link_function('glEvalPoint1', None, [GLint], requires='OpenGL 1.0')
+glEvalPoint2 = _link_function('glEvalPoint2', None, [GLint, GLint], requires='OpenGL 1.0')
+glFeedbackBuffer = _link_function('glFeedbackBuffer', None, [GLsizei, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glFenceSync = _link_function('glFenceSync', GLsync, [GLenum, GLbitfield], requires='OpenGL 3.2')
+glFinish = _link_function('glFinish', None, [], requires='OpenGL 1.0')
+glFlush = _link_function('glFlush', None, [], requires='OpenGL 1.0')
+glFlushMappedBufferRange = _link_function('glFlushMappedBufferRange', None, [GLenum, GLintptr, GLsizeiptr], requires='OpenGL 3.0')
+glFlushMappedNamedBufferRange = _link_function('glFlushMappedNamedBufferRange', None, [GLuint, GLintptr, GLsizeiptr], requires='OpenGL 4.5')
+glFogCoordPointer = _link_function('glFogCoordPointer', None, [GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.4')
+glFogCoordd = _link_function('glFogCoordd', None, [GLdouble], requires='OpenGL 1.4')
+glFogCoorddv = _link_function('glFogCoorddv', None, [POINTER(GLdouble)], requires='OpenGL 1.4')
+glFogCoordf = _link_function('glFogCoordf', None, [GLfloat], requires='OpenGL 1.4')
+glFogCoordfv = _link_function('glFogCoordfv', None, [POINTER(GLfloat)], requires='OpenGL 1.4')
+glFogf = _link_function('glFogf', None, [GLenum, GLfloat], requires='OpenGL 1.0')
+glFogfv = _link_function('glFogfv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glFogi = _link_function('glFogi', None, [GLenum, GLint], requires='OpenGL 1.0')
+glFogiv = _link_function('glFogiv', None, [GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glFramebufferParameteri = _link_function('glFramebufferParameteri', None, [GLenum, GLenum, GLint], requires='OpenGL 4.3')
+glFramebufferRenderbuffer = _link_function('glFramebufferRenderbuffer', None, [GLenum, GLenum, GLenum, GLuint], requires='OpenGL 3.0')
+glFramebufferRenderbufferEXT = _link_function('glFramebufferRenderbufferEXT', None, [GLenum, GLenum, GLenum, GLuint], requires='None')
+glFramebufferTexture = _link_function('glFramebufferTexture', None, [GLenum, GLenum, GLuint, GLint], requires='OpenGL 3.2')
+glFramebufferTexture1D = _link_function('glFramebufferTexture1D', None, [GLenum, GLenum, GLenum, GLuint, GLint], requires='OpenGL 3.0')
+glFramebufferTexture1DEXT = _link_function('glFramebufferTexture1DEXT', None, [GLenum, GLenum, GLenum, GLuint, GLint], requires='None')
+glFramebufferTexture2D = _link_function('glFramebufferTexture2D', None, [GLenum, GLenum, GLenum, GLuint, GLint], requires='OpenGL 3.0')
+glFramebufferTexture2DEXT = _link_function('glFramebufferTexture2DEXT', None, [GLenum, GLenum, GLenum, GLuint, GLint], requires='None')
+glFramebufferTexture3D = _link_function('glFramebufferTexture3D', None, [GLenum, GLenum, GLenum, GLuint, GLint, GLint], requires='OpenGL 3.0')
+glFramebufferTexture3DEXT = _link_function('glFramebufferTexture3DEXT', None, [GLenum, GLenum, GLenum, GLuint, GLint, GLint], requires='None')
+glFramebufferTextureLayer = _link_function('glFramebufferTextureLayer', None, [GLenum, GLenum, GLuint, GLint, GLint], requires='OpenGL 3.0')
+glFrontFace = _link_function('glFrontFace', None, [GLenum], requires='OpenGL 1.0')
+glFrustum = _link_function('glFrustum', None, [GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glGenBuffers = _link_function('glGenBuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.5')
+glGenFramebuffers = _link_function('glGenFramebuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glGenFramebuffersEXT = _link_function('glGenFramebuffersEXT', None, [GLsizei, POINTER(GLuint)], requires='None')
+glGenLists = _link_function('glGenLists', GLuint, [GLsizei], requires='OpenGL 1.0')
+glGenProgramPipelines = _link_function('glGenProgramPipelines', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.1')
+glGenQueries = _link_function('glGenQueries', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.5')
+glGenRenderbuffers = _link_function('glGenRenderbuffers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glGenRenderbuffersEXT = _link_function('glGenRenderbuffersEXT', None, [GLsizei, POINTER(GLuint)], requires='None')
+glGenSamplers = _link_function('glGenSamplers', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.3')
+glGenTextures = _link_function('glGenTextures', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.1')
+glGenTransformFeedbacks = _link_function('glGenTransformFeedbacks', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 4.0')
+glGenVertexArrays = _link_function('glGenVertexArrays', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glGenerateMipmap = _link_function('glGenerateMipmap', None, [GLenum], requires='OpenGL 3.0')
+glGenerateMipmapEXT = _link_function('glGenerateMipmapEXT', None, [GLenum], requires='None')
+glGenerateTextureMipmap = _link_function('glGenerateTextureMipmap', None, [GLuint], requires='OpenGL 4.5')
+glGetActiveAtomicCounterBufferiv = _link_function('glGetActiveAtomicCounterBufferiv', None, [GLuint, GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.2')
+glGetActiveAttrib = _link_function('glGetActiveAttrib', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLchar)], requires='OpenGL 2.0')
+glGetActiveSubroutineName = _link_function('glGetActiveSubroutineName', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.0')
+glGetActiveSubroutineUniformName = _link_function('glGetActiveSubroutineUniformName', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.0')
+glGetActiveSubroutineUniformiv = _link_function('glGetActiveSubroutineUniformiv', None, [GLuint, GLenum, GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.0')
+glGetActiveUniform = _link_function('glGetActiveUniform', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLint), POINTER(GLenum), POINTER(GLchar)], requires='OpenGL 2.0')
+glGetActiveUniformBlockName = _link_function('glGetActiveUniformBlockName', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 3.1')
+glGetActiveUniformBlockiv = _link_function('glGetActiveUniformBlockiv', None, [GLuint, GLuint, GLenum, POINTER(GLint)], requires='OpenGL 3.1')
+glGetActiveUniformName = _link_function('glGetActiveUniformName', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 3.1')
+glGetActiveUniformsiv = _link_function('glGetActiveUniformsiv', None, [GLuint, GLsizei, POINTER(GLuint), GLenum, POINTER(GLint)], requires='OpenGL 3.1')
+glGetAttachedShaders = _link_function('glGetAttachedShaders', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLuint)], requires='OpenGL 2.0')
+glGetAttribLocation = _link_function('glGetAttribLocation', GLint, [GLuint, POINTER(GLchar)], requires='OpenGL 2.0')
+glGetBooleani_v = _link_function('glGetBooleani_v', None, [GLenum, GLuint, POINTER(GLboolean)], requires='OpenGL 3.0')
+glGetBooleanv = _link_function('glGetBooleanv', None, [GLenum, POINTER(GLboolean)], requires='OpenGL 1.0')
+glGetBufferParameteri64v = _link_function('glGetBufferParameteri64v', None, [GLenum, GLenum, POINTER(GLint64)], requires='OpenGL 3.2')
+glGetBufferParameteriv = _link_function('glGetBufferParameteriv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.5')
+glGetBufferPointerv = _link_function('glGetBufferPointerv', None, [GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.5')
+glGetBufferSubData = _link_function('glGetBufferSubData', None, [GLenum, GLintptr, GLsizeiptr, POINTER(GLvoid)], requires='OpenGL 1.5')
+glGetClipPlane = _link_function('glGetClipPlane', None, [GLenum, POINTER(GLdouble)], requires='OpenGL 1.0')
+glGetCompressedTexImage = _link_function('glGetCompressedTexImage', None, [GLenum, GLint, POINTER(GLvoid)], requires='OpenGL 1.3')
+glGetCompressedTextureImage = _link_function('glGetCompressedTextureImage', None, [GLuint, GLint, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetCompressedTextureSubImage = _link_function('glGetCompressedTextureSubImage', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetDebugMessageLog = _link_function('glGetDebugMessageLog', GLuint, [GLuint, GLsizei, POINTER(GLenum), POINTER(GLenum), POINTER(GLuint), POINTER(GLenum), POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.3')
+glGetDoublei_v = _link_function('glGetDoublei_v', None, [GLenum, GLuint, POINTER(GLdouble)], requires='OpenGL 4.1')
+glGetDoublev = _link_function('glGetDoublev', None, [GLenum, POINTER(GLdouble)], requires='OpenGL 1.0')
+glGetError = _link_function('glGetError', GLenum, [], requires='OpenGL 1.0')
+glGetFloati_v = _link_function('glGetFloati_v', None, [GLenum, GLuint, POINTER(GLfloat)], requires='OpenGL 4.1')
+glGetFloatv = _link_function('glGetFloatv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glGetFragDataIndex = _link_function('glGetFragDataIndex', GLint, [GLuint, POINTER(GLchar)], requires='OpenGL 3.3')
+glGetFragDataLocation = _link_function('glGetFragDataLocation', GLint, [GLuint, POINTER(GLchar)], requires='OpenGL 3.0')
+glGetFramebufferAttachmentParameteriv = _link_function('glGetFramebufferAttachmentParameteriv', None, [GLenum, GLenum, GLenum, POINTER(GLint)], requires='OpenGL 3.0')
+glGetFramebufferAttachmentParameterivEXT = _link_function('glGetFramebufferAttachmentParameterivEXT', None, [GLenum, GLenum, GLenum, POINTER(GLint)], requires='None')
+glGetFramebufferParameteriv = _link_function('glGetFramebufferParameteriv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 4.3')
+glGetGraphicsResetStatus = _link_function('glGetGraphicsResetStatus', GLenum, [], requires='OpenGL 4.5')
+glGetInteger64i_v = _link_function('glGetInteger64i_v', None, [GLenum, GLuint, POINTER(GLint64)], requires='OpenGL 3.2')
+glGetInteger64v = _link_function('glGetInteger64v', None, [GLenum, POINTER(GLint64)], requires='OpenGL 3.2')
+glGetIntegeri_v = _link_function('glGetIntegeri_v', None, [GLenum, GLuint, POINTER(GLint)], requires='OpenGL 3.1')
+glGetIntegerv = _link_function('glGetIntegerv', None, [GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glGetInternalformati64v = _link_function('glGetInternalformati64v', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLint64)], requires='OpenGL 4.3')
+glGetInternalformativ = _link_function('glGetInternalformativ', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLint)], requires='OpenGL 4.2')
+glGetLightfv = _link_function('glGetLightfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glGetLightiv = _link_function('glGetLightiv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glGetMapdv = _link_function('glGetMapdv', None, [GLenum, GLenum, POINTER(GLdouble)], requires='OpenGL 1.0')
+glGetMapfv = _link_function('glGetMapfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glGetMapiv = _link_function('glGetMapiv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glGetMaterialfv = _link_function('glGetMaterialfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glGetMaterialiv = _link_function('glGetMaterialiv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glGetMultisamplefv = _link_function('glGetMultisamplefv', None, [GLenum, GLuint, POINTER(GLfloat)], requires='OpenGL 3.2')
+glGetNamedBufferParameteri64v = _link_function('glGetNamedBufferParameteri64v', None, [GLuint, GLenum, POINTER(GLint64)], requires='OpenGL 4.5')
+glGetNamedBufferParameteriv = _link_function('glGetNamedBufferParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetNamedBufferPointerv = _link_function('glGetNamedBufferPointerv', None, [GLuint, GLenum, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetNamedBufferSubData = _link_function('glGetNamedBufferSubData', None, [GLuint, GLintptr, GLsizeiptr, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetNamedFramebufferAttachmentParameteriv = _link_function('glGetNamedFramebufferAttachmentParameteriv', None, [GLuint, GLenum, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetNamedFramebufferParameteriv = _link_function('glGetNamedFramebufferParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetNamedRenderbufferParameteriv = _link_function('glGetNamedRenderbufferParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetObjectLabel = _link_function('glGetObjectLabel', None, [GLenum, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.3')
+glGetObjectPtrLabel = _link_function('glGetObjectPtrLabel', None, [POINTER(GLvoid), GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.3')
+glGetPixelMapfv = _link_function('glGetPixelMapfv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glGetPixelMapuiv = _link_function('glGetPixelMapuiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 1.0')
+glGetPixelMapusv = _link_function('glGetPixelMapusv', None, [GLenum, POINTER(GLushort)], requires='OpenGL 1.0')
+glGetPointerv = _link_function('glGetPointerv', None, [GLenum, POINTER(GLvoid)], requires='OpenGL 4.3')
+glGetPolygonStipple = _link_function('glGetPolygonStipple', None, [POINTER(GLubyte)], requires='OpenGL 1.0')
+glGetProgramBinary = _link_function('glGetProgramBinary', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLenum), POINTER(GLvoid)], requires='OpenGL 4.1')
+glGetProgramInfoLog = _link_function('glGetProgramInfoLog', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 2.0')
+glGetProgramInterfaceiv = _link_function('glGetProgramInterfaceiv', None, [GLuint, GLenum, GLenum, POINTER(GLint)], requires='OpenGL 4.3')
+glGetProgramPipelineInfoLog = _link_function('glGetProgramPipelineInfoLog', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.1')
+glGetProgramPipelineiv = _link_function('glGetProgramPipelineiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.1')
+glGetProgramResourceIndex = _link_function('glGetProgramResourceIndex', GLuint, [GLuint, GLenum, POINTER(GLchar)], requires='OpenGL 4.3')
+glGetProgramResourceLocation = _link_function('glGetProgramResourceLocation', GLint, [GLuint, GLenum, POINTER(GLchar)], requires='OpenGL 4.3')
+glGetProgramResourceLocationIndex = _link_function('glGetProgramResourceLocationIndex', GLint, [GLuint, GLenum, POINTER(GLchar)], requires='OpenGL 4.3')
+glGetProgramResourceName = _link_function('glGetProgramResourceName', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 4.3')
+glGetProgramResourceiv = _link_function('glGetProgramResourceiv', None, [GLuint, GLenum, GLuint, GLsizei, POINTER(GLenum), GLsizei, POINTER(GLsizei), POINTER(GLint)], requires='OpenGL 4.3')
+glGetProgramStageiv = _link_function('glGetProgramStageiv', None, [GLuint, GLenum, GLenum, POINTER(GLint)], requires='OpenGL 4.0')
+glGetProgramiv = _link_function('glGetProgramiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 2.0')
+glGetQueryBufferObjecti64v = _link_function('glGetQueryBufferObjecti64v', None, [GLuint, GLuint, GLenum, GLintptr], requires='OpenGL 4.5')
+glGetQueryBufferObjectiv = _link_function('glGetQueryBufferObjectiv', None, [GLuint, GLuint, GLenum, GLintptr], requires='OpenGL 4.5')
+glGetQueryBufferObjectui64v = _link_function('glGetQueryBufferObjectui64v', None, [GLuint, GLuint, GLenum, GLintptr], requires='OpenGL 4.5')
+glGetQueryBufferObjectuiv = _link_function('glGetQueryBufferObjectuiv', None, [GLuint, GLuint, GLenum, GLintptr], requires='OpenGL 4.5')
+glGetQueryIndexediv = _link_function('glGetQueryIndexediv', None, [GLenum, GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.0')
+glGetQueryObjecti64v = _link_function('glGetQueryObjecti64v', None, [GLuint, GLenum, POINTER(GLint64)], requires='OpenGL 3.3')
+glGetQueryObjectiv = _link_function('glGetQueryObjectiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 1.5')
+glGetQueryObjectui64v = _link_function('glGetQueryObjectui64v', None, [GLuint, GLenum, POINTER(GLuint64)], requires='OpenGL 3.3')
+glGetQueryObjectuiv = _link_function('glGetQueryObjectuiv', None, [GLuint, GLenum, POINTER(GLuint)], requires='OpenGL 1.5')
+glGetQueryiv = _link_function('glGetQueryiv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.5')
+glGetRenderbufferParameteriv = _link_function('glGetRenderbufferParameteriv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 3.0')
+glGetRenderbufferParameterivEXT = _link_function('glGetRenderbufferParameterivEXT', None, [GLenum, GLenum, POINTER(GLint)], requires='None')
+glGetSamplerParameterIiv = _link_function('glGetSamplerParameterIiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 3.3')
+glGetSamplerParameterIuiv = _link_function('glGetSamplerParameterIuiv', None, [GLuint, GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glGetSamplerParameterfv = _link_function('glGetSamplerParameterfv', None, [GLuint, GLenum, POINTER(GLfloat)], requires='OpenGL 3.3')
+glGetSamplerParameteriv = _link_function('glGetSamplerParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 3.3')
+glGetShaderInfoLog = _link_function('glGetShaderInfoLog', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 2.0')
+glGetShaderPrecisionFormat = _link_function('glGetShaderPrecisionFormat', None, [GLenum, GLenum, POINTER(GLint), POINTER(GLint)], requires='OpenGL 4.1')
+glGetShaderSource = _link_function('glGetShaderSource', None, [GLuint, GLsizei, POINTER(GLsizei), POINTER(GLchar)], requires='OpenGL 2.0')
+glGetShaderiv = _link_function('glGetShaderiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 2.0')
+glGetString = _link_function('glGetString', POINTER(GLubyte), [GLenum], requires='OpenGL 1.0')
+glGetStringi = _link_function('glGetStringi', POINTER(GLubyte), [GLenum, GLuint], requires='OpenGL 3.0')
+glGetSubroutineIndex = _link_function('glGetSubroutineIndex', GLuint, [GLuint, GLenum, POINTER(GLchar)], requires='OpenGL 4.0')
+glGetSubroutineUniformLocation = _link_function('glGetSubroutineUniformLocation', GLint, [GLuint, GLenum, POINTER(GLchar)], requires='OpenGL 4.0')
+glGetSynciv = _link_function('glGetSynciv', None, [GLsync, GLenum, GLsizei, POINTER(GLsizei), POINTER(GLint)], requires='OpenGL 3.2')
+glGetTexEnvfv = _link_function('glGetTexEnvfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glGetTexEnviv = _link_function('glGetTexEnviv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glGetTexGendv = _link_function('glGetTexGendv', None, [GLenum, GLenum, POINTER(GLdouble)], requires='OpenGL 1.0')
+glGetTexGenfv = _link_function('glGetTexGenfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glGetTexGeniv = _link_function('glGetTexGeniv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glGetTexImage = _link_function('glGetTexImage', None, [GLenum, GLint, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.0')
+glGetTexLevelParameterfv = _link_function('glGetTexLevelParameterfv', None, [GLenum, GLint, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glGetTexLevelParameteriv = _link_function('glGetTexLevelParameteriv', None, [GLenum, GLint, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glGetTexParameterIiv = _link_function('glGetTexParameterIiv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 3.0')
+glGetTexParameterIuiv = _link_function('glGetTexParameterIuiv', None, [GLenum, GLenum, POINTER(GLuint)], requires='OpenGL 3.0')
+glGetTexParameterfv = _link_function('glGetTexParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glGetTexParameteriv = _link_function('glGetTexParameteriv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glGetTextureImage = _link_function('glGetTextureImage', None, [GLuint, GLint, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetTextureLevelParameterfv = _link_function('glGetTextureLevelParameterfv', None, [GLuint, GLint, GLenum, POINTER(GLfloat)], requires='OpenGL 4.5')
+glGetTextureLevelParameteriv = _link_function('glGetTextureLevelParameteriv', None, [GLuint, GLint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetTextureParameterIiv = _link_function('glGetTextureParameterIiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetTextureParameterIuiv = _link_function('glGetTextureParameterIuiv', None, [GLuint, GLenum, POINTER(GLuint)], requires='OpenGL 4.5')
+glGetTextureParameterfv = _link_function('glGetTextureParameterfv', None, [GLuint, GLenum, POINTER(GLfloat)], requires='OpenGL 4.5')
+glGetTextureParameteriv = _link_function('glGetTextureParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetTextureSubImage = _link_function('glGetTextureSubImage', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetTransformFeedbackVarying = _link_function('glGetTransformFeedbackVarying', None, [GLuint, GLuint, GLsizei, POINTER(GLsizei), POINTER(GLsizei), POINTER(GLenum), POINTER(GLchar)], requires='OpenGL 3.0')
+glGetTransformFeedbacki64_v = _link_function('glGetTransformFeedbacki64_v', None, [GLuint, GLenum, GLuint, POINTER(GLint64)], requires='OpenGL 4.5')
+glGetTransformFeedbacki_v = _link_function('glGetTransformFeedbacki_v', None, [GLuint, GLenum, GLuint, POINTER(GLint)], requires='OpenGL 4.5')
+glGetTransformFeedbackiv = _link_function('glGetTransformFeedbackiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetUniformBlockIndex = _link_function('glGetUniformBlockIndex', GLuint, [GLuint, POINTER(GLchar)], requires='OpenGL 3.1')
+glGetUniformIndices = _link_function('glGetUniformIndices', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), POINTER(GLuint)], requires='OpenGL 3.1')
+glGetUniformLocation = _link_function('glGetUniformLocation', GLint, [GLuint, POINTER(GLchar)], requires='OpenGL 2.0')
+glGetUniformSubroutineuiv = _link_function('glGetUniformSubroutineuiv', None, [GLenum, GLint, POINTER(GLuint)], requires='OpenGL 4.0')
+glGetUniformdv = _link_function('glGetUniformdv', None, [GLuint, GLint, POINTER(GLdouble)], requires='OpenGL 4.0')
+glGetUniformfv = _link_function('glGetUniformfv', None, [GLuint, GLint, POINTER(GLfloat)], requires='OpenGL 2.0')
+glGetUniformiv = _link_function('glGetUniformiv', None, [GLuint, GLint, POINTER(GLint)], requires='OpenGL 2.0')
+glGetUniformuiv = _link_function('glGetUniformuiv', None, [GLuint, GLint, POINTER(GLuint)], requires='OpenGL 3.0')
+glGetVertexArrayIndexed64iv = _link_function('glGetVertexArrayIndexed64iv', None, [GLuint, GLuint, GLenum, POINTER(GLint64)], requires='OpenGL 4.5')
+glGetVertexArrayIndexediv = _link_function('glGetVertexArrayIndexediv', None, [GLuint, GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetVertexArrayiv = _link_function('glGetVertexArrayiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glGetVertexAttribIiv = _link_function('glGetVertexAttribIiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 3.0')
+glGetVertexAttribIuiv = _link_function('glGetVertexAttribIuiv', None, [GLuint, GLenum, POINTER(GLuint)], requires='OpenGL 3.0')
+glGetVertexAttribLdv = _link_function('glGetVertexAttribLdv', None, [GLuint, GLenum, POINTER(GLdouble)], requires='OpenGL 4.1')
+glGetVertexAttribPointerv = _link_function('glGetVertexAttribPointerv', None, [GLuint, GLenum, POINTER(GLvoid)], requires='OpenGL 2.0')
+glGetVertexAttribdv = _link_function('glGetVertexAttribdv', None, [GLuint, GLenum, POINTER(GLdouble)], requires='OpenGL 2.0')
+glGetVertexAttribfv = _link_function('glGetVertexAttribfv', None, [GLuint, GLenum, POINTER(GLfloat)], requires='OpenGL 2.0')
+glGetVertexAttribiv = _link_function('glGetVertexAttribiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 2.0')
+glGetnColorTable = _link_function('glGetnColorTable', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnCompressedTexImage = _link_function('glGetnCompressedTexImage', None, [GLenum, GLint, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnConvolutionFilter = _link_function('glGetnConvolutionFilter', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnHistogram = _link_function('glGetnHistogram', None, [GLenum, GLboolean, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnMapdv = _link_function('glGetnMapdv', None, [GLenum, GLenum, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.5')
+glGetnMapfv = _link_function('glGetnMapfv', None, [GLenum, GLenum, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.5')
+glGetnMapiv = _link_function('glGetnMapiv', None, [GLenum, GLenum, GLsizei, POINTER(GLint)], requires='OpenGL 4.5')
+glGetnMinmax = _link_function('glGetnMinmax', None, [GLenum, GLboolean, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnPixelMapfv = _link_function('glGetnPixelMapfv', None, [GLenum, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.5')
+glGetnPixelMapuiv = _link_function('glGetnPixelMapuiv', None, [GLenum, GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glGetnPixelMapusv = _link_function('glGetnPixelMapusv', None, [GLenum, GLsizei, POINTER(GLushort)], requires='OpenGL 4.5')
+glGetnPolygonStipple = _link_function('glGetnPolygonStipple', None, [GLsizei, POINTER(GLubyte)], requires='OpenGL 4.5')
+glGetnSeparableFilter = _link_function('glGetnSeparableFilter', None, [GLenum, GLenum, GLenum, GLsizei, POINTER(GLvoid), GLsizei, POINTER(GLvoid), POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnTexImage = _link_function('glGetnTexImage', None, [GLenum, GLint, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glGetnUniformdv = _link_function('glGetnUniformdv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.5')
+glGetnUniformfv = _link_function('glGetnUniformfv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.5')
+glGetnUniformiv = _link_function('glGetnUniformiv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], requires='OpenGL 4.5')
+glGetnUniformuiv = _link_function('glGetnUniformuiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.5')
+glHint = _link_function('glHint', None, [GLenum, GLenum], requires='OpenGL 1.0')
+glIndexMask = _link_function('glIndexMask', None, [GLuint], requires='OpenGL 1.0')
+glIndexPointer = _link_function('glIndexPointer', None, [GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.1')
+glIndexd = _link_function('glIndexd', None, [GLdouble], requires='OpenGL 1.0')
+glIndexdv = _link_function('glIndexdv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glIndexf = _link_function('glIndexf', None, [GLfloat], requires='OpenGL 1.0')
+glIndexfv = _link_function('glIndexfv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glIndexi = _link_function('glIndexi', None, [GLint], requires='OpenGL 1.0')
+glIndexiv = _link_function('glIndexiv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glIndexs = _link_function('glIndexs', None, [GLshort], requires='OpenGL 1.0')
+glIndexsv = _link_function('glIndexsv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glIndexub = _link_function('glIndexub', None, [GLubyte], requires='OpenGL 1.1')
+glIndexubv = _link_function('glIndexubv', None, [POINTER(GLubyte)], requires='OpenGL 1.1')
+glInitNames = _link_function('glInitNames', None, [], requires='OpenGL 1.0')
+glInterleavedArrays = _link_function('glInterleavedArrays', None, [GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.1')
+glInvalidateBufferData = _link_function('glInvalidateBufferData', None, [GLuint], requires='OpenGL 4.3')
+glInvalidateBufferSubData = _link_function('glInvalidateBufferSubData', None, [GLuint, GLintptr, GLsizeiptr], requires='OpenGL 4.3')
+glInvalidateFramebuffer = _link_function('glInvalidateFramebuffer', None, [GLenum, GLsizei, POINTER(GLenum)], requires='OpenGL 4.3')
+glInvalidateNamedFramebufferData = _link_function('glInvalidateNamedFramebufferData', None, [GLuint, GLsizei, POINTER(GLenum)], requires='OpenGL 4.5')
+glInvalidateNamedFramebufferSubData = _link_function('glInvalidateNamedFramebufferSubData', None, [GLuint, GLsizei, POINTER(GLenum), GLint, GLint, GLsizei, GLsizei], requires='OpenGL 4.5')
+glInvalidateSubFramebuffer = _link_function('glInvalidateSubFramebuffer', None, [GLenum, GLsizei, POINTER(GLenum), GLint, GLint, GLsizei, GLsizei], requires='OpenGL 4.3')
+glInvalidateTexImage = _link_function('glInvalidateTexImage', None, [GLuint, GLint], requires='OpenGL 4.3')
+glInvalidateTexSubImage = _link_function('glInvalidateTexSubImage', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei], requires='OpenGL 4.3')
+glIsBuffer = _link_function('glIsBuffer', GLboolean, [GLuint], requires='OpenGL 1.5')
+glIsEnabled = _link_function('glIsEnabled', GLboolean, [GLenum], requires='OpenGL 1.0')
+glIsEnabledi = _link_function('glIsEnabledi', GLboolean, [GLenum, GLuint], requires='OpenGL 3.0')
+glIsFramebuffer = _link_function('glIsFramebuffer', GLboolean, [GLuint], requires='OpenGL 3.0')
+glIsFramebufferEXT = _link_function('glIsFramebufferEXT', GLboolean, [GLuint], requires='None')
+glIsList = _link_function('glIsList', GLboolean, [GLuint], requires='OpenGL 1.0')
+glIsProgram = _link_function('glIsProgram', GLboolean, [GLuint], requires='OpenGL 2.0')
+glIsProgramPipeline = _link_function('glIsProgramPipeline', GLboolean, [GLuint], requires='OpenGL 4.1')
+glIsQuery = _link_function('glIsQuery', GLboolean, [GLuint], requires='OpenGL 1.5')
+glIsRenderbuffer = _link_function('glIsRenderbuffer', GLboolean, [GLuint], requires='OpenGL 3.0')
+glIsRenderbufferEXT = _link_function('glIsRenderbufferEXT', GLboolean, [GLuint], requires='None')
+glIsSampler = _link_function('glIsSampler', GLboolean, [GLuint], requires='OpenGL 3.3')
+glIsShader = _link_function('glIsShader', GLboolean, [GLuint], requires='OpenGL 2.0')
+glIsSync = _link_function('glIsSync', GLboolean, [GLsync], requires='OpenGL 3.2')
+glIsTexture = _link_function('glIsTexture', GLboolean, [GLuint], requires='OpenGL 1.1')
+glIsTransformFeedback = _link_function('glIsTransformFeedback', GLboolean, [GLuint], requires='OpenGL 4.0')
+glIsVertexArray = _link_function('glIsVertexArray', GLboolean, [GLuint], requires='OpenGL 3.0')
+glLightModelf = _link_function('glLightModelf', None, [GLenum, GLfloat], requires='OpenGL 1.0')
+glLightModelfv = _link_function('glLightModelfv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glLightModeli = _link_function('glLightModeli', None, [GLenum, GLint], requires='OpenGL 1.0')
+glLightModeliv = _link_function('glLightModeliv', None, [GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glLightf = _link_function('glLightf', None, [GLenum, GLenum, GLfloat], requires='OpenGL 1.0')
+glLightfv = _link_function('glLightfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glLighti = _link_function('glLighti', None, [GLenum, GLenum, GLint], requires='OpenGL 1.0')
+glLightiv = _link_function('glLightiv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glLineStipple = _link_function('glLineStipple', None, [GLint, GLushort], requires='OpenGL 1.0')
+glLineWidth = _link_function('glLineWidth', None, [GLfloat], requires='OpenGL 1.0')
+glLinkProgram = _link_function('glLinkProgram', None, [GLuint], requires='OpenGL 2.0')
+glListBase = _link_function('glListBase', None, [GLuint], requires='OpenGL 1.0')
+glLoadIdentity = _link_function('glLoadIdentity', None, [], requires='OpenGL 1.0')
+glLoadMatrixd = _link_function('glLoadMatrixd', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glLoadMatrixf = _link_function('glLoadMatrixf', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glLoadName = _link_function('glLoadName', None, [GLuint], requires='OpenGL 1.0')
+glLoadTransposeMatrixd = _link_function('glLoadTransposeMatrixd', None, [POINTER(GLdouble)], requires='OpenGL 1.3')
+glLoadTransposeMatrixf = _link_function('glLoadTransposeMatrixf', None, [POINTER(GLfloat)], requires='OpenGL 1.3')
+glLogicOp = _link_function('glLogicOp', None, [GLenum], requires='OpenGL 1.0')
+glMap1d = _link_function('glMap1d', None, [GLenum, GLdouble, GLdouble, GLint, GLint, POINTER(GLdouble)], requires='OpenGL 1.0')
+glMap1f = _link_function('glMap1f', None, [GLenum, GLfloat, GLfloat, GLint, GLint, POINTER(GLfloat)], requires='OpenGL 1.0')
+glMap2d = _link_function('glMap2d', None, [GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, POINTER(GLdouble)], requires='OpenGL 1.0')
+glMap2f = _link_function('glMap2f', None, [GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, POINTER(GLfloat)], requires='OpenGL 1.0')
+glMapBuffer = _link_function('glMapBuffer', POINTER(None), [GLenum, GLenum], requires='OpenGL 1.5')
+glMapBufferRange = _link_function('glMapBufferRange', POINTER(None), [GLenum, GLintptr, GLsizeiptr, GLbitfield], requires='OpenGL 3.0')
+glMapGrid1d = _link_function('glMapGrid1d', None, [GLint, GLdouble, GLdouble], requires='OpenGL 1.0')
+glMapGrid1f = _link_function('glMapGrid1f', None, [GLint, GLfloat, GLfloat], requires='OpenGL 1.0')
+glMapGrid2d = _link_function('glMapGrid2d', None, [GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble], requires='OpenGL 1.0')
+glMapGrid2f = _link_function('glMapGrid2f', None, [GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat], requires='OpenGL 1.0')
+glMapNamedBuffer = _link_function('glMapNamedBuffer', POINTER(None), [GLuint, GLenum], requires='OpenGL 4.5')
+glMapNamedBufferRange = _link_function('glMapNamedBufferRange', POINTER(None), [GLuint, GLintptr, GLsizeiptr, GLbitfield], requires='OpenGL 4.5')
+glMaterialf = _link_function('glMaterialf', None, [GLenum, GLenum, GLfloat], requires='OpenGL 1.0')
+glMaterialfv = _link_function('glMaterialfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glMateriali = _link_function('glMateriali', None, [GLenum, GLenum, GLint], requires='OpenGL 1.0')
+glMaterialiv = _link_function('glMaterialiv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glMatrixMode = _link_function('glMatrixMode', None, [GLenum], requires='OpenGL 1.0')
+glMemoryBarrier = _link_function('glMemoryBarrier', None, [GLbitfield], requires='OpenGL 4.2')
+glMemoryBarrierByRegion = _link_function('glMemoryBarrierByRegion', None, [GLbitfield], requires='OpenGL 4.5')
+glMinSampleShading = _link_function('glMinSampleShading', None, [GLfloat], requires='OpenGL 4.0')
+glMultMatrixd = _link_function('glMultMatrixd', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glMultMatrixf = _link_function('glMultMatrixf', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glMultTransposeMatrixd = _link_function('glMultTransposeMatrixd', None, [POINTER(GLdouble)], requires='OpenGL 1.3')
+glMultTransposeMatrixf = _link_function('glMultTransposeMatrixf', None, [POINTER(GLfloat)], requires='OpenGL 1.3')
+glMultiDrawArrays = _link_function('glMultiDrawArrays', None, [GLenum, POINTER(GLint), POINTER(GLsizei), GLsizei], requires='OpenGL 1.4')
+glMultiDrawArraysIndirect = _link_function('glMultiDrawArraysIndirect', None, [GLenum, POINTER(GLvoid), GLsizei, GLsizei], requires='OpenGL 4.3')
+glMultiDrawArraysIndirectCount = _link_function('glMultiDrawArraysIndirectCount', None, [GLenum, POINTER(GLvoid), GLintptr, GLsizei, GLsizei], requires='OpenGL 4.6')
+glMultiDrawElements = _link_function('glMultiDrawElements', None, [GLenum, POINTER(GLsizei), GLenum, POINTER(GLvoid), GLsizei], requires='OpenGL 1.4')
+glMultiDrawElementsBaseVertex = _link_function('glMultiDrawElementsBaseVertex', None, [GLenum, POINTER(GLsizei), GLenum, POINTER(GLvoid), GLsizei, POINTER(GLint)], requires='OpenGL 3.2')
+glMultiDrawElementsIndirect = _link_function('glMultiDrawElementsIndirect', None, [GLenum, GLenum, POINTER(GLvoid), GLsizei, GLsizei], requires='OpenGL 4.3')
+glMultiDrawElementsIndirectCount = _link_function('glMultiDrawElementsIndirectCount', None, [GLenum, GLenum, POINTER(GLvoid), GLintptr, GLsizei, GLsizei], requires='OpenGL 4.6')
+glMultiTexCoord1d = _link_function('glMultiTexCoord1d', None, [GLenum, GLdouble], requires='OpenGL 1.3')
+glMultiTexCoord1dv = _link_function('glMultiTexCoord1dv', None, [GLenum, POINTER(GLdouble)], requires='OpenGL 1.3')
+glMultiTexCoord1f = _link_function('glMultiTexCoord1f', None, [GLenum, GLfloat], requires='OpenGL 1.3')
+glMultiTexCoord1fv = _link_function('glMultiTexCoord1fv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 1.3')
+glMultiTexCoord1i = _link_function('glMultiTexCoord1i', None, [GLenum, GLint], requires='OpenGL 1.3')
+glMultiTexCoord1iv = _link_function('glMultiTexCoord1iv', None, [GLenum, POINTER(GLint)], requires='OpenGL 1.3')
+glMultiTexCoord1s = _link_function('glMultiTexCoord1s', None, [GLenum, GLshort], requires='OpenGL 1.3')
+glMultiTexCoord1sv = _link_function('glMultiTexCoord1sv', None, [GLenum, POINTER(GLshort)], requires='OpenGL 1.3')
+glMultiTexCoord2d = _link_function('glMultiTexCoord2d', None, [GLenum, GLdouble, GLdouble], requires='OpenGL 1.3')
+glMultiTexCoord2dv = _link_function('glMultiTexCoord2dv', None, [GLenum, POINTER(GLdouble)], requires='OpenGL 1.3')
+glMultiTexCoord2f = _link_function('glMultiTexCoord2f', None, [GLenum, GLfloat, GLfloat], requires='OpenGL 1.3')
+glMultiTexCoord2fv = _link_function('glMultiTexCoord2fv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 1.3')
+glMultiTexCoord2i = _link_function('glMultiTexCoord2i', None, [GLenum, GLint, GLint], requires='OpenGL 1.3')
+glMultiTexCoord2iv = _link_function('glMultiTexCoord2iv', None, [GLenum, POINTER(GLint)], requires='OpenGL 1.3')
+glMultiTexCoord2s = _link_function('glMultiTexCoord2s', None, [GLenum, GLshort, GLshort], requires='OpenGL 1.3')
+glMultiTexCoord2sv = _link_function('glMultiTexCoord2sv', None, [GLenum, POINTER(GLshort)], requires='OpenGL 1.3')
+glMultiTexCoord3d = _link_function('glMultiTexCoord3d', None, [GLenum, GLdouble, GLdouble, GLdouble], requires='OpenGL 1.3')
+glMultiTexCoord3dv = _link_function('glMultiTexCoord3dv', None, [GLenum, POINTER(GLdouble)], requires='OpenGL 1.3')
+glMultiTexCoord3f = _link_function('glMultiTexCoord3f', None, [GLenum, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.3')
+glMultiTexCoord3fv = _link_function('glMultiTexCoord3fv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 1.3')
+glMultiTexCoord3i = _link_function('glMultiTexCoord3i', None, [GLenum, GLint, GLint, GLint], requires='OpenGL 1.3')
+glMultiTexCoord3iv = _link_function('glMultiTexCoord3iv', None, [GLenum, POINTER(GLint)], requires='OpenGL 1.3')
+glMultiTexCoord3s = _link_function('glMultiTexCoord3s', None, [GLenum, GLshort, GLshort, GLshort], requires='OpenGL 1.3')
+glMultiTexCoord3sv = _link_function('glMultiTexCoord3sv', None, [GLenum, POINTER(GLshort)], requires='OpenGL 1.3')
+glMultiTexCoord4d = _link_function('glMultiTexCoord4d', None, [GLenum, GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 1.3')
+glMultiTexCoord4dv = _link_function('glMultiTexCoord4dv', None, [GLenum, POINTER(GLdouble)], requires='OpenGL 1.3')
+glMultiTexCoord4f = _link_function('glMultiTexCoord4f', None, [GLenum, GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.3')
+glMultiTexCoord4fv = _link_function('glMultiTexCoord4fv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 1.3')
+glMultiTexCoord4i = _link_function('glMultiTexCoord4i', None, [GLenum, GLint, GLint, GLint, GLint], requires='OpenGL 1.3')
+glMultiTexCoord4iv = _link_function('glMultiTexCoord4iv', None, [GLenum, POINTER(GLint)], requires='OpenGL 1.3')
+glMultiTexCoord4s = _link_function('glMultiTexCoord4s', None, [GLenum, GLshort, GLshort, GLshort, GLshort], requires='OpenGL 1.3')
+glMultiTexCoord4sv = _link_function('glMultiTexCoord4sv', None, [GLenum, POINTER(GLshort)], requires='OpenGL 1.3')
+glMultiTexCoordP1ui = _link_function('glMultiTexCoordP1ui', None, [GLenum, GLenum, GLuint], requires='OpenGL 3.3')
+glMultiTexCoordP1uiv = _link_function('glMultiTexCoordP1uiv', None, [GLenum, GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glMultiTexCoordP2ui = _link_function('glMultiTexCoordP2ui', None, [GLenum, GLenum, GLuint], requires='OpenGL 3.3')
+glMultiTexCoordP2uiv = _link_function('glMultiTexCoordP2uiv', None, [GLenum, GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glMultiTexCoordP3ui = _link_function('glMultiTexCoordP3ui', None, [GLenum, GLenum, GLuint], requires='OpenGL 3.3')
+glMultiTexCoordP3uiv = _link_function('glMultiTexCoordP3uiv', None, [GLenum, GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glMultiTexCoordP4ui = _link_function('glMultiTexCoordP4ui', None, [GLenum, GLenum, GLuint], requires='OpenGL 3.3')
+glMultiTexCoordP4uiv = _link_function('glMultiTexCoordP4uiv', None, [GLenum, GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glNamedBufferData = _link_function('glNamedBufferData', None, [GLuint, GLsizeiptr, POINTER(GLvoid), GLenum], requires='OpenGL 4.5')
+glNamedBufferStorage = _link_function('glNamedBufferStorage', None, [GLuint, GLsizeiptr, POINTER(GLvoid), GLbitfield], requires='OpenGL 4.5')
+glNamedBufferSubData = _link_function('glNamedBufferSubData', None, [GLuint, GLintptr, GLsizeiptr, POINTER(GLvoid)], requires='OpenGL 4.5')
+glNamedFramebufferDrawBuffer = _link_function('glNamedFramebufferDrawBuffer', None, [GLuint, GLenum], requires='OpenGL 4.5')
+glNamedFramebufferDrawBuffers = _link_function('glNamedFramebufferDrawBuffers', None, [GLuint, GLsizei, POINTER(GLenum)], requires='OpenGL 4.5')
+glNamedFramebufferParameteri = _link_function('glNamedFramebufferParameteri', None, [GLuint, GLenum, GLint], requires='OpenGL 4.5')
+glNamedFramebufferReadBuffer = _link_function('glNamedFramebufferReadBuffer', None, [GLuint, GLenum], requires='OpenGL 4.5')
+glNamedFramebufferRenderbuffer = _link_function('glNamedFramebufferRenderbuffer', None, [GLuint, GLenum, GLenum, GLuint], requires='OpenGL 4.5')
+glNamedFramebufferTexture = _link_function('glNamedFramebufferTexture', None, [GLuint, GLenum, GLuint, GLint], requires='OpenGL 4.5')
+glNamedFramebufferTextureLayer = _link_function('glNamedFramebufferTextureLayer', None, [GLuint, GLenum, GLuint, GLint, GLint], requires='OpenGL 4.5')
+glNamedRenderbufferStorage = _link_function('glNamedRenderbufferStorage', None, [GLuint, GLenum, GLsizei, GLsizei], requires='OpenGL 4.5')
+glNamedRenderbufferStorageMultisample = _link_function('glNamedRenderbufferStorageMultisample', None, [GLuint, GLsizei, GLenum, GLsizei, GLsizei], requires='OpenGL 4.5')
+glNewList = _link_function('glNewList', None, [GLuint, GLenum], requires='OpenGL 1.0')
+glNormal3b = _link_function('glNormal3b', None, [GLbyte, GLbyte, GLbyte], requires='OpenGL 1.0')
+glNormal3bv = _link_function('glNormal3bv', None, [POINTER(GLbyte)], requires='OpenGL 1.0')
+glNormal3d = _link_function('glNormal3d', None, [GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glNormal3dv = _link_function('glNormal3dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glNormal3f = _link_function('glNormal3f', None, [GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glNormal3fv = _link_function('glNormal3fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glNormal3i = _link_function('glNormal3i', None, [GLint, GLint, GLint], requires='OpenGL 1.0')
+glNormal3iv = _link_function('glNormal3iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glNormal3s = _link_function('glNormal3s', None, [GLshort, GLshort, GLshort], requires='OpenGL 1.0')
+glNormal3sv = _link_function('glNormal3sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glNormalP3ui = _link_function('glNormalP3ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glNormalP3uiv = _link_function('glNormalP3uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glNormalPointer = _link_function('glNormalPointer', None, [GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.1')
+glObjectLabel = _link_function('glObjectLabel', None, [GLenum, GLuint, GLsizei, POINTER(GLchar)], requires='OpenGL 4.3')
+glObjectPtrLabel = _link_function('glObjectPtrLabel', None, [POINTER(GLvoid), GLsizei, POINTER(GLchar)], requires='OpenGL 4.3')
+glOrtho = _link_function('glOrtho', None, [GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glPassThrough = _link_function('glPassThrough', None, [GLfloat], requires='OpenGL 1.0')
+glPatchParameterfv = _link_function('glPatchParameterfv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 4.0')
+glPatchParameteri = _link_function('glPatchParameteri', None, [GLenum, GLint], requires='OpenGL 4.0')
+glPauseTransformFeedback = _link_function('glPauseTransformFeedback', None, [], requires='OpenGL 4.0')
+glPixelMapfv = _link_function('glPixelMapfv', None, [GLenum, GLsizei, POINTER(GLfloat)], requires='OpenGL 1.0')
+glPixelMapuiv = _link_function('glPixelMapuiv', None, [GLenum, GLsizei, POINTER(GLuint)], requires='OpenGL 1.0')
+glPixelMapusv = _link_function('glPixelMapusv', None, [GLenum, GLsizei, POINTER(GLushort)], requires='OpenGL 1.0')
+glPixelStoref = _link_function('glPixelStoref', None, [GLenum, GLfloat], requires='OpenGL 1.0')
+glPixelStorei = _link_function('glPixelStorei', None, [GLenum, GLint], requires='OpenGL 1.0')
+glPixelTransferf = _link_function('glPixelTransferf', None, [GLenum, GLfloat], requires='OpenGL 1.0')
+glPixelTransferi = _link_function('glPixelTransferi', None, [GLenum, GLint], requires='OpenGL 1.0')
+glPixelZoom = _link_function('glPixelZoom', None, [GLfloat, GLfloat], requires='OpenGL 1.0')
+glPointParameterf = _link_function('glPointParameterf', None, [GLenum, GLfloat], requires='OpenGL 1.4')
+glPointParameterfv = _link_function('glPointParameterfv', None, [GLenum, POINTER(GLfloat)], requires='OpenGL 1.4')
+glPointParameteri = _link_function('glPointParameteri', None, [GLenum, GLint], requires='OpenGL 1.4')
+glPointParameteriv = _link_function('glPointParameteriv', None, [GLenum, POINTER(GLint)], requires='OpenGL 1.4')
+glPointSize = _link_function('glPointSize', None, [GLfloat], requires='OpenGL 1.0')
+glPolygonMode = _link_function('glPolygonMode', None, [GLenum, GLenum], requires='OpenGL 1.0')
+glPolygonOffset = _link_function('glPolygonOffset', None, [GLfloat, GLfloat], requires='OpenGL 1.1')
+glPolygonOffsetClamp = _link_function('glPolygonOffsetClamp', None, [GLfloat, GLfloat, GLfloat], requires='OpenGL 4.6')
+glPolygonStipple = _link_function('glPolygonStipple', None, [POINTER(GLubyte)], requires='OpenGL 1.0')
+glPopAttrib = _link_function('glPopAttrib', None, [], requires='OpenGL 1.0')
+glPopClientAttrib = _link_function('glPopClientAttrib', None, [], requires='OpenGL 1.1')
+glPopDebugGroup = _link_function('glPopDebugGroup', None, [], requires='OpenGL 4.3')
+glPopMatrix = _link_function('glPopMatrix', None, [], requires='OpenGL 1.0')
+glPopName = _link_function('glPopName', None, [], requires='OpenGL 1.0')
+glPrimitiveRestartIndex = _link_function('glPrimitiveRestartIndex', None, [GLuint], requires='OpenGL 3.1')
+glPrioritizeTextures = _link_function('glPrioritizeTextures', None, [GLsizei, POINTER(GLuint), POINTER(GLfloat)], requires='OpenGL 1.1')
+glProgramBinary = _link_function('glProgramBinary', None, [GLuint, GLenum, POINTER(GLvoid), GLsizei], requires='OpenGL 4.1')
+glProgramParameteri = _link_function('glProgramParameteri', None, [GLuint, GLenum, GLint], requires='OpenGL 4.1')
+glProgramUniform1d = _link_function('glProgramUniform1d', None, [GLuint, GLint, GLdouble], requires='OpenGL 4.1')
+glProgramUniform1dv = _link_function('glProgramUniform1dv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniform1f = _link_function('glProgramUniform1f', None, [GLuint, GLint, GLfloat], requires='OpenGL 4.1')
+glProgramUniform1fv = _link_function('glProgramUniform1fv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniform1i = _link_function('glProgramUniform1i', None, [GLuint, GLint, GLint], requires='OpenGL 4.1')
+glProgramUniform1iv = _link_function('glProgramUniform1iv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], requires='OpenGL 4.1')
+glProgramUniform1ui = _link_function('glProgramUniform1ui', None, [GLuint, GLint, GLuint], requires='OpenGL 4.1')
+glProgramUniform1uiv = _link_function('glProgramUniform1uiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.1')
+glProgramUniform2d = _link_function('glProgramUniform2d', None, [GLuint, GLint, GLdouble, GLdouble], requires='OpenGL 4.1')
+glProgramUniform2dv = _link_function('glProgramUniform2dv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniform2f = _link_function('glProgramUniform2f', None, [GLuint, GLint, GLfloat, GLfloat], requires='OpenGL 4.1')
+glProgramUniform2fv = _link_function('glProgramUniform2fv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniform2i = _link_function('glProgramUniform2i', None, [GLuint, GLint, GLint, GLint], requires='OpenGL 4.1')
+glProgramUniform2iv = _link_function('glProgramUniform2iv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], requires='OpenGL 4.1')
+glProgramUniform2ui = _link_function('glProgramUniform2ui', None, [GLuint, GLint, GLuint, GLuint], requires='OpenGL 4.1')
+glProgramUniform2uiv = _link_function('glProgramUniform2uiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.1')
+glProgramUniform3d = _link_function('glProgramUniform3d', None, [GLuint, GLint, GLdouble, GLdouble, GLdouble], requires='OpenGL 4.1')
+glProgramUniform3dv = _link_function('glProgramUniform3dv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniform3f = _link_function('glProgramUniform3f', None, [GLuint, GLint, GLfloat, GLfloat, GLfloat], requires='OpenGL 4.1')
+glProgramUniform3fv = _link_function('glProgramUniform3fv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniform3i = _link_function('glProgramUniform3i', None, [GLuint, GLint, GLint, GLint, GLint], requires='OpenGL 4.1')
+glProgramUniform3iv = _link_function('glProgramUniform3iv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], requires='OpenGL 4.1')
+glProgramUniform3ui = _link_function('glProgramUniform3ui', None, [GLuint, GLint, GLuint, GLuint, GLuint], requires='OpenGL 4.1')
+glProgramUniform3uiv = _link_function('glProgramUniform3uiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.1')
+glProgramUniform4d = _link_function('glProgramUniform4d', None, [GLuint, GLint, GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 4.1')
+glProgramUniform4dv = _link_function('glProgramUniform4dv', None, [GLuint, GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniform4f = _link_function('glProgramUniform4f', None, [GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 4.1')
+glProgramUniform4fv = _link_function('glProgramUniform4fv', None, [GLuint, GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniform4i = _link_function('glProgramUniform4i', None, [GLuint, GLint, GLint, GLint, GLint, GLint], requires='OpenGL 4.1')
+glProgramUniform4iv = _link_function('glProgramUniform4iv', None, [GLuint, GLint, GLsizei, POINTER(GLint)], requires='OpenGL 4.1')
+glProgramUniform4ui = _link_function('glProgramUniform4ui', None, [GLuint, GLint, GLuint, GLuint, GLuint, GLuint], requires='OpenGL 4.1')
+glProgramUniform4uiv = _link_function('glProgramUniform4uiv', None, [GLuint, GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 4.1')
+glProgramUniformMatrix2dv = _link_function('glProgramUniformMatrix2dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix2fv = _link_function('glProgramUniformMatrix2fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix2x3dv = _link_function('glProgramUniformMatrix2x3dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix2x3fv = _link_function('glProgramUniformMatrix2x3fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix2x4dv = _link_function('glProgramUniformMatrix2x4dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix2x4fv = _link_function('glProgramUniformMatrix2x4fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix3dv = _link_function('glProgramUniformMatrix3dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix3fv = _link_function('glProgramUniformMatrix3fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix3x2dv = _link_function('glProgramUniformMatrix3x2dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix3x2fv = _link_function('glProgramUniformMatrix3x2fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix3x4dv = _link_function('glProgramUniformMatrix3x4dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix3x4fv = _link_function('glProgramUniformMatrix3x4fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix4dv = _link_function('glProgramUniformMatrix4dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix4fv = _link_function('glProgramUniformMatrix4fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix4x2dv = _link_function('glProgramUniformMatrix4x2dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix4x2fv = _link_function('glProgramUniformMatrix4x2fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProgramUniformMatrix4x3dv = _link_function('glProgramUniformMatrix4x3dv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.1')
+glProgramUniformMatrix4x3fv = _link_function('glProgramUniformMatrix4x3fv', None, [GLuint, GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 4.1')
+glProvokingVertex = _link_function('glProvokingVertex', None, [GLenum], requires='OpenGL 3.2')
+glPushAttrib = _link_function('glPushAttrib', None, [GLbitfield], requires='OpenGL 1.0')
+glPushClientAttrib = _link_function('glPushClientAttrib', None, [GLbitfield], requires='OpenGL 1.1')
+glPushDebugGroup = _link_function('glPushDebugGroup', None, [GLenum, GLuint, GLsizei, POINTER(GLchar)], requires='OpenGL 4.3')
+glPushMatrix = _link_function('glPushMatrix', None, [], requires='OpenGL 1.0')
+glPushName = _link_function('glPushName', None, [GLuint], requires='OpenGL 1.0')
+glQueryCounter = _link_function('glQueryCounter', None, [GLuint, GLenum], requires='OpenGL 3.3')
+glRasterPos2d = _link_function('glRasterPos2d', None, [GLdouble, GLdouble], requires='OpenGL 1.0')
+glRasterPos2dv = _link_function('glRasterPos2dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glRasterPos2f = _link_function('glRasterPos2f', None, [GLfloat, GLfloat], requires='OpenGL 1.0')
+glRasterPos2fv = _link_function('glRasterPos2fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glRasterPos2i = _link_function('glRasterPos2i', None, [GLint, GLint], requires='OpenGL 1.0')
+glRasterPos2iv = _link_function('glRasterPos2iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glRasterPos2s = _link_function('glRasterPos2s', None, [GLshort, GLshort], requires='OpenGL 1.0')
+glRasterPos2sv = _link_function('glRasterPos2sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glRasterPos3d = _link_function('glRasterPos3d', None, [GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glRasterPos3dv = _link_function('glRasterPos3dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glRasterPos3f = _link_function('glRasterPos3f', None, [GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glRasterPos3fv = _link_function('glRasterPos3fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glRasterPos3i = _link_function('glRasterPos3i', None, [GLint, GLint, GLint], requires='OpenGL 1.0')
+glRasterPos3iv = _link_function('glRasterPos3iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glRasterPos3s = _link_function('glRasterPos3s', None, [GLshort, GLshort, GLshort], requires='OpenGL 1.0')
+glRasterPos3sv = _link_function('glRasterPos3sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glRasterPos4d = _link_function('glRasterPos4d', None, [GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glRasterPos4dv = _link_function('glRasterPos4dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glRasterPos4f = _link_function('glRasterPos4f', None, [GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glRasterPos4fv = _link_function('glRasterPos4fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glRasterPos4i = _link_function('glRasterPos4i', None, [GLint, GLint, GLint, GLint], requires='OpenGL 1.0')
+glRasterPos4iv = _link_function('glRasterPos4iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glRasterPos4s = _link_function('glRasterPos4s', None, [GLshort, GLshort, GLshort, GLshort], requires='OpenGL 1.0')
+glRasterPos4sv = _link_function('glRasterPos4sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glReadBuffer = _link_function('glReadBuffer', None, [GLenum], requires='OpenGL 1.0')
+glReadPixels = _link_function('glReadPixels', None, [GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.0')
+glReadnPixels = _link_function('glReadnPixels', None, [GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.5')
+glRectd = _link_function('glRectd', None, [GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glRectdv = _link_function('glRectdv', None, [POINTER(GLdouble), POINTER(GLdouble)], requires='OpenGL 1.0')
+glRectf = _link_function('glRectf', None, [GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glRectfv = _link_function('glRectfv', None, [POINTER(GLfloat), POINTER(GLfloat)], requires='OpenGL 1.0')
+glRecti = _link_function('glRecti', None, [GLint, GLint, GLint, GLint], requires='OpenGL 1.0')
+glRectiv = _link_function('glRectiv', None, [POINTER(GLint), POINTER(GLint)], requires='OpenGL 1.0')
+glRects = _link_function('glRects', None, [GLshort, GLshort, GLshort, GLshort], requires='OpenGL 1.0')
+glRectsv = _link_function('glRectsv', None, [POINTER(GLshort), POINTER(GLshort)], requires='OpenGL 1.0')
+glReleaseShaderCompiler = _link_function('glReleaseShaderCompiler', None, [], requires='OpenGL 4.1')
+glRenderMode = _link_function('glRenderMode', GLint, [GLenum], requires='OpenGL 1.0')
+glRenderbufferStorage = _link_function('glRenderbufferStorage', None, [GLenum, GLenum, GLsizei, GLsizei], requires='OpenGL 3.0')
+glRenderbufferStorageEXT = _link_function('glRenderbufferStorageEXT', None, [GLenum, GLenum, GLsizei, GLsizei], requires='None')
+glRenderbufferStorageMultisample = _link_function('glRenderbufferStorageMultisample', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei], requires='OpenGL 3.0')
+glResumeTransformFeedback = _link_function('glResumeTransformFeedback', None, [], requires='OpenGL 4.0')
+glRotated = _link_function('glRotated', None, [GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glRotatef = _link_function('glRotatef', None, [GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glSampleCoverage = _link_function('glSampleCoverage', None, [GLfloat, GLboolean], requires='OpenGL 1.3')
+glSampleCoverageARB = _link_function('glSampleCoverageARB', None, [GLfloat, GLboolean], requires='None')
+glSampleMaski = _link_function('glSampleMaski', None, [GLuint, GLbitfield], requires='OpenGL 3.2')
+glSamplerParameterIiv = _link_function('glSamplerParameterIiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 3.3')
+glSamplerParameterIuiv = _link_function('glSamplerParameterIuiv', None, [GLuint, GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glSamplerParameterf = _link_function('glSamplerParameterf', None, [GLuint, GLenum, GLfloat], requires='OpenGL 3.3')
+glSamplerParameterfv = _link_function('glSamplerParameterfv', None, [GLuint, GLenum, POINTER(GLfloat)], requires='OpenGL 3.3')
+glSamplerParameteri = _link_function('glSamplerParameteri', None, [GLuint, GLenum, GLint], requires='OpenGL 3.3')
+glSamplerParameteriv = _link_function('glSamplerParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 3.3')
+glScaled = _link_function('glScaled', None, [GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glScalef = _link_function('glScalef', None, [GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glScissor = _link_function('glScissor', None, [GLint, GLint, GLsizei, GLsizei], requires='OpenGL 1.0')
+glScissorArrayv = _link_function('glScissorArrayv', None, [GLuint, GLsizei, POINTER(GLint)], requires='OpenGL 4.1')
+glScissorIndexed = _link_function('glScissorIndexed', None, [GLuint, GLint, GLint, GLsizei, GLsizei], requires='OpenGL 4.1')
+glScissorIndexedv = _link_function('glScissorIndexedv', None, [GLuint, POINTER(GLint)], requires='OpenGL 4.1')
+glSecondaryColor3b = _link_function('glSecondaryColor3b', None, [GLbyte, GLbyte, GLbyte], requires='OpenGL 1.4')
+glSecondaryColor3bv = _link_function('glSecondaryColor3bv', None, [POINTER(GLbyte)], requires='OpenGL 1.4')
+glSecondaryColor3d = _link_function('glSecondaryColor3d', None, [GLdouble, GLdouble, GLdouble], requires='OpenGL 1.4')
+glSecondaryColor3dv = _link_function('glSecondaryColor3dv', None, [POINTER(GLdouble)], requires='OpenGL 1.4')
+glSecondaryColor3f = _link_function('glSecondaryColor3f', None, [GLfloat, GLfloat, GLfloat], requires='OpenGL 1.4')
+glSecondaryColor3fv = _link_function('glSecondaryColor3fv', None, [POINTER(GLfloat)], requires='OpenGL 1.4')
+glSecondaryColor3i = _link_function('glSecondaryColor3i', None, [GLint, GLint, GLint], requires='OpenGL 1.4')
+glSecondaryColor3iv = _link_function('glSecondaryColor3iv', None, [POINTER(GLint)], requires='OpenGL 1.4')
+glSecondaryColor3s = _link_function('glSecondaryColor3s', None, [GLshort, GLshort, GLshort], requires='OpenGL 1.4')
+glSecondaryColor3sv = _link_function('glSecondaryColor3sv', None, [POINTER(GLshort)], requires='OpenGL 1.4')
+glSecondaryColor3ub = _link_function('glSecondaryColor3ub', None, [GLubyte, GLubyte, GLubyte], requires='OpenGL 1.4')
+glSecondaryColor3ubv = _link_function('glSecondaryColor3ubv', None, [POINTER(GLubyte)], requires='OpenGL 1.4')
+glSecondaryColor3ui = _link_function('glSecondaryColor3ui', None, [GLuint, GLuint, GLuint], requires='OpenGL 1.4')
+glSecondaryColor3uiv = _link_function('glSecondaryColor3uiv', None, [POINTER(GLuint)], requires='OpenGL 1.4')
+glSecondaryColor3us = _link_function('glSecondaryColor3us', None, [GLushort, GLushort, GLushort], requires='OpenGL 1.4')
+glSecondaryColor3usv = _link_function('glSecondaryColor3usv', None, [POINTER(GLushort)], requires='OpenGL 1.4')
+glSecondaryColorP3ui = _link_function('glSecondaryColorP3ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glSecondaryColorP3uiv = _link_function('glSecondaryColorP3uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glSecondaryColorPointer = _link_function('glSecondaryColorPointer', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.4')
+glSelectBuffer = _link_function('glSelectBuffer', None, [GLsizei, POINTER(GLuint)], requires='OpenGL 1.0')
+glShadeModel = _link_function('glShadeModel', None, [GLenum], requires='OpenGL 1.0')
+glShaderBinary = _link_function('glShaderBinary', None, [GLsizei, POINTER(GLuint), GLenum, POINTER(GLvoid), GLsizei], requires='OpenGL 4.1')
+glShaderSource = _link_function('glShaderSource', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), POINTER(GLint)], requires='OpenGL 2.0')
+glShaderStorageBlockBinding = _link_function('glShaderStorageBlockBinding', None, [GLuint, GLuint, GLuint], requires='OpenGL 4.3')
+glSpecializeShader = _link_function('glSpecializeShader', None, [GLuint, POINTER(GLchar), GLuint, POINTER(GLuint), POINTER(GLuint)], requires='OpenGL 4.6')
+glStencilFunc = _link_function('glStencilFunc', None, [GLenum, GLint, GLuint], requires='OpenGL 1.0')
+glStencilFuncSeparate = _link_function('glStencilFuncSeparate', None, [GLenum, GLenum, GLint, GLuint], requires='OpenGL 2.0')
+glStencilMask = _link_function('glStencilMask', None, [GLuint], requires='OpenGL 1.0')
+glStencilMaskSeparate = _link_function('glStencilMaskSeparate', None, [GLenum, GLuint], requires='OpenGL 2.0')
+glStencilOp = _link_function('glStencilOp', None, [GLenum, GLenum, GLenum], requires='OpenGL 1.0')
+glStencilOpSeparate = _link_function('glStencilOpSeparate', None, [GLenum, GLenum, GLenum, GLenum], requires='OpenGL 2.0')
+glTexBuffer = _link_function('glTexBuffer', None, [GLenum, GLenum, GLuint], requires='OpenGL 3.1')
+glTexBufferRange = _link_function('glTexBufferRange', None, [GLenum, GLenum, GLuint, GLintptr, GLsizeiptr], requires='OpenGL 4.3')
+glTexCoord1d = _link_function('glTexCoord1d', None, [GLdouble], requires='OpenGL 1.0')
+glTexCoord1dv = _link_function('glTexCoord1dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glTexCoord1f = _link_function('glTexCoord1f', None, [GLfloat], requires='OpenGL 1.0')
+glTexCoord1fv = _link_function('glTexCoord1fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glTexCoord1i = _link_function('glTexCoord1i', None, [GLint], requires='OpenGL 1.0')
+glTexCoord1iv = _link_function('glTexCoord1iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glTexCoord1s = _link_function('glTexCoord1s', None, [GLshort], requires='OpenGL 1.0')
+glTexCoord1sv = _link_function('glTexCoord1sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glTexCoord2d = _link_function('glTexCoord2d', None, [GLdouble, GLdouble], requires='OpenGL 1.0')
+glTexCoord2dv = _link_function('glTexCoord2dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glTexCoord2f = _link_function('glTexCoord2f', None, [GLfloat, GLfloat], requires='OpenGL 1.0')
+glTexCoord2fv = _link_function('glTexCoord2fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glTexCoord2i = _link_function('glTexCoord2i', None, [GLint, GLint], requires='OpenGL 1.0')
+glTexCoord2iv = _link_function('glTexCoord2iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glTexCoord2s = _link_function('glTexCoord2s', None, [GLshort, GLshort], requires='OpenGL 1.0')
+glTexCoord2sv = _link_function('glTexCoord2sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glTexCoord3d = _link_function('glTexCoord3d', None, [GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glTexCoord3dv = _link_function('glTexCoord3dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glTexCoord3f = _link_function('glTexCoord3f', None, [GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glTexCoord3fv = _link_function('glTexCoord3fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glTexCoord3i = _link_function('glTexCoord3i', None, [GLint, GLint, GLint], requires='OpenGL 1.0')
+glTexCoord3iv = _link_function('glTexCoord3iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glTexCoord3s = _link_function('glTexCoord3s', None, [GLshort, GLshort, GLshort], requires='OpenGL 1.0')
+glTexCoord3sv = _link_function('glTexCoord3sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glTexCoord4d = _link_function('glTexCoord4d', None, [GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glTexCoord4dv = _link_function('glTexCoord4dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glTexCoord4f = _link_function('glTexCoord4f', None, [GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glTexCoord4fv = _link_function('glTexCoord4fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glTexCoord4i = _link_function('glTexCoord4i', None, [GLint, GLint, GLint, GLint], requires='OpenGL 1.0')
+glTexCoord4iv = _link_function('glTexCoord4iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glTexCoord4s = _link_function('glTexCoord4s', None, [GLshort, GLshort, GLshort, GLshort], requires='OpenGL 1.0')
+glTexCoord4sv = _link_function('glTexCoord4sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glTexCoordP1ui = _link_function('glTexCoordP1ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glTexCoordP1uiv = _link_function('glTexCoordP1uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glTexCoordP2ui = _link_function('glTexCoordP2ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glTexCoordP2uiv = _link_function('glTexCoordP2uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glTexCoordP3ui = _link_function('glTexCoordP3ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glTexCoordP3uiv = _link_function('glTexCoordP3uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glTexCoordP4ui = _link_function('glTexCoordP4ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glTexCoordP4uiv = _link_function('glTexCoordP4uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glTexCoordPointer = _link_function('glTexCoordPointer', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.1')
+glTexEnvf = _link_function('glTexEnvf', None, [GLenum, GLenum, GLfloat], requires='OpenGL 1.0')
+glTexEnvfv = _link_function('glTexEnvfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glTexEnvi = _link_function('glTexEnvi', None, [GLenum, GLenum, GLint], requires='OpenGL 1.0')
+glTexEnviv = _link_function('glTexEnviv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glTexGend = _link_function('glTexGend', None, [GLenum, GLenum, GLdouble], requires='OpenGL 1.0')
+glTexGendv = _link_function('glTexGendv', None, [GLenum, GLenum, POINTER(GLdouble)], requires='OpenGL 1.0')
+glTexGenf = _link_function('glTexGenf', None, [GLenum, GLenum, GLfloat], requires='OpenGL 1.0')
+glTexGenfv = _link_function('glTexGenfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glTexGeni = _link_function('glTexGeni', None, [GLenum, GLenum, GLint], requires='OpenGL 1.0')
+glTexGeniv = _link_function('glTexGeniv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glTexImage1D = _link_function('glTexImage1D', None, [GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.0')
+glTexImage2D = _link_function('glTexImage2D', None, [GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.0')
+glTexImage2DMultisample = _link_function('glTexImage2DMultisample', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean], requires='OpenGL 3.2')
+glTexImage3D = _link_function('glTexImage3D', None, [GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.2')
+glTexImage3DMultisample = _link_function('glTexImage3DMultisample', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean], requires='OpenGL 3.2')
+glTexParameterIiv = _link_function('glTexParameterIiv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 3.0')
+glTexParameterIuiv = _link_function('glTexParameterIuiv', None, [GLenum, GLenum, POINTER(GLuint)], requires='OpenGL 3.0')
+glTexParameterf = _link_function('glTexParameterf', None, [GLenum, GLenum, GLfloat], requires='OpenGL 1.0')
+glTexParameterfv = _link_function('glTexParameterfv', None, [GLenum, GLenum, POINTER(GLfloat)], requires='OpenGL 1.0')
+glTexParameteri = _link_function('glTexParameteri', None, [GLenum, GLenum, GLint], requires='OpenGL 1.0')
+glTexParameteriv = _link_function('glTexParameteriv', None, [GLenum, GLenum, POINTER(GLint)], requires='OpenGL 1.0')
+glTexStorage1D = _link_function('glTexStorage1D', None, [GLenum, GLsizei, GLenum, GLsizei], requires='OpenGL 4.2')
+glTexStorage2D = _link_function('glTexStorage2D', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei], requires='OpenGL 4.2')
+glTexStorage2DMultisample = _link_function('glTexStorage2DMultisample', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean], requires='OpenGL 4.3')
+glTexStorage3D = _link_function('glTexStorage3D', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei], requires='OpenGL 4.2')
+glTexStorage3DMultisample = _link_function('glTexStorage3DMultisample', None, [GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean], requires='OpenGL 4.3')
+glTexSubImage1D = _link_function('glTexSubImage1D', None, [GLenum, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.1')
+glTexSubImage2D = _link_function('glTexSubImage2D', None, [GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.1')
+glTexSubImage3D = _link_function('glTexSubImage3D', None, [GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 1.2')
+glTextureBarrier = _link_function('glTextureBarrier', None, [], requires='OpenGL 4.5')
+glTextureBuffer = _link_function('glTextureBuffer', None, [GLuint, GLenum, GLuint], requires='OpenGL 4.5')
+glTextureBufferRange = _link_function('glTextureBufferRange', None, [GLuint, GLenum, GLuint, GLintptr, GLsizeiptr], requires='OpenGL 4.5')
+glTextureParameterIiv = _link_function('glTextureParameterIiv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glTextureParameterIuiv = _link_function('glTextureParameterIuiv', None, [GLuint, GLenum, POINTER(GLuint)], requires='OpenGL 4.5')
+glTextureParameterf = _link_function('glTextureParameterf', None, [GLuint, GLenum, GLfloat], requires='OpenGL 4.5')
+glTextureParameterfv = _link_function('glTextureParameterfv', None, [GLuint, GLenum, POINTER(GLfloat)], requires='OpenGL 4.5')
+glTextureParameteri = _link_function('glTextureParameteri', None, [GLuint, GLenum, GLint], requires='OpenGL 4.5')
+glTextureParameteriv = _link_function('glTextureParameteriv', None, [GLuint, GLenum, POINTER(GLint)], requires='OpenGL 4.5')
+glTextureStorage1D = _link_function('glTextureStorage1D', None, [GLuint, GLsizei, GLenum, GLsizei], requires='OpenGL 4.5')
+glTextureStorage2D = _link_function('glTextureStorage2D', None, [GLuint, GLsizei, GLenum, GLsizei, GLsizei], requires='OpenGL 4.5')
+glTextureStorage2DMultisample = _link_function('glTextureStorage2DMultisample', None, [GLuint, GLsizei, GLenum, GLsizei, GLsizei, GLboolean], requires='OpenGL 4.5')
+glTextureStorage3D = _link_function('glTextureStorage3D', None, [GLuint, GLsizei, GLenum, GLsizei, GLsizei, GLsizei], requires='OpenGL 4.5')
+glTextureStorage3DMultisample = _link_function('glTextureStorage3DMultisample', None, [GLuint, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean], requires='OpenGL 4.5')
+glTextureSubImage1D = _link_function('glTextureSubImage1D', None, [GLuint, GLint, GLint, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.5')
+glTextureSubImage2D = _link_function('glTextureSubImage2D', None, [GLuint, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.5')
+glTextureSubImage3D = _link_function('glTextureSubImage3D', None, [GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, POINTER(GLvoid)], requires='OpenGL 4.5')
+glTextureView = _link_function('glTextureView', None, [GLuint, GLenum, GLuint, GLenum, GLuint, GLuint, GLuint, GLuint], requires='OpenGL 4.3')
+glTransformFeedbackBufferBase = _link_function('glTransformFeedbackBufferBase', None, [GLuint, GLuint, GLuint], requires='OpenGL 4.5')
+glTransformFeedbackBufferRange = _link_function('glTransformFeedbackBufferRange', None, [GLuint, GLuint, GLuint, GLintptr, GLsizeiptr], requires='OpenGL 4.5')
+glTransformFeedbackVaryings = _link_function('glTransformFeedbackVaryings', None, [GLuint, GLsizei, POINTER(POINTER(GLchar)), GLenum], requires='OpenGL 3.0')
+glTranslated = _link_function('glTranslated', None, [GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glTranslatef = _link_function('glTranslatef', None, [GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glUniform1d = _link_function('glUniform1d', None, [GLint, GLdouble], requires='OpenGL 4.0')
+glUniform1dv = _link_function('glUniform1dv', None, [GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniform1f = _link_function('glUniform1f', None, [GLint, GLfloat], requires='OpenGL 2.0')
+glUniform1fv = _link_function('glUniform1fv', None, [GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniform1i = _link_function('glUniform1i', None, [GLint, GLint], requires='OpenGL 2.0')
+glUniform1iv = _link_function('glUniform1iv', None, [GLint, GLsizei, POINTER(GLint)], requires='OpenGL 2.0')
+glUniform1ui = _link_function('glUniform1ui', None, [GLint, GLuint], requires='OpenGL 3.0')
+glUniform1uiv = _link_function('glUniform1uiv', None, [GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glUniform2d = _link_function('glUniform2d', None, [GLint, GLdouble, GLdouble], requires='OpenGL 4.0')
+glUniform2dv = _link_function('glUniform2dv', None, [GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniform2f = _link_function('glUniform2f', None, [GLint, GLfloat, GLfloat], requires='OpenGL 2.0')
+glUniform2fv = _link_function('glUniform2fv', None, [GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniform2i = _link_function('glUniform2i', None, [GLint, GLint, GLint], requires='OpenGL 2.0')
+glUniform2iv = _link_function('glUniform2iv', None, [GLint, GLsizei, POINTER(GLint)], requires='OpenGL 2.0')
+glUniform2ui = _link_function('glUniform2ui', None, [GLint, GLuint, GLuint], requires='OpenGL 3.0')
+glUniform2uiv = _link_function('glUniform2uiv', None, [GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glUniform3d = _link_function('glUniform3d', None, [GLint, GLdouble, GLdouble, GLdouble], requires='OpenGL 4.0')
+glUniform3dv = _link_function('glUniform3dv', None, [GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniform3f = _link_function('glUniform3f', None, [GLint, GLfloat, GLfloat, GLfloat], requires='OpenGL 2.0')
+glUniform3fv = _link_function('glUniform3fv', None, [GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniform3i = _link_function('glUniform3i', None, [GLint, GLint, GLint, GLint], requires='OpenGL 2.0')
+glUniform3iv = _link_function('glUniform3iv', None, [GLint, GLsizei, POINTER(GLint)], requires='OpenGL 2.0')
+glUniform3ui = _link_function('glUniform3ui', None, [GLint, GLuint, GLuint, GLuint], requires='OpenGL 3.0')
+glUniform3uiv = _link_function('glUniform3uiv', None, [GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glUniform4d = _link_function('glUniform4d', None, [GLint, GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 4.0')
+glUniform4dv = _link_function('glUniform4dv', None, [GLint, GLsizei, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniform4f = _link_function('glUniform4f', None, [GLint, GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 2.0')
+glUniform4fv = _link_function('glUniform4fv', None, [GLint, GLsizei, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniform4i = _link_function('glUniform4i', None, [GLint, GLint, GLint, GLint, GLint], requires='OpenGL 2.0')
+glUniform4iv = _link_function('glUniform4iv', None, [GLint, GLsizei, POINTER(GLint)], requires='OpenGL 2.0')
+glUniform4ui = _link_function('glUniform4ui', None, [GLint, GLuint, GLuint, GLuint, GLuint], requires='OpenGL 3.0')
+glUniform4uiv = _link_function('glUniform4uiv', None, [GLint, GLsizei, POINTER(GLuint)], requires='OpenGL 3.0')
+glUniformBlockBinding = _link_function('glUniformBlockBinding', None, [GLuint, GLuint, GLuint], requires='OpenGL 3.1')
+glUniformMatrix2dv = _link_function('glUniformMatrix2dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix2fv = _link_function('glUniformMatrix2fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniformMatrix2x3dv = _link_function('glUniformMatrix2x3dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix2x3fv = _link_function('glUniformMatrix2x3fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.1')
+glUniformMatrix2x4dv = _link_function('glUniformMatrix2x4dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix2x4fv = _link_function('glUniformMatrix2x4fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.1')
+glUniformMatrix3dv = _link_function('glUniformMatrix3dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix3fv = _link_function('glUniformMatrix3fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniformMatrix3x2dv = _link_function('glUniformMatrix3x2dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix3x2fv = _link_function('glUniformMatrix3x2fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.1')
+glUniformMatrix3x4dv = _link_function('glUniformMatrix3x4dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix3x4fv = _link_function('glUniformMatrix3x4fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.1')
+glUniformMatrix4dv = _link_function('glUniformMatrix4dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix4fv = _link_function('glUniformMatrix4fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.0')
+glUniformMatrix4x2dv = _link_function('glUniformMatrix4x2dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix4x2fv = _link_function('glUniformMatrix4x2fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.1')
+glUniformMatrix4x3dv = _link_function('glUniformMatrix4x3dv', None, [GLint, GLsizei, GLboolean, POINTER(GLdouble)], requires='OpenGL 4.0')
+glUniformMatrix4x3fv = _link_function('glUniformMatrix4x3fv', None, [GLint, GLsizei, GLboolean, POINTER(GLfloat)], requires='OpenGL 2.1')
+glUniformSubroutinesuiv = _link_function('glUniformSubroutinesuiv', None, [GLenum, GLsizei, POINTER(GLuint)], requires='OpenGL 4.0')
+glUnmapBuffer = _link_function('glUnmapBuffer', GLboolean, [GLenum], requires='OpenGL 1.5')
+glUnmapNamedBuffer = _link_function('glUnmapNamedBuffer', GLboolean, [GLuint], requires='OpenGL 4.5')
+glUseProgram = _link_function('glUseProgram', None, [GLuint], requires='OpenGL 2.0')
+glUseProgramStages = _link_function('glUseProgramStages', None, [GLuint, GLbitfield, GLuint], requires='OpenGL 4.1')
+glValidateProgram = _link_function('glValidateProgram', None, [GLuint], requires='OpenGL 2.0')
+glValidateProgramPipeline = _link_function('glValidateProgramPipeline', None, [GLuint], requires='OpenGL 4.1')
+glVertex2d = _link_function('glVertex2d', None, [GLdouble, GLdouble], requires='OpenGL 1.0')
+glVertex2dv = _link_function('glVertex2dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glVertex2f = _link_function('glVertex2f', None, [GLfloat, GLfloat], requires='OpenGL 1.0')
+glVertex2fv = _link_function('glVertex2fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glVertex2i = _link_function('glVertex2i', None, [GLint, GLint], requires='OpenGL 1.0')
+glVertex2iv = _link_function('glVertex2iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glVertex2s = _link_function('glVertex2s', None, [GLshort, GLshort], requires='OpenGL 1.0')
+glVertex2sv = _link_function('glVertex2sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glVertex3d = _link_function('glVertex3d', None, [GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glVertex3dv = _link_function('glVertex3dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glVertex3f = _link_function('glVertex3f', None, [GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glVertex3fv = _link_function('glVertex3fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glVertex3i = _link_function('glVertex3i', None, [GLint, GLint, GLint], requires='OpenGL 1.0')
+glVertex3iv = _link_function('glVertex3iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glVertex3s = _link_function('glVertex3s', None, [GLshort, GLshort, GLshort], requires='OpenGL 1.0')
+glVertex3sv = _link_function('glVertex3sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glVertex4d = _link_function('glVertex4d', None, [GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 1.0')
+glVertex4dv = _link_function('glVertex4dv', None, [POINTER(GLdouble)], requires='OpenGL 1.0')
+glVertex4f = _link_function('glVertex4f', None, [GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 1.0')
+glVertex4fv = _link_function('glVertex4fv', None, [POINTER(GLfloat)], requires='OpenGL 1.0')
+glVertex4i = _link_function('glVertex4i', None, [GLint, GLint, GLint, GLint], requires='OpenGL 1.0')
+glVertex4iv = _link_function('glVertex4iv', None, [POINTER(GLint)], requires='OpenGL 1.0')
+glVertex4s = _link_function('glVertex4s', None, [GLshort, GLshort, GLshort, GLshort], requires='OpenGL 1.0')
+glVertex4sv = _link_function('glVertex4sv', None, [POINTER(GLshort)], requires='OpenGL 1.0')
+glVertexArrayAttribBinding = _link_function('glVertexArrayAttribBinding', None, [GLuint, GLuint, GLuint], requires='OpenGL 4.5')
+glVertexArrayAttribFormat = _link_function('glVertexArrayAttribFormat', None, [GLuint, GLuint, GLint, GLenum, GLboolean, GLuint], requires='OpenGL 4.5')
+glVertexArrayAttribIFormat = _link_function('glVertexArrayAttribIFormat', None, [GLuint, GLuint, GLint, GLenum, GLuint], requires='OpenGL 4.5')
+glVertexArrayAttribLFormat = _link_function('glVertexArrayAttribLFormat', None, [GLuint, GLuint, GLint, GLenum, GLuint], requires='OpenGL 4.5')
+glVertexArrayBindingDivisor = _link_function('glVertexArrayBindingDivisor', None, [GLuint, GLuint, GLuint], requires='OpenGL 4.5')
+glVertexArrayElementBuffer = _link_function('glVertexArrayElementBuffer', None, [GLuint, GLuint], requires='OpenGL 4.5')
+glVertexArrayVertexBuffer = _link_function('glVertexArrayVertexBuffer', None, [GLuint, GLuint, GLuint, GLintptr, GLsizei], requires='OpenGL 4.5')
+glVertexArrayVertexBuffers = _link_function('glVertexArrayVertexBuffers', None, [GLuint, GLuint, GLsizei, POINTER(GLuint), POINTER(GLintptr), POINTER(GLsizei)], requires='OpenGL 4.5')
+glVertexAttrib1d = _link_function('glVertexAttrib1d', None, [GLuint, GLdouble], requires='OpenGL 2.0')
+glVertexAttrib1dv = _link_function('glVertexAttrib1dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 2.0')
+glVertexAttrib1f = _link_function('glVertexAttrib1f', None, [GLuint, GLfloat], requires='OpenGL 2.0')
+glVertexAttrib1fv = _link_function('glVertexAttrib1fv', None, [GLuint, POINTER(GLfloat)], requires='OpenGL 2.0')
+glVertexAttrib1s = _link_function('glVertexAttrib1s', None, [GLuint, GLshort], requires='OpenGL 2.0')
+glVertexAttrib1sv = _link_function('glVertexAttrib1sv', None, [GLuint, POINTER(GLshort)], requires='OpenGL 2.0')
+glVertexAttrib2d = _link_function('glVertexAttrib2d', None, [GLuint, GLdouble, GLdouble], requires='OpenGL 2.0')
+glVertexAttrib2dv = _link_function('glVertexAttrib2dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 2.0')
+glVertexAttrib2f = _link_function('glVertexAttrib2f', None, [GLuint, GLfloat, GLfloat], requires='OpenGL 2.0')
+glVertexAttrib2fv = _link_function('glVertexAttrib2fv', None, [GLuint, POINTER(GLfloat)], requires='OpenGL 2.0')
+glVertexAttrib2s = _link_function('glVertexAttrib2s', None, [GLuint, GLshort, GLshort], requires='OpenGL 2.0')
+glVertexAttrib2sv = _link_function('glVertexAttrib2sv', None, [GLuint, POINTER(GLshort)], requires='OpenGL 2.0')
+glVertexAttrib3d = _link_function('glVertexAttrib3d', None, [GLuint, GLdouble, GLdouble, GLdouble], requires='OpenGL 2.0')
+glVertexAttrib3dv = _link_function('glVertexAttrib3dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 2.0')
+glVertexAttrib3f = _link_function('glVertexAttrib3f', None, [GLuint, GLfloat, GLfloat, GLfloat], requires='OpenGL 2.0')
+glVertexAttrib3fv = _link_function('glVertexAttrib3fv', None, [GLuint, POINTER(GLfloat)], requires='OpenGL 2.0')
+glVertexAttrib3s = _link_function('glVertexAttrib3s', None, [GLuint, GLshort, GLshort, GLshort], requires='OpenGL 2.0')
+glVertexAttrib3sv = _link_function('glVertexAttrib3sv', None, [GLuint, POINTER(GLshort)], requires='OpenGL 2.0')
+glVertexAttrib4Nbv = _link_function('glVertexAttrib4Nbv', None, [GLuint, POINTER(GLbyte)], requires='OpenGL 2.0')
+glVertexAttrib4Niv = _link_function('glVertexAttrib4Niv', None, [GLuint, POINTER(GLint)], requires='OpenGL 2.0')
+glVertexAttrib4Nsv = _link_function('glVertexAttrib4Nsv', None, [GLuint, POINTER(GLshort)], requires='OpenGL 2.0')
+glVertexAttrib4Nub = _link_function('glVertexAttrib4Nub', None, [GLuint, GLubyte, GLubyte, GLubyte, GLubyte], requires='OpenGL 2.0')
+glVertexAttrib4Nubv = _link_function('glVertexAttrib4Nubv', None, [GLuint, POINTER(GLubyte)], requires='OpenGL 2.0')
+glVertexAttrib4Nuiv = _link_function('glVertexAttrib4Nuiv', None, [GLuint, POINTER(GLuint)], requires='OpenGL 2.0')
+glVertexAttrib4Nusv = _link_function('glVertexAttrib4Nusv', None, [GLuint, POINTER(GLushort)], requires='OpenGL 2.0')
+glVertexAttrib4bv = _link_function('glVertexAttrib4bv', None, [GLuint, POINTER(GLbyte)], requires='OpenGL 2.0')
+glVertexAttrib4d = _link_function('glVertexAttrib4d', None, [GLuint, GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 2.0')
+glVertexAttrib4dv = _link_function('glVertexAttrib4dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 2.0')
+glVertexAttrib4f = _link_function('glVertexAttrib4f', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 2.0')
+glVertexAttrib4fv = _link_function('glVertexAttrib4fv', None, [GLuint, POINTER(GLfloat)], requires='OpenGL 2.0')
+glVertexAttrib4iv = _link_function('glVertexAttrib4iv', None, [GLuint, POINTER(GLint)], requires='OpenGL 2.0')
+glVertexAttrib4s = _link_function('glVertexAttrib4s', None, [GLuint, GLshort, GLshort, GLshort, GLshort], requires='OpenGL 2.0')
+glVertexAttrib4sv = _link_function('glVertexAttrib4sv', None, [GLuint, POINTER(GLshort)], requires='OpenGL 2.0')
+glVertexAttrib4ubv = _link_function('glVertexAttrib4ubv', None, [GLuint, POINTER(GLubyte)], requires='OpenGL 2.0')
+glVertexAttrib4uiv = _link_function('glVertexAttrib4uiv', None, [GLuint, POINTER(GLuint)], requires='OpenGL 2.0')
+glVertexAttrib4usv = _link_function('glVertexAttrib4usv', None, [GLuint, POINTER(GLushort)], requires='OpenGL 2.0')
+glVertexAttribBinding = _link_function('glVertexAttribBinding', None, [GLuint, GLuint], requires='OpenGL 4.3')
+glVertexAttribDivisor = _link_function('glVertexAttribDivisor', None, [GLuint, GLuint], requires='OpenGL 3.3')
+glVertexAttribFormat = _link_function('glVertexAttribFormat', None, [GLuint, GLint, GLenum, GLboolean, GLuint], requires='OpenGL 4.3')
+glVertexAttribI1i = _link_function('glVertexAttribI1i', None, [GLuint, GLint], requires='OpenGL 3.0')
+glVertexAttribI1iv = _link_function('glVertexAttribI1iv', None, [GLuint, POINTER(GLint)], requires='OpenGL 3.0')
+glVertexAttribI1ui = _link_function('glVertexAttribI1ui', None, [GLuint, GLuint], requires='OpenGL 3.0')
+glVertexAttribI1uiv = _link_function('glVertexAttribI1uiv', None, [GLuint, POINTER(GLuint)], requires='OpenGL 3.0')
+glVertexAttribI2i = _link_function('glVertexAttribI2i', None, [GLuint, GLint, GLint], requires='OpenGL 3.0')
+glVertexAttribI2iv = _link_function('glVertexAttribI2iv', None, [GLuint, POINTER(GLint)], requires='OpenGL 3.0')
+glVertexAttribI2ui = _link_function('glVertexAttribI2ui', None, [GLuint, GLuint, GLuint], requires='OpenGL 3.0')
+glVertexAttribI2uiv = _link_function('glVertexAttribI2uiv', None, [GLuint, POINTER(GLuint)], requires='OpenGL 3.0')
+glVertexAttribI3i = _link_function('glVertexAttribI3i', None, [GLuint, GLint, GLint, GLint], requires='OpenGL 3.0')
+glVertexAttribI3iv = _link_function('glVertexAttribI3iv', None, [GLuint, POINTER(GLint)], requires='OpenGL 3.0')
+glVertexAttribI3ui = _link_function('glVertexAttribI3ui', None, [GLuint, GLuint, GLuint, GLuint], requires='OpenGL 3.0')
+glVertexAttribI3uiv = _link_function('glVertexAttribI3uiv', None, [GLuint, POINTER(GLuint)], requires='OpenGL 3.0')
+glVertexAttribI4bv = _link_function('glVertexAttribI4bv', None, [GLuint, POINTER(GLbyte)], requires='OpenGL 3.0')
+glVertexAttribI4i = _link_function('glVertexAttribI4i', None, [GLuint, GLint, GLint, GLint, GLint], requires='OpenGL 3.0')
+glVertexAttribI4iv = _link_function('glVertexAttribI4iv', None, [GLuint, POINTER(GLint)], requires='OpenGL 3.0')
+glVertexAttribI4sv = _link_function('glVertexAttribI4sv', None, [GLuint, POINTER(GLshort)], requires='OpenGL 3.0')
+glVertexAttribI4ubv = _link_function('glVertexAttribI4ubv', None, [GLuint, POINTER(GLubyte)], requires='OpenGL 3.0')
+glVertexAttribI4ui = _link_function('glVertexAttribI4ui', None, [GLuint, GLuint, GLuint, GLuint, GLuint], requires='OpenGL 3.0')
+glVertexAttribI4uiv = _link_function('glVertexAttribI4uiv', None, [GLuint, POINTER(GLuint)], requires='OpenGL 3.0')
+glVertexAttribI4usv = _link_function('glVertexAttribI4usv', None, [GLuint, POINTER(GLushort)], requires='OpenGL 3.0')
+glVertexAttribIFormat = _link_function('glVertexAttribIFormat', None, [GLuint, GLint, GLenum, GLuint], requires='OpenGL 4.3')
+glVertexAttribIPointer = _link_function('glVertexAttribIPointer', None, [GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 3.0')
+glVertexAttribL1d = _link_function('glVertexAttribL1d', None, [GLuint, GLdouble], requires='OpenGL 4.1')
+glVertexAttribL1dv = _link_function('glVertexAttribL1dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 4.1')
+glVertexAttribL2d = _link_function('glVertexAttribL2d', None, [GLuint, GLdouble, GLdouble], requires='OpenGL 4.1')
+glVertexAttribL2dv = _link_function('glVertexAttribL2dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 4.1')
+glVertexAttribL3d = _link_function('glVertexAttribL3d', None, [GLuint, GLdouble, GLdouble, GLdouble], requires='OpenGL 4.1')
+glVertexAttribL3dv = _link_function('glVertexAttribL3dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 4.1')
+glVertexAttribL4d = _link_function('glVertexAttribL4d', None, [GLuint, GLdouble, GLdouble, GLdouble, GLdouble], requires='OpenGL 4.1')
+glVertexAttribL4dv = _link_function('glVertexAttribL4dv', None, [GLuint, POINTER(GLdouble)], requires='OpenGL 4.1')
+glVertexAttribLFormat = _link_function('glVertexAttribLFormat', None, [GLuint, GLint, GLenum, GLuint], requires='OpenGL 4.3')
+glVertexAttribLPointer = _link_function('glVertexAttribLPointer', None, [GLuint, GLint, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 4.1')
+glVertexAttribP1ui = _link_function('glVertexAttribP1ui', None, [GLuint, GLenum, GLboolean, GLuint], requires='OpenGL 3.3')
+glVertexAttribP1uiv = _link_function('glVertexAttribP1uiv', None, [GLuint, GLenum, GLboolean, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexAttribP2ui = _link_function('glVertexAttribP2ui', None, [GLuint, GLenum, GLboolean, GLuint], requires='OpenGL 3.3')
+glVertexAttribP2uiv = _link_function('glVertexAttribP2uiv', None, [GLuint, GLenum, GLboolean, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexAttribP3ui = _link_function('glVertexAttribP3ui', None, [GLuint, GLenum, GLboolean, GLuint], requires='OpenGL 3.3')
+glVertexAttribP3uiv = _link_function('glVertexAttribP3uiv', None, [GLuint, GLenum, GLboolean, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexAttribP4ui = _link_function('glVertexAttribP4ui', None, [GLuint, GLenum, GLboolean, GLuint], requires='OpenGL 3.3')
+glVertexAttribP4uiv = _link_function('glVertexAttribP4uiv', None, [GLuint, GLenum, GLboolean, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexAttribPointer = _link_function('glVertexAttribPointer', None, [GLuint, GLint, GLenum, GLboolean, GLsizei, POINTER(GLvoid)], requires='OpenGL 2.0')
+glVertexBindingDivisor = _link_function('glVertexBindingDivisor', None, [GLuint, GLuint], requires='OpenGL 4.3')
+glVertexP2ui = _link_function('glVertexP2ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glVertexP2uiv = _link_function('glVertexP2uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexP3ui = _link_function('glVertexP3ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glVertexP3uiv = _link_function('glVertexP3uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexP4ui = _link_function('glVertexP4ui', None, [GLenum, GLuint], requires='OpenGL 3.3')
+glVertexP4uiv = _link_function('glVertexP4uiv', None, [GLenum, POINTER(GLuint)], requires='OpenGL 3.3')
+glVertexPointer = _link_function('glVertexPointer', None, [GLint, GLenum, GLsizei, POINTER(GLvoid)], requires='OpenGL 1.1')
+glViewport = _link_function('glViewport', None, [GLint, GLint, GLsizei, GLsizei], requires='OpenGL 1.0')
+glViewportArrayv = _link_function('glViewportArrayv', None, [GLuint, GLsizei, POINTER(GLfloat)], requires='OpenGL 4.1')
+glViewportIndexedf = _link_function('glViewportIndexedf', None, [GLuint, GLfloat, GLfloat, GLfloat, GLfloat], requires='OpenGL 4.1')
+glViewportIndexedfv = _link_function('glViewportIndexedfv', None, [GLuint, POINTER(GLfloat)], requires='OpenGL 4.1')
+glWaitSync = _link_function('glWaitSync', None, [GLsync, GLbitfield, GLuint64], requires='OpenGL 3.2')
+glWindowPos2d = _link_function('glWindowPos2d', None, [GLdouble, GLdouble], requires='OpenGL 1.4')
+glWindowPos2dv = _link_function('glWindowPos2dv', None, [POINTER(GLdouble)], requires='OpenGL 1.4')
+glWindowPos2f = _link_function('glWindowPos2f', None, [GLfloat, GLfloat], requires='OpenGL 1.4')
+glWindowPos2fv = _link_function('glWindowPos2fv', None, [POINTER(GLfloat)], requires='OpenGL 1.4')
+glWindowPos2i = _link_function('glWindowPos2i', None, [GLint, GLint], requires='OpenGL 1.4')
+glWindowPos2iv = _link_function('glWindowPos2iv', None, [POINTER(GLint)], requires='OpenGL 1.4')
+glWindowPos2s = _link_function('glWindowPos2s', None, [GLshort, GLshort], requires='OpenGL 1.4')
+glWindowPos2sv = _link_function('glWindowPos2sv', None, [POINTER(GLshort)], requires='OpenGL 1.4')
+glWindowPos3d = _link_function('glWindowPos3d', None, [GLdouble, GLdouble, GLdouble], requires='OpenGL 1.4')
+glWindowPos3dv = _link_function('glWindowPos3dv', None, [POINTER(GLdouble)], requires='OpenGL 1.4')
+glWindowPos3f = _link_function('glWindowPos3f', None, [GLfloat, GLfloat, GLfloat], requires='OpenGL 1.4')
+glWindowPos3fv = _link_function('glWindowPos3fv', None, [POINTER(GLfloat)], requires='OpenGL 1.4')
+glWindowPos3i = _link_function('glWindowPos3i', None, [GLint, GLint, GLint], requires='OpenGL 1.4')
+glWindowPos3iv = _link_function('glWindowPos3iv', None, [POINTER(GLint)], requires='OpenGL 1.4')
+glWindowPos3s = _link_function('glWindowPos3s', None, [GLshort, GLshort, GLshort], requires='OpenGL 1.4')
+glWindowPos3sv = _link_function('glWindowPos3sv', None, [POINTER(GLshort)], requires='OpenGL 1.4')
+
+
+__all__ = [
+ 'GLenum',
+ 'GLboolean',
+ 'GLbitfield',
+ 'GLvoid',
+ 'GLbyte',
+ 'GLubyte',
+ 'GLshort',
+ 'GLushort',
+ 'GLint',
+ 'GLuint',
+ 'GLclampx',
+ 'GLsizei',
+ 'GLfloat',
+ 'GLclampf',
+ 'GLdouble',
+ 'GLclampd',
+ 'GLchar',
+ 'GLintptr',
+ 'GLsizeiptr',
+ 'GLint64',
+ 'GLuint64',
+ 'GLsync',
+ 'GLDEBUGPROC',
+ 'GL_DEPTH_BUFFER_BIT',
+ 'GL_STENCIL_BUFFER_BIT',
+ 'GL_COLOR_BUFFER_BIT',
+ 'GL_FALSE',
+ 'GL_TRUE',
+ 'GL_POINTS',
+ 'GL_LINES',
+ 'GL_LINE_LOOP',
+ 'GL_LINE_STRIP',
+ 'GL_TRIANGLES',
+ 'GL_TRIANGLE_STRIP',
+ 'GL_TRIANGLE_FAN',
+ 'GL_QUADS',
+ 'GL_NEVER',
+ 'GL_LESS',
+ 'GL_EQUAL',
+ 'GL_LEQUAL',
+ 'GL_GREATER',
+ 'GL_NOTEQUAL',
+ 'GL_GEQUAL',
+ 'GL_ALWAYS',
+ 'GL_ZERO',
+ 'GL_ONE',
+ 'GL_SRC_COLOR',
+ 'GL_ONE_MINUS_SRC_COLOR',
+ 'GL_SRC_ALPHA',
+ 'GL_ONE_MINUS_SRC_ALPHA',
+ 'GL_DST_ALPHA',
+ 'GL_ONE_MINUS_DST_ALPHA',
+ 'GL_DST_COLOR',
+ 'GL_ONE_MINUS_DST_COLOR',
+ 'GL_SRC_ALPHA_SATURATE',
+ 'GL_NONE',
+ 'GL_FRONT_LEFT',
+ 'GL_FRONT_RIGHT',
+ 'GL_BACK_LEFT',
+ 'GL_BACK_RIGHT',
+ 'GL_FRONT',
+ 'GL_BACK',
+ 'GL_LEFT',
+ 'GL_RIGHT',
+ 'GL_FRONT_AND_BACK',
+ 'GL_NO_ERROR',
+ 'GL_INVALID_ENUM',
+ 'GL_INVALID_VALUE',
+ 'GL_INVALID_OPERATION',
+ 'GL_OUT_OF_MEMORY',
+ 'GL_CW',
+ 'GL_CCW',
+ 'GL_POINT_SIZE',
+ 'GL_POINT_SIZE_RANGE',
+ 'GL_POINT_SIZE_GRANULARITY',
+ 'GL_LINE_SMOOTH',
+ 'GL_LINE_WIDTH',
+ 'GL_LINE_WIDTH_RANGE',
+ 'GL_LINE_WIDTH_GRANULARITY',
+ 'GL_POLYGON_MODE',
+ 'GL_POLYGON_SMOOTH',
+ 'GL_CULL_FACE',
+ 'GL_CULL_FACE_MODE',
+ 'GL_FRONT_FACE',
+ 'GL_DEPTH_RANGE',
+ 'GL_DEPTH_TEST',
+ 'GL_DEPTH_WRITEMASK',
+ 'GL_DEPTH_CLEAR_VALUE',
+ 'GL_DEPTH_FUNC',
+ 'GL_STENCIL_TEST',
+ 'GL_STENCIL_CLEAR_VALUE',
+ 'GL_STENCIL_FUNC',
+ 'GL_STENCIL_VALUE_MASK',
+ 'GL_STENCIL_FAIL',
+ 'GL_STENCIL_PASS_DEPTH_FAIL',
+ 'GL_STENCIL_PASS_DEPTH_PASS',
+ 'GL_STENCIL_REF',
+ 'GL_STENCIL_WRITEMASK',
+ 'GL_VIEWPORT',
+ 'GL_DITHER',
+ 'GL_BLEND_DST',
+ 'GL_BLEND_SRC',
+ 'GL_BLEND',
+ 'GL_LOGIC_OP_MODE',
+ 'GL_DRAW_BUFFER',
+ 'GL_READ_BUFFER',
+ 'GL_SCISSOR_BOX',
+ 'GL_SCISSOR_TEST',
+ 'GL_COLOR_CLEAR_VALUE',
+ 'GL_COLOR_WRITEMASK',
+ 'GL_DOUBLEBUFFER',
+ 'GL_STEREO',
+ 'GL_LINE_SMOOTH_HINT',
+ 'GL_POLYGON_SMOOTH_HINT',
+ 'GL_UNPACK_SWAP_BYTES',
+ 'GL_UNPACK_LSB_FIRST',
+ 'GL_UNPACK_ROW_LENGTH',
+ 'GL_UNPACK_SKIP_ROWS',
+ 'GL_UNPACK_SKIP_PIXELS',
+ 'GL_UNPACK_ALIGNMENT',
+ 'GL_PACK_SWAP_BYTES',
+ 'GL_PACK_LSB_FIRST',
+ 'GL_PACK_ROW_LENGTH',
+ 'GL_PACK_SKIP_ROWS',
+ 'GL_PACK_SKIP_PIXELS',
+ 'GL_PACK_ALIGNMENT',
+ 'GL_MAX_TEXTURE_SIZE',
+ 'GL_MAX_VIEWPORT_DIMS',
+ 'GL_SUBPIXEL_BITS',
+ 'GL_TEXTURE_1D',
+ 'GL_TEXTURE_2D',
+ 'GL_TEXTURE_WIDTH',
+ 'GL_TEXTURE_HEIGHT',
+ 'GL_TEXTURE_BORDER_COLOR',
+ 'GL_DONT_CARE',
+ 'GL_FASTEST',
+ 'GL_NICEST',
+ 'GL_BYTE',
+ 'GL_UNSIGNED_BYTE',
+ 'GL_SHORT',
+ 'GL_UNSIGNED_SHORT',
+ 'GL_INT',
+ 'GL_UNSIGNED_INT',
+ 'GL_FLOAT',
+ 'GL_STACK_OVERFLOW',
+ 'GL_STACK_UNDERFLOW',
+ 'GL_CLEAR',
+ 'GL_AND',
+ 'GL_AND_REVERSE',
+ 'GL_COPY',
+ 'GL_AND_INVERTED',
+ 'GL_NOOP',
+ 'GL_XOR',
+ 'GL_OR',
+ 'GL_NOR',
+ 'GL_EQUIV',
+ 'GL_INVERT',
+ 'GL_OR_REVERSE',
+ 'GL_COPY_INVERTED',
+ 'GL_OR_INVERTED',
+ 'GL_NAND',
+ 'GL_SET',
+ 'GL_TEXTURE',
+ 'GL_COLOR',
+ 'GL_DEPTH',
+ 'GL_STENCIL',
+ 'GL_STENCIL_INDEX',
+ 'GL_DEPTH_COMPONENT',
+ 'GL_RED',
+ 'GL_GREEN',
+ 'GL_BLUE',
+ 'GL_ALPHA',
+ 'GL_RGB',
+ 'GL_RGBA',
+ 'GL_POINT',
+ 'GL_LINE',
+ 'GL_FILL',
+ 'GL_KEEP',
+ 'GL_REPLACE',
+ 'GL_INCR',
+ 'GL_DECR',
+ 'GL_VENDOR',
+ 'GL_RENDERER',
+ 'GL_VERSION',
+ 'GL_EXTENSIONS',
+ 'GL_NEAREST',
+ 'GL_LINEAR',
+ 'GL_NEAREST_MIPMAP_NEAREST',
+ 'GL_LINEAR_MIPMAP_NEAREST',
+ 'GL_NEAREST_MIPMAP_LINEAR',
+ 'GL_LINEAR_MIPMAP_LINEAR',
+ 'GL_TEXTURE_MAG_FILTER',
+ 'GL_TEXTURE_MIN_FILTER',
+ 'GL_TEXTURE_WRAP_S',
+ 'GL_TEXTURE_WRAP_T',
+ 'GL_REPEAT',
+ 'GL_CURRENT_BIT',
+ 'GL_POINT_BIT',
+ 'GL_LINE_BIT',
+ 'GL_POLYGON_BIT',
+ 'GL_POLYGON_STIPPLE_BIT',
+ 'GL_PIXEL_MODE_BIT',
+ 'GL_LIGHTING_BIT',
+ 'GL_FOG_BIT',
+ 'GL_ACCUM_BUFFER_BIT',
+ 'GL_VIEWPORT_BIT',
+ 'GL_TRANSFORM_BIT',
+ 'GL_ENABLE_BIT',
+ 'GL_HINT_BIT',
+ 'GL_EVAL_BIT',
+ 'GL_LIST_BIT',
+ 'GL_TEXTURE_BIT',
+ 'GL_SCISSOR_BIT',
+ 'GL_ALL_ATTRIB_BITS',
+ 'GL_QUAD_STRIP',
+ 'GL_POLYGON',
+ 'GL_ACCUM',
+ 'GL_LOAD',
+ 'GL_RETURN',
+ 'GL_MULT',
+ 'GL_ADD',
+ 'GL_AUX0',
+ 'GL_AUX1',
+ 'GL_AUX2',
+ 'GL_AUX3',
+ 'GL_2D',
+ 'GL_3D',
+ 'GL_3D_COLOR',
+ 'GL_3D_COLOR_TEXTURE',
+ 'GL_4D_COLOR_TEXTURE',
+ 'GL_PASS_THROUGH_TOKEN',
+ 'GL_POINT_TOKEN',
+ 'GL_LINE_TOKEN',
+ 'GL_POLYGON_TOKEN',
+ 'GL_BITMAP_TOKEN',
+ 'GL_DRAW_PIXEL_TOKEN',
+ 'GL_COPY_PIXEL_TOKEN',
+ 'GL_LINE_RESET_TOKEN',
+ 'GL_EXP',
+ 'GL_EXP2',
+ 'GL_COEFF',
+ 'GL_ORDER',
+ 'GL_DOMAIN',
+ 'GL_PIXEL_MAP_I_TO_I',
+ 'GL_PIXEL_MAP_S_TO_S',
+ 'GL_PIXEL_MAP_I_TO_R',
+ 'GL_PIXEL_MAP_I_TO_G',
+ 'GL_PIXEL_MAP_I_TO_B',
+ 'GL_PIXEL_MAP_I_TO_A',
+ 'GL_PIXEL_MAP_R_TO_R',
+ 'GL_PIXEL_MAP_G_TO_G',
+ 'GL_PIXEL_MAP_B_TO_B',
+ 'GL_PIXEL_MAP_A_TO_A',
+ 'GL_CURRENT_COLOR',
+ 'GL_CURRENT_INDEX',
+ 'GL_CURRENT_NORMAL',
+ 'GL_CURRENT_TEXTURE_COORDS',
+ 'GL_CURRENT_RASTER_COLOR',
+ 'GL_CURRENT_RASTER_INDEX',
+ 'GL_CURRENT_RASTER_TEXTURE_COORDS',
+ 'GL_CURRENT_RASTER_POSITION',
+ 'GL_CURRENT_RASTER_POSITION_VALID',
+ 'GL_CURRENT_RASTER_DISTANCE',
+ 'GL_POINT_SMOOTH',
+ 'GL_LINE_STIPPLE',
+ 'GL_LINE_STIPPLE_PATTERN',
+ 'GL_LINE_STIPPLE_REPEAT',
+ 'GL_LIST_MODE',
+ 'GL_MAX_LIST_NESTING',
+ 'GL_LIST_BASE',
+ 'GL_LIST_INDEX',
+ 'GL_POLYGON_STIPPLE',
+ 'GL_EDGE_FLAG',
+ 'GL_LIGHTING',
+ 'GL_LIGHT_MODEL_LOCAL_VIEWER',
+ 'GL_LIGHT_MODEL_TWO_SIDE',
+ 'GL_LIGHT_MODEL_AMBIENT',
+ 'GL_SHADE_MODEL',
+ 'GL_COLOR_MATERIAL_FACE',
+ 'GL_COLOR_MATERIAL_PARAMETER',
+ 'GL_COLOR_MATERIAL',
+ 'GL_FOG',
+ 'GL_FOG_INDEX',
+ 'GL_FOG_DENSITY',
+ 'GL_FOG_START',
+ 'GL_FOG_END',
+ 'GL_FOG_MODE',
+ 'GL_FOG_COLOR',
+ 'GL_ACCUM_CLEAR_VALUE',
+ 'GL_MATRIX_MODE',
+ 'GL_NORMALIZE',
+ 'GL_MODELVIEW_STACK_DEPTH',
+ 'GL_PROJECTION_STACK_DEPTH',
+ 'GL_TEXTURE_STACK_DEPTH',
+ 'GL_MODELVIEW_MATRIX',
+ 'GL_PROJECTION_MATRIX',
+ 'GL_TEXTURE_MATRIX',
+ 'GL_ATTRIB_STACK_DEPTH',
+ 'GL_ALPHA_TEST',
+ 'GL_ALPHA_TEST_FUNC',
+ 'GL_ALPHA_TEST_REF',
+ 'GL_LOGIC_OP',
+ 'GL_AUX_BUFFERS',
+ 'GL_INDEX_CLEAR_VALUE',
+ 'GL_INDEX_WRITEMASK',
+ 'GL_INDEX_MODE',
+ 'GL_RGBA_MODE',
+ 'GL_RENDER_MODE',
+ 'GL_PERSPECTIVE_CORRECTION_HINT',
+ 'GL_POINT_SMOOTH_HINT',
+ 'GL_FOG_HINT',
+ 'GL_TEXTURE_GEN_S',
+ 'GL_TEXTURE_GEN_T',
+ 'GL_TEXTURE_GEN_R',
+ 'GL_TEXTURE_GEN_Q',
+ 'GL_PIXEL_MAP_I_TO_I_SIZE',
+ 'GL_PIXEL_MAP_S_TO_S_SIZE',
+ 'GL_PIXEL_MAP_I_TO_R_SIZE',
+ 'GL_PIXEL_MAP_I_TO_G_SIZE',
+ 'GL_PIXEL_MAP_I_TO_B_SIZE',
+ 'GL_PIXEL_MAP_I_TO_A_SIZE',
+ 'GL_PIXEL_MAP_R_TO_R_SIZE',
+ 'GL_PIXEL_MAP_G_TO_G_SIZE',
+ 'GL_PIXEL_MAP_B_TO_B_SIZE',
+ 'GL_PIXEL_MAP_A_TO_A_SIZE',
+ 'GL_MAP_COLOR',
+ 'GL_MAP_STENCIL',
+ 'GL_INDEX_SHIFT',
+ 'GL_INDEX_OFFSET',
+ 'GL_RED_SCALE',
+ 'GL_RED_BIAS',
+ 'GL_ZOOM_X',
+ 'GL_ZOOM_Y',
+ 'GL_GREEN_SCALE',
+ 'GL_GREEN_BIAS',
+ 'GL_BLUE_SCALE',
+ 'GL_BLUE_BIAS',
+ 'GL_ALPHA_SCALE',
+ 'GL_ALPHA_BIAS',
+ 'GL_DEPTH_SCALE',
+ 'GL_DEPTH_BIAS',
+ 'GL_MAX_EVAL_ORDER',
+ 'GL_MAX_LIGHTS',
+ 'GL_MAX_CLIP_PLANES',
+ 'GL_MAX_PIXEL_MAP_TABLE',
+ 'GL_MAX_ATTRIB_STACK_DEPTH',
+ 'GL_MAX_MODELVIEW_STACK_DEPTH',
+ 'GL_MAX_NAME_STACK_DEPTH',
+ 'GL_MAX_PROJECTION_STACK_DEPTH',
+ 'GL_MAX_TEXTURE_STACK_DEPTH',
+ 'GL_INDEX_BITS',
+ 'GL_RED_BITS',
+ 'GL_GREEN_BITS',
+ 'GL_BLUE_BITS',
+ 'GL_ALPHA_BITS',
+ 'GL_DEPTH_BITS',
+ 'GL_STENCIL_BITS',
+ 'GL_ACCUM_RED_BITS',
+ 'GL_ACCUM_GREEN_BITS',
+ 'GL_ACCUM_BLUE_BITS',
+ 'GL_ACCUM_ALPHA_BITS',
+ 'GL_NAME_STACK_DEPTH',
+ 'GL_AUTO_NORMAL',
+ 'GL_MAP1_COLOR_4',
+ 'GL_MAP1_INDEX',
+ 'GL_MAP1_NORMAL',
+ 'GL_MAP1_TEXTURE_COORD_1',
+ 'GL_MAP1_TEXTURE_COORD_2',
+ 'GL_MAP1_TEXTURE_COORD_3',
+ 'GL_MAP1_TEXTURE_COORD_4',
+ 'GL_MAP1_VERTEX_3',
+ 'GL_MAP1_VERTEX_4',
+ 'GL_MAP2_COLOR_4',
+ 'GL_MAP2_INDEX',
+ 'GL_MAP2_NORMAL',
+ 'GL_MAP2_TEXTURE_COORD_1',
+ 'GL_MAP2_TEXTURE_COORD_2',
+ 'GL_MAP2_TEXTURE_COORD_3',
+ 'GL_MAP2_TEXTURE_COORD_4',
+ 'GL_MAP2_VERTEX_3',
+ 'GL_MAP2_VERTEX_4',
+ 'GL_MAP1_GRID_DOMAIN',
+ 'GL_MAP1_GRID_SEGMENTS',
+ 'GL_MAP2_GRID_DOMAIN',
+ 'GL_MAP2_GRID_SEGMENTS',
+ 'GL_TEXTURE_COMPONENTS',
+ 'GL_TEXTURE_BORDER',
+ 'GL_AMBIENT',
+ 'GL_DIFFUSE',
+ 'GL_SPECULAR',
+ 'GL_POSITION',
+ 'GL_SPOT_DIRECTION',
+ 'GL_SPOT_EXPONENT',
+ 'GL_SPOT_CUTOFF',
+ 'GL_CONSTANT_ATTENUATION',
+ 'GL_LINEAR_ATTENUATION',
+ 'GL_QUADRATIC_ATTENUATION',
+ 'GL_COMPILE',
+ 'GL_COMPILE_AND_EXECUTE',
+ 'GL_2_BYTES',
+ 'GL_3_BYTES',
+ 'GL_4_BYTES',
+ 'GL_EMISSION',
+ 'GL_SHININESS',
+ 'GL_AMBIENT_AND_DIFFUSE',
+ 'GL_COLOR_INDEXES',
+ 'GL_MODELVIEW',
+ 'GL_PROJECTION',
+ 'GL_COLOR_INDEX',
+ 'GL_LUMINANCE',
+ 'GL_LUMINANCE_ALPHA',
+ 'GL_BITMAP',
+ 'GL_RENDER',
+ 'GL_FEEDBACK',
+ 'GL_SELECT',
+ 'GL_FLAT',
+ 'GL_SMOOTH',
+ 'GL_S',
+ 'GL_T',
+ 'GL_R',
+ 'GL_Q',
+ 'GL_MODULATE',
+ 'GL_DECAL',
+ 'GL_TEXTURE_ENV_MODE',
+ 'GL_TEXTURE_ENV_COLOR',
+ 'GL_TEXTURE_ENV',
+ 'GL_EYE_LINEAR',
+ 'GL_OBJECT_LINEAR',
+ 'GL_SPHERE_MAP',
+ 'GL_TEXTURE_GEN_MODE',
+ 'GL_OBJECT_PLANE',
+ 'GL_EYE_PLANE',
+ 'GL_CLAMP',
+ 'GL_CLIP_PLANE0',
+ 'GL_CLIP_PLANE1',
+ 'GL_CLIP_PLANE2',
+ 'GL_CLIP_PLANE3',
+ 'GL_CLIP_PLANE4',
+ 'GL_CLIP_PLANE5',
+ 'GL_LIGHT0',
+ 'GL_LIGHT1',
+ 'GL_LIGHT2',
+ 'GL_LIGHT3',
+ 'GL_LIGHT4',
+ 'GL_LIGHT5',
+ 'GL_LIGHT6',
+ 'GL_LIGHT7',
+ 'GL_COLOR_LOGIC_OP',
+ 'GL_POLYGON_OFFSET_UNITS',
+ 'GL_POLYGON_OFFSET_POINT',
+ 'GL_POLYGON_OFFSET_LINE',
+ 'GL_POLYGON_OFFSET_FILL',
+ 'GL_POLYGON_OFFSET_FACTOR',
+ 'GL_TEXTURE_BINDING_1D',
+ 'GL_TEXTURE_BINDING_2D',
+ 'GL_TEXTURE_INTERNAL_FORMAT',
+ 'GL_TEXTURE_RED_SIZE',
+ 'GL_TEXTURE_GREEN_SIZE',
+ 'GL_TEXTURE_BLUE_SIZE',
+ 'GL_TEXTURE_ALPHA_SIZE',
+ 'GL_DOUBLE',
+ 'GL_PROXY_TEXTURE_1D',
+ 'GL_PROXY_TEXTURE_2D',
+ 'GL_R3_G3_B2',
+ 'GL_RGB4',
+ 'GL_RGB5',
+ 'GL_RGB8',
+ 'GL_RGB10',
+ 'GL_RGB12',
+ 'GL_RGB16',
+ 'GL_RGBA2',
+ 'GL_RGBA4',
+ 'GL_RGB5_A1',
+ 'GL_RGBA8',
+ 'GL_RGB10_A2',
+ 'GL_RGBA12',
+ 'GL_RGBA16',
+ 'GL_CLIENT_PIXEL_STORE_BIT',
+ 'GL_CLIENT_VERTEX_ARRAY_BIT',
+ 'GL_CLIENT_ALL_ATTRIB_BITS',
+ 'GL_VERTEX_ARRAY_POINTER',
+ 'GL_NORMAL_ARRAY_POINTER',
+ 'GL_COLOR_ARRAY_POINTER',
+ 'GL_INDEX_ARRAY_POINTER',
+ 'GL_TEXTURE_COORD_ARRAY_POINTER',
+ 'GL_EDGE_FLAG_ARRAY_POINTER',
+ 'GL_FEEDBACK_BUFFER_POINTER',
+ 'GL_SELECTION_BUFFER_POINTER',
+ 'GL_CLIENT_ATTRIB_STACK_DEPTH',
+ 'GL_INDEX_LOGIC_OP',
+ 'GL_MAX_CLIENT_ATTRIB_STACK_DEPTH',
+ 'GL_FEEDBACK_BUFFER_SIZE',
+ 'GL_FEEDBACK_BUFFER_TYPE',
+ 'GL_SELECTION_BUFFER_SIZE',
+ 'GL_VERTEX_ARRAY',
+ 'GL_NORMAL_ARRAY',
+ 'GL_COLOR_ARRAY',
+ 'GL_INDEX_ARRAY',
+ 'GL_TEXTURE_COORD_ARRAY',
+ 'GL_EDGE_FLAG_ARRAY',
+ 'GL_VERTEX_ARRAY_SIZE',
+ 'GL_VERTEX_ARRAY_TYPE',
+ 'GL_VERTEX_ARRAY_STRIDE',
+ 'GL_NORMAL_ARRAY_TYPE',
+ 'GL_NORMAL_ARRAY_STRIDE',
+ 'GL_COLOR_ARRAY_SIZE',
+ 'GL_COLOR_ARRAY_TYPE',
+ 'GL_COLOR_ARRAY_STRIDE',
+ 'GL_INDEX_ARRAY_TYPE',
+ 'GL_INDEX_ARRAY_STRIDE',
+ 'GL_TEXTURE_COORD_ARRAY_SIZE',
+ 'GL_TEXTURE_COORD_ARRAY_TYPE',
+ 'GL_TEXTURE_COORD_ARRAY_STRIDE',
+ 'GL_EDGE_FLAG_ARRAY_STRIDE',
+ 'GL_TEXTURE_LUMINANCE_SIZE',
+ 'GL_TEXTURE_INTENSITY_SIZE',
+ 'GL_TEXTURE_PRIORITY',
+ 'GL_TEXTURE_RESIDENT',
+ 'GL_ALPHA4',
+ 'GL_ALPHA8',
+ 'GL_ALPHA12',
+ 'GL_ALPHA16',
+ 'GL_LUMINANCE4',
+ 'GL_LUMINANCE8',
+ 'GL_LUMINANCE12',
+ 'GL_LUMINANCE16',
+ 'GL_LUMINANCE4_ALPHA4',
+ 'GL_LUMINANCE6_ALPHA2',
+ 'GL_LUMINANCE8_ALPHA8',
+ 'GL_LUMINANCE12_ALPHA4',
+ 'GL_LUMINANCE12_ALPHA12',
+ 'GL_LUMINANCE16_ALPHA16',
+ 'GL_INTENSITY',
+ 'GL_INTENSITY4',
+ 'GL_INTENSITY8',
+ 'GL_INTENSITY12',
+ 'GL_INTENSITY16',
+ 'GL_V2F',
+ 'GL_V3F',
+ 'GL_C4UB_V2F',
+ 'GL_C4UB_V3F',
+ 'GL_C3F_V3F',
+ 'GL_N3F_V3F',
+ 'GL_C4F_N3F_V3F',
+ 'GL_T2F_V3F',
+ 'GL_T4F_V4F',
+ 'GL_T2F_C4UB_V3F',
+ 'GL_T2F_C3F_V3F',
+ 'GL_T2F_N3F_V3F',
+ 'GL_T2F_C4F_N3F_V3F',
+ 'GL_T4F_C4F_N3F_V4F',
+ 'GL_UNSIGNED_BYTE_3_3_2',
+ 'GL_UNSIGNED_SHORT_4_4_4_4',
+ 'GL_UNSIGNED_SHORT_5_5_5_1',
+ 'GL_UNSIGNED_INT_8_8_8_8',
+ 'GL_UNSIGNED_INT_10_10_10_2',
+ 'GL_TEXTURE_BINDING_3D',
+ 'GL_PACK_SKIP_IMAGES',
+ 'GL_PACK_IMAGE_HEIGHT',
+ 'GL_UNPACK_SKIP_IMAGES',
+ 'GL_UNPACK_IMAGE_HEIGHT',
+ 'GL_TEXTURE_3D',
+ 'GL_PROXY_TEXTURE_3D',
+ 'GL_TEXTURE_DEPTH',
+ 'GL_TEXTURE_WRAP_R',
+ 'GL_MAX_3D_TEXTURE_SIZE',
+ 'GL_UNSIGNED_BYTE_2_3_3_REV',
+ 'GL_UNSIGNED_SHORT_5_6_5',
+ 'GL_UNSIGNED_SHORT_5_6_5_REV',
+ 'GL_UNSIGNED_SHORT_4_4_4_4_REV',
+ 'GL_UNSIGNED_SHORT_1_5_5_5_REV',
+ 'GL_UNSIGNED_INT_8_8_8_8_REV',
+ 'GL_UNSIGNED_INT_2_10_10_10_REV',
+ 'GL_BGR',
+ 'GL_BGRA',
+ 'GL_MAX_ELEMENTS_VERTICES',
+ 'GL_MAX_ELEMENTS_INDICES',
+ 'GL_CLAMP_TO_EDGE',
+ 'GL_TEXTURE_MIN_LOD',
+ 'GL_TEXTURE_MAX_LOD',
+ 'GL_TEXTURE_BASE_LEVEL',
+ 'GL_TEXTURE_MAX_LEVEL',
+ 'GL_SMOOTH_POINT_SIZE_RANGE',
+ 'GL_SMOOTH_POINT_SIZE_GRANULARITY',
+ 'GL_SMOOTH_LINE_WIDTH_RANGE',
+ 'GL_SMOOTH_LINE_WIDTH_GRANULARITY',
+ 'GL_ALIASED_LINE_WIDTH_RANGE',
+ 'GL_RESCALE_NORMAL',
+ 'GL_LIGHT_MODEL_COLOR_CONTROL',
+ 'GL_SINGLE_COLOR',
+ 'GL_SEPARATE_SPECULAR_COLOR',
+ 'GL_ALIASED_POINT_SIZE_RANGE',
+ 'GL_TEXTURE0',
+ 'GL_TEXTURE1',
+ 'GL_TEXTURE2',
+ 'GL_TEXTURE3',
+ 'GL_TEXTURE4',
+ 'GL_TEXTURE5',
+ 'GL_TEXTURE6',
+ 'GL_TEXTURE7',
+ 'GL_TEXTURE8',
+ 'GL_TEXTURE9',
+ 'GL_TEXTURE10',
+ 'GL_TEXTURE11',
+ 'GL_TEXTURE12',
+ 'GL_TEXTURE13',
+ 'GL_TEXTURE14',
+ 'GL_TEXTURE15',
+ 'GL_TEXTURE16',
+ 'GL_TEXTURE17',
+ 'GL_TEXTURE18',
+ 'GL_TEXTURE19',
+ 'GL_TEXTURE20',
+ 'GL_TEXTURE21',
+ 'GL_TEXTURE22',
+ 'GL_TEXTURE23',
+ 'GL_TEXTURE24',
+ 'GL_TEXTURE25',
+ 'GL_TEXTURE26',
+ 'GL_TEXTURE27',
+ 'GL_TEXTURE28',
+ 'GL_TEXTURE29',
+ 'GL_TEXTURE30',
+ 'GL_TEXTURE31',
+ 'GL_ACTIVE_TEXTURE',
+ 'GL_MULTISAMPLE',
+ 'GL_SAMPLE_ALPHA_TO_COVERAGE',
+ 'GL_SAMPLE_ALPHA_TO_ONE',
+ 'GL_SAMPLE_COVERAGE',
+ 'GL_SAMPLE_BUFFERS',
+ 'GL_SAMPLES',
+ 'GL_SAMPLE_COVERAGE_VALUE',
+ 'GL_SAMPLE_COVERAGE_INVERT',
+ 'GL_TEXTURE_CUBE_MAP',
+ 'GL_TEXTURE_BINDING_CUBE_MAP',
+ 'GL_TEXTURE_CUBE_MAP_POSITIVE_X',
+ 'GL_TEXTURE_CUBE_MAP_NEGATIVE_X',
+ 'GL_TEXTURE_CUBE_MAP_POSITIVE_Y',
+ 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Y',
+ 'GL_TEXTURE_CUBE_MAP_POSITIVE_Z',
+ 'GL_TEXTURE_CUBE_MAP_NEGATIVE_Z',
+ 'GL_PROXY_TEXTURE_CUBE_MAP',
+ 'GL_MAX_CUBE_MAP_TEXTURE_SIZE',
+ 'GL_COMPRESSED_RGB',
+ 'GL_COMPRESSED_RGBA',
+ 'GL_TEXTURE_COMPRESSION_HINT',
+ 'GL_TEXTURE_COMPRESSED_IMAGE_SIZE',
+ 'GL_TEXTURE_COMPRESSED',
+ 'GL_NUM_COMPRESSED_TEXTURE_FORMATS',
+ 'GL_COMPRESSED_TEXTURE_FORMATS',
+ 'GL_CLAMP_TO_BORDER',
+ 'GL_CLIENT_ACTIVE_TEXTURE',
+ 'GL_MAX_TEXTURE_UNITS',
+ 'GL_TRANSPOSE_MODELVIEW_MATRIX',
+ 'GL_TRANSPOSE_PROJECTION_MATRIX',
+ 'GL_TRANSPOSE_TEXTURE_MATRIX',
+ 'GL_TRANSPOSE_COLOR_MATRIX',
+ 'GL_MULTISAMPLE_BIT',
+ 'GL_NORMAL_MAP',
+ 'GL_REFLECTION_MAP',
+ 'GL_COMPRESSED_ALPHA',
+ 'GL_COMPRESSED_LUMINANCE',
+ 'GL_COMPRESSED_LUMINANCE_ALPHA',
+ 'GL_COMPRESSED_INTENSITY',
+ 'GL_COMBINE',
+ 'GL_COMBINE_RGB',
+ 'GL_COMBINE_ALPHA',
+ 'GL_SOURCE0_RGB',
+ 'GL_SOURCE1_RGB',
+ 'GL_SOURCE2_RGB',
+ 'GL_SOURCE0_ALPHA',
+ 'GL_SOURCE1_ALPHA',
+ 'GL_SOURCE2_ALPHA',
+ 'GL_OPERAND0_RGB',
+ 'GL_OPERAND1_RGB',
+ 'GL_OPERAND2_RGB',
+ 'GL_OPERAND0_ALPHA',
+ 'GL_OPERAND1_ALPHA',
+ 'GL_OPERAND2_ALPHA',
+ 'GL_RGB_SCALE',
+ 'GL_ADD_SIGNED',
+ 'GL_INTERPOLATE',
+ 'GL_SUBTRACT',
+ 'GL_CONSTANT',
+ 'GL_PRIMARY_COLOR',
+ 'GL_PREVIOUS',
+ 'GL_DOT3_RGB',
+ 'GL_DOT3_RGBA',
+ 'GL_BLEND_DST_RGB',
+ 'GL_BLEND_SRC_RGB',
+ 'GL_BLEND_DST_ALPHA',
+ 'GL_BLEND_SRC_ALPHA',
+ 'GL_POINT_FADE_THRESHOLD_SIZE',
+ 'GL_DEPTH_COMPONENT16',
+ 'GL_DEPTH_COMPONENT24',
+ 'GL_DEPTH_COMPONENT32',
+ 'GL_MIRRORED_REPEAT',
+ 'GL_MAX_TEXTURE_LOD_BIAS',
+ 'GL_TEXTURE_LOD_BIAS',
+ 'GL_INCR_WRAP',
+ 'GL_DECR_WRAP',
+ 'GL_TEXTURE_DEPTH_SIZE',
+ 'GL_TEXTURE_COMPARE_MODE',
+ 'GL_TEXTURE_COMPARE_FUNC',
+ 'GL_POINT_SIZE_MIN',
+ 'GL_POINT_SIZE_MAX',
+ 'GL_POINT_DISTANCE_ATTENUATION',
+ 'GL_GENERATE_MIPMAP',
+ 'GL_GENERATE_MIPMAP_HINT',
+ 'GL_FOG_COORDINATE_SOURCE',
+ 'GL_FOG_COORDINATE',
+ 'GL_FRAGMENT_DEPTH',
+ 'GL_CURRENT_FOG_COORDINATE',
+ 'GL_FOG_COORDINATE_ARRAY_TYPE',
+ 'GL_FOG_COORDINATE_ARRAY_STRIDE',
+ 'GL_FOG_COORDINATE_ARRAY_POINTER',
+ 'GL_FOG_COORDINATE_ARRAY',
+ 'GL_COLOR_SUM',
+ 'GL_CURRENT_SECONDARY_COLOR',
+ 'GL_SECONDARY_COLOR_ARRAY_SIZE',
+ 'GL_SECONDARY_COLOR_ARRAY_TYPE',
+ 'GL_SECONDARY_COLOR_ARRAY_STRIDE',
+ 'GL_SECONDARY_COLOR_ARRAY_POINTER',
+ 'GL_SECONDARY_COLOR_ARRAY',
+ 'GL_TEXTURE_FILTER_CONTROL',
+ 'GL_DEPTH_TEXTURE_MODE',
+ 'GL_COMPARE_R_TO_TEXTURE',
+ 'GL_BLEND_COLOR',
+ 'GL_BLEND_EQUATION',
+ 'GL_CONSTANT_COLOR',
+ 'GL_ONE_MINUS_CONSTANT_COLOR',
+ 'GL_CONSTANT_ALPHA',
+ 'GL_ONE_MINUS_CONSTANT_ALPHA',
+ 'GL_FUNC_ADD',
+ 'GL_FUNC_REVERSE_SUBTRACT',
+ 'GL_FUNC_SUBTRACT',
+ 'GL_MIN',
+ 'GL_MAX',
+ 'GL_BUFFER_SIZE',
+ 'GL_BUFFER_USAGE',
+ 'GL_QUERY_COUNTER_BITS',
+ 'GL_CURRENT_QUERY',
+ 'GL_QUERY_RESULT',
+ 'GL_QUERY_RESULT_AVAILABLE',
+ 'GL_ARRAY_BUFFER',
+ 'GL_ELEMENT_ARRAY_BUFFER',
+ 'GL_ARRAY_BUFFER_BINDING',
+ 'GL_ELEMENT_ARRAY_BUFFER_BINDING',
+ 'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING',
+ 'GL_READ_ONLY',
+ 'GL_WRITE_ONLY',
+ 'GL_READ_WRITE',
+ 'GL_BUFFER_ACCESS',
+ 'GL_BUFFER_MAPPED',
+ 'GL_BUFFER_MAP_POINTER',
+ 'GL_STREAM_DRAW',
+ 'GL_STREAM_READ',
+ 'GL_STREAM_COPY',
+ 'GL_STATIC_DRAW',
+ 'GL_STATIC_READ',
+ 'GL_STATIC_COPY',
+ 'GL_DYNAMIC_DRAW',
+ 'GL_DYNAMIC_READ',
+ 'GL_DYNAMIC_COPY',
+ 'GL_SAMPLES_PASSED',
+ 'GL_SRC1_ALPHA',
+ 'GL_VERTEX_ARRAY_BUFFER_BINDING',
+ 'GL_NORMAL_ARRAY_BUFFER_BINDING',
+ 'GL_COLOR_ARRAY_BUFFER_BINDING',
+ 'GL_INDEX_ARRAY_BUFFER_BINDING',
+ 'GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING',
+ 'GL_EDGE_FLAG_ARRAY_BUFFER_BINDING',
+ 'GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING',
+ 'GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING',
+ 'GL_WEIGHT_ARRAY_BUFFER_BINDING',
+ 'GL_FOG_COORD_SRC',
+ 'GL_FOG_COORD',
+ 'GL_CURRENT_FOG_COORD',
+ 'GL_FOG_COORD_ARRAY_TYPE',
+ 'GL_FOG_COORD_ARRAY_STRIDE',
+ 'GL_FOG_COORD_ARRAY_POINTER',
+ 'GL_FOG_COORD_ARRAY',
+ 'GL_FOG_COORD_ARRAY_BUFFER_BINDING',
+ 'GL_SRC0_RGB',
+ 'GL_SRC1_RGB',
+ 'GL_SRC2_RGB',
+ 'GL_SRC0_ALPHA',
+ 'GL_SRC2_ALPHA',
+ 'GL_BLEND_EQUATION_RGB',
+ 'GL_VERTEX_ATTRIB_ARRAY_ENABLED',
+ 'GL_VERTEX_ATTRIB_ARRAY_SIZE',
+ 'GL_VERTEX_ATTRIB_ARRAY_STRIDE',
+ 'GL_VERTEX_ATTRIB_ARRAY_TYPE',
+ 'GL_CURRENT_VERTEX_ATTRIB',
+ 'GL_VERTEX_PROGRAM_POINT_SIZE',
+ 'GL_VERTEX_ATTRIB_ARRAY_POINTER',
+ 'GL_STENCIL_BACK_FUNC',
+ 'GL_STENCIL_BACK_FAIL',
+ 'GL_STENCIL_BACK_PASS_DEPTH_FAIL',
+ 'GL_STENCIL_BACK_PASS_DEPTH_PASS',
+ 'GL_MAX_DRAW_BUFFERS',
+ 'GL_DRAW_BUFFER0',
+ 'GL_DRAW_BUFFER1',
+ 'GL_DRAW_BUFFER2',
+ 'GL_DRAW_BUFFER3',
+ 'GL_DRAW_BUFFER4',
+ 'GL_DRAW_BUFFER5',
+ 'GL_DRAW_BUFFER6',
+ 'GL_DRAW_BUFFER7',
+ 'GL_DRAW_BUFFER8',
+ 'GL_DRAW_BUFFER9',
+ 'GL_DRAW_BUFFER10',
+ 'GL_DRAW_BUFFER11',
+ 'GL_DRAW_BUFFER12',
+ 'GL_DRAW_BUFFER13',
+ 'GL_DRAW_BUFFER14',
+ 'GL_DRAW_BUFFER15',
+ 'GL_BLEND_EQUATION_ALPHA',
+ 'GL_MAX_VERTEX_ATTRIBS',
+ 'GL_VERTEX_ATTRIB_ARRAY_NORMALIZED',
+ 'GL_MAX_TEXTURE_IMAGE_UNITS',
+ 'GL_FRAGMENT_SHADER',
+ 'GL_VERTEX_SHADER',
+ 'GL_MAX_FRAGMENT_UNIFORM_COMPONENTS',
+ 'GL_MAX_VERTEX_UNIFORM_COMPONENTS',
+ 'GL_MAX_VARYING_FLOATS',
+ 'GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS',
+ 'GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS',
+ 'GL_SHADER_TYPE',
+ 'GL_FLOAT_VEC2',
+ 'GL_FLOAT_VEC3',
+ 'GL_FLOAT_VEC4',
+ 'GL_INT_VEC2',
+ 'GL_INT_VEC3',
+ 'GL_INT_VEC4',
+ 'GL_BOOL',
+ 'GL_BOOL_VEC2',
+ 'GL_BOOL_VEC3',
+ 'GL_BOOL_VEC4',
+ 'GL_FLOAT_MAT2',
+ 'GL_FLOAT_MAT3',
+ 'GL_FLOAT_MAT4',
+ 'GL_SAMPLER_1D',
+ 'GL_SAMPLER_2D',
+ 'GL_SAMPLER_3D',
+ 'GL_SAMPLER_CUBE',
+ 'GL_SAMPLER_1D_SHADOW',
+ 'GL_SAMPLER_2D_SHADOW',
+ 'GL_DELETE_STATUS',
+ 'GL_COMPILE_STATUS',
+ 'GL_LINK_STATUS',
+ 'GL_VALIDATE_STATUS',
+ 'GL_INFO_LOG_LENGTH',
+ 'GL_ATTACHED_SHADERS',
+ 'GL_ACTIVE_UNIFORMS',
+ 'GL_ACTIVE_UNIFORM_MAX_LENGTH',
+ 'GL_SHADER_SOURCE_LENGTH',
+ 'GL_ACTIVE_ATTRIBUTES',
+ 'GL_ACTIVE_ATTRIBUTE_MAX_LENGTH',
+ 'GL_FRAGMENT_SHADER_DERIVATIVE_HINT',
+ 'GL_SHADING_LANGUAGE_VERSION',
+ 'GL_CURRENT_PROGRAM',
+ 'GL_POINT_SPRITE_COORD_ORIGIN',
+ 'GL_LOWER_LEFT',
+ 'GL_UPPER_LEFT',
+ 'GL_STENCIL_BACK_REF',
+ 'GL_STENCIL_BACK_VALUE_MASK',
+ 'GL_STENCIL_BACK_WRITEMASK',
+ 'GL_VERTEX_PROGRAM_TWO_SIDE',
+ 'GL_POINT_SPRITE',
+ 'GL_COORD_REPLACE',
+ 'GL_MAX_TEXTURE_COORDS',
+ 'GL_PIXEL_PACK_BUFFER',
+ 'GL_PIXEL_UNPACK_BUFFER',
+ 'GL_PIXEL_PACK_BUFFER_BINDING',
+ 'GL_PIXEL_UNPACK_BUFFER_BINDING',
+ 'GL_FLOAT_MAT2x3',
+ 'GL_FLOAT_MAT2x4',
+ 'GL_FLOAT_MAT3x2',
+ 'GL_FLOAT_MAT3x4',
+ 'GL_FLOAT_MAT4x2',
+ 'GL_FLOAT_MAT4x3',
+ 'GL_SRGB',
+ 'GL_SRGB8',
+ 'GL_SRGB_ALPHA',
+ 'GL_SRGB8_ALPHA8',
+ 'GL_COMPRESSED_SRGB',
+ 'GL_COMPRESSED_SRGB_ALPHA',
+ 'GL_CURRENT_RASTER_SECONDARY_COLOR',
+ 'GL_SLUMINANCE_ALPHA',
+ 'GL_SLUMINANCE8_ALPHA8',
+ 'GL_SLUMINANCE',
+ 'GL_SLUMINANCE8',
+ 'GL_COMPRESSED_SLUMINANCE',
+ 'GL_COMPRESSED_SLUMINANCE_ALPHA',
+ 'GL_COMPARE_REF_TO_TEXTURE',
+ 'GL_CLIP_DISTANCE0',
+ 'GL_CLIP_DISTANCE1',
+ 'GL_CLIP_DISTANCE2',
+ 'GL_CLIP_DISTANCE3',
+ 'GL_CLIP_DISTANCE4',
+ 'GL_CLIP_DISTANCE5',
+ 'GL_CLIP_DISTANCE6',
+ 'GL_CLIP_DISTANCE7',
+ 'GL_MAX_CLIP_DISTANCES',
+ 'GL_MAJOR_VERSION',
+ 'GL_MINOR_VERSION',
+ 'GL_NUM_EXTENSIONS',
+ 'GL_CONTEXT_FLAGS',
+ 'GL_COMPRESSED_RED',
+ 'GL_COMPRESSED_RG',
+ 'GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT',
+ 'GL_RGBA32F',
+ 'GL_RGB32F',
+ 'GL_RGBA16F',
+ 'GL_RGB16F',
+ 'GL_VERTEX_ATTRIB_ARRAY_INTEGER',
+ 'GL_MAX_ARRAY_TEXTURE_LAYERS',
+ 'GL_MIN_PROGRAM_TEXEL_OFFSET',
+ 'GL_MAX_PROGRAM_TEXEL_OFFSET',
+ 'GL_CLAMP_READ_COLOR',
+ 'GL_FIXED_ONLY',
+ 'GL_MAX_VARYING_COMPONENTS',
+ 'GL_TEXTURE_1D_ARRAY',
+ 'GL_PROXY_TEXTURE_1D_ARRAY',
+ 'GL_TEXTURE_2D_ARRAY',
+ 'GL_PROXY_TEXTURE_2D_ARRAY',
+ 'GL_TEXTURE_BINDING_1D_ARRAY',
+ 'GL_TEXTURE_BINDING_2D_ARRAY',
+ 'GL_R11F_G11F_B10F',
+ 'GL_UNSIGNED_INT_10F_11F_11F_REV',
+ 'GL_RGB9_E5',
+ 'GL_UNSIGNED_INT_5_9_9_9_REV',
+ 'GL_TEXTURE_SHARED_SIZE',
+ 'GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_MODE',
+ 'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS',
+ 'GL_TRANSFORM_FEEDBACK_VARYINGS',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_START',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_SIZE',
+ 'GL_PRIMITIVES_GENERATED',
+ 'GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN',
+ 'GL_RASTERIZER_DISCARD',
+ 'GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS',
+ 'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS',
+ 'GL_INTERLEAVED_ATTRIBS',
+ 'GL_SEPARATE_ATTRIBS',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_BINDING',
+ 'GL_RGBA32UI',
+ 'GL_RGB32UI',
+ 'GL_RGBA16UI',
+ 'GL_RGB16UI',
+ 'GL_RGBA8UI',
+ 'GL_RGB8UI',
+ 'GL_RGBA32I',
+ 'GL_RGB32I',
+ 'GL_RGBA16I',
+ 'GL_RGB16I',
+ 'GL_RGBA8I',
+ 'GL_RGB8I',
+ 'GL_RED_INTEGER',
+ 'GL_GREEN_INTEGER',
+ 'GL_BLUE_INTEGER',
+ 'GL_RGB_INTEGER',
+ 'GL_RGBA_INTEGER',
+ 'GL_BGR_INTEGER',
+ 'GL_BGRA_INTEGER',
+ 'GL_SAMPLER_1D_ARRAY',
+ 'GL_SAMPLER_2D_ARRAY',
+ 'GL_SAMPLER_1D_ARRAY_SHADOW',
+ 'GL_SAMPLER_2D_ARRAY_SHADOW',
+ 'GL_SAMPLER_CUBE_SHADOW',
+ 'GL_UNSIGNED_INT_VEC2',
+ 'GL_UNSIGNED_INT_VEC3',
+ 'GL_UNSIGNED_INT_VEC4',
+ 'GL_INT_SAMPLER_1D',
+ 'GL_INT_SAMPLER_2D',
+ 'GL_INT_SAMPLER_3D',
+ 'GL_INT_SAMPLER_CUBE',
+ 'GL_INT_SAMPLER_1D_ARRAY',
+ 'GL_INT_SAMPLER_2D_ARRAY',
+ 'GL_UNSIGNED_INT_SAMPLER_1D',
+ 'GL_UNSIGNED_INT_SAMPLER_2D',
+ 'GL_UNSIGNED_INT_SAMPLER_3D',
+ 'GL_UNSIGNED_INT_SAMPLER_CUBE',
+ 'GL_UNSIGNED_INT_SAMPLER_1D_ARRAY',
+ 'GL_UNSIGNED_INT_SAMPLER_2D_ARRAY',
+ 'GL_QUERY_WAIT',
+ 'GL_QUERY_NO_WAIT',
+ 'GL_QUERY_BY_REGION_WAIT',
+ 'GL_QUERY_BY_REGION_NO_WAIT',
+ 'GL_BUFFER_ACCESS_FLAGS',
+ 'GL_BUFFER_MAP_LENGTH',
+ 'GL_BUFFER_MAP_OFFSET',
+ 'GL_DEPTH_COMPONENT32F',
+ 'GL_DEPTH32F_STENCIL8',
+ 'GL_FLOAT_32_UNSIGNED_INT_24_8_REV',
+ 'GL_INVALID_FRAMEBUFFER_OPERATION',
+ 'GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING',
+ 'GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE',
+ 'GL_FRAMEBUFFER_DEFAULT',
+ 'GL_FRAMEBUFFER_UNDEFINED',
+ 'GL_DEPTH_STENCIL_ATTACHMENT',
+ 'GL_MAX_RENDERBUFFER_SIZE',
+ 'GL_DEPTH_STENCIL',
+ 'GL_UNSIGNED_INT_24_8',
+ 'GL_DEPTH24_STENCIL8',
+ 'GL_TEXTURE_STENCIL_SIZE',
+ 'GL_TEXTURE_RED_TYPE',
+ 'GL_TEXTURE_GREEN_TYPE',
+ 'GL_TEXTURE_BLUE_TYPE',
+ 'GL_TEXTURE_ALPHA_TYPE',
+ 'GL_TEXTURE_DEPTH_TYPE',
+ 'GL_UNSIGNED_NORMALIZED',
+ 'GL_FRAMEBUFFER_BINDING',
+ 'GL_DRAW_FRAMEBUFFER_BINDING',
+ 'GL_RENDERBUFFER_BINDING',
+ 'GL_READ_FRAMEBUFFER',
+ 'GL_DRAW_FRAMEBUFFER',
+ 'GL_READ_FRAMEBUFFER_BINDING',
+ 'GL_RENDERBUFFER_SAMPLES',
+ 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER',
+ 'GL_FRAMEBUFFER_COMPLETE',
+ 'GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER',
+ 'GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER',
+ 'GL_FRAMEBUFFER_UNSUPPORTED',
+ 'GL_MAX_COLOR_ATTACHMENTS',
+ 'GL_COLOR_ATTACHMENT0',
+ 'GL_COLOR_ATTACHMENT1',
+ 'GL_COLOR_ATTACHMENT2',
+ 'GL_COLOR_ATTACHMENT3',
+ 'GL_COLOR_ATTACHMENT4',
+ 'GL_COLOR_ATTACHMENT5',
+ 'GL_COLOR_ATTACHMENT6',
+ 'GL_COLOR_ATTACHMENT7',
+ 'GL_COLOR_ATTACHMENT8',
+ 'GL_COLOR_ATTACHMENT9',
+ 'GL_COLOR_ATTACHMENT10',
+ 'GL_COLOR_ATTACHMENT11',
+ 'GL_COLOR_ATTACHMENT12',
+ 'GL_COLOR_ATTACHMENT13',
+ 'GL_COLOR_ATTACHMENT14',
+ 'GL_COLOR_ATTACHMENT15',
+ 'GL_COLOR_ATTACHMENT16',
+ 'GL_COLOR_ATTACHMENT17',
+ 'GL_COLOR_ATTACHMENT18',
+ 'GL_COLOR_ATTACHMENT19',
+ 'GL_COLOR_ATTACHMENT20',
+ 'GL_COLOR_ATTACHMENT21',
+ 'GL_COLOR_ATTACHMENT22',
+ 'GL_COLOR_ATTACHMENT23',
+ 'GL_COLOR_ATTACHMENT24',
+ 'GL_COLOR_ATTACHMENT25',
+ 'GL_COLOR_ATTACHMENT26',
+ 'GL_COLOR_ATTACHMENT27',
+ 'GL_COLOR_ATTACHMENT28',
+ 'GL_COLOR_ATTACHMENT29',
+ 'GL_COLOR_ATTACHMENT30',
+ 'GL_COLOR_ATTACHMENT31',
+ 'GL_DEPTH_ATTACHMENT',
+ 'GL_STENCIL_ATTACHMENT',
+ 'GL_FRAMEBUFFER',
+ 'GL_RENDERBUFFER',
+ 'GL_RENDERBUFFER_WIDTH',
+ 'GL_RENDERBUFFER_HEIGHT',
+ 'GL_RENDERBUFFER_INTERNAL_FORMAT',
+ 'GL_STENCIL_INDEX1',
+ 'GL_STENCIL_INDEX4',
+ 'GL_STENCIL_INDEX8',
+ 'GL_STENCIL_INDEX16',
+ 'GL_RENDERBUFFER_RED_SIZE',
+ 'GL_RENDERBUFFER_GREEN_SIZE',
+ 'GL_RENDERBUFFER_BLUE_SIZE',
+ 'GL_RENDERBUFFER_ALPHA_SIZE',
+ 'GL_RENDERBUFFER_DEPTH_SIZE',
+ 'GL_RENDERBUFFER_STENCIL_SIZE',
+ 'GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE',
+ 'GL_MAX_SAMPLES',
+ 'GL_INDEX',
+ 'GL_TEXTURE_LUMINANCE_TYPE',
+ 'GL_TEXTURE_INTENSITY_TYPE',
+ 'GL_FRAMEBUFFER_SRGB',
+ 'GL_HALF_FLOAT',
+ 'GL_MAP_READ_BIT',
+ 'GL_MAP_WRITE_BIT',
+ 'GL_MAP_INVALIDATE_RANGE_BIT',
+ 'GL_MAP_INVALIDATE_BUFFER_BIT',
+ 'GL_MAP_FLUSH_EXPLICIT_BIT',
+ 'GL_MAP_UNSYNCHRONIZED_BIT',
+ 'GL_COMPRESSED_RED_RGTC1',
+ 'GL_COMPRESSED_SIGNED_RED_RGTC1',
+ 'GL_COMPRESSED_RG_RGTC2',
+ 'GL_COMPRESSED_SIGNED_RG_RGTC2',
+ 'GL_RG',
+ 'GL_RG_INTEGER',
+ 'GL_R8',
+ 'GL_R16',
+ 'GL_RG8',
+ 'GL_RG16',
+ 'GL_R16F',
+ 'GL_R32F',
+ 'GL_RG16F',
+ 'GL_RG32F',
+ 'GL_R8I',
+ 'GL_R8UI',
+ 'GL_R16I',
+ 'GL_R16UI',
+ 'GL_R32I',
+ 'GL_R32UI',
+ 'GL_RG8I',
+ 'GL_RG8UI',
+ 'GL_RG16I',
+ 'GL_RG16UI',
+ 'GL_RG32I',
+ 'GL_RG32UI',
+ 'GL_VERTEX_ARRAY_BINDING',
+ 'GL_CLAMP_VERTEX_COLOR',
+ 'GL_CLAMP_FRAGMENT_COLOR',
+ 'GL_ALPHA_INTEGER',
+ 'GL_SAMPLER_2D_RECT',
+ 'GL_SAMPLER_2D_RECT_SHADOW',
+ 'GL_SAMPLER_BUFFER',
+ 'GL_INT_SAMPLER_2D_RECT',
+ 'GL_INT_SAMPLER_BUFFER',
+ 'GL_UNSIGNED_INT_SAMPLER_2D_RECT',
+ 'GL_UNSIGNED_INT_SAMPLER_BUFFER',
+ 'GL_TEXTURE_BUFFER',
+ 'GL_MAX_TEXTURE_BUFFER_SIZE',
+ 'GL_TEXTURE_BINDING_BUFFER',
+ 'GL_TEXTURE_BUFFER_DATA_STORE_BINDING',
+ 'GL_TEXTURE_RECTANGLE',
+ 'GL_TEXTURE_BINDING_RECTANGLE',
+ 'GL_PROXY_TEXTURE_RECTANGLE',
+ 'GL_MAX_RECTANGLE_TEXTURE_SIZE',
+ 'GL_R8_SNORM',
+ 'GL_RG8_SNORM',
+ 'GL_RGB8_SNORM',
+ 'GL_RGBA8_SNORM',
+ 'GL_R16_SNORM',
+ 'GL_RG16_SNORM',
+ 'GL_RGB16_SNORM',
+ 'GL_RGBA16_SNORM',
+ 'GL_SIGNED_NORMALIZED',
+ 'GL_PRIMITIVE_RESTART',
+ 'GL_PRIMITIVE_RESTART_INDEX',
+ 'GL_COPY_READ_BUFFER',
+ 'GL_COPY_WRITE_BUFFER',
+ 'GL_UNIFORM_BUFFER',
+ 'GL_UNIFORM_BUFFER_BINDING',
+ 'GL_UNIFORM_BUFFER_START',
+ 'GL_UNIFORM_BUFFER_SIZE',
+ 'GL_MAX_VERTEX_UNIFORM_BLOCKS',
+ 'GL_MAX_GEOMETRY_UNIFORM_BLOCKS',
+ 'GL_MAX_FRAGMENT_UNIFORM_BLOCKS',
+ 'GL_MAX_COMBINED_UNIFORM_BLOCKS',
+ 'GL_MAX_UNIFORM_BUFFER_BINDINGS',
+ 'GL_MAX_UNIFORM_BLOCK_SIZE',
+ 'GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS',
+ 'GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS',
+ 'GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS',
+ 'GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT',
+ 'GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH',
+ 'GL_ACTIVE_UNIFORM_BLOCKS',
+ 'GL_UNIFORM_TYPE',
+ 'GL_UNIFORM_SIZE',
+ 'GL_UNIFORM_NAME_LENGTH',
+ 'GL_UNIFORM_BLOCK_INDEX',
+ 'GL_UNIFORM_OFFSET',
+ 'GL_UNIFORM_ARRAY_STRIDE',
+ 'GL_UNIFORM_MATRIX_STRIDE',
+ 'GL_UNIFORM_IS_ROW_MAJOR',
+ 'GL_UNIFORM_BLOCK_BINDING',
+ 'GL_UNIFORM_BLOCK_DATA_SIZE',
+ 'GL_UNIFORM_BLOCK_NAME_LENGTH',
+ 'GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS',
+ 'GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES',
+ 'GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER',
+ 'GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER',
+ 'GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER',
+ 'GL_INVALID_INDEX',
+ 'GL_CONTEXT_CORE_PROFILE_BIT',
+ 'GL_CONTEXT_COMPATIBILITY_PROFILE_BIT',
+ 'GL_LINES_ADJACENCY',
+ 'GL_LINE_STRIP_ADJACENCY',
+ 'GL_TRIANGLES_ADJACENCY',
+ 'GL_TRIANGLE_STRIP_ADJACENCY',
+ 'GL_PROGRAM_POINT_SIZE',
+ 'GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS',
+ 'GL_FRAMEBUFFER_ATTACHMENT_LAYERED',
+ 'GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS',
+ 'GL_GEOMETRY_SHADER',
+ 'GL_GEOMETRY_VERTICES_OUT',
+ 'GL_GEOMETRY_INPUT_TYPE',
+ 'GL_GEOMETRY_OUTPUT_TYPE',
+ 'GL_MAX_GEOMETRY_UNIFORM_COMPONENTS',
+ 'GL_MAX_GEOMETRY_OUTPUT_VERTICES',
+ 'GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS',
+ 'GL_MAX_VERTEX_OUTPUT_COMPONENTS',
+ 'GL_MAX_GEOMETRY_INPUT_COMPONENTS',
+ 'GL_MAX_GEOMETRY_OUTPUT_COMPONENTS',
+ 'GL_MAX_FRAGMENT_INPUT_COMPONENTS',
+ 'GL_CONTEXT_PROFILE_MASK',
+ 'GL_DEPTH_CLAMP',
+ 'GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION',
+ 'GL_FIRST_VERTEX_CONVENTION',
+ 'GL_LAST_VERTEX_CONVENTION',
+ 'GL_PROVOKING_VERTEX',
+ 'GL_TEXTURE_CUBE_MAP_SEAMLESS',
+ 'GL_MAX_SERVER_WAIT_TIMEOUT',
+ 'GL_OBJECT_TYPE',
+ 'GL_SYNC_CONDITION',
+ 'GL_SYNC_STATUS',
+ 'GL_SYNC_FLAGS',
+ 'GL_SYNC_FENCE',
+ 'GL_SYNC_GPU_COMMANDS_COMPLETE',
+ 'GL_UNSIGNALED',
+ 'GL_SIGNALED',
+ 'GL_ALREADY_SIGNALED',
+ 'GL_TIMEOUT_EXPIRED',
+ 'GL_CONDITION_SATISFIED',
+ 'GL_WAIT_FAILED',
+ 'GL_TIMEOUT_IGNORED',
+ 'GL_SYNC_FLUSH_COMMANDS_BIT',
+ 'GL_SAMPLE_POSITION',
+ 'GL_SAMPLE_MASK',
+ 'GL_SAMPLE_MASK_VALUE',
+ 'GL_MAX_SAMPLE_MASK_WORDS',
+ 'GL_TEXTURE_2D_MULTISAMPLE',
+ 'GL_PROXY_TEXTURE_2D_MULTISAMPLE',
+ 'GL_TEXTURE_2D_MULTISAMPLE_ARRAY',
+ 'GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY',
+ 'GL_TEXTURE_BINDING_2D_MULTISAMPLE',
+ 'GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY',
+ 'GL_TEXTURE_SAMPLES',
+ 'GL_TEXTURE_FIXED_SAMPLE_LOCATIONS',
+ 'GL_SAMPLER_2D_MULTISAMPLE',
+ 'GL_INT_SAMPLER_2D_MULTISAMPLE',
+ 'GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE',
+ 'GL_SAMPLER_2D_MULTISAMPLE_ARRAY',
+ 'GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY',
+ 'GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY',
+ 'GL_MAX_COLOR_TEXTURE_SAMPLES',
+ 'GL_MAX_DEPTH_TEXTURE_SAMPLES',
+ 'GL_MAX_INTEGER_SAMPLES',
+ 'GL_VERTEX_ATTRIB_ARRAY_DIVISOR',
+ 'GL_SRC1_COLOR',
+ 'GL_ONE_MINUS_SRC1_COLOR',
+ 'GL_ONE_MINUS_SRC1_ALPHA',
+ 'GL_MAX_DUAL_SOURCE_DRAW_BUFFERS',
+ 'GL_ANY_SAMPLES_PASSED',
+ 'GL_SAMPLER_BINDING',
+ 'GL_RGB10_A2UI',
+ 'GL_TEXTURE_SWIZZLE_R',
+ 'GL_TEXTURE_SWIZZLE_G',
+ 'GL_TEXTURE_SWIZZLE_B',
+ 'GL_TEXTURE_SWIZZLE_A',
+ 'GL_TEXTURE_SWIZZLE_RGBA',
+ 'GL_TIME_ELAPSED',
+ 'GL_TIMESTAMP',
+ 'GL_INT_2_10_10_10_REV',
+ 'GL_SAMPLE_SHADING',
+ 'GL_MIN_SAMPLE_SHADING_VALUE',
+ 'GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET',
+ 'GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET',
+ 'GL_TEXTURE_CUBE_MAP_ARRAY',
+ 'GL_TEXTURE_BINDING_CUBE_MAP_ARRAY',
+ 'GL_PROXY_TEXTURE_CUBE_MAP_ARRAY',
+ 'GL_SAMPLER_CUBE_MAP_ARRAY',
+ 'GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW',
+ 'GL_INT_SAMPLER_CUBE_MAP_ARRAY',
+ 'GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY',
+ 'GL_DRAW_INDIRECT_BUFFER',
+ 'GL_DRAW_INDIRECT_BUFFER_BINDING',
+ 'GL_GEOMETRY_SHADER_INVOCATIONS',
+ 'GL_MAX_GEOMETRY_SHADER_INVOCATIONS',
+ 'GL_MIN_FRAGMENT_INTERPOLATION_OFFSET',
+ 'GL_MAX_FRAGMENT_INTERPOLATION_OFFSET',
+ 'GL_FRAGMENT_INTERPOLATION_OFFSET_BITS',
+ 'GL_MAX_VERTEX_STREAMS',
+ 'GL_DOUBLE_VEC2',
+ 'GL_DOUBLE_VEC3',
+ 'GL_DOUBLE_VEC4',
+ 'GL_DOUBLE_MAT2',
+ 'GL_DOUBLE_MAT3',
+ 'GL_DOUBLE_MAT4',
+ 'GL_DOUBLE_MAT2x3',
+ 'GL_DOUBLE_MAT2x4',
+ 'GL_DOUBLE_MAT3x2',
+ 'GL_DOUBLE_MAT3x4',
+ 'GL_DOUBLE_MAT4x2',
+ 'GL_DOUBLE_MAT4x3',
+ 'GL_ACTIVE_SUBROUTINES',
+ 'GL_ACTIVE_SUBROUTINE_UNIFORMS',
+ 'GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS',
+ 'GL_ACTIVE_SUBROUTINE_MAX_LENGTH',
+ 'GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH',
+ 'GL_MAX_SUBROUTINES',
+ 'GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS',
+ 'GL_NUM_COMPATIBLE_SUBROUTINES',
+ 'GL_COMPATIBLE_SUBROUTINES',
+ 'GL_PATCHES',
+ 'GL_PATCH_VERTICES',
+ 'GL_PATCH_DEFAULT_INNER_LEVEL',
+ 'GL_PATCH_DEFAULT_OUTER_LEVEL',
+ 'GL_TESS_CONTROL_OUTPUT_VERTICES',
+ 'GL_TESS_GEN_MODE',
+ 'GL_TESS_GEN_SPACING',
+ 'GL_TESS_GEN_VERTEX_ORDER',
+ 'GL_TESS_GEN_POINT_MODE',
+ 'GL_ISOLINES',
+ 'GL_FRACTIONAL_ODD',
+ 'GL_FRACTIONAL_EVEN',
+ 'GL_MAX_PATCH_VERTICES',
+ 'GL_MAX_TESS_GEN_LEVEL',
+ 'GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS',
+ 'GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS',
+ 'GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS',
+ 'GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS',
+ 'GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS',
+ 'GL_MAX_TESS_PATCH_COMPONENTS',
+ 'GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS',
+ 'GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS',
+ 'GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS',
+ 'GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS',
+ 'GL_MAX_TESS_CONTROL_INPUT_COMPONENTS',
+ 'GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS',
+ 'GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS',
+ 'GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS',
+ 'GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER',
+ 'GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER',
+ 'GL_TESS_EVALUATION_SHADER',
+ 'GL_TESS_CONTROL_SHADER',
+ 'GL_TRANSFORM_FEEDBACK',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE',
+ 'GL_TRANSFORM_FEEDBACK_BINDING',
+ 'GL_MAX_TRANSFORM_FEEDBACK_BUFFERS',
+ 'GL_FIXED',
+ 'GL_IMPLEMENTATION_COLOR_READ_TYPE',
+ 'GL_IMPLEMENTATION_COLOR_READ_FORMAT',
+ 'GL_LOW_FLOAT',
+ 'GL_MEDIUM_FLOAT',
+ 'GL_HIGH_FLOAT',
+ 'GL_LOW_INT',
+ 'GL_MEDIUM_INT',
+ 'GL_HIGH_INT',
+ 'GL_SHADER_COMPILER',
+ 'GL_SHADER_BINARY_FORMATS',
+ 'GL_NUM_SHADER_BINARY_FORMATS',
+ 'GL_MAX_VERTEX_UNIFORM_VECTORS',
+ 'GL_MAX_VARYING_VECTORS',
+ 'GL_MAX_FRAGMENT_UNIFORM_VECTORS',
+ 'GL_RGB565',
+ 'GL_PROGRAM_BINARY_RETRIEVABLE_HINT',
+ 'GL_PROGRAM_BINARY_LENGTH',
+ 'GL_NUM_PROGRAM_BINARY_FORMATS',
+ 'GL_PROGRAM_BINARY_FORMATS',
+ 'GL_VERTEX_SHADER_BIT',
+ 'GL_FRAGMENT_SHADER_BIT',
+ 'GL_GEOMETRY_SHADER_BIT',
+ 'GL_TESS_CONTROL_SHADER_BIT',
+ 'GL_TESS_EVALUATION_SHADER_BIT',
+ 'GL_ALL_SHADER_BITS',
+ 'GL_PROGRAM_SEPARABLE',
+ 'GL_ACTIVE_PROGRAM',
+ 'GL_PROGRAM_PIPELINE_BINDING',
+ 'GL_MAX_VIEWPORTS',
+ 'GL_VIEWPORT_SUBPIXEL_BITS',
+ 'GL_VIEWPORT_BOUNDS_RANGE',
+ 'GL_LAYER_PROVOKING_VERTEX',
+ 'GL_VIEWPORT_INDEX_PROVOKING_VERTEX',
+ 'GL_UNDEFINED_VERTEX',
+ 'GL_COPY_READ_BUFFER_BINDING',
+ 'GL_COPY_WRITE_BUFFER_BINDING',
+ 'GL_TRANSFORM_FEEDBACK_ACTIVE',
+ 'GL_TRANSFORM_FEEDBACK_PAUSED',
+ 'GL_UNPACK_COMPRESSED_BLOCK_WIDTH',
+ 'GL_UNPACK_COMPRESSED_BLOCK_HEIGHT',
+ 'GL_UNPACK_COMPRESSED_BLOCK_DEPTH',
+ 'GL_UNPACK_COMPRESSED_BLOCK_SIZE',
+ 'GL_PACK_COMPRESSED_BLOCK_WIDTH',
+ 'GL_PACK_COMPRESSED_BLOCK_HEIGHT',
+ 'GL_PACK_COMPRESSED_BLOCK_DEPTH',
+ 'GL_PACK_COMPRESSED_BLOCK_SIZE',
+ 'GL_NUM_SAMPLE_COUNTS',
+ 'GL_MIN_MAP_BUFFER_ALIGNMENT',
+ 'GL_ATOMIC_COUNTER_BUFFER',
+ 'GL_ATOMIC_COUNTER_BUFFER_BINDING',
+ 'GL_ATOMIC_COUNTER_BUFFER_START',
+ 'GL_ATOMIC_COUNTER_BUFFER_SIZE',
+ 'GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE',
+ 'GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS',
+ 'GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES',
+ 'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER',
+ 'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER',
+ 'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER',
+ 'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER',
+ 'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER',
+ 'GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_VERTEX_ATOMIC_COUNTERS',
+ 'GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS',
+ 'GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS',
+ 'GL_MAX_GEOMETRY_ATOMIC_COUNTERS',
+ 'GL_MAX_FRAGMENT_ATOMIC_COUNTERS',
+ 'GL_MAX_COMBINED_ATOMIC_COUNTERS',
+ 'GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE',
+ 'GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS',
+ 'GL_ACTIVE_ATOMIC_COUNTER_BUFFERS',
+ 'GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX',
+ 'GL_UNSIGNED_INT_ATOMIC_COUNTER',
+ 'GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT',
+ 'GL_ELEMENT_ARRAY_BARRIER_BIT',
+ 'GL_UNIFORM_BARRIER_BIT',
+ 'GL_TEXTURE_FETCH_BARRIER_BIT',
+ 'GL_SHADER_IMAGE_ACCESS_BARRIER_BIT',
+ 'GL_COMMAND_BARRIER_BIT',
+ 'GL_PIXEL_BUFFER_BARRIER_BIT',
+ 'GL_TEXTURE_UPDATE_BARRIER_BIT',
+ 'GL_BUFFER_UPDATE_BARRIER_BIT',
+ 'GL_FRAMEBUFFER_BARRIER_BIT',
+ 'GL_TRANSFORM_FEEDBACK_BARRIER_BIT',
+ 'GL_ATOMIC_COUNTER_BARRIER_BIT',
+ 'GL_ALL_BARRIER_BITS',
+ 'GL_MAX_IMAGE_UNITS',
+ 'GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS',
+ 'GL_IMAGE_BINDING_NAME',
+ 'GL_IMAGE_BINDING_LEVEL',
+ 'GL_IMAGE_BINDING_LAYERED',
+ 'GL_IMAGE_BINDING_LAYER',
+ 'GL_IMAGE_BINDING_ACCESS',
+ 'GL_IMAGE_1D',
+ 'GL_IMAGE_2D',
+ 'GL_IMAGE_3D',
+ 'GL_IMAGE_2D_RECT',
+ 'GL_IMAGE_CUBE',
+ 'GL_IMAGE_BUFFER',
+ 'GL_IMAGE_1D_ARRAY',
+ 'GL_IMAGE_2D_ARRAY',
+ 'GL_IMAGE_CUBE_MAP_ARRAY',
+ 'GL_IMAGE_2D_MULTISAMPLE',
+ 'GL_IMAGE_2D_MULTISAMPLE_ARRAY',
+ 'GL_INT_IMAGE_1D',
+ 'GL_INT_IMAGE_2D',
+ 'GL_INT_IMAGE_3D',
+ 'GL_INT_IMAGE_2D_RECT',
+ 'GL_INT_IMAGE_CUBE',
+ 'GL_INT_IMAGE_BUFFER',
+ 'GL_INT_IMAGE_1D_ARRAY',
+ 'GL_INT_IMAGE_2D_ARRAY',
+ 'GL_INT_IMAGE_CUBE_MAP_ARRAY',
+ 'GL_INT_IMAGE_2D_MULTISAMPLE',
+ 'GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY',
+ 'GL_UNSIGNED_INT_IMAGE_1D',
+ 'GL_UNSIGNED_INT_IMAGE_2D',
+ 'GL_UNSIGNED_INT_IMAGE_3D',
+ 'GL_UNSIGNED_INT_IMAGE_2D_RECT',
+ 'GL_UNSIGNED_INT_IMAGE_CUBE',
+ 'GL_UNSIGNED_INT_IMAGE_BUFFER',
+ 'GL_UNSIGNED_INT_IMAGE_1D_ARRAY',
+ 'GL_UNSIGNED_INT_IMAGE_2D_ARRAY',
+ 'GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY',
+ 'GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE',
+ 'GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY',
+ 'GL_MAX_IMAGE_SAMPLES',
+ 'GL_IMAGE_BINDING_FORMAT',
+ 'GL_IMAGE_FORMAT_COMPATIBILITY_TYPE',
+ 'GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE',
+ 'GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS',
+ 'GL_MAX_VERTEX_IMAGE_UNIFORMS',
+ 'GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS',
+ 'GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS',
+ 'GL_MAX_GEOMETRY_IMAGE_UNIFORMS',
+ 'GL_MAX_FRAGMENT_IMAGE_UNIFORMS',
+ 'GL_MAX_COMBINED_IMAGE_UNIFORMS',
+ 'GL_COMPRESSED_RGBA_BPTC_UNORM',
+ 'GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM',
+ 'GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT',
+ 'GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT',
+ 'GL_TEXTURE_IMMUTABLE_FORMAT',
+ 'GL_NUM_SHADING_LANGUAGE_VERSIONS',
+ 'GL_VERTEX_ATTRIB_ARRAY_LONG',
+ 'GL_COMPRESSED_RGB8_ETC2',
+ 'GL_COMPRESSED_SRGB8_ETC2',
+ 'GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2',
+ 'GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2',
+ 'GL_COMPRESSED_RGBA8_ETC2_EAC',
+ 'GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC',
+ 'GL_COMPRESSED_R11_EAC',
+ 'GL_COMPRESSED_SIGNED_R11_EAC',
+ 'GL_COMPRESSED_RG11_EAC',
+ 'GL_COMPRESSED_SIGNED_RG11_EAC',
+ 'GL_PRIMITIVE_RESTART_FIXED_INDEX',
+ 'GL_ANY_SAMPLES_PASSED_CONSERVATIVE',
+ 'GL_MAX_ELEMENT_INDEX',
+ 'GL_COMPUTE_SHADER',
+ 'GL_MAX_COMPUTE_UNIFORM_BLOCKS',
+ 'GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS',
+ 'GL_MAX_COMPUTE_IMAGE_UNIFORMS',
+ 'GL_MAX_COMPUTE_SHARED_MEMORY_SIZE',
+ 'GL_MAX_COMPUTE_UNIFORM_COMPONENTS',
+ 'GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS',
+ 'GL_MAX_COMPUTE_ATOMIC_COUNTERS',
+ 'GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS',
+ 'GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS',
+ 'GL_MAX_COMPUTE_WORK_GROUP_COUNT',
+ 'GL_MAX_COMPUTE_WORK_GROUP_SIZE',
+ 'GL_COMPUTE_WORK_GROUP_SIZE',
+ 'GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER',
+ 'GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER',
+ 'GL_DISPATCH_INDIRECT_BUFFER',
+ 'GL_DISPATCH_INDIRECT_BUFFER_BINDING',
+ 'GL_COMPUTE_SHADER_BIT',
+ 'GL_DEBUG_OUTPUT_SYNCHRONOUS',
+ 'GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH',
+ 'GL_DEBUG_CALLBACK_FUNCTION',
+ 'GL_DEBUG_CALLBACK_USER_PARAM',
+ 'GL_DEBUG_SOURCE_API',
+ 'GL_DEBUG_SOURCE_WINDOW_SYSTEM',
+ 'GL_DEBUG_SOURCE_SHADER_COMPILER',
+ 'GL_DEBUG_SOURCE_THIRD_PARTY',
+ 'GL_DEBUG_SOURCE_APPLICATION',
+ 'GL_DEBUG_SOURCE_OTHER',
+ 'GL_DEBUG_TYPE_ERROR',
+ 'GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR',
+ 'GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR',
+ 'GL_DEBUG_TYPE_PORTABILITY',
+ 'GL_DEBUG_TYPE_PERFORMANCE',
+ 'GL_DEBUG_TYPE_OTHER',
+ 'GL_MAX_DEBUG_MESSAGE_LENGTH',
+ 'GL_MAX_DEBUG_LOGGED_MESSAGES',
+ 'GL_DEBUG_LOGGED_MESSAGES',
+ 'GL_DEBUG_SEVERITY_HIGH',
+ 'GL_DEBUG_SEVERITY_MEDIUM',
+ 'GL_DEBUG_SEVERITY_LOW',
+ 'GL_DEBUG_TYPE_MARKER',
+ 'GL_DEBUG_TYPE_PUSH_GROUP',
+ 'GL_DEBUG_TYPE_POP_GROUP',
+ 'GL_DEBUG_SEVERITY_NOTIFICATION',
+ 'GL_MAX_DEBUG_GROUP_STACK_DEPTH',
+ 'GL_DEBUG_GROUP_STACK_DEPTH',
+ 'GL_BUFFER',
+ 'GL_SHADER',
+ 'GL_PROGRAM',
+ 'GL_QUERY',
+ 'GL_PROGRAM_PIPELINE',
+ 'GL_SAMPLER',
+ 'GL_MAX_LABEL_LENGTH',
+ 'GL_DEBUG_OUTPUT',
+ 'GL_CONTEXT_FLAG_DEBUG_BIT',
+ 'GL_MAX_UNIFORM_LOCATIONS',
+ 'GL_FRAMEBUFFER_DEFAULT_WIDTH',
+ 'GL_FRAMEBUFFER_DEFAULT_HEIGHT',
+ 'GL_FRAMEBUFFER_DEFAULT_LAYERS',
+ 'GL_FRAMEBUFFER_DEFAULT_SAMPLES',
+ 'GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS',
+ 'GL_MAX_FRAMEBUFFER_WIDTH',
+ 'GL_MAX_FRAMEBUFFER_HEIGHT',
+ 'GL_MAX_FRAMEBUFFER_LAYERS',
+ 'GL_MAX_FRAMEBUFFER_SAMPLES',
+ 'GL_INTERNALFORMAT_SUPPORTED',
+ 'GL_INTERNALFORMAT_PREFERRED',
+ 'GL_INTERNALFORMAT_RED_SIZE',
+ 'GL_INTERNALFORMAT_GREEN_SIZE',
+ 'GL_INTERNALFORMAT_BLUE_SIZE',
+ 'GL_INTERNALFORMAT_ALPHA_SIZE',
+ 'GL_INTERNALFORMAT_DEPTH_SIZE',
+ 'GL_INTERNALFORMAT_STENCIL_SIZE',
+ 'GL_INTERNALFORMAT_SHARED_SIZE',
+ 'GL_INTERNALFORMAT_RED_TYPE',
+ 'GL_INTERNALFORMAT_GREEN_TYPE',
+ 'GL_INTERNALFORMAT_BLUE_TYPE',
+ 'GL_INTERNALFORMAT_ALPHA_TYPE',
+ 'GL_INTERNALFORMAT_DEPTH_TYPE',
+ 'GL_INTERNALFORMAT_STENCIL_TYPE',
+ 'GL_MAX_WIDTH',
+ 'GL_MAX_HEIGHT',
+ 'GL_MAX_DEPTH',
+ 'GL_MAX_LAYERS',
+ 'GL_MAX_COMBINED_DIMENSIONS',
+ 'GL_COLOR_COMPONENTS',
+ 'GL_DEPTH_COMPONENTS',
+ 'GL_STENCIL_COMPONENTS',
+ 'GL_COLOR_RENDERABLE',
+ 'GL_DEPTH_RENDERABLE',
+ 'GL_STENCIL_RENDERABLE',
+ 'GL_FRAMEBUFFER_RENDERABLE',
+ 'GL_FRAMEBUFFER_RENDERABLE_LAYERED',
+ 'GL_FRAMEBUFFER_BLEND',
+ 'GL_READ_PIXELS',
+ 'GL_READ_PIXELS_FORMAT',
+ 'GL_READ_PIXELS_TYPE',
+ 'GL_TEXTURE_IMAGE_FORMAT',
+ 'GL_TEXTURE_IMAGE_TYPE',
+ 'GL_GET_TEXTURE_IMAGE_FORMAT',
+ 'GL_GET_TEXTURE_IMAGE_TYPE',
+ 'GL_MIPMAP',
+ 'GL_MANUAL_GENERATE_MIPMAP',
+ 'GL_AUTO_GENERATE_MIPMAP',
+ 'GL_COLOR_ENCODING',
+ 'GL_SRGB_READ',
+ 'GL_SRGB_WRITE',
+ 'GL_FILTER',
+ 'GL_VERTEX_TEXTURE',
+ 'GL_TESS_CONTROL_TEXTURE',
+ 'GL_TESS_EVALUATION_TEXTURE',
+ 'GL_GEOMETRY_TEXTURE',
+ 'GL_FRAGMENT_TEXTURE',
+ 'GL_COMPUTE_TEXTURE',
+ 'GL_TEXTURE_SHADOW',
+ 'GL_TEXTURE_GATHER',
+ 'GL_TEXTURE_GATHER_SHADOW',
+ 'GL_SHADER_IMAGE_LOAD',
+ 'GL_SHADER_IMAGE_STORE',
+ 'GL_SHADER_IMAGE_ATOMIC',
+ 'GL_IMAGE_TEXEL_SIZE',
+ 'GL_IMAGE_COMPATIBILITY_CLASS',
+ 'GL_IMAGE_PIXEL_FORMAT',
+ 'GL_IMAGE_PIXEL_TYPE',
+ 'GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST',
+ 'GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST',
+ 'GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE',
+ 'GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE',
+ 'GL_TEXTURE_COMPRESSED_BLOCK_WIDTH',
+ 'GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT',
+ 'GL_TEXTURE_COMPRESSED_BLOCK_SIZE',
+ 'GL_CLEAR_BUFFER',
+ 'GL_TEXTURE_VIEW',
+ 'GL_VIEW_COMPATIBILITY_CLASS',
+ 'GL_FULL_SUPPORT',
+ 'GL_CAVEAT_SUPPORT',
+ 'GL_IMAGE_CLASS_4_X_32',
+ 'GL_IMAGE_CLASS_2_X_32',
+ 'GL_IMAGE_CLASS_1_X_32',
+ 'GL_IMAGE_CLASS_4_X_16',
+ 'GL_IMAGE_CLASS_2_X_16',
+ 'GL_IMAGE_CLASS_1_X_16',
+ 'GL_IMAGE_CLASS_4_X_8',
+ 'GL_IMAGE_CLASS_2_X_8',
+ 'GL_IMAGE_CLASS_1_X_8',
+ 'GL_IMAGE_CLASS_11_11_10',
+ 'GL_IMAGE_CLASS_10_10_10_2',
+ 'GL_VIEW_CLASS_128_BITS',
+ 'GL_VIEW_CLASS_96_BITS',
+ 'GL_VIEW_CLASS_64_BITS',
+ 'GL_VIEW_CLASS_48_BITS',
+ 'GL_VIEW_CLASS_32_BITS',
+ 'GL_VIEW_CLASS_24_BITS',
+ 'GL_VIEW_CLASS_16_BITS',
+ 'GL_VIEW_CLASS_8_BITS',
+ 'GL_VIEW_CLASS_S3TC_DXT1_RGB',
+ 'GL_VIEW_CLASS_S3TC_DXT1_RGBA',
+ 'GL_VIEW_CLASS_S3TC_DXT3_RGBA',
+ 'GL_VIEW_CLASS_S3TC_DXT5_RGBA',
+ 'GL_VIEW_CLASS_RGTC1_RED',
+ 'GL_VIEW_CLASS_RGTC2_RG',
+ 'GL_VIEW_CLASS_BPTC_UNORM',
+ 'GL_VIEW_CLASS_BPTC_FLOAT',
+ 'GL_UNIFORM',
+ 'GL_UNIFORM_BLOCK',
+ 'GL_PROGRAM_INPUT',
+ 'GL_PROGRAM_OUTPUT',
+ 'GL_BUFFER_VARIABLE',
+ 'GL_SHADER_STORAGE_BLOCK',
+ 'GL_VERTEX_SUBROUTINE',
+ 'GL_TESS_CONTROL_SUBROUTINE',
+ 'GL_TESS_EVALUATION_SUBROUTINE',
+ 'GL_GEOMETRY_SUBROUTINE',
+ 'GL_FRAGMENT_SUBROUTINE',
+ 'GL_COMPUTE_SUBROUTINE',
+ 'GL_VERTEX_SUBROUTINE_UNIFORM',
+ 'GL_TESS_CONTROL_SUBROUTINE_UNIFORM',
+ 'GL_TESS_EVALUATION_SUBROUTINE_UNIFORM',
+ 'GL_GEOMETRY_SUBROUTINE_UNIFORM',
+ 'GL_FRAGMENT_SUBROUTINE_UNIFORM',
+ 'GL_COMPUTE_SUBROUTINE_UNIFORM',
+ 'GL_TRANSFORM_FEEDBACK_VARYING',
+ 'GL_ACTIVE_RESOURCES',
+ 'GL_MAX_NAME_LENGTH',
+ 'GL_MAX_NUM_ACTIVE_VARIABLES',
+ 'GL_MAX_NUM_COMPATIBLE_SUBROUTINES',
+ 'GL_NAME_LENGTH',
+ 'GL_TYPE',
+ 'GL_ARRAY_SIZE',
+ 'GL_OFFSET',
+ 'GL_BLOCK_INDEX',
+ 'GL_ARRAY_STRIDE',
+ 'GL_MATRIX_STRIDE',
+ 'GL_IS_ROW_MAJOR',
+ 'GL_ATOMIC_COUNTER_BUFFER_INDEX',
+ 'GL_BUFFER_BINDING',
+ 'GL_BUFFER_DATA_SIZE',
+ 'GL_NUM_ACTIVE_VARIABLES',
+ 'GL_ACTIVE_VARIABLES',
+ 'GL_REFERENCED_BY_VERTEX_SHADER',
+ 'GL_REFERENCED_BY_TESS_CONTROL_SHADER',
+ 'GL_REFERENCED_BY_TESS_EVALUATION_SHADER',
+ 'GL_REFERENCED_BY_GEOMETRY_SHADER',
+ 'GL_REFERENCED_BY_FRAGMENT_SHADER',
+ 'GL_REFERENCED_BY_COMPUTE_SHADER',
+ 'GL_TOP_LEVEL_ARRAY_SIZE',
+ 'GL_TOP_LEVEL_ARRAY_STRIDE',
+ 'GL_LOCATION',
+ 'GL_LOCATION_INDEX',
+ 'GL_IS_PER_PATCH',
+ 'GL_SHADER_STORAGE_BUFFER',
+ 'GL_SHADER_STORAGE_BUFFER_BINDING',
+ 'GL_SHADER_STORAGE_BUFFER_START',
+ 'GL_SHADER_STORAGE_BUFFER_SIZE',
+ 'GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS',
+ 'GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS',
+ 'GL_MAX_SHADER_STORAGE_BLOCK_SIZE',
+ 'GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT',
+ 'GL_SHADER_STORAGE_BARRIER_BIT',
+ 'GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES',
+ 'GL_DEPTH_STENCIL_TEXTURE_MODE',
+ 'GL_TEXTURE_BUFFER_OFFSET',
+ 'GL_TEXTURE_BUFFER_SIZE',
+ 'GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT',
+ 'GL_TEXTURE_VIEW_MIN_LEVEL',
+ 'GL_TEXTURE_VIEW_NUM_LEVELS',
+ 'GL_TEXTURE_VIEW_MIN_LAYER',
+ 'GL_TEXTURE_VIEW_NUM_LAYERS',
+ 'GL_TEXTURE_IMMUTABLE_LEVELS',
+ 'GL_VERTEX_ATTRIB_BINDING',
+ 'GL_VERTEX_ATTRIB_RELATIVE_OFFSET',
+ 'GL_VERTEX_BINDING_DIVISOR',
+ 'GL_VERTEX_BINDING_OFFSET',
+ 'GL_VERTEX_BINDING_STRIDE',
+ 'GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET',
+ 'GL_MAX_VERTEX_ATTRIB_BINDINGS',
+ 'GL_VERTEX_BINDING_BUFFER',
+ 'GL_DISPLAY_LIST',
+ 'GL_MAX_VERTEX_ATTRIB_STRIDE',
+ 'GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED',
+ 'GL_TEXTURE_BUFFER_BINDING',
+ 'GL_MAP_PERSISTENT_BIT',
+ 'GL_MAP_COHERENT_BIT',
+ 'GL_DYNAMIC_STORAGE_BIT',
+ 'GL_CLIENT_STORAGE_BIT',
+ 'GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT',
+ 'GL_BUFFER_IMMUTABLE_STORAGE',
+ 'GL_BUFFER_STORAGE_FLAGS',
+ 'GL_CLEAR_TEXTURE',
+ 'GL_LOCATION_COMPONENT',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_INDEX',
+ 'GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE',
+ 'GL_QUERY_BUFFER',
+ 'GL_QUERY_BUFFER_BARRIER_BIT',
+ 'GL_QUERY_BUFFER_BINDING',
+ 'GL_QUERY_RESULT_NO_WAIT',
+ 'GL_MIRROR_CLAMP_TO_EDGE',
+ 'GL_CONTEXT_LOST',
+ 'GL_NEGATIVE_ONE_TO_ONE',
+ 'GL_ZERO_TO_ONE',
+ 'GL_CLIP_ORIGIN',
+ 'GL_CLIP_DEPTH_MODE',
+ 'GL_QUERY_WAIT_INVERTED',
+ 'GL_QUERY_NO_WAIT_INVERTED',
+ 'GL_QUERY_BY_REGION_WAIT_INVERTED',
+ 'GL_QUERY_BY_REGION_NO_WAIT_INVERTED',
+ 'GL_MAX_CULL_DISTANCES',
+ 'GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES',
+ 'GL_TEXTURE_TARGET',
+ 'GL_QUERY_TARGET',
+ 'GL_GUILTY_CONTEXT_RESET',
+ 'GL_INNOCENT_CONTEXT_RESET',
+ 'GL_UNKNOWN_CONTEXT_RESET',
+ 'GL_RESET_NOTIFICATION_STRATEGY',
+ 'GL_LOSE_CONTEXT_ON_RESET',
+ 'GL_NO_RESET_NOTIFICATION',
+ 'GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT',
+ 'GL_COLOR_TABLE',
+ 'GL_POST_CONVOLUTION_COLOR_TABLE',
+ 'GL_POST_COLOR_MATRIX_COLOR_TABLE',
+ 'GL_PROXY_COLOR_TABLE',
+ 'GL_PROXY_POST_CONVOLUTION_COLOR_TABLE',
+ 'GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE',
+ 'GL_CONVOLUTION_1D',
+ 'GL_CONVOLUTION_2D',
+ 'GL_SEPARABLE_2D',
+ 'GL_HISTOGRAM',
+ 'GL_PROXY_HISTOGRAM',
+ 'GL_MINMAX',
+ 'GL_CONTEXT_RELEASE_BEHAVIOR',
+ 'GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH',
+ 'GL_SHADER_BINARY_FORMAT_SPIR_V',
+ 'GL_SPIR_V_BINARY',
+ 'GL_PARAMETER_BUFFER',
+ 'GL_PARAMETER_BUFFER_BINDING',
+ 'GL_CONTEXT_FLAG_NO_ERROR_BIT',
+ 'GL_VERTICES_SUBMITTED',
+ 'GL_PRIMITIVES_SUBMITTED',
+ 'GL_VERTEX_SHADER_INVOCATIONS',
+ 'GL_TESS_CONTROL_SHADER_PATCHES',
+ 'GL_TESS_EVALUATION_SHADER_INVOCATIONS',
+ 'GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED',
+ 'GL_FRAGMENT_SHADER_INVOCATIONS',
+ 'GL_COMPUTE_SHADER_INVOCATIONS',
+ 'GL_CLIPPING_INPUT_PRIMITIVES',
+ 'GL_CLIPPING_OUTPUT_PRIMITIVES',
+ 'GL_POLYGON_OFFSET_CLAMP',
+ 'GL_SPIR_V_EXTENSIONS',
+ 'GL_NUM_SPIR_V_EXTENSIONS',
+ 'GL_TEXTURE_MAX_ANISOTROPY',
+ 'GL_MAX_TEXTURE_MAX_ANISOTROPY',
+ 'GL_TRANSFORM_FEEDBACK_OVERFLOW',
+ 'GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW',
+ 'GL_MULTISAMPLE_ARB',
+ 'GL_SAMPLE_ALPHA_TO_COVERAGE_ARB',
+ 'GL_SAMPLE_ALPHA_TO_ONE_ARB',
+ 'GL_SAMPLE_COVERAGE_ARB',
+ 'GL_SAMPLE_BUFFERS_ARB',
+ 'GL_SAMPLES_ARB',
+ 'GL_SAMPLE_COVERAGE_VALUE_ARB',
+ 'GL_SAMPLE_COVERAGE_INVERT_ARB',
+ 'GL_MULTISAMPLE_BIT_ARB',
+ 'GL_COMPRESSED_RGB_S3TC_DXT1_EXT',
+ 'GL_COMPRESSED_RGBA_S3TC_DXT1_EXT',
+ 'GL_COMPRESSED_RGBA_S3TC_DXT3_EXT',
+ 'GL_COMPRESSED_RGBA_S3TC_DXT5_EXT',
+ 'GL_INVALID_FRAMEBUFFER_OPERATION_EXT',
+ 'GL_MAX_RENDERBUFFER_SIZE_EXT',
+ 'GL_FRAMEBUFFER_BINDING_EXT',
+ 'GL_RENDERBUFFER_BINDING_EXT',
+ 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT',
+ 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT',
+ 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT',
+ 'GL_FRAMEBUFFER_COMPLETE_EXT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT',
+ 'GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT',
+ 'GL_FRAMEBUFFER_UNSUPPORTED_EXT',
+ 'GL_MAX_COLOR_ATTACHMENTS_EXT',
+ 'GL_COLOR_ATTACHMENT0_EXT',
+ 'GL_COLOR_ATTACHMENT1_EXT',
+ 'GL_COLOR_ATTACHMENT2_EXT',
+ 'GL_COLOR_ATTACHMENT3_EXT',
+ 'GL_COLOR_ATTACHMENT4_EXT',
+ 'GL_COLOR_ATTACHMENT5_EXT',
+ 'GL_COLOR_ATTACHMENT6_EXT',
+ 'GL_COLOR_ATTACHMENT7_EXT',
+ 'GL_COLOR_ATTACHMENT8_EXT',
+ 'GL_COLOR_ATTACHMENT9_EXT',
+ 'GL_COLOR_ATTACHMENT10_EXT',
+ 'GL_COLOR_ATTACHMENT11_EXT',
+ 'GL_COLOR_ATTACHMENT12_EXT',
+ 'GL_COLOR_ATTACHMENT13_EXT',
+ 'GL_COLOR_ATTACHMENT14_EXT',
+ 'GL_COLOR_ATTACHMENT15_EXT',
+ 'GL_DEPTH_ATTACHMENT_EXT',
+ 'GL_STENCIL_ATTACHMENT_EXT',
+ 'GL_FRAMEBUFFER_EXT',
+ 'GL_RENDERBUFFER_EXT',
+ 'GL_RENDERBUFFER_WIDTH_EXT',
+ 'GL_RENDERBUFFER_HEIGHT_EXT',
+ 'GL_RENDERBUFFER_INTERNAL_FORMAT_EXT',
+ 'GL_STENCIL_INDEX1_EXT',
+ 'GL_STENCIL_INDEX4_EXT',
+ 'GL_STENCIL_INDEX8_EXT',
+ 'GL_STENCIL_INDEX16_EXT',
+ 'GL_RENDERBUFFER_RED_SIZE_EXT',
+ 'GL_RENDERBUFFER_GREEN_SIZE_EXT',
+ 'GL_RENDERBUFFER_BLUE_SIZE_EXT',
+ 'GL_RENDERBUFFER_ALPHA_SIZE_EXT',
+ 'GL_RENDERBUFFER_DEPTH_SIZE_EXT',
+ 'GL_RENDERBUFFER_STENCIL_SIZE_EXT',
+ 'glAccum',
+ 'glActiveShaderProgram',
+ 'glActiveTexture',
+ 'glAlphaFunc',
+ 'glAreTexturesResident',
+ 'glArrayElement',
+ 'glAttachShader',
+ 'glBegin',
+ 'glBeginConditionalRender',
+ 'glBeginQuery',
+ 'glBeginQueryIndexed',
+ 'glBeginTransformFeedback',
+ 'glBindAttribLocation',
+ 'glBindBuffer',
+ 'glBindBufferBase',
+ 'glBindBufferRange',
+ 'glBindBuffersBase',
+ 'glBindBuffersRange',
+ 'glBindFragDataLocation',
+ 'glBindFragDataLocationIndexed',
+ 'glBindFramebuffer',
+ 'glBindFramebufferEXT',
+ 'glBindImageTexture',
+ 'glBindImageTextures',
+ 'glBindProgramPipeline',
+ 'glBindRenderbuffer',
+ 'glBindRenderbufferEXT',
+ 'glBindSampler',
+ 'glBindSamplers',
+ 'glBindTexture',
+ 'glBindTextureUnit',
+ 'glBindTextures',
+ 'glBindTransformFeedback',
+ 'glBindVertexArray',
+ 'glBindVertexBuffer',
+ 'glBindVertexBuffers',
+ 'glBitmap',
+ 'glBlendColor',
+ 'glBlendEquation',
+ 'glBlendEquationSeparate',
+ 'glBlendEquationSeparatei',
+ 'glBlendEquationi',
+ 'glBlendFunc',
+ 'glBlendFuncSeparate',
+ 'glBlendFuncSeparatei',
+ 'glBlendFunci',
+ 'glBlitFramebuffer',
+ 'glBlitNamedFramebuffer',
+ 'glBufferData',
+ 'glBufferStorage',
+ 'glBufferSubData',
+ 'glCallList',
+ 'glCallLists',
+ 'glCheckFramebufferStatus',
+ 'glCheckFramebufferStatusEXT',
+ 'glCheckNamedFramebufferStatus',
+ 'glClampColor',
+ 'glClear',
+ 'glClearAccum',
+ 'glClearBufferData',
+ 'glClearBufferSubData',
+ 'glClearBufferfi',
+ 'glClearBufferfv',
+ 'glClearBufferiv',
+ 'glClearBufferuiv',
+ 'glClearColor',
+ 'glClearDepth',
+ 'glClearDepthf',
+ 'glClearIndex',
+ 'glClearNamedBufferData',
+ 'glClearNamedBufferSubData',
+ 'glClearNamedFramebufferfi',
+ 'glClearNamedFramebufferfv',
+ 'glClearNamedFramebufferiv',
+ 'glClearNamedFramebufferuiv',
+ 'glClearStencil',
+ 'glClearTexImage',
+ 'glClearTexSubImage',
+ 'glClientActiveTexture',
+ 'glClientWaitSync',
+ 'glClipControl',
+ 'glClipPlane',
+ 'glColor3b',
+ 'glColor3bv',
+ 'glColor3d',
+ 'glColor3dv',
+ 'glColor3f',
+ 'glColor3fv',
+ 'glColor3i',
+ 'glColor3iv',
+ 'glColor3s',
+ 'glColor3sv',
+ 'glColor3ub',
+ 'glColor3ubv',
+ 'glColor3ui',
+ 'glColor3uiv',
+ 'glColor3us',
+ 'glColor3usv',
+ 'glColor4b',
+ 'glColor4bv',
+ 'glColor4d',
+ 'glColor4dv',
+ 'glColor4f',
+ 'glColor4fv',
+ 'glColor4i',
+ 'glColor4iv',
+ 'glColor4s',
+ 'glColor4sv',
+ 'glColor4ub',
+ 'glColor4ubv',
+ 'glColor4ui',
+ 'glColor4uiv',
+ 'glColor4us',
+ 'glColor4usv',
+ 'glColorMask',
+ 'glColorMaski',
+ 'glColorMaterial',
+ 'glColorP3ui',
+ 'glColorP3uiv',
+ 'glColorP4ui',
+ 'glColorP4uiv',
+ 'glColorPointer',
+ 'glCompileShader',
+ 'glCompressedTexImage1D',
+ 'glCompressedTexImage2D',
+ 'glCompressedTexImage3D',
+ 'glCompressedTexSubImage1D',
+ 'glCompressedTexSubImage2D',
+ 'glCompressedTexSubImage3D',
+ 'glCompressedTextureSubImage1D',
+ 'glCompressedTextureSubImage2D',
+ 'glCompressedTextureSubImage3D',
+ 'glCopyBufferSubData',
+ 'glCopyImageSubData',
+ 'glCopyNamedBufferSubData',
+ 'glCopyPixels',
+ 'glCopyTexImage1D',
+ 'glCopyTexImage2D',
+ 'glCopyTexSubImage1D',
+ 'glCopyTexSubImage2D',
+ 'glCopyTexSubImage3D',
+ 'glCopyTextureSubImage1D',
+ 'glCopyTextureSubImage2D',
+ 'glCopyTextureSubImage3D',
+ 'glCreateBuffers',
+ 'glCreateFramebuffers',
+ 'glCreateProgram',
+ 'glCreateProgramPipelines',
+ 'glCreateQueries',
+ 'glCreateRenderbuffers',
+ 'glCreateSamplers',
+ 'glCreateShader',
+ 'glCreateShaderProgramv',
+ 'glCreateTextures',
+ 'glCreateTransformFeedbacks',
+ 'glCreateVertexArrays',
+ 'glCullFace',
+ 'glDebugMessageCallback',
+ 'glDebugMessageControl',
+ 'glDebugMessageInsert',
+ 'glDeleteBuffers',
+ 'glDeleteFramebuffers',
+ 'glDeleteFramebuffersEXT',
+ 'glDeleteLists',
+ 'glDeleteProgram',
+ 'glDeleteProgramPipelines',
+ 'glDeleteQueries',
+ 'glDeleteRenderbuffers',
+ 'glDeleteRenderbuffersEXT',
+ 'glDeleteSamplers',
+ 'glDeleteShader',
+ 'glDeleteSync',
+ 'glDeleteTextures',
+ 'glDeleteTransformFeedbacks',
+ 'glDeleteVertexArrays',
+ 'glDepthFunc',
+ 'glDepthMask',
+ 'glDepthRange',
+ 'glDepthRangeArrayv',
+ 'glDepthRangeIndexed',
+ 'glDepthRangef',
+ 'glDetachShader',
+ 'glDisable',
+ 'glDisableClientState',
+ 'glDisableVertexArrayAttrib',
+ 'glDisableVertexAttribArray',
+ 'glDisablei',
+ 'glDispatchCompute',
+ 'glDispatchComputeIndirect',
+ 'glDrawArrays',
+ 'glDrawArraysIndirect',
+ 'glDrawArraysInstanced',
+ 'glDrawArraysInstancedBaseInstance',
+ 'glDrawBuffer',
+ 'glDrawBuffers',
+ 'glDrawElements',
+ 'glDrawElementsBaseVertex',
+ 'glDrawElementsIndirect',
+ 'glDrawElementsInstanced',
+ 'glDrawElementsInstancedBaseInstance',
+ 'glDrawElementsInstancedBaseVertex',
+ 'glDrawElementsInstancedBaseVertexBaseInstance',
+ 'glDrawPixels',
+ 'glDrawRangeElements',
+ 'glDrawRangeElementsBaseVertex',
+ 'glDrawTransformFeedback',
+ 'glDrawTransformFeedbackInstanced',
+ 'glDrawTransformFeedbackStream',
+ 'glDrawTransformFeedbackStreamInstanced',
+ 'glEdgeFlag',
+ 'glEdgeFlagPointer',
+ 'glEdgeFlagv',
+ 'glEnable',
+ 'glEnableClientState',
+ 'glEnableVertexArrayAttrib',
+ 'glEnableVertexAttribArray',
+ 'glEnablei',
+ 'glEnd',
+ 'glEndConditionalRender',
+ 'glEndList',
+ 'glEndQuery',
+ 'glEndQueryIndexed',
+ 'glEndTransformFeedback',
+ 'glEvalCoord1d',
+ 'glEvalCoord1dv',
+ 'glEvalCoord1f',
+ 'glEvalCoord1fv',
+ 'glEvalCoord2d',
+ 'glEvalCoord2dv',
+ 'glEvalCoord2f',
+ 'glEvalCoord2fv',
+ 'glEvalMesh1',
+ 'glEvalMesh2',
+ 'glEvalPoint1',
+ 'glEvalPoint2',
+ 'glFeedbackBuffer',
+ 'glFenceSync',
+ 'glFinish',
+ 'glFlush',
+ 'glFlushMappedBufferRange',
+ 'glFlushMappedNamedBufferRange',
+ 'glFogCoordPointer',
+ 'glFogCoordd',
+ 'glFogCoorddv',
+ 'glFogCoordf',
+ 'glFogCoordfv',
+ 'glFogf',
+ 'glFogfv',
+ 'glFogi',
+ 'glFogiv',
+ 'glFramebufferParameteri',
+ 'glFramebufferRenderbuffer',
+ 'glFramebufferRenderbufferEXT',
+ 'glFramebufferTexture',
+ 'glFramebufferTexture1D',
+ 'glFramebufferTexture1DEXT',
+ 'glFramebufferTexture2D',
+ 'glFramebufferTexture2DEXT',
+ 'glFramebufferTexture3D',
+ 'glFramebufferTexture3DEXT',
+ 'glFramebufferTextureLayer',
+ 'glFrontFace',
+ 'glFrustum',
+ 'glGenBuffers',
+ 'glGenFramebuffers',
+ 'glGenFramebuffersEXT',
+ 'glGenLists',
+ 'glGenProgramPipelines',
+ 'glGenQueries',
+ 'glGenRenderbuffers',
+ 'glGenRenderbuffersEXT',
+ 'glGenSamplers',
+ 'glGenTextures',
+ 'glGenTransformFeedbacks',
+ 'glGenVertexArrays',
+ 'glGenerateMipmap',
+ 'glGenerateMipmapEXT',
+ 'glGenerateTextureMipmap',
+ 'glGetActiveAtomicCounterBufferiv',
+ 'glGetActiveAttrib',
+ 'glGetActiveSubroutineName',
+ 'glGetActiveSubroutineUniformName',
+ 'glGetActiveSubroutineUniformiv',
+ 'glGetActiveUniform',
+ 'glGetActiveUniformBlockName',
+ 'glGetActiveUniformBlockiv',
+ 'glGetActiveUniformName',
+ 'glGetActiveUniformsiv',
+ 'glGetAttachedShaders',
+ 'glGetAttribLocation',
+ 'glGetBooleani_v',
+ 'glGetBooleanv',
+ 'glGetBufferParameteri64v',
+ 'glGetBufferParameteriv',
+ 'glGetBufferPointerv',
+ 'glGetBufferSubData',
+ 'glGetClipPlane',
+ 'glGetCompressedTexImage',
+ 'glGetCompressedTextureImage',
+ 'glGetCompressedTextureSubImage',
+ 'glGetDebugMessageLog',
+ 'glGetDoublei_v',
+ 'glGetDoublev',
+ 'glGetError',
+ 'glGetFloati_v',
+ 'glGetFloatv',
+ 'glGetFragDataIndex',
+ 'glGetFragDataLocation',
+ 'glGetFramebufferAttachmentParameteriv',
+ 'glGetFramebufferAttachmentParameterivEXT',
+ 'glGetFramebufferParameteriv',
+ 'glGetGraphicsResetStatus',
+ 'glGetInteger64i_v',
+ 'glGetInteger64v',
+ 'glGetIntegeri_v',
+ 'glGetIntegerv',
+ 'glGetInternalformati64v',
+ 'glGetInternalformativ',
+ 'glGetLightfv',
+ 'glGetLightiv',
+ 'glGetMapdv',
+ 'glGetMapfv',
+ 'glGetMapiv',
+ 'glGetMaterialfv',
+ 'glGetMaterialiv',
+ 'glGetMultisamplefv',
+ 'glGetNamedBufferParameteri64v',
+ 'glGetNamedBufferParameteriv',
+ 'glGetNamedBufferPointerv',
+ 'glGetNamedBufferSubData',
+ 'glGetNamedFramebufferAttachmentParameteriv',
+ 'glGetNamedFramebufferParameteriv',
+ 'glGetNamedRenderbufferParameteriv',
+ 'glGetObjectLabel',
+ 'glGetObjectPtrLabel',
+ 'glGetPixelMapfv',
+ 'glGetPixelMapuiv',
+ 'glGetPixelMapusv',
+ 'glGetPointerv',
+ 'glGetPolygonStipple',
+ 'glGetProgramBinary',
+ 'glGetProgramInfoLog',
+ 'glGetProgramInterfaceiv',
+ 'glGetProgramPipelineInfoLog',
+ 'glGetProgramPipelineiv',
+ 'glGetProgramResourceIndex',
+ 'glGetProgramResourceLocation',
+ 'glGetProgramResourceLocationIndex',
+ 'glGetProgramResourceName',
+ 'glGetProgramResourceiv',
+ 'glGetProgramStageiv',
+ 'glGetProgramiv',
+ 'glGetQueryBufferObjecti64v',
+ 'glGetQueryBufferObjectiv',
+ 'glGetQueryBufferObjectui64v',
+ 'glGetQueryBufferObjectuiv',
+ 'glGetQueryIndexediv',
+ 'glGetQueryObjecti64v',
+ 'glGetQueryObjectiv',
+ 'glGetQueryObjectui64v',
+ 'glGetQueryObjectuiv',
+ 'glGetQueryiv',
+ 'glGetRenderbufferParameteriv',
+ 'glGetRenderbufferParameterivEXT',
+ 'glGetSamplerParameterIiv',
+ 'glGetSamplerParameterIuiv',
+ 'glGetSamplerParameterfv',
+ 'glGetSamplerParameteriv',
+ 'glGetShaderInfoLog',
+ 'glGetShaderPrecisionFormat',
+ 'glGetShaderSource',
+ 'glGetShaderiv',
+ 'glGetString',
+ 'glGetStringi',
+ 'glGetSubroutineIndex',
+ 'glGetSubroutineUniformLocation',
+ 'glGetSynciv',
+ 'glGetTexEnvfv',
+ 'glGetTexEnviv',
+ 'glGetTexGendv',
+ 'glGetTexGenfv',
+ 'glGetTexGeniv',
+ 'glGetTexImage',
+ 'glGetTexLevelParameterfv',
+ 'glGetTexLevelParameteriv',
+ 'glGetTexParameterIiv',
+ 'glGetTexParameterIuiv',
+ 'glGetTexParameterfv',
+ 'glGetTexParameteriv',
+ 'glGetTextureImage',
+ 'glGetTextureLevelParameterfv',
+ 'glGetTextureLevelParameteriv',
+ 'glGetTextureParameterIiv',
+ 'glGetTextureParameterIuiv',
+ 'glGetTextureParameterfv',
+ 'glGetTextureParameteriv',
+ 'glGetTextureSubImage',
+ 'glGetTransformFeedbackVarying',
+ 'glGetTransformFeedbacki64_v',
+ 'glGetTransformFeedbacki_v',
+ 'glGetTransformFeedbackiv',
+ 'glGetUniformBlockIndex',
+ 'glGetUniformIndices',
+ 'glGetUniformLocation',
+ 'glGetUniformSubroutineuiv',
+ 'glGetUniformdv',
+ 'glGetUniformfv',
+ 'glGetUniformiv',
+ 'glGetUniformuiv',
+ 'glGetVertexArrayIndexed64iv',
+ 'glGetVertexArrayIndexediv',
+ 'glGetVertexArrayiv',
+ 'glGetVertexAttribIiv',
+ 'glGetVertexAttribIuiv',
+ 'glGetVertexAttribLdv',
+ 'glGetVertexAttribPointerv',
+ 'glGetVertexAttribdv',
+ 'glGetVertexAttribfv',
+ 'glGetVertexAttribiv',
+ 'glGetnColorTable',
+ 'glGetnCompressedTexImage',
+ 'glGetnConvolutionFilter',
+ 'glGetnHistogram',
+ 'glGetnMapdv',
+ 'glGetnMapfv',
+ 'glGetnMapiv',
+ 'glGetnMinmax',
+ 'glGetnPixelMapfv',
+ 'glGetnPixelMapuiv',
+ 'glGetnPixelMapusv',
+ 'glGetnPolygonStipple',
+ 'glGetnSeparableFilter',
+ 'glGetnTexImage',
+ 'glGetnUniformdv',
+ 'glGetnUniformfv',
+ 'glGetnUniformiv',
+ 'glGetnUniformuiv',
+ 'glHint',
+ 'glIndexMask',
+ 'glIndexPointer',
+ 'glIndexd',
+ 'glIndexdv',
+ 'glIndexf',
+ 'glIndexfv',
+ 'glIndexi',
+ 'glIndexiv',
+ 'glIndexs',
+ 'glIndexsv',
+ 'glIndexub',
+ 'glIndexubv',
+ 'glInitNames',
+ 'glInterleavedArrays',
+ 'glInvalidateBufferData',
+ 'glInvalidateBufferSubData',
+ 'glInvalidateFramebuffer',
+ 'glInvalidateNamedFramebufferData',
+ 'glInvalidateNamedFramebufferSubData',
+ 'glInvalidateSubFramebuffer',
+ 'glInvalidateTexImage',
+ 'glInvalidateTexSubImage',
+ 'glIsBuffer',
+ 'glIsEnabled',
+ 'glIsEnabledi',
+ 'glIsFramebuffer',
+ 'glIsFramebufferEXT',
+ 'glIsList',
+ 'glIsProgram',
+ 'glIsProgramPipeline',
+ 'glIsQuery',
+ 'glIsRenderbuffer',
+ 'glIsRenderbufferEXT',
+ 'glIsSampler',
+ 'glIsShader',
+ 'glIsSync',
+ 'glIsTexture',
+ 'glIsTransformFeedback',
+ 'glIsVertexArray',
+ 'glLightModelf',
+ 'glLightModelfv',
+ 'glLightModeli',
+ 'glLightModeliv',
+ 'glLightf',
+ 'glLightfv',
+ 'glLighti',
+ 'glLightiv',
+ 'glLineStipple',
+ 'glLineWidth',
+ 'glLinkProgram',
+ 'glListBase',
+ 'glLoadIdentity',
+ 'glLoadMatrixd',
+ 'glLoadMatrixf',
+ 'glLoadName',
+ 'glLoadTransposeMatrixd',
+ 'glLoadTransposeMatrixf',
+ 'glLogicOp',
+ 'glMap1d',
+ 'glMap1f',
+ 'glMap2d',
+ 'glMap2f',
+ 'glMapBuffer',
+ 'glMapBufferRange',
+ 'glMapGrid1d',
+ 'glMapGrid1f',
+ 'glMapGrid2d',
+ 'glMapGrid2f',
+ 'glMapNamedBuffer',
+ 'glMapNamedBufferRange',
+ 'glMaterialf',
+ 'glMaterialfv',
+ 'glMateriali',
+ 'glMaterialiv',
+ 'glMatrixMode',
+ 'glMemoryBarrier',
+ 'glMemoryBarrierByRegion',
+ 'glMinSampleShading',
+ 'glMultMatrixd',
+ 'glMultMatrixf',
+ 'glMultTransposeMatrixd',
+ 'glMultTransposeMatrixf',
+ 'glMultiDrawArrays',
+ 'glMultiDrawArraysIndirect',
+ 'glMultiDrawArraysIndirectCount',
+ 'glMultiDrawElements',
+ 'glMultiDrawElementsBaseVertex',
+ 'glMultiDrawElementsIndirect',
+ 'glMultiDrawElementsIndirectCount',
+ 'glMultiTexCoord1d',
+ 'glMultiTexCoord1dv',
+ 'glMultiTexCoord1f',
+ 'glMultiTexCoord1fv',
+ 'glMultiTexCoord1i',
+ 'glMultiTexCoord1iv',
+ 'glMultiTexCoord1s',
+ 'glMultiTexCoord1sv',
+ 'glMultiTexCoord2d',
+ 'glMultiTexCoord2dv',
+ 'glMultiTexCoord2f',
+ 'glMultiTexCoord2fv',
+ 'glMultiTexCoord2i',
+ 'glMultiTexCoord2iv',
+ 'glMultiTexCoord2s',
+ 'glMultiTexCoord2sv',
+ 'glMultiTexCoord3d',
+ 'glMultiTexCoord3dv',
+ 'glMultiTexCoord3f',
+ 'glMultiTexCoord3fv',
+ 'glMultiTexCoord3i',
+ 'glMultiTexCoord3iv',
+ 'glMultiTexCoord3s',
+ 'glMultiTexCoord3sv',
+ 'glMultiTexCoord4d',
+ 'glMultiTexCoord4dv',
+ 'glMultiTexCoord4f',
+ 'glMultiTexCoord4fv',
+ 'glMultiTexCoord4i',
+ 'glMultiTexCoord4iv',
+ 'glMultiTexCoord4s',
+ 'glMultiTexCoord4sv',
+ 'glMultiTexCoordP1ui',
+ 'glMultiTexCoordP1uiv',
+ 'glMultiTexCoordP2ui',
+ 'glMultiTexCoordP2uiv',
+ 'glMultiTexCoordP3ui',
+ 'glMultiTexCoordP3uiv',
+ 'glMultiTexCoordP4ui',
+ 'glMultiTexCoordP4uiv',
+ 'glNamedBufferData',
+ 'glNamedBufferStorage',
+ 'glNamedBufferSubData',
+ 'glNamedFramebufferDrawBuffer',
+ 'glNamedFramebufferDrawBuffers',
+ 'glNamedFramebufferParameteri',
+ 'glNamedFramebufferReadBuffer',
+ 'glNamedFramebufferRenderbuffer',
+ 'glNamedFramebufferTexture',
+ 'glNamedFramebufferTextureLayer',
+ 'glNamedRenderbufferStorage',
+ 'glNamedRenderbufferStorageMultisample',
+ 'glNewList',
+ 'glNormal3b',
+ 'glNormal3bv',
+ 'glNormal3d',
+ 'glNormal3dv',
+ 'glNormal3f',
+ 'glNormal3fv',
+ 'glNormal3i',
+ 'glNormal3iv',
+ 'glNormal3s',
+ 'glNormal3sv',
+ 'glNormalP3ui',
+ 'glNormalP3uiv',
+ 'glNormalPointer',
+ 'glObjectLabel',
+ 'glObjectPtrLabel',
+ 'glOrtho',
+ 'glPassThrough',
+ 'glPatchParameterfv',
+ 'glPatchParameteri',
+ 'glPauseTransformFeedback',
+ 'glPixelMapfv',
+ 'glPixelMapuiv',
+ 'glPixelMapusv',
+ 'glPixelStoref',
+ 'glPixelStorei',
+ 'glPixelTransferf',
+ 'glPixelTransferi',
+ 'glPixelZoom',
+ 'glPointParameterf',
+ 'glPointParameterfv',
+ 'glPointParameteri',
+ 'glPointParameteriv',
+ 'glPointSize',
+ 'glPolygonMode',
+ 'glPolygonOffset',
+ 'glPolygonOffsetClamp',
+ 'glPolygonStipple',
+ 'glPopAttrib',
+ 'glPopClientAttrib',
+ 'glPopDebugGroup',
+ 'glPopMatrix',
+ 'glPopName',
+ 'glPrimitiveRestartIndex',
+ 'glPrioritizeTextures',
+ 'glProgramBinary',
+ 'glProgramParameteri',
+ 'glProgramUniform1d',
+ 'glProgramUniform1dv',
+ 'glProgramUniform1f',
+ 'glProgramUniform1fv',
+ 'glProgramUniform1i',
+ 'glProgramUniform1iv',
+ 'glProgramUniform1ui',
+ 'glProgramUniform1uiv',
+ 'glProgramUniform2d',
+ 'glProgramUniform2dv',
+ 'glProgramUniform2f',
+ 'glProgramUniform2fv',
+ 'glProgramUniform2i',
+ 'glProgramUniform2iv',
+ 'glProgramUniform2ui',
+ 'glProgramUniform2uiv',
+ 'glProgramUniform3d',
+ 'glProgramUniform3dv',
+ 'glProgramUniform3f',
+ 'glProgramUniform3fv',
+ 'glProgramUniform3i',
+ 'glProgramUniform3iv',
+ 'glProgramUniform3ui',
+ 'glProgramUniform3uiv',
+ 'glProgramUniform4d',
+ 'glProgramUniform4dv',
+ 'glProgramUniform4f',
+ 'glProgramUniform4fv',
+ 'glProgramUniform4i',
+ 'glProgramUniform4iv',
+ 'glProgramUniform4ui',
+ 'glProgramUniform4uiv',
+ 'glProgramUniformMatrix2dv',
+ 'glProgramUniformMatrix2fv',
+ 'glProgramUniformMatrix2x3dv',
+ 'glProgramUniformMatrix2x3fv',
+ 'glProgramUniformMatrix2x4dv',
+ 'glProgramUniformMatrix2x4fv',
+ 'glProgramUniformMatrix3dv',
+ 'glProgramUniformMatrix3fv',
+ 'glProgramUniformMatrix3x2dv',
+ 'glProgramUniformMatrix3x2fv',
+ 'glProgramUniformMatrix3x4dv',
+ 'glProgramUniformMatrix3x4fv',
+ 'glProgramUniformMatrix4dv',
+ 'glProgramUniformMatrix4fv',
+ 'glProgramUniformMatrix4x2dv',
+ 'glProgramUniformMatrix4x2fv',
+ 'glProgramUniformMatrix4x3dv',
+ 'glProgramUniformMatrix4x3fv',
+ 'glProvokingVertex',
+ 'glPushAttrib',
+ 'glPushClientAttrib',
+ 'glPushDebugGroup',
+ 'glPushMatrix',
+ 'glPushName',
+ 'glQueryCounter',
+ 'glRasterPos2d',
+ 'glRasterPos2dv',
+ 'glRasterPos2f',
+ 'glRasterPos2fv',
+ 'glRasterPos2i',
+ 'glRasterPos2iv',
+ 'glRasterPos2s',
+ 'glRasterPos2sv',
+ 'glRasterPos3d',
+ 'glRasterPos3dv',
+ 'glRasterPos3f',
+ 'glRasterPos3fv',
+ 'glRasterPos3i',
+ 'glRasterPos3iv',
+ 'glRasterPos3s',
+ 'glRasterPos3sv',
+ 'glRasterPos4d',
+ 'glRasterPos4dv',
+ 'glRasterPos4f',
+ 'glRasterPos4fv',
+ 'glRasterPos4i',
+ 'glRasterPos4iv',
+ 'glRasterPos4s',
+ 'glRasterPos4sv',
+ 'glReadBuffer',
+ 'glReadPixels',
+ 'glReadnPixels',
+ 'glRectd',
+ 'glRectdv',
+ 'glRectf',
+ 'glRectfv',
+ 'glRecti',
+ 'glRectiv',
+ 'glRects',
+ 'glRectsv',
+ 'glReleaseShaderCompiler',
+ 'glRenderMode',
+ 'glRenderbufferStorage',
+ 'glRenderbufferStorageEXT',
+ 'glRenderbufferStorageMultisample',
+ 'glResumeTransformFeedback',
+ 'glRotated',
+ 'glRotatef',
+ 'glSampleCoverage',
+ 'glSampleCoverageARB',
+ 'glSampleMaski',
+ 'glSamplerParameterIiv',
+ 'glSamplerParameterIuiv',
+ 'glSamplerParameterf',
+ 'glSamplerParameterfv',
+ 'glSamplerParameteri',
+ 'glSamplerParameteriv',
+ 'glScaled',
+ 'glScalef',
+ 'glScissor',
+ 'glScissorArrayv',
+ 'glScissorIndexed',
+ 'glScissorIndexedv',
+ 'glSecondaryColor3b',
+ 'glSecondaryColor3bv',
+ 'glSecondaryColor3d',
+ 'glSecondaryColor3dv',
+ 'glSecondaryColor3f',
+ 'glSecondaryColor3fv',
+ 'glSecondaryColor3i',
+ 'glSecondaryColor3iv',
+ 'glSecondaryColor3s',
+ 'glSecondaryColor3sv',
+ 'glSecondaryColor3ub',
+ 'glSecondaryColor3ubv',
+ 'glSecondaryColor3ui',
+ 'glSecondaryColor3uiv',
+ 'glSecondaryColor3us',
+ 'glSecondaryColor3usv',
+ 'glSecondaryColorP3ui',
+ 'glSecondaryColorP3uiv',
+ 'glSecondaryColorPointer',
+ 'glSelectBuffer',
+ 'glShadeModel',
+ 'glShaderBinary',
+ 'glShaderSource',
+ 'glShaderStorageBlockBinding',
+ 'glSpecializeShader',
+ 'glStencilFunc',
+ 'glStencilFuncSeparate',
+ 'glStencilMask',
+ 'glStencilMaskSeparate',
+ 'glStencilOp',
+ 'glStencilOpSeparate',
+ 'glTexBuffer',
+ 'glTexBufferRange',
+ 'glTexCoord1d',
+ 'glTexCoord1dv',
+ 'glTexCoord1f',
+ 'glTexCoord1fv',
+ 'glTexCoord1i',
+ 'glTexCoord1iv',
+ 'glTexCoord1s',
+ 'glTexCoord1sv',
+ 'glTexCoord2d',
+ 'glTexCoord2dv',
+ 'glTexCoord2f',
+ 'glTexCoord2fv',
+ 'glTexCoord2i',
+ 'glTexCoord2iv',
+ 'glTexCoord2s',
+ 'glTexCoord2sv',
+ 'glTexCoord3d',
+ 'glTexCoord3dv',
+ 'glTexCoord3f',
+ 'glTexCoord3fv',
+ 'glTexCoord3i',
+ 'glTexCoord3iv',
+ 'glTexCoord3s',
+ 'glTexCoord3sv',
+ 'glTexCoord4d',
+ 'glTexCoord4dv',
+ 'glTexCoord4f',
+ 'glTexCoord4fv',
+ 'glTexCoord4i',
+ 'glTexCoord4iv',
+ 'glTexCoord4s',
+ 'glTexCoord4sv',
+ 'glTexCoordP1ui',
+ 'glTexCoordP1uiv',
+ 'glTexCoordP2ui',
+ 'glTexCoordP2uiv',
+ 'glTexCoordP3ui',
+ 'glTexCoordP3uiv',
+ 'glTexCoordP4ui',
+ 'glTexCoordP4uiv',
+ 'glTexCoordPointer',
+ 'glTexEnvf',
+ 'glTexEnvfv',
+ 'glTexEnvi',
+ 'glTexEnviv',
+ 'glTexGend',
+ 'glTexGendv',
+ 'glTexGenf',
+ 'glTexGenfv',
+ 'glTexGeni',
+ 'glTexGeniv',
+ 'glTexImage1D',
+ 'glTexImage2D',
+ 'glTexImage2DMultisample',
+ 'glTexImage3D',
+ 'glTexImage3DMultisample',
+ 'glTexParameterIiv',
+ 'glTexParameterIuiv',
+ 'glTexParameterf',
+ 'glTexParameterfv',
+ 'glTexParameteri',
+ 'glTexParameteriv',
+ 'glTexStorage1D',
+ 'glTexStorage2D',
+ 'glTexStorage2DMultisample',
+ 'glTexStorage3D',
+ 'glTexStorage3DMultisample',
+ 'glTexSubImage1D',
+ 'glTexSubImage2D',
+ 'glTexSubImage3D',
+ 'glTextureBarrier',
+ 'glTextureBuffer',
+ 'glTextureBufferRange',
+ 'glTextureParameterIiv',
+ 'glTextureParameterIuiv',
+ 'glTextureParameterf',
+ 'glTextureParameterfv',
+ 'glTextureParameteri',
+ 'glTextureParameteriv',
+ 'glTextureStorage1D',
+ 'glTextureStorage2D',
+ 'glTextureStorage2DMultisample',
+ 'glTextureStorage3D',
+ 'glTextureStorage3DMultisample',
+ 'glTextureSubImage1D',
+ 'glTextureSubImage2D',
+ 'glTextureSubImage3D',
+ 'glTextureView',
+ 'glTransformFeedbackBufferBase',
+ 'glTransformFeedbackBufferRange',
+ 'glTransformFeedbackVaryings',
+ 'glTranslated',
+ 'glTranslatef',
+ 'glUniform1d',
+ 'glUniform1dv',
+ 'glUniform1f',
+ 'glUniform1fv',
+ 'glUniform1i',
+ 'glUniform1iv',
+ 'glUniform1ui',
+ 'glUniform1uiv',
+ 'glUniform2d',
+ 'glUniform2dv',
+ 'glUniform2f',
+ 'glUniform2fv',
+ 'glUniform2i',
+ 'glUniform2iv',
+ 'glUniform2ui',
+ 'glUniform2uiv',
+ 'glUniform3d',
+ 'glUniform3dv',
+ 'glUniform3f',
+ 'glUniform3fv',
+ 'glUniform3i',
+ 'glUniform3iv',
+ 'glUniform3ui',
+ 'glUniform3uiv',
+ 'glUniform4d',
+ 'glUniform4dv',
+ 'glUniform4f',
+ 'glUniform4fv',
+ 'glUniform4i',
+ 'glUniform4iv',
+ 'glUniform4ui',
+ 'glUniform4uiv',
+ 'glUniformBlockBinding',
+ 'glUniformMatrix2dv',
+ 'glUniformMatrix2fv',
+ 'glUniformMatrix2x3dv',
+ 'glUniformMatrix2x3fv',
+ 'glUniformMatrix2x4dv',
+ 'glUniformMatrix2x4fv',
+ 'glUniformMatrix3dv',
+ 'glUniformMatrix3fv',
+ 'glUniformMatrix3x2dv',
+ 'glUniformMatrix3x2fv',
+ 'glUniformMatrix3x4dv',
+ 'glUniformMatrix3x4fv',
+ 'glUniformMatrix4dv',
+ 'glUniformMatrix4fv',
+ 'glUniformMatrix4x2dv',
+ 'glUniformMatrix4x2fv',
+ 'glUniformMatrix4x3dv',
+ 'glUniformMatrix4x3fv',
+ 'glUniformSubroutinesuiv',
+ 'glUnmapBuffer',
+ 'glUnmapNamedBuffer',
+ 'glUseProgram',
+ 'glUseProgramStages',
+ 'glValidateProgram',
+ 'glValidateProgramPipeline',
+ 'glVertex2d',
+ 'glVertex2dv',
+ 'glVertex2f',
+ 'glVertex2fv',
+ 'glVertex2i',
+ 'glVertex2iv',
+ 'glVertex2s',
+ 'glVertex2sv',
+ 'glVertex3d',
+ 'glVertex3dv',
+ 'glVertex3f',
+ 'glVertex3fv',
+ 'glVertex3i',
+ 'glVertex3iv',
+ 'glVertex3s',
+ 'glVertex3sv',
+ 'glVertex4d',
+ 'glVertex4dv',
+ 'glVertex4f',
+ 'glVertex4fv',
+ 'glVertex4i',
+ 'glVertex4iv',
+ 'glVertex4s',
+ 'glVertex4sv',
+ 'glVertexArrayAttribBinding',
+ 'glVertexArrayAttribFormat',
+ 'glVertexArrayAttribIFormat',
+ 'glVertexArrayAttribLFormat',
+ 'glVertexArrayBindingDivisor',
+ 'glVertexArrayElementBuffer',
+ 'glVertexArrayVertexBuffer',
+ 'glVertexArrayVertexBuffers',
+ 'glVertexAttrib1d',
+ 'glVertexAttrib1dv',
+ 'glVertexAttrib1f',
+ 'glVertexAttrib1fv',
+ 'glVertexAttrib1s',
+ 'glVertexAttrib1sv',
+ 'glVertexAttrib2d',
+ 'glVertexAttrib2dv',
+ 'glVertexAttrib2f',
+ 'glVertexAttrib2fv',
+ 'glVertexAttrib2s',
+ 'glVertexAttrib2sv',
+ 'glVertexAttrib3d',
+ 'glVertexAttrib3dv',
+ 'glVertexAttrib3f',
+ 'glVertexAttrib3fv',
+ 'glVertexAttrib3s',
+ 'glVertexAttrib3sv',
+ 'glVertexAttrib4Nbv',
+ 'glVertexAttrib4Niv',
+ 'glVertexAttrib4Nsv',
+ 'glVertexAttrib4Nub',
+ 'glVertexAttrib4Nubv',
+ 'glVertexAttrib4Nuiv',
+ 'glVertexAttrib4Nusv',
+ 'glVertexAttrib4bv',
+ 'glVertexAttrib4d',
+ 'glVertexAttrib4dv',
+ 'glVertexAttrib4f',
+ 'glVertexAttrib4fv',
+ 'glVertexAttrib4iv',
+ 'glVertexAttrib4s',
+ 'glVertexAttrib4sv',
+ 'glVertexAttrib4ubv',
+ 'glVertexAttrib4uiv',
+ 'glVertexAttrib4usv',
+ 'glVertexAttribBinding',
+ 'glVertexAttribDivisor',
+ 'glVertexAttribFormat',
+ 'glVertexAttribI1i',
+ 'glVertexAttribI1iv',
+ 'glVertexAttribI1ui',
+ 'glVertexAttribI1uiv',
+ 'glVertexAttribI2i',
+ 'glVertexAttribI2iv',
+ 'glVertexAttribI2ui',
+ 'glVertexAttribI2uiv',
+ 'glVertexAttribI3i',
+ 'glVertexAttribI3iv',
+ 'glVertexAttribI3ui',
+ 'glVertexAttribI3uiv',
+ 'glVertexAttribI4bv',
+ 'glVertexAttribI4i',
+ 'glVertexAttribI4iv',
+ 'glVertexAttribI4sv',
+ 'glVertexAttribI4ubv',
+ 'glVertexAttribI4ui',
+ 'glVertexAttribI4uiv',
+ 'glVertexAttribI4usv',
+ 'glVertexAttribIFormat',
+ 'glVertexAttribIPointer',
+ 'glVertexAttribL1d',
+ 'glVertexAttribL1dv',
+ 'glVertexAttribL2d',
+ 'glVertexAttribL2dv',
+ 'glVertexAttribL3d',
+ 'glVertexAttribL3dv',
+ 'glVertexAttribL4d',
+ 'glVertexAttribL4dv',
+ 'glVertexAttribLFormat',
+ 'glVertexAttribLPointer',
+ 'glVertexAttribP1ui',
+ 'glVertexAttribP1uiv',
+ 'glVertexAttribP2ui',
+ 'glVertexAttribP2uiv',
+ 'glVertexAttribP3ui',
+ 'glVertexAttribP3uiv',
+ 'glVertexAttribP4ui',
+ 'glVertexAttribP4uiv',
+ 'glVertexAttribPointer',
+ 'glVertexBindingDivisor',
+ 'glVertexP2ui',
+ 'glVertexP2uiv',
+ 'glVertexP3ui',
+ 'glVertexP3uiv',
+ 'glVertexP4ui',
+ 'glVertexP4uiv',
+ 'glVertexPointer',
+ 'glViewport',
+ 'glViewportArrayv',
+ 'glViewportIndexedf',
+ 'glViewportIndexedfv',
+ 'glWaitSync',
+ 'glWindowPos2d',
+ 'glWindowPos2dv',
+ 'glWindowPos2f',
+ 'glWindowPos2fv',
+ 'glWindowPos2i',
+ 'glWindowPos2iv',
+ 'glWindowPos2s',
+ 'glWindowPos2sv',
+ 'glWindowPos3d',
+ 'glWindowPos3dv',
+ 'glWindowPos3f',
+ 'glWindowPos3fv',
+ 'glWindowPos3i',
+ 'glWindowPos3iv',
+ 'glWindowPos3s',
+ 'glWindowPos3sv',
+]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/gl_info.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/gl_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..8495e1eb76024984738c9e7f026643ef72a39594
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/gl_info.py
@@ -0,0 +1,205 @@
+"""Information about version and extensions of current GL implementation.
+
+Usage::
+
+ from pyglet.gl import gl_info
+
+ if gl_info.have_extension('GL_NV_register_combiners'):
+ # ...
+
+If you are using more than one context, you can set up a separate GLInfo
+object for each context. Call `set_active_context` after switching to the
+context::
+
+ from pyglet.gl.gl_info import GLInfo
+
+ info = GLInfo()
+ info.set_active_context()
+
+ if info.have_version(4, 5):
+ # ...
+
+"""
+import warnings
+
+from ctypes import c_char_p, cast
+
+from pyglet.gl.gl import GL_EXTENSIONS, GL_RENDERER, GL_VENDOR, GL_VERSION
+from pyglet.gl.gl import GL_MAJOR_VERSION, GL_MINOR_VERSION, GLint
+from pyglet.gl.lib import GLException
+from pyglet.util import asstr
+
+
+def _get_number(parameter):
+ from pyglet.gl.gl import glGetIntegerv
+ number = GLint()
+ glGetIntegerv(parameter, number)
+ return number.value
+
+
+class GLInfo:
+ """Information interface for a single GL context.
+
+ A default instance is created automatically when the first OpenGL context
+ is created. You can use the module functions as a convenience for
+ this default instance's methods.
+
+ If you are using more than one context, you must call `set_active_context`
+ when the context is active for this `GLInfo` instance.
+ """
+ _have_context = False
+ vendor = ''
+ renderer = ''
+ version = '0.0'
+ major_version = 0
+ minor_version = 0
+ opengl_api = 'gl'
+ extensions = set()
+
+ _have_info = False
+
+ def set_active_context(self):
+ """Store information for the currently active context.
+
+ This method is called automatically for the default context.
+ """
+ from pyglet.gl.gl import glGetString, glGetStringi, GL_NUM_EXTENSIONS
+
+ self._have_context = True
+ if not self._have_info:
+ self.vendor = asstr(cast(glGetString(GL_VENDOR), c_char_p).value)
+ self.renderer = asstr(cast(glGetString(GL_RENDERER), c_char_p).value)
+ self.version = asstr(cast(glGetString(GL_VERSION), c_char_p).value)
+ # NOTE: The version string requirements for gles is a lot stricter
+ # so using this to rely on detecting the API is not too unreasonable
+ self.opengl_api = "gles" if "opengl es" in self.version.lower() else "gl"
+
+ try:
+ self.major_version = _get_number(GL_MAJOR_VERSION)
+ self.minor_version = _get_number(GL_MINOR_VERSION)
+ num_ext = _get_number(GL_NUM_EXTENSIONS)
+ self.extensions = (asstr(cast(glGetStringi(GL_EXTENSIONS, i), c_char_p).value) for i in range(num_ext))
+ self.extensions = set(self.extensions)
+ except GLException:
+ pass # GL3 is likely not available
+
+ self._have_info = True
+
+ def remove_active_context(self):
+ self._have_context = False
+ self._have_info = False
+
+ def have_context(self):
+ return self._have_context
+
+ def have_extension(self, extension):
+ """Determine if an OpenGL extension is available.
+
+ :Parameters:
+ `extension` : str
+ The name of the extension to test for, including its
+ ``GL_`` prefix.
+
+ :return: True if the extension is provided by the driver.
+ :rtype: bool
+ """
+ if not self._have_context:
+ warnings.warn('No GL context created yet.')
+ return extension in self.extensions
+
+ def get_extensions(self):
+ """Get a list of available OpenGL extensions.
+
+ :return: a list of the available extensions.
+ :rtype: list of str
+ """
+ if not self._have_context:
+ warnings.warn('No GL context created yet.')
+ return self.extensions
+
+ def get_version(self):
+ """Get the current OpenGL version.
+
+ :return: The major and minor version as a tuple
+ :rtype: tuple
+ """
+ if not self._have_context:
+ warnings.warn('No GL context created yet.')
+ return self.major_version, self.minor_version
+
+ def get_version_string(self):
+ """Get the current OpenGL version string.
+
+ :return: The OpenGL version string
+ :rtype: str
+ """
+ if not self._have_context:
+ warnings.warn('No GL context created yet.')
+ return self.version
+
+ def have_version(self, major, minor=0):
+ """Determine if a version of OpenGL is supported.
+
+ :Parameters:
+ `major` : int
+ The major revision number (typically 1 or 2).
+ `minor` : int
+ The minor revision number.
+
+ :rtype: bool
+ :return: True if the requested or a later version is supported.
+ """
+
+ if not self._have_context:
+ warnings.warn('No GL context created yet.')
+ if not self.major_version and not self.minor_version:
+ return False
+
+ return (self.major_version > major or
+ (self.major_version == major and self.minor_version >= minor) or
+ (self.major_version == major and self.minor_version == minor))
+
+ def get_renderer(self):
+ """Determine the renderer string of the OpenGL context.
+
+ :rtype: str
+ """
+ if not self._have_context:
+ warnings.warn('No GL context created yet.')
+ return self.renderer
+
+ def get_vendor(self):
+ """Determine the vendor string of the OpenGL context.
+
+ :rtype: str
+ """
+ if not self._have_context:
+ warnings.warn('No GL context created yet.')
+ return self.vendor
+
+ def get_opengl_api(self):
+ """Determine the OpenGL API version.
+ Usually ``gl`` or ``gles``.
+
+ :rtype: str
+ """
+ if not self._have_context:
+ warnings.warn('No GL context created yet.')
+ return self.opengl_api
+
+
+# Single instance useful for apps with only a single context
+# (or all contexts have the same GL driver, a common case).
+_gl_info = GLInfo()
+
+get_extensions = _gl_info.get_extensions
+get_version = _gl_info.get_version
+get_version_string = _gl_info.get_version_string
+have_version = _gl_info.have_version
+get_renderer = _gl_info.get_renderer
+get_vendor = _gl_info.get_vendor
+get_opengl_api = _gl_info.get_opengl_api
+have_extension = _gl_info.have_extension
+have_context = _gl_info.have_context
+remove_active_context = _gl_info.remove_active_context
+set_active_context = _gl_info.set_active_context
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glx.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glx.py
new file mode 100644
index 0000000000000000000000000000000000000000..9416929e2d613ce80fda59fa4a2a552c010d3d67
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glx.py
@@ -0,0 +1,588 @@
+"""Wrapper for /usr/include/GL/glx.h
+
+Do not modify generated portions of this file.
+"""
+
+from ctypes import *
+from pyglet.gl.lib import link_GLX as _link_function
+from pyglet.gl.lib import c_void
+
+if not _link_function:
+ raise ImportError('libGL.so is not available.')
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for /usr/include/GL/glx.h
+
+import pyglet.libs.x11.xlib
+
+# H (/usr/include/GL/glx.h:26)
+GLX_VERSION_1_1 = 1 # /usr/include/GL/glx.h:58
+GLX_VERSION_1_2 = 1 # /usr/include/GL/glx.h:59
+GLX_VERSION_1_3 = 1 # /usr/include/GL/glx.h:60
+GLX_VERSION_1_4 = 1 # /usr/include/GL/glx.h:61
+GLX_USE_GL = 1 # /usr/include/GL/glx.h:70
+GLX_BUFFER_SIZE = 2 # /usr/include/GL/glx.h:71
+GLX_LEVEL = 3 # /usr/include/GL/glx.h:72
+GLX_RGBA = 4 # /usr/include/GL/glx.h:73
+GLX_DOUBLEBUFFER = 5 # /usr/include/GL/glx.h:74
+GLX_STEREO = 6 # /usr/include/GL/glx.h:75
+GLX_AUX_BUFFERS = 7 # /usr/include/GL/glx.h:76
+GLX_RED_SIZE = 8 # /usr/include/GL/glx.h:77
+GLX_GREEN_SIZE = 9 # /usr/include/GL/glx.h:78
+GLX_BLUE_SIZE = 10 # /usr/include/GL/glx.h:79
+GLX_ALPHA_SIZE = 11 # /usr/include/GL/glx.h:80
+GLX_DEPTH_SIZE = 12 # /usr/include/GL/glx.h:81
+GLX_STENCIL_SIZE = 13 # /usr/include/GL/glx.h:82
+GLX_ACCUM_RED_SIZE = 14 # /usr/include/GL/glx.h:83
+GLX_ACCUM_GREEN_SIZE = 15 # /usr/include/GL/glx.h:84
+GLX_ACCUM_BLUE_SIZE = 16 # /usr/include/GL/glx.h:85
+GLX_ACCUM_ALPHA_SIZE = 17 # /usr/include/GL/glx.h:86
+GLX_BAD_SCREEN = 1 # /usr/include/GL/glx.h:92
+GLX_BAD_ATTRIBUTE = 2 # /usr/include/GL/glx.h:93
+GLX_NO_EXTENSION = 3 # /usr/include/GL/glx.h:94
+GLX_BAD_VISUAL = 4 # /usr/include/GL/glx.h:95
+GLX_BAD_CONTEXT = 5 # /usr/include/GL/glx.h:96
+GLX_BAD_VALUE = 6 # /usr/include/GL/glx.h:97
+GLX_BAD_ENUM = 7 # /usr/include/GL/glx.h:98
+GLX_VENDOR = 1 # /usr/include/GL/glx.h:104
+GLX_VERSION = 2 # /usr/include/GL/glx.h:105
+GLX_EXTENSIONS = 3 # /usr/include/GL/glx.h:106
+GLX_CONFIG_CAVEAT = 32 # /usr/include/GL/glx.h:112
+GLX_DONT_CARE = 4294967295 # /usr/include/GL/glx.h:113
+GLX_X_VISUAL_TYPE = 34 # /usr/include/GL/glx.h:114
+GLX_TRANSPARENT_TYPE = 35 # /usr/include/GL/glx.h:115
+GLX_TRANSPARENT_INDEX_VALUE = 36 # /usr/include/GL/glx.h:116
+GLX_TRANSPARENT_RED_VALUE = 37 # /usr/include/GL/glx.h:117
+GLX_TRANSPARENT_GREEN_VALUE = 38 # /usr/include/GL/glx.h:118
+GLX_TRANSPARENT_BLUE_VALUE = 39 # /usr/include/GL/glx.h:119
+GLX_TRANSPARENT_ALPHA_VALUE = 40 # /usr/include/GL/glx.h:120
+GLX_WINDOW_BIT = 1 # /usr/include/GL/glx.h:121
+GLX_PIXMAP_BIT = 2 # /usr/include/GL/glx.h:122
+GLX_PBUFFER_BIT = 4 # /usr/include/GL/glx.h:123
+GLX_AUX_BUFFERS_BIT = 16 # /usr/include/GL/glx.h:124
+GLX_FRONT_LEFT_BUFFER_BIT = 1 # /usr/include/GL/glx.h:125
+GLX_FRONT_RIGHT_BUFFER_BIT = 2 # /usr/include/GL/glx.h:126
+GLX_BACK_LEFT_BUFFER_BIT = 4 # /usr/include/GL/glx.h:127
+GLX_BACK_RIGHT_BUFFER_BIT = 8 # /usr/include/GL/glx.h:128
+GLX_DEPTH_BUFFER_BIT = 32 # /usr/include/GL/glx.h:129
+GLX_STENCIL_BUFFER_BIT = 64 # /usr/include/GL/glx.h:130
+GLX_ACCUM_BUFFER_BIT = 128 # /usr/include/GL/glx.h:131
+GLX_NONE = 32768 # /usr/include/GL/glx.h:132
+GLX_SLOW_CONFIG = 32769 # /usr/include/GL/glx.h:133
+GLX_TRUE_COLOR = 32770 # /usr/include/GL/glx.h:134
+GLX_DIRECT_COLOR = 32771 # /usr/include/GL/glx.h:135
+GLX_PSEUDO_COLOR = 32772 # /usr/include/GL/glx.h:136
+GLX_STATIC_COLOR = 32773 # /usr/include/GL/glx.h:137
+GLX_GRAY_SCALE = 32774 # /usr/include/GL/glx.h:138
+GLX_STATIC_GRAY = 32775 # /usr/include/GL/glx.h:139
+GLX_TRANSPARENT_RGB = 32776 # /usr/include/GL/glx.h:140
+GLX_TRANSPARENT_INDEX = 32777 # /usr/include/GL/glx.h:141
+GLX_VISUAL_ID = 32779 # /usr/include/GL/glx.h:142
+GLX_SCREEN = 32780 # /usr/include/GL/glx.h:143
+GLX_NON_CONFORMANT_CONFIG = 32781 # /usr/include/GL/glx.h:144
+GLX_DRAWABLE_TYPE = 32784 # /usr/include/GL/glx.h:145
+GLX_RENDER_TYPE = 32785 # /usr/include/GL/glx.h:146
+GLX_X_RENDERABLE = 32786 # /usr/include/GL/glx.h:147
+GLX_FBCONFIG_ID = 32787 # /usr/include/GL/glx.h:148
+GLX_RGBA_TYPE = 32788 # /usr/include/GL/glx.h:149
+GLX_COLOR_INDEX_TYPE = 32789 # /usr/include/GL/glx.h:150
+GLX_MAX_PBUFFER_WIDTH = 32790 # /usr/include/GL/glx.h:151
+GLX_MAX_PBUFFER_HEIGHT = 32791 # /usr/include/GL/glx.h:152
+GLX_MAX_PBUFFER_PIXELS = 32792 # /usr/include/GL/glx.h:153
+GLX_PRESERVED_CONTENTS = 32795 # /usr/include/GL/glx.h:154
+GLX_LARGEST_PBUFFER = 32796 # /usr/include/GL/glx.h:155
+GLX_WIDTH = 32797 # /usr/include/GL/glx.h:156
+GLX_HEIGHT = 32798 # /usr/include/GL/glx.h:157
+GLX_EVENT_MASK = 32799 # /usr/include/GL/glx.h:158
+GLX_DAMAGED = 32800 # /usr/include/GL/glx.h:159
+GLX_SAVED = 32801 # /usr/include/GL/glx.h:160
+GLX_WINDOW = 32802 # /usr/include/GL/glx.h:161
+GLX_PBUFFER = 32803 # /usr/include/GL/glx.h:162
+GLX_PBUFFER_HEIGHT = 32832 # /usr/include/GL/glx.h:163
+GLX_PBUFFER_WIDTH = 32833 # /usr/include/GL/glx.h:164
+GLX_RGBA_BIT = 1 # /usr/include/GL/glx.h:165
+GLX_COLOR_INDEX_BIT = 2 # /usr/include/GL/glx.h:166
+GLX_PBUFFER_CLOBBER_MASK = 134217728 # /usr/include/GL/glx.h:167
+GLX_SAMPLE_BUFFERS = 100000 # /usr/include/GL/glx.h:173
+GLX_SAMPLES = 100001 # /usr/include/GL/glx.h:174
+class struct___GLXcontextRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXcontextRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct___GLXcontextRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXcontextRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GLXContext = POINTER(struct___GLXcontextRec) # /usr/include/GL/glx.h:178
+XID = pyglet.libs.x11.xlib.XID
+GLXPixmap = XID # /usr/include/GL/glx.h:179
+GLXDrawable = XID # /usr/include/GL/glx.h:180
+class struct___GLXFBConfigRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXFBConfigRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct___GLXFBConfigRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXFBConfigRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GLXFBConfig = POINTER(struct___GLXFBConfigRec) # /usr/include/GL/glx.h:182
+GLXFBConfigID = XID # /usr/include/GL/glx.h:183
+GLXContextID = XID # /usr/include/GL/glx.h:184
+GLXWindow = XID # /usr/include/GL/glx.h:185
+GLXPbuffer = XID # /usr/include/GL/glx.h:186
+XVisualInfo = pyglet.libs.x11.xlib.XVisualInfo
+Display = pyglet.libs.x11.xlib.Display
+# /usr/include/GL/glx.h:190
+glXChooseVisual = _link_function('glXChooseVisual', POINTER(XVisualInfo), [POINTER(Display), c_int, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:193
+glXCreateContext = _link_function('glXCreateContext', GLXContext, [POINTER(Display), POINTER(XVisualInfo), GLXContext, c_int], 'H')
+
+# /usr/include/GL/glx.h:196
+glXDestroyContext = _link_function('glXDestroyContext', None, [POINTER(Display), GLXContext], 'H')
+
+# /usr/include/GL/glx.h:198
+glXMakeCurrent = _link_function('glXMakeCurrent', c_int, [POINTER(Display), GLXDrawable, GLXContext], 'H')
+
+# /usr/include/GL/glx.h:201
+glXCopyContext = _link_function('glXCopyContext', None, [POINTER(Display), GLXContext, GLXContext, c_ulong], 'H')
+
+# /usr/include/GL/glx.h:204
+glXSwapBuffers = _link_function('glXSwapBuffers', None, [POINTER(Display), GLXDrawable], 'H')
+
+Pixmap = pyglet.libs.x11.xlib.Pixmap
+# /usr/include/GL/glx.h:206
+glXCreateGLXPixmap = _link_function('glXCreateGLXPixmap', GLXPixmap, [POINTER(Display), POINTER(XVisualInfo), Pixmap], 'H')
+
+# /usr/include/GL/glx.h:209
+glXDestroyGLXPixmap = _link_function('glXDestroyGLXPixmap', None, [POINTER(Display), GLXPixmap], 'H')
+
+# /usr/include/GL/glx.h:211
+glXQueryExtension = _link_function('glXQueryExtension', c_int, [POINTER(Display), POINTER(c_int), POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:213
+glXQueryVersion = _link_function('glXQueryVersion', c_int, [POINTER(Display), POINTER(c_int), POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:215
+glXIsDirect = _link_function('glXIsDirect', c_int, [POINTER(Display), GLXContext], 'H')
+
+# /usr/include/GL/glx.h:217
+glXGetConfig = _link_function('glXGetConfig', c_int, [POINTER(Display), POINTER(XVisualInfo), c_int, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:220
+glXGetCurrentContext = _link_function('glXGetCurrentContext', GLXContext, [], 'H')
+
+# /usr/include/GL/glx.h:222
+glXGetCurrentDrawable = _link_function('glXGetCurrentDrawable', GLXDrawable, [], 'H')
+
+# /usr/include/GL/glx.h:224
+glXWaitGL = _link_function('glXWaitGL', None, [], 'H')
+
+# /usr/include/GL/glx.h:226
+glXWaitX = _link_function('glXWaitX', None, [], 'H')
+
+Font = pyglet.libs.x11.xlib.Font
+# /usr/include/GL/glx.h:228
+glXUseXFont = _link_function('glXUseXFont', None, [Font, c_int, c_int, c_int], 'H')
+
+# /usr/include/GL/glx.h:233
+glXQueryExtensionsString = _link_function('glXQueryExtensionsString', c_char_p, [POINTER(Display), c_int], 'H')
+
+# /usr/include/GL/glx.h:235
+glXQueryServerString = _link_function('glXQueryServerString', c_char_p, [POINTER(Display), c_int, c_int], 'H')
+
+# /usr/include/GL/glx.h:237
+glXGetClientString = _link_function('glXGetClientString', c_char_p, [POINTER(Display), c_int], 'H')
+
+# /usr/include/GL/glx.h:241
+glXGetCurrentDisplay = _link_function('glXGetCurrentDisplay', POINTER(Display), [], 'H')
+
+# /usr/include/GL/glx.h:245
+glXChooseFBConfig = _link_function('glXChooseFBConfig', POINTER(GLXFBConfig), [POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:248
+glXGetFBConfigAttrib = _link_function('glXGetFBConfigAttrib', c_int, [POINTER(Display), GLXFBConfig, c_int, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:251
+glXGetFBConfigs = _link_function('glXGetFBConfigs', POINTER(GLXFBConfig), [POINTER(Display), c_int, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:254
+glXGetVisualFromFBConfig = _link_function('glXGetVisualFromFBConfig', POINTER(XVisualInfo), [POINTER(Display), GLXFBConfig], 'H')
+
+Window = pyglet.libs.x11.xlib.Window
+# /usr/include/GL/glx.h:257
+glXCreateWindow = _link_function('glXCreateWindow', GLXWindow, [POINTER(Display), GLXFBConfig, Window, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:260
+glXDestroyWindow = _link_function('glXDestroyWindow', None, [POINTER(Display), GLXWindow], 'H')
+
+# /usr/include/GL/glx.h:262
+glXCreatePixmap = _link_function('glXCreatePixmap', GLXPixmap, [POINTER(Display), GLXFBConfig, Pixmap, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:265
+glXDestroyPixmap = _link_function('glXDestroyPixmap', None, [POINTER(Display), GLXPixmap], 'H')
+
+# /usr/include/GL/glx.h:267
+glXCreatePbuffer = _link_function('glXCreatePbuffer', GLXPbuffer, [POINTER(Display), GLXFBConfig, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:270
+glXDestroyPbuffer = _link_function('glXDestroyPbuffer', None, [POINTER(Display), GLXPbuffer], 'H')
+
+# /usr/include/GL/glx.h:272
+glXQueryDrawable = _link_function('glXQueryDrawable', None, [POINTER(Display), GLXDrawable, c_int, POINTER(c_uint)], 'H')
+
+# /usr/include/GL/glx.h:275
+glXCreateNewContext = _link_function('glXCreateNewContext', GLXContext, [POINTER(Display), GLXFBConfig, c_int, GLXContext, c_int], 'H')
+
+# /usr/include/GL/glx.h:279
+glXMakeContextCurrent = _link_function('glXMakeContextCurrent', c_int, [POINTER(Display), GLXDrawable, GLXDrawable, GLXContext], 'H')
+
+# /usr/include/GL/glx.h:282
+glXGetCurrentReadDrawable = _link_function('glXGetCurrentReadDrawable', GLXDrawable, [], 'H')
+
+# /usr/include/GL/glx.h:284
+glXQueryContext = _link_function('glXQueryContext', c_int, [POINTER(Display), GLXContext, c_int, POINTER(c_int)], 'H')
+
+# /usr/include/GL/glx.h:287
+glXSelectEvent = _link_function('glXSelectEvent', None, [POINTER(Display), GLXDrawable, c_ulong], 'H')
+
+# /usr/include/GL/glx.h:290
+glXGetSelectedEvent = _link_function('glXGetSelectedEvent', None, [POINTER(Display), GLXDrawable, POINTER(c_ulong)], 'H')
+
+PFNGLXGETFBCONFIGSPROC = CFUNCTYPE(POINTER(GLXFBConfig), POINTER(Display), c_int, POINTER(c_int)) # /usr/include/GL/glx.h:294
+PFNGLXCHOOSEFBCONFIGPROC = CFUNCTYPE(POINTER(GLXFBConfig), POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)) # /usr/include/GL/glx.h:295
+PFNGLXGETFBCONFIGATTRIBPROC = CFUNCTYPE(c_int, POINTER(Display), GLXFBConfig, c_int, POINTER(c_int)) # /usr/include/GL/glx.h:296
+PFNGLXGETVISUALFROMFBCONFIGPROC = CFUNCTYPE(POINTER(XVisualInfo), POINTER(Display), GLXFBConfig) # /usr/include/GL/glx.h:297
+PFNGLXCREATEWINDOWPROC = CFUNCTYPE(GLXWindow, POINTER(Display), GLXFBConfig, Window, POINTER(c_int)) # /usr/include/GL/glx.h:298
+PFNGLXDESTROYWINDOWPROC = CFUNCTYPE(None, POINTER(Display), GLXWindow) # /usr/include/GL/glx.h:299
+PFNGLXCREATEPIXMAPPROC = CFUNCTYPE(GLXPixmap, POINTER(Display), GLXFBConfig, Pixmap, POINTER(c_int)) # /usr/include/GL/glx.h:300
+PFNGLXDESTROYPIXMAPPROC = CFUNCTYPE(None, POINTER(Display), GLXPixmap) # /usr/include/GL/glx.h:301
+PFNGLXCREATEPBUFFERPROC = CFUNCTYPE(GLXPbuffer, POINTER(Display), GLXFBConfig, POINTER(c_int)) # /usr/include/GL/glx.h:302
+PFNGLXDESTROYPBUFFERPROC = CFUNCTYPE(None, POINTER(Display), GLXPbuffer) # /usr/include/GL/glx.h:303
+PFNGLXQUERYDRAWABLEPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int, POINTER(c_uint)) # /usr/include/GL/glx.h:304
+PFNGLXCREATENEWCONTEXTPROC = CFUNCTYPE(GLXContext, POINTER(Display), GLXFBConfig, c_int, GLXContext, c_int) # /usr/include/GL/glx.h:305
+PFNGLXMAKECONTEXTCURRENTPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, GLXDrawable, GLXContext) # /usr/include/GL/glx.h:306
+PFNGLXGETCURRENTREADDRAWABLEPROC = CFUNCTYPE(GLXDrawable) # /usr/include/GL/glx.h:307
+PFNGLXGETCURRENTDISPLAYPROC = CFUNCTYPE(POINTER(Display)) # /usr/include/GL/glx.h:308
+PFNGLXQUERYCONTEXTPROC = CFUNCTYPE(c_int, POINTER(Display), GLXContext, c_int, POINTER(c_int)) # /usr/include/GL/glx.h:309
+PFNGLXSELECTEVENTPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_ulong) # /usr/include/GL/glx.h:310
+PFNGLXGETSELECTEDEVENTPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, POINTER(c_ulong)) # /usr/include/GL/glx.h:311
+# ARB_get_proc_address (/usr/include/GL/glx.h:317)
+GLX_ARB_get_proc_address = 1 # /usr/include/GL/glx.h:318
+__GLXextFuncPtr = CFUNCTYPE(None) # /usr/include/GL/glx.h:320
+GLubyte = c_ubyte # /usr/include/GL/gl.h:160
+# /usr/include/GL/glx.h:321
+glXGetProcAddressARB = _link_function('glXGetProcAddressARB', __GLXextFuncPtr, [POINTER(GLubyte)], 'ARB_get_proc_address')
+
+# /usr/include/GL/glx.h:328
+glXGetProcAddress = _link_function('glXGetProcAddress', POINTER(CFUNCTYPE(None)), [POINTER(GLubyte)], 'ARB_get_proc_address')
+
+PFNGLXGETPROCADDRESSPROC = CFUNCTYPE(__GLXextFuncPtr, POINTER(GLubyte)) # /usr/include/GL/glx.h:331
+# GLXEXT_LEGACY (/usr/include/GL/glx.h:334)
+# VERSION_1_3 (/usr/include/GL/glxext.h:55)
+# VERSION_1_4 (/usr/include/GL/glxext.h:114)
+# ARB_get_proc_address (/usr/include/GL/glxext.h:119)
+# ARB_multisample (/usr/include/GL/glxext.h:122)
+# ARB_fbconfig_float (/usr/include/GL/glxext.h:127)
+# ARB_create_context (/usr/include/GL/glxext.h:132)
+# ARB_create_context_profile (/usr/include/GL/glxext.h:140)
+# SGIS_multisample (/usr/include/GL/glxext.h:146)
+# EXT_visual_info (/usr/include/GL/glxext.h:151)
+# SGI_swap_control (/usr/include/GL/glxext.h:170)
+# SGI_video_sync (/usr/include/GL/glxext.h:173)
+# SGI_make_current_read (/usr/include/GL/glxext.h:176)
+# SGIX_video_source (/usr/include/GL/glxext.h:179)
+# EXT_visual_rating (/usr/include/GL/glxext.h:182)
+# EXT_import_context (/usr/include/GL/glxext.h:189)
+# SGIX_fbconfig (/usr/include/GL/glxext.h:195)
+# SGIX_pbuffer (/usr/include/GL/glxext.h:209)
+# SGI_cushion (/usr/include/GL/glxext.h:237)
+# SGIX_video_resize (/usr/include/GL/glxext.h:240)
+# SGIX_dmbuffer (/usr/include/GL/glxext.h:245)
+# SGIX_swap_group (/usr/include/GL/glxext.h:249)
+# SGIX_swap_barrier (/usr/include/GL/glxext.h:252)
+# SGIS_blended_overlay (/usr/include/GL/glxext.h:255)
+# SGIS_shared_multisample (/usr/include/GL/glxext.h:259)
+# SUN_get_transparent_index (/usr/include/GL/glxext.h:264)
+# 3DFX_multisample (/usr/include/GL/glxext.h:267)
+# MESA_copy_sub_buffer (/usr/include/GL/glxext.h:272)
+# MESA_pixmap_colormap (/usr/include/GL/glxext.h:275)
+# MESA_release_buffers (/usr/include/GL/glxext.h:278)
+# MESA_set_3dfx_mode (/usr/include/GL/glxext.h:281)
+# SGIX_visual_select_group (/usr/include/GL/glxext.h:286)
+# OML_swap_method (/usr/include/GL/glxext.h:290)
+# OML_sync_control (/usr/include/GL/glxext.h:297)
+# NV_float_buffer (/usr/include/GL/glxext.h:300)
+# SGIX_hyperpipe (/usr/include/GL/glxext.h:304)
+# MESA_agp_offset (/usr/include/GL/glxext.h:317)
+# EXT_fbconfig_packed_float (/usr/include/GL/glxext.h:320)
+# EXT_framebuffer_sRGB (/usr/include/GL/glxext.h:325)
+# EXT_texture_from_pixmap (/usr/include/GL/glxext.h:329)
+# NV_present_video (/usr/include/GL/glxext.h:365)
+# NV_video_out (/usr/include/GL/glxext.h:369)
+# NV_swap_group (/usr/include/GL/glxext.h:382)
+# NV_video_capture (/usr/include/GL/glxext.h:385)
+# EXT_swap_control (/usr/include/GL/glxext.h:391)
+# NV_copy_image (/usr/include/GL/glxext.h:396)
+# ARB_get_proc_address (/usr/include/GL/glxext.h:402)
+# SGIX_video_source (/usr/include/GL/glxext.h:406)
+# SGIX_fbconfig (/usr/include/GL/glxext.h:410)
+# SGIX_pbuffer (/usr/include/GL/glxext.h:415)
+# NV_video_output (/usr/include/GL/glxext.h:432)
+# NV_video_capture (/usr/include/GL/glxext.h:436)
+# VERSION_1_3 (/usr/include/GL/glxext.h:477)
+# VERSION_1_4 (/usr/include/GL/glxext.h:519)
+# ARB_get_proc_address (/usr/include/GL/glxext.h:527)
+# ARB_multisample (/usr/include/GL/glxext.h:535)
+# ARB_fbconfig_float (/usr/include/GL/glxext.h:539)
+# ARB_create_context (/usr/include/GL/glxext.h:543)
+# ARB_create_context_profile (/usr/include/GL/glxext.h:551)
+# SGIS_multisample (/usr/include/GL/glxext.h:555)
+# EXT_visual_info (/usr/include/GL/glxext.h:559)
+# SGI_swap_control (/usr/include/GL/glxext.h:563)
+# SGI_video_sync (/usr/include/GL/glxext.h:571)
+# SGI_make_current_read (/usr/include/GL/glxext.h:581)
+# SGIX_video_source (/usr/include/GL/glxext.h:591)
+# EXT_visual_rating (/usr/include/GL/glxext.h:603)
+# EXT_import_context (/usr/include/GL/glxext.h:607)
+# SGIX_fbconfig (/usr/include/GL/glxext.h:623)
+# SGIX_pbuffer (/usr/include/GL/glxext.h:641)
+# SGI_cushion (/usr/include/GL/glxext.h:657)
+# SGIX_video_resize (/usr/include/GL/glxext.h:665)
+# SGIX_dmbuffer (/usr/include/GL/glxext.h:681)
+# SGIX_swap_group (/usr/include/GL/glxext.h:691)
+# SGIX_swap_barrier (/usr/include/GL/glxext.h:699)
+# SUN_get_transparent_index (/usr/include/GL/glxext.h:709)
+# MESA_copy_sub_buffer (/usr/include/GL/glxext.h:717)
+# MESA_pixmap_colormap (/usr/include/GL/glxext.h:725)
+# MESA_release_buffers (/usr/include/GL/glxext.h:733)
+# MESA_set_3dfx_mode (/usr/include/GL/glxext.h:741)
+# SGIX_visual_select_group (/usr/include/GL/glxext.h:749)
+# OML_swap_method (/usr/include/GL/glxext.h:753)
+# OML_sync_control (/usr/include/GL/glxext.h:757)
+# NV_float_buffer (/usr/include/GL/glxext.h:773)
+# SGIX_hyperpipe (/usr/include/GL/glxext.h:777)
+# MESA_agp_offset (/usr/include/GL/glxext.h:824)
+# EXT_fbconfig_packed_float (/usr/include/GL/glxext.h:832)
+# EXT_framebuffer_sRGB (/usr/include/GL/glxext.h:836)
+# EXT_texture_from_pixmap (/usr/include/GL/glxext.h:840)
+# NV_present_video (/usr/include/GL/glxext.h:850)
+# NV_video_output (/usr/include/GL/glxext.h:860)
+# NV_swap_group (/usr/include/GL/glxext.h:878)
+# NV_video_capture (/usr/include/GL/glxext.h:896)
+# EXT_swap_control (/usr/include/GL/glxext.h:912)
+# NV_copy_image (/usr/include/GL/glxext.h:920)
+# NV_vertex_array_range (/usr/include/GL/glx.h:349)
+GLsizei = c_int # /usr/include/GL/gl.h:163
+GLfloat = c_float # /usr/include/GL/gl.h:164
+# /usr/include/GL/glx.h:352
+glXAllocateMemoryNV = _link_function('glXAllocateMemoryNV', POINTER(c_void), [GLsizei, GLfloat, GLfloat, GLfloat], 'NV_vertex_array_range')
+
+GLvoid = None # /usr/include/GL/gl.h:156
+# /usr/include/GL/glx.h:353
+glXFreeMemoryNV = _link_function('glXFreeMemoryNV', None, [POINTER(GLvoid)], 'NV_vertex_array_range')
+
+PFNGLXALLOCATEMEMORYNVPROC = CFUNCTYPE(POINTER(c_void), GLsizei, GLfloat, GLfloat, GLfloat) # /usr/include/GL/glx.h:354
+PFNGLXFREEMEMORYNVPROC = CFUNCTYPE(None, POINTER(GLvoid)) # /usr/include/GL/glx.h:355
+# MESA_allocate_memory (/usr/include/GL/glx.h:363)
+GLX_MESA_allocate_memory = 1 # /usr/include/GL/glx.h:364
+# /usr/include/GL/glx.h:366
+glXAllocateMemoryMESA = _link_function('glXAllocateMemoryMESA', POINTER(c_void), [POINTER(Display), c_int, c_size_t, c_float, c_float, c_float], 'MESA_allocate_memory')
+
+# /usr/include/GL/glx.h:367
+glXFreeMemoryMESA = _link_function('glXFreeMemoryMESA', None, [POINTER(Display), c_int, POINTER(None)], 'MESA_allocate_memory')
+
+GLuint = c_uint # /usr/include/GL/gl.h:162
+# /usr/include/GL/glx.h:368
+glXGetMemoryOffsetMESA = _link_function('glXGetMemoryOffsetMESA', GLuint, [POINTER(Display), c_int, POINTER(None)], 'MESA_allocate_memory')
+
+PFNGLXALLOCATEMEMORYMESAPROC = CFUNCTYPE(POINTER(c_void), POINTER(Display), c_int, c_size_t, c_float, c_float, c_float) # /usr/include/GL/glx.h:369
+PFNGLXFREEMEMORYMESAPROC = CFUNCTYPE(None, POINTER(Display), c_int, POINTER(None)) # /usr/include/GL/glx.h:370
+PFNGLXGETMEMORYOFFSETMESAPROC = CFUNCTYPE(GLuint, POINTER(Display), c_int, POINTER(None)) # /usr/include/GL/glx.h:371
+# ARB_render_texture (/usr/include/GL/glx.h:380)
+GLX_ARB_render_texture = 1 # /usr/include/GL/glx.h:381
+# /usr/include/GL/glx.h:383
+glXBindTexImageARB = _link_function('glXBindTexImageARB', c_int, [POINTER(Display), GLXPbuffer, c_int], 'ARB_render_texture')
+
+# /usr/include/GL/glx.h:384
+glXReleaseTexImageARB = _link_function('glXReleaseTexImageARB', c_int, [POINTER(Display), GLXPbuffer, c_int], 'ARB_render_texture')
+
+# /usr/include/GL/glx.h:385
+glXDrawableAttribARB = _link_function('glXDrawableAttribARB', c_int, [POINTER(Display), GLXDrawable, POINTER(c_int)], 'ARB_render_texture')
+
+# NV_float_buffer (/usr/include/GL/glx.h:393)
+# MESA_swap_frame_usage (/usr/include/GL/glx.h:405)
+GLX_MESA_swap_frame_usage = 1 # /usr/include/GL/glx.h:406
+# /usr/include/GL/glx.h:408
+glXGetFrameUsageMESA = _link_function('glXGetFrameUsageMESA', c_int, [POINTER(Display), GLXDrawable, POINTER(c_float)], 'MESA_swap_frame_usage')
+
+# /usr/include/GL/glx.h:409
+glXBeginFrameTrackingMESA = _link_function('glXBeginFrameTrackingMESA', c_int, [POINTER(Display), GLXDrawable], 'MESA_swap_frame_usage')
+
+# /usr/include/GL/glx.h:410
+glXEndFrameTrackingMESA = _link_function('glXEndFrameTrackingMESA', c_int, [POINTER(Display), GLXDrawable], 'MESA_swap_frame_usage')
+
+# /usr/include/GL/glx.h:411
+glXQueryFrameTrackingMESA = _link_function('glXQueryFrameTrackingMESA', c_int, [POINTER(Display), GLXDrawable, POINTER(c_int64), POINTER(c_int64), POINTER(c_float)], 'MESA_swap_frame_usage')
+
+PFNGLXGETFRAMEUSAGEMESAPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(c_float)) # /usr/include/GL/glx.h:413
+PFNGLXBEGINFRAMETRACKINGMESAPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable) # /usr/include/GL/glx.h:414
+PFNGLXENDFRAMETRACKINGMESAPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable) # /usr/include/GL/glx.h:415
+PFNGLXQUERYFRAMETRACKINGMESAPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(c_int64), POINTER(c_int64), POINTER(c_float)) # /usr/include/GL/glx.h:416
+# MESA_swap_control (/usr/include/GL/glx.h:425)
+GLX_MESA_swap_control = 1 # /usr/include/GL/glx.h:426
+# /usr/include/GL/glx.h:428
+glXSwapIntervalMESA = _link_function('glXSwapIntervalMESA', c_int, [c_uint], 'MESA_swap_control')
+
+# /usr/include/GL/glx.h:429
+glXGetSwapIntervalMESA = _link_function('glXGetSwapIntervalMESA', c_int, [], 'MESA_swap_control')
+
+PFNGLXSWAPINTERVALMESAPROC = CFUNCTYPE(c_int, c_uint) # /usr/include/GL/glx.h:431
+PFNGLXGETSWAPINTERVALMESAPROC = CFUNCTYPE(c_int) # /usr/include/GL/glx.h:432
+# EXT_texture_from_pixmap (/usr/include/GL/glx.h:442)
+class struct_anon_111(Structure):
+ __slots__ = [
+ 'event_type',
+ 'draw_type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'drawable',
+ 'buffer_mask',
+ 'aux_buffer',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'count',
+ ]
+struct_anon_111._fields_ = [
+ ('event_type', c_int),
+ ('draw_type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('drawable', GLXDrawable),
+ ('buffer_mask', c_uint),
+ ('aux_buffer', c_uint),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('count', c_int),
+]
+
+GLXPbufferClobberEvent = struct_anon_111 # /usr/include/GL/glx.h:508
+class struct___GLXEvent(Union):
+ __slots__ = [
+ 'glxpbufferclobber',
+ 'pad',
+ ]
+struct___GLXEvent._fields_ = [
+ ('glxpbufferclobber', GLXPbufferClobberEvent),
+ ('pad', c_long * 24),
+]
+
+GLXEvent = struct___GLXEvent # /usr/include/GL/glx.h:513
+
+__all__ = ['GLX_VERSION_1_1', 'GLX_VERSION_1_2', 'GLX_VERSION_1_3',
+'GLX_VERSION_1_4', 'GLX_USE_GL', 'GLX_BUFFER_SIZE', 'GLX_LEVEL', 'GLX_RGBA',
+'GLX_DOUBLEBUFFER', 'GLX_STEREO', 'GLX_AUX_BUFFERS', 'GLX_RED_SIZE',
+'GLX_GREEN_SIZE', 'GLX_BLUE_SIZE', 'GLX_ALPHA_SIZE', 'GLX_DEPTH_SIZE',
+'GLX_STENCIL_SIZE', 'GLX_ACCUM_RED_SIZE', 'GLX_ACCUM_GREEN_SIZE',
+'GLX_ACCUM_BLUE_SIZE', 'GLX_ACCUM_ALPHA_SIZE', 'GLX_BAD_SCREEN',
+'GLX_BAD_ATTRIBUTE', 'GLX_NO_EXTENSION', 'GLX_BAD_VISUAL', 'GLX_BAD_CONTEXT',
+'GLX_BAD_VALUE', 'GLX_BAD_ENUM', 'GLX_VENDOR', 'GLX_VERSION',
+'GLX_EXTENSIONS', 'GLX_CONFIG_CAVEAT', 'GLX_DONT_CARE', 'GLX_X_VISUAL_TYPE',
+'GLX_TRANSPARENT_TYPE', 'GLX_TRANSPARENT_INDEX_VALUE',
+'GLX_TRANSPARENT_RED_VALUE', 'GLX_TRANSPARENT_GREEN_VALUE',
+'GLX_TRANSPARENT_BLUE_VALUE', 'GLX_TRANSPARENT_ALPHA_VALUE', 'GLX_WINDOW_BIT',
+'GLX_PIXMAP_BIT', 'GLX_PBUFFER_BIT', 'GLX_AUX_BUFFERS_BIT',
+'GLX_FRONT_LEFT_BUFFER_BIT', 'GLX_FRONT_RIGHT_BUFFER_BIT',
+'GLX_BACK_LEFT_BUFFER_BIT', 'GLX_BACK_RIGHT_BUFFER_BIT',
+'GLX_DEPTH_BUFFER_BIT', 'GLX_STENCIL_BUFFER_BIT', 'GLX_ACCUM_BUFFER_BIT',
+'GLX_NONE', 'GLX_SLOW_CONFIG', 'GLX_TRUE_COLOR', 'GLX_DIRECT_COLOR',
+'GLX_PSEUDO_COLOR', 'GLX_STATIC_COLOR', 'GLX_GRAY_SCALE', 'GLX_STATIC_GRAY',
+'GLX_TRANSPARENT_RGB', 'GLX_TRANSPARENT_INDEX', 'GLX_VISUAL_ID', 'GLX_SCREEN',
+'GLX_NON_CONFORMANT_CONFIG', 'GLX_DRAWABLE_TYPE', 'GLX_RENDER_TYPE',
+'GLX_X_RENDERABLE', 'GLX_FBCONFIG_ID', 'GLX_RGBA_TYPE',
+'GLX_COLOR_INDEX_TYPE', 'GLX_MAX_PBUFFER_WIDTH', 'GLX_MAX_PBUFFER_HEIGHT',
+'GLX_MAX_PBUFFER_PIXELS', 'GLX_PRESERVED_CONTENTS', 'GLX_LARGEST_PBUFFER',
+'GLX_WIDTH', 'GLX_HEIGHT', 'GLX_EVENT_MASK', 'GLX_DAMAGED', 'GLX_SAVED',
+'GLX_WINDOW', 'GLX_PBUFFER', 'GLX_PBUFFER_HEIGHT', 'GLX_PBUFFER_WIDTH',
+'GLX_RGBA_BIT', 'GLX_COLOR_INDEX_BIT', 'GLX_PBUFFER_CLOBBER_MASK',
+'GLX_SAMPLE_BUFFERS', 'GLX_SAMPLES', 'GLXContext', 'GLXPixmap', 'GLXDrawable',
+'GLXFBConfig', 'GLXFBConfigID', 'GLXContextID', 'GLXWindow', 'GLXPbuffer',
+'glXChooseVisual', 'glXCreateContext', 'glXDestroyContext', 'glXMakeCurrent',
+'glXCopyContext', 'glXSwapBuffers', 'glXCreateGLXPixmap',
+'glXDestroyGLXPixmap', 'glXQueryExtension', 'glXQueryVersion', 'glXIsDirect',
+'glXGetConfig', 'glXGetCurrentContext', 'glXGetCurrentDrawable', 'glXWaitGL',
+'glXWaitX', 'glXUseXFont', 'glXQueryExtensionsString', 'glXQueryServerString',
+'glXGetClientString', 'glXGetCurrentDisplay', 'glXChooseFBConfig',
+'glXGetFBConfigAttrib', 'glXGetFBConfigs', 'glXGetVisualFromFBConfig',
+'glXCreateWindow', 'glXDestroyWindow', 'glXCreatePixmap', 'glXDestroyPixmap',
+'glXCreatePbuffer', 'glXDestroyPbuffer', 'glXQueryDrawable',
+'glXCreateNewContext', 'glXMakeContextCurrent', 'glXGetCurrentReadDrawable',
+'glXQueryContext', 'glXSelectEvent', 'glXGetSelectedEvent',
+'PFNGLXGETFBCONFIGSPROC', 'PFNGLXCHOOSEFBCONFIGPROC',
+'PFNGLXGETFBCONFIGATTRIBPROC', 'PFNGLXGETVISUALFROMFBCONFIGPROC',
+'PFNGLXCREATEWINDOWPROC', 'PFNGLXDESTROYWINDOWPROC', 'PFNGLXCREATEPIXMAPPROC',
+'PFNGLXDESTROYPIXMAPPROC', 'PFNGLXCREATEPBUFFERPROC',
+'PFNGLXDESTROYPBUFFERPROC', 'PFNGLXQUERYDRAWABLEPROC',
+'PFNGLXCREATENEWCONTEXTPROC', 'PFNGLXMAKECONTEXTCURRENTPROC',
+'PFNGLXGETCURRENTREADDRAWABLEPROC', 'PFNGLXGETCURRENTDISPLAYPROC',
+'PFNGLXQUERYCONTEXTPROC', 'PFNGLXSELECTEVENTPROC',
+'PFNGLXGETSELECTEDEVENTPROC', 'GLX_ARB_get_proc_address', '__GLXextFuncPtr',
+'glXGetProcAddressARB', 'glXGetProcAddress', 'PFNGLXGETPROCADDRESSPROC',
+'glXAllocateMemoryNV', 'glXFreeMemoryNV', 'PFNGLXALLOCATEMEMORYNVPROC',
+'PFNGLXFREEMEMORYNVPROC', 'GLX_MESA_allocate_memory', 'glXAllocateMemoryMESA',
+'glXFreeMemoryMESA', 'glXGetMemoryOffsetMESA', 'PFNGLXALLOCATEMEMORYMESAPROC',
+'PFNGLXFREEMEMORYMESAPROC', 'PFNGLXGETMEMORYOFFSETMESAPROC',
+'GLX_ARB_render_texture', 'glXBindTexImageARB', 'glXReleaseTexImageARB',
+'glXDrawableAttribARB', 'GLX_MESA_swap_frame_usage', 'glXGetFrameUsageMESA',
+'glXBeginFrameTrackingMESA', 'glXEndFrameTrackingMESA',
+'glXQueryFrameTrackingMESA', 'PFNGLXGETFRAMEUSAGEMESAPROC',
+'PFNGLXBEGINFRAMETRACKINGMESAPROC', 'PFNGLXENDFRAMETRACKINGMESAPROC',
+'PFNGLXQUERYFRAMETRACKINGMESAPROC', 'GLX_MESA_swap_control',
+'glXSwapIntervalMESA', 'glXGetSwapIntervalMESA', 'PFNGLXSWAPINTERVALMESAPROC',
+'PFNGLXGETSWAPINTERVALMESAPROC', 'GLXPbufferClobberEvent', 'GLXEvent']
+# END GENERATED CONTENT (do not edit above this line)
+
+# From glxproto.h
+GLXBadContext = 0
+GLXBadContextState = 1
+GLXBadDrawable = 2
+GLXBadPixmap = 3
+GLXBadContextTag = 4
+GLXBadCurrentWindow = 5
+GLXBadRenderRequest = 6
+GLXBadLargeRequest = 7
+GLXUnsupportedPrivateRequest = 8
+GLXBadFBConfig = 9
+GLXBadPbuffer = 10
+GLXBadCurrentDrawable = 11
+GLXBadWindow = 12
+
+__all__ += ['GLXBadContext', 'GLXBadContextState', 'GLXBadDrawable',
+'GLXBadPixmap', 'GLXBadContextTag', 'GLXBadCurrentWindow',
+'GLXBadRenderRequest', 'GLXBadLargeRequest', 'GLXUnsupportedPrivateRequest',
+'GLXBadFBConfig', 'GLXBadPbuffer', 'GLXBadCurrentDrawable', 'GLXBadWindow']
+
+
+
+
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glx_info.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glx_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..7842493818d893d0b5293094697bceeb91b03f89
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glx_info.py
@@ -0,0 +1,113 @@
+"""Information about version and extensions of current GLX implementation.
+
+Usage::
+
+ from pyglet.gl import glx_info
+
+ if glx_info.have_extension('GLX_NV_float_buffer'):
+ # ...
+
+Or, if using more than one display::
+
+ from pyglet.gl.glx_info import GLXInfo
+
+ info = GLXInfo(window._display)
+ if info.get_server_vendor() == 'ATI':
+ # ...
+
+"""
+
+from ctypes import *
+
+from pyglet.gl.glx import *
+from pyglet.util import asstr
+
+
+class GLXInfoException(Exception):
+ pass
+
+
+class GLXInfo:
+ def __init__(self, display=None):
+ # Set default display if not set
+ if display and not _glx_info.display:
+ _glx_info.set_display(display)
+
+ self.display = display
+
+ def set_display(self, display):
+ self.display = display
+
+ def check_display(self):
+ if not self.display:
+ raise GLXInfoException('No X11 display has been set yet.')
+
+ def have_version(self, major, minor=0):
+ self.check_display()
+ if not glXQueryExtension(self.display, None, None):
+ raise GLXInfoException('pyglet requires an X server with GLX')
+
+ server_version = self.get_server_version().split()[0]
+ client_version = self.get_client_version().split()[0]
+
+ server = [int(i) for i in server_version.split('.')]
+ client = [int(i) for i in client_version.split('.')]
+ return (tuple(server) >= (major, minor) and
+ tuple(client) >= (major, minor))
+
+ def get_server_vendor(self):
+ self.check_display()
+ return asstr(glXQueryServerString(self.display, 0, GLX_VENDOR))
+
+ def get_server_version(self):
+ # glXQueryServerString was introduced in GLX 1.1, so we need to use the
+ # 1.0 function here which queries the server implementation for its
+ # version.
+ self.check_display()
+ major = c_int()
+ minor = c_int()
+ if not glXQueryVersion(self.display, byref(major), byref(minor)):
+ raise GLXInfoException('Could not determine GLX server version')
+ return f'{major.value}.{minor.value}'
+
+ def get_server_extensions(self):
+ self.check_display()
+ return asstr(glXQueryServerString(self.display, 0, GLX_EXTENSIONS)).split()
+
+ def get_client_vendor(self):
+ self.check_display()
+ return asstr(glXGetClientString(self.display, GLX_VENDOR))
+
+ def get_client_version(self):
+ self.check_display()
+ return asstr(glXGetClientString(self.display, GLX_VERSION))
+
+ def get_client_extensions(self):
+ self.check_display()
+ return asstr(glXGetClientString(self.display, GLX_EXTENSIONS)).split()
+
+ def get_extensions(self):
+ self.check_display()
+ return asstr(glXQueryExtensionsString(self.display, 0)).split()
+
+ def have_extension(self, extension):
+ self.check_display()
+ if not self.have_version(1, 1):
+ return False
+ return extension in self.get_extensions()
+
+
+# Single instance suitable for apps that use only a single display.
+_glx_info = GLXInfo()
+
+set_display = _glx_info.set_display
+check_display = _glx_info.check_display
+have_version = _glx_info.have_version
+get_server_vendor = _glx_info.get_server_vendor
+get_server_version = _glx_info.get_server_version
+get_server_extensions = _glx_info.get_server_extensions
+get_client_vendor = _glx_info.get_client_vendor
+get_client_version = _glx_info.get_client_version
+get_client_extensions = _glx_info.get_client_extensions
+get_extensions = _glx_info.get_extensions
+have_extension = _glx_info.have_extension
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glxext_arb.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glxext_arb.py
new file mode 100644
index 0000000000000000000000000000000000000000..11763a61b7eb6de2cd9819f7bd8b31e625cc0676
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glxext_arb.py
@@ -0,0 +1,954 @@
+"""Wrapper for http://oss.sgi.com/projects/ogl-sample/ABI/glxext.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+"""
+
+import ctypes
+from ctypes import *
+from pyglet.gl.lib import link_GLX as _link_function
+
+
+if not hasattr(ctypes, 'c_int64'):
+ # XXX TODO completely wrong, but at least can import.
+ # Can c_longlong still be used?
+ c_int64 = c_long
+ c_uint64 = c_ulong
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for http://www.opengl.org/registry/api/glxext.h
+
+import pyglet.libs.x11.xlib
+import pyglet.gl.glx
+
+# H (/usr/include/GL/glx.h:26)
+# ARB_get_proc_address (/usr/include/GL/glx.h:317)
+# GLXEXT_LEGACY (/usr/include/GL/glx.h:334)
+GLX_GLXEXT_VERSION = 32 # GL/glxext.h:53
+# VERSION_1_3 (GL/glxext.h:55)
+# VERSION_1_4 (GL/glxext.h:114)
+# ARB_get_proc_address (GL/glxext.h:119)
+# ARB_multisample (GL/glxext.h:122)
+GLX_SAMPLE_BUFFERS_ARB = 100000 # GL/glxext.h:123
+GLX_SAMPLES_ARB = 100001 # GL/glxext.h:124
+# ARB_vertex_buffer_object (GL/glxext.h:127)
+GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB = 8341 # GL/glxext.h:128
+# ARB_fbconfig_float (GL/glxext.h:131)
+GLX_RGBA_FLOAT_TYPE_ARB = 8377 # GL/glxext.h:132
+GLX_RGBA_FLOAT_BIT_ARB = 4 # GL/glxext.h:133
+# ARB_framebuffer_sRGB (GL/glxext.h:136)
+GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB = 8370 # GL/glxext.h:137
+# ARB_create_context (GL/glxext.h:140)
+GLX_CONTEXT_DEBUG_BIT_ARB = 1 # GL/glxext.h:141
+GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 2 # GL/glxext.h:142
+GLX_CONTEXT_MAJOR_VERSION_ARB = 8337 # GL/glxext.h:143
+GLX_CONTEXT_MINOR_VERSION_ARB = 8338 # GL/glxext.h:144
+GLX_CONTEXT_FLAGS_ARB = 8340 # GL/glxext.h:145
+# ARB_create_context_profile (GL/glxext.h:148)
+GLX_CONTEXT_CORE_PROFILE_BIT_ARB = 1 # GL/glxext.h:149
+GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB = 2 # GL/glxext.h:150
+GLX_CONTEXT_PROFILE_MASK_ARB = 37158 # GL/glxext.h:151
+# ARB_create_context_robustness (GL/glxext.h:154)
+GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB = 4 # GL/glxext.h:155
+GLX_LOSE_CONTEXT_ON_RESET_ARB = 33362 # GL/glxext.h:156
+GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB = 33366 # GL/glxext.h:157
+GLX_NO_RESET_NOTIFICATION_ARB = 33377 # GL/glxext.h:158
+# SGIS_multisample (GL/glxext.h:161)
+GLX_SAMPLE_BUFFERS_SGIS = 100000 # GL/glxext.h:162
+GLX_SAMPLES_SGIS = 100001 # GL/glxext.h:163
+# EXT_visual_info (GL/glxext.h:166)
+GLX_X_VISUAL_TYPE_EXT = 34 # GL/glxext.h:167
+GLX_TRANSPARENT_TYPE_EXT = 35 # GL/glxext.h:168
+GLX_TRANSPARENT_INDEX_VALUE_EXT = 36 # GL/glxext.h:169
+GLX_TRANSPARENT_RED_VALUE_EXT = 37 # GL/glxext.h:170
+GLX_TRANSPARENT_GREEN_VALUE_EXT = 38 # GL/glxext.h:171
+GLX_TRANSPARENT_BLUE_VALUE_EXT = 39 # GL/glxext.h:172
+GLX_TRANSPARENT_ALPHA_VALUE_EXT = 40 # GL/glxext.h:173
+GLX_NONE_EXT = 32768 # GL/glxext.h:174
+GLX_TRUE_COLOR_EXT = 32770 # GL/glxext.h:175
+GLX_DIRECT_COLOR_EXT = 32771 # GL/glxext.h:176
+GLX_PSEUDO_COLOR_EXT = 32772 # GL/glxext.h:177
+GLX_STATIC_COLOR_EXT = 32773 # GL/glxext.h:178
+GLX_GRAY_SCALE_EXT = 32774 # GL/glxext.h:179
+GLX_STATIC_GRAY_EXT = 32775 # GL/glxext.h:180
+GLX_TRANSPARENT_RGB_EXT = 32776 # GL/glxext.h:181
+GLX_TRANSPARENT_INDEX_EXT = 32777 # GL/glxext.h:182
+# SGI_swap_control (GL/glxext.h:185)
+# SGI_video_sync (GL/glxext.h:188)
+# SGI_make_current_read (GL/glxext.h:191)
+# SGIX_video_source (GL/glxext.h:194)
+# EXT_visual_rating (GL/glxext.h:197)
+GLX_VISUAL_CAVEAT_EXT = 32 # GL/glxext.h:198
+GLX_SLOW_VISUAL_EXT = 32769 # GL/glxext.h:199
+GLX_NON_CONFORMANT_VISUAL_EXT = 32781 # GL/glxext.h:200
+# EXT_import_context (GL/glxext.h:204)
+GLX_SHARE_CONTEXT_EXT = 32778 # GL/glxext.h:205
+GLX_VISUAL_ID_EXT = 32779 # GL/glxext.h:206
+GLX_SCREEN_EXT = 32780 # GL/glxext.h:207
+# SGIX_fbconfig (GL/glxext.h:210)
+GLX_WINDOW_BIT_SGIX = 1 # GL/glxext.h:211
+GLX_PIXMAP_BIT_SGIX = 2 # GL/glxext.h:212
+GLX_RGBA_BIT_SGIX = 1 # GL/glxext.h:213
+GLX_COLOR_INDEX_BIT_SGIX = 2 # GL/glxext.h:214
+GLX_DRAWABLE_TYPE_SGIX = 32784 # GL/glxext.h:215
+GLX_RENDER_TYPE_SGIX = 32785 # GL/glxext.h:216
+GLX_X_RENDERABLE_SGIX = 32786 # GL/glxext.h:217
+GLX_FBCONFIG_ID_SGIX = 32787 # GL/glxext.h:218
+GLX_RGBA_TYPE_SGIX = 32788 # GL/glxext.h:219
+GLX_COLOR_INDEX_TYPE_SGIX = 32789 # GL/glxext.h:220
+# SGIX_pbuffer (GL/glxext.h:224)
+GLX_PBUFFER_BIT_SGIX = 4 # GL/glxext.h:225
+GLX_BUFFER_CLOBBER_MASK_SGIX = 134217728 # GL/glxext.h:226
+GLX_FRONT_LEFT_BUFFER_BIT_SGIX = 1 # GL/glxext.h:227
+GLX_FRONT_RIGHT_BUFFER_BIT_SGIX = 2 # GL/glxext.h:228
+GLX_BACK_LEFT_BUFFER_BIT_SGIX = 4 # GL/glxext.h:229
+GLX_BACK_RIGHT_BUFFER_BIT_SGIX = 8 # GL/glxext.h:230
+GLX_AUX_BUFFERS_BIT_SGIX = 16 # GL/glxext.h:231
+GLX_DEPTH_BUFFER_BIT_SGIX = 32 # GL/glxext.h:232
+GLX_STENCIL_BUFFER_BIT_SGIX = 64 # GL/glxext.h:233
+GLX_ACCUM_BUFFER_BIT_SGIX = 128 # GL/glxext.h:234
+GLX_SAMPLE_BUFFERS_BIT_SGIX = 256 # GL/glxext.h:235
+GLX_MAX_PBUFFER_WIDTH_SGIX = 32790 # GL/glxext.h:236
+GLX_MAX_PBUFFER_HEIGHT_SGIX = 32791 # GL/glxext.h:237
+GLX_MAX_PBUFFER_PIXELS_SGIX = 32792 # GL/glxext.h:238
+GLX_OPTIMAL_PBUFFER_WIDTH_SGIX = 32793 # GL/glxext.h:239
+GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX = 32794 # GL/glxext.h:240
+GLX_PRESERVED_CONTENTS_SGIX = 32795 # GL/glxext.h:241
+GLX_LARGEST_PBUFFER_SGIX = 32796 # GL/glxext.h:242
+GLX_WIDTH_SGIX = 32797 # GL/glxext.h:243
+GLX_HEIGHT_SGIX = 32798 # GL/glxext.h:244
+GLX_EVENT_MASK_SGIX = 32799 # GL/glxext.h:245
+GLX_DAMAGED_SGIX = 32800 # GL/glxext.h:246
+GLX_SAVED_SGIX = 32801 # GL/glxext.h:247
+GLX_WINDOW_SGIX = 32802 # GL/glxext.h:248
+GLX_PBUFFER_SGIX = 32803 # GL/glxext.h:249
+# SGI_cushion (GL/glxext.h:252)
+# SGIX_video_resize (GL/glxext.h:255)
+GLX_SYNC_FRAME_SGIX = 0 # GL/glxext.h:256
+GLX_SYNC_SWAP_SGIX = 1 # GL/glxext.h:257
+# SGIX_dmbuffer (GL/glxext.h:260)
+GLX_DIGITAL_MEDIA_PBUFFER_SGIX = 32804 # GL/glxext.h:261
+# SGIX_swap_group (GL/glxext.h:264)
+# SGIX_swap_barrier (GL/glxext.h:267)
+# SGIS_blended_overlay (GL/glxext.h:270)
+GLX_BLENDED_RGBA_SGIS = 32805 # GL/glxext.h:271
+# SGIS_shared_multisample (GL/glxext.h:274)
+GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS = 32806 # GL/glxext.h:275
+GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS = 32807 # GL/glxext.h:276
+# SUN_get_transparent_index (GL/glxext.h:279)
+# 3DFX_multisample (GL/glxext.h:282)
+GLX_SAMPLE_BUFFERS_3DFX = 32848 # GL/glxext.h:283
+GLX_SAMPLES_3DFX = 32849 # GL/glxext.h:284
+# MESA_copy_sub_buffer (GL/glxext.h:287)
+# MESA_pixmap_colormap (GL/glxext.h:290)
+# MESA_release_buffers (GL/glxext.h:293)
+# MESA_set_3dfx_mode (GL/glxext.h:296)
+GLX_3DFX_WINDOW_MODE_MESA = 1 # GL/glxext.h:297
+GLX_3DFX_FULLSCREEN_MODE_MESA = 2 # GL/glxext.h:298
+# SGIX_visual_select_group (GL/glxext.h:301)
+GLX_VISUAL_SELECT_GROUP_SGIX = 32808 # GL/glxext.h:302
+# OML_swap_method (GL/glxext.h:305)
+GLX_SWAP_METHOD_OML = 32864 # GL/glxext.h:306
+GLX_SWAP_EXCHANGE_OML = 32865 # GL/glxext.h:307
+GLX_SWAP_COPY_OML = 32866 # GL/glxext.h:308
+GLX_SWAP_UNDEFINED_OML = 32867 # GL/glxext.h:309
+# OML_sync_control (GL/glxext.h:312)
+# NV_float_buffer (GL/glxext.h:315)
+GLX_FLOAT_COMPONENTS_NV = 8368 # GL/glxext.h:316
+# SGIX_hyperpipe (GL/glxext.h:319)
+GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX = 80 # GL/glxext.h:320
+GLX_BAD_HYPERPIPE_CONFIG_SGIX = 91 # GL/glxext.h:321
+GLX_BAD_HYPERPIPE_SGIX = 92 # GL/glxext.h:322
+GLX_HYPERPIPE_DISPLAY_PIPE_SGIX = 1 # GL/glxext.h:323
+GLX_HYPERPIPE_RENDER_PIPE_SGIX = 2 # GL/glxext.h:324
+GLX_PIPE_RECT_SGIX = 1 # GL/glxext.h:325
+GLX_PIPE_RECT_LIMITS_SGIX = 2 # GL/glxext.h:326
+GLX_HYPERPIPE_STEREO_SGIX = 3 # GL/glxext.h:327
+GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX = 4 # GL/glxext.h:328
+GLX_HYPERPIPE_ID_SGIX = 32816 # GL/glxext.h:329
+# MESA_agp_offset (GL/glxext.h:332)
+# EXT_fbconfig_packed_float (GL/glxext.h:335)
+GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT = 8369 # GL/glxext.h:336
+GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT = 8 # GL/glxext.h:337
+# EXT_framebuffer_sRGB (GL/glxext.h:340)
+GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT = 8370 # GL/glxext.h:341
+# EXT_texture_from_pixmap (GL/glxext.h:344)
+GLX_TEXTURE_1D_BIT_EXT = 1 # GL/glxext.h:345
+GLX_TEXTURE_2D_BIT_EXT = 2 # GL/glxext.h:346
+GLX_TEXTURE_RECTANGLE_BIT_EXT = 4 # GL/glxext.h:347
+GLX_BIND_TO_TEXTURE_RGB_EXT = 8400 # GL/glxext.h:348
+GLX_BIND_TO_TEXTURE_RGBA_EXT = 8401 # GL/glxext.h:349
+GLX_BIND_TO_MIPMAP_TEXTURE_EXT = 8402 # GL/glxext.h:350
+GLX_BIND_TO_TEXTURE_TARGETS_EXT = 8403 # GL/glxext.h:351
+GLX_Y_INVERTED_EXT = 8404 # GL/glxext.h:352
+GLX_TEXTURE_FORMAT_EXT = 8405 # GL/glxext.h:353
+GLX_TEXTURE_TARGET_EXT = 8406 # GL/glxext.h:354
+GLX_MIPMAP_TEXTURE_EXT = 8407 # GL/glxext.h:355
+GLX_TEXTURE_FORMAT_NONE_EXT = 8408 # GL/glxext.h:356
+GLX_TEXTURE_FORMAT_RGB_EXT = 8409 # GL/glxext.h:357
+GLX_TEXTURE_FORMAT_RGBA_EXT = 8410 # GL/glxext.h:358
+GLX_TEXTURE_1D_EXT = 8411 # GL/glxext.h:359
+GLX_TEXTURE_2D_EXT = 8412 # GL/glxext.h:360
+GLX_TEXTURE_RECTANGLE_EXT = 8413 # GL/glxext.h:361
+GLX_FRONT_LEFT_EXT = 8414 # GL/glxext.h:362
+GLX_FRONT_RIGHT_EXT = 8415 # GL/glxext.h:363
+GLX_BACK_LEFT_EXT = 8416 # GL/glxext.h:364
+GLX_BACK_RIGHT_EXT = 8417 # GL/glxext.h:365
+GLX_FRONT_EXT = 8414 # GL/glxext.h:366
+GLX_BACK_EXT = 8416 # GL/glxext.h:367
+GLX_AUX0_EXT = 8418 # GL/glxext.h:368
+GLX_AUX1_EXT = 8419 # GL/glxext.h:369
+GLX_AUX2_EXT = 8420 # GL/glxext.h:370
+GLX_AUX3_EXT = 8421 # GL/glxext.h:371
+GLX_AUX4_EXT = 8422 # GL/glxext.h:372
+GLX_AUX5_EXT = 8423 # GL/glxext.h:373
+GLX_AUX6_EXT = 8424 # GL/glxext.h:374
+GLX_AUX7_EXT = 8425 # GL/glxext.h:375
+GLX_AUX8_EXT = 8426 # GL/glxext.h:376
+GLX_AUX9_EXT = 8427 # GL/glxext.h:377
+# NV_present_video (GL/glxext.h:380)
+GLX_NUM_VIDEO_SLOTS_NV = 8432 # GL/glxext.h:381
+# NV_video_out (GL/glxext.h:384)
+GLX_VIDEO_OUT_COLOR_NV = 8387 # GL/glxext.h:385
+GLX_VIDEO_OUT_ALPHA_NV = 8388 # GL/glxext.h:386
+GLX_VIDEO_OUT_DEPTH_NV = 8389 # GL/glxext.h:387
+GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV = 8390 # GL/glxext.h:388
+GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV = 8391 # GL/glxext.h:389
+GLX_VIDEO_OUT_FRAME_NV = 8392 # GL/glxext.h:390
+GLX_VIDEO_OUT_FIELD_1_NV = 8393 # GL/glxext.h:391
+GLX_VIDEO_OUT_FIELD_2_NV = 8394 # GL/glxext.h:392
+GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV = 8395 # GL/glxext.h:393
+GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV = 8396 # GL/glxext.h:394
+# NV_swap_group (GL/glxext.h:397)
+# NV_video_capture (GL/glxext.h:400)
+GLX_DEVICE_ID_NV = 8397 # GL/glxext.h:401
+GLX_UNIQUE_ID_NV = 8398 # GL/glxext.h:402
+GLX_NUM_VIDEO_CAPTURE_SLOTS_NV = 8399 # GL/glxext.h:403
+# EXT_swap_control (GL/glxext.h:406)
+GLX_SWAP_INTERVAL_EXT = 8433 # GL/glxext.h:407
+GLX_MAX_SWAP_INTERVAL_EXT = 8434 # GL/glxext.h:408
+# NV_copy_image (GL/glxext.h:411)
+# INTEL_swap_event (GL/glxext.h:414)
+GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK = 67108864 # GL/glxext.h:415
+GLX_EXCHANGE_COMPLETE_INTEL = 33152 # GL/glxext.h:416
+GLX_COPY_COMPLETE_INTEL = 33153 # GL/glxext.h:417
+GLX_FLIP_COMPLETE_INTEL = 33154 # GL/glxext.h:418
+# NV_multisample_coverage (GL/glxext.h:421)
+GLX_COVERAGE_SAMPLES_NV = 100001 # GL/glxext.h:422
+GLX_COLOR_SAMPLES_NV = 8371 # GL/glxext.h:423
+# AMD_gpu_association (GL/glxext.h:426)
+GLX_GPU_VENDOR_AMD = 7936 # GL/glxext.h:427
+GLX_GPU_RENDERER_STRING_AMD = 7937 # GL/glxext.h:428
+GLX_GPU_OPENGL_VERSION_STRING_AMD = 7938 # GL/glxext.h:429
+GLX_GPU_FASTEST_TARGET_GPUS_AMD = 8610 # GL/glxext.h:430
+GLX_GPU_RAM_AMD = 8611 # GL/glxext.h:431
+GLX_GPU_CLOCK_AMD = 8612 # GL/glxext.h:432
+GLX_GPU_NUM_PIPES_AMD = 8613 # GL/glxext.h:433
+GLX_GPU_NUM_SIMD_AMD = 8614 # GL/glxext.h:434
+GLX_GPU_NUM_RB_AMD = 8615 # GL/glxext.h:435
+GLX_GPU_NUM_SPI_AMD = 8616 # GL/glxext.h:436
+# EXT_create_context_es2_profile (GL/glxext.h:439)
+GLX_CONTEXT_ES2_PROFILE_BIT_EXT = 4 # GL/glxext.h:440
+# ARB_get_proc_address (GL/glxext.h:446)
+# SGIX_video_source (GL/glxext.h:450)
+XID = pyglet.libs.x11.xlib.XID
+GLXVideoSourceSGIX = XID # GL/glxext.h:451
+# SGIX_fbconfig (GL/glxext.h:454)
+GLXFBConfigIDSGIX = XID # GL/glxext.h:455
+class struct___GLXFBConfigRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXFBConfigRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct___GLXFBConfigRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXFBConfigRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GLXFBConfigSGIX = POINTER(struct___GLXFBConfigRec) # GL/glxext.h:456
+# SGIX_pbuffer (GL/glxext.h:459)
+GLXPbufferSGIX = XID # GL/glxext.h:460
+class struct_anon_106(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'drawable',
+ 'event_type',
+ 'draw_type',
+ 'mask',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'count',
+ ]
+Display = pyglet.libs.x11.xlib.Display
+GLXDrawable = pyglet.gl.glx.GLXDrawable
+struct_anon_106._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('drawable', GLXDrawable),
+ ('event_type', c_int),
+ ('draw_type', c_int),
+ ('mask', c_uint),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('count', c_int),
+]
+
+GLXBufferClobberEventSGIX = struct_anon_106 # GL/glxext.h:473
+# NV_video_output (GL/glxext.h:476)
+GLXVideoDeviceNV = c_uint # GL/glxext.h:477
+# NV_video_capture (GL/glxext.h:480)
+GLXVideoCaptureDeviceNV = XID # GL/glxext.h:481
+# VERSION_1_3 (GL/glxext.h:521)
+# VERSION_1_4 (GL/glxext.h:563)
+# ARB_get_proc_address (GL/glxext.h:571)
+# ARB_multisample (GL/glxext.h:579)
+GLX_ARB_multisample = 1 # GL/glxext.h:580
+# ARB_fbconfig_float (GL/glxext.h:583)
+GLX_ARB_fbconfig_float = 1 # GL/glxext.h:584
+# ARB_framebuffer_sRGB (GL/glxext.h:587)
+GLX_ARB_framebuffer_sRGB = 1 # GL/glxext.h:588
+# ARB_create_context (GL/glxext.h:591)
+GLX_ARB_create_context = 1 # GL/glxext.h:592
+GLXContext = pyglet.gl.glx.GLXContext
+GLXFBConfig = pyglet.gl.glx.GLXFBConfig
+# GL/glxext.h:594
+glXCreateContextAttribsARB = _link_function('glXCreateContextAttribsARB', GLXContext, [POINTER(Display), GLXFBConfig, GLXContext, c_int, POINTER(c_int)], 'ARB_create_context')
+
+PFNGLXCREATECONTEXTATTRIBSARBPROC = CFUNCTYPE(GLXContext, POINTER(Display), GLXFBConfig, GLXContext, c_int, POINTER(c_int)) # GL/glxext.h:596
+# ARB_create_context_profile (GL/glxext.h:599)
+GLX_ARB_create_context_profile = 1 # GL/glxext.h:600
+# ARB_create_context_robustness (GL/glxext.h:603)
+GLX_ARB_create_context_robustness = 1 # GL/glxext.h:604
+# SGIS_multisample (GL/glxext.h:607)
+GLX_SGIS_multisample = 1 # GL/glxext.h:608
+# EXT_visual_info (GL/glxext.h:611)
+GLX_EXT_visual_info = 1 # GL/glxext.h:612
+# SGI_swap_control (GL/glxext.h:615)
+GLX_SGI_swap_control = 1 # GL/glxext.h:616
+# GL/glxext.h:618
+glXSwapIntervalSGI = _link_function('glXSwapIntervalSGI', c_int, [c_int], 'SGI_swap_control')
+
+PFNGLXSWAPINTERVALSGIPROC = CFUNCTYPE(c_int, c_int) # GL/glxext.h:620
+# SGI_video_sync (GL/glxext.h:623)
+GLX_SGI_video_sync = 1 # GL/glxext.h:624
+# GL/glxext.h:626
+glXGetVideoSyncSGI = _link_function('glXGetVideoSyncSGI', c_int, [POINTER(c_uint)], 'SGI_video_sync')
+
+# GL/glxext.h:627
+glXWaitVideoSyncSGI = _link_function('glXWaitVideoSyncSGI', c_int, [c_int, c_int, POINTER(c_uint)], 'SGI_video_sync')
+
+PFNGLXGETVIDEOSYNCSGIPROC = CFUNCTYPE(c_int, POINTER(c_uint)) # GL/glxext.h:629
+PFNGLXWAITVIDEOSYNCSGIPROC = CFUNCTYPE(c_int, c_int, c_int, POINTER(c_uint)) # GL/glxext.h:630
+# SGI_make_current_read (GL/glxext.h:633)
+GLX_SGI_make_current_read = 1 # GL/glxext.h:634
+# GL/glxext.h:636
+glXMakeCurrentReadSGI = _link_function('glXMakeCurrentReadSGI', c_int, [POINTER(Display), GLXDrawable, GLXDrawable, GLXContext], 'SGI_make_current_read')
+
+# GL/glxext.h:637
+glXGetCurrentReadDrawableSGI = _link_function('glXGetCurrentReadDrawableSGI', GLXDrawable, [], 'SGI_make_current_read')
+
+PFNGLXMAKECURRENTREADSGIPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, GLXDrawable, GLXContext) # GL/glxext.h:639
+PFNGLXGETCURRENTREADDRAWABLESGIPROC = CFUNCTYPE(GLXDrawable) # GL/glxext.h:640
+# SGIX_video_source (GL/glxext.h:643)
+GLX_SGIX_video_source = 1 # GL/glxext.h:644
+# EXT_visual_rating (GL/glxext.h:655)
+GLX_EXT_visual_rating = 1 # GL/glxext.h:656
+# EXT_import_context (GL/glxext.h:659)
+GLX_EXT_import_context = 1 # GL/glxext.h:660
+# GL/glxext.h:662
+glXGetCurrentDisplayEXT = _link_function('glXGetCurrentDisplayEXT', POINTER(Display), [], 'EXT_import_context')
+
+# GL/glxext.h:663
+glXQueryContextInfoEXT = _link_function('glXQueryContextInfoEXT', c_int, [POINTER(Display), GLXContext, c_int, POINTER(c_int)], 'EXT_import_context')
+
+GLXContextID = pyglet.gl.glx.GLXContextID
+# GL/glxext.h:664
+glXGetContextIDEXT = _link_function('glXGetContextIDEXT', GLXContextID, [GLXContext], 'EXT_import_context')
+
+# GL/glxext.h:665
+glXImportContextEXT = _link_function('glXImportContextEXT', GLXContext, [POINTER(Display), GLXContextID], 'EXT_import_context')
+
+# GL/glxext.h:666
+glXFreeContextEXT = _link_function('glXFreeContextEXT', None, [POINTER(Display), GLXContext], 'EXT_import_context')
+
+PFNGLXGETCURRENTDISPLAYEXTPROC = CFUNCTYPE(POINTER(Display)) # GL/glxext.h:668
+PFNGLXQUERYCONTEXTINFOEXTPROC = CFUNCTYPE(c_int, POINTER(Display), GLXContext, c_int, POINTER(c_int)) # GL/glxext.h:669
+PFNGLXGETCONTEXTIDEXTPROC = CFUNCTYPE(GLXContextID, GLXContext) # GL/glxext.h:670
+PFNGLXIMPORTCONTEXTEXTPROC = CFUNCTYPE(GLXContext, POINTER(Display), GLXContextID) # GL/glxext.h:671
+PFNGLXFREECONTEXTEXTPROC = CFUNCTYPE(None, POINTER(Display), GLXContext) # GL/glxext.h:672
+# SGIX_fbconfig (GL/glxext.h:675)
+GLX_SGIX_fbconfig = 1 # GL/glxext.h:676
+# GL/glxext.h:678
+glXGetFBConfigAttribSGIX = _link_function('glXGetFBConfigAttribSGIX', c_int, [POINTER(Display), GLXFBConfigSGIX, c_int, POINTER(c_int)], 'SGIX_fbconfig')
+
+# GL/glxext.h:679
+glXChooseFBConfigSGIX = _link_function('glXChooseFBConfigSGIX', POINTER(GLXFBConfigSGIX), [POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)], 'SGIX_fbconfig')
+
+GLXPixmap = pyglet.gl.glx.GLXPixmap
+Pixmap = pyglet.libs.x11.xlib.Pixmap
+# GL/glxext.h:680
+glXCreateGLXPixmapWithConfigSGIX = _link_function('glXCreateGLXPixmapWithConfigSGIX', GLXPixmap, [POINTER(Display), GLXFBConfigSGIX, Pixmap], 'SGIX_fbconfig')
+
+# GL/glxext.h:681
+glXCreateContextWithConfigSGIX = _link_function('glXCreateContextWithConfigSGIX', GLXContext, [POINTER(Display), GLXFBConfigSGIX, c_int, GLXContext, c_int], 'SGIX_fbconfig')
+
+XVisualInfo = pyglet.libs.x11.xlib.XVisualInfo
+# GL/glxext.h:682
+glXGetVisualFromFBConfigSGIX = _link_function('glXGetVisualFromFBConfigSGIX', POINTER(XVisualInfo), [POINTER(Display), GLXFBConfigSGIX], 'SGIX_fbconfig')
+
+# GL/glxext.h:683
+glXGetFBConfigFromVisualSGIX = _link_function('glXGetFBConfigFromVisualSGIX', GLXFBConfigSGIX, [POINTER(Display), POINTER(XVisualInfo)], 'SGIX_fbconfig')
+
+PFNGLXGETFBCONFIGATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), GLXFBConfigSGIX, c_int, POINTER(c_int)) # GL/glxext.h:685
+PFNGLXCHOOSEFBCONFIGSGIXPROC = CFUNCTYPE(POINTER(GLXFBConfigSGIX), POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)) # GL/glxext.h:686
+PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC = CFUNCTYPE(GLXPixmap, POINTER(Display), GLXFBConfigSGIX, Pixmap) # GL/glxext.h:687
+PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC = CFUNCTYPE(GLXContext, POINTER(Display), GLXFBConfigSGIX, c_int, GLXContext, c_int) # GL/glxext.h:688
+PFNGLXGETVISUALFROMFBCONFIGSGIXPROC = CFUNCTYPE(POINTER(XVisualInfo), POINTER(Display), GLXFBConfigSGIX) # GL/glxext.h:689
+PFNGLXGETFBCONFIGFROMVISUALSGIXPROC = CFUNCTYPE(GLXFBConfigSGIX, POINTER(Display), POINTER(XVisualInfo)) # GL/glxext.h:690
+# SGIX_pbuffer (GL/glxext.h:693)
+GLX_SGIX_pbuffer = 1 # GL/glxext.h:694
+# GL/glxext.h:696
+glXCreateGLXPbufferSGIX = _link_function('glXCreateGLXPbufferSGIX', GLXPbufferSGIX, [POINTER(Display), GLXFBConfigSGIX, c_uint, c_uint, POINTER(c_int)], 'SGIX_pbuffer')
+
+# GL/glxext.h:697
+glXDestroyGLXPbufferSGIX = _link_function('glXDestroyGLXPbufferSGIX', None, [POINTER(Display), GLXPbufferSGIX], 'SGIX_pbuffer')
+
+# GL/glxext.h:698
+glXQueryGLXPbufferSGIX = _link_function('glXQueryGLXPbufferSGIX', c_int, [POINTER(Display), GLXPbufferSGIX, c_int, POINTER(c_uint)], 'SGIX_pbuffer')
+
+# GL/glxext.h:699
+glXSelectEventSGIX = _link_function('glXSelectEventSGIX', None, [POINTER(Display), GLXDrawable, c_ulong], 'SGIX_pbuffer')
+
+# GL/glxext.h:700
+glXGetSelectedEventSGIX = _link_function('glXGetSelectedEventSGIX', None, [POINTER(Display), GLXDrawable, POINTER(c_ulong)], 'SGIX_pbuffer')
+
+PFNGLXCREATEGLXPBUFFERSGIXPROC = CFUNCTYPE(GLXPbufferSGIX, POINTER(Display), GLXFBConfigSGIX, c_uint, c_uint, POINTER(c_int)) # GL/glxext.h:702
+PFNGLXDESTROYGLXPBUFFERSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXPbufferSGIX) # GL/glxext.h:703
+PFNGLXQUERYGLXPBUFFERSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), GLXPbufferSGIX, c_int, POINTER(c_uint)) # GL/glxext.h:704
+PFNGLXSELECTEVENTSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_ulong) # GL/glxext.h:705
+PFNGLXGETSELECTEDEVENTSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, POINTER(c_ulong)) # GL/glxext.h:706
+# SGI_cushion (GL/glxext.h:709)
+GLX_SGI_cushion = 1 # GL/glxext.h:710
+Window = pyglet.libs.x11.xlib.Window
+# GL/glxext.h:712
+glXCushionSGI = _link_function('glXCushionSGI', None, [POINTER(Display), Window, c_float], 'SGI_cushion')
+
+PFNGLXCUSHIONSGIPROC = CFUNCTYPE(None, POINTER(Display), Window, c_float) # GL/glxext.h:714
+# SGIX_video_resize (GL/glxext.h:717)
+GLX_SGIX_video_resize = 1 # GL/glxext.h:718
+# GL/glxext.h:720
+glXBindChannelToWindowSGIX = _link_function('glXBindChannelToWindowSGIX', c_int, [POINTER(Display), c_int, c_int, Window], 'SGIX_video_resize')
+
+# GL/glxext.h:721
+glXChannelRectSGIX = _link_function('glXChannelRectSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, c_int, c_int, c_int], 'SGIX_video_resize')
+
+# GL/glxext.h:722
+glXQueryChannelRectSGIX = _link_function('glXQueryChannelRectSGIX', c_int, [POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)], 'SGIX_video_resize')
+
+# GL/glxext.h:723
+glXQueryChannelDeltasSGIX = _link_function('glXQueryChannelDeltasSGIX', c_int, [POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)], 'SGIX_video_resize')
+
+GLenum = c_uint # /usr/include/GL/gl.h:153
+# GL/glxext.h:724
+glXChannelRectSyncSGIX = _link_function('glXChannelRectSyncSGIX', c_int, [POINTER(Display), c_int, c_int, GLenum], 'SGIX_video_resize')
+
+PFNGLXBINDCHANNELTOWINDOWSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, Window) # GL/glxext.h:726
+PFNGLXCHANNELRECTSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, c_int, c_int, c_int) # GL/glxext.h:727
+PFNGLXQUERYCHANNELRECTSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)) # GL/glxext.h:728
+PFNGLXQUERYCHANNELDELTASSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)) # GL/glxext.h:729
+PFNGLXCHANNELRECTSYNCSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, GLenum) # GL/glxext.h:730
+# SGIX_dmbuffer (GL/glxext.h:733)
+GLX_SGIX_dmbuffer = 1 # GL/glxext.h:734
+# SGIX_swap_group (GL/glxext.h:743)
+GLX_SGIX_swap_group = 1 # GL/glxext.h:744
+# GL/glxext.h:746
+glXJoinSwapGroupSGIX = _link_function('glXJoinSwapGroupSGIX', None, [POINTER(Display), GLXDrawable, GLXDrawable], 'SGIX_swap_group')
+
+PFNGLXJOINSWAPGROUPSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, GLXDrawable) # GL/glxext.h:748
+# SGIX_swap_barrier (GL/glxext.h:751)
+GLX_SGIX_swap_barrier = 1 # GL/glxext.h:752
+# GL/glxext.h:754
+glXBindSwapBarrierSGIX = _link_function('glXBindSwapBarrierSGIX', None, [POINTER(Display), GLXDrawable, c_int], 'SGIX_swap_barrier')
+
+# GL/glxext.h:755
+glXQueryMaxSwapBarriersSGIX = _link_function('glXQueryMaxSwapBarriersSGIX', c_int, [POINTER(Display), c_int, POINTER(c_int)], 'SGIX_swap_barrier')
+
+PFNGLXBINDSWAPBARRIERSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int) # GL/glxext.h:757
+PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, POINTER(c_int)) # GL/glxext.h:758
+# SUN_get_transparent_index (GL/glxext.h:761)
+GLX_SUN_get_transparent_index = 1 # GL/glxext.h:762
+# GL/glxext.h:764
+glXGetTransparentIndexSUN = _link_function('glXGetTransparentIndexSUN', c_int, [POINTER(Display), Window, Window, POINTER(c_long)], 'SUN_get_transparent_index')
+
+PFNGLXGETTRANSPARENTINDEXSUNPROC = CFUNCTYPE(c_int, POINTER(Display), Window, Window, POINTER(c_long)) # GL/glxext.h:766
+# MESA_copy_sub_buffer (GL/glxext.h:769)
+GLX_MESA_copy_sub_buffer = 1 # GL/glxext.h:770
+# GL/glxext.h:772
+glXCopySubBufferMESA = _link_function('glXCopySubBufferMESA', None, [POINTER(Display), GLXDrawable, c_int, c_int, c_int, c_int], 'MESA_copy_sub_buffer')
+
+PFNGLXCOPYSUBBUFFERMESAPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int, c_int, c_int, c_int) # GL/glxext.h:774
+# MESA_pixmap_colormap (GL/glxext.h:777)
+GLX_MESA_pixmap_colormap = 1 # GL/glxext.h:778
+Colormap = pyglet.libs.x11.xlib.Colormap
+# GL/glxext.h:780
+glXCreateGLXPixmapMESA = _link_function('glXCreateGLXPixmapMESA', GLXPixmap, [POINTER(Display), POINTER(XVisualInfo), Pixmap, Colormap], 'MESA_pixmap_colormap')
+
+PFNGLXCREATEGLXPIXMAPMESAPROC = CFUNCTYPE(GLXPixmap, POINTER(Display), POINTER(XVisualInfo), Pixmap, Colormap) # GL/glxext.h:782
+# MESA_release_buffers (GL/glxext.h:785)
+GLX_MESA_release_buffers = 1 # GL/glxext.h:786
+# GL/glxext.h:788
+glXReleaseBuffersMESA = _link_function('glXReleaseBuffersMESA', c_int, [POINTER(Display), GLXDrawable], 'MESA_release_buffers')
+
+PFNGLXRELEASEBUFFERSMESAPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable) # GL/glxext.h:790
+# MESA_set_3dfx_mode (GL/glxext.h:793)
+GLX_MESA_set_3dfx_mode = 1 # GL/glxext.h:794
+# GL/glxext.h:796
+glXSet3DfxModeMESA = _link_function('glXSet3DfxModeMESA', c_int, [c_int], 'MESA_set_3dfx_mode')
+
+PFNGLXSET3DFXMODEMESAPROC = CFUNCTYPE(c_int, c_int) # GL/glxext.h:798
+# SGIX_visual_select_group (GL/glxext.h:801)
+GLX_SGIX_visual_select_group = 1 # GL/glxext.h:802
+# OML_swap_method (GL/glxext.h:805)
+GLX_OML_swap_method = 1 # GL/glxext.h:806
+# OML_sync_control (GL/glxext.h:809)
+GLX_OML_sync_control = 1 # GL/glxext.h:810
+# GL/glxext.h:812
+glXGetSyncValuesOML = _link_function('glXGetSyncValuesOML', c_int, [POINTER(Display), GLXDrawable, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)], 'OML_sync_control')
+
+# GL/glxext.h:813
+glXGetMscRateOML = _link_function('glXGetMscRateOML', c_int, [POINTER(Display), GLXDrawable, POINTER(c_int32), POINTER(c_int32)], 'OML_sync_control')
+
+# GL/glxext.h:814
+glXSwapBuffersMscOML = _link_function('glXSwapBuffersMscOML', c_int64, [POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64], 'OML_sync_control')
+
+# GL/glxext.h:815
+glXWaitForMscOML = _link_function('glXWaitForMscOML', c_int, [POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)], 'OML_sync_control')
+
+# GL/glxext.h:816
+glXWaitForSbcOML = _link_function('glXWaitForSbcOML', c_int, [POINTER(Display), GLXDrawable, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)], 'OML_sync_control')
+
+PFNGLXGETSYNCVALUESOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)) # GL/glxext.h:818
+PFNGLXGETMSCRATEOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(c_int32), POINTER(c_int32)) # GL/glxext.h:819
+PFNGLXSWAPBUFFERSMSCOMLPROC = CFUNCTYPE(c_int64, POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64) # GL/glxext.h:820
+PFNGLXWAITFORMSCOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)) # GL/glxext.h:821
+PFNGLXWAITFORSBCOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)) # GL/glxext.h:822
+# NV_float_buffer (GL/glxext.h:825)
+GLX_NV_float_buffer = 1 # GL/glxext.h:826
+# SGIX_hyperpipe (GL/glxext.h:829)
+GLX_SGIX_hyperpipe = 1 # GL/glxext.h:830
+class struct_anon_107(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'networkId',
+ ]
+struct_anon_107._fields_ = [
+ ('pipeName', c_char * 80),
+ ('networkId', c_int),
+]
+
+GLXHyperpipeNetworkSGIX = struct_anon_107 # GL/glxext.h:835
+class struct_anon_108(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'channel',
+ 'participationType',
+ 'timeSlice',
+ ]
+struct_anon_108._fields_ = [
+ ('pipeName', c_char * 80),
+ ('channel', c_int),
+ ('participationType', c_uint),
+ ('timeSlice', c_int),
+]
+
+GLXHyperpipeConfigSGIX = struct_anon_108 # GL/glxext.h:843
+class struct_anon_109(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'srcXOrigin',
+ 'srcYOrigin',
+ 'srcWidth',
+ 'srcHeight',
+ 'destXOrigin',
+ 'destYOrigin',
+ 'destWidth',
+ 'destHeight',
+ ]
+struct_anon_109._fields_ = [
+ ('pipeName', c_char * 80),
+ ('srcXOrigin', c_int),
+ ('srcYOrigin', c_int),
+ ('srcWidth', c_int),
+ ('srcHeight', c_int),
+ ('destXOrigin', c_int),
+ ('destYOrigin', c_int),
+ ('destWidth', c_int),
+ ('destHeight', c_int),
+]
+
+GLXPipeRect = struct_anon_109 # GL/glxext.h:849
+class struct_anon_110(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'XOrigin',
+ 'YOrigin',
+ 'maxHeight',
+ 'maxWidth',
+ ]
+struct_anon_110._fields_ = [
+ ('pipeName', c_char * 80),
+ ('XOrigin', c_int),
+ ('YOrigin', c_int),
+ ('maxHeight', c_int),
+ ('maxWidth', c_int),
+]
+
+GLXPipeRectLimits = struct_anon_110 # GL/glxext.h:854
+# GL/glxext.h:857
+glXQueryHyperpipeNetworkSGIX = _link_function('glXQueryHyperpipeNetworkSGIX', POINTER(GLXHyperpipeNetworkSGIX), [POINTER(Display), POINTER(c_int)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:858
+glXHyperpipeConfigSGIX = _link_function('glXHyperpipeConfigSGIX', c_int, [POINTER(Display), c_int, c_int, POINTER(GLXHyperpipeConfigSGIX), POINTER(c_int)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:859
+glXQueryHyperpipeConfigSGIX = _link_function('glXQueryHyperpipeConfigSGIX', POINTER(GLXHyperpipeConfigSGIX), [POINTER(Display), c_int, POINTER(c_int)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:860
+glXDestroyHyperpipeConfigSGIX = _link_function('glXDestroyHyperpipeConfigSGIX', c_int, [POINTER(Display), c_int], 'SGIX_hyperpipe')
+
+# GL/glxext.h:861
+glXBindHyperpipeSGIX = _link_function('glXBindHyperpipeSGIX', c_int, [POINTER(Display), c_int], 'SGIX_hyperpipe')
+
+# GL/glxext.h:862
+glXQueryHyperpipeBestAttribSGIX = _link_function('glXQueryHyperpipeBestAttribSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, POINTER(None), POINTER(None)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:863
+glXHyperpipeAttribSGIX = _link_function('glXHyperpipeAttribSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, POINTER(None)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:864
+glXQueryHyperpipeAttribSGIX = _link_function('glXQueryHyperpipeAttribSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, POINTER(None)], 'SGIX_hyperpipe')
+
+PFNGLXQUERYHYPERPIPENETWORKSGIXPROC = CFUNCTYPE(POINTER(GLXHyperpipeNetworkSGIX), POINTER(Display), POINTER(c_int)) # GL/glxext.h:866
+PFNGLXHYPERPIPECONFIGSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(GLXHyperpipeConfigSGIX), POINTER(c_int)) # GL/glxext.h:867
+PFNGLXQUERYHYPERPIPECONFIGSGIXPROC = CFUNCTYPE(POINTER(GLXHyperpipeConfigSGIX), POINTER(Display), c_int, POINTER(c_int)) # GL/glxext.h:868
+PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int) # GL/glxext.h:869
+PFNGLXBINDHYPERPIPESGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int) # GL/glxext.h:870
+PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, POINTER(None), POINTER(None)) # GL/glxext.h:871
+PFNGLXHYPERPIPEATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, POINTER(None)) # GL/glxext.h:872
+PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, POINTER(None)) # GL/glxext.h:873
+# MESA_agp_offset (GL/glxext.h:876)
+GLX_MESA_agp_offset = 1 # GL/glxext.h:877
+# GL/glxext.h:879
+glXGetAGPOffsetMESA = _link_function('glXGetAGPOffsetMESA', c_uint, [POINTER(None)], 'MESA_agp_offset')
+
+PFNGLXGETAGPOFFSETMESAPROC = CFUNCTYPE(c_uint, POINTER(None)) # GL/glxext.h:881
+# EXT_fbconfig_packed_float (GL/glxext.h:884)
+GLX_EXT_fbconfig_packed_float = 1 # GL/glxext.h:885
+# EXT_framebuffer_sRGB (GL/glxext.h:888)
+GLX_EXT_framebuffer_sRGB = 1 # GL/glxext.h:889
+# EXT_texture_from_pixmap (GL/glxext.h:892)
+GLX_EXT_texture_from_pixmap = 1 # GL/glxext.h:893
+# GL/glxext.h:895
+glXBindTexImageEXT = _link_function('glXBindTexImageEXT', None, [POINTER(Display), GLXDrawable, c_int, POINTER(c_int)], 'EXT_texture_from_pixmap')
+
+# GL/glxext.h:896
+glXReleaseTexImageEXT = _link_function('glXReleaseTexImageEXT', None, [POINTER(Display), GLXDrawable, c_int], 'EXT_texture_from_pixmap')
+
+PFNGLXBINDTEXIMAGEEXTPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int, POINTER(c_int)) # GL/glxext.h:898
+PFNGLXRELEASETEXIMAGEEXTPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int) # GL/glxext.h:899
+# NV_present_video (GL/glxext.h:902)
+GLX_NV_present_video = 1 # GL/glxext.h:903
+# GL/glxext.h:905
+glXEnumerateVideoDevicesNV = _link_function('glXEnumerateVideoDevicesNV', POINTER(c_uint), [POINTER(Display), c_int, POINTER(c_int)], 'NV_present_video')
+
+# GL/glxext.h:906
+glXBindVideoDeviceNV = _link_function('glXBindVideoDeviceNV', c_int, [POINTER(Display), c_uint, c_uint, POINTER(c_int)], 'NV_present_video')
+
+PFNGLXENUMERATEVIDEODEVICESNVPROC = CFUNCTYPE(POINTER(c_uint), POINTER(Display), c_int, POINTER(c_int)) # GL/glxext.h:908
+PFNGLXBINDVIDEODEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), c_uint, c_uint, POINTER(c_int)) # GL/glxext.h:909
+# NV_video_output (GL/glxext.h:912)
+GLX_NV_video_output = 1 # GL/glxext.h:913
+# GL/glxext.h:915
+glXGetVideoDeviceNV = _link_function('glXGetVideoDeviceNV', c_int, [POINTER(Display), c_int, c_int, POINTER(GLXVideoDeviceNV)], 'NV_video_output')
+
+# GL/glxext.h:916
+glXReleaseVideoDeviceNV = _link_function('glXReleaseVideoDeviceNV', c_int, [POINTER(Display), c_int, GLXVideoDeviceNV], 'NV_video_output')
+
+GLXPbuffer = pyglet.gl.glx.GLXPbuffer
+# GL/glxext.h:917
+glXBindVideoImageNV = _link_function('glXBindVideoImageNV', c_int, [POINTER(Display), GLXVideoDeviceNV, GLXPbuffer, c_int], 'NV_video_output')
+
+# GL/glxext.h:918
+glXReleaseVideoImageNV = _link_function('glXReleaseVideoImageNV', c_int, [POINTER(Display), GLXPbuffer], 'NV_video_output')
+
+GLboolean = c_ubyte # /usr/include/GL/gl.h:154
+# GL/glxext.h:919
+glXSendPbufferToVideoNV = _link_function('glXSendPbufferToVideoNV', c_int, [POINTER(Display), GLXPbuffer, c_int, POINTER(c_ulong), GLboolean], 'NV_video_output')
+
+# GL/glxext.h:920
+glXGetVideoInfoNV = _link_function('glXGetVideoInfoNV', c_int, [POINTER(Display), c_int, GLXVideoDeviceNV, POINTER(c_ulong), POINTER(c_ulong)], 'NV_video_output')
+
+PFNGLXGETVIDEODEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(GLXVideoDeviceNV)) # GL/glxext.h:922
+PFNGLXRELEASEVIDEODEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, GLXVideoDeviceNV) # GL/glxext.h:923
+PFNGLXBINDVIDEOIMAGENVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXVideoDeviceNV, GLXPbuffer, c_int) # GL/glxext.h:924
+PFNGLXRELEASEVIDEOIMAGENVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXPbuffer) # GL/glxext.h:925
+PFNGLXSENDPBUFFERTOVIDEONVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXPbuffer, c_int, POINTER(c_ulong), GLboolean) # GL/glxext.h:926
+PFNGLXGETVIDEOINFONVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, GLXVideoDeviceNV, POINTER(c_ulong), POINTER(c_ulong)) # GL/glxext.h:927
+# NV_swap_group (GL/glxext.h:930)
+GLX_NV_swap_group = 1 # GL/glxext.h:931
+GLuint = c_uint # /usr/include/GL/gl.h:162
+# GL/glxext.h:933
+glXJoinSwapGroupNV = _link_function('glXJoinSwapGroupNV', c_int, [POINTER(Display), GLXDrawable, GLuint], 'NV_swap_group')
+
+# GL/glxext.h:934
+glXBindSwapBarrierNV = _link_function('glXBindSwapBarrierNV', c_int, [POINTER(Display), GLuint, GLuint], 'NV_swap_group')
+
+# GL/glxext.h:935
+glXQuerySwapGroupNV = _link_function('glXQuerySwapGroupNV', c_int, [POINTER(Display), GLXDrawable, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# GL/glxext.h:936
+glXQueryMaxSwapGroupsNV = _link_function('glXQueryMaxSwapGroupsNV', c_int, [POINTER(Display), c_int, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# GL/glxext.h:937
+glXQueryFrameCountNV = _link_function('glXQueryFrameCountNV', c_int, [POINTER(Display), c_int, POINTER(GLuint)], 'NV_swap_group')
+
+# GL/glxext.h:938
+glXResetFrameCountNV = _link_function('glXResetFrameCountNV', c_int, [POINTER(Display), c_int], 'NV_swap_group')
+
+PFNGLXJOINSWAPGROUPNVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, GLuint) # GL/glxext.h:940
+PFNGLXBINDSWAPBARRIERNVPROC = CFUNCTYPE(c_int, POINTER(Display), GLuint, GLuint) # GL/glxext.h:941
+PFNGLXQUERYSWAPGROUPNVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(GLuint), POINTER(GLuint)) # GL/glxext.h:942
+PFNGLXQUERYMAXSWAPGROUPSNVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, POINTER(GLuint), POINTER(GLuint)) # GL/glxext.h:943
+PFNGLXQUERYFRAMECOUNTNVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, POINTER(GLuint)) # GL/glxext.h:944
+PFNGLXRESETFRAMECOUNTNVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int) # GL/glxext.h:945
+# NV_video_capture (GL/glxext.h:948)
+GLX_NV_video_capture = 1 # GL/glxext.h:949
+# GL/glxext.h:951
+glXBindVideoCaptureDeviceNV = _link_function('glXBindVideoCaptureDeviceNV', c_int, [POINTER(Display), c_uint, GLXVideoCaptureDeviceNV], 'NV_video_capture')
+
+# GL/glxext.h:952
+glXEnumerateVideoCaptureDevicesNV = _link_function('glXEnumerateVideoCaptureDevicesNV', POINTER(GLXVideoCaptureDeviceNV), [POINTER(Display), c_int, POINTER(c_int)], 'NV_video_capture')
+
+# GL/glxext.h:953
+glXLockVideoCaptureDeviceNV = _link_function('glXLockVideoCaptureDeviceNV', None, [POINTER(Display), GLXVideoCaptureDeviceNV], 'NV_video_capture')
+
+# GL/glxext.h:954
+glXQueryVideoCaptureDeviceNV = _link_function('glXQueryVideoCaptureDeviceNV', c_int, [POINTER(Display), GLXVideoCaptureDeviceNV, c_int, POINTER(c_int)], 'NV_video_capture')
+
+# GL/glxext.h:955
+glXReleaseVideoCaptureDeviceNV = _link_function('glXReleaseVideoCaptureDeviceNV', None, [POINTER(Display), GLXVideoCaptureDeviceNV], 'NV_video_capture')
+
+PFNGLXBINDVIDEOCAPTUREDEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), c_uint, GLXVideoCaptureDeviceNV) # GL/glxext.h:957
+PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC = CFUNCTYPE(POINTER(GLXVideoCaptureDeviceNV), POINTER(Display), c_int, POINTER(c_int)) # GL/glxext.h:958
+PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC = CFUNCTYPE(None, POINTER(Display), GLXVideoCaptureDeviceNV) # GL/glxext.h:959
+PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXVideoCaptureDeviceNV, c_int, POINTER(c_int)) # GL/glxext.h:960
+PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC = CFUNCTYPE(None, POINTER(Display), GLXVideoCaptureDeviceNV) # GL/glxext.h:961
+# EXT_swap_control (GL/glxext.h:964)
+GLX_EXT_swap_control = 1 # GL/glxext.h:965
+# GL/glxext.h:967
+glXSwapIntervalEXT = _link_function('glXSwapIntervalEXT', c_int, [POINTER(Display), GLXDrawable, c_int], 'EXT_swap_control')
+
+PFNGLXSWAPINTERVALEXTPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, c_int) # GL/glxext.h:969
+# NV_copy_image (GL/glxext.h:972)
+GLX_NV_copy_image = 1 # GL/glxext.h:973
+GLint = c_int # /usr/include/GL/gl.h:159
+GLsizei = c_int # /usr/include/GL/gl.h:163
+# GL/glxext.h:975
+glXCopyImageSubDataNV = _link_function('glXCopyImageSubDataNV', None, [POINTER(Display), GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei], 'NV_copy_image')
+
+PFNGLXCOPYIMAGESUBDATANVPROC = CFUNCTYPE(None, POINTER(Display), GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei) # GL/glxext.h:977
+# INTEL_swap_event (GL/glxext.h:980)
+GLX_INTEL_swap_event = 1 # GL/glxext.h:981
+# NV_multisample_coverage (GL/glxext.h:984)
+GLX_NV_multisample_coverage = 1 # GL/glxext.h:985
+# NV_vertex_array_range (/usr/include/GL/glx.h:349)
+# MESA_allocate_memory (/usr/include/GL/glx.h:363)
+# ARB_render_texture (/usr/include/GL/glx.h:380)
+# NV_float_buffer (/usr/include/GL/glx.h:393)
+# MESA_swap_frame_usage (/usr/include/GL/glx.h:405)
+# MESA_swap_control (/usr/include/GL/glx.h:425)
+# EXT_texture_from_pixmap (/usr/include/GL/glx.h:442)
+
+__all__ = ['GLX_GLXEXT_VERSION', 'GLX_SAMPLE_BUFFERS_ARB', 'GLX_SAMPLES_ARB',
+'GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB', 'GLX_RGBA_FLOAT_TYPE_ARB',
+'GLX_RGBA_FLOAT_BIT_ARB', 'GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB',
+'GLX_CONTEXT_DEBUG_BIT_ARB', 'GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB',
+'GLX_CONTEXT_MAJOR_VERSION_ARB', 'GLX_CONTEXT_MINOR_VERSION_ARB',
+'GLX_CONTEXT_FLAGS_ARB', 'GLX_CONTEXT_CORE_PROFILE_BIT_ARB',
+'GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB', 'GLX_CONTEXT_PROFILE_MASK_ARB',
+'GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB', 'GLX_LOSE_CONTEXT_ON_RESET_ARB',
+'GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB',
+'GLX_NO_RESET_NOTIFICATION_ARB', 'GLX_SAMPLE_BUFFERS_SGIS',
+'GLX_SAMPLES_SGIS', 'GLX_X_VISUAL_TYPE_EXT', 'GLX_TRANSPARENT_TYPE_EXT',
+'GLX_TRANSPARENT_INDEX_VALUE_EXT', 'GLX_TRANSPARENT_RED_VALUE_EXT',
+'GLX_TRANSPARENT_GREEN_VALUE_EXT', 'GLX_TRANSPARENT_BLUE_VALUE_EXT',
+'GLX_TRANSPARENT_ALPHA_VALUE_EXT', 'GLX_NONE_EXT', 'GLX_TRUE_COLOR_EXT',
+'GLX_DIRECT_COLOR_EXT', 'GLX_PSEUDO_COLOR_EXT', 'GLX_STATIC_COLOR_EXT',
+'GLX_GRAY_SCALE_EXT', 'GLX_STATIC_GRAY_EXT', 'GLX_TRANSPARENT_RGB_EXT',
+'GLX_TRANSPARENT_INDEX_EXT', 'GLX_VISUAL_CAVEAT_EXT', 'GLX_SLOW_VISUAL_EXT',
+'GLX_NON_CONFORMANT_VISUAL_EXT', 'GLX_SHARE_CONTEXT_EXT', 'GLX_VISUAL_ID_EXT',
+'GLX_SCREEN_EXT', 'GLX_WINDOW_BIT_SGIX', 'GLX_PIXMAP_BIT_SGIX',
+'GLX_RGBA_BIT_SGIX', 'GLX_COLOR_INDEX_BIT_SGIX', 'GLX_DRAWABLE_TYPE_SGIX',
+'GLX_RENDER_TYPE_SGIX', 'GLX_X_RENDERABLE_SGIX', 'GLX_FBCONFIG_ID_SGIX',
+'GLX_RGBA_TYPE_SGIX', 'GLX_COLOR_INDEX_TYPE_SGIX', 'GLX_PBUFFER_BIT_SGIX',
+'GLX_BUFFER_CLOBBER_MASK_SGIX', 'GLX_FRONT_LEFT_BUFFER_BIT_SGIX',
+'GLX_FRONT_RIGHT_BUFFER_BIT_SGIX', 'GLX_BACK_LEFT_BUFFER_BIT_SGIX',
+'GLX_BACK_RIGHT_BUFFER_BIT_SGIX', 'GLX_AUX_BUFFERS_BIT_SGIX',
+'GLX_DEPTH_BUFFER_BIT_SGIX', 'GLX_STENCIL_BUFFER_BIT_SGIX',
+'GLX_ACCUM_BUFFER_BIT_SGIX', 'GLX_SAMPLE_BUFFERS_BIT_SGIX',
+'GLX_MAX_PBUFFER_WIDTH_SGIX', 'GLX_MAX_PBUFFER_HEIGHT_SGIX',
+'GLX_MAX_PBUFFER_PIXELS_SGIX', 'GLX_OPTIMAL_PBUFFER_WIDTH_SGIX',
+'GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX', 'GLX_PRESERVED_CONTENTS_SGIX',
+'GLX_LARGEST_PBUFFER_SGIX', 'GLX_WIDTH_SGIX', 'GLX_HEIGHT_SGIX',
+'GLX_EVENT_MASK_SGIX', 'GLX_DAMAGED_SGIX', 'GLX_SAVED_SGIX',
+'GLX_WINDOW_SGIX', 'GLX_PBUFFER_SGIX', 'GLX_SYNC_FRAME_SGIX',
+'GLX_SYNC_SWAP_SGIX', 'GLX_DIGITAL_MEDIA_PBUFFER_SGIX',
+'GLX_BLENDED_RGBA_SGIS', 'GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS',
+'GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS', 'GLX_SAMPLE_BUFFERS_3DFX',
+'GLX_SAMPLES_3DFX', 'GLX_3DFX_WINDOW_MODE_MESA',
+'GLX_3DFX_FULLSCREEN_MODE_MESA', 'GLX_VISUAL_SELECT_GROUP_SGIX',
+'GLX_SWAP_METHOD_OML', 'GLX_SWAP_EXCHANGE_OML', 'GLX_SWAP_COPY_OML',
+'GLX_SWAP_UNDEFINED_OML', 'GLX_FLOAT_COMPONENTS_NV',
+'GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX', 'GLX_BAD_HYPERPIPE_CONFIG_SGIX',
+'GLX_BAD_HYPERPIPE_SGIX', 'GLX_HYPERPIPE_DISPLAY_PIPE_SGIX',
+'GLX_HYPERPIPE_RENDER_PIPE_SGIX', 'GLX_PIPE_RECT_SGIX',
+'GLX_PIPE_RECT_LIMITS_SGIX', 'GLX_HYPERPIPE_STEREO_SGIX',
+'GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX', 'GLX_HYPERPIPE_ID_SGIX',
+'GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT', 'GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT',
+'GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT', 'GLX_TEXTURE_1D_BIT_EXT',
+'GLX_TEXTURE_2D_BIT_EXT', 'GLX_TEXTURE_RECTANGLE_BIT_EXT',
+'GLX_BIND_TO_TEXTURE_RGB_EXT', 'GLX_BIND_TO_TEXTURE_RGBA_EXT',
+'GLX_BIND_TO_MIPMAP_TEXTURE_EXT', 'GLX_BIND_TO_TEXTURE_TARGETS_EXT',
+'GLX_Y_INVERTED_EXT', 'GLX_TEXTURE_FORMAT_EXT', 'GLX_TEXTURE_TARGET_EXT',
+'GLX_MIPMAP_TEXTURE_EXT', 'GLX_TEXTURE_FORMAT_NONE_EXT',
+'GLX_TEXTURE_FORMAT_RGB_EXT', 'GLX_TEXTURE_FORMAT_RGBA_EXT',
+'GLX_TEXTURE_1D_EXT', 'GLX_TEXTURE_2D_EXT', 'GLX_TEXTURE_RECTANGLE_EXT',
+'GLX_FRONT_LEFT_EXT', 'GLX_FRONT_RIGHT_EXT', 'GLX_BACK_LEFT_EXT',
+'GLX_BACK_RIGHT_EXT', 'GLX_FRONT_EXT', 'GLX_BACK_EXT', 'GLX_AUX0_EXT',
+'GLX_AUX1_EXT', 'GLX_AUX2_EXT', 'GLX_AUX3_EXT', 'GLX_AUX4_EXT',
+'GLX_AUX5_EXT', 'GLX_AUX6_EXT', 'GLX_AUX7_EXT', 'GLX_AUX8_EXT',
+'GLX_AUX9_EXT', 'GLX_NUM_VIDEO_SLOTS_NV', 'GLX_VIDEO_OUT_COLOR_NV',
+'GLX_VIDEO_OUT_ALPHA_NV', 'GLX_VIDEO_OUT_DEPTH_NV',
+'GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV', 'GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV',
+'GLX_VIDEO_OUT_FRAME_NV', 'GLX_VIDEO_OUT_FIELD_1_NV',
+'GLX_VIDEO_OUT_FIELD_2_NV', 'GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV',
+'GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV', 'GLX_DEVICE_ID_NV', 'GLX_UNIQUE_ID_NV',
+'GLX_NUM_VIDEO_CAPTURE_SLOTS_NV', 'GLX_SWAP_INTERVAL_EXT',
+'GLX_MAX_SWAP_INTERVAL_EXT', 'GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK',
+'GLX_EXCHANGE_COMPLETE_INTEL', 'GLX_COPY_COMPLETE_INTEL',
+'GLX_FLIP_COMPLETE_INTEL', 'GLX_COVERAGE_SAMPLES_NV', 'GLX_COLOR_SAMPLES_NV',
+'GLX_GPU_VENDOR_AMD', 'GLX_GPU_RENDERER_STRING_AMD',
+'GLX_GPU_OPENGL_VERSION_STRING_AMD', 'GLX_GPU_FASTEST_TARGET_GPUS_AMD',
+'GLX_GPU_RAM_AMD', 'GLX_GPU_CLOCK_AMD', 'GLX_GPU_NUM_PIPES_AMD',
+'GLX_GPU_NUM_SIMD_AMD', 'GLX_GPU_NUM_RB_AMD', 'GLX_GPU_NUM_SPI_AMD',
+'GLX_CONTEXT_ES2_PROFILE_BIT_EXT', 'GLXVideoSourceSGIX', 'GLXFBConfigIDSGIX',
+'GLXFBConfigSGIX', 'GLXPbufferSGIX', 'GLXBufferClobberEventSGIX',
+'GLXVideoDeviceNV', 'GLXVideoCaptureDeviceNV', 'GLX_ARB_multisample',
+'GLX_ARB_fbconfig_float', 'GLX_ARB_framebuffer_sRGB',
+'GLX_ARB_create_context', 'glXCreateContextAttribsARB',
+'PFNGLXCREATECONTEXTATTRIBSARBPROC', 'GLX_ARB_create_context_profile',
+'GLX_ARB_create_context_robustness', 'GLX_SGIS_multisample',
+'GLX_EXT_visual_info', 'GLX_SGI_swap_control', 'glXSwapIntervalSGI',
+'PFNGLXSWAPINTERVALSGIPROC', 'GLX_SGI_video_sync', 'glXGetVideoSyncSGI',
+'glXWaitVideoSyncSGI', 'PFNGLXGETVIDEOSYNCSGIPROC',
+'PFNGLXWAITVIDEOSYNCSGIPROC', 'GLX_SGI_make_current_read',
+'glXMakeCurrentReadSGI', 'glXGetCurrentReadDrawableSGI',
+'PFNGLXMAKECURRENTREADSGIPROC', 'PFNGLXGETCURRENTREADDRAWABLESGIPROC',
+'GLX_SGIX_video_source', 'GLX_EXT_visual_rating', 'GLX_EXT_import_context',
+'glXGetCurrentDisplayEXT', 'glXQueryContextInfoEXT', 'glXGetContextIDEXT',
+'glXImportContextEXT', 'glXFreeContextEXT', 'PFNGLXGETCURRENTDISPLAYEXTPROC',
+'PFNGLXQUERYCONTEXTINFOEXTPROC', 'PFNGLXGETCONTEXTIDEXTPROC',
+'PFNGLXIMPORTCONTEXTEXTPROC', 'PFNGLXFREECONTEXTEXTPROC', 'GLX_SGIX_fbconfig',
+'glXGetFBConfigAttribSGIX', 'glXChooseFBConfigSGIX',
+'glXCreateGLXPixmapWithConfigSGIX', 'glXCreateContextWithConfigSGIX',
+'glXGetVisualFromFBConfigSGIX', 'glXGetFBConfigFromVisualSGIX',
+'PFNGLXGETFBCONFIGATTRIBSGIXPROC', 'PFNGLXCHOOSEFBCONFIGSGIXPROC',
+'PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC',
+'PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC',
+'PFNGLXGETVISUALFROMFBCONFIGSGIXPROC', 'PFNGLXGETFBCONFIGFROMVISUALSGIXPROC',
+'GLX_SGIX_pbuffer', 'glXCreateGLXPbufferSGIX', 'glXDestroyGLXPbufferSGIX',
+'glXQueryGLXPbufferSGIX', 'glXSelectEventSGIX', 'glXGetSelectedEventSGIX',
+'PFNGLXCREATEGLXPBUFFERSGIXPROC', 'PFNGLXDESTROYGLXPBUFFERSGIXPROC',
+'PFNGLXQUERYGLXPBUFFERSGIXPROC', 'PFNGLXSELECTEVENTSGIXPROC',
+'PFNGLXGETSELECTEDEVENTSGIXPROC', 'GLX_SGI_cushion', 'glXCushionSGI',
+'PFNGLXCUSHIONSGIPROC', 'GLX_SGIX_video_resize', 'glXBindChannelToWindowSGIX',
+'glXChannelRectSGIX', 'glXQueryChannelRectSGIX', 'glXQueryChannelDeltasSGIX',
+'glXChannelRectSyncSGIX', 'PFNGLXBINDCHANNELTOWINDOWSGIXPROC',
+'PFNGLXCHANNELRECTSGIXPROC', 'PFNGLXQUERYCHANNELRECTSGIXPROC',
+'PFNGLXQUERYCHANNELDELTASSGIXPROC', 'PFNGLXCHANNELRECTSYNCSGIXPROC',
+'GLX_SGIX_dmbuffer', 'GLX_SGIX_swap_group', 'glXJoinSwapGroupSGIX',
+'PFNGLXJOINSWAPGROUPSGIXPROC', 'GLX_SGIX_swap_barrier',
+'glXBindSwapBarrierSGIX', 'glXQueryMaxSwapBarriersSGIX',
+'PFNGLXBINDSWAPBARRIERSGIXPROC', 'PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC',
+'GLX_SUN_get_transparent_index', 'glXGetTransparentIndexSUN',
+'PFNGLXGETTRANSPARENTINDEXSUNPROC', 'GLX_MESA_copy_sub_buffer',
+'glXCopySubBufferMESA', 'PFNGLXCOPYSUBBUFFERMESAPROC',
+'GLX_MESA_pixmap_colormap', 'glXCreateGLXPixmapMESA',
+'PFNGLXCREATEGLXPIXMAPMESAPROC', 'GLX_MESA_release_buffers',
+'glXReleaseBuffersMESA', 'PFNGLXRELEASEBUFFERSMESAPROC',
+'GLX_MESA_set_3dfx_mode', 'glXSet3DfxModeMESA', 'PFNGLXSET3DFXMODEMESAPROC',
+'GLX_SGIX_visual_select_group', 'GLX_OML_swap_method', 'GLX_OML_sync_control',
+'glXGetSyncValuesOML', 'glXGetMscRateOML', 'glXSwapBuffersMscOML',
+'glXWaitForMscOML', 'glXWaitForSbcOML', 'PFNGLXGETSYNCVALUESOMLPROC',
+'PFNGLXGETMSCRATEOMLPROC', 'PFNGLXSWAPBUFFERSMSCOMLPROC',
+'PFNGLXWAITFORMSCOMLPROC', 'PFNGLXWAITFORSBCOMLPROC', 'GLX_NV_float_buffer',
+'GLX_SGIX_hyperpipe', 'GLXHyperpipeNetworkSGIX', 'GLXHyperpipeConfigSGIX',
+'GLXPipeRect', 'GLXPipeRectLimits', 'glXQueryHyperpipeNetworkSGIX',
+'glXHyperpipeConfigSGIX', 'glXQueryHyperpipeConfigSGIX',
+'glXDestroyHyperpipeConfigSGIX', 'glXBindHyperpipeSGIX',
+'glXQueryHyperpipeBestAttribSGIX', 'glXHyperpipeAttribSGIX',
+'glXQueryHyperpipeAttribSGIX', 'PFNGLXQUERYHYPERPIPENETWORKSGIXPROC',
+'PFNGLXHYPERPIPECONFIGSGIXPROC', 'PFNGLXQUERYHYPERPIPECONFIGSGIXPROC',
+'PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC', 'PFNGLXBINDHYPERPIPESGIXPROC',
+'PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC', 'PFNGLXHYPERPIPEATTRIBSGIXPROC',
+'PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC', 'GLX_MESA_agp_offset',
+'glXGetAGPOffsetMESA', 'PFNGLXGETAGPOFFSETMESAPROC',
+'GLX_EXT_fbconfig_packed_float', 'GLX_EXT_framebuffer_sRGB',
+'GLX_EXT_texture_from_pixmap', 'glXBindTexImageEXT', 'glXReleaseTexImageEXT',
+'PFNGLXBINDTEXIMAGEEXTPROC', 'PFNGLXRELEASETEXIMAGEEXTPROC',
+'GLX_NV_present_video', 'glXEnumerateVideoDevicesNV', 'glXBindVideoDeviceNV',
+'PFNGLXENUMERATEVIDEODEVICESNVPROC', 'PFNGLXBINDVIDEODEVICENVPROC',
+'GLX_NV_video_output', 'glXGetVideoDeviceNV', 'glXReleaseVideoDeviceNV',
+'glXBindVideoImageNV', 'glXReleaseVideoImageNV', 'glXSendPbufferToVideoNV',
+'glXGetVideoInfoNV', 'PFNGLXGETVIDEODEVICENVPROC',
+'PFNGLXRELEASEVIDEODEVICENVPROC', 'PFNGLXBINDVIDEOIMAGENVPROC',
+'PFNGLXRELEASEVIDEOIMAGENVPROC', 'PFNGLXSENDPBUFFERTOVIDEONVPROC',
+'PFNGLXGETVIDEOINFONVPROC', 'GLX_NV_swap_group', 'glXJoinSwapGroupNV',
+'glXBindSwapBarrierNV', 'glXQuerySwapGroupNV', 'glXQueryMaxSwapGroupsNV',
+'glXQueryFrameCountNV', 'glXResetFrameCountNV', 'PFNGLXJOINSWAPGROUPNVPROC',
+'PFNGLXBINDSWAPBARRIERNVPROC', 'PFNGLXQUERYSWAPGROUPNVPROC',
+'PFNGLXQUERYMAXSWAPGROUPSNVPROC', 'PFNGLXQUERYFRAMECOUNTNVPROC',
+'PFNGLXRESETFRAMECOUNTNVPROC', 'GLX_NV_video_capture',
+'glXBindVideoCaptureDeviceNV', 'glXEnumerateVideoCaptureDevicesNV',
+'glXLockVideoCaptureDeviceNV', 'glXQueryVideoCaptureDeviceNV',
+'glXReleaseVideoCaptureDeviceNV', 'PFNGLXBINDVIDEOCAPTUREDEVICENVPROC',
+'PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC',
+'PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC', 'PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC',
+'PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC', 'GLX_EXT_swap_control',
+'glXSwapIntervalEXT', 'PFNGLXSWAPINTERVALEXTPROC', 'GLX_NV_copy_image',
+'glXCopyImageSubDataNV', 'PFNGLXCOPYIMAGESUBDATANVPROC',
+'GLX_INTEL_swap_event', 'GLX_NV_multisample_coverage']
+# END GENERATED CONTENT (do not edit above this line)
+
+
+
+
+
+
+
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glxext_mesa.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glxext_mesa.py
new file mode 100644
index 0000000000000000000000000000000000000000..b30b5252c24b85352f9faa503a57fb0acd2ae258
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glxext_mesa.py
@@ -0,0 +1,8 @@
+"""This file is currently hand-coded; I don't have a MESA header file to build
+off.
+"""
+
+from ctypes import *
+from pyglet.gl.lib import link_GLX as _link_function
+
+glXSwapIntervalMESA = _link_function('glXSwapIntervalMESA', c_int, [c_int], 'MESA_swap_control')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glxext_nv.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glxext_nv.py
new file mode 100644
index 0000000000000000000000000000000000000000..382292f6b981bdf284994dd291a6f267c4b02f85
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/glxext_nv.py
@@ -0,0 +1,801 @@
+"""Wrapper for http://developer.download.nvidia.com/opengl/includes/glxext.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+"""
+
+from ctypes import *
+from pyglet.gl.lib import link_GLX as _link_function
+from pyglet.gl.lib import c_void
+
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for http://developer.download.nvidia.com/opengl/includes/glxext.h
+
+import pyglet.libs.x11.xlib
+import pyglet.gl.glx
+
+# H (/usr/include/GL/glx.h:26)
+# ARB_get_proc_address (/usr/include/GL/glx.h:317)
+# GLXEXT_LEGACY (/usr/include/GL/glx.h:334)
+GLX_GLXEXT_VERSION = 10 # GL/glxext.h:57
+# ARB_get_proc_address (GL/glxext.h:59)
+# ARB_multisample (GL/glxext.h:62)
+GLX_SAMPLE_BUFFERS_ARB = 100000 # GL/glxext.h:63
+GLX_SAMPLES_ARB = 100001 # GL/glxext.h:64
+# ARB_fbconfig_float (GL/glxext.h:67)
+GLX_RGBA_FLOAT_TYPE_ARB = 8377 # GL/glxext.h:68
+GLX_RGBA_FLOAT_BIT_ARB = 4 # GL/glxext.h:69
+# SGIS_multisample (GL/glxext.h:72)
+GLX_SAMPLE_BUFFERS_SGIS = 100000 # GL/glxext.h:73
+GLX_SAMPLES_SGIS = 100001 # GL/glxext.h:74
+# EXT_visual_info (GL/glxext.h:77)
+GLX_X_VISUAL_TYPE_EXT = 34 # GL/glxext.h:78
+GLX_TRANSPARENT_TYPE_EXT = 35 # GL/glxext.h:79
+GLX_TRANSPARENT_INDEX_VALUE_EXT = 36 # GL/glxext.h:80
+GLX_TRANSPARENT_RED_VALUE_EXT = 37 # GL/glxext.h:81
+GLX_TRANSPARENT_GREEN_VALUE_EXT = 38 # GL/glxext.h:82
+GLX_TRANSPARENT_BLUE_VALUE_EXT = 39 # GL/glxext.h:83
+GLX_TRANSPARENT_ALPHA_VALUE_EXT = 40 # GL/glxext.h:84
+GLX_NONE_EXT = 32768 # GL/glxext.h:85
+GLX_TRUE_COLOR_EXT = 32770 # GL/glxext.h:86
+GLX_DIRECT_COLOR_EXT = 32771 # GL/glxext.h:87
+GLX_PSEUDO_COLOR_EXT = 32772 # GL/glxext.h:88
+GLX_STATIC_COLOR_EXT = 32773 # GL/glxext.h:89
+GLX_GRAY_SCALE_EXT = 32774 # GL/glxext.h:90
+GLX_STATIC_GRAY_EXT = 32775 # GL/glxext.h:91
+GLX_TRANSPARENT_RGB_EXT = 32776 # GL/glxext.h:92
+GLX_TRANSPARENT_INDEX_EXT = 32777 # GL/glxext.h:93
+# SGI_swap_control (GL/glxext.h:96)
+# SGI_video_sync (GL/glxext.h:99)
+# SGI_make_current_read (GL/glxext.h:102)
+# SGIX_video_source (GL/glxext.h:105)
+# EXT_visual_rating (GL/glxext.h:108)
+GLX_VISUAL_CAVEAT_EXT = 32 # GL/glxext.h:109
+GLX_SLOW_VISUAL_EXT = 32769 # GL/glxext.h:110
+GLX_NON_CONFORMANT_VISUAL_EXT = 32781 # GL/glxext.h:111
+# EXT_import_context (GL/glxext.h:115)
+GLX_SHARE_CONTEXT_EXT = 32778 # GL/glxext.h:116
+GLX_VISUAL_ID_EXT = 32779 # GL/glxext.h:117
+GLX_SCREEN_EXT = 32780 # GL/glxext.h:118
+# SGIX_fbconfig (GL/glxext.h:121)
+GLX_WINDOW_BIT_SGIX = 1 # GL/glxext.h:122
+GLX_PIXMAP_BIT_SGIX = 2 # GL/glxext.h:123
+GLX_RGBA_BIT_SGIX = 1 # GL/glxext.h:124
+GLX_COLOR_INDEX_BIT_SGIX = 2 # GL/glxext.h:125
+GLX_DRAWABLE_TYPE_SGIX = 32784 # GL/glxext.h:126
+GLX_RENDER_TYPE_SGIX = 32785 # GL/glxext.h:127
+GLX_X_RENDERABLE_SGIX = 32786 # GL/glxext.h:128
+GLX_FBCONFIG_ID_SGIX = 32787 # GL/glxext.h:129
+GLX_RGBA_TYPE_SGIX = 32788 # GL/glxext.h:130
+GLX_COLOR_INDEX_TYPE_SGIX = 32789 # GL/glxext.h:131
+# SGIX_pbuffer (GL/glxext.h:135)
+GLX_PBUFFER_BIT_SGIX = 4 # GL/glxext.h:136
+GLX_BUFFER_CLOBBER_MASK_SGIX = 134217728 # GL/glxext.h:137
+GLX_FRONT_LEFT_BUFFER_BIT_SGIX = 1 # GL/glxext.h:138
+GLX_FRONT_RIGHT_BUFFER_BIT_SGIX = 2 # GL/glxext.h:139
+GLX_BACK_LEFT_BUFFER_BIT_SGIX = 4 # GL/glxext.h:140
+GLX_BACK_RIGHT_BUFFER_BIT_SGIX = 8 # GL/glxext.h:141
+GLX_AUX_BUFFERS_BIT_SGIX = 16 # GL/glxext.h:142
+GLX_DEPTH_BUFFER_BIT_SGIX = 32 # GL/glxext.h:143
+GLX_STENCIL_BUFFER_BIT_SGIX = 64 # GL/glxext.h:144
+GLX_ACCUM_BUFFER_BIT_SGIX = 128 # GL/glxext.h:145
+GLX_SAMPLE_BUFFERS_BIT_SGIX = 256 # GL/glxext.h:146
+GLX_MAX_PBUFFER_WIDTH_SGIX = 32790 # GL/glxext.h:147
+GLX_MAX_PBUFFER_HEIGHT_SGIX = 32791 # GL/glxext.h:148
+GLX_MAX_PBUFFER_PIXELS_SGIX = 32792 # GL/glxext.h:149
+GLX_OPTIMAL_PBUFFER_WIDTH_SGIX = 32793 # GL/glxext.h:150
+GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX = 32794 # GL/glxext.h:151
+GLX_PRESERVED_CONTENTS_SGIX = 32795 # GL/glxext.h:152
+GLX_LARGEST_PBUFFER_SGIX = 32796 # GL/glxext.h:153
+GLX_WIDTH_SGIX = 32797 # GL/glxext.h:154
+GLX_HEIGHT_SGIX = 32798 # GL/glxext.h:155
+GLX_EVENT_MASK_SGIX = 32799 # GL/glxext.h:156
+GLX_DAMAGED_SGIX = 32800 # GL/glxext.h:157
+GLX_SAVED_SGIX = 32801 # GL/glxext.h:158
+GLX_WINDOW_SGIX = 32802 # GL/glxext.h:159
+GLX_PBUFFER_SGIX = 32803 # GL/glxext.h:160
+# SGI_cushion (GL/glxext.h:163)
+# SGIX_video_resize (GL/glxext.h:166)
+GLX_SYNC_FRAME_SGIX = 0 # GL/glxext.h:167
+GLX_SYNC_SWAP_SGIX = 1 # GL/glxext.h:168
+# SGIX_dmbuffer (GL/glxext.h:171)
+GLX_DIGITAL_MEDIA_PBUFFER_SGIX = 32804 # GL/glxext.h:172
+# SGIX_swap_group (GL/glxext.h:175)
+# SGIX_swap_barrier (GL/glxext.h:178)
+# SGIS_blended_overlay (GL/glxext.h:181)
+GLX_BLENDED_RGBA_SGIS = 32805 # GL/glxext.h:182
+# SGIS_shared_multisample (GL/glxext.h:185)
+GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS = 32806 # GL/glxext.h:186
+GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS = 32807 # GL/glxext.h:187
+# SUN_get_transparent_index (GL/glxext.h:190)
+# 3DFX_multisample (GL/glxext.h:193)
+GLX_SAMPLE_BUFFERS_3DFX = 32848 # GL/glxext.h:194
+GLX_SAMPLES_3DFX = 32849 # GL/glxext.h:195
+# MESA_copy_sub_buffer (GL/glxext.h:198)
+# MESA_pixmap_colormap (GL/glxext.h:201)
+# MESA_release_buffers (GL/glxext.h:204)
+# MESA_set_3dfx_mode (GL/glxext.h:207)
+GLX_3DFX_WINDOW_MODE_MESA = 1 # GL/glxext.h:208
+GLX_3DFX_FULLSCREEN_MODE_MESA = 2 # GL/glxext.h:209
+# SGIX_visual_select_group (GL/glxext.h:212)
+GLX_VISUAL_SELECT_GROUP_SGIX = 32808 # GL/glxext.h:213
+# OML_swap_method (GL/glxext.h:216)
+GLX_SWAP_METHOD_OML = 32864 # GL/glxext.h:217
+GLX_SWAP_EXCHANGE_OML = 32865 # GL/glxext.h:218
+GLX_SWAP_COPY_OML = 32866 # GL/glxext.h:219
+GLX_SWAP_UNDEFINED_OML = 32867 # GL/glxext.h:220
+# OML_sync_control (GL/glxext.h:223)
+# NV_float_buffer (GL/glxext.h:226)
+GLX_FLOAT_COMPONENTS_NV = 8368 # GL/glxext.h:227
+# SGIX_hyperpipe (GL/glxext.h:230)
+GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX = 80 # GL/glxext.h:231
+GLX_BAD_HYPERPIPE_CONFIG_SGIX = 91 # GL/glxext.h:232
+GLX_BAD_HYPERPIPE_SGIX = 92 # GL/glxext.h:233
+GLX_HYPERPIPE_DISPLAY_PIPE_SGIX = 1 # GL/glxext.h:234
+GLX_HYPERPIPE_RENDER_PIPE_SGIX = 2 # GL/glxext.h:235
+GLX_PIPE_RECT_SGIX = 1 # GL/glxext.h:236
+GLX_PIPE_RECT_LIMITS_SGIX = 2 # GL/glxext.h:237
+GLX_HYPERPIPE_STEREO_SGIX = 3 # GL/glxext.h:238
+GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX = 4 # GL/glxext.h:239
+GLX_HYPERPIPE_ID_SGIX = 32816 # GL/glxext.h:240
+# MESA_agp_offset (GL/glxext.h:243)
+# ARB_get_proc_address (GL/glxext.h:249)
+# SGIX_video_source (GL/glxext.h:256)
+XID = pyglet.libs.x11.xlib.XID
+GLXVideoSourceSGIX = XID # GL/glxext.h:257
+# SGIX_fbconfig (GL/glxext.h:260)
+GLXFBConfigIDSGIX = XID # GL/glxext.h:261
+class struct___GLXFBConfigRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXFBConfigRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct___GLXFBConfigRec(Structure):
+ __slots__ = [
+ ]
+struct___GLXFBConfigRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GLXFBConfigSGIX = POINTER(struct___GLXFBConfigRec) # GL/glxext.h:262
+# SGIX_pbuffer (GL/glxext.h:265)
+GLXPbufferSGIX = XID # GL/glxext.h:266
+class struct_anon_106(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'drawable',
+ 'event_type',
+ 'draw_type',
+ 'mask',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'count',
+ ]
+Display = pyglet.libs.x11.xlib.Display
+GLXDrawable = pyglet.gl.glx.GLXDrawable
+struct_anon_106._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('drawable', GLXDrawable),
+ ('event_type', c_int),
+ ('draw_type', c_int),
+ ('mask', c_uint),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('count', c_int),
+]
+
+GLXBufferClobberEventSGIX = struct_anon_106 # GL/glxext.h:279
+# NV_swap_group (GL/glxext.h:282)
+# NV_video_out (GL/glxext.h:285)
+GLXVideoDeviceNV = c_uint # GL/glxext.h:290
+GLX_VIDEO_OUT_COLOR_NV = 8387 # GL/glxext.h:293
+GLX_VIDEO_OUT_ALPHA_NV = 8388 # GL/glxext.h:294
+GLX_VIDEO_OUT_DEPTH_NV = 8389 # GL/glxext.h:295
+GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV = 8390 # GL/glxext.h:296
+GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV = 8391 # GL/glxext.h:297
+GLX_VIDEO_OUT_FRAME_NV = 8392 # GL/glxext.h:300
+GLX_VIDEO_OUT_FIELD_1_NV = 8393 # GL/glxext.h:301
+GLX_VIDEO_OUT_FIELD_2_NV = 8394 # GL/glxext.h:302
+# EXT_texture_from_pixmap (GL/glxext.h:305)
+GLX_BIND_TO_TEXTURE_RGB_EXT = 8400 # GL/glxext.h:307
+GLX_BIND_TO_TEXTURE_RGBA_EXT = 8401 # GL/glxext.h:308
+GLX_BIND_TO_MIPMAP_TEXTURE_EXT = 8402 # GL/glxext.h:309
+GLX_BIND_TO_TEXTURE_TARGETS_EXT = 8403 # GL/glxext.h:310
+GLX_Y_INVERTED_EXT = 8404 # GL/glxext.h:311
+GLX_TEXTURE_FORMAT_EXT = 8405 # GL/glxext.h:314
+GLX_TEXTURE_TARGET_EXT = 8406 # GL/glxext.h:315
+GLX_MIPMAP_TEXTURE_EXT = 8407 # GL/glxext.h:316
+GLX_TEXTURE_FORMAT_NONE_EXT = 8408 # GL/glxext.h:319
+GLX_TEXTURE_FORMAT_RGB_EXT = 8409 # GL/glxext.h:320
+GLX_TEXTURE_FORMAT_RGBA_EXT = 8410 # GL/glxext.h:321
+GLX_TEXTURE_1D_BIT_EXT = 1 # GL/glxext.h:324
+GLX_TEXTURE_2D_BIT_EXT = 2 # GL/glxext.h:325
+GLX_TEXTURE_RECTANGLE_BIT_EXT = 4 # GL/glxext.h:326
+GLX_TEXTURE_1D_EXT = 8411 # GL/glxext.h:329
+GLX_TEXTURE_2D_EXT = 8412 # GL/glxext.h:330
+GLX_TEXTURE_RECTANGLE_EXT = 8413 # GL/glxext.h:331
+GLX_FRONT_LEFT_EXT = 8414 # GL/glxext.h:337
+GLX_FRONT_RIGHT_EXT = 8415 # GL/glxext.h:338
+GLX_BACK_LEFT_EXT = 8416 # GL/glxext.h:339
+GLX_BACK_RIGHT_EXT = 8417 # GL/glxext.h:340
+GLX_FRONT_EXT = 8414 # GL/glxext.h:341
+GLX_BACK_EXT = 8416 # GL/glxext.h:342
+GLX_AUX0_EXT = 8418 # GL/glxext.h:343
+GLX_AUX1_EXT = 8419 # GL/glxext.h:344
+GLX_AUX2_EXT = 8420 # GL/glxext.h:345
+GLX_AUX3_EXT = 8421 # GL/glxext.h:346
+GLX_AUX4_EXT = 8422 # GL/glxext.h:347
+GLX_AUX5_EXT = 8423 # GL/glxext.h:348
+GLX_AUX6_EXT = 8424 # GL/glxext.h:349
+GLX_AUX7_EXT = 8425 # GL/glxext.h:350
+GLX_AUX8_EXT = 8426 # GL/glxext.h:351
+GLX_AUX9_EXT = 8427 # GL/glxext.h:352
+# ARB_get_proc_address (GL/glxext.h:373)
+# ARB_multisample (GL/glxext.h:377)
+GLX_ARB_multisample = 1 # GL/glxext.h:378
+# ARB_fbconfig_float (GL/glxext.h:381)
+GLX_ARB_fbconfig_float = 1 # GL/glxext.h:382
+# SGIS_multisample (GL/glxext.h:385)
+GLX_SGIS_multisample = 1 # GL/glxext.h:386
+# EXT_visual_info (GL/glxext.h:389)
+GLX_EXT_visual_info = 1 # GL/glxext.h:390
+# SGI_swap_control (GL/glxext.h:393)
+GLX_SGI_swap_control = 1 # GL/glxext.h:394
+# GL/glxext.h:396
+glXSwapIntervalSGI = _link_function('glXSwapIntervalSGI', c_int, [c_int], 'SGI_swap_control')
+
+PFNGLXSWAPINTERVALSGIPROC = CFUNCTYPE(c_int, c_int) # GL/glxext.h:398
+# SGI_video_sync (GL/glxext.h:401)
+GLX_SGI_video_sync = 1 # GL/glxext.h:402
+# GL/glxext.h:404
+glXGetVideoSyncSGI = _link_function('glXGetVideoSyncSGI', c_int, [POINTER(c_uint)], 'SGI_video_sync')
+
+# GL/glxext.h:405
+glXWaitVideoSyncSGI = _link_function('glXWaitVideoSyncSGI', c_int, [c_int, c_int, POINTER(c_uint)], 'SGI_video_sync')
+
+# GL/glxext.h:406
+glXGetRefreshRateSGI = _link_function('glXGetRefreshRateSGI', c_int, [POINTER(c_uint)], 'SGI_video_sync')
+
+PFNGLXGETVIDEOSYNCSGIPROC = CFUNCTYPE(c_int, POINTER(c_uint)) # GL/glxext.h:408
+PFNGLXWAITVIDEOSYNCSGIPROC = CFUNCTYPE(c_int, c_int, c_int, POINTER(c_uint)) # GL/glxext.h:409
+PFNGLXGETREFRESHRATESGIPROC = CFUNCTYPE(c_int, POINTER(c_uint)) # GL/glxext.h:410
+# SGI_make_current_read (GL/glxext.h:413)
+GLX_SGI_make_current_read = 1 # GL/glxext.h:414
+GLXContext = pyglet.gl.glx.GLXContext
+# GL/glxext.h:416
+glXMakeCurrentReadSGI = _link_function('glXMakeCurrentReadSGI', c_int, [POINTER(Display), GLXDrawable, GLXDrawable, GLXContext], 'SGI_make_current_read')
+
+# GL/glxext.h:417
+glXGetCurrentReadDrawableSGI = _link_function('glXGetCurrentReadDrawableSGI', GLXDrawable, [], 'SGI_make_current_read')
+
+PFNGLXMAKECURRENTREADSGIPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, GLXDrawable, GLXContext) # GL/glxext.h:419
+PFNGLXGETCURRENTREADDRAWABLESGIPROC = CFUNCTYPE(GLXDrawable) # GL/glxext.h:420
+# SGIX_video_source (GL/glxext.h:423)
+GLX_SGIX_video_source = 1 # GL/glxext.h:424
+# EXT_visual_rating (GL/glxext.h:435)
+GLX_EXT_visual_rating = 1 # GL/glxext.h:436
+# EXT_import_context (GL/glxext.h:439)
+GLX_EXT_import_context = 1 # GL/glxext.h:440
+# GL/glxext.h:442
+glXGetCurrentDisplayEXT = _link_function('glXGetCurrentDisplayEXT', POINTER(Display), [], 'EXT_import_context')
+
+# GL/glxext.h:443
+glXQueryContextInfoEXT = _link_function('glXQueryContextInfoEXT', c_int, [POINTER(Display), GLXContext, c_int, POINTER(c_int)], 'EXT_import_context')
+
+GLXContextID = pyglet.gl.glx.GLXContextID
+# GL/glxext.h:444
+glXGetContextIDEXT = _link_function('glXGetContextIDEXT', GLXContextID, [GLXContext], 'EXT_import_context')
+
+# GL/glxext.h:445
+glXImportContextEXT = _link_function('glXImportContextEXT', GLXContext, [POINTER(Display), GLXContextID], 'EXT_import_context')
+
+# GL/glxext.h:446
+glXFreeContextEXT = _link_function('glXFreeContextEXT', None, [POINTER(Display), GLXContext], 'EXT_import_context')
+
+PFNGLXGETCURRENTDISPLAYEXTPROC = CFUNCTYPE(POINTER(Display)) # GL/glxext.h:448
+PFNGLXQUERYCONTEXTINFOEXTPROC = CFUNCTYPE(c_int, POINTER(Display), GLXContext, c_int, POINTER(c_int)) # GL/glxext.h:449
+PFNGLXGETCONTEXTIDEXTPROC = CFUNCTYPE(GLXContextID, GLXContext) # GL/glxext.h:450
+PFNGLXIMPORTCONTEXTEXTPROC = CFUNCTYPE(GLXContext, POINTER(Display), GLXContextID) # GL/glxext.h:451
+PFNGLXFREECONTEXTEXTPROC = CFUNCTYPE(None, POINTER(Display), GLXContext) # GL/glxext.h:452
+# SGIX_fbconfig (GL/glxext.h:455)
+GLX_SGIX_fbconfig = 1 # GL/glxext.h:456
+# GL/glxext.h:458
+glXGetFBConfigAttribSGIX = _link_function('glXGetFBConfigAttribSGIX', c_int, [POINTER(Display), GLXFBConfigSGIX, c_int, POINTER(c_int)], 'SGIX_fbconfig')
+
+# GL/glxext.h:459
+glXChooseFBConfigSGIX = _link_function('glXChooseFBConfigSGIX', POINTER(GLXFBConfigSGIX), [POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)], 'SGIX_fbconfig')
+
+GLXPixmap = pyglet.gl.glx.GLXPixmap
+Pixmap = pyglet.libs.x11.xlib.Pixmap
+# GL/glxext.h:460
+glXCreateGLXPixmapWithConfigSGIX = _link_function('glXCreateGLXPixmapWithConfigSGIX', GLXPixmap, [POINTER(Display), GLXFBConfigSGIX, Pixmap], 'SGIX_fbconfig')
+
+# GL/glxext.h:461
+glXCreateContextWithConfigSGIX = _link_function('glXCreateContextWithConfigSGIX', GLXContext, [POINTER(Display), GLXFBConfigSGIX, c_int, GLXContext, c_int], 'SGIX_fbconfig')
+
+XVisualInfo = pyglet.libs.x11.xlib.XVisualInfo
+# GL/glxext.h:462
+glXGetVisualFromFBConfigSGIX = _link_function('glXGetVisualFromFBConfigSGIX', POINTER(XVisualInfo), [POINTER(Display), GLXFBConfigSGIX], 'SGIX_fbconfig')
+
+# GL/glxext.h:463
+glXGetFBConfigFromVisualSGIX = _link_function('glXGetFBConfigFromVisualSGIX', GLXFBConfigSGIX, [POINTER(Display), POINTER(XVisualInfo)], 'SGIX_fbconfig')
+
+PFNGLXGETFBCONFIGATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), GLXFBConfigSGIX, c_int, POINTER(c_int)) # GL/glxext.h:465
+PFNGLXCHOOSEFBCONFIGSGIXPROC = CFUNCTYPE(POINTER(GLXFBConfigSGIX), POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)) # GL/glxext.h:466
+PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC = CFUNCTYPE(GLXPixmap, POINTER(Display), GLXFBConfigSGIX, Pixmap) # GL/glxext.h:467
+PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC = CFUNCTYPE(GLXContext, POINTER(Display), GLXFBConfigSGIX, c_int, GLXContext, c_int) # GL/glxext.h:468
+PFNGLXGETVISUALFROMFBCONFIGSGIXPROC = CFUNCTYPE(POINTER(XVisualInfo), POINTER(Display), GLXFBConfigSGIX) # GL/glxext.h:469
+PFNGLXGETFBCONFIGFROMVISUALSGIXPROC = CFUNCTYPE(GLXFBConfigSGIX, POINTER(Display), POINTER(XVisualInfo)) # GL/glxext.h:470
+# SGIX_pbuffer (GL/glxext.h:473)
+GLX_SGIX_pbuffer = 1 # GL/glxext.h:474
+# GL/glxext.h:476
+glXCreateGLXPbufferSGIX = _link_function('glXCreateGLXPbufferSGIX', GLXPbufferSGIX, [POINTER(Display), GLXFBConfigSGIX, c_uint, c_uint, POINTER(c_int)], 'SGIX_pbuffer')
+
+# GL/glxext.h:477
+glXDestroyGLXPbufferSGIX = _link_function('glXDestroyGLXPbufferSGIX', None, [POINTER(Display), GLXPbufferSGIX], 'SGIX_pbuffer')
+
+# GL/glxext.h:478
+glXQueryGLXPbufferSGIX = _link_function('glXQueryGLXPbufferSGIX', c_int, [POINTER(Display), GLXPbufferSGIX, c_int, POINTER(c_uint)], 'SGIX_pbuffer')
+
+# GL/glxext.h:479
+glXSelectEventSGIX = _link_function('glXSelectEventSGIX', None, [POINTER(Display), GLXDrawable, c_ulong], 'SGIX_pbuffer')
+
+# GL/glxext.h:480
+glXGetSelectedEventSGIX = _link_function('glXGetSelectedEventSGIX', None, [POINTER(Display), GLXDrawable, POINTER(c_ulong)], 'SGIX_pbuffer')
+
+PFNGLXCREATEGLXPBUFFERSGIXPROC = CFUNCTYPE(GLXPbufferSGIX, POINTER(Display), GLXFBConfigSGIX, c_uint, c_uint, POINTER(c_int)) # GL/glxext.h:482
+PFNGLXDESTROYGLXPBUFFERSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXPbufferSGIX) # GL/glxext.h:483
+PFNGLXQUERYGLXPBUFFERSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), GLXPbufferSGIX, c_int, POINTER(c_uint)) # GL/glxext.h:484
+PFNGLXSELECTEVENTSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_ulong) # GL/glxext.h:485
+PFNGLXGETSELECTEDEVENTSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, POINTER(c_ulong)) # GL/glxext.h:486
+# SGI_cushion (GL/glxext.h:489)
+GLX_SGI_cushion = 1 # GL/glxext.h:490
+Window = pyglet.libs.x11.xlib.Window
+# GL/glxext.h:492
+glXCushionSGI = _link_function('glXCushionSGI', None, [POINTER(Display), Window, c_float], 'SGI_cushion')
+
+PFNGLXCUSHIONSGIPROC = CFUNCTYPE(None, POINTER(Display), Window, c_float) # GL/glxext.h:494
+# SGIX_video_resize (GL/glxext.h:497)
+GLX_SGIX_video_resize = 1 # GL/glxext.h:498
+# GL/glxext.h:500
+glXBindChannelToWindowSGIX = _link_function('glXBindChannelToWindowSGIX', c_int, [POINTER(Display), c_int, c_int, Window], 'SGIX_video_resize')
+
+# GL/glxext.h:501
+glXChannelRectSGIX = _link_function('glXChannelRectSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, c_int, c_int, c_int], 'SGIX_video_resize')
+
+# GL/glxext.h:502
+glXQueryChannelRectSGIX = _link_function('glXQueryChannelRectSGIX', c_int, [POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)], 'SGIX_video_resize')
+
+# GL/glxext.h:503
+glXQueryChannelDeltasSGIX = _link_function('glXQueryChannelDeltasSGIX', c_int, [POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)], 'SGIX_video_resize')
+
+GLenum = c_uint # /usr/include/GL/gl.h:153
+# GL/glxext.h:504
+glXChannelRectSyncSGIX = _link_function('glXChannelRectSyncSGIX', c_int, [POINTER(Display), c_int, c_int, GLenum], 'SGIX_video_resize')
+
+PFNGLXBINDCHANNELTOWINDOWSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, Window) # GL/glxext.h:506
+PFNGLXCHANNELRECTSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, c_int, c_int, c_int) # GL/glxext.h:507
+PFNGLXQUERYCHANNELRECTSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)) # GL/glxext.h:508
+PFNGLXQUERYCHANNELDELTASSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)) # GL/glxext.h:509
+PFNGLXCHANNELRECTSYNCSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, GLenum) # GL/glxext.h:510
+# SGIX_dmbuffer (GL/glxext.h:513)
+GLX_SGIX_dmbuffer = 1 # GL/glxext.h:514
+# SGIX_swap_group (GL/glxext.h:523)
+GLX_SGIX_swap_group = 1 # GL/glxext.h:524
+# GL/glxext.h:526
+glXJoinSwapGroupSGIX = _link_function('glXJoinSwapGroupSGIX', None, [POINTER(Display), GLXDrawable, GLXDrawable], 'SGIX_swap_group')
+
+PFNGLXJOINSWAPGROUPSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, GLXDrawable) # GL/glxext.h:528
+# SGIX_swap_barrier (GL/glxext.h:531)
+GLX_SGIX_swap_barrier = 1 # GL/glxext.h:532
+# GL/glxext.h:534
+glXBindSwapBarrierSGIX = _link_function('glXBindSwapBarrierSGIX', None, [POINTER(Display), GLXDrawable, c_int], 'SGIX_swap_barrier')
+
+# GL/glxext.h:535
+glXQueryMaxSwapBarriersSGIX = _link_function('glXQueryMaxSwapBarriersSGIX', c_int, [POINTER(Display), c_int, POINTER(c_int)], 'SGIX_swap_barrier')
+
+PFNGLXBINDSWAPBARRIERSGIXPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int) # GL/glxext.h:537
+PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, POINTER(c_int)) # GL/glxext.h:538
+# SUN_get_transparent_index (GL/glxext.h:541)
+GLX_SUN_get_transparent_index = 1 # GL/glxext.h:542
+# GL/glxext.h:544
+glXGetTransparentIndexSUN = _link_function('glXGetTransparentIndexSUN', c_int, [POINTER(Display), Window, Window, POINTER(c_long)], 'SUN_get_transparent_index')
+
+PFNGLXGETTRANSPARENTINDEXSUNPROC = CFUNCTYPE(c_int, POINTER(Display), Window, Window, POINTER(c_long)) # GL/glxext.h:546
+# MESA_copy_sub_buffer (GL/glxext.h:549)
+GLX_MESA_copy_sub_buffer = 1 # GL/glxext.h:550
+# GL/glxext.h:552
+glXCopySubBufferMESA = _link_function('glXCopySubBufferMESA', None, [POINTER(Display), GLXDrawable, c_int, c_int, c_int, c_int], 'MESA_copy_sub_buffer')
+
+PFNGLXCOPYSUBBUFFERMESAPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int, c_int, c_int, c_int) # GL/glxext.h:554
+# MESA_pixmap_colormap (GL/glxext.h:557)
+GLX_MESA_pixmap_colormap = 1 # GL/glxext.h:558
+Colormap = pyglet.libs.x11.xlib.Colormap
+# GL/glxext.h:560
+glXCreateGLXPixmapMESA = _link_function('glXCreateGLXPixmapMESA', GLXPixmap, [POINTER(Display), POINTER(XVisualInfo), Pixmap, Colormap], 'MESA_pixmap_colormap')
+
+PFNGLXCREATEGLXPIXMAPMESAPROC = CFUNCTYPE(GLXPixmap, POINTER(Display), POINTER(XVisualInfo), Pixmap, Colormap) # GL/glxext.h:562
+# MESA_release_buffers (GL/glxext.h:565)
+GLX_MESA_release_buffers = 1 # GL/glxext.h:566
+# GL/glxext.h:568
+glXReleaseBuffersMESA = _link_function('glXReleaseBuffersMESA', c_int, [POINTER(Display), GLXDrawable], 'MESA_release_buffers')
+
+PFNGLXRELEASEBUFFERSMESAPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable) # GL/glxext.h:570
+# MESA_set_3dfx_mode (GL/glxext.h:573)
+GLX_MESA_set_3dfx_mode = 1 # GL/glxext.h:574
+# GL/glxext.h:576
+glXSet3DfxModeMESA = _link_function('glXSet3DfxModeMESA', c_int, [c_int], 'MESA_set_3dfx_mode')
+
+PFNGLXSET3DFXMODEMESAPROC = CFUNCTYPE(c_int, c_int) # GL/glxext.h:578
+# SGIX_visual_select_group (GL/glxext.h:581)
+GLX_SGIX_visual_select_group = 1 # GL/glxext.h:582
+# OML_swap_method (GL/glxext.h:585)
+GLX_OML_swap_method = 1 # GL/glxext.h:586
+# OML_sync_control (GL/glxext.h:589)
+GLX_OML_sync_control = 1 # GL/glxext.h:590
+# GL/glxext.h:592
+glXGetSyncValuesOML = _link_function('glXGetSyncValuesOML', c_int, [POINTER(Display), GLXDrawable, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)], 'OML_sync_control')
+
+# GL/glxext.h:593
+glXGetMscRateOML = _link_function('glXGetMscRateOML', c_int, [POINTER(Display), GLXDrawable, POINTER(c_int32), POINTER(c_int32)], 'OML_sync_control')
+
+# GL/glxext.h:594
+glXSwapBuffersMscOML = _link_function('glXSwapBuffersMscOML', c_int64, [POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64], 'OML_sync_control')
+
+# GL/glxext.h:595
+glXWaitForMscOML = _link_function('glXWaitForMscOML', c_int, [POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)], 'OML_sync_control')
+
+# GL/glxext.h:596
+glXWaitForSbcOML = _link_function('glXWaitForSbcOML', c_int, [POINTER(Display), GLXDrawable, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)], 'OML_sync_control')
+
+PFNGLXGETSYNCVALUESOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)) # GL/glxext.h:598
+PFNGLXGETMSCRATEOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(c_int32), POINTER(c_int32)) # GL/glxext.h:599
+PFNGLXSWAPBUFFERSMSCOMLPROC = CFUNCTYPE(c_int64, POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64) # GL/glxext.h:600
+PFNGLXWAITFORMSCOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, c_int64, c_int64, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)) # GL/glxext.h:601
+PFNGLXWAITFORSBCOMLPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, c_int64, POINTER(c_int64), POINTER(c_int64), POINTER(c_int64)) # GL/glxext.h:602
+# NV_float_buffer (GL/glxext.h:605)
+GLX_NV_float_buffer = 1 # GL/glxext.h:606
+# SGIX_hyperpipe (GL/glxext.h:609)
+GLX_SGIX_hyperpipe = 1 # GL/glxext.h:610
+class struct_anon_107(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'networkId',
+ ]
+struct_anon_107._fields_ = [
+ ('pipeName', c_char * 80),
+ ('networkId', c_int),
+]
+
+GLXHyperpipeNetworkSGIX = struct_anon_107 # GL/glxext.h:615
+class struct_anon_108(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'channel',
+ 'participationType',
+ 'timeSlice',
+ ]
+struct_anon_108._fields_ = [
+ ('pipeName', c_char * 80),
+ ('channel', c_int),
+ ('participationType', c_uint),
+ ('timeSlice', c_int),
+]
+
+GLXHyperpipeConfigSGIX = struct_anon_108 # GL/glxext.h:623
+class struct_anon_109(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'srcXOrigin',
+ 'srcYOrigin',
+ 'srcWidth',
+ 'srcHeight',
+ 'destXOrigin',
+ 'destYOrigin',
+ 'destWidth',
+ 'destHeight',
+ ]
+struct_anon_109._fields_ = [
+ ('pipeName', c_char * 80),
+ ('srcXOrigin', c_int),
+ ('srcYOrigin', c_int),
+ ('srcWidth', c_int),
+ ('srcHeight', c_int),
+ ('destXOrigin', c_int),
+ ('destYOrigin', c_int),
+ ('destWidth', c_int),
+ ('destHeight', c_int),
+]
+
+GLXPipeRect = struct_anon_109 # GL/glxext.h:629
+class struct_anon_110(Structure):
+ __slots__ = [
+ 'pipeName',
+ 'XOrigin',
+ 'YOrigin',
+ 'maxHeight',
+ 'maxWidth',
+ ]
+struct_anon_110._fields_ = [
+ ('pipeName', c_char * 80),
+ ('XOrigin', c_int),
+ ('YOrigin', c_int),
+ ('maxHeight', c_int),
+ ('maxWidth', c_int),
+]
+
+GLXPipeRectLimits = struct_anon_110 # GL/glxext.h:634
+# GL/glxext.h:637
+glXQueryHyperpipeNetworkSGIX = _link_function('glXQueryHyperpipeNetworkSGIX', POINTER(GLXHyperpipeNetworkSGIX), [POINTER(Display), POINTER(c_int)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:638
+glXHyperpipeConfigSGIX = _link_function('glXHyperpipeConfigSGIX', c_int, [POINTER(Display), c_int, c_int, POINTER(GLXHyperpipeConfigSGIX), POINTER(c_int)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:639
+glXQueryHyperpipeConfigSGIX = _link_function('glXQueryHyperpipeConfigSGIX', POINTER(GLXHyperpipeConfigSGIX), [POINTER(Display), c_int, POINTER(c_int)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:640
+glXDestroyHyperpipeConfigSGIX = _link_function('glXDestroyHyperpipeConfigSGIX', c_int, [POINTER(Display), c_int], 'SGIX_hyperpipe')
+
+# GL/glxext.h:641
+glXBindHyperpipeSGIX = _link_function('glXBindHyperpipeSGIX', c_int, [POINTER(Display), c_int], 'SGIX_hyperpipe')
+
+# GL/glxext.h:642
+glXQueryHyperpipeBestAttribSGIX = _link_function('glXQueryHyperpipeBestAttribSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, POINTER(None), POINTER(None)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:643
+glXHyperpipeAttribSGIX = _link_function('glXHyperpipeAttribSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, POINTER(None)], 'SGIX_hyperpipe')
+
+# GL/glxext.h:644
+glXQueryHyperpipeAttribSGIX = _link_function('glXQueryHyperpipeAttribSGIX', c_int, [POINTER(Display), c_int, c_int, c_int, POINTER(None)], 'SGIX_hyperpipe')
+
+PFNGLXQUERYHYPERPIPENETWORKSGIXPROC = CFUNCTYPE(POINTER(GLXHyperpipeNetworkSGIX), POINTER(Display), POINTER(c_int)) # GL/glxext.h:646
+PFNGLXHYPERPIPECONFIGSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(GLXHyperpipeConfigSGIX), POINTER(c_int)) # GL/glxext.h:647
+PFNGLXQUERYHYPERPIPECONFIGSGIXPROC = CFUNCTYPE(POINTER(GLXHyperpipeConfigSGIX), POINTER(Display), c_int, POINTER(c_int)) # GL/glxext.h:648
+PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int) # GL/glxext.h:649
+PFNGLXBINDHYPERPIPESGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int) # GL/glxext.h:650
+PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, POINTER(None), POINTER(None)) # GL/glxext.h:651
+PFNGLXHYPERPIPEATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, POINTER(None)) # GL/glxext.h:652
+PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, c_int, POINTER(None)) # GL/glxext.h:653
+# MESA_agp_offset (GL/glxext.h:656)
+GLX_MESA_agp_offset = 1 # GL/glxext.h:657
+# GL/glxext.h:659
+glXGetAGPOffsetMESA = _link_function('glXGetAGPOffsetMESA', c_uint, [POINTER(None)], 'MESA_agp_offset')
+
+PFNGLXGETAGPOFFSETMESAPROC = CFUNCTYPE(c_uint, POINTER(None)) # GL/glxext.h:661
+# NV_vertex_array_range (GL/glxext.h:667)
+GLX_NV_vertex_array_range = 1 # GL/glxext.h:668
+GLsizei = pyglet.gl.glx.GLsizei
+GLfloat = pyglet.gl.glx.GLfloat
+# GL/glxext.h:670
+glXAllocateMemoryNV = _link_function('glXAllocateMemoryNV', POINTER(c_void), [GLsizei, GLfloat, GLfloat, GLfloat], 'NV_vertex_array_range')
+
+GLvoid = pyglet.gl.glx.GLvoid
+# GL/glxext.h:673
+glXFreeMemoryNV = _link_function('glXFreeMemoryNV', None, [POINTER(GLvoid)], 'NV_vertex_array_range')
+
+PFNGLXALLOCATEMEMORYNVPROC = pyglet.gl.glx.PFNGLXALLOCATEMEMORYNVPROC
+PFNGLXFREEMEMORYNVPROC = pyglet.gl.glx.PFNGLXFREEMEMORYNVPROC
+# NV_swap_group (GL/glxext.h:683)
+GLX_NV_swap_group = 1 # GL/glxext.h:684
+GLuint = pyglet.gl.glx.GLuint
+# GL/glxext.h:686
+glXJoinSwapGroupNV = _link_function('glXJoinSwapGroupNV', c_int, [POINTER(Display), GLXDrawable, GLuint], 'NV_swap_group')
+
+# GL/glxext.h:689
+glXBindSwapBarrierNV = _link_function('glXBindSwapBarrierNV', c_int, [POINTER(Display), GLuint, GLuint], 'NV_swap_group')
+
+# GL/glxext.h:691
+glXQuerySwapGroupNV = _link_function('glXQuerySwapGroupNV', c_int, [POINTER(Display), GLXDrawable, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# GL/glxext.h:694
+glXQueryMaxSwapGroupsNV = _link_function('glXQueryMaxSwapGroupsNV', c_int, [POINTER(Display), c_int, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# GL/glxext.h:697
+glXQueryFrameCountNV = _link_function('glXQueryFrameCountNV', c_int, [POINTER(Display), c_int, POINTER(GLuint)], 'NV_swap_group')
+
+# GL/glxext.h:699
+glXResetFrameCountNV = _link_function('glXResetFrameCountNV', c_int, [POINTER(Display), c_int], 'NV_swap_group')
+
+PFNGLXJOINSWAPGROUPNVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, GLuint) # GL/glxext.h:701
+PFNGLXBINDSWAPBARRIERNVPROC = CFUNCTYPE(c_int, POINTER(Display), GLuint, GLuint) # GL/glxext.h:705
+PFNGLXQUERYSWAPGROUPNVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXDrawable, POINTER(GLuint), POINTER(GLuint)) # GL/glxext.h:709
+PFNGLXQUERYMAXSWAPGROUPSNVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, POINTER(GLuint), POINTER(GLuint)) # GL/glxext.h:714
+PFNGLXQUERYFRAMECOUNTNVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, POINTER(GLuint)) # GL/glxext.h:719
+PFNGLXRESETFRAMECOUNTNVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int) # GL/glxext.h:723
+# NV_video_out (GL/glxext.h:726)
+GLX_NV_video_out = 1 # GL/glxext.h:727
+# GL/glxext.h:729
+glXGetVideoDeviceNV = _link_function('glXGetVideoDeviceNV', c_int, [POINTER(Display), c_int, c_int, POINTER(GLXVideoDeviceNV)], 'NV_video_out')
+
+# GL/glxext.h:732
+glXReleaseVideoDeviceNV = _link_function('glXReleaseVideoDeviceNV', c_int, [POINTER(Display), c_int, GLXVideoDeviceNV], 'NV_video_out')
+
+GLXPbuffer = pyglet.gl.glx.GLXPbuffer
+# GL/glxext.h:735
+glXBindVideoImageNV = _link_function('glXBindVideoImageNV', c_int, [POINTER(Display), GLXVideoDeviceNV, GLXPbuffer, c_int], 'NV_video_out')
+
+# GL/glxext.h:738
+glXReleaseVideoImageNV = _link_function('glXReleaseVideoImageNV', c_int, [POINTER(Display), GLXPbuffer], 'NV_video_out')
+
+GLboolean = c_ubyte # /usr/include/GL/gl.h:154
+# GL/glxext.h:740
+glXSendPbufferToVideoNV = _link_function('glXSendPbufferToVideoNV', c_int, [POINTER(Display), GLXPbuffer, c_int, POINTER(c_ulong), GLboolean], 'NV_video_out')
+
+# GL/glxext.h:745
+glXGetVideoInfoNV = _link_function('glXGetVideoInfoNV', c_int, [POINTER(Display), c_int, GLXVideoDeviceNV, POINTER(c_ulong), POINTER(c_ulong)], 'NV_video_out')
+
+PFNGLXGETVIDEODEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, c_int, POINTER(GLXVideoDeviceNV)) # GL/glxext.h:750
+PFNGLXRELEASEVIDEODEVICENVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, GLXVideoDeviceNV) # GL/glxext.h:755
+PFNGLXBINDVIDEOIMAGENVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXVideoDeviceNV, GLXPbuffer, c_int) # GL/glxext.h:759
+PFNGLXRELEASEVIDEOIMAGENVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXPbuffer) # GL/glxext.h:764
+PFNGLXSENDPBUFFERTOVIDEONVPROC = CFUNCTYPE(c_int, POINTER(Display), GLXPbuffer, c_int, POINTER(c_ulong), GLboolean) # GL/glxext.h:767
+PFNGLXGETVIDEOINFONVPROC = CFUNCTYPE(c_int, POINTER(Display), c_int, GLXVideoDeviceNV, POINTER(c_ulong), POINTER(c_ulong)) # GL/glxext.h:773
+# EXT_texture_from_pixmap (GL/glxext.h:779)
+# GL/glxext.h:782
+glXBindTexImageEXT = _link_function('glXBindTexImageEXT', None, [POINTER(Display), GLXDrawable, c_int, POINTER(c_int)], 'EXT_texture_from_pixmap')
+
+# GL/glxext.h:784
+glXReleaseTextImageEXT = _link_function('glXReleaseTextImageEXT', None, [POINTER(Display), GLXDrawable, c_int], 'EXT_texture_from_pixmap')
+
+PFNGLXBINDTEXIMAGEEXTPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int, POINTER(c_int)) # GL/glxext.h:787
+PFNGLXRELEASETEXIMAGEEXTPROC = CFUNCTYPE(None, POINTER(Display), GLXDrawable, c_int) # GL/glxext.h:791
+# NV_vertex_array_range (/usr/include/GL/glx.h:349)
+# MESA_allocate_memory (/usr/include/GL/glx.h:363)
+# ARB_render_texture (/usr/include/GL/glx.h:380)
+# NV_float_buffer (/usr/include/GL/glx.h:393)
+# MESA_swap_frame_usage (/usr/include/GL/glx.h:405)
+# MESA_swap_control (/usr/include/GL/glx.h:425)
+# EXT_texture_from_pixmap (/usr/include/GL/glx.h:442)
+
+__all__ = ['GLX_GLXEXT_VERSION', 'GLX_SAMPLE_BUFFERS_ARB', 'GLX_SAMPLES_ARB',
+'GLX_RGBA_FLOAT_TYPE_ARB', 'GLX_RGBA_FLOAT_BIT_ARB',
+'GLX_SAMPLE_BUFFERS_SGIS', 'GLX_SAMPLES_SGIS', 'GLX_X_VISUAL_TYPE_EXT',
+'GLX_TRANSPARENT_TYPE_EXT', 'GLX_TRANSPARENT_INDEX_VALUE_EXT',
+'GLX_TRANSPARENT_RED_VALUE_EXT', 'GLX_TRANSPARENT_GREEN_VALUE_EXT',
+'GLX_TRANSPARENT_BLUE_VALUE_EXT', 'GLX_TRANSPARENT_ALPHA_VALUE_EXT',
+'GLX_NONE_EXT', 'GLX_TRUE_COLOR_EXT', 'GLX_DIRECT_COLOR_EXT',
+'GLX_PSEUDO_COLOR_EXT', 'GLX_STATIC_COLOR_EXT', 'GLX_GRAY_SCALE_EXT',
+'GLX_STATIC_GRAY_EXT', 'GLX_TRANSPARENT_RGB_EXT', 'GLX_TRANSPARENT_INDEX_EXT',
+'GLX_VISUAL_CAVEAT_EXT', 'GLX_SLOW_VISUAL_EXT',
+'GLX_NON_CONFORMANT_VISUAL_EXT', 'GLX_SHARE_CONTEXT_EXT', 'GLX_VISUAL_ID_EXT',
+'GLX_SCREEN_EXT', 'GLX_WINDOW_BIT_SGIX', 'GLX_PIXMAP_BIT_SGIX',
+'GLX_RGBA_BIT_SGIX', 'GLX_COLOR_INDEX_BIT_SGIX', 'GLX_DRAWABLE_TYPE_SGIX',
+'GLX_RENDER_TYPE_SGIX', 'GLX_X_RENDERABLE_SGIX', 'GLX_FBCONFIG_ID_SGIX',
+'GLX_RGBA_TYPE_SGIX', 'GLX_COLOR_INDEX_TYPE_SGIX', 'GLX_PBUFFER_BIT_SGIX',
+'GLX_BUFFER_CLOBBER_MASK_SGIX', 'GLX_FRONT_LEFT_BUFFER_BIT_SGIX',
+'GLX_FRONT_RIGHT_BUFFER_BIT_SGIX', 'GLX_BACK_LEFT_BUFFER_BIT_SGIX',
+'GLX_BACK_RIGHT_BUFFER_BIT_SGIX', 'GLX_AUX_BUFFERS_BIT_SGIX',
+'GLX_DEPTH_BUFFER_BIT_SGIX', 'GLX_STENCIL_BUFFER_BIT_SGIX',
+'GLX_ACCUM_BUFFER_BIT_SGIX', 'GLX_SAMPLE_BUFFERS_BIT_SGIX',
+'GLX_MAX_PBUFFER_WIDTH_SGIX', 'GLX_MAX_PBUFFER_HEIGHT_SGIX',
+'GLX_MAX_PBUFFER_PIXELS_SGIX', 'GLX_OPTIMAL_PBUFFER_WIDTH_SGIX',
+'GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX', 'GLX_PRESERVED_CONTENTS_SGIX',
+'GLX_LARGEST_PBUFFER_SGIX', 'GLX_WIDTH_SGIX', 'GLX_HEIGHT_SGIX',
+'GLX_EVENT_MASK_SGIX', 'GLX_DAMAGED_SGIX', 'GLX_SAVED_SGIX',
+'GLX_WINDOW_SGIX', 'GLX_PBUFFER_SGIX', 'GLX_SYNC_FRAME_SGIX',
+'GLX_SYNC_SWAP_SGIX', 'GLX_DIGITAL_MEDIA_PBUFFER_SGIX',
+'GLX_BLENDED_RGBA_SGIS', 'GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS',
+'GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS', 'GLX_SAMPLE_BUFFERS_3DFX',
+'GLX_SAMPLES_3DFX', 'GLX_3DFX_WINDOW_MODE_MESA',
+'GLX_3DFX_FULLSCREEN_MODE_MESA', 'GLX_VISUAL_SELECT_GROUP_SGIX',
+'GLX_SWAP_METHOD_OML', 'GLX_SWAP_EXCHANGE_OML', 'GLX_SWAP_COPY_OML',
+'GLX_SWAP_UNDEFINED_OML', 'GLX_FLOAT_COMPONENTS_NV',
+'GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX', 'GLX_BAD_HYPERPIPE_CONFIG_SGIX',
+'GLX_BAD_HYPERPIPE_SGIX', 'GLX_HYPERPIPE_DISPLAY_PIPE_SGIX',
+'GLX_HYPERPIPE_RENDER_PIPE_SGIX', 'GLX_PIPE_RECT_SGIX',
+'GLX_PIPE_RECT_LIMITS_SGIX', 'GLX_HYPERPIPE_STEREO_SGIX',
+'GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX', 'GLX_HYPERPIPE_ID_SGIX',
+'GLXVideoSourceSGIX', 'GLXFBConfigIDSGIX', 'GLXFBConfigSGIX',
+'GLXPbufferSGIX', 'GLXBufferClobberEventSGIX', 'GLXVideoDeviceNV',
+'GLX_VIDEO_OUT_COLOR_NV', 'GLX_VIDEO_OUT_ALPHA_NV', 'GLX_VIDEO_OUT_DEPTH_NV',
+'GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV', 'GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV',
+'GLX_VIDEO_OUT_FRAME_NV', 'GLX_VIDEO_OUT_FIELD_1_NV',
+'GLX_VIDEO_OUT_FIELD_2_NV', 'GLX_BIND_TO_TEXTURE_RGB_EXT',
+'GLX_BIND_TO_TEXTURE_RGBA_EXT', 'GLX_BIND_TO_MIPMAP_TEXTURE_EXT',
+'GLX_BIND_TO_TEXTURE_TARGETS_EXT', 'GLX_Y_INVERTED_EXT',
+'GLX_TEXTURE_FORMAT_EXT', 'GLX_TEXTURE_TARGET_EXT', 'GLX_MIPMAP_TEXTURE_EXT',
+'GLX_TEXTURE_FORMAT_NONE_EXT', 'GLX_TEXTURE_FORMAT_RGB_EXT',
+'GLX_TEXTURE_FORMAT_RGBA_EXT', 'GLX_TEXTURE_1D_BIT_EXT',
+'GLX_TEXTURE_2D_BIT_EXT', 'GLX_TEXTURE_RECTANGLE_BIT_EXT',
+'GLX_TEXTURE_1D_EXT', 'GLX_TEXTURE_2D_EXT', 'GLX_TEXTURE_RECTANGLE_EXT',
+'GLX_FRONT_LEFT_EXT', 'GLX_FRONT_RIGHT_EXT', 'GLX_BACK_LEFT_EXT',
+'GLX_BACK_RIGHT_EXT', 'GLX_FRONT_EXT', 'GLX_BACK_EXT', 'GLX_AUX0_EXT',
+'GLX_AUX1_EXT', 'GLX_AUX2_EXT', 'GLX_AUX3_EXT', 'GLX_AUX4_EXT',
+'GLX_AUX5_EXT', 'GLX_AUX6_EXT', 'GLX_AUX7_EXT', 'GLX_AUX8_EXT',
+'GLX_AUX9_EXT', 'GLX_ARB_multisample', 'GLX_ARB_fbconfig_float',
+'GLX_SGIS_multisample', 'GLX_EXT_visual_info', 'GLX_SGI_swap_control',
+'glXSwapIntervalSGI', 'PFNGLXSWAPINTERVALSGIPROC', 'GLX_SGI_video_sync',
+'glXGetVideoSyncSGI', 'glXWaitVideoSyncSGI', 'glXGetRefreshRateSGI',
+'PFNGLXGETVIDEOSYNCSGIPROC', 'PFNGLXWAITVIDEOSYNCSGIPROC',
+'PFNGLXGETREFRESHRATESGIPROC', 'GLX_SGI_make_current_read',
+'glXMakeCurrentReadSGI', 'glXGetCurrentReadDrawableSGI',
+'PFNGLXMAKECURRENTREADSGIPROC', 'PFNGLXGETCURRENTREADDRAWABLESGIPROC',
+'GLX_SGIX_video_source', 'GLX_EXT_visual_rating', 'GLX_EXT_import_context',
+'glXGetCurrentDisplayEXT', 'glXQueryContextInfoEXT', 'glXGetContextIDEXT',
+'glXImportContextEXT', 'glXFreeContextEXT', 'PFNGLXGETCURRENTDISPLAYEXTPROC',
+'PFNGLXQUERYCONTEXTINFOEXTPROC', 'PFNGLXGETCONTEXTIDEXTPROC',
+'PFNGLXIMPORTCONTEXTEXTPROC', 'PFNGLXFREECONTEXTEXTPROC', 'GLX_SGIX_fbconfig',
+'glXGetFBConfigAttribSGIX', 'glXChooseFBConfigSGIX',
+'glXCreateGLXPixmapWithConfigSGIX', 'glXCreateContextWithConfigSGIX',
+'glXGetVisualFromFBConfigSGIX', 'glXGetFBConfigFromVisualSGIX',
+'PFNGLXGETFBCONFIGATTRIBSGIXPROC', 'PFNGLXCHOOSEFBCONFIGSGIXPROC',
+'PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC',
+'PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC',
+'PFNGLXGETVISUALFROMFBCONFIGSGIXPROC', 'PFNGLXGETFBCONFIGFROMVISUALSGIXPROC',
+'GLX_SGIX_pbuffer', 'glXCreateGLXPbufferSGIX', 'glXDestroyGLXPbufferSGIX',
+'glXQueryGLXPbufferSGIX', 'glXSelectEventSGIX', 'glXGetSelectedEventSGIX',
+'PFNGLXCREATEGLXPBUFFERSGIXPROC', 'PFNGLXDESTROYGLXPBUFFERSGIXPROC',
+'PFNGLXQUERYGLXPBUFFERSGIXPROC', 'PFNGLXSELECTEVENTSGIXPROC',
+'PFNGLXGETSELECTEDEVENTSGIXPROC', 'GLX_SGI_cushion', 'glXCushionSGI',
+'PFNGLXCUSHIONSGIPROC', 'GLX_SGIX_video_resize', 'glXBindChannelToWindowSGIX',
+'glXChannelRectSGIX', 'glXQueryChannelRectSGIX', 'glXQueryChannelDeltasSGIX',
+'glXChannelRectSyncSGIX', 'PFNGLXBINDCHANNELTOWINDOWSGIXPROC',
+'PFNGLXCHANNELRECTSGIXPROC', 'PFNGLXQUERYCHANNELRECTSGIXPROC',
+'PFNGLXQUERYCHANNELDELTASSGIXPROC', 'PFNGLXCHANNELRECTSYNCSGIXPROC',
+'GLX_SGIX_dmbuffer', 'GLX_SGIX_swap_group', 'glXJoinSwapGroupSGIX',
+'PFNGLXJOINSWAPGROUPSGIXPROC', 'GLX_SGIX_swap_barrier',
+'glXBindSwapBarrierSGIX', 'glXQueryMaxSwapBarriersSGIX',
+'PFNGLXBINDSWAPBARRIERSGIXPROC', 'PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC',
+'GLX_SUN_get_transparent_index', 'glXGetTransparentIndexSUN',
+'PFNGLXGETTRANSPARENTINDEXSUNPROC', 'GLX_MESA_copy_sub_buffer',
+'glXCopySubBufferMESA', 'PFNGLXCOPYSUBBUFFERMESAPROC',
+'GLX_MESA_pixmap_colormap', 'glXCreateGLXPixmapMESA',
+'PFNGLXCREATEGLXPIXMAPMESAPROC', 'GLX_MESA_release_buffers',
+'glXReleaseBuffersMESA', 'PFNGLXRELEASEBUFFERSMESAPROC',
+'GLX_MESA_set_3dfx_mode', 'glXSet3DfxModeMESA', 'PFNGLXSET3DFXMODEMESAPROC',
+'GLX_SGIX_visual_select_group', 'GLX_OML_swap_method', 'GLX_OML_sync_control',
+'glXGetSyncValuesOML', 'glXGetMscRateOML', 'glXSwapBuffersMscOML',
+'glXWaitForMscOML', 'glXWaitForSbcOML', 'PFNGLXGETSYNCVALUESOMLPROC',
+'PFNGLXGETMSCRATEOMLPROC', 'PFNGLXSWAPBUFFERSMSCOMLPROC',
+'PFNGLXWAITFORMSCOMLPROC', 'PFNGLXWAITFORSBCOMLPROC', 'GLX_NV_float_buffer',
+'GLX_SGIX_hyperpipe', 'GLXHyperpipeNetworkSGIX', 'GLXHyperpipeConfigSGIX',
+'GLXPipeRect', 'GLXPipeRectLimits', 'glXQueryHyperpipeNetworkSGIX',
+'glXHyperpipeConfigSGIX', 'glXQueryHyperpipeConfigSGIX',
+'glXDestroyHyperpipeConfigSGIX', 'glXBindHyperpipeSGIX',
+'glXQueryHyperpipeBestAttribSGIX', 'glXHyperpipeAttribSGIX',
+'glXQueryHyperpipeAttribSGIX', 'PFNGLXQUERYHYPERPIPENETWORKSGIXPROC',
+'PFNGLXHYPERPIPECONFIGSGIXPROC', 'PFNGLXQUERYHYPERPIPECONFIGSGIXPROC',
+'PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC', 'PFNGLXBINDHYPERPIPESGIXPROC',
+'PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC', 'PFNGLXHYPERPIPEATTRIBSGIXPROC',
+'PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC', 'GLX_MESA_agp_offset',
+'glXGetAGPOffsetMESA', 'PFNGLXGETAGPOFFSETMESAPROC',
+'GLX_NV_vertex_array_range', 'glXAllocateMemoryNV', 'glXFreeMemoryNV',
+'PFNGLXALLOCATEMEMORYNVPROC', 'PFNGLXFREEMEMORYNVPROC', 'GLX_NV_swap_group',
+'glXJoinSwapGroupNV', 'glXBindSwapBarrierNV', 'glXQuerySwapGroupNV',
+'glXQueryMaxSwapGroupsNV', 'glXQueryFrameCountNV', 'glXResetFrameCountNV',
+'PFNGLXJOINSWAPGROUPNVPROC', 'PFNGLXBINDSWAPBARRIERNVPROC',
+'PFNGLXQUERYSWAPGROUPNVPROC', 'PFNGLXQUERYMAXSWAPGROUPSNVPROC',
+'PFNGLXQUERYFRAMECOUNTNVPROC', 'PFNGLXRESETFRAMECOUNTNVPROC',
+'GLX_NV_video_out', 'glXGetVideoDeviceNV', 'glXReleaseVideoDeviceNV',
+'glXBindVideoImageNV', 'glXReleaseVideoImageNV', 'glXSendPbufferToVideoNV',
+'glXGetVideoInfoNV', 'PFNGLXGETVIDEODEVICENVPROC',
+'PFNGLXRELEASEVIDEODEVICENVPROC', 'PFNGLXBINDVIDEOIMAGENVPROC',
+'PFNGLXRELEASEVIDEOIMAGENVPROC', 'PFNGLXSENDPBUFFERTOVIDEONVPROC',
+'PFNGLXGETVIDEOINFONVPROC', 'glXBindTexImageEXT', 'glXReleaseTextImageEXT',
+'PFNGLXBINDTEXIMAGEEXTPROC', 'PFNGLXRELEASETEXIMAGEEXTPROC']
+# END GENERATED CONTENT (do not edit above this line)
+
+
+
+
+
+
+
+
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/headless.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/headless.py
new file mode 100644
index 0000000000000000000000000000000000000000..d4a0a82c8cb41d91a15f1ab0f8bf42dbcb6c3d2e
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/headless.py
@@ -0,0 +1,157 @@
+from ctypes import *
+
+from pyglet import gl
+from pyglet.canvas.headless import HeadlessCanvas
+from pyglet.libs.egl import egl
+from pyglet.libs.egl.egl import *
+
+from .base import CanvasConfig, Config, Context
+
+_fake_gl_attributes = {
+ 'double_buffer': 0,
+ 'stereo': 0,
+ 'aux_buffers': 0,
+ 'accum_red_size': 0,
+ 'accum_green_size': 0,
+ 'accum_blue_size': 0,
+ 'accum_alpha_size': 0
+}
+
+
+class HeadlessConfig(Config):
+ def match(self, canvas):
+ if not isinstance(canvas, HeadlessCanvas):
+ raise RuntimeError('Canvas must be an instance of HeadlessCanvas')
+
+ display_connection = canvas.display._display_connection
+
+ # Construct array of attributes
+ attrs = []
+ for name, value in self.get_gl_attributes():
+ if name == 'double_buffer':
+ continue
+ attr = HeadlessCanvasConfig.attribute_ids.get(name, None)
+ if attr and value is not None:
+ attrs.extend([attr, int(value)])
+ attrs.extend([EGL_SURFACE_TYPE, EGL_PBUFFER_BIT])
+ if self.opengl_api == "gl":
+ attrs.extend([EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT])
+ elif self.opengl_api == "gles":
+ attrs.extend([EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT])
+ else:
+ raise ValueError(f"Unknown OpenGL API: {self.opengl_api}")
+ attrs.extend([EGL_NONE])
+ attrs_list = (egl.EGLint * len(attrs))(*attrs)
+
+ num_config = egl.EGLint()
+ egl.eglChooseConfig(display_connection, attrs_list, None, 0, byref(num_config))
+ configs = (egl.EGLConfig * num_config.value)()
+ egl.eglChooseConfig(display_connection, attrs_list, configs,
+ num_config.value, byref(num_config))
+
+ result = [HeadlessCanvasConfig(canvas, c, self) for c in configs]
+ return result
+
+
+class HeadlessCanvasConfig(CanvasConfig):
+ attribute_ids = {
+ 'buffer_size': egl.EGL_BUFFER_SIZE,
+ 'level': egl.EGL_LEVEL, # Not supported
+ 'red_size': egl.EGL_RED_SIZE,
+ 'green_size': egl.EGL_GREEN_SIZE,
+ 'blue_size': egl.EGL_BLUE_SIZE,
+ 'alpha_size': egl.EGL_ALPHA_SIZE,
+ 'depth_size': egl.EGL_DEPTH_SIZE,
+ 'stencil_size': egl.EGL_STENCIL_SIZE,
+ 'sample_buffers': egl.EGL_SAMPLE_BUFFERS,
+ 'samples': egl.EGL_SAMPLES,
+ }
+
+ def __init__(self, canvas, egl_config, config):
+ super(HeadlessCanvasConfig, self).__init__(canvas, config)
+ self._egl_config = egl_config
+ context_attribs = (EGL_CONTEXT_MAJOR_VERSION, config.major_version or 2,
+ EGL_CONTEXT_MINOR_VERSION, config.minor_version or 0,
+ EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE, config.forward_compatible or 0,
+ EGL_CONTEXT_OPENGL_DEBUG, config.debug or 0,
+ EGL_NONE)
+ self._context_attrib_array = (egl.EGLint * len(context_attribs))(*context_attribs)
+
+ for name, attr in self.attribute_ids.items():
+ value = egl.EGLint()
+ egl.eglGetConfigAttrib(canvas.display._display_connection, egl_config, attr, byref(value))
+ setattr(self, name, value.value)
+
+ for name, value in _fake_gl_attributes.items():
+ setattr(self, name, value)
+
+ def compatible(self, canvas):
+ # TODO check more
+ return isinstance(canvas, HeadlessCanvas)
+
+ def create_context(self, share):
+ return HeadlessContext(self, share)
+
+
+class HeadlessContext(Context):
+ def __init__(self, config, share):
+ super(HeadlessContext, self).__init__(config, share)
+
+ self.display_connection = config.canvas.display._display_connection
+
+ self.egl_context = self._create_egl_context(share)
+ if not self.egl_context:
+ raise gl.ContextException('Could not create GL context')
+
+ def _create_egl_context(self, share):
+ if share:
+ share_context = share.egl_context
+ else:
+ share_context = None
+
+ if self.config.opengl_api == "gl":
+ egl.eglBindAPI(egl.EGL_OPENGL_API)
+ elif self.config.opengl_api == "gles":
+ egl.eglBindAPI(egl.EGL_OPENGL_ES_API)
+ return egl.eglCreateContext(self.config.canvas.display._display_connection,
+ self.config._egl_config, share_context,
+ self.config._context_attrib_array)
+
+ def attach(self, canvas):
+ if canvas is self.canvas:
+ return
+
+ super(HeadlessContext, self).attach(canvas)
+
+ self.egl_surface = canvas.egl_surface
+ self.set_current()
+
+ def set_current(self):
+ egl.eglMakeCurrent(
+ self.display_connection, self.egl_surface, self.egl_surface, self.egl_context)
+ super(HeadlessContext, self).set_current()
+
+ def detach(self):
+ if not self.canvas:
+ return
+
+ self.set_current()
+ gl.glFlush() # needs to be in try/except?
+
+ super(HeadlessContext, self).detach()
+
+ egl.eglMakeCurrent(
+ self.display_connection, 0, 0, None)
+ self.egl_surface = None
+
+ def destroy(self):
+ super(HeadlessContext, self).destroy()
+ if self.egl_context:
+ egl.eglDestroyContext(self.display_connection, self.egl_context)
+ self.egl_context = None
+
+ def flip(self):
+ if not self.egl_surface:
+ return
+
+ egl.eglSwapBuffers(self.display_connection, self.egl_surface)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/lib.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/lib.py
new file mode 100644
index 0000000000000000000000000000000000000000..d868430abb6986980770a0e9f719586d6b2ee3cb
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/lib.py
@@ -0,0 +1,98 @@
+import ctypes
+
+import pyglet
+
+__all__ = ['link_GL', 'link_AGL', 'link_GLX', 'link_WGL',
+ 'GLException', 'missing_function', 'decorate_function']
+
+_debug_gl = pyglet.options['debug_gl']
+_debug_gl_trace = pyglet.options['debug_gl_trace']
+_debug_gl_trace_args = pyglet.options['debug_gl_trace_args']
+
+
+class MissingFunctionException(Exception):
+ def __init__(self, name, requires=None, suggestions=None):
+ msg = '%s is not exported by the available OpenGL driver.' % name
+ if requires:
+ msg += ' %s is required for this functionality.' % requires
+ if suggestions:
+ msg += ' Consider alternative(s) %s.' % ', '.join(suggestions)
+ Exception.__init__(self, msg)
+
+
+def missing_function(name, requires=None, suggestions=None):
+ def MissingFunction(*args, **kwargs):
+ raise MissingFunctionException(name, requires, suggestions)
+
+ return MissingFunction
+
+
+_int_types = (ctypes.c_int16, ctypes.c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if ctypes.sizeof(t) == ctypes.sizeof(ctypes.c_size_t):
+ c_ptrdiff_t = t
+
+
+class c_void(ctypes.Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', ctypes.c_int)]
+
+
+class GLException(Exception):
+ pass
+
+
+def errcheck(result, func, arguments):
+ if _debug_gl_trace:
+ try:
+ name = func.__name__
+ except AttributeError:
+ name = repr(func)
+ if _debug_gl_trace_args:
+ trace_args = ', '.join([repr(arg)[:20] for arg in arguments])
+ print(f'{name}({trace_args})')
+ else:
+ print(name)
+
+ from pyglet import gl
+ context = gl.current_context
+ if not context:
+ raise GLException('No GL context; create a Window first')
+ error = gl.glGetError()
+ if error:
+ # These are the 6 possible error codes we can get in opengl core 3.3+
+ error_types = {
+ gl.GL_INVALID_ENUM: "Invalid enum. An unacceptable value is specified for an enumerated argument.",
+ gl.GL_INVALID_VALUE: "Invalid value. A numeric argument is out of range.",
+ gl.GL_INVALID_OPERATION: "Invalid operation. The specified operation is not allowed in the current state.",
+ gl.GL_INVALID_FRAMEBUFFER_OPERATION: "Invalid framebuffer operation. The framebuffer object is not complete.",
+ gl.GL_OUT_OF_MEMORY: "Out of memory. There is not enough memory left to execute the command.",
+ }
+ msg = error_types.get(error, "Unknown error")
+ raise GLException(f'(0x{error}): {msg}')
+ return result
+
+
+def decorate_function(func, name):
+ if _debug_gl:
+ if name not in ('glGetError',) and name[:3] not in ('glX', 'agl', 'wgl'):
+ func.errcheck = errcheck
+
+
+link_AGL = None
+link_GLX = None
+link_WGL = None
+
+if pyglet.compat_platform in ('win32', 'cygwin'):
+ from pyglet.gl.lib_wgl import link_GL, link_WGL
+elif pyglet.compat_platform == 'darwin':
+ from pyglet.gl.lib_agl import link_GL, link_AGL
+else:
+ from pyglet.gl.lib_glx import link_GL, link_GLX
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/lib_agl.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/lib_agl.py
new file mode 100644
index 0000000000000000000000000000000000000000..a6c258ef6c877a050a11a6fbf038e9f074b973a1
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/lib_agl.py
@@ -0,0 +1,31 @@
+from ctypes import *
+
+import pyglet.lib
+from pyglet.gl.lib import missing_function, decorate_function
+
+__all__ = ['link_GL', 'link_AGL']
+
+gl_lib = pyglet.lib.load_library(framework='OpenGL')
+agl_lib = pyglet.lib.load_library(framework='AGL')
+
+
+def link_GL(name, restype, argtypes, requires=None, suggestions=None):
+ try:
+ func = getattr(gl_lib, name)
+ func.restype = restype
+ func.argtypes = argtypes
+ decorate_function(func, name)
+ return func
+ except AttributeError:
+ return missing_function(name, requires, suggestions)
+
+
+def link_AGL(name, restype, argtypes, requires=None, suggestions=None):
+ try:
+ func = getattr(agl_lib, name)
+ func.restype = restype
+ func.argtypes = argtypes
+ decorate_function(func, name)
+ return func
+ except AttributeError:
+ return missing_function(name, requires, suggestions)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/lib_glx.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/lib_glx.py
new file mode 100644
index 0000000000000000000000000000000000000000..7e6291d1e3c4381f1d9acc25098cf11dffde0599
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/lib_glx.py
@@ -0,0 +1,44 @@
+from ctypes import *
+from typing import Any, Callable
+
+import pyglet.lib
+from pyglet.gl.lib import missing_function, decorate_function
+
+from pyglet.util import asbytes
+
+__all__ = ['link_GL', 'link_GLX']
+
+gl_lib = pyglet.lib.load_library('GL')
+
+# Look for glXGetProcAddressARB extension, use it as fallback (for ATI fglrx and DRI drivers).
+try:
+ glXGetProcAddressARB = getattr(gl_lib, 'glXGetProcAddressARB')
+ glXGetProcAddressARB.restype = POINTER(CFUNCTYPE(None))
+ glXGetProcAddressARB.argtypes = [POINTER(c_ubyte)]
+ _have_getprocaddress = True
+except AttributeError:
+ _have_getprocaddress = False
+
+
+def link_GL(name, restype, argtypes, requires=None, suggestions=None) -> Callable[..., Any]:
+ try:
+ func = getattr(gl_lib, name)
+ func.restype = restype
+ func.argtypes = argtypes
+ decorate_function(func, name)
+ return func
+ except AttributeError:
+ if _have_getprocaddress:
+ # Fallback if implemented but not in ABI
+ bname = cast(pointer(create_string_buffer(asbytes(name))), POINTER(c_ubyte))
+ addr = glXGetProcAddressARB(bname)
+ if addr:
+ ftype = CFUNCTYPE(*((restype,) + tuple(argtypes)))
+ func = cast(addr, ftype)
+ decorate_function(func, name)
+ return func
+
+ return missing_function(name, requires, suggestions)
+
+
+link_GLX = link_GL
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/lib_wgl.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/lib_wgl.py
new file mode 100644
index 0000000000000000000000000000000000000000..37900241fd44e4ddc632c6e43e39604d94bdef99
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/lib_wgl.py
@@ -0,0 +1,98 @@
+import ctypes
+from ctypes import *
+
+import pyglet
+from pyglet.gl.lib import missing_function, decorate_function
+from pyglet.util import asbytes
+
+__all__ = ['link_GL', 'link_WGL']
+
+_debug_trace = pyglet.options['debug_trace']
+
+gl_lib = ctypes.windll.opengl32
+wgl_lib = gl_lib
+
+if _debug_trace:
+ from pyglet.lib import _TraceLibrary
+
+ gl_lib = _TraceLibrary(gl_lib)
+ wgl_lib = _TraceLibrary(wgl_lib)
+
+try:
+ wglGetProcAddress = wgl_lib.wglGetProcAddress
+ wglGetProcAddress.restype = CFUNCTYPE(POINTER(c_int))
+ wglGetProcAddress.argtypes = [c_char_p]
+ _have_get_proc_address = True
+except AttributeError:
+ _have_get_proc_address = False
+
+class_slots = ['name', 'requires', 'suggestions', 'ftype', 'func']
+
+
+def makeWGLFunction(func):
+ class WGLFunction:
+ __slots__ = class_slots
+ __call__ = func
+
+ return WGLFunction
+
+
+class WGLFunctionProxy:
+ __slots__ = class_slots
+
+ def __init__(self, name, ftype, requires, suggestions):
+ assert _have_get_proc_address
+ self.name = name
+ self.ftype = ftype
+ self.requires = requires
+ self.suggestions = suggestions
+ self.func = None
+
+ def __call__(self, *args, **kwargs):
+ from pyglet.gl import current_context
+ if not current_context:
+ raise Exception(
+ 'Call to function "%s" before GL context created' % self.name)
+ address = wglGetProcAddress(asbytes(self.name))
+ if cast(address, POINTER(c_int)): # check cast because address is func
+ self.func = cast(address, self.ftype)
+ decorate_function(self.func, self.name)
+ else:
+ self.func = missing_function(
+ self.name, self.requires, self.suggestions)
+
+ self.__class__ = makeWGLFunction(self.func)
+
+ return self.func(*args, **kwargs)
+
+
+def link_GL(name, restype, argtypes, requires=None, suggestions=None):
+ try:
+ func = getattr(gl_lib, name)
+ func.restype = restype
+ func.argtypes = argtypes
+ decorate_function(func, name)
+ return func
+ except AttributeError:
+ # Not in opengl32.dll. Try and get a pointer from WGL.
+ try:
+ fargs = (restype,) + tuple(argtypes)
+ ftype = ctypes.WINFUNCTYPE(*fargs)
+ if _have_get_proc_address:
+ from pyglet.gl import gl_info
+ if gl_info.have_context():
+ address = wglGetProcAddress(name)
+ if address:
+ func = cast(address, ftype)
+ decorate_function(func, name)
+ return func
+ else:
+ # Insert proxy until we have a context
+ return WGLFunctionProxy(name, ftype, requires, suggestions)
+ except:
+ pass
+
+ return missing_function(name, requires, suggestions)
+
+
+link_WGL = link_GL
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/wgl.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/wgl.py
new file mode 100644
index 0000000000000000000000000000000000000000..4b2b024c23bdb7ffaa3eeeaab5b042d88c577212
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/wgl.py
@@ -0,0 +1,338 @@
+"""Wrapper for C:\cygwin\home\Alex\pyglet\tools\wgl.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+"""
+
+from ctypes import *
+from pyglet.gl.lib import link_WGL as _link_function
+
+
+if not _link_function:
+ raise ImportError('opengl32.dll is not available.')
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for C:\cygwin\home\Alex\pyglet\tools\wgl.h
+
+
+CONST = 0 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:14
+GLenum = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:17
+GLboolean = c_ubyte # C:\cygwin\home\Alex\pyglet\tools\wgl.h:18
+GLbitfield = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:19
+GLbyte = c_char # C:\cygwin\home\Alex\pyglet\tools\wgl.h:20
+GLshort = c_short # C:\cygwin\home\Alex\pyglet\tools\wgl.h:21
+GLint = c_int # C:\cygwin\home\Alex\pyglet\tools\wgl.h:22
+GLsizei = c_int # C:\cygwin\home\Alex\pyglet\tools\wgl.h:23
+GLubyte = c_ubyte # C:\cygwin\home\Alex\pyglet\tools\wgl.h:24
+GLushort = c_ushort # C:\cygwin\home\Alex\pyglet\tools\wgl.h:25
+GLuint = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:26
+GLfloat = c_float # C:\cygwin\home\Alex\pyglet\tools\wgl.h:27
+GLclampf = c_float # C:\cygwin\home\Alex\pyglet\tools\wgl.h:28
+GLdouble = c_double # C:\cygwin\home\Alex\pyglet\tools\wgl.h:29
+GLclampd = c_double # C:\cygwin\home\Alex\pyglet\tools\wgl.h:30
+GLvoid = None # C:\cygwin\home\Alex\pyglet\tools\wgl.h:31
+INT8 = c_char # C:\cygwin\home\Alex\pyglet\tools\wgl.h:33
+PINT8 = c_char_p # C:\cygwin\home\Alex\pyglet\tools\wgl.h:33
+INT16 = c_short # C:\cygwin\home\Alex\pyglet\tools\wgl.h:34
+PINT16 = POINTER(c_short) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:34
+INT32 = c_int # C:\cygwin\home\Alex\pyglet\tools\wgl.h:35
+PINT32 = POINTER(c_int) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:35
+UINT8 = c_ubyte # C:\cygwin\home\Alex\pyglet\tools\wgl.h:36
+PUINT8 = POINTER(c_ubyte) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:36
+UINT16 = c_ushort # C:\cygwin\home\Alex\pyglet\tools\wgl.h:37
+PUINT16 = POINTER(c_ushort) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:37
+UINT32 = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:38
+PUINT32 = POINTER(c_uint) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:38
+LONG32 = c_int # C:\cygwin\home\Alex\pyglet\tools\wgl.h:39
+PLONG32 = POINTER(c_int) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:39
+ULONG32 = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:40
+PULONG32 = POINTER(c_uint) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:40
+DWORD32 = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:41
+PDWORD32 = POINTER(c_uint) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:41
+INT64 = c_longlong # C:\cygwin\home\Alex\pyglet\tools\wgl.h:42
+PINT64 = POINTER(c_longlong) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:42
+UINT64 = c_ulonglong # C:\cygwin\home\Alex\pyglet\tools\wgl.h:43
+PUINT64 = POINTER(c_ulonglong) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:43
+VOID = None # C:\cygwin\home\Alex\pyglet\tools\wgl.h:45
+LPVOID = POINTER(None) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:45
+LPCSTR = c_char_p # C:\cygwin\home\Alex\pyglet\tools\wgl.h:46
+CHAR = c_char # C:\cygwin\home\Alex\pyglet\tools\wgl.h:47
+BYTE = c_ubyte # C:\cygwin\home\Alex\pyglet\tools\wgl.h:48
+WORD = c_ushort # C:\cygwin\home\Alex\pyglet\tools\wgl.h:49
+USHORT = c_ushort # C:\cygwin\home\Alex\pyglet\tools\wgl.h:49
+UINT = c_uint # C:\cygwin\home\Alex\pyglet\tools\wgl.h:50
+INT = c_int # C:\cygwin\home\Alex\pyglet\tools\wgl.h:51
+INT_PTR = POINTER(c_int) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:51
+BOOL = c_long # C:\cygwin\home\Alex\pyglet\tools\wgl.h:52
+LONG = c_long # C:\cygwin\home\Alex\pyglet\tools\wgl.h:53
+DWORD = c_ulong # C:\cygwin\home\Alex\pyglet\tools\wgl.h:54
+FLOAT = c_float # C:\cygwin\home\Alex\pyglet\tools\wgl.h:55
+COLORREF = DWORD # C:\cygwin\home\Alex\pyglet\tools\wgl.h:56
+LPCOLORREF = POINTER(DWORD) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:56
+HANDLE = POINTER(None) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:58
+HGLRC = HANDLE # C:\cygwin\home\Alex\pyglet\tools\wgl.h:60
+HDC = HANDLE # C:\cygwin\home\Alex\pyglet\tools\wgl.h:61
+PROC = CFUNCTYPE(INT_PTR) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:63
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:65
+wglCopyContext = _link_function('wglCopyContext', BOOL, [HGLRC, HGLRC, UINT], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:66
+wglCreateContext = _link_function('wglCreateContext', HGLRC, [HDC], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:67
+wglCreateLayerContext = _link_function('wglCreateLayerContext', HGLRC, [HDC, c_int], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:68
+wglDeleteContext = _link_function('wglDeleteContext', BOOL, [HGLRC], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:69
+wglGetCurrentContext = _link_function('wglGetCurrentContext', HGLRC, [], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:70
+wglGetCurrentDC = _link_function('wglGetCurrentDC', HDC, [], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:71
+wglGetProcAddress = _link_function('wglGetProcAddress', PROC, [LPCSTR], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:72
+wglMakeCurrent = _link_function('wglMakeCurrent', BOOL, [HDC, HGLRC], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:73
+wglShareLists = _link_function('wglShareLists', BOOL, [HGLRC, HGLRC], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:74
+wglUseFontBitmapsA = _link_function('wglUseFontBitmapsA', BOOL, [HDC, DWORD, DWORD, DWORD], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:75
+wglUseFontBitmapsW = _link_function('wglUseFontBitmapsW', BOOL, [HDC, DWORD, DWORD, DWORD], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:76
+SwapBuffers = _link_function('SwapBuffers', BOOL, [HDC], None)
+
+class struct__POINTFLOAT(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ ]
+struct__POINTFLOAT._fields_ = [
+ ('x', FLOAT),
+ ('y', FLOAT),
+]
+
+POINTFLOAT = struct__POINTFLOAT # C:\cygwin\home\Alex\pyglet\tools\wgl.h:81
+PPOINTFLOAT = POINTER(struct__POINTFLOAT) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:81
+class struct__GLYPHMETRICSFLOAT(Structure):
+ __slots__ = [
+ 'gmfBlackBoxX',
+ 'gmfBlackBoxY',
+ 'gmfptGlyphOrigin',
+ 'gmfCellIncX',
+ 'gmfCellIncY',
+ ]
+struct__GLYPHMETRICSFLOAT._fields_ = [
+ ('gmfBlackBoxX', FLOAT),
+ ('gmfBlackBoxY', FLOAT),
+ ('gmfptGlyphOrigin', POINTFLOAT),
+ ('gmfCellIncX', FLOAT),
+ ('gmfCellIncY', FLOAT),
+]
+
+GLYPHMETRICSFLOAT = struct__GLYPHMETRICSFLOAT # C:\cygwin\home\Alex\pyglet\tools\wgl.h:89
+PGLYPHMETRICSFLOAT = POINTER(struct__GLYPHMETRICSFLOAT) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:89
+LPGLYPHMETRICSFLOAT = POINTER(struct__GLYPHMETRICSFLOAT) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:89
+WGL_FONT_LINES = 0 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:91
+WGL_FONT_POLYGONS = 1 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:92
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:93
+wglUseFontOutlinesA = _link_function('wglUseFontOutlinesA', BOOL, [HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, c_int, LPGLYPHMETRICSFLOAT], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:95
+wglUseFontOutlinesW = _link_function('wglUseFontOutlinesW', BOOL, [HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, c_int, LPGLYPHMETRICSFLOAT], None)
+
+class struct_tagLAYERPLANEDESCRIPTOR(Structure):
+ __slots__ = [
+ 'nSize',
+ 'nVersion',
+ 'dwFlags',
+ 'iPixelType',
+ 'cColorBits',
+ 'cRedBits',
+ 'cRedShift',
+ 'cGreenBits',
+ 'cGreenShift',
+ 'cBlueBits',
+ 'cBlueShift',
+ 'cAlphaBits',
+ 'cAlphaShift',
+ 'cAccumBits',
+ 'cAccumRedBits',
+ 'cAccumGreenBits',
+ 'cAccumBlueBits',
+ 'cAccumAlphaBits',
+ 'cDepthBits',
+ 'cStencilBits',
+ 'cAuxBuffers',
+ 'iLayerPlane',
+ 'bReserved',
+ 'crTransparent',
+ ]
+struct_tagLAYERPLANEDESCRIPTOR._fields_ = [
+ ('nSize', WORD),
+ ('nVersion', WORD),
+ ('dwFlags', DWORD),
+ ('iPixelType', BYTE),
+ ('cColorBits', BYTE),
+ ('cRedBits', BYTE),
+ ('cRedShift', BYTE),
+ ('cGreenBits', BYTE),
+ ('cGreenShift', BYTE),
+ ('cBlueBits', BYTE),
+ ('cBlueShift', BYTE),
+ ('cAlphaBits', BYTE),
+ ('cAlphaShift', BYTE),
+ ('cAccumBits', BYTE),
+ ('cAccumRedBits', BYTE),
+ ('cAccumGreenBits', BYTE),
+ ('cAccumBlueBits', BYTE),
+ ('cAccumAlphaBits', BYTE),
+ ('cDepthBits', BYTE),
+ ('cStencilBits', BYTE),
+ ('cAuxBuffers', BYTE),
+ ('iLayerPlane', BYTE),
+ ('bReserved', BYTE),
+ ('crTransparent', COLORREF),
+]
+
+LAYERPLANEDESCRIPTOR = struct_tagLAYERPLANEDESCRIPTOR # C:\cygwin\home\Alex\pyglet\tools\wgl.h:125
+PLAYERPLANEDESCRIPTOR = POINTER(struct_tagLAYERPLANEDESCRIPTOR) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:125
+LPLAYERPLANEDESCRIPTOR = POINTER(struct_tagLAYERPLANEDESCRIPTOR) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:125
+LPD_DOUBLEBUFFER = 1 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:128
+LPD_STEREO = 2 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:129
+LPD_SUPPORT_GDI = 16 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:130
+LPD_SUPPORT_OPENGL = 32 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:131
+LPD_SHARE_DEPTH = 64 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:132
+LPD_SHARE_STENCIL = 128 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:133
+LPD_SHARE_ACCUM = 256 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:134
+LPD_SWAP_EXCHANGE = 512 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:135
+LPD_SWAP_COPY = 1024 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:136
+LPD_TRANSPARENT = 4096 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:137
+LPD_TYPE_RGBA = 0 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:139
+LPD_TYPE_COLORINDEX = 1 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:140
+WGL_SWAP_MAIN_PLANE = 1 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:143
+WGL_SWAP_OVERLAY1 = 2 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:144
+WGL_SWAP_OVERLAY2 = 4 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:145
+WGL_SWAP_OVERLAY3 = 8 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:146
+WGL_SWAP_OVERLAY4 = 16 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:147
+WGL_SWAP_OVERLAY5 = 32 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:148
+WGL_SWAP_OVERLAY6 = 64 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:149
+WGL_SWAP_OVERLAY7 = 128 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:150
+WGL_SWAP_OVERLAY8 = 256 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:151
+WGL_SWAP_OVERLAY9 = 512 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:152
+WGL_SWAP_OVERLAY10 = 1024 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:153
+WGL_SWAP_OVERLAY11 = 2048 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:154
+WGL_SWAP_OVERLAY12 = 4096 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:155
+WGL_SWAP_OVERLAY13 = 8192 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:156
+WGL_SWAP_OVERLAY14 = 16384 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:157
+WGL_SWAP_OVERLAY15 = 32768 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:158
+WGL_SWAP_UNDERLAY1 = 65536 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:159
+WGL_SWAP_UNDERLAY2 = 131072 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:160
+WGL_SWAP_UNDERLAY3 = 262144 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:161
+WGL_SWAP_UNDERLAY4 = 524288 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:162
+WGL_SWAP_UNDERLAY5 = 1048576 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:163
+WGL_SWAP_UNDERLAY6 = 2097152 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:164
+WGL_SWAP_UNDERLAY7 = 4194304 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:165
+WGL_SWAP_UNDERLAY8 = 8388608 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:166
+WGL_SWAP_UNDERLAY9 = 16777216 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:167
+WGL_SWAP_UNDERLAY10 = 33554432 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:168
+WGL_SWAP_UNDERLAY11 = 67108864 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:169
+WGL_SWAP_UNDERLAY12 = 134217728 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:170
+WGL_SWAP_UNDERLAY13 = 268435456 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:171
+WGL_SWAP_UNDERLAY14 = 536870912 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:172
+WGL_SWAP_UNDERLAY15 = 1073741824 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:173
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:175
+wglDescribeLayerPlane = _link_function('wglDescribeLayerPlane', BOOL, [HDC, c_int, c_int, UINT, LPLAYERPLANEDESCRIPTOR], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:177
+wglSetLayerPaletteEntries = _link_function('wglSetLayerPaletteEntries', c_int, [HDC, c_int, c_int, c_int, POINTER(COLORREF)], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:179
+wglGetLayerPaletteEntries = _link_function('wglGetLayerPaletteEntries', c_int, [HDC, c_int, c_int, c_int, POINTER(COLORREF)], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:181
+wglRealizeLayerPalette = _link_function('wglRealizeLayerPalette', BOOL, [HDC, c_int, BOOL], None)
+
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:182
+wglSwapLayerBuffers = _link_function('wglSwapLayerBuffers', BOOL, [HDC, UINT], None)
+
+class struct__WGLSWAP(Structure):
+ __slots__ = [
+ 'hdc',
+ 'uiFlags',
+ ]
+struct__WGLSWAP._fields_ = [
+ ('hdc', HDC),
+ ('uiFlags', UINT),
+]
+
+WGLSWAP = struct__WGLSWAP # C:\cygwin\home\Alex\pyglet\tools\wgl.h:188
+PWGLSWAP = POINTER(struct__WGLSWAP) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:188
+LPWGLSWAP = POINTER(struct__WGLSWAP) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:188
+WGL_SWAPMULTIPLE_MAX = 16 # C:\cygwin\home\Alex\pyglet\tools\wgl.h:190
+# C:\cygwin\home\Alex\pyglet\tools\wgl.h:192
+wglSwapMultipleBuffers = _link_function('wglSwapMultipleBuffers', DWORD, [UINT, POINTER(WGLSWAP)], None)
+
+class struct_tagRECT(Structure):
+ __slots__ = [
+ 'left',
+ 'top',
+ 'right',
+ 'bottom',
+ ]
+struct_tagRECT._fields_ = [
+ ('left', LONG),
+ ('top', LONG),
+ ('right', LONG),
+ ('bottom', LONG),
+]
+
+RECT = struct_tagRECT # C:\cygwin\home\Alex\pyglet\tools\wgl.h:200
+PRECT = POINTER(struct_tagRECT) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:200
+NPRECT = POINTER(struct_tagRECT) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:200
+LPRECT = POINTER(struct_tagRECT) # C:\cygwin\home\Alex\pyglet\tools\wgl.h:200
+
+__all__ = ['CONST', 'GLenum', 'GLboolean', 'GLbitfield', 'GLbyte', 'GLshort',
+'GLint', 'GLsizei', 'GLubyte', 'GLushort', 'GLuint', 'GLfloat', 'GLclampf',
+'GLdouble', 'GLclampd', 'GLvoid', 'INT8', 'PINT8', 'INT16', 'PINT16', 'INT32',
+'PINT32', 'UINT8', 'PUINT8', 'UINT16', 'PUINT16', 'UINT32', 'PUINT32',
+'LONG32', 'PLONG32', 'ULONG32', 'PULONG32', 'DWORD32', 'PDWORD32', 'INT64',
+'PINT64', 'UINT64', 'PUINT64', 'VOID', 'LPVOID', 'LPCSTR', 'CHAR', 'BYTE',
+'WORD', 'USHORT', 'UINT', 'INT', 'INT_PTR', 'BOOL', 'LONG', 'DWORD', 'FLOAT',
+'COLORREF', 'LPCOLORREF', 'HANDLE', 'HGLRC', 'HDC', 'PROC', 'wglCopyContext',
+'wglCreateContext', 'wglCreateLayerContext', 'wglDeleteContext',
+'wglGetCurrentContext', 'wglGetCurrentDC', 'wglGetProcAddress',
+'wglMakeCurrent', 'wglShareLists', 'wglUseFontBitmapsA', 'wglUseFontBitmapsW',
+'SwapBuffers', 'POINTFLOAT', 'PPOINTFLOAT', 'GLYPHMETRICSFLOAT',
+'PGLYPHMETRICSFLOAT', 'LPGLYPHMETRICSFLOAT', 'WGL_FONT_LINES',
+'WGL_FONT_POLYGONS', 'wglUseFontOutlinesA', 'wglUseFontOutlinesW',
+'LAYERPLANEDESCRIPTOR', 'PLAYERPLANEDESCRIPTOR', 'LPLAYERPLANEDESCRIPTOR',
+'LPD_DOUBLEBUFFER', 'LPD_STEREO', 'LPD_SUPPORT_GDI', 'LPD_SUPPORT_OPENGL',
+'LPD_SHARE_DEPTH', 'LPD_SHARE_STENCIL', 'LPD_SHARE_ACCUM',
+'LPD_SWAP_EXCHANGE', 'LPD_SWAP_COPY', 'LPD_TRANSPARENT', 'LPD_TYPE_RGBA',
+'LPD_TYPE_COLORINDEX', 'WGL_SWAP_MAIN_PLANE', 'WGL_SWAP_OVERLAY1',
+'WGL_SWAP_OVERLAY2', 'WGL_SWAP_OVERLAY3', 'WGL_SWAP_OVERLAY4',
+'WGL_SWAP_OVERLAY5', 'WGL_SWAP_OVERLAY6', 'WGL_SWAP_OVERLAY7',
+'WGL_SWAP_OVERLAY8', 'WGL_SWAP_OVERLAY9', 'WGL_SWAP_OVERLAY10',
+'WGL_SWAP_OVERLAY11', 'WGL_SWAP_OVERLAY12', 'WGL_SWAP_OVERLAY13',
+'WGL_SWAP_OVERLAY14', 'WGL_SWAP_OVERLAY15', 'WGL_SWAP_UNDERLAY1',
+'WGL_SWAP_UNDERLAY2', 'WGL_SWAP_UNDERLAY3', 'WGL_SWAP_UNDERLAY4',
+'WGL_SWAP_UNDERLAY5', 'WGL_SWAP_UNDERLAY6', 'WGL_SWAP_UNDERLAY7',
+'WGL_SWAP_UNDERLAY8', 'WGL_SWAP_UNDERLAY9', 'WGL_SWAP_UNDERLAY10',
+'WGL_SWAP_UNDERLAY11', 'WGL_SWAP_UNDERLAY12', 'WGL_SWAP_UNDERLAY13',
+'WGL_SWAP_UNDERLAY14', 'WGL_SWAP_UNDERLAY15', 'wglDescribeLayerPlane',
+'wglSetLayerPaletteEntries', 'wglGetLayerPaletteEntries',
+'wglRealizeLayerPalette', 'wglSwapLayerBuffers', 'WGLSWAP', 'PWGLSWAP',
+'LPWGLSWAP', 'WGL_SWAPMULTIPLE_MAX', 'wglSwapMultipleBuffers', 'RECT',
+'PRECT', 'NPRECT', 'LPRECT']
+# END GENERATED CONTENT (do not edit above this line)
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/wgl_info.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/wgl_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..4d9783654bea65537ab82d6aedb9bdd0e88b7359
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/wgl_info.py
@@ -0,0 +1,38 @@
+"""Cached information about version and extensions of current WGL
+implementation.
+"""
+
+from ctypes import *
+import warnings
+
+from pyglet.gl.lib import MissingFunctionException
+from pyglet.gl.gl import *
+from pyglet.gl import gl_info
+from pyglet.gl.wgl import *
+from pyglet.gl.wglext_arb import *
+from pyglet.util import asstr
+
+
+class WGLInfoException(Exception):
+ pass
+
+
+class WGLInfo:
+ def get_extensions(self):
+ if not gl_info.have_context():
+ warnings.warn("Can't query WGL until a context is created.")
+ return []
+
+ try:
+ return asstr(wglGetExtensionsStringEXT()).split()
+ except MissingFunctionException:
+ return asstr(cast(glGetString(GL_EXTENSIONS), c_char_p).value).split()
+
+ def have_extension(self, extension):
+ return extension in self.get_extensions()
+
+
+_wgl_info = WGLInfo()
+
+get_extensions = _wgl_info.get_extensions
+have_extension = _wgl_info.have_extension
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/wglext_arb.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/wglext_arb.py
new file mode 100644
index 0000000000000000000000000000000000000000..ef3ac278344218819449ae6891ba3e8773f70d62
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/wglext_arb.py
@@ -0,0 +1,988 @@
+"""Wrapper for http://oss.sgi.com/projects/ogl-sample/ABI/wglext.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+"""
+
+from ctypes import *
+from pyglet.gl.lib import link_WGL as _link_function
+from pyglet.gl.lib import c_void
+
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for http://www.opengl.org/registry/api/wglext.h
+
+
+# H (C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:7)
+# H (C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:7)
+WIN32_LEAN_AND_MEAN = 1 # http://www.opengl.org/registry/api/wglext.h:34
+WGL_WGLEXT_VERSION = 11 # http://www.opengl.org/registry/api/wglext.h:53
+# ARB_buffer_region (http://www.opengl.org/registry/api/wglext.h:55)
+WGL_FRONT_COLOR_BUFFER_BIT_ARB = 1 # http://www.opengl.org/registry/api/wglext.h:56
+WGL_BACK_COLOR_BUFFER_BIT_ARB = 2 # http://www.opengl.org/registry/api/wglext.h:57
+WGL_DEPTH_BUFFER_BIT_ARB = 4 # http://www.opengl.org/registry/api/wglext.h:58
+WGL_STENCIL_BUFFER_BIT_ARB = 8 # http://www.opengl.org/registry/api/wglext.h:59
+# ARB_multisample (http://www.opengl.org/registry/api/wglext.h:62)
+WGL_SAMPLE_BUFFERS_ARB = 8257 # http://www.opengl.org/registry/api/wglext.h:63
+WGL_SAMPLES_ARB = 8258 # http://www.opengl.org/registry/api/wglext.h:64
+# ARB_extensions_string (http://www.opengl.org/registry/api/wglext.h:67)
+# ARB_pixel_format (http://www.opengl.org/registry/api/wglext.h:70)
+WGL_NUMBER_PIXEL_FORMATS_ARB = 8192 # http://www.opengl.org/registry/api/wglext.h:71
+WGL_DRAW_TO_WINDOW_ARB = 8193 # http://www.opengl.org/registry/api/wglext.h:72
+WGL_DRAW_TO_BITMAP_ARB = 8194 # http://www.opengl.org/registry/api/wglext.h:73
+WGL_ACCELERATION_ARB = 8195 # http://www.opengl.org/registry/api/wglext.h:74
+WGL_NEED_PALETTE_ARB = 8196 # http://www.opengl.org/registry/api/wglext.h:75
+WGL_NEED_SYSTEM_PALETTE_ARB = 8197 # http://www.opengl.org/registry/api/wglext.h:76
+WGL_SWAP_LAYER_BUFFERS_ARB = 8198 # http://www.opengl.org/registry/api/wglext.h:77
+WGL_SWAP_METHOD_ARB = 8199 # http://www.opengl.org/registry/api/wglext.h:78
+WGL_NUMBER_OVERLAYS_ARB = 8200 # http://www.opengl.org/registry/api/wglext.h:79
+WGL_NUMBER_UNDERLAYS_ARB = 8201 # http://www.opengl.org/registry/api/wglext.h:80
+WGL_TRANSPARENT_ARB = 8202 # http://www.opengl.org/registry/api/wglext.h:81
+WGL_TRANSPARENT_RED_VALUE_ARB = 8247 # http://www.opengl.org/registry/api/wglext.h:82
+WGL_TRANSPARENT_GREEN_VALUE_ARB = 8248 # http://www.opengl.org/registry/api/wglext.h:83
+WGL_TRANSPARENT_BLUE_VALUE_ARB = 8249 # http://www.opengl.org/registry/api/wglext.h:84
+WGL_TRANSPARENT_ALPHA_VALUE_ARB = 8250 # http://www.opengl.org/registry/api/wglext.h:85
+WGL_TRANSPARENT_INDEX_VALUE_ARB = 8251 # http://www.opengl.org/registry/api/wglext.h:86
+WGL_SHARE_DEPTH_ARB = 8204 # http://www.opengl.org/registry/api/wglext.h:87
+WGL_SHARE_STENCIL_ARB = 8205 # http://www.opengl.org/registry/api/wglext.h:88
+WGL_SHARE_ACCUM_ARB = 8206 # http://www.opengl.org/registry/api/wglext.h:89
+WGL_SUPPORT_GDI_ARB = 8207 # http://www.opengl.org/registry/api/wglext.h:90
+WGL_SUPPORT_OPENGL_ARB = 8208 # http://www.opengl.org/registry/api/wglext.h:91
+WGL_DOUBLE_BUFFER_ARB = 8209 # http://www.opengl.org/registry/api/wglext.h:92
+WGL_STEREO_ARB = 8210 # http://www.opengl.org/registry/api/wglext.h:93
+WGL_PIXEL_TYPE_ARB = 8211 # http://www.opengl.org/registry/api/wglext.h:94
+WGL_COLOR_BITS_ARB = 8212 # http://www.opengl.org/registry/api/wglext.h:95
+WGL_RED_BITS_ARB = 8213 # http://www.opengl.org/registry/api/wglext.h:96
+WGL_RED_SHIFT_ARB = 8214 # http://www.opengl.org/registry/api/wglext.h:97
+WGL_GREEN_BITS_ARB = 8215 # http://www.opengl.org/registry/api/wglext.h:98
+WGL_GREEN_SHIFT_ARB = 8216 # http://www.opengl.org/registry/api/wglext.h:99
+WGL_BLUE_BITS_ARB = 8217 # http://www.opengl.org/registry/api/wglext.h:100
+WGL_BLUE_SHIFT_ARB = 8218 # http://www.opengl.org/registry/api/wglext.h:101
+WGL_ALPHA_BITS_ARB = 8219 # http://www.opengl.org/registry/api/wglext.h:102
+WGL_ALPHA_SHIFT_ARB = 8220 # http://www.opengl.org/registry/api/wglext.h:103
+WGL_ACCUM_BITS_ARB = 8221 # http://www.opengl.org/registry/api/wglext.h:104
+WGL_ACCUM_RED_BITS_ARB = 8222 # http://www.opengl.org/registry/api/wglext.h:105
+WGL_ACCUM_GREEN_BITS_ARB = 8223 # http://www.opengl.org/registry/api/wglext.h:106
+WGL_ACCUM_BLUE_BITS_ARB = 8224 # http://www.opengl.org/registry/api/wglext.h:107
+WGL_ACCUM_ALPHA_BITS_ARB = 8225 # http://www.opengl.org/registry/api/wglext.h:108
+WGL_DEPTH_BITS_ARB = 8226 # http://www.opengl.org/registry/api/wglext.h:109
+WGL_STENCIL_BITS_ARB = 8227 # http://www.opengl.org/registry/api/wglext.h:110
+WGL_AUX_BUFFERS_ARB = 8228 # http://www.opengl.org/registry/api/wglext.h:111
+WGL_NO_ACCELERATION_ARB = 8229 # http://www.opengl.org/registry/api/wglext.h:112
+WGL_GENERIC_ACCELERATION_ARB = 8230 # http://www.opengl.org/registry/api/wglext.h:113
+WGL_FULL_ACCELERATION_ARB = 8231 # http://www.opengl.org/registry/api/wglext.h:114
+WGL_SWAP_EXCHANGE_ARB = 8232 # http://www.opengl.org/registry/api/wglext.h:115
+WGL_SWAP_COPY_ARB = 8233 # http://www.opengl.org/registry/api/wglext.h:116
+WGL_SWAP_UNDEFINED_ARB = 8234 # http://www.opengl.org/registry/api/wglext.h:117
+WGL_TYPE_RGBA_ARB = 8235 # http://www.opengl.org/registry/api/wglext.h:118
+WGL_TYPE_COLORINDEX_ARB = 8236 # http://www.opengl.org/registry/api/wglext.h:119
+# ARB_make_current_read (http://www.opengl.org/registry/api/wglext.h:122)
+ERROR_INVALID_PIXEL_TYPE_ARB = 8259 # http://www.opengl.org/registry/api/wglext.h:123
+ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = 8276 # http://www.opengl.org/registry/api/wglext.h:124
+# ARB_pbuffer (http://www.opengl.org/registry/api/wglext.h:127)
+WGL_DRAW_TO_PBUFFER_ARB = 8237 # http://www.opengl.org/registry/api/wglext.h:128
+WGL_MAX_PBUFFER_PIXELS_ARB = 8238 # http://www.opengl.org/registry/api/wglext.h:129
+WGL_MAX_PBUFFER_WIDTH_ARB = 8239 # http://www.opengl.org/registry/api/wglext.h:130
+WGL_MAX_PBUFFER_HEIGHT_ARB = 8240 # http://www.opengl.org/registry/api/wglext.h:131
+WGL_PBUFFER_LARGEST_ARB = 8243 # http://www.opengl.org/registry/api/wglext.h:132
+WGL_PBUFFER_WIDTH_ARB = 8244 # http://www.opengl.org/registry/api/wglext.h:133
+WGL_PBUFFER_HEIGHT_ARB = 8245 # http://www.opengl.org/registry/api/wglext.h:134
+WGL_PBUFFER_LOST_ARB = 8246 # http://www.opengl.org/registry/api/wglext.h:135
+# ARB_render_texture (http://www.opengl.org/registry/api/wglext.h:138)
+WGL_BIND_TO_TEXTURE_RGB_ARB = 8304 # http://www.opengl.org/registry/api/wglext.h:139
+WGL_BIND_TO_TEXTURE_RGBA_ARB = 8305 # http://www.opengl.org/registry/api/wglext.h:140
+WGL_TEXTURE_FORMAT_ARB = 8306 # http://www.opengl.org/registry/api/wglext.h:141
+WGL_TEXTURE_TARGET_ARB = 8307 # http://www.opengl.org/registry/api/wglext.h:142
+WGL_MIPMAP_TEXTURE_ARB = 8308 # http://www.opengl.org/registry/api/wglext.h:143
+WGL_TEXTURE_RGB_ARB = 8309 # http://www.opengl.org/registry/api/wglext.h:144
+WGL_TEXTURE_RGBA_ARB = 8310 # http://www.opengl.org/registry/api/wglext.h:145
+WGL_NO_TEXTURE_ARB = 8311 # http://www.opengl.org/registry/api/wglext.h:146
+WGL_TEXTURE_CUBE_MAP_ARB = 8312 # http://www.opengl.org/registry/api/wglext.h:147
+WGL_TEXTURE_1D_ARB = 8313 # http://www.opengl.org/registry/api/wglext.h:148
+WGL_TEXTURE_2D_ARB = 8314 # http://www.opengl.org/registry/api/wglext.h:149
+WGL_MIPMAP_LEVEL_ARB = 8315 # http://www.opengl.org/registry/api/wglext.h:150
+WGL_CUBE_MAP_FACE_ARB = 8316 # http://www.opengl.org/registry/api/wglext.h:151
+WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 8317 # http://www.opengl.org/registry/api/wglext.h:152
+WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 8318 # http://www.opengl.org/registry/api/wglext.h:153
+WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 8319 # http://www.opengl.org/registry/api/wglext.h:154
+WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 8320 # http://www.opengl.org/registry/api/wglext.h:155
+WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 8321 # http://www.opengl.org/registry/api/wglext.h:156
+WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 8322 # http://www.opengl.org/registry/api/wglext.h:157
+WGL_FRONT_LEFT_ARB = 8323 # http://www.opengl.org/registry/api/wglext.h:158
+WGL_FRONT_RIGHT_ARB = 8324 # http://www.opengl.org/registry/api/wglext.h:159
+WGL_BACK_LEFT_ARB = 8325 # http://www.opengl.org/registry/api/wglext.h:160
+WGL_BACK_RIGHT_ARB = 8326 # http://www.opengl.org/registry/api/wglext.h:161
+WGL_AUX0_ARB = 8327 # http://www.opengl.org/registry/api/wglext.h:162
+WGL_AUX1_ARB = 8328 # http://www.opengl.org/registry/api/wglext.h:163
+WGL_AUX2_ARB = 8329 # http://www.opengl.org/registry/api/wglext.h:164
+WGL_AUX3_ARB = 8330 # http://www.opengl.org/registry/api/wglext.h:165
+WGL_AUX4_ARB = 8331 # http://www.opengl.org/registry/api/wglext.h:166
+WGL_AUX5_ARB = 8332 # http://www.opengl.org/registry/api/wglext.h:167
+WGL_AUX6_ARB = 8333 # http://www.opengl.org/registry/api/wglext.h:168
+WGL_AUX7_ARB = 8334 # http://www.opengl.org/registry/api/wglext.h:169
+WGL_AUX8_ARB = 8335 # http://www.opengl.org/registry/api/wglext.h:170
+WGL_AUX9_ARB = 8336 # http://www.opengl.org/registry/api/wglext.h:171
+# ARB_pixel_format_float (http://www.opengl.org/registry/api/wglext.h:174)
+WGL_TYPE_RGBA_FLOAT_ARB = 8608 # http://www.opengl.org/registry/api/wglext.h:175
+# ARB_create_context (http://www.opengl.org/registry/api/wglext.h:178)
+WGL_CONTEXT_DEBUG_BIT_ARB = 1 # http://www.opengl.org/registry/api/wglext.h:179
+WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB = 2 # http://www.opengl.org/registry/api/wglext.h:180
+WGL_CONTEXT_MAJOR_VERSION_ARB = 8337 # http://www.opengl.org/registry/api/wglext.h:181
+WGL_CONTEXT_MINOR_VERSION_ARB = 8338 # http://www.opengl.org/registry/api/wglext.h:182
+WGL_CONTEXT_LAYER_PLANE_ARB = 8339 # http://www.opengl.org/registry/api/wglext.h:183
+WGL_CONTEXT_FLAGS_ARB = 8340 # http://www.opengl.org/registry/api/wglext.h:184
+ERROR_INVALID_VERSION_ARB = 8341 # http://www.opengl.org/registry/api/wglext.h:185
+# EXT_make_current_read (http://www.opengl.org/registry/api/wglext.h:188)
+ERROR_INVALID_PIXEL_TYPE_EXT = 8259 # http://www.opengl.org/registry/api/wglext.h:189
+# EXT_pixel_format (http://www.opengl.org/registry/api/wglext.h:192)
+WGL_NUMBER_PIXEL_FORMATS_EXT = 8192 # http://www.opengl.org/registry/api/wglext.h:193
+WGL_DRAW_TO_WINDOW_EXT = 8193 # http://www.opengl.org/registry/api/wglext.h:194
+WGL_DRAW_TO_BITMAP_EXT = 8194 # http://www.opengl.org/registry/api/wglext.h:195
+WGL_ACCELERATION_EXT = 8195 # http://www.opengl.org/registry/api/wglext.h:196
+WGL_NEED_PALETTE_EXT = 8196 # http://www.opengl.org/registry/api/wglext.h:197
+WGL_NEED_SYSTEM_PALETTE_EXT = 8197 # http://www.opengl.org/registry/api/wglext.h:198
+WGL_SWAP_LAYER_BUFFERS_EXT = 8198 # http://www.opengl.org/registry/api/wglext.h:199
+WGL_SWAP_METHOD_EXT = 8199 # http://www.opengl.org/registry/api/wglext.h:200
+WGL_NUMBER_OVERLAYS_EXT = 8200 # http://www.opengl.org/registry/api/wglext.h:201
+WGL_NUMBER_UNDERLAYS_EXT = 8201 # http://www.opengl.org/registry/api/wglext.h:202
+WGL_TRANSPARENT_EXT = 8202 # http://www.opengl.org/registry/api/wglext.h:203
+WGL_TRANSPARENT_VALUE_EXT = 8203 # http://www.opengl.org/registry/api/wglext.h:204
+WGL_SHARE_DEPTH_EXT = 8204 # http://www.opengl.org/registry/api/wglext.h:205
+WGL_SHARE_STENCIL_EXT = 8205 # http://www.opengl.org/registry/api/wglext.h:206
+WGL_SHARE_ACCUM_EXT = 8206 # http://www.opengl.org/registry/api/wglext.h:207
+WGL_SUPPORT_GDI_EXT = 8207 # http://www.opengl.org/registry/api/wglext.h:208
+WGL_SUPPORT_OPENGL_EXT = 8208 # http://www.opengl.org/registry/api/wglext.h:209
+WGL_DOUBLE_BUFFER_EXT = 8209 # http://www.opengl.org/registry/api/wglext.h:210
+WGL_STEREO_EXT = 8210 # http://www.opengl.org/registry/api/wglext.h:211
+WGL_PIXEL_TYPE_EXT = 8211 # http://www.opengl.org/registry/api/wglext.h:212
+WGL_COLOR_BITS_EXT = 8212 # http://www.opengl.org/registry/api/wglext.h:213
+WGL_RED_BITS_EXT = 8213 # http://www.opengl.org/registry/api/wglext.h:214
+WGL_RED_SHIFT_EXT = 8214 # http://www.opengl.org/registry/api/wglext.h:215
+WGL_GREEN_BITS_EXT = 8215 # http://www.opengl.org/registry/api/wglext.h:216
+WGL_GREEN_SHIFT_EXT = 8216 # http://www.opengl.org/registry/api/wglext.h:217
+WGL_BLUE_BITS_EXT = 8217 # http://www.opengl.org/registry/api/wglext.h:218
+WGL_BLUE_SHIFT_EXT = 8218 # http://www.opengl.org/registry/api/wglext.h:219
+WGL_ALPHA_BITS_EXT = 8219 # http://www.opengl.org/registry/api/wglext.h:220
+WGL_ALPHA_SHIFT_EXT = 8220 # http://www.opengl.org/registry/api/wglext.h:221
+WGL_ACCUM_BITS_EXT = 8221 # http://www.opengl.org/registry/api/wglext.h:222
+WGL_ACCUM_RED_BITS_EXT = 8222 # http://www.opengl.org/registry/api/wglext.h:223
+WGL_ACCUM_GREEN_BITS_EXT = 8223 # http://www.opengl.org/registry/api/wglext.h:224
+WGL_ACCUM_BLUE_BITS_EXT = 8224 # http://www.opengl.org/registry/api/wglext.h:225
+WGL_ACCUM_ALPHA_BITS_EXT = 8225 # http://www.opengl.org/registry/api/wglext.h:226
+WGL_DEPTH_BITS_EXT = 8226 # http://www.opengl.org/registry/api/wglext.h:227
+WGL_STENCIL_BITS_EXT = 8227 # http://www.opengl.org/registry/api/wglext.h:228
+WGL_AUX_BUFFERS_EXT = 8228 # http://www.opengl.org/registry/api/wglext.h:229
+WGL_NO_ACCELERATION_EXT = 8229 # http://www.opengl.org/registry/api/wglext.h:230
+WGL_GENERIC_ACCELERATION_EXT = 8230 # http://www.opengl.org/registry/api/wglext.h:231
+WGL_FULL_ACCELERATION_EXT = 8231 # http://www.opengl.org/registry/api/wglext.h:232
+WGL_SWAP_EXCHANGE_EXT = 8232 # http://www.opengl.org/registry/api/wglext.h:233
+WGL_SWAP_COPY_EXT = 8233 # http://www.opengl.org/registry/api/wglext.h:234
+WGL_SWAP_UNDEFINED_EXT = 8234 # http://www.opengl.org/registry/api/wglext.h:235
+WGL_TYPE_RGBA_EXT = 8235 # http://www.opengl.org/registry/api/wglext.h:236
+WGL_TYPE_COLORINDEX_EXT = 8236 # http://www.opengl.org/registry/api/wglext.h:237
+# EXT_pbuffer (http://www.opengl.org/registry/api/wglext.h:240)
+WGL_DRAW_TO_PBUFFER_EXT = 8237 # http://www.opengl.org/registry/api/wglext.h:241
+WGL_MAX_PBUFFER_PIXELS_EXT = 8238 # http://www.opengl.org/registry/api/wglext.h:242
+WGL_MAX_PBUFFER_WIDTH_EXT = 8239 # http://www.opengl.org/registry/api/wglext.h:243
+WGL_MAX_PBUFFER_HEIGHT_EXT = 8240 # http://www.opengl.org/registry/api/wglext.h:244
+WGL_OPTIMAL_PBUFFER_WIDTH_EXT = 8241 # http://www.opengl.org/registry/api/wglext.h:245
+WGL_OPTIMAL_PBUFFER_HEIGHT_EXT = 8242 # http://www.opengl.org/registry/api/wglext.h:246
+WGL_PBUFFER_LARGEST_EXT = 8243 # http://www.opengl.org/registry/api/wglext.h:247
+WGL_PBUFFER_WIDTH_EXT = 8244 # http://www.opengl.org/registry/api/wglext.h:248
+WGL_PBUFFER_HEIGHT_EXT = 8245 # http://www.opengl.org/registry/api/wglext.h:249
+# EXT_depth_float (http://www.opengl.org/registry/api/wglext.h:252)
+WGL_DEPTH_FLOAT_EXT = 8256 # http://www.opengl.org/registry/api/wglext.h:253
+# 3DFX_multisample (http://www.opengl.org/registry/api/wglext.h:256)
+WGL_SAMPLE_BUFFERS_3DFX = 8288 # http://www.opengl.org/registry/api/wglext.h:257
+WGL_SAMPLES_3DFX = 8289 # http://www.opengl.org/registry/api/wglext.h:258
+# EXT_multisample (http://www.opengl.org/registry/api/wglext.h:261)
+WGL_SAMPLE_BUFFERS_EXT = 8257 # http://www.opengl.org/registry/api/wglext.h:262
+WGL_SAMPLES_EXT = 8258 # http://www.opengl.org/registry/api/wglext.h:263
+# I3D_digital_video_control (http://www.opengl.org/registry/api/wglext.h:266)
+WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = 8272 # http://www.opengl.org/registry/api/wglext.h:267
+WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = 8273 # http://www.opengl.org/registry/api/wglext.h:268
+WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = 8274 # http://www.opengl.org/registry/api/wglext.h:269
+WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = 8275 # http://www.opengl.org/registry/api/wglext.h:270
+# I3D_gamma (http://www.opengl.org/registry/api/wglext.h:273)
+WGL_GAMMA_TABLE_SIZE_I3D = 8270 # http://www.opengl.org/registry/api/wglext.h:274
+WGL_GAMMA_EXCLUDE_DESKTOP_I3D = 8271 # http://www.opengl.org/registry/api/wglext.h:275
+# I3D_genlock (http://www.opengl.org/registry/api/wglext.h:278)
+WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = 8260 # http://www.opengl.org/registry/api/wglext.h:279
+WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D = 8261 # http://www.opengl.org/registry/api/wglext.h:280
+WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D = 8262 # http://www.opengl.org/registry/api/wglext.h:281
+WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D = 8263 # http://www.opengl.org/registry/api/wglext.h:282
+WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D = 8264 # http://www.opengl.org/registry/api/wglext.h:283
+WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D = 8265 # http://www.opengl.org/registry/api/wglext.h:284
+WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D = 8266 # http://www.opengl.org/registry/api/wglext.h:285
+WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = 8267 # http://www.opengl.org/registry/api/wglext.h:286
+WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = 8268 # http://www.opengl.org/registry/api/wglext.h:287
+# I3D_image_buffer (http://www.opengl.org/registry/api/wglext.h:290)
+WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = 1 # http://www.opengl.org/registry/api/wglext.h:291
+WGL_IMAGE_BUFFER_LOCK_I3D = 2 # http://www.opengl.org/registry/api/wglext.h:292
+# I3D_swap_frame_lock (http://www.opengl.org/registry/api/wglext.h:295)
+# NV_render_depth_texture (http://www.opengl.org/registry/api/wglext.h:298)
+WGL_BIND_TO_TEXTURE_DEPTH_NV = 8355 # http://www.opengl.org/registry/api/wglext.h:299
+WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = 8356 # http://www.opengl.org/registry/api/wglext.h:300
+WGL_DEPTH_TEXTURE_FORMAT_NV = 8357 # http://www.opengl.org/registry/api/wglext.h:301
+WGL_TEXTURE_DEPTH_COMPONENT_NV = 8358 # http://www.opengl.org/registry/api/wglext.h:302
+WGL_DEPTH_COMPONENT_NV = 8359 # http://www.opengl.org/registry/api/wglext.h:303
+# NV_render_texture_rectangle (http://www.opengl.org/registry/api/wglext.h:306)
+WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = 8352 # http://www.opengl.org/registry/api/wglext.h:307
+WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = 8353 # http://www.opengl.org/registry/api/wglext.h:308
+WGL_TEXTURE_RECTANGLE_NV = 8354 # http://www.opengl.org/registry/api/wglext.h:309
+# ATI_pixel_format_float (http://www.opengl.org/registry/api/wglext.h:312)
+WGL_TYPE_RGBA_FLOAT_ATI = 8608 # http://www.opengl.org/registry/api/wglext.h:313
+# NV_float_buffer (http://www.opengl.org/registry/api/wglext.h:316)
+WGL_FLOAT_COMPONENTS_NV = 8368 # http://www.opengl.org/registry/api/wglext.h:317
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = 8369 # http://www.opengl.org/registry/api/wglext.h:318
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = 8370 # http://www.opengl.org/registry/api/wglext.h:319
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = 8371 # http://www.opengl.org/registry/api/wglext.h:320
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = 8372 # http://www.opengl.org/registry/api/wglext.h:321
+WGL_TEXTURE_FLOAT_R_NV = 8373 # http://www.opengl.org/registry/api/wglext.h:322
+WGL_TEXTURE_FLOAT_RG_NV = 8374 # http://www.opengl.org/registry/api/wglext.h:323
+WGL_TEXTURE_FLOAT_RGB_NV = 8375 # http://www.opengl.org/registry/api/wglext.h:324
+WGL_TEXTURE_FLOAT_RGBA_NV = 8376 # http://www.opengl.org/registry/api/wglext.h:325
+# 3DL_stereo_control (http://www.opengl.org/registry/api/wglext.h:328)
+WGL_STEREO_EMITTER_ENABLE_3DL = 8277 # http://www.opengl.org/registry/api/wglext.h:329
+WGL_STEREO_EMITTER_DISABLE_3DL = 8278 # http://www.opengl.org/registry/api/wglext.h:330
+WGL_STEREO_POLARITY_NORMAL_3DL = 8279 # http://www.opengl.org/registry/api/wglext.h:331
+WGL_STEREO_POLARITY_INVERT_3DL = 8280 # http://www.opengl.org/registry/api/wglext.h:332
+# EXT_pixel_format_packed_float (http://www.opengl.org/registry/api/wglext.h:335)
+WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT = 8360 # http://www.opengl.org/registry/api/wglext.h:336
+# EXT_framebuffer_sRGB (http://www.opengl.org/registry/api/wglext.h:339)
+WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT = 8361 # http://www.opengl.org/registry/api/wglext.h:340
+# NV_present_video (http://www.opengl.org/registry/api/wglext.h:343)
+WGL_NUM_VIDEO_SLOTS_NV = 8432 # http://www.opengl.org/registry/api/wglext.h:344
+# NV_video_out (http://www.opengl.org/registry/api/wglext.h:347)
+WGL_BIND_TO_VIDEO_RGB_NV = 8384 # http://www.opengl.org/registry/api/wglext.h:348
+WGL_BIND_TO_VIDEO_RGBA_NV = 8385 # http://www.opengl.org/registry/api/wglext.h:349
+WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV = 8386 # http://www.opengl.org/registry/api/wglext.h:350
+WGL_VIDEO_OUT_COLOR_NV = 8387 # http://www.opengl.org/registry/api/wglext.h:351
+WGL_VIDEO_OUT_ALPHA_NV = 8388 # http://www.opengl.org/registry/api/wglext.h:352
+WGL_VIDEO_OUT_DEPTH_NV = 8389 # http://www.opengl.org/registry/api/wglext.h:353
+WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV = 8390 # http://www.opengl.org/registry/api/wglext.h:354
+WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV = 8391 # http://www.opengl.org/registry/api/wglext.h:355
+WGL_VIDEO_OUT_FRAME = 8392 # http://www.opengl.org/registry/api/wglext.h:356
+WGL_VIDEO_OUT_FIELD_1 = 8393 # http://www.opengl.org/registry/api/wglext.h:357
+WGL_VIDEO_OUT_FIELD_2 = 8394 # http://www.opengl.org/registry/api/wglext.h:358
+WGL_VIDEO_OUT_STACKED_FIELDS_1_2 = 8395 # http://www.opengl.org/registry/api/wglext.h:359
+WGL_VIDEO_OUT_STACKED_FIELDS_2_1 = 8396 # http://www.opengl.org/registry/api/wglext.h:360
+# NV_swap_group (http://www.opengl.org/registry/api/wglext.h:363)
+# NV_gpu_affinity (http://www.opengl.org/registry/api/wglext.h:366)
+WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV = 8400 # http://www.opengl.org/registry/api/wglext.h:367
+WGL_ERROR_MISSING_AFFINITY_MASK_NV = 8401 # http://www.opengl.org/registry/api/wglext.h:368
+# ARB_pbuffer (http://www.opengl.org/registry/api/wglext.h:374)
+HANDLE = POINTER(None) # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:58
+HPBUFFERARB = HANDLE # http://www.opengl.org/registry/api/wglext.h:375
+# EXT_pbuffer (http://www.opengl.org/registry/api/wglext.h:377)
+HPBUFFEREXT = HANDLE # http://www.opengl.org/registry/api/wglext.h:378
+# NV_present_video (http://www.opengl.org/registry/api/wglext.h:380)
+HVIDEOOUTPUTDEVICENV = HANDLE # http://www.opengl.org/registry/api/wglext.h:381
+# NV_video_out (http://www.opengl.org/registry/api/wglext.h:383)
+HPVIDEODEV = HANDLE # http://www.opengl.org/registry/api/wglext.h:384
+# NV_gpu_affinity (http://www.opengl.org/registry/api/wglext.h:386)
+HPGPUNV = HANDLE # http://www.opengl.org/registry/api/wglext.h:387
+HGPUNV = HANDLE # http://www.opengl.org/registry/api/wglext.h:388
+class struct__GPU_DEVICE(Structure):
+ __slots__ = [
+ 'cb',
+ 'DeviceName',
+ 'DeviceString',
+ 'Flags',
+ 'rcVirtualScreen',
+ ]
+DWORD = c_ulong # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:54
+CHAR = c_char # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:47
+class struct_tagRECT(Structure):
+ __slots__ = [
+ 'left',
+ 'top',
+ 'right',
+ 'bottom',
+ ]
+LONG = c_long # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:53
+struct_tagRECT._fields_ = [
+ ('left', LONG),
+ ('top', LONG),
+ ('right', LONG),
+ ('bottom', LONG),
+]
+
+RECT = struct_tagRECT # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:200
+struct__GPU_DEVICE._fields_ = [
+ ('cb', DWORD),
+ ('DeviceName', CHAR * 32),
+ ('DeviceString', CHAR * 128),
+ ('Flags', DWORD),
+ ('rcVirtualScreen', RECT),
+]
+
+GPU_DEVICE = struct__GPU_DEVICE # http://www.opengl.org/registry/api/wglext.h:396
+PGPU_DEVICE = POINTER(struct__GPU_DEVICE) # http://www.opengl.org/registry/api/wglext.h:396
+# ARB_buffer_region (http://www.opengl.org/registry/api/wglext.h:399)
+WGL_ARB_buffer_region = 1 # http://www.opengl.org/registry/api/wglext.h:400
+HDC = HANDLE # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:61
+UINT = c_uint # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:50
+# http://www.opengl.org/registry/api/wglext.h:402
+wglCreateBufferRegionARB = _link_function('wglCreateBufferRegionARB', HANDLE, [HDC, c_int, UINT], 'ARB_buffer_region')
+
+VOID = None # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:45
+# http://www.opengl.org/registry/api/wglext.h:403
+wglDeleteBufferRegionARB = _link_function('wglDeleteBufferRegionARB', VOID, [HANDLE], 'ARB_buffer_region')
+
+BOOL = c_long # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:52
+# http://www.opengl.org/registry/api/wglext.h:404
+wglSaveBufferRegionARB = _link_function('wglSaveBufferRegionARB', BOOL, [HANDLE, c_int, c_int, c_int, c_int], 'ARB_buffer_region')
+
+# http://www.opengl.org/registry/api/wglext.h:405
+wglRestoreBufferRegionARB = _link_function('wglRestoreBufferRegionARB', BOOL, [HANDLE, c_int, c_int, c_int, c_int, c_int, c_int], 'ARB_buffer_region')
+
+PFNWGLCREATEBUFFERREGIONARBPROC = CFUNCTYPE(HANDLE, HDC, c_int, UINT) # http://www.opengl.org/registry/api/wglext.h:407
+PFNWGLDELETEBUFFERREGIONARBPROC = CFUNCTYPE(VOID, HANDLE) # http://www.opengl.org/registry/api/wglext.h:408
+PFNWGLSAVEBUFFERREGIONARBPROC = CFUNCTYPE(BOOL, HANDLE, c_int, c_int, c_int, c_int) # http://www.opengl.org/registry/api/wglext.h:409
+PFNWGLRESTOREBUFFERREGIONARBPROC = CFUNCTYPE(BOOL, HANDLE, c_int, c_int, c_int, c_int, c_int, c_int) # http://www.opengl.org/registry/api/wglext.h:410
+# ARB_multisample (http://www.opengl.org/registry/api/wglext.h:413)
+WGL_ARB_multisample = 1 # http://www.opengl.org/registry/api/wglext.h:414
+# ARB_extensions_string (http://www.opengl.org/registry/api/wglext.h:417)
+WGL_ARB_extensions_string = 1 # http://www.opengl.org/registry/api/wglext.h:418
+# http://www.opengl.org/registry/api/wglext.h:420
+wglGetExtensionsStringARB = _link_function('wglGetExtensionsStringARB', c_char_p, [HDC], 'ARB_extensions_string')
+
+PFNWGLGETEXTENSIONSSTRINGARBPROC = CFUNCTYPE(c_char_p, HDC) # http://www.opengl.org/registry/api/wglext.h:422
+# ARB_pixel_format (http://www.opengl.org/registry/api/wglext.h:425)
+WGL_ARB_pixel_format = 1 # http://www.opengl.org/registry/api/wglext.h:426
+# http://www.opengl.org/registry/api/wglext.h:428
+wglGetPixelFormatAttribivARB = _link_function('wglGetPixelFormatAttribivARB', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)], 'ARB_pixel_format')
+
+FLOAT = c_float # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:55
+# http://www.opengl.org/registry/api/wglext.h:429
+wglGetPixelFormatAttribfvARB = _link_function('wglGetPixelFormatAttribfvARB', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)], 'ARB_pixel_format')
+
+# http://www.opengl.org/registry/api/wglext.h:430
+wglChoosePixelFormatARB = _link_function('wglChoosePixelFormatARB', BOOL, [HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)], 'ARB_pixel_format')
+
+PFNWGLGETPIXELFORMATATTRIBIVARBPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:432
+PFNWGLGETPIXELFORMATATTRIBFVARBPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)) # http://www.opengl.org/registry/api/wglext.h:433
+PFNWGLCHOOSEPIXELFORMATARBPROC = CFUNCTYPE(BOOL, HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:434
+# ARB_make_current_read (http://www.opengl.org/registry/api/wglext.h:437)
+WGL_ARB_make_current_read = 1 # http://www.opengl.org/registry/api/wglext.h:438
+HGLRC = HANDLE # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:60
+# http://www.opengl.org/registry/api/wglext.h:440
+wglMakeContextCurrentARB = _link_function('wglMakeContextCurrentARB', BOOL, [HDC, HDC, HGLRC], 'ARB_make_current_read')
+
+# http://www.opengl.org/registry/api/wglext.h:441
+wglGetCurrentReadDCARB = _link_function('wglGetCurrentReadDCARB', HDC, [], 'ARB_make_current_read')
+
+PFNWGLMAKECONTEXTCURRENTARBPROC = CFUNCTYPE(BOOL, HDC, HDC, HGLRC) # http://www.opengl.org/registry/api/wglext.h:443
+PFNWGLGETCURRENTREADDCARBPROC = CFUNCTYPE(HDC) # http://www.opengl.org/registry/api/wglext.h:444
+# ARB_pbuffer (http://www.opengl.org/registry/api/wglext.h:447)
+WGL_ARB_pbuffer = 1 # http://www.opengl.org/registry/api/wglext.h:448
+# http://www.opengl.org/registry/api/wglext.h:450
+wglCreatePbufferARB = _link_function('wglCreatePbufferARB', HPBUFFERARB, [HDC, c_int, c_int, c_int, POINTER(c_int)], 'ARB_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:451
+wglGetPbufferDCARB = _link_function('wglGetPbufferDCARB', HDC, [HPBUFFERARB], 'ARB_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:452
+wglReleasePbufferDCARB = _link_function('wglReleasePbufferDCARB', c_int, [HPBUFFERARB, HDC], 'ARB_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:453
+wglDestroyPbufferARB = _link_function('wglDestroyPbufferARB', BOOL, [HPBUFFERARB], 'ARB_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:454
+wglQueryPbufferARB = _link_function('wglQueryPbufferARB', BOOL, [HPBUFFERARB, c_int, POINTER(c_int)], 'ARB_pbuffer')
+
+PFNWGLCREATEPBUFFERARBPROC = CFUNCTYPE(HPBUFFERARB, HDC, c_int, c_int, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:456
+PFNWGLGETPBUFFERDCARBPROC = CFUNCTYPE(HDC, HPBUFFERARB) # http://www.opengl.org/registry/api/wglext.h:457
+PFNWGLRELEASEPBUFFERDCARBPROC = CFUNCTYPE(c_int, HPBUFFERARB, HDC) # http://www.opengl.org/registry/api/wglext.h:458
+PFNWGLDESTROYPBUFFERARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB) # http://www.opengl.org/registry/api/wglext.h:459
+PFNWGLQUERYPBUFFERARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:460
+# ARB_render_texture (http://www.opengl.org/registry/api/wglext.h:463)
+WGL_ARB_render_texture = 1 # http://www.opengl.org/registry/api/wglext.h:464
+# http://www.opengl.org/registry/api/wglext.h:466
+wglBindTexImageARB = _link_function('wglBindTexImageARB', BOOL, [HPBUFFERARB, c_int], 'ARB_render_texture')
+
+# http://www.opengl.org/registry/api/wglext.h:467
+wglReleaseTexImageARB = _link_function('wglReleaseTexImageARB', BOOL, [HPBUFFERARB, c_int], 'ARB_render_texture')
+
+# http://www.opengl.org/registry/api/wglext.h:468
+wglSetPbufferAttribARB = _link_function('wglSetPbufferAttribARB', BOOL, [HPBUFFERARB, POINTER(c_int)], 'ARB_render_texture')
+
+PFNWGLBINDTEXIMAGEARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int) # http://www.opengl.org/registry/api/wglext.h:470
+PFNWGLRELEASETEXIMAGEARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int) # http://www.opengl.org/registry/api/wglext.h:471
+PFNWGLSETPBUFFERATTRIBARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:472
+# ARB_pixel_format_float (http://www.opengl.org/registry/api/wglext.h:475)
+WGL_ARB_pixel_format_float = 1 # http://www.opengl.org/registry/api/wglext.h:476
+# ARB_create_context (http://www.opengl.org/registry/api/wglext.h:479)
+WGL_ARB_create_context = 1 # http://www.opengl.org/registry/api/wglext.h:480
+# http://www.opengl.org/registry/api/wglext.h:482
+wglCreateContextAttribsARB = _link_function('wglCreateContextAttribsARB', HGLRC, [HDC, HGLRC, POINTER(c_int)], 'ARB_create_context')
+
+PFNWGLCREATECONTEXTATTRIBSARBPROC = CFUNCTYPE(HGLRC, HDC, HGLRC, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:484
+# EXT_display_color_table (http://www.opengl.org/registry/api/wglext.h:487)
+WGL_EXT_display_color_table = 1 # http://www.opengl.org/registry/api/wglext.h:488
+GLboolean = c_ubyte # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:18
+GLushort = c_ushort # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:25
+# http://www.opengl.org/registry/api/wglext.h:490
+wglCreateDisplayColorTableEXT = _link_function('wglCreateDisplayColorTableEXT', GLboolean, [GLushort], 'EXT_display_color_table')
+
+GLuint = c_uint # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:26
+# http://www.opengl.org/registry/api/wglext.h:491
+wglLoadDisplayColorTableEXT = _link_function('wglLoadDisplayColorTableEXT', GLboolean, [POINTER(GLushort), GLuint], 'EXT_display_color_table')
+
+# http://www.opengl.org/registry/api/wglext.h:492
+wglBindDisplayColorTableEXT = _link_function('wglBindDisplayColorTableEXT', GLboolean, [GLushort], 'EXT_display_color_table')
+
+# http://www.opengl.org/registry/api/wglext.h:493
+wglDestroyDisplayColorTableEXT = _link_function('wglDestroyDisplayColorTableEXT', VOID, [GLushort], 'EXT_display_color_table')
+
+PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(GLboolean, GLushort) # http://www.opengl.org/registry/api/wglext.h:495
+PFNWGLLOADDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(GLboolean, POINTER(GLushort), GLuint) # http://www.opengl.org/registry/api/wglext.h:496
+PFNWGLBINDDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(GLboolean, GLushort) # http://www.opengl.org/registry/api/wglext.h:497
+PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(VOID, GLushort) # http://www.opengl.org/registry/api/wglext.h:498
+# EXT_extensions_string (http://www.opengl.org/registry/api/wglext.h:501)
+WGL_EXT_extensions_string = 1 # http://www.opengl.org/registry/api/wglext.h:502
+# http://www.opengl.org/registry/api/wglext.h:504
+wglGetExtensionsStringEXT = _link_function('wglGetExtensionsStringEXT', c_char_p, [], 'EXT_extensions_string')
+
+PFNWGLGETEXTENSIONSSTRINGEXTPROC = CFUNCTYPE(c_char_p) # http://www.opengl.org/registry/api/wglext.h:506
+# EXT_make_current_read (http://www.opengl.org/registry/api/wglext.h:509)
+WGL_EXT_make_current_read = 1 # http://www.opengl.org/registry/api/wglext.h:510
+# http://www.opengl.org/registry/api/wglext.h:512
+wglMakeContextCurrentEXT = _link_function('wglMakeContextCurrentEXT', BOOL, [HDC, HDC, HGLRC], 'EXT_make_current_read')
+
+# http://www.opengl.org/registry/api/wglext.h:513
+wglGetCurrentReadDCEXT = _link_function('wglGetCurrentReadDCEXT', HDC, [], 'EXT_make_current_read')
+
+PFNWGLMAKECONTEXTCURRENTEXTPROC = CFUNCTYPE(BOOL, HDC, HDC, HGLRC) # http://www.opengl.org/registry/api/wglext.h:515
+PFNWGLGETCURRENTREADDCEXTPROC = CFUNCTYPE(HDC) # http://www.opengl.org/registry/api/wglext.h:516
+# EXT_pbuffer (http://www.opengl.org/registry/api/wglext.h:519)
+WGL_EXT_pbuffer = 1 # http://www.opengl.org/registry/api/wglext.h:520
+# http://www.opengl.org/registry/api/wglext.h:522
+wglCreatePbufferEXT = _link_function('wglCreatePbufferEXT', HPBUFFEREXT, [HDC, c_int, c_int, c_int, POINTER(c_int)], 'EXT_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:523
+wglGetPbufferDCEXT = _link_function('wglGetPbufferDCEXT', HDC, [HPBUFFEREXT], 'EXT_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:524
+wglReleasePbufferDCEXT = _link_function('wglReleasePbufferDCEXT', c_int, [HPBUFFEREXT, HDC], 'EXT_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:525
+wglDestroyPbufferEXT = _link_function('wglDestroyPbufferEXT', BOOL, [HPBUFFEREXT], 'EXT_pbuffer')
+
+# http://www.opengl.org/registry/api/wglext.h:526
+wglQueryPbufferEXT = _link_function('wglQueryPbufferEXT', BOOL, [HPBUFFEREXT, c_int, POINTER(c_int)], 'EXT_pbuffer')
+
+PFNWGLCREATEPBUFFEREXTPROC = CFUNCTYPE(HPBUFFEREXT, HDC, c_int, c_int, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:528
+PFNWGLGETPBUFFERDCEXTPROC = CFUNCTYPE(HDC, HPBUFFEREXT) # http://www.opengl.org/registry/api/wglext.h:529
+PFNWGLRELEASEPBUFFERDCEXTPROC = CFUNCTYPE(c_int, HPBUFFEREXT, HDC) # http://www.opengl.org/registry/api/wglext.h:530
+PFNWGLDESTROYPBUFFEREXTPROC = CFUNCTYPE(BOOL, HPBUFFEREXT) # http://www.opengl.org/registry/api/wglext.h:531
+PFNWGLQUERYPBUFFEREXTPROC = CFUNCTYPE(BOOL, HPBUFFEREXT, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:532
+# EXT_pixel_format (http://www.opengl.org/registry/api/wglext.h:535)
+WGL_EXT_pixel_format = 1 # http://www.opengl.org/registry/api/wglext.h:536
+# http://www.opengl.org/registry/api/wglext.h:538
+wglGetPixelFormatAttribivEXT = _link_function('wglGetPixelFormatAttribivEXT', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)], 'EXT_pixel_format')
+
+# http://www.opengl.org/registry/api/wglext.h:539
+wglGetPixelFormatAttribfvEXT = _link_function('wglGetPixelFormatAttribfvEXT', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)], 'EXT_pixel_format')
+
+# http://www.opengl.org/registry/api/wglext.h:540
+wglChoosePixelFormatEXT = _link_function('wglChoosePixelFormatEXT', BOOL, [HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)], 'EXT_pixel_format')
+
+PFNWGLGETPIXELFORMATATTRIBIVEXTPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:542
+PFNWGLGETPIXELFORMATATTRIBFVEXTPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)) # http://www.opengl.org/registry/api/wglext.h:543
+PFNWGLCHOOSEPIXELFORMATEXTPROC = CFUNCTYPE(BOOL, HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:544
+# EXT_swap_control (http://www.opengl.org/registry/api/wglext.h:547)
+WGL_EXT_swap_control = 1 # http://www.opengl.org/registry/api/wglext.h:548
+# http://www.opengl.org/registry/api/wglext.h:550
+wglSwapIntervalEXT = _link_function('wglSwapIntervalEXT', BOOL, [c_int], 'EXT_swap_control')
+
+# http://www.opengl.org/registry/api/wglext.h:551
+wglGetSwapIntervalEXT = _link_function('wglGetSwapIntervalEXT', c_int, [], 'EXT_swap_control')
+
+PFNWGLSWAPINTERVALEXTPROC = CFUNCTYPE(BOOL, c_int) # http://www.opengl.org/registry/api/wglext.h:553
+PFNWGLGETSWAPINTERVALEXTPROC = CFUNCTYPE(c_int) # http://www.opengl.org/registry/api/wglext.h:554
+# EXT_depth_float (http://www.opengl.org/registry/api/wglext.h:557)
+WGL_EXT_depth_float = 1 # http://www.opengl.org/registry/api/wglext.h:558
+# NV_vertex_array_range (http://www.opengl.org/registry/api/wglext.h:561)
+WGL_NV_vertex_array_range = 1 # http://www.opengl.org/registry/api/wglext.h:562
+GLsizei = c_int # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:23
+GLfloat = c_float # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:27
+# http://www.opengl.org/registry/api/wglext.h:564
+wglAllocateMemoryNV = _link_function('wglAllocateMemoryNV', POINTER(c_void), [GLsizei, GLfloat, GLfloat, GLfloat], 'NV_vertex_array_range')
+
+# http://www.opengl.org/registry/api/wglext.h:565
+wglFreeMemoryNV = _link_function('wglFreeMemoryNV', None, [POINTER(None)], 'NV_vertex_array_range')
+
+PFNWGLALLOCATEMEMORYNVPROC = CFUNCTYPE(POINTER(c_void), GLsizei, GLfloat, GLfloat, GLfloat) # http://www.opengl.org/registry/api/wglext.h:567
+PFNWGLFREEMEMORYNVPROC = CFUNCTYPE(None, POINTER(None)) # http://www.opengl.org/registry/api/wglext.h:568
+# 3DFX_multisample (http://www.opengl.org/registry/api/wglext.h:571)
+WGL_3DFX_multisample = 1 # http://www.opengl.org/registry/api/wglext.h:572
+# EXT_multisample (http://www.opengl.org/registry/api/wglext.h:575)
+WGL_EXT_multisample = 1 # http://www.opengl.org/registry/api/wglext.h:576
+# OML_sync_control (http://www.opengl.org/registry/api/wglext.h:579)
+WGL_OML_sync_control = 1 # http://www.opengl.org/registry/api/wglext.h:580
+INT64 = c_longlong # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:42
+# http://www.opengl.org/registry/api/wglext.h:582
+wglGetSyncValuesOML = _link_function('wglGetSyncValuesOML', BOOL, [HDC, POINTER(INT64), POINTER(INT64), POINTER(INT64)], 'OML_sync_control')
+
+INT32 = c_int # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:35
+# http://www.opengl.org/registry/api/wglext.h:583
+wglGetMscRateOML = _link_function('wglGetMscRateOML', BOOL, [HDC, POINTER(INT32), POINTER(INT32)], 'OML_sync_control')
+
+# http://www.opengl.org/registry/api/wglext.h:584
+wglSwapBuffersMscOML = _link_function('wglSwapBuffersMscOML', INT64, [HDC, INT64, INT64, INT64], 'OML_sync_control')
+
+# http://www.opengl.org/registry/api/wglext.h:585
+wglSwapLayerBuffersMscOML = _link_function('wglSwapLayerBuffersMscOML', INT64, [HDC, c_int, INT64, INT64, INT64], 'OML_sync_control')
+
+# http://www.opengl.org/registry/api/wglext.h:586
+wglWaitForMscOML = _link_function('wglWaitForMscOML', BOOL, [HDC, INT64, INT64, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)], 'OML_sync_control')
+
+# http://www.opengl.org/registry/api/wglext.h:587
+wglWaitForSbcOML = _link_function('wglWaitForSbcOML', BOOL, [HDC, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)], 'OML_sync_control')
+
+PFNWGLGETSYNCVALUESOMLPROC = CFUNCTYPE(BOOL, HDC, POINTER(INT64), POINTER(INT64), POINTER(INT64)) # http://www.opengl.org/registry/api/wglext.h:589
+PFNWGLGETMSCRATEOMLPROC = CFUNCTYPE(BOOL, HDC, POINTER(INT32), POINTER(INT32)) # http://www.opengl.org/registry/api/wglext.h:590
+PFNWGLSWAPBUFFERSMSCOMLPROC = CFUNCTYPE(INT64, HDC, INT64, INT64, INT64) # http://www.opengl.org/registry/api/wglext.h:591
+PFNWGLSWAPLAYERBUFFERSMSCOMLPROC = CFUNCTYPE(INT64, HDC, c_int, INT64, INT64, INT64) # http://www.opengl.org/registry/api/wglext.h:592
+PFNWGLWAITFORMSCOMLPROC = CFUNCTYPE(BOOL, HDC, INT64, INT64, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)) # http://www.opengl.org/registry/api/wglext.h:593
+PFNWGLWAITFORSBCOMLPROC = CFUNCTYPE(BOOL, HDC, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)) # http://www.opengl.org/registry/api/wglext.h:594
+# I3D_digital_video_control (http://www.opengl.org/registry/api/wglext.h:597)
+WGL_I3D_digital_video_control = 1 # http://www.opengl.org/registry/api/wglext.h:598
+# http://www.opengl.org/registry/api/wglext.h:600
+wglGetDigitalVideoParametersI3D = _link_function('wglGetDigitalVideoParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_digital_video_control')
+
+# http://www.opengl.org/registry/api/wglext.h:601
+wglSetDigitalVideoParametersI3D = _link_function('wglSetDigitalVideoParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_digital_video_control')
+
+PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:603
+PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:604
+# I3D_gamma (http://www.opengl.org/registry/api/wglext.h:607)
+WGL_I3D_gamma = 1 # http://www.opengl.org/registry/api/wglext.h:608
+# http://www.opengl.org/registry/api/wglext.h:610
+wglGetGammaTableParametersI3D = _link_function('wglGetGammaTableParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_gamma')
+
+# http://www.opengl.org/registry/api/wglext.h:611
+wglSetGammaTableParametersI3D = _link_function('wglSetGammaTableParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_gamma')
+
+USHORT = c_ushort # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:49
+# http://www.opengl.org/registry/api/wglext.h:612
+wglGetGammaTableI3D = _link_function('wglGetGammaTableI3D', BOOL, [HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)], 'I3D_gamma')
+
+# http://www.opengl.org/registry/api/wglext.h:613
+wglSetGammaTableI3D = _link_function('wglSetGammaTableI3D', BOOL, [HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)], 'I3D_gamma')
+
+PFNWGLGETGAMMATABLEPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:615
+PFNWGLSETGAMMATABLEPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:616
+PFNWGLGETGAMMATABLEI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)) # http://www.opengl.org/registry/api/wglext.h:617
+PFNWGLSETGAMMATABLEI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)) # http://www.opengl.org/registry/api/wglext.h:618
+# I3D_genlock (http://www.opengl.org/registry/api/wglext.h:621)
+WGL_I3D_genlock = 1 # http://www.opengl.org/registry/api/wglext.h:622
+# http://www.opengl.org/registry/api/wglext.h:624
+wglEnableGenlockI3D = _link_function('wglEnableGenlockI3D', BOOL, [HDC], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:625
+wglDisableGenlockI3D = _link_function('wglDisableGenlockI3D', BOOL, [HDC], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:626
+wglIsEnabledGenlockI3D = _link_function('wglIsEnabledGenlockI3D', BOOL, [HDC, POINTER(BOOL)], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:627
+wglGenlockSourceI3D = _link_function('wglGenlockSourceI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:628
+wglGetGenlockSourceI3D = _link_function('wglGetGenlockSourceI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:629
+wglGenlockSourceEdgeI3D = _link_function('wglGenlockSourceEdgeI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:630
+wglGetGenlockSourceEdgeI3D = _link_function('wglGetGenlockSourceEdgeI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:631
+wglGenlockSampleRateI3D = _link_function('wglGenlockSampleRateI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:632
+wglGetGenlockSampleRateI3D = _link_function('wglGetGenlockSampleRateI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:633
+wglGenlockSourceDelayI3D = _link_function('wglGenlockSourceDelayI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:634
+wglGetGenlockSourceDelayI3D = _link_function('wglGetGenlockSourceDelayI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://www.opengl.org/registry/api/wglext.h:635
+wglQueryGenlockMaxSourceDelayI3D = _link_function('wglQueryGenlockMaxSourceDelayI3D', BOOL, [HDC, POINTER(UINT), POINTER(UINT)], 'I3D_genlock')
+
+PFNWGLENABLEGENLOCKI3DPROC = CFUNCTYPE(BOOL, HDC) # http://www.opengl.org/registry/api/wglext.h:637
+PFNWGLDISABLEGENLOCKI3DPROC = CFUNCTYPE(BOOL, HDC) # http://www.opengl.org/registry/api/wglext.h:638
+PFNWGLISENABLEDGENLOCKI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(BOOL)) # http://www.opengl.org/registry/api/wglext.h:639
+PFNWGLGENLOCKSOURCEI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://www.opengl.org/registry/api/wglext.h:640
+PFNWGLGETGENLOCKSOURCEI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:641
+PFNWGLGENLOCKSOURCEEDGEI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://www.opengl.org/registry/api/wglext.h:642
+PFNWGLGETGENLOCKSOURCEEDGEI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:643
+PFNWGLGENLOCKSAMPLERATEI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://www.opengl.org/registry/api/wglext.h:644
+PFNWGLGETGENLOCKSAMPLERATEI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:645
+PFNWGLGENLOCKSOURCEDELAYI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://www.opengl.org/registry/api/wglext.h:646
+PFNWGLGETGENLOCKSOURCEDELAYI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:647
+PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT), POINTER(UINT)) # http://www.opengl.org/registry/api/wglext.h:648
+# I3D_image_buffer (http://www.opengl.org/registry/api/wglext.h:651)
+WGL_I3D_image_buffer = 1 # http://www.opengl.org/registry/api/wglext.h:652
+LPVOID = POINTER(None) # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:45
+# http://www.opengl.org/registry/api/wglext.h:654
+wglCreateImageBufferI3D = _link_function('wglCreateImageBufferI3D', LPVOID, [HDC, DWORD, UINT], 'I3D_image_buffer')
+
+# http://www.opengl.org/registry/api/wglext.h:655
+wglDestroyImageBufferI3D = _link_function('wglDestroyImageBufferI3D', BOOL, [HDC, LPVOID], 'I3D_image_buffer')
+
+# http://www.opengl.org/registry/api/wglext.h:656
+wglAssociateImageBufferEventsI3D = _link_function('wglAssociateImageBufferEventsI3D', BOOL, [HDC, POINTER(HANDLE), POINTER(LPVOID), POINTER(DWORD), UINT], 'I3D_image_buffer')
+
+# http://www.opengl.org/registry/api/wglext.h:657
+wglReleaseImageBufferEventsI3D = _link_function('wglReleaseImageBufferEventsI3D', BOOL, [HDC, POINTER(LPVOID), UINT], 'I3D_image_buffer')
+
+PFNWGLCREATEIMAGEBUFFERI3DPROC = CFUNCTYPE(LPVOID, HDC, DWORD, UINT) # http://www.opengl.org/registry/api/wglext.h:659
+PFNWGLDESTROYIMAGEBUFFERI3DPROC = CFUNCTYPE(BOOL, HDC, LPVOID) # http://www.opengl.org/registry/api/wglext.h:660
+PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(HANDLE), POINTER(LPVOID), POINTER(DWORD), UINT) # http://www.opengl.org/registry/api/wglext.h:661
+PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(LPVOID), UINT) # http://www.opengl.org/registry/api/wglext.h:662
+# I3D_swap_frame_lock (http://www.opengl.org/registry/api/wglext.h:665)
+WGL_I3D_swap_frame_lock = 1 # http://www.opengl.org/registry/api/wglext.h:666
+# http://www.opengl.org/registry/api/wglext.h:668
+wglEnableFrameLockI3D = _link_function('wglEnableFrameLockI3D', BOOL, [], 'I3D_swap_frame_lock')
+
+# http://www.opengl.org/registry/api/wglext.h:669
+wglDisableFrameLockI3D = _link_function('wglDisableFrameLockI3D', BOOL, [], 'I3D_swap_frame_lock')
+
+# http://www.opengl.org/registry/api/wglext.h:670
+wglIsEnabledFrameLockI3D = _link_function('wglIsEnabledFrameLockI3D', BOOL, [POINTER(BOOL)], 'I3D_swap_frame_lock')
+
+# http://www.opengl.org/registry/api/wglext.h:671
+wglQueryFrameLockMasterI3D = _link_function('wglQueryFrameLockMasterI3D', BOOL, [POINTER(BOOL)], 'I3D_swap_frame_lock')
+
+PFNWGLENABLEFRAMELOCKI3DPROC = CFUNCTYPE(BOOL) # http://www.opengl.org/registry/api/wglext.h:673
+PFNWGLDISABLEFRAMELOCKI3DPROC = CFUNCTYPE(BOOL) # http://www.opengl.org/registry/api/wglext.h:674
+PFNWGLISENABLEDFRAMELOCKI3DPROC = CFUNCTYPE(BOOL, POINTER(BOOL)) # http://www.opengl.org/registry/api/wglext.h:675
+PFNWGLQUERYFRAMELOCKMASTERI3DPROC = CFUNCTYPE(BOOL, POINTER(BOOL)) # http://www.opengl.org/registry/api/wglext.h:676
+# I3D_swap_frame_usage (http://www.opengl.org/registry/api/wglext.h:679)
+WGL_I3D_swap_frame_usage = 1 # http://www.opengl.org/registry/api/wglext.h:680
+# http://www.opengl.org/registry/api/wglext.h:682
+wglGetFrameUsageI3D = _link_function('wglGetFrameUsageI3D', BOOL, [POINTER(c_float)], 'I3D_swap_frame_usage')
+
+# http://www.opengl.org/registry/api/wglext.h:683
+wglBeginFrameTrackingI3D = _link_function('wglBeginFrameTrackingI3D', BOOL, [], 'I3D_swap_frame_usage')
+
+# http://www.opengl.org/registry/api/wglext.h:684
+wglEndFrameTrackingI3D = _link_function('wglEndFrameTrackingI3D', BOOL, [], 'I3D_swap_frame_usage')
+
+# http://www.opengl.org/registry/api/wglext.h:685
+wglQueryFrameTrackingI3D = _link_function('wglQueryFrameTrackingI3D', BOOL, [POINTER(DWORD), POINTER(DWORD), POINTER(c_float)], 'I3D_swap_frame_usage')
+
+PFNWGLGETFRAMEUSAGEI3DPROC = CFUNCTYPE(BOOL, POINTER(c_float)) # http://www.opengl.org/registry/api/wglext.h:687
+PFNWGLBEGINFRAMETRACKINGI3DPROC = CFUNCTYPE(BOOL) # http://www.opengl.org/registry/api/wglext.h:688
+PFNWGLENDFRAMETRACKINGI3DPROC = CFUNCTYPE(BOOL) # http://www.opengl.org/registry/api/wglext.h:689
+PFNWGLQUERYFRAMETRACKINGI3DPROC = CFUNCTYPE(BOOL, POINTER(DWORD), POINTER(DWORD), POINTER(c_float)) # http://www.opengl.org/registry/api/wglext.h:690
+# ATI_pixel_format_float (http://www.opengl.org/registry/api/wglext.h:693)
+WGL_ATI_pixel_format_float = 1 # http://www.opengl.org/registry/api/wglext.h:694
+# NV_float_buffer (http://www.opengl.org/registry/api/wglext.h:697)
+WGL_NV_float_buffer = 1 # http://www.opengl.org/registry/api/wglext.h:698
+# EXT_pixel_format_packed_float (http://www.opengl.org/registry/api/wglext.h:701)
+WGL_EXT_pixel_format_packed_float = 1 # http://www.opengl.org/registry/api/wglext.h:702
+# EXT_framebuffer_sRGB (http://www.opengl.org/registry/api/wglext.h:705)
+WGL_EXT_framebuffer_sRGB = 1 # http://www.opengl.org/registry/api/wglext.h:706
+# NV_present_video (http://www.opengl.org/registry/api/wglext.h:709)
+WGL_NV_present_video = 1 # http://www.opengl.org/registry/api/wglext.h:710
+# http://www.opengl.org/registry/api/wglext.h:712
+wglEnumerateVideoDevicesNV = _link_function('wglEnumerateVideoDevicesNV', c_int, [HDC, POINTER(HVIDEOOUTPUTDEVICENV)], 'NV_present_video')
+
+# http://www.opengl.org/registry/api/wglext.h:713
+wglBindVideoDeviceNV = _link_function('wglBindVideoDeviceNV', BOOL, [HDC, c_uint, HVIDEOOUTPUTDEVICENV, POINTER(c_int)], 'NV_present_video')
+
+# http://www.opengl.org/registry/api/wglext.h:714
+wglQueryCurrentContextNV = _link_function('wglQueryCurrentContextNV', BOOL, [c_int, POINTER(c_int)], 'NV_present_video')
+
+PFNWGLENUMERATEVIDEODEVICESNVPROC = CFUNCTYPE(c_int, HDC, POINTER(HVIDEOOUTPUTDEVICENV)) # http://www.opengl.org/registry/api/wglext.h:716
+PFNWGLBINDVIDEODEVICENVPROC = CFUNCTYPE(BOOL, HDC, c_uint, HVIDEOOUTPUTDEVICENV, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:717
+PFNWGLQUERYCURRENTCONTEXTNVPROC = CFUNCTYPE(BOOL, c_int, POINTER(c_int)) # http://www.opengl.org/registry/api/wglext.h:718
+# NV_video_out (http://www.opengl.org/registry/api/wglext.h:721)
+WGL_NV_video_out = 1 # http://www.opengl.org/registry/api/wglext.h:722
+# http://www.opengl.org/registry/api/wglext.h:724
+wglGetVideoDeviceNV = _link_function('wglGetVideoDeviceNV', BOOL, [HDC, c_int, POINTER(HPVIDEODEV)], 'NV_video_out')
+
+# http://www.opengl.org/registry/api/wglext.h:725
+wglReleaseVideoDeviceNV = _link_function('wglReleaseVideoDeviceNV', BOOL, [HPVIDEODEV], 'NV_video_out')
+
+# http://www.opengl.org/registry/api/wglext.h:726
+wglBindVideoImageNV = _link_function('wglBindVideoImageNV', BOOL, [HPVIDEODEV, HPBUFFERARB, c_int], 'NV_video_out')
+
+# http://www.opengl.org/registry/api/wglext.h:727
+wglReleaseVideoImageNV = _link_function('wglReleaseVideoImageNV', BOOL, [HPBUFFERARB, c_int], 'NV_video_out')
+
+# http://www.opengl.org/registry/api/wglext.h:728
+wglSendPbufferToVideoNV = _link_function('wglSendPbufferToVideoNV', BOOL, [HPBUFFERARB, c_int, POINTER(c_ulong), BOOL], 'NV_video_out')
+
+# http://www.opengl.org/registry/api/wglext.h:729
+wglGetVideoInfoNV = _link_function('wglGetVideoInfoNV', BOOL, [HPVIDEODEV, POINTER(c_ulong), POINTER(c_ulong)], 'NV_video_out')
+
+PFNWGLGETVIDEODEVICENVPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(HPVIDEODEV)) # http://www.opengl.org/registry/api/wglext.h:731
+PFNWGLRELEASEVIDEODEVICENVPROC = CFUNCTYPE(BOOL, HPVIDEODEV) # http://www.opengl.org/registry/api/wglext.h:732
+PFNWGLBINDVIDEOIMAGENVPROC = CFUNCTYPE(BOOL, HPVIDEODEV, HPBUFFERARB, c_int) # http://www.opengl.org/registry/api/wglext.h:733
+PFNWGLRELEASEVIDEOIMAGENVPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int) # http://www.opengl.org/registry/api/wglext.h:734
+PFNWGLSENDPBUFFERTOVIDEONVPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int, POINTER(c_ulong), BOOL) # http://www.opengl.org/registry/api/wglext.h:735
+PFNWGLGETVIDEOINFONVPROC = CFUNCTYPE(BOOL, HPVIDEODEV, POINTER(c_ulong), POINTER(c_ulong)) # http://www.opengl.org/registry/api/wglext.h:736
+# NV_swap_group (http://www.opengl.org/registry/api/wglext.h:739)
+WGL_NV_swap_group = 1 # http://www.opengl.org/registry/api/wglext.h:740
+# http://www.opengl.org/registry/api/wglext.h:742
+wglJoinSwapGroupNV = _link_function('wglJoinSwapGroupNV', BOOL, [HDC, GLuint], 'NV_swap_group')
+
+# http://www.opengl.org/registry/api/wglext.h:743
+wglBindSwapBarrierNV = _link_function('wglBindSwapBarrierNV', BOOL, [GLuint, GLuint], 'NV_swap_group')
+
+# http://www.opengl.org/registry/api/wglext.h:744
+wglQuerySwapGroupNV = _link_function('wglQuerySwapGroupNV', BOOL, [HDC, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# http://www.opengl.org/registry/api/wglext.h:745
+wglQueryMaxSwapGroupsNV = _link_function('wglQueryMaxSwapGroupsNV', BOOL, [HDC, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# http://www.opengl.org/registry/api/wglext.h:746
+wglQueryFrameCountNV = _link_function('wglQueryFrameCountNV', BOOL, [HDC, POINTER(GLuint)], 'NV_swap_group')
+
+# http://www.opengl.org/registry/api/wglext.h:747
+wglResetFrameCountNV = _link_function('wglResetFrameCountNV', BOOL, [HDC], 'NV_swap_group')
+
+PFNWGLJOINSWAPGROUPNVPROC = CFUNCTYPE(BOOL, HDC, GLuint) # http://www.opengl.org/registry/api/wglext.h:749
+PFNWGLBINDSWAPBARRIERNVPROC = CFUNCTYPE(BOOL, GLuint, GLuint) # http://www.opengl.org/registry/api/wglext.h:750
+PFNWGLQUERYSWAPGROUPNVPROC = CFUNCTYPE(BOOL, HDC, POINTER(GLuint), POINTER(GLuint)) # http://www.opengl.org/registry/api/wglext.h:751
+PFNWGLQUERYMAXSWAPGROUPSNVPROC = CFUNCTYPE(BOOL, HDC, POINTER(GLuint), POINTER(GLuint)) # http://www.opengl.org/registry/api/wglext.h:752
+PFNWGLQUERYFRAMECOUNTNVPROC = CFUNCTYPE(BOOL, HDC, POINTER(GLuint)) # http://www.opengl.org/registry/api/wglext.h:753
+PFNWGLRESETFRAMECOUNTNVPROC = CFUNCTYPE(BOOL, HDC) # http://www.opengl.org/registry/api/wglext.h:754
+# NV_gpu_affinity (http://www.opengl.org/registry/api/wglext.h:757)
+WGL_NV_gpu_affinity = 1 # http://www.opengl.org/registry/api/wglext.h:758
+# http://www.opengl.org/registry/api/wglext.h:760
+wglEnumGpusNV = _link_function('wglEnumGpusNV', BOOL, [UINT, POINTER(HGPUNV)], 'NV_gpu_affinity')
+
+# http://www.opengl.org/registry/api/wglext.h:761
+wglEnumGpuDevicesNV = _link_function('wglEnumGpuDevicesNV', BOOL, [HGPUNV, UINT, PGPU_DEVICE], 'NV_gpu_affinity')
+
+# http://www.opengl.org/registry/api/wglext.h:762
+wglCreateAffinityDCNV = _link_function('wglCreateAffinityDCNV', HDC, [POINTER(HGPUNV)], 'NV_gpu_affinity')
+
+# http://www.opengl.org/registry/api/wglext.h:763
+wglEnumGpusFromAffinityDCNV = _link_function('wglEnumGpusFromAffinityDCNV', BOOL, [HDC, UINT, POINTER(HGPUNV)], 'NV_gpu_affinity')
+
+# http://www.opengl.org/registry/api/wglext.h:764
+wglDeleteDCNV = _link_function('wglDeleteDCNV', BOOL, [HDC], 'NV_gpu_affinity')
+
+PFNWGLENUMGPUSNVPROC = CFUNCTYPE(BOOL, UINT, POINTER(HGPUNV)) # http://www.opengl.org/registry/api/wglext.h:766
+PFNWGLENUMGPUDEVICESNVPROC = CFUNCTYPE(BOOL, HGPUNV, UINT, PGPU_DEVICE) # http://www.opengl.org/registry/api/wglext.h:767
+PFNWGLCREATEAFFINITYDCNVPROC = CFUNCTYPE(HDC, POINTER(HGPUNV)) # http://www.opengl.org/registry/api/wglext.h:768
+PFNWGLENUMGPUSFROMAFFINITYDCNVPROC = CFUNCTYPE(BOOL, HDC, UINT, POINTER(HGPUNV)) # http://www.opengl.org/registry/api/wglext.h:769
+PFNWGLDELETEDCNVPROC = CFUNCTYPE(BOOL, HDC) # http://www.opengl.org/registry/api/wglext.h:770
+
+__all__ = ['WIN32_LEAN_AND_MEAN', 'WGL_WGLEXT_VERSION',
+'WGL_FRONT_COLOR_BUFFER_BIT_ARB', 'WGL_BACK_COLOR_BUFFER_BIT_ARB',
+'WGL_DEPTH_BUFFER_BIT_ARB', 'WGL_STENCIL_BUFFER_BIT_ARB',
+'WGL_SAMPLE_BUFFERS_ARB', 'WGL_SAMPLES_ARB', 'WGL_NUMBER_PIXEL_FORMATS_ARB',
+'WGL_DRAW_TO_WINDOW_ARB', 'WGL_DRAW_TO_BITMAP_ARB', 'WGL_ACCELERATION_ARB',
+'WGL_NEED_PALETTE_ARB', 'WGL_NEED_SYSTEM_PALETTE_ARB',
+'WGL_SWAP_LAYER_BUFFERS_ARB', 'WGL_SWAP_METHOD_ARB',
+'WGL_NUMBER_OVERLAYS_ARB', 'WGL_NUMBER_UNDERLAYS_ARB', 'WGL_TRANSPARENT_ARB',
+'WGL_TRANSPARENT_RED_VALUE_ARB', 'WGL_TRANSPARENT_GREEN_VALUE_ARB',
+'WGL_TRANSPARENT_BLUE_VALUE_ARB', 'WGL_TRANSPARENT_ALPHA_VALUE_ARB',
+'WGL_TRANSPARENT_INDEX_VALUE_ARB', 'WGL_SHARE_DEPTH_ARB',
+'WGL_SHARE_STENCIL_ARB', 'WGL_SHARE_ACCUM_ARB', 'WGL_SUPPORT_GDI_ARB',
+'WGL_SUPPORT_OPENGL_ARB', 'WGL_DOUBLE_BUFFER_ARB', 'WGL_STEREO_ARB',
+'WGL_PIXEL_TYPE_ARB', 'WGL_COLOR_BITS_ARB', 'WGL_RED_BITS_ARB',
+'WGL_RED_SHIFT_ARB', 'WGL_GREEN_BITS_ARB', 'WGL_GREEN_SHIFT_ARB',
+'WGL_BLUE_BITS_ARB', 'WGL_BLUE_SHIFT_ARB', 'WGL_ALPHA_BITS_ARB',
+'WGL_ALPHA_SHIFT_ARB', 'WGL_ACCUM_BITS_ARB', 'WGL_ACCUM_RED_BITS_ARB',
+'WGL_ACCUM_GREEN_BITS_ARB', 'WGL_ACCUM_BLUE_BITS_ARB',
+'WGL_ACCUM_ALPHA_BITS_ARB', 'WGL_DEPTH_BITS_ARB', 'WGL_STENCIL_BITS_ARB',
+'WGL_AUX_BUFFERS_ARB', 'WGL_NO_ACCELERATION_ARB',
+'WGL_GENERIC_ACCELERATION_ARB', 'WGL_FULL_ACCELERATION_ARB',
+'WGL_SWAP_EXCHANGE_ARB', 'WGL_SWAP_COPY_ARB', 'WGL_SWAP_UNDEFINED_ARB',
+'WGL_TYPE_RGBA_ARB', 'WGL_TYPE_COLORINDEX_ARB',
+'ERROR_INVALID_PIXEL_TYPE_ARB', 'ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB',
+'WGL_DRAW_TO_PBUFFER_ARB', 'WGL_MAX_PBUFFER_PIXELS_ARB',
+'WGL_MAX_PBUFFER_WIDTH_ARB', 'WGL_MAX_PBUFFER_HEIGHT_ARB',
+'WGL_PBUFFER_LARGEST_ARB', 'WGL_PBUFFER_WIDTH_ARB', 'WGL_PBUFFER_HEIGHT_ARB',
+'WGL_PBUFFER_LOST_ARB', 'WGL_BIND_TO_TEXTURE_RGB_ARB',
+'WGL_BIND_TO_TEXTURE_RGBA_ARB', 'WGL_TEXTURE_FORMAT_ARB',
+'WGL_TEXTURE_TARGET_ARB', 'WGL_MIPMAP_TEXTURE_ARB', 'WGL_TEXTURE_RGB_ARB',
+'WGL_TEXTURE_RGBA_ARB', 'WGL_NO_TEXTURE_ARB', 'WGL_TEXTURE_CUBE_MAP_ARB',
+'WGL_TEXTURE_1D_ARB', 'WGL_TEXTURE_2D_ARB', 'WGL_MIPMAP_LEVEL_ARB',
+'WGL_CUBE_MAP_FACE_ARB', 'WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB',
+'WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB', 'WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB',
+'WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB', 'WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB',
+'WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB', 'WGL_FRONT_LEFT_ARB',
+'WGL_FRONT_RIGHT_ARB', 'WGL_BACK_LEFT_ARB', 'WGL_BACK_RIGHT_ARB',
+'WGL_AUX0_ARB', 'WGL_AUX1_ARB', 'WGL_AUX2_ARB', 'WGL_AUX3_ARB',
+'WGL_AUX4_ARB', 'WGL_AUX5_ARB', 'WGL_AUX6_ARB', 'WGL_AUX7_ARB',
+'WGL_AUX8_ARB', 'WGL_AUX9_ARB', 'WGL_TYPE_RGBA_FLOAT_ARB',
+'WGL_CONTEXT_DEBUG_BIT_ARB', 'WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB',
+'WGL_CONTEXT_MAJOR_VERSION_ARB', 'WGL_CONTEXT_MINOR_VERSION_ARB',
+'WGL_CONTEXT_LAYER_PLANE_ARB', 'WGL_CONTEXT_FLAGS_ARB',
+'ERROR_INVALID_VERSION_ARB', 'ERROR_INVALID_PIXEL_TYPE_EXT',
+'WGL_NUMBER_PIXEL_FORMATS_EXT', 'WGL_DRAW_TO_WINDOW_EXT',
+'WGL_DRAW_TO_BITMAP_EXT', 'WGL_ACCELERATION_EXT', 'WGL_NEED_PALETTE_EXT',
+'WGL_NEED_SYSTEM_PALETTE_EXT', 'WGL_SWAP_LAYER_BUFFERS_EXT',
+'WGL_SWAP_METHOD_EXT', 'WGL_NUMBER_OVERLAYS_EXT', 'WGL_NUMBER_UNDERLAYS_EXT',
+'WGL_TRANSPARENT_EXT', 'WGL_TRANSPARENT_VALUE_EXT', 'WGL_SHARE_DEPTH_EXT',
+'WGL_SHARE_STENCIL_EXT', 'WGL_SHARE_ACCUM_EXT', 'WGL_SUPPORT_GDI_EXT',
+'WGL_SUPPORT_OPENGL_EXT', 'WGL_DOUBLE_BUFFER_EXT', 'WGL_STEREO_EXT',
+'WGL_PIXEL_TYPE_EXT', 'WGL_COLOR_BITS_EXT', 'WGL_RED_BITS_EXT',
+'WGL_RED_SHIFT_EXT', 'WGL_GREEN_BITS_EXT', 'WGL_GREEN_SHIFT_EXT',
+'WGL_BLUE_BITS_EXT', 'WGL_BLUE_SHIFT_EXT', 'WGL_ALPHA_BITS_EXT',
+'WGL_ALPHA_SHIFT_EXT', 'WGL_ACCUM_BITS_EXT', 'WGL_ACCUM_RED_BITS_EXT',
+'WGL_ACCUM_GREEN_BITS_EXT', 'WGL_ACCUM_BLUE_BITS_EXT',
+'WGL_ACCUM_ALPHA_BITS_EXT', 'WGL_DEPTH_BITS_EXT', 'WGL_STENCIL_BITS_EXT',
+'WGL_AUX_BUFFERS_EXT', 'WGL_NO_ACCELERATION_EXT',
+'WGL_GENERIC_ACCELERATION_EXT', 'WGL_FULL_ACCELERATION_EXT',
+'WGL_SWAP_EXCHANGE_EXT', 'WGL_SWAP_COPY_EXT', 'WGL_SWAP_UNDEFINED_EXT',
+'WGL_TYPE_RGBA_EXT', 'WGL_TYPE_COLORINDEX_EXT', 'WGL_DRAW_TO_PBUFFER_EXT',
+'WGL_MAX_PBUFFER_PIXELS_EXT', 'WGL_MAX_PBUFFER_WIDTH_EXT',
+'WGL_MAX_PBUFFER_HEIGHT_EXT', 'WGL_OPTIMAL_PBUFFER_WIDTH_EXT',
+'WGL_OPTIMAL_PBUFFER_HEIGHT_EXT', 'WGL_PBUFFER_LARGEST_EXT',
+'WGL_PBUFFER_WIDTH_EXT', 'WGL_PBUFFER_HEIGHT_EXT', 'WGL_DEPTH_FLOAT_EXT',
+'WGL_SAMPLE_BUFFERS_3DFX', 'WGL_SAMPLES_3DFX', 'WGL_SAMPLE_BUFFERS_EXT',
+'WGL_SAMPLES_EXT', 'WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D',
+'WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D',
+'WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D',
+'WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D', 'WGL_GAMMA_TABLE_SIZE_I3D',
+'WGL_GAMMA_EXCLUDE_DESKTOP_I3D', 'WGL_GENLOCK_SOURCE_MULTIVIEW_I3D',
+'WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D', 'WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D',
+'WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D', 'WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D',
+'WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D', 'WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D',
+'WGL_GENLOCK_SOURCE_EDGE_RISING_I3D', 'WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D',
+'WGL_IMAGE_BUFFER_MIN_ACCESS_I3D', 'WGL_IMAGE_BUFFER_LOCK_I3D',
+'WGL_BIND_TO_TEXTURE_DEPTH_NV', 'WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV',
+'WGL_DEPTH_TEXTURE_FORMAT_NV', 'WGL_TEXTURE_DEPTH_COMPONENT_NV',
+'WGL_DEPTH_COMPONENT_NV', 'WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV', 'WGL_TEXTURE_RECTANGLE_NV',
+'WGL_TYPE_RGBA_FLOAT_ATI', 'WGL_FLOAT_COMPONENTS_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV', 'WGL_TEXTURE_FLOAT_R_NV',
+'WGL_TEXTURE_FLOAT_RG_NV', 'WGL_TEXTURE_FLOAT_RGB_NV',
+'WGL_TEXTURE_FLOAT_RGBA_NV', 'WGL_STEREO_EMITTER_ENABLE_3DL',
+'WGL_STEREO_EMITTER_DISABLE_3DL', 'WGL_STEREO_POLARITY_NORMAL_3DL',
+'WGL_STEREO_POLARITY_INVERT_3DL', 'WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT',
+'WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT', 'WGL_NUM_VIDEO_SLOTS_NV',
+'WGL_BIND_TO_VIDEO_RGB_NV', 'WGL_BIND_TO_VIDEO_RGBA_NV',
+'WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV', 'WGL_VIDEO_OUT_COLOR_NV',
+'WGL_VIDEO_OUT_ALPHA_NV', 'WGL_VIDEO_OUT_DEPTH_NV',
+'WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV', 'WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV',
+'WGL_VIDEO_OUT_FRAME', 'WGL_VIDEO_OUT_FIELD_1', 'WGL_VIDEO_OUT_FIELD_2',
+'WGL_VIDEO_OUT_STACKED_FIELDS_1_2', 'WGL_VIDEO_OUT_STACKED_FIELDS_2_1',
+'WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV',
+'WGL_ERROR_MISSING_AFFINITY_MASK_NV', 'HPBUFFERARB', 'HPBUFFEREXT',
+'HVIDEOOUTPUTDEVICENV', 'HPVIDEODEV', 'HPGPUNV', 'HGPUNV', 'GPU_DEVICE',
+'PGPU_DEVICE', 'WGL_ARB_buffer_region', 'wglCreateBufferRegionARB',
+'wglDeleteBufferRegionARB', 'wglSaveBufferRegionARB',
+'wglRestoreBufferRegionARB', 'PFNWGLCREATEBUFFERREGIONARBPROC',
+'PFNWGLDELETEBUFFERREGIONARBPROC', 'PFNWGLSAVEBUFFERREGIONARBPROC',
+'PFNWGLRESTOREBUFFERREGIONARBPROC', 'WGL_ARB_multisample',
+'WGL_ARB_extensions_string', 'wglGetExtensionsStringARB',
+'PFNWGLGETEXTENSIONSSTRINGARBPROC', 'WGL_ARB_pixel_format',
+'wglGetPixelFormatAttribivARB', 'wglGetPixelFormatAttribfvARB',
+'wglChoosePixelFormatARB', 'PFNWGLGETPIXELFORMATATTRIBIVARBPROC',
+'PFNWGLGETPIXELFORMATATTRIBFVARBPROC', 'PFNWGLCHOOSEPIXELFORMATARBPROC',
+'WGL_ARB_make_current_read', 'wglMakeContextCurrentARB',
+'wglGetCurrentReadDCARB', 'PFNWGLMAKECONTEXTCURRENTARBPROC',
+'PFNWGLGETCURRENTREADDCARBPROC', 'WGL_ARB_pbuffer', 'wglCreatePbufferARB',
+'wglGetPbufferDCARB', 'wglReleasePbufferDCARB', 'wglDestroyPbufferARB',
+'wglQueryPbufferARB', 'PFNWGLCREATEPBUFFERARBPROC',
+'PFNWGLGETPBUFFERDCARBPROC', 'PFNWGLRELEASEPBUFFERDCARBPROC',
+'PFNWGLDESTROYPBUFFERARBPROC', 'PFNWGLQUERYPBUFFERARBPROC',
+'WGL_ARB_render_texture', 'wglBindTexImageARB', 'wglReleaseTexImageARB',
+'wglSetPbufferAttribARB', 'PFNWGLBINDTEXIMAGEARBPROC',
+'PFNWGLRELEASETEXIMAGEARBPROC', 'PFNWGLSETPBUFFERATTRIBARBPROC',
+'WGL_ARB_pixel_format_float', 'WGL_ARB_create_context',
+'wglCreateContextAttribsARB', 'PFNWGLCREATECONTEXTATTRIBSARBPROC',
+'WGL_EXT_display_color_table', 'wglCreateDisplayColorTableEXT',
+'wglLoadDisplayColorTableEXT', 'wglBindDisplayColorTableEXT',
+'wglDestroyDisplayColorTableEXT', 'PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC',
+'PFNWGLLOADDISPLAYCOLORTABLEEXTPROC', 'PFNWGLBINDDISPLAYCOLORTABLEEXTPROC',
+'PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC', 'WGL_EXT_extensions_string',
+'wglGetExtensionsStringEXT', 'PFNWGLGETEXTENSIONSSTRINGEXTPROC',
+'WGL_EXT_make_current_read', 'wglMakeContextCurrentEXT',
+'wglGetCurrentReadDCEXT', 'PFNWGLMAKECONTEXTCURRENTEXTPROC',
+'PFNWGLGETCURRENTREADDCEXTPROC', 'WGL_EXT_pbuffer', 'wglCreatePbufferEXT',
+'wglGetPbufferDCEXT', 'wglReleasePbufferDCEXT', 'wglDestroyPbufferEXT',
+'wglQueryPbufferEXT', 'PFNWGLCREATEPBUFFEREXTPROC',
+'PFNWGLGETPBUFFERDCEXTPROC', 'PFNWGLRELEASEPBUFFERDCEXTPROC',
+'PFNWGLDESTROYPBUFFEREXTPROC', 'PFNWGLQUERYPBUFFEREXTPROC',
+'WGL_EXT_pixel_format', 'wglGetPixelFormatAttribivEXT',
+'wglGetPixelFormatAttribfvEXT', 'wglChoosePixelFormatEXT',
+'PFNWGLGETPIXELFORMATATTRIBIVEXTPROC', 'PFNWGLGETPIXELFORMATATTRIBFVEXTPROC',
+'PFNWGLCHOOSEPIXELFORMATEXTPROC', 'WGL_EXT_swap_control',
+'wglSwapIntervalEXT', 'wglGetSwapIntervalEXT', 'PFNWGLSWAPINTERVALEXTPROC',
+'PFNWGLGETSWAPINTERVALEXTPROC', 'WGL_EXT_depth_float',
+'WGL_NV_vertex_array_range', 'wglAllocateMemoryNV', 'wglFreeMemoryNV',
+'PFNWGLALLOCATEMEMORYNVPROC', 'PFNWGLFREEMEMORYNVPROC',
+'WGL_3DFX_multisample', 'WGL_EXT_multisample', 'WGL_OML_sync_control',
+'wglGetSyncValuesOML', 'wglGetMscRateOML', 'wglSwapBuffersMscOML',
+'wglSwapLayerBuffersMscOML', 'wglWaitForMscOML', 'wglWaitForSbcOML',
+'PFNWGLGETSYNCVALUESOMLPROC', 'PFNWGLGETMSCRATEOMLPROC',
+'PFNWGLSWAPBUFFERSMSCOMLPROC', 'PFNWGLSWAPLAYERBUFFERSMSCOMLPROC',
+'PFNWGLWAITFORMSCOMLPROC', 'PFNWGLWAITFORSBCOMLPROC',
+'WGL_I3D_digital_video_control', 'wglGetDigitalVideoParametersI3D',
+'wglSetDigitalVideoParametersI3D', 'PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC',
+'PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC', 'WGL_I3D_gamma',
+'wglGetGammaTableParametersI3D', 'wglSetGammaTableParametersI3D',
+'wglGetGammaTableI3D', 'wglSetGammaTableI3D',
+'PFNWGLGETGAMMATABLEPARAMETERSI3DPROC',
+'PFNWGLSETGAMMATABLEPARAMETERSI3DPROC', 'PFNWGLGETGAMMATABLEI3DPROC',
+'PFNWGLSETGAMMATABLEI3DPROC', 'WGL_I3D_genlock', 'wglEnableGenlockI3D',
+'wglDisableGenlockI3D', 'wglIsEnabledGenlockI3D', 'wglGenlockSourceI3D',
+'wglGetGenlockSourceI3D', 'wglGenlockSourceEdgeI3D',
+'wglGetGenlockSourceEdgeI3D', 'wglGenlockSampleRateI3D',
+'wglGetGenlockSampleRateI3D', 'wglGenlockSourceDelayI3D',
+'wglGetGenlockSourceDelayI3D', 'wglQueryGenlockMaxSourceDelayI3D',
+'PFNWGLENABLEGENLOCKI3DPROC', 'PFNWGLDISABLEGENLOCKI3DPROC',
+'PFNWGLISENABLEDGENLOCKI3DPROC', 'PFNWGLGENLOCKSOURCEI3DPROC',
+'PFNWGLGETGENLOCKSOURCEI3DPROC', 'PFNWGLGENLOCKSOURCEEDGEI3DPROC',
+'PFNWGLGETGENLOCKSOURCEEDGEI3DPROC', 'PFNWGLGENLOCKSAMPLERATEI3DPROC',
+'PFNWGLGETGENLOCKSAMPLERATEI3DPROC', 'PFNWGLGENLOCKSOURCEDELAYI3DPROC',
+'PFNWGLGETGENLOCKSOURCEDELAYI3DPROC',
+'PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC', 'WGL_I3D_image_buffer',
+'wglCreateImageBufferI3D', 'wglDestroyImageBufferI3D',
+'wglAssociateImageBufferEventsI3D', 'wglReleaseImageBufferEventsI3D',
+'PFNWGLCREATEIMAGEBUFFERI3DPROC', 'PFNWGLDESTROYIMAGEBUFFERI3DPROC',
+'PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC',
+'PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC', 'WGL_I3D_swap_frame_lock',
+'wglEnableFrameLockI3D', 'wglDisableFrameLockI3D', 'wglIsEnabledFrameLockI3D',
+'wglQueryFrameLockMasterI3D', 'PFNWGLENABLEFRAMELOCKI3DPROC',
+'PFNWGLDISABLEFRAMELOCKI3DPROC', 'PFNWGLISENABLEDFRAMELOCKI3DPROC',
+'PFNWGLQUERYFRAMELOCKMASTERI3DPROC', 'WGL_I3D_swap_frame_usage',
+'wglGetFrameUsageI3D', 'wglBeginFrameTrackingI3D', 'wglEndFrameTrackingI3D',
+'wglQueryFrameTrackingI3D', 'PFNWGLGETFRAMEUSAGEI3DPROC',
+'PFNWGLBEGINFRAMETRACKINGI3DPROC', 'PFNWGLENDFRAMETRACKINGI3DPROC',
+'PFNWGLQUERYFRAMETRACKINGI3DPROC', 'WGL_ATI_pixel_format_float',
+'WGL_NV_float_buffer', 'WGL_EXT_pixel_format_packed_float',
+'WGL_EXT_framebuffer_sRGB', 'WGL_NV_present_video',
+'wglEnumerateVideoDevicesNV', 'wglBindVideoDeviceNV',
+'wglQueryCurrentContextNV', 'PFNWGLENUMERATEVIDEODEVICESNVPROC',
+'PFNWGLBINDVIDEODEVICENVPROC', 'PFNWGLQUERYCURRENTCONTEXTNVPROC',
+'WGL_NV_video_out', 'wglGetVideoDeviceNV', 'wglReleaseVideoDeviceNV',
+'wglBindVideoImageNV', 'wglReleaseVideoImageNV', 'wglSendPbufferToVideoNV',
+'wglGetVideoInfoNV', 'PFNWGLGETVIDEODEVICENVPROC',
+'PFNWGLRELEASEVIDEODEVICENVPROC', 'PFNWGLBINDVIDEOIMAGENVPROC',
+'PFNWGLRELEASEVIDEOIMAGENVPROC', 'PFNWGLSENDPBUFFERTOVIDEONVPROC',
+'PFNWGLGETVIDEOINFONVPROC', 'WGL_NV_swap_group', 'wglJoinSwapGroupNV',
+'wglBindSwapBarrierNV', 'wglQuerySwapGroupNV', 'wglQueryMaxSwapGroupsNV',
+'wglQueryFrameCountNV', 'wglResetFrameCountNV', 'PFNWGLJOINSWAPGROUPNVPROC',
+'PFNWGLBINDSWAPBARRIERNVPROC', 'PFNWGLQUERYSWAPGROUPNVPROC',
+'PFNWGLQUERYMAXSWAPGROUPSNVPROC', 'PFNWGLQUERYFRAMECOUNTNVPROC',
+'PFNWGLRESETFRAMECOUNTNVPROC', 'WGL_NV_gpu_affinity', 'wglEnumGpusNV',
+'wglEnumGpuDevicesNV', 'wglCreateAffinityDCNV', 'wglEnumGpusFromAffinityDCNV',
+'wglDeleteDCNV', 'PFNWGLENUMGPUSNVPROC', 'PFNWGLENUMGPUDEVICESNVPROC',
+'PFNWGLCREATEAFFINITYDCNVPROC', 'PFNWGLENUMGPUSFROMAFFINITYDCNVPROC',
+'PFNWGLDELETEDCNVPROC']
+# END GENERATED CONTENT (do not edit above this line)
+
+
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/wglext_nv.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/wglext_nv.py
new file mode 100644
index 0000000000000000000000000000000000000000..aabcde3bb7f9424dacc975b23f6a8b1021350787
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/wglext_nv.py
@@ -0,0 +1,874 @@
+"""Wrapper for http://developer.download.nvidia.com/opengl/includes/wglext.h
+
+Generated by tools/gengl.py.
+Do not modify this file.
+"""
+
+from ctypes import *
+from pyglet.gl.lib import link_WGL as _link_function
+from pyglet.gl.lib import c_void
+
+
+# BEGIN GENERATED CONTENT (do not edit below this line)
+
+# This content is generated by tools/gengl.py.
+# Wrapper for http://developer.download.nvidia.com/opengl/includes/wglext.h
+
+
+# H (C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:7)
+# H (C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:7)
+WIN32_LEAN_AND_MEAN = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:40
+WGL_WGLEXT_VERSION = 6 # http://developer.download.nvidia.com/opengl/includes/wglext.h:60
+# ARB_buffer_region (http://developer.download.nvidia.com/opengl/includes/wglext.h:62)
+WGL_FRONT_COLOR_BUFFER_BIT_ARB = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:63
+WGL_BACK_COLOR_BUFFER_BIT_ARB = 2 # http://developer.download.nvidia.com/opengl/includes/wglext.h:64
+WGL_DEPTH_BUFFER_BIT_ARB = 4 # http://developer.download.nvidia.com/opengl/includes/wglext.h:65
+WGL_STENCIL_BUFFER_BIT_ARB = 8 # http://developer.download.nvidia.com/opengl/includes/wglext.h:66
+# ARB_multisample (http://developer.download.nvidia.com/opengl/includes/wglext.h:69)
+WGL_SAMPLE_BUFFERS_ARB = 8257 # http://developer.download.nvidia.com/opengl/includes/wglext.h:70
+WGL_SAMPLES_ARB = 8258 # http://developer.download.nvidia.com/opengl/includes/wglext.h:71
+# ARB_extensions_string (http://developer.download.nvidia.com/opengl/includes/wglext.h:74)
+# ARB_pixel_format (http://developer.download.nvidia.com/opengl/includes/wglext.h:77)
+WGL_NUMBER_PIXEL_FORMATS_ARB = 8192 # http://developer.download.nvidia.com/opengl/includes/wglext.h:78
+WGL_DRAW_TO_WINDOW_ARB = 8193 # http://developer.download.nvidia.com/opengl/includes/wglext.h:79
+WGL_DRAW_TO_BITMAP_ARB = 8194 # http://developer.download.nvidia.com/opengl/includes/wglext.h:80
+WGL_ACCELERATION_ARB = 8195 # http://developer.download.nvidia.com/opengl/includes/wglext.h:81
+WGL_NEED_PALETTE_ARB = 8196 # http://developer.download.nvidia.com/opengl/includes/wglext.h:82
+WGL_NEED_SYSTEM_PALETTE_ARB = 8197 # http://developer.download.nvidia.com/opengl/includes/wglext.h:83
+WGL_SWAP_LAYER_BUFFERS_ARB = 8198 # http://developer.download.nvidia.com/opengl/includes/wglext.h:84
+WGL_SWAP_METHOD_ARB = 8199 # http://developer.download.nvidia.com/opengl/includes/wglext.h:85
+WGL_NUMBER_OVERLAYS_ARB = 8200 # http://developer.download.nvidia.com/opengl/includes/wglext.h:86
+WGL_NUMBER_UNDERLAYS_ARB = 8201 # http://developer.download.nvidia.com/opengl/includes/wglext.h:87
+WGL_TRANSPARENT_ARB = 8202 # http://developer.download.nvidia.com/opengl/includes/wglext.h:88
+WGL_TRANSPARENT_RED_VALUE_ARB = 8247 # http://developer.download.nvidia.com/opengl/includes/wglext.h:89
+WGL_TRANSPARENT_GREEN_VALUE_ARB = 8248 # http://developer.download.nvidia.com/opengl/includes/wglext.h:90
+WGL_TRANSPARENT_BLUE_VALUE_ARB = 8249 # http://developer.download.nvidia.com/opengl/includes/wglext.h:91
+WGL_TRANSPARENT_ALPHA_VALUE_ARB = 8250 # http://developer.download.nvidia.com/opengl/includes/wglext.h:92
+WGL_TRANSPARENT_INDEX_VALUE_ARB = 8251 # http://developer.download.nvidia.com/opengl/includes/wglext.h:93
+WGL_SHARE_DEPTH_ARB = 8204 # http://developer.download.nvidia.com/opengl/includes/wglext.h:94
+WGL_SHARE_STENCIL_ARB = 8205 # http://developer.download.nvidia.com/opengl/includes/wglext.h:95
+WGL_SHARE_ACCUM_ARB = 8206 # http://developer.download.nvidia.com/opengl/includes/wglext.h:96
+WGL_SUPPORT_GDI_ARB = 8207 # http://developer.download.nvidia.com/opengl/includes/wglext.h:97
+WGL_SUPPORT_OPENGL_ARB = 8208 # http://developer.download.nvidia.com/opengl/includes/wglext.h:98
+WGL_DOUBLE_BUFFER_ARB = 8209 # http://developer.download.nvidia.com/opengl/includes/wglext.h:99
+WGL_STEREO_ARB = 8210 # http://developer.download.nvidia.com/opengl/includes/wglext.h:100
+WGL_PIXEL_TYPE_ARB = 8211 # http://developer.download.nvidia.com/opengl/includes/wglext.h:101
+WGL_COLOR_BITS_ARB = 8212 # http://developer.download.nvidia.com/opengl/includes/wglext.h:102
+WGL_RED_BITS_ARB = 8213 # http://developer.download.nvidia.com/opengl/includes/wglext.h:103
+WGL_RED_SHIFT_ARB = 8214 # http://developer.download.nvidia.com/opengl/includes/wglext.h:104
+WGL_GREEN_BITS_ARB = 8215 # http://developer.download.nvidia.com/opengl/includes/wglext.h:105
+WGL_GREEN_SHIFT_ARB = 8216 # http://developer.download.nvidia.com/opengl/includes/wglext.h:106
+WGL_BLUE_BITS_ARB = 8217 # http://developer.download.nvidia.com/opengl/includes/wglext.h:107
+WGL_BLUE_SHIFT_ARB = 8218 # http://developer.download.nvidia.com/opengl/includes/wglext.h:108
+WGL_ALPHA_BITS_ARB = 8219 # http://developer.download.nvidia.com/opengl/includes/wglext.h:109
+WGL_ALPHA_SHIFT_ARB = 8220 # http://developer.download.nvidia.com/opengl/includes/wglext.h:110
+WGL_ACCUM_BITS_ARB = 8221 # http://developer.download.nvidia.com/opengl/includes/wglext.h:111
+WGL_ACCUM_RED_BITS_ARB = 8222 # http://developer.download.nvidia.com/opengl/includes/wglext.h:112
+WGL_ACCUM_GREEN_BITS_ARB = 8223 # http://developer.download.nvidia.com/opengl/includes/wglext.h:113
+WGL_ACCUM_BLUE_BITS_ARB = 8224 # http://developer.download.nvidia.com/opengl/includes/wglext.h:114
+WGL_ACCUM_ALPHA_BITS_ARB = 8225 # http://developer.download.nvidia.com/opengl/includes/wglext.h:115
+WGL_DEPTH_BITS_ARB = 8226 # http://developer.download.nvidia.com/opengl/includes/wglext.h:116
+WGL_STENCIL_BITS_ARB = 8227 # http://developer.download.nvidia.com/opengl/includes/wglext.h:117
+WGL_AUX_BUFFERS_ARB = 8228 # http://developer.download.nvidia.com/opengl/includes/wglext.h:118
+WGL_NO_ACCELERATION_ARB = 8229 # http://developer.download.nvidia.com/opengl/includes/wglext.h:119
+WGL_GENERIC_ACCELERATION_ARB = 8230 # http://developer.download.nvidia.com/opengl/includes/wglext.h:120
+WGL_FULL_ACCELERATION_ARB = 8231 # http://developer.download.nvidia.com/opengl/includes/wglext.h:121
+WGL_SWAP_EXCHANGE_ARB = 8232 # http://developer.download.nvidia.com/opengl/includes/wglext.h:122
+WGL_SWAP_COPY_ARB = 8233 # http://developer.download.nvidia.com/opengl/includes/wglext.h:123
+WGL_SWAP_UNDEFINED_ARB = 8234 # http://developer.download.nvidia.com/opengl/includes/wglext.h:124
+WGL_TYPE_RGBA_ARB = 8235 # http://developer.download.nvidia.com/opengl/includes/wglext.h:125
+WGL_TYPE_COLORINDEX_ARB = 8236 # http://developer.download.nvidia.com/opengl/includes/wglext.h:126
+# ARB_make_current_read (http://developer.download.nvidia.com/opengl/includes/wglext.h:129)
+ERROR_INVALID_PIXEL_TYPE_ARB = 8259 # http://developer.download.nvidia.com/opengl/includes/wglext.h:130
+ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = 8276 # http://developer.download.nvidia.com/opengl/includes/wglext.h:131
+# ARB_pbuffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:134)
+WGL_DRAW_TO_PBUFFER_ARB = 8237 # http://developer.download.nvidia.com/opengl/includes/wglext.h:135
+WGL_MAX_PBUFFER_PIXELS_ARB = 8238 # http://developer.download.nvidia.com/opengl/includes/wglext.h:136
+WGL_MAX_PBUFFER_WIDTH_ARB = 8239 # http://developer.download.nvidia.com/opengl/includes/wglext.h:137
+WGL_MAX_PBUFFER_HEIGHT_ARB = 8240 # http://developer.download.nvidia.com/opengl/includes/wglext.h:138
+WGL_PBUFFER_LARGEST_ARB = 8243 # http://developer.download.nvidia.com/opengl/includes/wglext.h:139
+WGL_PBUFFER_WIDTH_ARB = 8244 # http://developer.download.nvidia.com/opengl/includes/wglext.h:140
+WGL_PBUFFER_HEIGHT_ARB = 8245 # http://developer.download.nvidia.com/opengl/includes/wglext.h:141
+WGL_PBUFFER_LOST_ARB = 8246 # http://developer.download.nvidia.com/opengl/includes/wglext.h:142
+# ARB_render_texture (http://developer.download.nvidia.com/opengl/includes/wglext.h:145)
+WGL_BIND_TO_TEXTURE_RGB_ARB = 8304 # http://developer.download.nvidia.com/opengl/includes/wglext.h:146
+WGL_BIND_TO_TEXTURE_RGBA_ARB = 8305 # http://developer.download.nvidia.com/opengl/includes/wglext.h:147
+WGL_TEXTURE_FORMAT_ARB = 8306 # http://developer.download.nvidia.com/opengl/includes/wglext.h:148
+WGL_TEXTURE_TARGET_ARB = 8307 # http://developer.download.nvidia.com/opengl/includes/wglext.h:149
+WGL_MIPMAP_TEXTURE_ARB = 8308 # http://developer.download.nvidia.com/opengl/includes/wglext.h:150
+WGL_TEXTURE_RGB_ARB = 8309 # http://developer.download.nvidia.com/opengl/includes/wglext.h:151
+WGL_TEXTURE_RGBA_ARB = 8310 # http://developer.download.nvidia.com/opengl/includes/wglext.h:152
+WGL_NO_TEXTURE_ARB = 8311 # http://developer.download.nvidia.com/opengl/includes/wglext.h:153
+WGL_TEXTURE_CUBE_MAP_ARB = 8312 # http://developer.download.nvidia.com/opengl/includes/wglext.h:154
+WGL_TEXTURE_1D_ARB = 8313 # http://developer.download.nvidia.com/opengl/includes/wglext.h:155
+WGL_TEXTURE_2D_ARB = 8314 # http://developer.download.nvidia.com/opengl/includes/wglext.h:156
+WGL_MIPMAP_LEVEL_ARB = 8315 # http://developer.download.nvidia.com/opengl/includes/wglext.h:157
+WGL_CUBE_MAP_FACE_ARB = 8316 # http://developer.download.nvidia.com/opengl/includes/wglext.h:158
+WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 8317 # http://developer.download.nvidia.com/opengl/includes/wglext.h:159
+WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 8318 # http://developer.download.nvidia.com/opengl/includes/wglext.h:160
+WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 8319 # http://developer.download.nvidia.com/opengl/includes/wglext.h:161
+WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 8320 # http://developer.download.nvidia.com/opengl/includes/wglext.h:162
+WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 8321 # http://developer.download.nvidia.com/opengl/includes/wglext.h:163
+WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 8322 # http://developer.download.nvidia.com/opengl/includes/wglext.h:164
+WGL_FRONT_LEFT_ARB = 8323 # http://developer.download.nvidia.com/opengl/includes/wglext.h:165
+WGL_FRONT_RIGHT_ARB = 8324 # http://developer.download.nvidia.com/opengl/includes/wglext.h:166
+WGL_BACK_LEFT_ARB = 8325 # http://developer.download.nvidia.com/opengl/includes/wglext.h:167
+WGL_BACK_RIGHT_ARB = 8326 # http://developer.download.nvidia.com/opengl/includes/wglext.h:168
+WGL_AUX0_ARB = 8327 # http://developer.download.nvidia.com/opengl/includes/wglext.h:169
+WGL_AUX1_ARB = 8328 # http://developer.download.nvidia.com/opengl/includes/wglext.h:170
+WGL_AUX2_ARB = 8329 # http://developer.download.nvidia.com/opengl/includes/wglext.h:171
+WGL_AUX3_ARB = 8330 # http://developer.download.nvidia.com/opengl/includes/wglext.h:172
+WGL_AUX4_ARB = 8331 # http://developer.download.nvidia.com/opengl/includes/wglext.h:173
+WGL_AUX5_ARB = 8332 # http://developer.download.nvidia.com/opengl/includes/wglext.h:174
+WGL_AUX6_ARB = 8333 # http://developer.download.nvidia.com/opengl/includes/wglext.h:175
+WGL_AUX7_ARB = 8334 # http://developer.download.nvidia.com/opengl/includes/wglext.h:176
+WGL_AUX8_ARB = 8335 # http://developer.download.nvidia.com/opengl/includes/wglext.h:177
+WGL_AUX9_ARB = 8336 # http://developer.download.nvidia.com/opengl/includes/wglext.h:178
+# ARB_pixel_format_float (http://developer.download.nvidia.com/opengl/includes/wglext.h:181)
+WGL_TYPE_RGBA_FLOAT_ARB = 8608 # http://developer.download.nvidia.com/opengl/includes/wglext.h:182
+# EXT_make_current_read (http://developer.download.nvidia.com/opengl/includes/wglext.h:185)
+ERROR_INVALID_PIXEL_TYPE_EXT = 8259 # http://developer.download.nvidia.com/opengl/includes/wglext.h:186
+# EXT_pixel_format (http://developer.download.nvidia.com/opengl/includes/wglext.h:189)
+WGL_NUMBER_PIXEL_FORMATS_EXT = 8192 # http://developer.download.nvidia.com/opengl/includes/wglext.h:190
+WGL_DRAW_TO_WINDOW_EXT = 8193 # http://developer.download.nvidia.com/opengl/includes/wglext.h:191
+WGL_DRAW_TO_BITMAP_EXT = 8194 # http://developer.download.nvidia.com/opengl/includes/wglext.h:192
+WGL_ACCELERATION_EXT = 8195 # http://developer.download.nvidia.com/opengl/includes/wglext.h:193
+WGL_NEED_PALETTE_EXT = 8196 # http://developer.download.nvidia.com/opengl/includes/wglext.h:194
+WGL_NEED_SYSTEM_PALETTE_EXT = 8197 # http://developer.download.nvidia.com/opengl/includes/wglext.h:195
+WGL_SWAP_LAYER_BUFFERS_EXT = 8198 # http://developer.download.nvidia.com/opengl/includes/wglext.h:196
+WGL_SWAP_METHOD_EXT = 8199 # http://developer.download.nvidia.com/opengl/includes/wglext.h:197
+WGL_NUMBER_OVERLAYS_EXT = 8200 # http://developer.download.nvidia.com/opengl/includes/wglext.h:198
+WGL_NUMBER_UNDERLAYS_EXT = 8201 # http://developer.download.nvidia.com/opengl/includes/wglext.h:199
+WGL_TRANSPARENT_EXT = 8202 # http://developer.download.nvidia.com/opengl/includes/wglext.h:200
+WGL_TRANSPARENT_VALUE_EXT = 8203 # http://developer.download.nvidia.com/opengl/includes/wglext.h:201
+WGL_SHARE_DEPTH_EXT = 8204 # http://developer.download.nvidia.com/opengl/includes/wglext.h:202
+WGL_SHARE_STENCIL_EXT = 8205 # http://developer.download.nvidia.com/opengl/includes/wglext.h:203
+WGL_SHARE_ACCUM_EXT = 8206 # http://developer.download.nvidia.com/opengl/includes/wglext.h:204
+WGL_SUPPORT_GDI_EXT = 8207 # http://developer.download.nvidia.com/opengl/includes/wglext.h:205
+WGL_SUPPORT_OPENGL_EXT = 8208 # http://developer.download.nvidia.com/opengl/includes/wglext.h:206
+WGL_DOUBLE_BUFFER_EXT = 8209 # http://developer.download.nvidia.com/opengl/includes/wglext.h:207
+WGL_STEREO_EXT = 8210 # http://developer.download.nvidia.com/opengl/includes/wglext.h:208
+WGL_PIXEL_TYPE_EXT = 8211 # http://developer.download.nvidia.com/opengl/includes/wglext.h:209
+WGL_COLOR_BITS_EXT = 8212 # http://developer.download.nvidia.com/opengl/includes/wglext.h:210
+WGL_RED_BITS_EXT = 8213 # http://developer.download.nvidia.com/opengl/includes/wglext.h:211
+WGL_RED_SHIFT_EXT = 8214 # http://developer.download.nvidia.com/opengl/includes/wglext.h:212
+WGL_GREEN_BITS_EXT = 8215 # http://developer.download.nvidia.com/opengl/includes/wglext.h:213
+WGL_GREEN_SHIFT_EXT = 8216 # http://developer.download.nvidia.com/opengl/includes/wglext.h:214
+WGL_BLUE_BITS_EXT = 8217 # http://developer.download.nvidia.com/opengl/includes/wglext.h:215
+WGL_BLUE_SHIFT_EXT = 8218 # http://developer.download.nvidia.com/opengl/includes/wglext.h:216
+WGL_ALPHA_BITS_EXT = 8219 # http://developer.download.nvidia.com/opengl/includes/wglext.h:217
+WGL_ALPHA_SHIFT_EXT = 8220 # http://developer.download.nvidia.com/opengl/includes/wglext.h:218
+WGL_ACCUM_BITS_EXT = 8221 # http://developer.download.nvidia.com/opengl/includes/wglext.h:219
+WGL_ACCUM_RED_BITS_EXT = 8222 # http://developer.download.nvidia.com/opengl/includes/wglext.h:220
+WGL_ACCUM_GREEN_BITS_EXT = 8223 # http://developer.download.nvidia.com/opengl/includes/wglext.h:221
+WGL_ACCUM_BLUE_BITS_EXT = 8224 # http://developer.download.nvidia.com/opengl/includes/wglext.h:222
+WGL_ACCUM_ALPHA_BITS_EXT = 8225 # http://developer.download.nvidia.com/opengl/includes/wglext.h:223
+WGL_DEPTH_BITS_EXT = 8226 # http://developer.download.nvidia.com/opengl/includes/wglext.h:224
+WGL_STENCIL_BITS_EXT = 8227 # http://developer.download.nvidia.com/opengl/includes/wglext.h:225
+WGL_AUX_BUFFERS_EXT = 8228 # http://developer.download.nvidia.com/opengl/includes/wglext.h:226
+WGL_NO_ACCELERATION_EXT = 8229 # http://developer.download.nvidia.com/opengl/includes/wglext.h:227
+WGL_GENERIC_ACCELERATION_EXT = 8230 # http://developer.download.nvidia.com/opengl/includes/wglext.h:228
+WGL_FULL_ACCELERATION_EXT = 8231 # http://developer.download.nvidia.com/opengl/includes/wglext.h:229
+WGL_SWAP_EXCHANGE_EXT = 8232 # http://developer.download.nvidia.com/opengl/includes/wglext.h:230
+WGL_SWAP_COPY_EXT = 8233 # http://developer.download.nvidia.com/opengl/includes/wglext.h:231
+WGL_SWAP_UNDEFINED_EXT = 8234 # http://developer.download.nvidia.com/opengl/includes/wglext.h:232
+WGL_TYPE_RGBA_EXT = 8235 # http://developer.download.nvidia.com/opengl/includes/wglext.h:233
+WGL_TYPE_COLORINDEX_EXT = 8236 # http://developer.download.nvidia.com/opengl/includes/wglext.h:234
+# EXT_pbuffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:237)
+WGL_DRAW_TO_PBUFFER_EXT = 8237 # http://developer.download.nvidia.com/opengl/includes/wglext.h:238
+WGL_MAX_PBUFFER_PIXELS_EXT = 8238 # http://developer.download.nvidia.com/opengl/includes/wglext.h:239
+WGL_MAX_PBUFFER_WIDTH_EXT = 8239 # http://developer.download.nvidia.com/opengl/includes/wglext.h:240
+WGL_MAX_PBUFFER_HEIGHT_EXT = 8240 # http://developer.download.nvidia.com/opengl/includes/wglext.h:241
+WGL_OPTIMAL_PBUFFER_WIDTH_EXT = 8241 # http://developer.download.nvidia.com/opengl/includes/wglext.h:242
+WGL_OPTIMAL_PBUFFER_HEIGHT_EXT = 8242 # http://developer.download.nvidia.com/opengl/includes/wglext.h:243
+WGL_PBUFFER_LARGEST_EXT = 8243 # http://developer.download.nvidia.com/opengl/includes/wglext.h:244
+WGL_PBUFFER_WIDTH_EXT = 8244 # http://developer.download.nvidia.com/opengl/includes/wglext.h:245
+WGL_PBUFFER_HEIGHT_EXT = 8245 # http://developer.download.nvidia.com/opengl/includes/wglext.h:246
+# EXT_depth_float (http://developer.download.nvidia.com/opengl/includes/wglext.h:249)
+WGL_DEPTH_FLOAT_EXT = 8256 # http://developer.download.nvidia.com/opengl/includes/wglext.h:250
+# 3DFX_multisample (http://developer.download.nvidia.com/opengl/includes/wglext.h:253)
+WGL_SAMPLE_BUFFERS_3DFX = 8288 # http://developer.download.nvidia.com/opengl/includes/wglext.h:254
+WGL_SAMPLES_3DFX = 8289 # http://developer.download.nvidia.com/opengl/includes/wglext.h:255
+# EXT_multisample (http://developer.download.nvidia.com/opengl/includes/wglext.h:258)
+WGL_SAMPLE_BUFFERS_EXT = 8257 # http://developer.download.nvidia.com/opengl/includes/wglext.h:259
+WGL_SAMPLES_EXT = 8258 # http://developer.download.nvidia.com/opengl/includes/wglext.h:260
+# I3D_digital_video_control (http://developer.download.nvidia.com/opengl/includes/wglext.h:263)
+WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = 8272 # http://developer.download.nvidia.com/opengl/includes/wglext.h:264
+WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = 8273 # http://developer.download.nvidia.com/opengl/includes/wglext.h:265
+WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = 8274 # http://developer.download.nvidia.com/opengl/includes/wglext.h:266
+WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = 8275 # http://developer.download.nvidia.com/opengl/includes/wglext.h:267
+# I3D_gamma (http://developer.download.nvidia.com/opengl/includes/wglext.h:270)
+WGL_GAMMA_TABLE_SIZE_I3D = 8270 # http://developer.download.nvidia.com/opengl/includes/wglext.h:271
+WGL_GAMMA_EXCLUDE_DESKTOP_I3D = 8271 # http://developer.download.nvidia.com/opengl/includes/wglext.h:272
+# I3D_genlock (http://developer.download.nvidia.com/opengl/includes/wglext.h:275)
+WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = 8260 # http://developer.download.nvidia.com/opengl/includes/wglext.h:276
+WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D = 8261 # http://developer.download.nvidia.com/opengl/includes/wglext.h:277
+WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D = 8262 # http://developer.download.nvidia.com/opengl/includes/wglext.h:278
+WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D = 8263 # http://developer.download.nvidia.com/opengl/includes/wglext.h:279
+WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D = 8264 # http://developer.download.nvidia.com/opengl/includes/wglext.h:280
+WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D = 8265 # http://developer.download.nvidia.com/opengl/includes/wglext.h:281
+WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D = 8266 # http://developer.download.nvidia.com/opengl/includes/wglext.h:282
+WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = 8267 # http://developer.download.nvidia.com/opengl/includes/wglext.h:283
+WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = 8268 # http://developer.download.nvidia.com/opengl/includes/wglext.h:284
+# I3D_image_buffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:287)
+WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:288
+WGL_IMAGE_BUFFER_LOCK_I3D = 2 # http://developer.download.nvidia.com/opengl/includes/wglext.h:289
+# I3D_swap_frame_lock (http://developer.download.nvidia.com/opengl/includes/wglext.h:292)
+# NV_render_depth_texture (http://developer.download.nvidia.com/opengl/includes/wglext.h:295)
+WGL_BIND_TO_TEXTURE_DEPTH_NV = 8355 # http://developer.download.nvidia.com/opengl/includes/wglext.h:296
+WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = 8356 # http://developer.download.nvidia.com/opengl/includes/wglext.h:297
+WGL_DEPTH_TEXTURE_FORMAT_NV = 8357 # http://developer.download.nvidia.com/opengl/includes/wglext.h:298
+WGL_TEXTURE_DEPTH_COMPONENT_NV = 8358 # http://developer.download.nvidia.com/opengl/includes/wglext.h:299
+WGL_DEPTH_COMPONENT_NV = 8359 # http://developer.download.nvidia.com/opengl/includes/wglext.h:300
+# NV_render_texture_rectangle (http://developer.download.nvidia.com/opengl/includes/wglext.h:303)
+WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = 8352 # http://developer.download.nvidia.com/opengl/includes/wglext.h:304
+WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = 8353 # http://developer.download.nvidia.com/opengl/includes/wglext.h:305
+WGL_TEXTURE_RECTANGLE_NV = 8354 # http://developer.download.nvidia.com/opengl/includes/wglext.h:306
+# ATI_pixel_format_float (http://developer.download.nvidia.com/opengl/includes/wglext.h:309)
+WGL_TYPE_RGBA_FLOAT_ATI = 8608 # http://developer.download.nvidia.com/opengl/includes/wglext.h:310
+WGL_RGBA_FLOAT_MODE_ATI = 34848 # http://developer.download.nvidia.com/opengl/includes/wglext.h:311
+WGL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI = 34869 # http://developer.download.nvidia.com/opengl/includes/wglext.h:312
+# NV_float_buffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:315)
+WGL_FLOAT_COMPONENTS_NV = 8368 # http://developer.download.nvidia.com/opengl/includes/wglext.h:316
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = 8369 # http://developer.download.nvidia.com/opengl/includes/wglext.h:317
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = 8370 # http://developer.download.nvidia.com/opengl/includes/wglext.h:318
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = 8371 # http://developer.download.nvidia.com/opengl/includes/wglext.h:319
+WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = 8372 # http://developer.download.nvidia.com/opengl/includes/wglext.h:320
+WGL_TEXTURE_FLOAT_R_NV = 8373 # http://developer.download.nvidia.com/opengl/includes/wglext.h:321
+WGL_TEXTURE_FLOAT_RG_NV = 8374 # http://developer.download.nvidia.com/opengl/includes/wglext.h:322
+WGL_TEXTURE_FLOAT_RGB_NV = 8375 # http://developer.download.nvidia.com/opengl/includes/wglext.h:323
+WGL_TEXTURE_FLOAT_RGBA_NV = 8376 # http://developer.download.nvidia.com/opengl/includes/wglext.h:324
+# NV_swap_group (http://developer.download.nvidia.com/opengl/includes/wglext.h:327)
+# NV_gpu_affinity (http://developer.download.nvidia.com/opengl/includes/wglext.h:330)
+WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV = 8400 # http://developer.download.nvidia.com/opengl/includes/wglext.h:331
+WGL_ERROR_MISSING_AFFINITY_MASK_NV = 8401 # http://developer.download.nvidia.com/opengl/includes/wglext.h:332
+# ARB_pbuffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:338)
+HANDLE = POINTER(None) # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:58
+HPBUFFERARB = HANDLE # http://developer.download.nvidia.com/opengl/includes/wglext.h:339
+# EXT_pbuffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:341)
+HPBUFFEREXT = HANDLE # http://developer.download.nvidia.com/opengl/includes/wglext.h:342
+# NV_gpu_affinity (http://developer.download.nvidia.com/opengl/includes/wglext.h:345)
+HGPUNV = HANDLE # http://developer.download.nvidia.com/opengl/includes/wglext.h:346
+class struct__GPU_DEVICE(Structure):
+ __slots__ = [
+ 'cb',
+ 'DeviceName',
+ 'DeviceString',
+ 'Flags',
+ 'rcVirtualScreen',
+ ]
+DWORD = c_ulong # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:54
+CHAR = c_char # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:47
+class struct_tagRECT(Structure):
+ __slots__ = [
+ 'left',
+ 'top',
+ 'right',
+ 'bottom',
+ ]
+LONG = c_long # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:53
+struct_tagRECT._fields_ = [
+ ('left', LONG),
+ ('top', LONG),
+ ('right', LONG),
+ ('bottom', LONG),
+]
+
+RECT = struct_tagRECT # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:200
+struct__GPU_DEVICE._fields_ = [
+ ('cb', DWORD),
+ ('DeviceName', CHAR * 32),
+ ('DeviceString', CHAR * 128),
+ ('Flags', DWORD),
+ ('rcVirtualScreen', RECT),
+]
+
+GPU_DEVICE = struct__GPU_DEVICE # http://developer.download.nvidia.com/opengl/includes/wglext.h:353
+PGPU_DEVICE = POINTER(struct__GPU_DEVICE) # http://developer.download.nvidia.com/opengl/includes/wglext.h:353
+# ARB_buffer_region (http://developer.download.nvidia.com/opengl/includes/wglext.h:356)
+WGL_ARB_buffer_region = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:357
+HDC = HANDLE # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:61
+UINT = c_uint # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:50
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:359
+wglCreateBufferRegionARB = _link_function('wglCreateBufferRegionARB', HANDLE, [HDC, c_int, UINT], 'ARB_buffer_region')
+
+VOID = None # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:45
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:360
+wglDeleteBufferRegionARB = _link_function('wglDeleteBufferRegionARB', VOID, [HANDLE], 'ARB_buffer_region')
+
+BOOL = c_long # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:52
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:361
+wglSaveBufferRegionARB = _link_function('wglSaveBufferRegionARB', BOOL, [HANDLE, c_int, c_int, c_int, c_int], 'ARB_buffer_region')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:362
+wglRestoreBufferRegionARB = _link_function('wglRestoreBufferRegionARB', BOOL, [HANDLE, c_int, c_int, c_int, c_int, c_int, c_int], 'ARB_buffer_region')
+
+PFNWGLCREATEBUFFERREGIONARBPROC = CFUNCTYPE(HANDLE, HDC, c_int, UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:364
+PFNWGLDELETEBUFFERREGIONARBPROC = CFUNCTYPE(VOID, HANDLE) # http://developer.download.nvidia.com/opengl/includes/wglext.h:365
+PFNWGLSAVEBUFFERREGIONARBPROC = CFUNCTYPE(BOOL, HANDLE, c_int, c_int, c_int, c_int) # http://developer.download.nvidia.com/opengl/includes/wglext.h:366
+PFNWGLRESTOREBUFFERREGIONARBPROC = CFUNCTYPE(BOOL, HANDLE, c_int, c_int, c_int, c_int, c_int, c_int) # http://developer.download.nvidia.com/opengl/includes/wglext.h:367
+# ARB_multisample (http://developer.download.nvidia.com/opengl/includes/wglext.h:370)
+WGL_ARB_multisample = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:371
+# ARB_extensions_string (http://developer.download.nvidia.com/opengl/includes/wglext.h:374)
+WGL_ARB_extensions_string = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:375
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:377
+wglGetExtensionsStringARB = _link_function('wglGetExtensionsStringARB', c_char_p, [HDC], 'ARB_extensions_string')
+
+PFNWGLGETEXTENSIONSSTRINGARBPROC = CFUNCTYPE(c_char_p, HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:379
+# ARB_pixel_format (http://developer.download.nvidia.com/opengl/includes/wglext.h:382)
+WGL_ARB_pixel_format = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:383
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:385
+wglGetPixelFormatAttribivARB = _link_function('wglGetPixelFormatAttribivARB', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)], 'ARB_pixel_format')
+
+FLOAT = c_float # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:55
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:386
+wglGetPixelFormatAttribfvARB = _link_function('wglGetPixelFormatAttribfvARB', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)], 'ARB_pixel_format')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:387
+wglChoosePixelFormatARB = _link_function('wglChoosePixelFormatARB', BOOL, [HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)], 'ARB_pixel_format')
+
+PFNWGLGETPIXELFORMATATTRIBIVARBPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:389
+PFNWGLGETPIXELFORMATATTRIBFVARBPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:390
+PFNWGLCHOOSEPIXELFORMATARBPROC = CFUNCTYPE(BOOL, HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:391
+# ARB_make_current_read (http://developer.download.nvidia.com/opengl/includes/wglext.h:394)
+WGL_ARB_make_current_read = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:395
+HGLRC = HANDLE # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:60
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:397
+wglMakeContextCurrentARB = _link_function('wglMakeContextCurrentARB', BOOL, [HDC, HDC, HGLRC], 'ARB_make_current_read')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:398
+wglGetCurrentReadDCARB = _link_function('wglGetCurrentReadDCARB', HDC, [], 'ARB_make_current_read')
+
+PFNWGLMAKECONTEXTCURRENTARBPROC = CFUNCTYPE(BOOL, HDC, HDC, HGLRC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:400
+PFNWGLGETCURRENTREADDCARBPROC = CFUNCTYPE(HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:401
+# ARB_pbuffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:404)
+WGL_ARB_pbuffer = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:405
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:407
+wglCreatePbufferARB = _link_function('wglCreatePbufferARB', HPBUFFERARB, [HDC, c_int, c_int, c_int, POINTER(c_int)], 'ARB_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:408
+wglGetPbufferDCARB = _link_function('wglGetPbufferDCARB', HDC, [HPBUFFERARB], 'ARB_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:409
+wglReleasePbufferDCARB = _link_function('wglReleasePbufferDCARB', c_int, [HPBUFFERARB, HDC], 'ARB_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:410
+wglDestroyPbufferARB = _link_function('wglDestroyPbufferARB', BOOL, [HPBUFFERARB], 'ARB_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:411
+wglQueryPbufferARB = _link_function('wglQueryPbufferARB', BOOL, [HPBUFFERARB, c_int, POINTER(c_int)], 'ARB_pbuffer')
+
+PFNWGLCREATEPBUFFERARBPROC = CFUNCTYPE(HPBUFFERARB, HDC, c_int, c_int, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:413
+PFNWGLGETPBUFFERDCARBPROC = CFUNCTYPE(HDC, HPBUFFERARB) # http://developer.download.nvidia.com/opengl/includes/wglext.h:414
+PFNWGLRELEASEPBUFFERDCARBPROC = CFUNCTYPE(c_int, HPBUFFERARB, HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:415
+PFNWGLDESTROYPBUFFERARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB) # http://developer.download.nvidia.com/opengl/includes/wglext.h:416
+PFNWGLQUERYPBUFFERARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:417
+# ARB_render_texture (http://developer.download.nvidia.com/opengl/includes/wglext.h:420)
+WGL_ARB_render_texture = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:421
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:423
+wglBindTexImageARB = _link_function('wglBindTexImageARB', BOOL, [HPBUFFERARB, c_int], 'ARB_render_texture')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:424
+wglReleaseTexImageARB = _link_function('wglReleaseTexImageARB', BOOL, [HPBUFFERARB, c_int], 'ARB_render_texture')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:425
+wglSetPbufferAttribARB = _link_function('wglSetPbufferAttribARB', BOOL, [HPBUFFERARB, POINTER(c_int)], 'ARB_render_texture')
+
+PFNWGLBINDTEXIMAGEARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int) # http://developer.download.nvidia.com/opengl/includes/wglext.h:427
+PFNWGLRELEASETEXIMAGEARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, c_int) # http://developer.download.nvidia.com/opengl/includes/wglext.h:428
+PFNWGLSETPBUFFERATTRIBARBPROC = CFUNCTYPE(BOOL, HPBUFFERARB, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:429
+# ARB_pixel_format_float (http://developer.download.nvidia.com/opengl/includes/wglext.h:432)
+WGL_ARB_pixel_format_float = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:433
+# EXT_display_color_table (http://developer.download.nvidia.com/opengl/includes/wglext.h:436)
+WGL_EXT_display_color_table = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:437
+GLboolean = c_ubyte # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:18
+GLushort = c_ushort # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:25
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:439
+wglCreateDisplayColorTableEXT = _link_function('wglCreateDisplayColorTableEXT', GLboolean, [GLushort], 'EXT_display_color_table')
+
+GLuint = c_uint # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:26
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:440
+wglLoadDisplayColorTableEXT = _link_function('wglLoadDisplayColorTableEXT', GLboolean, [POINTER(GLushort), GLuint], 'EXT_display_color_table')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:441
+wglBindDisplayColorTableEXT = _link_function('wglBindDisplayColorTableEXT', GLboolean, [GLushort], 'EXT_display_color_table')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:442
+wglDestroyDisplayColorTableEXT = _link_function('wglDestroyDisplayColorTableEXT', VOID, [GLushort], 'EXT_display_color_table')
+
+PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(GLboolean, GLushort) # http://developer.download.nvidia.com/opengl/includes/wglext.h:444
+PFNWGLLOADDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(GLboolean, POINTER(GLushort), GLuint) # http://developer.download.nvidia.com/opengl/includes/wglext.h:445
+PFNWGLBINDDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(GLboolean, GLushort) # http://developer.download.nvidia.com/opengl/includes/wglext.h:446
+PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC = CFUNCTYPE(VOID, GLushort) # http://developer.download.nvidia.com/opengl/includes/wglext.h:447
+# EXT_extensions_string (http://developer.download.nvidia.com/opengl/includes/wglext.h:450)
+WGL_EXT_extensions_string = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:451
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:453
+wglGetExtensionsStringEXT = _link_function('wglGetExtensionsStringEXT', c_char_p, [], 'EXT_extensions_string')
+
+PFNWGLGETEXTENSIONSSTRINGEXTPROC = CFUNCTYPE(c_char_p) # http://developer.download.nvidia.com/opengl/includes/wglext.h:455
+# EXT_make_current_read (http://developer.download.nvidia.com/opengl/includes/wglext.h:458)
+WGL_EXT_make_current_read = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:459
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:461
+wglMakeContextCurrentEXT = _link_function('wglMakeContextCurrentEXT', BOOL, [HDC, HDC, HGLRC], 'EXT_make_current_read')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:462
+wglGetCurrentReadDCEXT = _link_function('wglGetCurrentReadDCEXT', HDC, [], 'EXT_make_current_read')
+
+PFNWGLMAKECONTEXTCURRENTEXTPROC = CFUNCTYPE(BOOL, HDC, HDC, HGLRC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:464
+PFNWGLGETCURRENTREADDCEXTPROC = CFUNCTYPE(HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:465
+# EXT_pbuffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:468)
+WGL_EXT_pbuffer = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:469
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:471
+wglCreatePbufferEXT = _link_function('wglCreatePbufferEXT', HPBUFFEREXT, [HDC, c_int, c_int, c_int, POINTER(c_int)], 'EXT_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:472
+wglGetPbufferDCEXT = _link_function('wglGetPbufferDCEXT', HDC, [HPBUFFEREXT], 'EXT_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:473
+wglReleasePbufferDCEXT = _link_function('wglReleasePbufferDCEXT', c_int, [HPBUFFEREXT, HDC], 'EXT_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:474
+wglDestroyPbufferEXT = _link_function('wglDestroyPbufferEXT', BOOL, [HPBUFFEREXT], 'EXT_pbuffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:475
+wglQueryPbufferEXT = _link_function('wglQueryPbufferEXT', BOOL, [HPBUFFEREXT, c_int, POINTER(c_int)], 'EXT_pbuffer')
+
+PFNWGLCREATEPBUFFEREXTPROC = CFUNCTYPE(HPBUFFEREXT, HDC, c_int, c_int, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:477
+PFNWGLGETPBUFFERDCEXTPROC = CFUNCTYPE(HDC, HPBUFFEREXT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:478
+PFNWGLRELEASEPBUFFERDCEXTPROC = CFUNCTYPE(c_int, HPBUFFEREXT, HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:479
+PFNWGLDESTROYPBUFFEREXTPROC = CFUNCTYPE(BOOL, HPBUFFEREXT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:480
+PFNWGLQUERYPBUFFEREXTPROC = CFUNCTYPE(BOOL, HPBUFFEREXT, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:481
+# EXT_pixel_format (http://developer.download.nvidia.com/opengl/includes/wglext.h:484)
+WGL_EXT_pixel_format = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:485
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:487
+wglGetPixelFormatAttribivEXT = _link_function('wglGetPixelFormatAttribivEXT', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)], 'EXT_pixel_format')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:488
+wglGetPixelFormatAttribfvEXT = _link_function('wglGetPixelFormatAttribfvEXT', BOOL, [HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)], 'EXT_pixel_format')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:489
+wglChoosePixelFormatEXT = _link_function('wglChoosePixelFormatEXT', BOOL, [HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)], 'EXT_pixel_format')
+
+PFNWGLGETPIXELFORMATATTRIBIVEXTPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:491
+PFNWGLGETPIXELFORMATATTRIBFVEXTPROC = CFUNCTYPE(BOOL, HDC, c_int, c_int, UINT, POINTER(c_int), POINTER(FLOAT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:492
+PFNWGLCHOOSEPIXELFORMATEXTPROC = CFUNCTYPE(BOOL, HDC, POINTER(c_int), POINTER(FLOAT), UINT, POINTER(c_int), POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:493
+# EXT_swap_control (http://developer.download.nvidia.com/opengl/includes/wglext.h:496)
+WGL_EXT_swap_control = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:497
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:499
+wglSwapIntervalEXT = _link_function('wglSwapIntervalEXT', BOOL, [c_int], 'EXT_swap_control')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:500
+wglGetSwapIntervalEXT = _link_function('wglGetSwapIntervalEXT', c_int, [], 'EXT_swap_control')
+
+PFNWGLSWAPINTERVALEXTPROC = CFUNCTYPE(BOOL, c_int) # http://developer.download.nvidia.com/opengl/includes/wglext.h:502
+PFNWGLGETSWAPINTERVALEXTPROC = CFUNCTYPE(c_int) # http://developer.download.nvidia.com/opengl/includes/wglext.h:503
+# EXT_depth_float (http://developer.download.nvidia.com/opengl/includes/wglext.h:506)
+WGL_EXT_depth_float = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:507
+# NV_vertex_array_range (http://developer.download.nvidia.com/opengl/includes/wglext.h:510)
+WGL_NV_vertex_array_range = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:511
+GLsizei = c_int # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:23
+GLfloat = c_float # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:27
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:513
+wglAllocateMemoryNV = _link_function('wglAllocateMemoryNV', POINTER(c_void), [GLsizei, GLfloat, GLfloat, GLfloat], 'NV_vertex_array_range')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:514
+wglFreeMemoryNV = _link_function('wglFreeMemoryNV', None, [POINTER(None)], 'NV_vertex_array_range')
+
+PFNWGLALLOCATEMEMORYNVPROC = CFUNCTYPE(POINTER(c_void), GLsizei, GLfloat, GLfloat, GLfloat) # http://developer.download.nvidia.com/opengl/includes/wglext.h:516
+PFNWGLFREEMEMORYNVPROC = CFUNCTYPE(None, POINTER(None)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:517
+# 3DFX_multisample (http://developer.download.nvidia.com/opengl/includes/wglext.h:520)
+WGL_3DFX_multisample = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:521
+# EXT_multisample (http://developer.download.nvidia.com/opengl/includes/wglext.h:524)
+WGL_EXT_multisample = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:525
+# OML_sync_control (http://developer.download.nvidia.com/opengl/includes/wglext.h:528)
+WGL_OML_sync_control = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:529
+INT64 = c_longlong # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:42
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:531
+wglGetSyncValuesOML = _link_function('wglGetSyncValuesOML', BOOL, [HDC, POINTER(INT64), POINTER(INT64), POINTER(INT64)], 'OML_sync_control')
+
+INT32 = c_int # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:35
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:532
+wglGetMscRateOML = _link_function('wglGetMscRateOML', BOOL, [HDC, POINTER(INT32), POINTER(INT32)], 'OML_sync_control')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:533
+wglSwapBuffersMscOML = _link_function('wglSwapBuffersMscOML', INT64, [HDC, INT64, INT64, INT64], 'OML_sync_control')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:534
+wglSwapLayerBuffersMscOML = _link_function('wglSwapLayerBuffersMscOML', INT64, [HDC, c_int, INT64, INT64, INT64], 'OML_sync_control')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:535
+wglWaitForMscOML = _link_function('wglWaitForMscOML', BOOL, [HDC, INT64, INT64, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)], 'OML_sync_control')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:536
+wglWaitForSbcOML = _link_function('wglWaitForSbcOML', BOOL, [HDC, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)], 'OML_sync_control')
+
+PFNWGLGETSYNCVALUESOMLPROC = CFUNCTYPE(BOOL, HDC, POINTER(INT64), POINTER(INT64), POINTER(INT64)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:538
+PFNWGLGETMSCRATEOMLPROC = CFUNCTYPE(BOOL, HDC, POINTER(INT32), POINTER(INT32)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:539
+PFNWGLSWAPBUFFERSMSCOMLPROC = CFUNCTYPE(INT64, HDC, INT64, INT64, INT64) # http://developer.download.nvidia.com/opengl/includes/wglext.h:540
+PFNWGLSWAPLAYERBUFFERSMSCOMLPROC = CFUNCTYPE(INT64, HDC, c_int, INT64, INT64, INT64) # http://developer.download.nvidia.com/opengl/includes/wglext.h:541
+PFNWGLWAITFORMSCOMLPROC = CFUNCTYPE(BOOL, HDC, INT64, INT64, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:542
+PFNWGLWAITFORSBCOMLPROC = CFUNCTYPE(BOOL, HDC, INT64, POINTER(INT64), POINTER(INT64), POINTER(INT64)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:543
+# I3D_digital_video_control (http://developer.download.nvidia.com/opengl/includes/wglext.h:546)
+WGL_I3D_digital_video_control = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:547
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:549
+wglGetDigitalVideoParametersI3D = _link_function('wglGetDigitalVideoParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_digital_video_control')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:550
+wglSetDigitalVideoParametersI3D = _link_function('wglSetDigitalVideoParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_digital_video_control')
+
+PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:552
+PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:553
+# I3D_gamma (http://developer.download.nvidia.com/opengl/includes/wglext.h:556)
+WGL_I3D_gamma = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:557
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:559
+wglGetGammaTableParametersI3D = _link_function('wglGetGammaTableParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_gamma')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:560
+wglSetGammaTableParametersI3D = _link_function('wglSetGammaTableParametersI3D', BOOL, [HDC, c_int, POINTER(c_int)], 'I3D_gamma')
+
+USHORT = c_ushort # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:49
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:561
+wglGetGammaTableI3D = _link_function('wglGetGammaTableI3D', BOOL, [HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)], 'I3D_gamma')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:562
+wglSetGammaTableI3D = _link_function('wglSetGammaTableI3D', BOOL, [HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)], 'I3D_gamma')
+
+PFNWGLGETGAMMATABLEPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:564
+PFNWGLSETGAMMATABLEPARAMETERSI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(c_int)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:565
+PFNWGLGETGAMMATABLEI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:566
+PFNWGLSETGAMMATABLEI3DPROC = CFUNCTYPE(BOOL, HDC, c_int, POINTER(USHORT), POINTER(USHORT), POINTER(USHORT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:567
+# I3D_genlock (http://developer.download.nvidia.com/opengl/includes/wglext.h:570)
+WGL_I3D_genlock = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:571
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:573
+wglEnableGenlockI3D = _link_function('wglEnableGenlockI3D', BOOL, [HDC], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:574
+wglDisableGenlockI3D = _link_function('wglDisableGenlockI3D', BOOL, [HDC], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:575
+wglIsEnabledGenlockI3D = _link_function('wglIsEnabledGenlockI3D', BOOL, [HDC, POINTER(BOOL)], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:576
+wglGenlockSourceI3D = _link_function('wglGenlockSourceI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:577
+wglGetGenlockSourceI3D = _link_function('wglGetGenlockSourceI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:578
+wglGenlockSourceEdgeI3D = _link_function('wglGenlockSourceEdgeI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:579
+wglGetGenlockSourceEdgeI3D = _link_function('wglGetGenlockSourceEdgeI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:580
+wglGenlockSampleRateI3D = _link_function('wglGenlockSampleRateI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:581
+wglGetGenlockSampleRateI3D = _link_function('wglGetGenlockSampleRateI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:582
+wglGenlockSourceDelayI3D = _link_function('wglGenlockSourceDelayI3D', BOOL, [HDC, UINT], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:583
+wglGetGenlockSourceDelayI3D = _link_function('wglGetGenlockSourceDelayI3D', BOOL, [HDC, POINTER(UINT)], 'I3D_genlock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:584
+wglQueryGenlockMaxSourceDelayI3D = _link_function('wglQueryGenlockMaxSourceDelayI3D', BOOL, [HDC, POINTER(UINT), POINTER(UINT)], 'I3D_genlock')
+
+PFNWGLENABLEGENLOCKI3DPROC = CFUNCTYPE(BOOL, HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:586
+PFNWGLDISABLEGENLOCKI3DPROC = CFUNCTYPE(BOOL, HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:587
+PFNWGLISENABLEDGENLOCKI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(BOOL)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:588
+PFNWGLGENLOCKSOURCEI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:589
+PFNWGLGETGENLOCKSOURCEI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:590
+PFNWGLGENLOCKSOURCEEDGEI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:591
+PFNWGLGETGENLOCKSOURCEEDGEI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:592
+PFNWGLGENLOCKSAMPLERATEI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:593
+PFNWGLGETGENLOCKSAMPLERATEI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:594
+PFNWGLGENLOCKSOURCEDELAYI3DPROC = CFUNCTYPE(BOOL, HDC, UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:595
+PFNWGLGETGENLOCKSOURCEDELAYI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:596
+PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(UINT), POINTER(UINT)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:597
+# I3D_image_buffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:600)
+WGL_I3D_image_buffer = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:601
+LPVOID = POINTER(None) # C:\cygwin\home\alex\projects\pyglet\tools\wgl.h:45
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:603
+wglCreateImageBufferI3D = _link_function('wglCreateImageBufferI3D', LPVOID, [HDC, DWORD, UINT], 'I3D_image_buffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:604
+wglDestroyImageBufferI3D = _link_function('wglDestroyImageBufferI3D', BOOL, [HDC, LPVOID], 'I3D_image_buffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:605
+wglAssociateImageBufferEventsI3D = _link_function('wglAssociateImageBufferEventsI3D', BOOL, [HDC, POINTER(HANDLE), POINTER(LPVOID), POINTER(DWORD), UINT], 'I3D_image_buffer')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:606
+wglReleaseImageBufferEventsI3D = _link_function('wglReleaseImageBufferEventsI3D', BOOL, [HDC, POINTER(LPVOID), UINT], 'I3D_image_buffer')
+
+PFNWGLCREATEIMAGEBUFFERI3DPROC = CFUNCTYPE(LPVOID, HDC, DWORD, UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:608
+PFNWGLDESTROYIMAGEBUFFERI3DPROC = CFUNCTYPE(BOOL, HDC, LPVOID) # http://developer.download.nvidia.com/opengl/includes/wglext.h:609
+PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(HANDLE), POINTER(LPVOID), POINTER(DWORD), UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:610
+PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC = CFUNCTYPE(BOOL, HDC, POINTER(LPVOID), UINT) # http://developer.download.nvidia.com/opengl/includes/wglext.h:611
+# I3D_swap_frame_lock (http://developer.download.nvidia.com/opengl/includes/wglext.h:614)
+WGL_I3D_swap_frame_lock = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:615
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:617
+wglEnableFrameLockI3D = _link_function('wglEnableFrameLockI3D', BOOL, [], 'I3D_swap_frame_lock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:618
+wglDisableFrameLockI3D = _link_function('wglDisableFrameLockI3D', BOOL, [], 'I3D_swap_frame_lock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:619
+wglIsEnabledFrameLockI3D = _link_function('wglIsEnabledFrameLockI3D', BOOL, [POINTER(BOOL)], 'I3D_swap_frame_lock')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:620
+wglQueryFrameLockMasterI3D = _link_function('wglQueryFrameLockMasterI3D', BOOL, [POINTER(BOOL)], 'I3D_swap_frame_lock')
+
+PFNWGLENABLEFRAMELOCKI3DPROC = CFUNCTYPE(BOOL) # http://developer.download.nvidia.com/opengl/includes/wglext.h:622
+PFNWGLDISABLEFRAMELOCKI3DPROC = CFUNCTYPE(BOOL) # http://developer.download.nvidia.com/opengl/includes/wglext.h:623
+PFNWGLISENABLEDFRAMELOCKI3DPROC = CFUNCTYPE(BOOL, POINTER(BOOL)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:624
+PFNWGLQUERYFRAMELOCKMASTERI3DPROC = CFUNCTYPE(BOOL, POINTER(BOOL)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:625
+# I3D_swap_frame_usage (http://developer.download.nvidia.com/opengl/includes/wglext.h:628)
+WGL_I3D_swap_frame_usage = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:629
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:631
+wglGetFrameUsageI3D = _link_function('wglGetFrameUsageI3D', BOOL, [POINTER(c_float)], 'I3D_swap_frame_usage')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:632
+wglBeginFrameTrackingI3D = _link_function('wglBeginFrameTrackingI3D', BOOL, [], 'I3D_swap_frame_usage')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:633
+wglEndFrameTrackingI3D = _link_function('wglEndFrameTrackingI3D', BOOL, [], 'I3D_swap_frame_usage')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:634
+wglQueryFrameTrackingI3D = _link_function('wglQueryFrameTrackingI3D', BOOL, [POINTER(DWORD), POINTER(DWORD), POINTER(c_float)], 'I3D_swap_frame_usage')
+
+PFNWGLGETFRAMEUSAGEI3DPROC = CFUNCTYPE(BOOL, POINTER(c_float)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:636
+PFNWGLBEGINFRAMETRACKINGI3DPROC = CFUNCTYPE(BOOL) # http://developer.download.nvidia.com/opengl/includes/wglext.h:637
+PFNWGLENDFRAMETRACKINGI3DPROC = CFUNCTYPE(BOOL) # http://developer.download.nvidia.com/opengl/includes/wglext.h:638
+PFNWGLQUERYFRAMETRACKINGI3DPROC = CFUNCTYPE(BOOL, POINTER(DWORD), POINTER(DWORD), POINTER(c_float)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:639
+# ATI_pixel_format_float (http://developer.download.nvidia.com/opengl/includes/wglext.h:642)
+WGL_ATI_pixel_format_float = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:643
+# NV_render_depth_texture (http://developer.download.nvidia.com/opengl/includes/wglext.h:646)
+WGL_NV_render_depth_texture = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:647
+# NV_render_texture_rectangle (http://developer.download.nvidia.com/opengl/includes/wglext.h:650)
+WGL_NV_render_texture_rectangle = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:651
+# NV_float_buffer (http://developer.download.nvidia.com/opengl/includes/wglext.h:654)
+WGL_NV_float_buffer = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:655
+# NV_swap_group (http://developer.download.nvidia.com/opengl/includes/wglext.h:658)
+WGL_NV_swap_group = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:659
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:661
+wglJoinSwapGroupNV = _link_function('wglJoinSwapGroupNV', BOOL, [HDC, GLuint], 'NV_swap_group')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:662
+wglBindSwapBarrierNV = _link_function('wglBindSwapBarrierNV', BOOL, [GLuint, GLuint], 'NV_swap_group')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:663
+wglQuerySwapGroupNV = _link_function('wglQuerySwapGroupNV', BOOL, [HDC, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:664
+wglQueryMaxSwapGroupsNV = _link_function('wglQueryMaxSwapGroupsNV', BOOL, [HDC, POINTER(GLuint), POINTER(GLuint)], 'NV_swap_group')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:665
+wglQueryFrameCountNV = _link_function('wglQueryFrameCountNV', BOOL, [HDC, POINTER(GLuint)], 'NV_swap_group')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:666
+wglResetFrameCountNV = _link_function('wglResetFrameCountNV', BOOL, [HDC], 'NV_swap_group')
+
+PFNWGLJOINSWAPGROUPNVPROC = CFUNCTYPE(BOOL, HDC, GLuint) # http://developer.download.nvidia.com/opengl/includes/wglext.h:668
+PFNWGLBINDSWAPBARRIERNVPROC = CFUNCTYPE(BOOL, GLuint, GLuint) # http://developer.download.nvidia.com/opengl/includes/wglext.h:669
+PFNWGLQUERYSWAPGROUPNVPROC = CFUNCTYPE(BOOL, HDC, POINTER(GLuint), POINTER(GLuint)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:670
+PFNWGLQUERYMAXSWAPGROUPSNVPROC = CFUNCTYPE(BOOL, HDC, POINTER(GLuint), POINTER(GLuint)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:671
+PFNWGLQUERYFRAMECOUNTNVPROC = CFUNCTYPE(BOOL, HDC, POINTER(GLuint)) # http://developer.download.nvidia.com/opengl/includes/wglext.h:672
+PFNWGLRESETFRAMECOUNTNVPROC = CFUNCTYPE(BOOL, HDC) # http://developer.download.nvidia.com/opengl/includes/wglext.h:673
+# NV_gpu_affinity (http://developer.download.nvidia.com/opengl/includes/wglext.h:676)
+WGL_NV_gpu_affinity = 1 # http://developer.download.nvidia.com/opengl/includes/wglext.h:677
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:679
+wglEnumGpusNV = _link_function('wglEnumGpusNV', BOOL, [UINT, POINTER(HGPUNV)], 'NV_gpu_affinity')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:680
+wglEnumGpuDevicesNV = _link_function('wglEnumGpuDevicesNV', BOOL, [HGPUNV, UINT, PGPU_DEVICE], 'NV_gpu_affinity')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:681
+wglCreateAffinityDCNV = _link_function('wglCreateAffinityDCNV', HDC, [POINTER(HGPUNV)], 'NV_gpu_affinity')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:682
+wglEnumGpusFromAffinityDCNV = _link_function('wglEnumGpusFromAffinityDCNV', BOOL, [HDC, UINT, POINTER(HGPUNV)], 'NV_gpu_affinity')
+
+# http://developer.download.nvidia.com/opengl/includes/wglext.h:683
+wglDeleteDCNV = _link_function('wglDeleteDCNV', BOOL, [HDC], 'NV_gpu_affinity')
+
+
+__all__ = ['WIN32_LEAN_AND_MEAN', 'WGL_WGLEXT_VERSION',
+'WGL_FRONT_COLOR_BUFFER_BIT_ARB', 'WGL_BACK_COLOR_BUFFER_BIT_ARB',
+'WGL_DEPTH_BUFFER_BIT_ARB', 'WGL_STENCIL_BUFFER_BIT_ARB',
+'WGL_SAMPLE_BUFFERS_ARB', 'WGL_SAMPLES_ARB', 'WGL_NUMBER_PIXEL_FORMATS_ARB',
+'WGL_DRAW_TO_WINDOW_ARB', 'WGL_DRAW_TO_BITMAP_ARB', 'WGL_ACCELERATION_ARB',
+'WGL_NEED_PALETTE_ARB', 'WGL_NEED_SYSTEM_PALETTE_ARB',
+'WGL_SWAP_LAYER_BUFFERS_ARB', 'WGL_SWAP_METHOD_ARB',
+'WGL_NUMBER_OVERLAYS_ARB', 'WGL_NUMBER_UNDERLAYS_ARB', 'WGL_TRANSPARENT_ARB',
+'WGL_TRANSPARENT_RED_VALUE_ARB', 'WGL_TRANSPARENT_GREEN_VALUE_ARB',
+'WGL_TRANSPARENT_BLUE_VALUE_ARB', 'WGL_TRANSPARENT_ALPHA_VALUE_ARB',
+'WGL_TRANSPARENT_INDEX_VALUE_ARB', 'WGL_SHARE_DEPTH_ARB',
+'WGL_SHARE_STENCIL_ARB', 'WGL_SHARE_ACCUM_ARB', 'WGL_SUPPORT_GDI_ARB',
+'WGL_SUPPORT_OPENGL_ARB', 'WGL_DOUBLE_BUFFER_ARB', 'WGL_STEREO_ARB',
+'WGL_PIXEL_TYPE_ARB', 'WGL_COLOR_BITS_ARB', 'WGL_RED_BITS_ARB',
+'WGL_RED_SHIFT_ARB', 'WGL_GREEN_BITS_ARB', 'WGL_GREEN_SHIFT_ARB',
+'WGL_BLUE_BITS_ARB', 'WGL_BLUE_SHIFT_ARB', 'WGL_ALPHA_BITS_ARB',
+'WGL_ALPHA_SHIFT_ARB', 'WGL_ACCUM_BITS_ARB', 'WGL_ACCUM_RED_BITS_ARB',
+'WGL_ACCUM_GREEN_BITS_ARB', 'WGL_ACCUM_BLUE_BITS_ARB',
+'WGL_ACCUM_ALPHA_BITS_ARB', 'WGL_DEPTH_BITS_ARB', 'WGL_STENCIL_BITS_ARB',
+'WGL_AUX_BUFFERS_ARB', 'WGL_NO_ACCELERATION_ARB',
+'WGL_GENERIC_ACCELERATION_ARB', 'WGL_FULL_ACCELERATION_ARB',
+'WGL_SWAP_EXCHANGE_ARB', 'WGL_SWAP_COPY_ARB', 'WGL_SWAP_UNDEFINED_ARB',
+'WGL_TYPE_RGBA_ARB', 'WGL_TYPE_COLORINDEX_ARB',
+'ERROR_INVALID_PIXEL_TYPE_ARB', 'ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB',
+'WGL_DRAW_TO_PBUFFER_ARB', 'WGL_MAX_PBUFFER_PIXELS_ARB',
+'WGL_MAX_PBUFFER_WIDTH_ARB', 'WGL_MAX_PBUFFER_HEIGHT_ARB',
+'WGL_PBUFFER_LARGEST_ARB', 'WGL_PBUFFER_WIDTH_ARB', 'WGL_PBUFFER_HEIGHT_ARB',
+'WGL_PBUFFER_LOST_ARB', 'WGL_BIND_TO_TEXTURE_RGB_ARB',
+'WGL_BIND_TO_TEXTURE_RGBA_ARB', 'WGL_TEXTURE_FORMAT_ARB',
+'WGL_TEXTURE_TARGET_ARB', 'WGL_MIPMAP_TEXTURE_ARB', 'WGL_TEXTURE_RGB_ARB',
+'WGL_TEXTURE_RGBA_ARB', 'WGL_NO_TEXTURE_ARB', 'WGL_TEXTURE_CUBE_MAP_ARB',
+'WGL_TEXTURE_1D_ARB', 'WGL_TEXTURE_2D_ARB', 'WGL_MIPMAP_LEVEL_ARB',
+'WGL_CUBE_MAP_FACE_ARB', 'WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB',
+'WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB', 'WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB',
+'WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB', 'WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB',
+'WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB', 'WGL_FRONT_LEFT_ARB',
+'WGL_FRONT_RIGHT_ARB', 'WGL_BACK_LEFT_ARB', 'WGL_BACK_RIGHT_ARB',
+'WGL_AUX0_ARB', 'WGL_AUX1_ARB', 'WGL_AUX2_ARB', 'WGL_AUX3_ARB',
+'WGL_AUX4_ARB', 'WGL_AUX5_ARB', 'WGL_AUX6_ARB', 'WGL_AUX7_ARB',
+'WGL_AUX8_ARB', 'WGL_AUX9_ARB', 'WGL_TYPE_RGBA_FLOAT_ARB',
+'ERROR_INVALID_PIXEL_TYPE_EXT', 'WGL_NUMBER_PIXEL_FORMATS_EXT',
+'WGL_DRAW_TO_WINDOW_EXT', 'WGL_DRAW_TO_BITMAP_EXT', 'WGL_ACCELERATION_EXT',
+'WGL_NEED_PALETTE_EXT', 'WGL_NEED_SYSTEM_PALETTE_EXT',
+'WGL_SWAP_LAYER_BUFFERS_EXT', 'WGL_SWAP_METHOD_EXT',
+'WGL_NUMBER_OVERLAYS_EXT', 'WGL_NUMBER_UNDERLAYS_EXT', 'WGL_TRANSPARENT_EXT',
+'WGL_TRANSPARENT_VALUE_EXT', 'WGL_SHARE_DEPTH_EXT', 'WGL_SHARE_STENCIL_EXT',
+'WGL_SHARE_ACCUM_EXT', 'WGL_SUPPORT_GDI_EXT', 'WGL_SUPPORT_OPENGL_EXT',
+'WGL_DOUBLE_BUFFER_EXT', 'WGL_STEREO_EXT', 'WGL_PIXEL_TYPE_EXT',
+'WGL_COLOR_BITS_EXT', 'WGL_RED_BITS_EXT', 'WGL_RED_SHIFT_EXT',
+'WGL_GREEN_BITS_EXT', 'WGL_GREEN_SHIFT_EXT', 'WGL_BLUE_BITS_EXT',
+'WGL_BLUE_SHIFT_EXT', 'WGL_ALPHA_BITS_EXT', 'WGL_ALPHA_SHIFT_EXT',
+'WGL_ACCUM_BITS_EXT', 'WGL_ACCUM_RED_BITS_EXT', 'WGL_ACCUM_GREEN_BITS_EXT',
+'WGL_ACCUM_BLUE_BITS_EXT', 'WGL_ACCUM_ALPHA_BITS_EXT', 'WGL_DEPTH_BITS_EXT',
+'WGL_STENCIL_BITS_EXT', 'WGL_AUX_BUFFERS_EXT', 'WGL_NO_ACCELERATION_EXT',
+'WGL_GENERIC_ACCELERATION_EXT', 'WGL_FULL_ACCELERATION_EXT',
+'WGL_SWAP_EXCHANGE_EXT', 'WGL_SWAP_COPY_EXT', 'WGL_SWAP_UNDEFINED_EXT',
+'WGL_TYPE_RGBA_EXT', 'WGL_TYPE_COLORINDEX_EXT', 'WGL_DRAW_TO_PBUFFER_EXT',
+'WGL_MAX_PBUFFER_PIXELS_EXT', 'WGL_MAX_PBUFFER_WIDTH_EXT',
+'WGL_MAX_PBUFFER_HEIGHT_EXT', 'WGL_OPTIMAL_PBUFFER_WIDTH_EXT',
+'WGL_OPTIMAL_PBUFFER_HEIGHT_EXT', 'WGL_PBUFFER_LARGEST_EXT',
+'WGL_PBUFFER_WIDTH_EXT', 'WGL_PBUFFER_HEIGHT_EXT', 'WGL_DEPTH_FLOAT_EXT',
+'WGL_SAMPLE_BUFFERS_3DFX', 'WGL_SAMPLES_3DFX', 'WGL_SAMPLE_BUFFERS_EXT',
+'WGL_SAMPLES_EXT', 'WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D',
+'WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D',
+'WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D',
+'WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D', 'WGL_GAMMA_TABLE_SIZE_I3D',
+'WGL_GAMMA_EXCLUDE_DESKTOP_I3D', 'WGL_GENLOCK_SOURCE_MULTIVIEW_I3D',
+'WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D', 'WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D',
+'WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D', 'WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D',
+'WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D', 'WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D',
+'WGL_GENLOCK_SOURCE_EDGE_RISING_I3D', 'WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D',
+'WGL_IMAGE_BUFFER_MIN_ACCESS_I3D', 'WGL_IMAGE_BUFFER_LOCK_I3D',
+'WGL_BIND_TO_TEXTURE_DEPTH_NV', 'WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV',
+'WGL_DEPTH_TEXTURE_FORMAT_NV', 'WGL_TEXTURE_DEPTH_COMPONENT_NV',
+'WGL_DEPTH_COMPONENT_NV', 'WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV', 'WGL_TEXTURE_RECTANGLE_NV',
+'WGL_TYPE_RGBA_FLOAT_ATI', 'WGL_RGBA_FLOAT_MODE_ATI',
+'WGL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI', 'WGL_FLOAT_COMPONENTS_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV',
+'WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV', 'WGL_TEXTURE_FLOAT_R_NV',
+'WGL_TEXTURE_FLOAT_RG_NV', 'WGL_TEXTURE_FLOAT_RGB_NV',
+'WGL_TEXTURE_FLOAT_RGBA_NV', 'WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV',
+'WGL_ERROR_MISSING_AFFINITY_MASK_NV', 'HPBUFFERARB', 'HPBUFFEREXT', 'HGPUNV',
+'GPU_DEVICE', 'PGPU_DEVICE', 'WGL_ARB_buffer_region',
+'wglCreateBufferRegionARB', 'wglDeleteBufferRegionARB',
+'wglSaveBufferRegionARB', 'wglRestoreBufferRegionARB',
+'PFNWGLCREATEBUFFERREGIONARBPROC', 'PFNWGLDELETEBUFFERREGIONARBPROC',
+'PFNWGLSAVEBUFFERREGIONARBPROC', 'PFNWGLRESTOREBUFFERREGIONARBPROC',
+'WGL_ARB_multisample', 'WGL_ARB_extensions_string',
+'wglGetExtensionsStringARB', 'PFNWGLGETEXTENSIONSSTRINGARBPROC',
+'WGL_ARB_pixel_format', 'wglGetPixelFormatAttribivARB',
+'wglGetPixelFormatAttribfvARB', 'wglChoosePixelFormatARB',
+'PFNWGLGETPIXELFORMATATTRIBIVARBPROC', 'PFNWGLGETPIXELFORMATATTRIBFVARBPROC',
+'PFNWGLCHOOSEPIXELFORMATARBPROC', 'WGL_ARB_make_current_read',
+'wglMakeContextCurrentARB', 'wglGetCurrentReadDCARB',
+'PFNWGLMAKECONTEXTCURRENTARBPROC', 'PFNWGLGETCURRENTREADDCARBPROC',
+'WGL_ARB_pbuffer', 'wglCreatePbufferARB', 'wglGetPbufferDCARB',
+'wglReleasePbufferDCARB', 'wglDestroyPbufferARB', 'wglQueryPbufferARB',
+'PFNWGLCREATEPBUFFERARBPROC', 'PFNWGLGETPBUFFERDCARBPROC',
+'PFNWGLRELEASEPBUFFERDCARBPROC', 'PFNWGLDESTROYPBUFFERARBPROC',
+'PFNWGLQUERYPBUFFERARBPROC', 'WGL_ARB_render_texture', 'wglBindTexImageARB',
+'wglReleaseTexImageARB', 'wglSetPbufferAttribARB',
+'PFNWGLBINDTEXIMAGEARBPROC', 'PFNWGLRELEASETEXIMAGEARBPROC',
+'PFNWGLSETPBUFFERATTRIBARBPROC', 'WGL_ARB_pixel_format_float',
+'WGL_EXT_display_color_table', 'wglCreateDisplayColorTableEXT',
+'wglLoadDisplayColorTableEXT', 'wglBindDisplayColorTableEXT',
+'wglDestroyDisplayColorTableEXT', 'PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC',
+'PFNWGLLOADDISPLAYCOLORTABLEEXTPROC', 'PFNWGLBINDDISPLAYCOLORTABLEEXTPROC',
+'PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC', 'WGL_EXT_extensions_string',
+'wglGetExtensionsStringEXT', 'PFNWGLGETEXTENSIONSSTRINGEXTPROC',
+'WGL_EXT_make_current_read', 'wglMakeContextCurrentEXT',
+'wglGetCurrentReadDCEXT', 'PFNWGLMAKECONTEXTCURRENTEXTPROC',
+'PFNWGLGETCURRENTREADDCEXTPROC', 'WGL_EXT_pbuffer', 'wglCreatePbufferEXT',
+'wglGetPbufferDCEXT', 'wglReleasePbufferDCEXT', 'wglDestroyPbufferEXT',
+'wglQueryPbufferEXT', 'PFNWGLCREATEPBUFFEREXTPROC',
+'PFNWGLGETPBUFFERDCEXTPROC', 'PFNWGLRELEASEPBUFFERDCEXTPROC',
+'PFNWGLDESTROYPBUFFEREXTPROC', 'PFNWGLQUERYPBUFFEREXTPROC',
+'WGL_EXT_pixel_format', 'wglGetPixelFormatAttribivEXT',
+'wglGetPixelFormatAttribfvEXT', 'wglChoosePixelFormatEXT',
+'PFNWGLGETPIXELFORMATATTRIBIVEXTPROC', 'PFNWGLGETPIXELFORMATATTRIBFVEXTPROC',
+'PFNWGLCHOOSEPIXELFORMATEXTPROC', 'WGL_EXT_swap_control',
+'wglSwapIntervalEXT', 'wglGetSwapIntervalEXT', 'PFNWGLSWAPINTERVALEXTPROC',
+'PFNWGLGETSWAPINTERVALEXTPROC', 'WGL_EXT_depth_float',
+'WGL_NV_vertex_array_range', 'wglAllocateMemoryNV', 'wglFreeMemoryNV',
+'PFNWGLALLOCATEMEMORYNVPROC', 'PFNWGLFREEMEMORYNVPROC',
+'WGL_3DFX_multisample', 'WGL_EXT_multisample', 'WGL_OML_sync_control',
+'wglGetSyncValuesOML', 'wglGetMscRateOML', 'wglSwapBuffersMscOML',
+'wglSwapLayerBuffersMscOML', 'wglWaitForMscOML', 'wglWaitForSbcOML',
+'PFNWGLGETSYNCVALUESOMLPROC', 'PFNWGLGETMSCRATEOMLPROC',
+'PFNWGLSWAPBUFFERSMSCOMLPROC', 'PFNWGLSWAPLAYERBUFFERSMSCOMLPROC',
+'PFNWGLWAITFORMSCOMLPROC', 'PFNWGLWAITFORSBCOMLPROC',
+'WGL_I3D_digital_video_control', 'wglGetDigitalVideoParametersI3D',
+'wglSetDigitalVideoParametersI3D', 'PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC',
+'PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC', 'WGL_I3D_gamma',
+'wglGetGammaTableParametersI3D', 'wglSetGammaTableParametersI3D',
+'wglGetGammaTableI3D', 'wglSetGammaTableI3D',
+'PFNWGLGETGAMMATABLEPARAMETERSI3DPROC',
+'PFNWGLSETGAMMATABLEPARAMETERSI3DPROC', 'PFNWGLGETGAMMATABLEI3DPROC',
+'PFNWGLSETGAMMATABLEI3DPROC', 'WGL_I3D_genlock', 'wglEnableGenlockI3D',
+'wglDisableGenlockI3D', 'wglIsEnabledGenlockI3D', 'wglGenlockSourceI3D',
+'wglGetGenlockSourceI3D', 'wglGenlockSourceEdgeI3D',
+'wglGetGenlockSourceEdgeI3D', 'wglGenlockSampleRateI3D',
+'wglGetGenlockSampleRateI3D', 'wglGenlockSourceDelayI3D',
+'wglGetGenlockSourceDelayI3D', 'wglQueryGenlockMaxSourceDelayI3D',
+'PFNWGLENABLEGENLOCKI3DPROC', 'PFNWGLDISABLEGENLOCKI3DPROC',
+'PFNWGLISENABLEDGENLOCKI3DPROC', 'PFNWGLGENLOCKSOURCEI3DPROC',
+'PFNWGLGETGENLOCKSOURCEI3DPROC', 'PFNWGLGENLOCKSOURCEEDGEI3DPROC',
+'PFNWGLGETGENLOCKSOURCEEDGEI3DPROC', 'PFNWGLGENLOCKSAMPLERATEI3DPROC',
+'PFNWGLGETGENLOCKSAMPLERATEI3DPROC', 'PFNWGLGENLOCKSOURCEDELAYI3DPROC',
+'PFNWGLGETGENLOCKSOURCEDELAYI3DPROC',
+'PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC', 'WGL_I3D_image_buffer',
+'wglCreateImageBufferI3D', 'wglDestroyImageBufferI3D',
+'wglAssociateImageBufferEventsI3D', 'wglReleaseImageBufferEventsI3D',
+'PFNWGLCREATEIMAGEBUFFERI3DPROC', 'PFNWGLDESTROYIMAGEBUFFERI3DPROC',
+'PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC',
+'PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC', 'WGL_I3D_swap_frame_lock',
+'wglEnableFrameLockI3D', 'wglDisableFrameLockI3D', 'wglIsEnabledFrameLockI3D',
+'wglQueryFrameLockMasterI3D', 'PFNWGLENABLEFRAMELOCKI3DPROC',
+'PFNWGLDISABLEFRAMELOCKI3DPROC', 'PFNWGLISENABLEDFRAMELOCKI3DPROC',
+'PFNWGLQUERYFRAMELOCKMASTERI3DPROC', 'WGL_I3D_swap_frame_usage',
+'wglGetFrameUsageI3D', 'wglBeginFrameTrackingI3D', 'wglEndFrameTrackingI3D',
+'wglQueryFrameTrackingI3D', 'PFNWGLGETFRAMEUSAGEI3DPROC',
+'PFNWGLBEGINFRAMETRACKINGI3DPROC', 'PFNWGLENDFRAMETRACKINGI3DPROC',
+'PFNWGLQUERYFRAMETRACKINGI3DPROC', 'WGL_ATI_pixel_format_float',
+'WGL_NV_render_depth_texture', 'WGL_NV_render_texture_rectangle',
+'WGL_NV_float_buffer', 'WGL_NV_swap_group', 'wglJoinSwapGroupNV',
+'wglBindSwapBarrierNV', 'wglQuerySwapGroupNV', 'wglQueryMaxSwapGroupsNV',
+'wglQueryFrameCountNV', 'wglResetFrameCountNV', 'PFNWGLJOINSWAPGROUPNVPROC',
+'PFNWGLBINDSWAPBARRIERNVPROC', 'PFNWGLQUERYSWAPGROUPNVPROC',
+'PFNWGLQUERYMAXSWAPGROUPSNVPROC', 'PFNWGLQUERYFRAMECOUNTNVPROC',
+'PFNWGLRESETFRAMECOUNTNVPROC', 'WGL_NV_gpu_affinity', 'wglEnumGpusNV',
+'wglEnumGpuDevicesNV', 'wglCreateAffinityDCNV', 'wglEnumGpusFromAffinityDCNV',
+'wglDeleteDCNV']
+# END GENERATED CONTENT (do not edit above this line)
+
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/win32.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/win32.py
new file mode 100644
index 0000000000000000000000000000000000000000..2133d99bf3b14e24ade949bfc9e7d3adada2f203
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/win32.py
@@ -0,0 +1,255 @@
+from pyglet.canvas.win32 import Win32Canvas
+from .base import Config, CanvasConfig, Context
+
+from pyglet import gl
+from pyglet.gl import gl_info
+from pyglet.gl import wgl
+from pyglet.gl import wglext_arb
+from pyglet.gl import wgl_info
+
+from pyglet.libs.win32 import _user32, _kernel32, _gdi32
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+
+
+class Win32Config(Config):
+ def match(self, canvas):
+ if not isinstance(canvas, Win32Canvas):
+ raise RuntimeError('Canvas must be instance of Win32Canvas')
+
+ # Use ARB API if available
+ if gl_info.have_context() and wgl_info.have_extension('WGL_ARB_pixel_format'):
+ return self._get_arb_pixel_format_matching_configs(canvas)
+ else:
+ return self._get_pixel_format_descriptor_matching_configs(canvas)
+
+ def _get_pixel_format_descriptor_matching_configs(self, canvas):
+ """Get matching configs using standard PIXELFORMATDESCRIPTOR
+ technique."""
+ pfd = PIXELFORMATDESCRIPTOR()
+ pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR)
+ pfd.nVersion = 1
+ pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL
+
+ if self.double_buffer:
+ pfd.dwFlags |= PFD_DOUBLEBUFFER
+ else:
+ pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE
+
+ if self.stereo:
+ pfd.dwFlags |= PFD_STEREO
+ else:
+ pfd.dwFlags |= PFD_STEREO_DONTCARE
+
+ # Not supported in pyglet API
+ # if attributes.get('swap_copy', False):
+ # pfd.dwFlags |= PFD_SWAP_COPY
+ # if attributes.get('swap_exchange', False):
+ # pfd.dwFlags |= PFD_SWAP_EXCHANGE
+
+ if not self.depth_size:
+ pfd.dwFlags |= PFD_DEPTH_DONTCARE
+
+ pfd.iPixelType = PFD_TYPE_RGBA
+ pfd.cColorBits = self.buffer_size or 0
+ pfd.cRedBits = self.red_size or 0
+ pfd.cGreenBits = self.green_size or 0
+ pfd.cBlueBits = self.blue_size or 0
+ pfd.cAlphaBits = self.alpha_size or 0
+ pfd.cAccumRedBits = self.accum_red_size or 0
+ pfd.cAccumGreenBits = self.accum_green_size or 0
+ pfd.cAccumBlueBits = self.accum_blue_size or 0
+ pfd.cAccumAlphaBits = self.accum_alpha_size or 0
+ pfd.cDepthBits = self.depth_size or 0
+ pfd.cStencilBits = self.stencil_size or 0
+ pfd.cAuxBuffers = self.aux_buffers or 0
+
+ pf = _gdi32.ChoosePixelFormat(canvas.hdc, byref(pfd))
+ if pf:
+ return [Win32CanvasConfig(canvas, pf, self)]
+ else:
+ return []
+
+ def _get_arb_pixel_format_matching_configs(self, canvas):
+ """Get configs using the WGL_ARB_pixel_format extension.
+ This method assumes a (dummy) GL context is already created."""
+
+ # Check for required extensions
+ if self.sample_buffers or self.samples:
+ if not gl_info.have_extension('GL_ARB_multisample'):
+ return []
+
+ # Construct array of attributes
+ attrs = []
+ for name, value in self.get_gl_attributes():
+ attr = Win32CanvasConfigARB.attribute_ids.get(name, None)
+ if attr and value is not None:
+ attrs.extend([attr, int(value)])
+ attrs.append(0)
+ attrs = (c_int * len(attrs))(*attrs)
+
+ pformats = (c_int * 16)()
+ nformats = c_uint(16)
+ wglext_arb.wglChoosePixelFormatARB(canvas.hdc, attrs, None, nformats, pformats, nformats)
+
+ formats = [Win32CanvasConfigARB(canvas, pf, self) for pf in pformats[:nformats.value]]
+ return formats
+
+
+class Win32CanvasConfig(CanvasConfig):
+ def __init__(self, canvas, pf, config):
+ super(Win32CanvasConfig, self).__init__(canvas, config)
+ self._pf = pf
+ self._pfd = PIXELFORMATDESCRIPTOR()
+
+ _gdi32.DescribePixelFormat(canvas.hdc, pf, sizeof(PIXELFORMATDESCRIPTOR), byref(self._pfd))
+
+ self.double_buffer = bool(self._pfd.dwFlags & PFD_DOUBLEBUFFER)
+ self.sample_buffers = 0
+ self.samples = 0
+ self.stereo = bool(self._pfd.dwFlags & PFD_STEREO)
+ self.buffer_size = self._pfd.cColorBits
+ self.red_size = self._pfd.cRedBits
+ self.green_size = self._pfd.cGreenBits
+ self.blue_size = self._pfd.cBlueBits
+ self.alpha_size = self._pfd.cAlphaBits
+ self.accum_red_size = self._pfd.cAccumRedBits
+ self.accum_green_size = self._pfd.cAccumGreenBits
+ self.accum_blue_size = self._pfd.cAccumBlueBits
+ self.accum_alpha_size = self._pfd.cAccumAlphaBits
+ self.depth_size = self._pfd.cDepthBits
+ self.stencil_size = self._pfd.cStencilBits
+ self.aux_buffers = self._pfd.cAuxBuffers
+
+ def compatible(self, canvas):
+ # TODO more careful checking
+ return isinstance(canvas, Win32Canvas)
+
+ def create_context(self, share):
+ return Win32Context(self, share)
+
+ def _set_pixel_format(self, canvas):
+ _gdi32.SetPixelFormat(canvas.hdc, self._pf, byref(self._pfd))
+
+
+class Win32CanvasConfigARB(CanvasConfig):
+ attribute_ids = {
+ 'double_buffer': wglext_arb.WGL_DOUBLE_BUFFER_ARB,
+ 'stereo': wglext_arb.WGL_STEREO_ARB,
+ 'buffer_size': wglext_arb.WGL_COLOR_BITS_ARB,
+ 'aux_buffers': wglext_arb.WGL_AUX_BUFFERS_ARB,
+ 'sample_buffers': wglext_arb.WGL_SAMPLE_BUFFERS_ARB,
+ 'samples': wglext_arb.WGL_SAMPLES_ARB,
+ 'red_size': wglext_arb.WGL_RED_BITS_ARB,
+ 'green_size': wglext_arb.WGL_GREEN_BITS_ARB,
+ 'blue_size': wglext_arb.WGL_BLUE_BITS_ARB,
+ 'alpha_size': wglext_arb.WGL_ALPHA_BITS_ARB,
+ 'depth_size': wglext_arb.WGL_DEPTH_BITS_ARB,
+ 'stencil_size': wglext_arb.WGL_STENCIL_BITS_ARB,
+ 'accum_red_size': wglext_arb.WGL_ACCUM_RED_BITS_ARB,
+ 'accum_green_size': wglext_arb.WGL_ACCUM_GREEN_BITS_ARB,
+ 'accum_blue_size': wglext_arb.WGL_ACCUM_BLUE_BITS_ARB,
+ 'accum_alpha_size': wglext_arb.WGL_ACCUM_ALPHA_BITS_ARB,
+ }
+
+ def __init__(self, canvas, pf, config):
+ super(Win32CanvasConfigARB, self).__init__(canvas, config)
+ self._pf = pf
+
+ names = list(self.attribute_ids.keys())
+ attrs = list(self.attribute_ids.values())
+ attrs = (c_int * len(attrs))(*attrs)
+ values = (c_int * len(attrs))()
+
+ wglext_arb.wglGetPixelFormatAttribivARB(canvas.hdc, pf, 0, len(attrs), attrs, values)
+
+ for name, value in zip(names, values):
+ setattr(self, name, value)
+
+ def compatible(self, canvas):
+ # TODO more careful checking
+ return isinstance(canvas, Win32Canvas)
+
+ def create_context(self, share):
+ if wgl_info.have_extension('WGL_ARB_create_context'):
+ # Graphics adapters that ONLY support up to OpenGL 3.1/3.2
+ # should be using the Win32ARBContext class.
+ return Win32ARBContext(self, share)
+ else:
+ return Win32Context(self, share)
+
+ def _set_pixel_format(self, canvas):
+ _gdi32.SetPixelFormat(canvas.hdc, self._pf, None)
+
+
+class Win32Context(Context):
+ def __init__(self, config, share):
+ super(Win32Context, self).__init__(config, share)
+ self._context = None
+
+ def attach(self, canvas):
+ super(Win32Context, self).attach(canvas)
+
+ if not self._context:
+ self.config._set_pixel_format(canvas)
+ self._context = wgl.wglCreateContext(canvas.hdc)
+
+ share = self.context_share
+ if share:
+ if not share.canvas:
+ raise RuntimeError('Share context has no canvas.')
+ if not wgl.wglShareLists(share._context, self._context):
+ raise gl.ContextException('Unable to share contexts.')
+
+ def set_current(self):
+ if self._context is not None and self != gl.current_context:
+ wgl.wglMakeCurrent(self.canvas.hdc, self._context)
+ super(Win32Context, self).set_current()
+
+ def detach(self):
+ if self.canvas:
+ wgl.wglDeleteContext(self._context)
+ self._context = None
+ super(Win32Context, self).detach()
+
+ def flip(self):
+ _gdi32.SwapBuffers(self.canvas.hdc)
+
+ def get_vsync(self):
+ if wgl_info.have_extension('WGL_EXT_swap_control'):
+ return bool(wglext_arb.wglGetSwapIntervalEXT())
+
+ def set_vsync(self, vsync):
+ if wgl_info.have_extension('WGL_EXT_swap_control'):
+ wglext_arb.wglSwapIntervalEXT(int(vsync))
+
+
+class Win32ARBContext(Win32Context):
+ def __init__(self, config, share):
+ super(Win32ARBContext, self).__init__(config, share)
+
+ def attach(self, canvas):
+ share = self.context_share
+ if share:
+ if not share.canvas:
+ raise RuntimeError('Share context has no canvas.')
+ share = share._context
+
+ attribs = []
+ if self.config.major_version is not None:
+ attribs.extend([wglext_arb.WGL_CONTEXT_MAJOR_VERSION_ARB, self.config.major_version])
+ if self.config.minor_version is not None:
+ attribs.extend([wglext_arb.WGL_CONTEXT_MINOR_VERSION_ARB, self.config.minor_version])
+ flags = 0
+ if self.config.forward_compatible:
+ flags |= wglext_arb.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
+ if self.config.debug:
+ flags |= wglext_arb.WGL_DEBUG_BIT_ARB
+ if flags:
+ attribs.extend([wglext_arb.WGL_CONTEXT_FLAGS_ARB, flags])
+ attribs.append(0)
+ attribs = (c_int * len(attribs))(*attribs)
+
+ self.config._set_pixel_format(canvas)
+ self._context = wglext_arb.wglCreateContextAttribsARB(canvas.hdc, share, attribs)
+ super(Win32ARBContext, self).attach(canvas)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/xlib.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/xlib.py
new file mode 100644
index 0000000000000000000000000000000000000000..c2f4271fe0018cffafea600afbfa0127ed328288
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gl/xlib.py
@@ -0,0 +1,246 @@
+import warnings
+from ctypes import *
+
+from .base import Config, CanvasConfig, Context
+from pyglet.canvas.xlib import XlibCanvas
+from pyglet.gl import glx
+from pyglet.gl import glxext_arb
+from pyglet.gl import glx_info
+from pyglet.gl import glxext_mesa
+from pyglet.gl import lib
+from pyglet import gl
+
+
+class XlibConfig(Config):
+
+ def match(self, canvas):
+ if not isinstance(canvas, XlibCanvas):
+ raise RuntimeError('Canvas must be an instance of XlibCanvas')
+
+ x_display = canvas.display._display
+ x_screen = canvas.display.x_screen
+
+ info = glx_info.GLXInfo(x_display)
+
+ # Construct array of attributes
+ attrs = []
+ for name, value in self.get_gl_attributes():
+ attr = XlibCanvasConfig.attribute_ids.get(name, None)
+ if attr and value is not None:
+ attrs.extend([attr, int(value)])
+
+ attrs.extend([glx.GLX_X_RENDERABLE, True])
+ attrs.extend([0, 0]) # attrib_list must be null terminated
+
+ attrib_list = (c_int * len(attrs))(*attrs)
+
+ elements = c_int()
+ configs = glx.glXChooseFBConfig(x_display, x_screen, attrib_list, byref(elements))
+ if not configs:
+ return []
+
+ configs = cast(configs, POINTER(glx.GLXFBConfig * elements.value)).contents
+
+ result = [XlibCanvasConfig(canvas, info, c, self) for c in configs]
+
+ # Can't free array until all XlibGLConfig's are GC'd. Too much
+ # hassle, live with leak. XXX
+ # xlib.XFree(configs)
+
+ return result
+
+
+class XlibCanvasConfig(CanvasConfig):
+
+ attribute_ids = {
+ 'buffer_size': glx.GLX_BUFFER_SIZE,
+ 'level': glx.GLX_LEVEL, # Not supported
+ 'double_buffer': glx.GLX_DOUBLEBUFFER,
+ 'stereo': glx.GLX_STEREO,
+ 'aux_buffers': glx.GLX_AUX_BUFFERS,
+ 'red_size': glx.GLX_RED_SIZE,
+ 'green_size': glx.GLX_GREEN_SIZE,
+ 'blue_size': glx.GLX_BLUE_SIZE,
+ 'alpha_size': glx.GLX_ALPHA_SIZE,
+ 'depth_size': glx.GLX_DEPTH_SIZE,
+ 'stencil_size': glx.GLX_STENCIL_SIZE,
+ 'accum_red_size': glx.GLX_ACCUM_RED_SIZE,
+ 'accum_green_size': glx.GLX_ACCUM_GREEN_SIZE,
+ 'accum_blue_size': glx.GLX_ACCUM_BLUE_SIZE,
+ 'accum_alpha_size': glx.GLX_ACCUM_ALPHA_SIZE,
+
+ 'sample_buffers': glx.GLX_SAMPLE_BUFFERS,
+ 'samples': glx.GLX_SAMPLES,
+
+ # Not supported in current pyglet API:
+ 'render_type': glx.GLX_RENDER_TYPE,
+ 'config_caveat': glx.GLX_CONFIG_CAVEAT,
+ 'transparent_type': glx.GLX_TRANSPARENT_TYPE,
+ 'transparent_index_value': glx.GLX_TRANSPARENT_INDEX_VALUE,
+ 'transparent_red_value': glx.GLX_TRANSPARENT_RED_VALUE,
+ 'transparent_green_value': glx.GLX_TRANSPARENT_GREEN_VALUE,
+ 'transparent_blue_value': glx.GLX_TRANSPARENT_BLUE_VALUE,
+ 'transparent_alpha_value': glx.GLX_TRANSPARENT_ALPHA_VALUE,
+
+ # Used internally
+ 'x_renderable': glx.GLX_X_RENDERABLE,
+ }
+
+ def __init__(self, canvas, info, fbconfig, config):
+ super().__init__(canvas, config)
+
+ self.glx_info = info
+ self.fbconfig = fbconfig
+
+ for name, attr in self.attribute_ids.items():
+ value = c_int()
+ result = glx.glXGetFBConfigAttrib(canvas.display._display, self.fbconfig, attr, byref(value))
+ if result >= 0:
+ setattr(self, name, value.value)
+
+ def get_visual_info(self):
+ return glx.glXGetVisualFromFBConfig(self.canvas.display._display, self.fbconfig).contents
+
+ def create_context(self, share):
+ return XlibContext(self, share)
+
+ def compatible(self, canvas):
+ # TODO check more
+ return isinstance(canvas, XlibCanvas)
+
+ def _create_glx_context(self, share):
+ raise NotImplementedError('abstract')
+
+ def is_complete(self):
+ return True
+
+
+class XlibContext(Context):
+ def __init__(self, config, share):
+ super().__init__(config, share)
+
+ self.x_display = config.canvas.display._display
+
+ self.glx_context = self._create_glx_context(share)
+ if not self.glx_context:
+ # TODO: Check Xlib error generated
+ raise gl.ContextException('Could not create GL context')
+
+ self._have_SGI_video_sync = config.glx_info.have_extension('GLX_SGI_video_sync')
+ self._have_SGI_swap_control = config.glx_info.have_extension('GLX_SGI_swap_control')
+ self._have_EXT_swap_control = config.glx_info.have_extension('GLX_EXT_swap_control')
+ self._have_MESA_swap_control = config.glx_info.have_extension('GLX_MESA_swap_control')
+
+ # In order of preference:
+ # 1. GLX_EXT_swap_control (more likely to work where video_sync will not)
+ # 2. GLX_MESA_swap_control (same as above, but supported by MESA drivers)
+ # 3. GLX_SGI_video_sync (does not work on Intel 945GM, but that has EXT)
+ # 4. GLX_SGI_swap_control (cannot be disabled once enabled)
+ self._use_video_sync = (self._have_SGI_video_sync and
+ not (self._have_EXT_swap_control or self._have_MESA_swap_control))
+
+ # XXX Mandate that vsync defaults on across all platforms.
+ self._vsync = True
+
+ self.glx_window = None
+
+ def is_direct(self):
+ return glx.glXIsDirect(self.x_display, self.glx_context)
+
+ def _create_glx_context(self, share):
+ if share:
+ share_context = share.glx_context
+ else:
+ share_context = None
+
+ attribs = []
+ if self.config.major_version is not None:
+ attribs.extend([glxext_arb.GLX_CONTEXT_MAJOR_VERSION_ARB, self.config.major_version])
+ if self.config.minor_version is not None:
+ attribs.extend([glxext_arb.GLX_CONTEXT_MINOR_VERSION_ARB, self.config.minor_version])
+
+ if self.config.opengl_api == "gl":
+ attribs.extend([glxext_arb.GLX_CONTEXT_PROFILE_MASK_ARB, glxext_arb.GLX_CONTEXT_CORE_PROFILE_BIT_ARB])
+ elif self.config.opengl_api == "gles":
+ attribs.extend([glxext_arb.GLX_CONTEXT_PROFILE_MASK_ARB, glxext_arb.GLX_CONTEXT_ES2_PROFILE_BIT_EXT])
+
+ flags = 0
+ if self.config.forward_compatible:
+ flags |= glxext_arb.GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
+ if self.config.debug:
+ flags |= glxext_arb.GLX_CONTEXT_DEBUG_BIT_ARB
+
+ if flags:
+ attribs.extend([glxext_arb.GLX_CONTEXT_FLAGS_ARB, flags])
+ attribs.append(0)
+ attribs = (c_int * len(attribs))(*attribs)
+
+ return glxext_arb.glXCreateContextAttribsARB(self.config.canvas.display._display,
+ self.config.fbconfig, share_context, True, attribs)
+
+ def attach(self, canvas):
+ if canvas is self.canvas:
+ return
+
+ super().attach(canvas)
+
+ self.glx_window = glx.glXCreateWindow(self.x_display, self.config.fbconfig, canvas.x_window, None)
+ self.set_current()
+
+ def set_current(self):
+ glx.glXMakeContextCurrent(self.x_display, self.glx_window, self.glx_window, self.glx_context)
+ super().set_current()
+
+ def detach(self):
+ if not self.canvas:
+ return
+
+ self.set_current()
+ gl.glFlush()
+
+ super().detach()
+
+ glx.glXMakeContextCurrent(self.x_display, 0, 0, None)
+ if self.glx_window:
+ glx.glXDestroyWindow(self.x_display, self.glx_window)
+ self.glx_window = None
+
+ def destroy(self):
+ super().destroy()
+ if self.glx_window:
+ glx.glXDestroyWindow(self.config.display._display, self.glx_window)
+ self.glx_window = None
+ if self.glx_context:
+ glx.glXDestroyContext(self.x_display, self.glx_context)
+ self.glx_context = None
+
+ def set_vsync(self, vsync=True):
+ self._vsync = vsync
+ interval = vsync and 1 or 0
+ try:
+ if not self._use_video_sync and self._have_EXT_swap_control:
+ glxext_arb.glXSwapIntervalEXT(self.x_display, glx.glXGetCurrentDrawable(), interval)
+ elif not self._use_video_sync and self._have_MESA_swap_control:
+ glxext_mesa.glXSwapIntervalMESA(interval)
+ elif self._have_SGI_swap_control:
+ glxext_arb.glXSwapIntervalSGI(interval)
+ except lib.MissingFunctionException as e:
+ warnings.warn(str(e))
+
+ def get_vsync(self):
+ return self._vsync
+
+ def _wait_vsync(self):
+ if self._vsync and self._have_SGI_video_sync and self._use_video_sync:
+ count = c_uint()
+ glxext_arb.glXGetVideoSyncSGI(byref(count))
+ glxext_arb.glXWaitVideoSyncSGI(2, (count.value + 1) % 2, byref(count))
+
+ def flip(self):
+ if not self.glx_window:
+ return
+
+ if self._vsync:
+ self._wait_vsync()
+
+ glx.glXSwapBuffers(self.x_display, self.glx_window)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..972a126647d9a2e8d4dd936b7467f1ccd162170c
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/__init__.py
@@ -0,0 +1,638 @@
+"""Low-level graphics rendering and abstractions.
+
+This module provides efficient abstractions over OpenGL objects, such as
+Shaders and Buffers. It also provides classes for highly performant batched
+rendering and grouping.
+
+See the :ref:`guide_graphics` for details on how to use this graphics API.
+"""
+
+import ctypes
+import weakref
+
+import pyglet
+from pyglet.gl import *
+from pyglet.graphics import shader, vertexdomain
+from pyglet.graphics.vertexarray import VertexArray
+from pyglet.graphics.vertexbuffer import BufferObject
+
+_debug_graphics_batch = pyglet.options['debug_graphics_batch']
+
+
+def draw(size, mode, **data):
+ """Draw a primitive immediately.
+
+ :warning: This function is deprecated as of 2.0.4, and will be removed
+ in the next release.
+
+ :Parameters:
+ `size` : int
+ Number of vertices given
+ `mode` : gl primitive type
+ OpenGL drawing mode, e.g. ``GL_TRIANGLES``,
+ avoiding quotes.
+ `**data` : keyword arguments for passing vertex attribute data.
+ The keyword should be the vertex attribute name, and the
+ argument should be a tuple of (format, data). For example:
+ `position=('f', array)`
+
+ """
+ # Create and bind a throwaway VAO
+ vao_id = GLuint()
+ glGenVertexArrays(1, vao_id)
+ glBindVertexArray(vao_id)
+ # Activate shader program:
+ program = get_default_shader()
+ program.use()
+
+ buffers = []
+ for name, (fmt, array) in data.items():
+ location = program.attributes[name]['location']
+ count = program.attributes[name]['count']
+ gl_type = vertexdomain._gl_types[fmt[0]]
+ normalize = 'n' in fmt
+ attribute = shader.Attribute(name, location, count, gl_type, normalize)
+ assert size == len(array) // attribute.count, 'Data for %s is incorrect length' % fmt
+
+ buffer = BufferObject(size * attribute.stride)
+ attribute.set_region(buffer, 0, size, array)
+ attribute.enable()
+ attribute.set_pointer(buffer.ptr)
+
+ buffers.append(buffer) # Don't garbage collect it.
+
+ glDrawArrays(mode, 0, size)
+
+ # Deactivate shader program:
+ program.stop()
+ # Discard everything after drawing:
+ del buffers
+ glBindVertexArray(0)
+ glDeleteVertexArrays(1, vao_id)
+
+
+def draw_indexed(size, mode, indices, **data):
+ """Draw a primitive with indexed vertices immediately.
+
+ :warning: This function is deprecated as of 2.0.4, and will be removed
+ in the next release.
+
+ :Parameters:
+ `size` : int
+ Number of vertices given
+ `mode` : int
+ OpenGL drawing mode, e.g. ``GL_TRIANGLES``
+ `indices` : sequence of int
+ Sequence of integers giving indices into the vertex list.
+ `**data` : keyword arguments for passing vertex attribute data.
+ The keyword should be the vertex attribute name, and the
+ argument should be a tuple of (format, data). For example:
+ `position=('f', array)`
+
+ """
+ # Create and bind a throwaway VAO
+ vao_id = GLuint()
+ glGenVertexArrays(1, vao_id)
+ glBindVertexArray(vao_id)
+ # Activate shader program:
+ program = get_default_shader()
+ program.use()
+
+ buffers = []
+ for name, (fmt, array) in data.items():
+ location = program.attributes[name]['location']
+ count = program.attributes[name]['count']
+ gl_type = vertexdomain._gl_types[fmt[0]]
+ normalize = 'n' in fmt
+ attribute = shader.Attribute(name, location, count, gl_type, normalize)
+ assert size == len(array) // attribute.count, 'Data for %s is incorrect length' % fmt
+
+ buffer = BufferObject(size * attribute.stride)
+ attribute.set_region(buffer, 0, size, array)
+ attribute.enable()
+ attribute.set_pointer(buffer.ptr)
+ buffers.append(buffer)
+
+ if size <= 0xff:
+ index_type = GL_UNSIGNED_BYTE
+ index_c_type = ctypes.c_ubyte
+ elif size <= 0xffff:
+ index_type = GL_UNSIGNED_SHORT
+ index_c_type = ctypes.c_ushort
+ else:
+ index_type = GL_UNSIGNED_INT
+ index_c_type = ctypes.c_uint
+
+ # With GL 3.3 vertex arrays indices needs to be in a buffer
+ # bound to the ELEMENT_ARRAY slot
+ index_array = (index_c_type * len(indices))(*indices)
+ index_buffer = BufferObject(ctypes.sizeof(index_array))
+ index_buffer.set_data(index_array)
+ index_buffer.bind_to_index_buffer()
+
+ glDrawElements(mode, len(indices), index_type, 0)
+ glFlush()
+
+ # Deactivate shader program:
+ program.stop()
+ # Discard everything after drawing:
+ del buffers
+ del index_buffer
+ glBindVertexArray(0)
+ glDeleteVertexArrays(1, vao_id)
+
+
+# Default Shader source:
+
+_vertex_source = """#version 330 core
+ in vec3 position;
+ in vec4 colors;
+ in vec3 tex_coords;
+ out vec4 vertex_colors;
+ out vec3 texture_coords;
+
+ uniform WindowBlock
+ {
+ mat4 projection;
+ mat4 view;
+ } window;
+
+ void main()
+ {
+ gl_Position = window.projection * window.view * vec4(position, 1.0);
+
+ vertex_colors = colors;
+ texture_coords = tex_coords;
+ }
+"""
+
+_fragment_source = """#version 330 core
+ in vec4 vertex_colors;
+ in vec3 texture_coords;
+ out vec4 final_colors;
+
+ uniform sampler2D our_texture;
+
+ void main()
+ {
+ final_colors = texture(our_texture, texture_coords.xy) + vertex_colors;
+ }
+"""
+
+
+def get_default_batch():
+ try:
+ return pyglet.gl.current_context.pyglet_graphics_default_batch
+ except AttributeError:
+ pyglet.gl.current_context.pyglet_graphics_default_batch = Batch()
+ return pyglet.gl.current_context.pyglet_graphics_default_batch
+
+
+def get_default_group():
+ try:
+ return pyglet.gl.current_context.pyglet_graphics_default_group
+ except AttributeError:
+ pyglet.gl.current_context.pyglet_graphics_default_group = ShaderGroup(get_default_shader())
+ return pyglet.gl.current_context.pyglet_graphics_default_group
+
+
+def get_default_shader():
+ try:
+ return pyglet.gl.current_context.pyglet_graphics_default_shader
+ except AttributeError:
+ _default_vert_shader = pyglet.graphics.shader.Shader(_vertex_source, 'vertex')
+ _default_frag_shader = pyglet.graphics.shader.Shader(_fragment_source, 'fragment')
+ default_shader_program = pyglet.graphics.shader.ShaderProgram(_default_vert_shader, _default_frag_shader)
+ pyglet.gl.current_context.pyglet_graphics_default_shader = default_shader_program
+ return pyglet.gl.current_context.pyglet_graphics_default_shader
+
+
+class Batch:
+ """Manage a collection of drawables for batched rendering.
+
+ Many drawable pyglet objects accept an optional `Batch` argument in their
+ constructors. By giving a `Batch` to multiple objects, you can tell pyglet
+ that you expect to draw all of these objects at once, so it can optimise its
+ use of OpenGL. Hence, drawing a `Batch` is often much faster than drawing
+ each contained drawable separately.
+
+ The following example creates a batch, adds two sprites to the batch, and
+ then draws the entire batch::
+
+ batch = pyglet.graphics.Batch()
+ car = pyglet.sprite.Sprite(car_image, batch=batch)
+ boat = pyglet.sprite.Sprite(boat_image, batch=batch)
+
+ def on_draw():
+ batch.draw()
+
+ While any drawables can be added to a `Batch`, only those with the same
+ draw mode, shader program, and group can be optimised together.
+
+ Internally, a `Batch` manages a set of VertexDomains along with
+ information about how the domains are to be drawn. To implement batching on
+ a custom drawable, get your vertex domains from the given batch instead of
+ setting them up yourself.
+ """
+
+ def __init__(self):
+ """Create a graphics batch."""
+ # Mapping to find domain.
+ # group -> (attributes, mode, indexed) -> domain
+ self.group_map = {}
+
+ # Mapping of group to list of children.
+ self.group_children = {}
+
+ # List of top-level groups
+ self.top_groups = []
+
+ self._draw_list = []
+ self._draw_list_dirty = False
+
+ self._context = pyglet.gl.current_context
+
+ def invalidate(self):
+ """Force the batch to update the draw list.
+
+ This method can be used to force the batch to re-compute the draw list
+ when the ordering of groups has changed.
+
+ .. versionadded:: 1.2
+ """
+ self._draw_list_dirty = True
+
+ def migrate(self, vertex_list, mode, group, batch):
+ """Migrate a vertex list to another batch and/or group.
+
+ `vertex_list` and `mode` together identify the vertex list to migrate.
+ `group` and `batch` are new owners of the vertex list after migration.
+
+ The results are undefined if `mode` is not correct or if `vertex_list`
+ does not belong to this batch (they are not checked and will not
+ necessarily throw an exception immediately).
+
+ `batch` can remain unchanged if only a group change is desired.
+
+ :Parameters:
+ `vertex_list` : `~pyglet.graphics.vertexdomain.VertexList`
+ A vertex list currently belonging to this batch.
+ `mode` : int
+ The current GL drawing mode of the vertex list.
+ `group` : `~pyglet.graphics.Group`
+ The new group to migrate to.
+ `batch` : `~pyglet.graphics.Batch`
+ The batch to migrate to (or the current batch).
+
+ """
+ program = vertex_list.domain.program
+ attributes = vertex_list.domain.attribute_meta
+ if isinstance(vertex_list, vertexdomain.IndexedVertexList):
+ domain = batch.get_domain(True, mode, group, program, attributes)
+ else:
+ domain = batch.get_domain(False, mode, group, program, attributes)
+ vertex_list.migrate(domain)
+
+ def get_domain(self, indexed, mode, group, program, attributes):
+ """Get, or create, the vertex domain corresponding to the given arguments."""
+ if group is None:
+ group = ShaderGroup(program=program)
+
+ # Batch group
+ if group not in self.group_map:
+ self._add_group(group)
+
+ # Find domain given formats, indices and mode
+ domain_map = self.group_map[group]
+ key = (indexed, mode, program, str(attributes))
+ try:
+ domain = domain_map[key]
+ except KeyError:
+ # Create domain
+ if indexed:
+ domain = vertexdomain.IndexedVertexDomain(program, attributes)
+ else:
+ domain = vertexdomain.VertexDomain(program, attributes)
+ domain_map[key] = domain
+ self._draw_list_dirty = True
+
+ return domain
+
+ def _add_group(self, group):
+ self.group_map[group] = {}
+ if group.parent is None:
+ self.top_groups.append(group)
+ else:
+ if group.parent not in self.group_map:
+ self._add_group(group.parent)
+ if group.parent not in self.group_children:
+ self.group_children[group.parent] = []
+ self.group_children[group.parent].append(group)
+
+ group._assigned_batches.add(self)
+ self._draw_list_dirty = True
+
+ def _update_draw_list(self):
+ """Visit group tree in preorder and create a list of bound methods
+ to call.
+ """
+
+ def visit(group):
+ draw_list = []
+
+ # Draw domains using this group
+ domain_map = self.group_map[group]
+ for (formats, mode, indexed, program_id), domain in list(domain_map.items()):
+ # Remove unused domains from batch
+ if domain.is_empty:
+ del domain_map[(formats, mode, indexed, program_id)]
+ continue
+ draw_list.append((lambda d, m: lambda: d.draw(m))(domain, mode))
+
+ # Sort and visit child groups of this group
+ children = self.group_children.get(group)
+ if children:
+ children.sort()
+ for child in list(children):
+ if child.visible:
+ draw_list.extend(visit(child))
+
+ if children or domain_map:
+ return [group.set_state] + draw_list + [group.unset_state]
+ else:
+ # Remove unused group from batch
+ del self.group_map[group]
+ group._assigned_batches.remove(self)
+ if group.parent:
+ self.group_children[group.parent].remove(group)
+ try:
+ del self.group_children[group]
+ except KeyError:
+ pass
+ try:
+ self.top_groups.remove(group)
+ except ValueError:
+ pass
+
+ return []
+
+ self._draw_list = []
+
+ self.top_groups.sort()
+ for group in list(self.top_groups):
+ if group.visible:
+ self._draw_list.extend(visit(group))
+
+ self._draw_list_dirty = False
+
+ if _debug_graphics_batch:
+ self._dump_draw_list()
+
+ def _dump_draw_list(self):
+ def dump(group, indent=''):
+ print(indent, 'Begin group', group)
+ domain_map = self.group_map[group]
+ for _, domain in domain_map.items():
+ print(indent, ' ', domain)
+ for start, size in zip(*domain.allocator.get_allocated_regions()):
+ print(indent, ' ', 'Region %d size %d:' % (start, size))
+ for key, attribute in domain.attribute_names.items():
+ print(indent, ' ', end=' ')
+ try:
+ region = attribute.get_region(attribute.buffer, start, size)
+ print(key, region.array[:])
+ except:
+ print(key, '(unmappable)')
+ for child in self.group_children.get(group, ()):
+ dump(child, indent + ' ')
+ print(indent, 'End group', group)
+
+ print('Draw list for %r:' % self)
+ for group in self.top_groups:
+ dump(group)
+
+ def draw(self):
+ """Draw the batch."""
+
+ if self._draw_list_dirty:
+ self._update_draw_list()
+
+ for func in self._draw_list:
+ func()
+
+ def draw_subset(self, vertex_lists):
+ """Draw only some vertex lists in the batch.
+
+ The use of this method is highly discouraged, as it is quite
+ inefficient. Usually an application can be redesigned so that batches
+ can always be drawn in their entirety, using `draw`.
+
+ The given vertex lists must belong to this batch; behaviour is
+ undefined if this condition is not met.
+
+ :Parameters:
+ `vertex_lists` : sequence of `VertexList` or `IndexedVertexList`
+ Vertex lists to draw.
+
+ """
+
+ # Horrendously inefficient.
+ def visit(group):
+ group.set_state()
+
+ # Draw domains using this group
+ domain_map = self.group_map[group]
+ for (_, mode, _, _), domain in domain_map.items():
+ for alist in vertex_lists:
+ if alist.domain is domain:
+ alist.draw(mode)
+
+ # Sort and visit child groups of this group
+ children = self.group_children.get(group)
+ if children:
+ children.sort()
+ for child in children:
+ if child.visible:
+ visit(child)
+
+ group.unset_state()
+
+ self.top_groups.sort()
+ for group in self.top_groups:
+ if group.visible:
+ visit(group)
+
+
+class Group:
+ """Group of common OpenGL state.
+
+ `Group` provides extra control over how drawables are handled within a
+ `Batch`. When a batch draws a drawable, it ensures its group's state is set;
+ this can include binding textures, shaders, or setting any other parameters.
+ It also sorts the groups before drawing.
+
+ In the following example, the background sprite is guaranteed to be drawn
+ before the car and the boat::
+
+ batch = pyglet.graphics.Batch()
+ background = pyglet.graphics.Group(order=0)
+ foreground = pyglet.graphics.Group(order=1)
+
+ background = pyglet.sprite.Sprite(background_image, batch=batch, group=background)
+ car = pyglet.sprite.Sprite(car_image, batch=batch, group=foreground)
+ boat = pyglet.sprite.Sprite(boat_image, batch=batch, group=foreground)
+
+ def on_draw():
+ batch.draw()
+
+ :Parameters:
+ `order` : int
+ Set the order to render above or below other Groups.
+ Lower orders are drawn first.
+ `parent` : `~pyglet.graphics.Group`
+ Group to contain this Group; its state will be set before this
+ Group's state.
+
+ :Variables:
+ `visible` : bool
+ Determines whether this Group is visible in any of the Batches
+ it is assigned to. If ``False``, objects in this Group will not
+ be rendered.
+ `batches` : list
+ Read Only. A list of which Batches this Group is a part of.
+ """
+ def __init__(self, order=0, parent=None):
+
+ self._order = order
+ self.parent = parent
+ self._visible = True
+ self._assigned_batches = weakref.WeakSet()
+
+ @property
+ def order(self):
+ return self._order
+
+ @property
+ def visible(self):
+ return self._visible
+
+ @visible.setter
+ def visible(self, value):
+ self._visible = value
+
+ for batch in self._assigned_batches:
+ batch.invalidate()
+
+ @property
+ def batches(self):
+ return [batch for batch in self._assigned_batches]
+
+ def __lt__(self, other):
+ return self._order < other.order
+
+ def __eq__(self, other):
+ return (self.__class__ is other.__class__ and
+ self._order == other.order and
+ self.parent == other.parent)
+
+ def __hash__(self):
+ return hash((self._order, self.parent))
+
+ def __repr__(self):
+ return "{}(order={})".format(self.__class__.__name__, self._order)
+
+ def set_state(self):
+ """Apply the OpenGL state change.
+
+ The default implementation does nothing."""
+ pass
+
+ def unset_state(self):
+ """Repeal the OpenGL state change.
+
+ The default implementation does nothing."""
+ pass
+
+ def set_state_recursive(self):
+ """Set this group and its ancestry.
+
+ Call this method if you are using a group in isolation: the
+ parent groups will be called in top-down order, with this class's
+ `set` being called last.
+ """
+ if self.parent:
+ self.parent.set_state_recursive()
+ self.set_state()
+
+ def unset_state_recursive(self):
+ """Unset this group and its ancestry.
+
+ The inverse of `set_state_recursive`.
+ """
+ self.unset_state()
+ if self.parent:
+ self.parent.unset_state_recursive()
+
+
+# Example Groups.
+
+class ShaderGroup(Group):
+ """A group that enables and binds a ShaderProgram.
+ """
+
+ def __init__(self, program, order=0, parent=None):
+ super().__init__(order, parent)
+ self.program = program
+
+ def set_state(self):
+ self.program.use()
+
+ def unset_state(self):
+ self.program.stop()
+
+ def __eq__(self, other):
+ return (self.__class__ is other.__class__ and
+ self._order == other.order and
+ self.program == other.program and
+ self.parent == other.parent)
+
+ def __hash__(self):
+ return hash((self._order, self.parent, self.program))
+
+
+class TextureGroup(Group):
+ """A group that enables and binds a texture.
+
+ TextureGroups are equal if their textures' targets and names are equal.
+ """
+
+ def __init__(self, texture, order=0, parent=None):
+ """Create a texture group.
+
+ :Parameters:
+ `texture` : `~pyglet.image.Texture`
+ Texture to bind.
+ `order` : int
+ Change the order to render above or below other Groups.
+ `parent` : `~pyglet.graphics.Group`
+ Parent group.
+ """
+ super().__init__(order, parent)
+ self.texture = texture
+
+ def set_state(self):
+ glActiveTexture(GL_TEXTURE0)
+ glBindTexture(self.texture.target, self.texture.id)
+
+ def __hash__(self):
+ return hash((self.texture.target, self.texture.id, self.order, self.parent))
+
+ def __eq__(self, other):
+ return (self.__class__ is other.__class__ and
+ self.texture.target == other.texture.target and
+ self.texture.id == other.texture.id and
+ self.order == other.order and
+ self.parent == other.parent)
+
+ def __repr__(self):
+ return '%s(id=%d)' % (self.__class__.__name__, self.texture.id)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/allocation.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/allocation.py
new file mode 100644
index 0000000000000000000000000000000000000000..39b8965ae33abb99bbdb100409da041d72608556
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/allocation.py
@@ -0,0 +1,365 @@
+"""Memory allocation algorithm for vertex arrays and buffers.
+
+The region allocator is used to allocate vertex indices within a vertex
+domain's multiple buffers. ("Buffer" refers to any abstract buffer presented
+by :py:mod:`pyglet.graphics.vertexbuffer`.
+
+The allocator will at times request more space from the buffers. The current
+policy is to double the buffer size when there is not enough room to fulfil an
+allocation. The buffer is never resized smaller.
+
+The allocator maintains references to free space only; it is the caller's
+responsibility to maintain the allocated regions.
+"""
+
+# Common cases:
+# -regions will be the same size (instances of same object, e.g. sprites)
+# -regions will not usually be resized (only exception is text)
+# -alignment of 4 vertices (glyphs, sprites, images, ...)
+#
+# Optimise for:
+# -keeping regions adjacent, reduce the number of entries in glMultiDrawArrays
+# -finding large blocks of allocated regions quickly (for drawing)
+# -finding block of unallocated space is the _uncommon_ case!
+#
+# Decisions:
+# -don't over-allocate regions to any alignment -- this would require more
+# work in finding the allocated spaces (for drawing) and would result in
+# more entries in glMultiDrawArrays
+# -don't move blocks when they truncate themselves. try not to allocate the
+# space they freed too soon (they will likely need grow back into it later,
+# and growing will usually require a reallocation).
+# -allocator does not track individual allocated regions. Trusts caller
+# to provide accurate (start, size) tuple, which completely describes
+# a region from the allocator's point of view.
+# -this means that compacting is probably not feasible, or would be hideously
+# expensive
+
+
+class AllocatorMemoryException(Exception):
+ """The buffer is not large enough to fulfil an allocation.
+
+ Raised by `Allocator` methods when the operation failed due to
+ lack of buffer space. The buffer should be increased to at least
+ requested_capacity and then the operation retried (guaranteed to
+ pass second time).
+ """
+
+ def __init__(self, requested_capacity):
+ self.requested_capacity = requested_capacity
+
+
+class Allocator:
+ """Buffer space allocation implementation."""
+
+ __slots__ = 'capacity', 'starts', 'sizes'
+
+ def __init__(self, capacity):
+ """Create an allocator for a buffer of the specified capacity.
+
+ :Parameters:
+ `capacity` : int
+ Maximum size of the buffer.
+
+ """
+ self.capacity = capacity
+
+ # Allocated blocks. Start index and size in parallel lists.
+ #
+ # # = allocated, - = free
+ #
+ # 0 3 5 15 20 24 40
+ # |###--##########-----####----------------------|
+ #
+ # starts = [0, 5, 20]
+ # sizes = [3, 10, 4]
+ #
+ # To calculate free blocks:
+ # for i in range(0, len(starts)):
+ # free_start[i] = starts[i] + sizes[i]
+ # free_size[i] = starts[i+1] - free_start[i]
+ # free_size[i+1] = self.capacity - free_start[-1]
+
+ self.starts = []
+ self.sizes = []
+
+ def set_capacity(self, size):
+ """Resize the maximum buffer size.
+
+ The capaity cannot be reduced.
+
+ :Parameters:
+ `size` : int
+ New maximum size of the buffer.
+
+ """
+ assert size > self.capacity
+ self.capacity = size
+
+ def alloc(self, size):
+ """Allocate memory in the buffer.
+
+ Raises `AllocatorMemoryException` if the allocation cannot be
+ fulfilled.
+
+ :Parameters:
+ `size` : int
+ Size of region to allocate.
+
+ :rtype: int
+ :return: Starting index of the allocated region.
+ """
+ assert size >= 0
+
+ if size == 0:
+ return 0
+
+ # Return start, or raise AllocatorMemoryException
+ if not self.starts:
+ if size <= self.capacity:
+ self.starts.append(0)
+ self.sizes.append(size)
+ return 0
+ else:
+ raise AllocatorMemoryException(size)
+
+ # Restart from zero if space exists
+ if self.starts[0] > size:
+ self.starts.insert(0, 0)
+ self.sizes.insert(0, size)
+ return 0
+
+ # Allocate in a free space
+ free_start = self.starts[0] + self.sizes[0]
+ for i, (alloc_start, alloc_size) in enumerate(zip(self.starts[1:], self.sizes[1:])):
+ # Danger!
+ # i is actually index - 1 because of slicing above...
+ # starts[i] points to the block before this free space
+ # starts[i+1] points to the block after this free space, and is always valid.
+ free_size = alloc_start - free_start
+ if free_size == size:
+ # Merge previous block with this one (removing this free space)
+ self.sizes[i] += free_size + alloc_size
+ del self.starts[i+1]
+ del self.sizes[i+1]
+ return free_start
+ elif free_size > size:
+ # Increase size of previous block to intrude into this free
+ # space.
+ self.sizes[i] += size
+ return free_start
+ free_start = alloc_start + alloc_size
+
+ # Allocate at end of capacity
+ free_size = self.capacity - free_start
+ if free_size >= size:
+ self.sizes[-1] += size
+ return free_start
+
+ raise AllocatorMemoryException(self.capacity + size - free_size)
+
+ def realloc(self, start, size, new_size):
+ """Reallocate a region of the buffer.
+
+ This is more efficient than separate `dealloc` and `alloc` calls, as
+ the region can often be resized in-place.
+
+ Raises `AllocatorMemoryException` if the allocation cannot be
+ fulfilled.
+
+ :Parameters:
+ `start` : int
+ Current starting index of the region.
+ `size` : int
+ Current size of the region.
+ `new_size` : int
+ New size of the region.
+
+ """
+ assert size >= 0 and new_size >= 0
+
+ if new_size == 0:
+ if size != 0:
+ self.dealloc(start, size)
+ return 0
+ elif size == 0:
+ return self.alloc(new_size)
+
+ # return start, or raise AllocatorMemoryException
+
+ # Truncation is the same as deallocating the tail cruft
+ if new_size < size:
+ self.dealloc(start + new_size, size - new_size)
+ return start
+
+ # Find which block it lives in
+ for i, (alloc_start, alloc_size) in enumerate(zip(*(self.starts, self.sizes))):
+ p = start - alloc_start
+ if p >= 0 and size <= alloc_size - p:
+ break
+ if not (p >= 0 and size <= alloc_size - p):
+ print(list(zip(self.starts, self.sizes)))
+ print(start, size, new_size)
+ print(p, alloc_start, alloc_size)
+ assert p >= 0 and size <= alloc_size - p, 'Region not allocated'
+
+ if size == alloc_size - p:
+ # Region is at end of block. Find how much free space is after it.
+ is_final_block = i == len(self.starts) - 1
+ if not is_final_block:
+ free_size = self.starts[i + 1] - (start + size)
+ else:
+ free_size = self.capacity - (start + size)
+
+ # TODO If region is an entire block being an island in free space,
+ # can possibly extend in both directions.
+
+ if free_size == new_size - size and not is_final_block:
+ # Merge block with next (region is expanded in place to
+ # exactly fill the free space)
+ self.sizes[i] += free_size + self.sizes[i + 1]
+ del self.starts[i + 1]
+ del self.sizes[i + 1]
+ return start
+ elif free_size > new_size - size:
+ # Expand region in place
+ self.sizes[i] += new_size - size
+ return start
+
+ # The block must be repositioned. Dealloc then alloc.
+
+ # But don't do this! If alloc fails, we've already silently dealloc'd
+ # the original block.
+ # self.dealloc(start, size)
+ # return self.alloc(new_size)
+
+ # It must be alloc'd first. We're not missing an optimisation
+ # here, because if freeing the block would've allowed for the block to
+ # be placed in the resulting free space, one of the above in-place
+ # checks would've found it.
+ result = self.alloc(new_size)
+ self.dealloc(start, size)
+ return result
+
+ def dealloc(self, start, size):
+ """Free a region of the buffer.
+
+ :Parameters:
+ `start` : int
+ Starting index of the region.
+ `size` : int
+ Size of the region.
+
+ """
+ assert size >= 0
+
+ if size == 0:
+ return
+
+ assert self.starts
+
+ # Find which block needs to be split
+ for i, (alloc_start, alloc_size) in enumerate(zip(*(self.starts, self.sizes))):
+ p = start - alloc_start
+ if p >= 0 and size <= alloc_size - p:
+ break
+
+ # Assert we left via the break
+ assert p >= 0 and size <= alloc_size - p, 'Region not allocated'
+
+ if p == 0 and size == alloc_size:
+ # Remove entire block
+ del self.starts[i]
+ del self.sizes[i]
+ elif p == 0:
+ # Truncate beginning of block
+ self.starts[i] += size
+ self.sizes[i] -= size
+ elif size == alloc_size - p:
+ # Truncate end of block
+ self.sizes[i] -= size
+ else:
+ # Reduce size of left side, insert block at right side
+ # $ = dealloc'd block, # = alloc'd region from same block
+ #
+ # <------8------>
+ # <-5-><-6-><-7->
+ # 1 2 3 4
+ # #####$$$$$#####
+ #
+ # 1 = alloc_start
+ # 2 = start
+ # 3 = start + size
+ # 4 = alloc_start + alloc_size
+ # 5 = start - alloc_start = p
+ # 6 = size
+ # 7 = {8} - ({5} + {6}) = alloc_size - (p + size)
+ # 8 = alloc_size
+ #
+ self.sizes[i] = p
+ self.starts.insert(i + 1, start + size)
+ self.sizes.insert(i + 1, alloc_size - (p + size))
+
+ def get_allocated_regions(self):
+ """Get a list of (aggregate) allocated regions.
+
+ The result of this method is ``(starts, sizes)``, where ``starts`` is
+ a list of starting indices of the regions and ``sizes`` their
+ corresponding lengths.
+
+ :rtype: (list, list)
+ """
+ # return (starts, sizes); len(starts) == len(sizes)
+ return self.starts, self.sizes
+
+ def get_fragmented_free_size(self):
+ """Returns the amount of space unused, not including the final
+ free block.
+
+ :rtype: int
+ """
+ if not self.starts:
+ return 0
+
+ # Variation of search for free block.
+ total_free = 0
+ free_start = self.starts[0] + self.sizes[0]
+ for i, (alloc_start, alloc_size) in enumerate(zip(self.starts[1:], self.sizes[1:])):
+ total_free += alloc_start - free_start
+ free_start = alloc_start + alloc_size
+
+ return total_free
+
+ def get_free_size(self):
+ """Return the amount of space unused.
+
+ :rtype: int
+ """
+ if not self.starts:
+ return self.capacity
+
+ free_end = self.capacity - (self.starts[-1] + self.sizes[-1])
+ return self.get_fragmented_free_size() + free_end
+
+ def get_usage(self):
+ """Return fraction of capacity currently allocated.
+
+ :rtype: float
+ """
+ return 1. - self.get_free_size() / float(self.capacity)
+
+ def get_fragmentation(self):
+ """Return fraction of free space that is not expandable.
+
+ :rtype: float
+ """
+ free_size = self.get_free_size()
+ if free_size == 0:
+ return 0.
+ return self.get_fragmented_free_size() / float(self.get_free_size())
+
+ def __str__(self):
+ return 'allocs=' + repr(list(zip(self.starts, self.sizes)))
+
+ def __repr__(self):
+ return '<%s %s>' % (self.__class__.__name__, str(self))
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/shader.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/shader.py
new file mode 100644
index 0000000000000000000000000000000000000000..f14d0f638492577cb3cf856e7cb84fd38f7ea0b5
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/shader.py
@@ -0,0 +1,1020 @@
+from ctypes import *
+from weakref import proxy
+
+import pyglet
+
+from pyglet.gl import *
+from pyglet.graphics.vertexbuffer import BufferObject
+
+
+_debug_gl_shaders = pyglet.options['debug_gl_shaders']
+
+
+class ShaderException(BaseException):
+ pass
+
+
+_c_types = {
+ GL_BYTE: c_byte,
+ GL_UNSIGNED_BYTE: c_ubyte,
+ GL_SHORT: c_short,
+ GL_UNSIGNED_SHORT: c_ushort,
+ GL_INT: c_int,
+ GL_UNSIGNED_INT: c_uint,
+ GL_FLOAT: c_float,
+ GL_DOUBLE: c_double,
+}
+
+_shader_types = {
+ 'compute': GL_COMPUTE_SHADER,
+ 'fragment': GL_FRAGMENT_SHADER,
+ 'geometry': GL_GEOMETRY_SHADER,
+ 'tesscontrol': GL_TESS_CONTROL_SHADER,
+ 'tessevaluation': GL_TESS_EVALUATION_SHADER,
+ 'vertex': GL_VERTEX_SHADER,
+}
+
+_uniform_getters = {
+ GLint: glGetUniformiv,
+ GLfloat: glGetUniformfv,
+ GLboolean: glGetUniformiv,
+}
+
+_uniform_setters = {
+ # uniform: gl_type, legacy_setter, setter, length, count
+ GL_BOOL: (GLint, glUniform1iv, glProgramUniform1iv, 1, 1),
+ GL_BOOL_VEC2: (GLint, glUniform1iv, glProgramUniform1iv, 2, 1),
+ GL_BOOL_VEC3: (GLint, glUniform1iv, glProgramUniform1iv, 3, 1),
+ GL_BOOL_VEC4: (GLint, glUniform1iv, glProgramUniform1iv, 4, 1),
+
+ GL_INT: (GLint, glUniform1iv, glProgramUniform1iv, 1, 1),
+ GL_INT_VEC2: (GLint, glUniform2iv, glProgramUniform2iv, 2, 1),
+ GL_INT_VEC3: (GLint, glUniform3iv, glProgramUniform3iv, 3, 1),
+ GL_INT_VEC4: (GLint, glUniform4iv, glProgramUniform4iv, 4, 1),
+
+ GL_FLOAT: (GLfloat, glUniform1fv, glProgramUniform1fv, 1, 1),
+ GL_FLOAT_VEC2: (GLfloat, glUniform2fv, glProgramUniform2fv, 2, 1),
+ GL_FLOAT_VEC3: (GLfloat, glUniform3fv, glProgramUniform3fv, 3, 1),
+ GL_FLOAT_VEC4: (GLfloat, glUniform4fv, glProgramUniform4fv, 4, 1),
+
+ GL_SAMPLER_1D: (GLint, glUniform1iv, glProgramUniform1iv, 1, 1),
+ GL_SAMPLER_2D: (GLint, glUniform1iv, glProgramUniform1iv, 1, 1),
+ GL_SAMPLER_2D_ARRAY: (GLint, glUniform1iv, glProgramUniform1iv, 1, 1),
+
+ GL_SAMPLER_3D: (GLint, glUniform1iv, glProgramUniform1iv, 1, 1),
+
+ GL_FLOAT_MAT2: (GLfloat, glUniformMatrix2fv, glProgramUniformMatrix2fv, 4, 1),
+ GL_FLOAT_MAT3: (GLfloat, glUniformMatrix3fv, glProgramUniformMatrix3fv, 6, 1),
+ GL_FLOAT_MAT4: (GLfloat, glUniformMatrix4fv, glProgramUniformMatrix4fv, 16, 1),
+
+ # TODO: test/implement these:
+ # GL_FLOAT_MAT2x3: glUniformMatrix2x3fv, glProgramUniformMatrix2x3fv,
+ # GL_FLOAT_MAT2x4: glUniformMatrix2x4fv, glProgramUniformMatrix2x4fv,
+ # GL_FLOAT_MAT3x2: glUniformMatrix3x2fv, glProgramUniformMatrix3x2fv,
+ # GL_FLOAT_MAT3x4: glUniformMatrix3x4fv, glProgramUniformMatrix3x4fv,
+ # GL_FLOAT_MAT4x2: glUniformMatrix4x2fv, glProgramUniformMatrix4x2fv,
+ # GL_FLOAT_MAT4x3: glUniformMatrix4x3fv, glProgramUniformMatrix4x3fv,
+
+ GL_IMAGE_1D: (GLint, glUniform1iv, glProgramUniform1iv, 1, 1),
+ GL_IMAGE_2D: (GLint, glUniform1iv, glProgramUniform1iv, 2, 1),
+ GL_IMAGE_2D_RECT: (GLint, glUniform1iv, glProgramUniform1iv, 3, 1),
+ GL_IMAGE_3D: (GLint, glUniform1iv, glProgramUniform1iv, 3, 1),
+
+ GL_IMAGE_1D_ARRAY: (GLint, glUniform1iv, glProgramUniform1iv, 2, 1),
+ GL_IMAGE_2D_ARRAY: (GLint, glUniform1iv, glProgramUniform1iv, 3, 1),
+
+ GL_IMAGE_2D_MULTISAMPLE: (GLint, glUniform1iv, glProgramUniform1iv, 2, 1),
+ GL_IMAGE_2D_MULTISAMPLE_ARRAY: (GLint, glUniform1iv, glProgramUniform1iv, 3, 1),
+
+ GL_IMAGE_BUFFER: (GLint, glUniform1iv, glProgramUniform1iv, 3, 1),
+ GL_IMAGE_CUBE: (GLint, glUniform1iv, glProgramUniform1iv, 1, 1),
+ GL_IMAGE_CUBE_MAP_ARRAY: (GLint, glUniform1iv, glProgramUniform1iv, 3, 1),
+}
+
+_attribute_types = {
+ GL_BOOL: (1, '?'),
+ GL_BOOL_VEC2: (2, '?'),
+ GL_BOOL_VEC3: (3, '?'),
+ GL_BOOL_VEC4: (4, '?'),
+
+ GL_INT: (1, 'i'),
+ GL_INT_VEC2: (2, 'i'),
+ GL_INT_VEC3: (3, 'i'),
+ GL_INT_VEC4: (4, 'i'),
+
+ GL_UNSIGNED_INT: (1, 'I'),
+ GL_UNSIGNED_INT_VEC2: (2, 'I'),
+ GL_UNSIGNED_INT_VEC3: (3, 'I'),
+ GL_UNSIGNED_INT_VEC4: (4, 'I'),
+
+ GL_FLOAT: (1, 'f'),
+ GL_FLOAT_VEC2: (2, 'f'),
+ GL_FLOAT_VEC3: (3, 'f'),
+ GL_FLOAT_VEC4: (4, 'f'),
+
+ GL_DOUBLE: (1, 'd'),
+ GL_DOUBLE_VEC2: (2, 'd'),
+ GL_DOUBLE_VEC3: (3, 'd'),
+ GL_DOUBLE_VEC4: (4, 'd'),
+}
+
+
+# Accessor classes:
+
+class Attribute:
+ """Abstract accessor for an attribute in a mapped buffer."""
+
+ def __init__(self, name, location, count, gl_type, normalize):
+ """Create the attribute accessor.
+
+ :Parameters:
+ `name` : str
+ Name of the vertex attribute.
+ `location` : int
+ Location (index) of the vertex attribute.
+ `count` : int
+ Number of components in the attribute.
+ `gl_type` : int
+ OpenGL type enumerant; for example, ``GL_FLOAT``
+ `normalize`: bool
+ True if OpenGL should normalize the values
+
+ """
+ self.name = name
+ self.location = location
+ self.count = count
+
+ self.gl_type = gl_type
+ self.c_type = _c_types[gl_type]
+ self.normalize = normalize
+
+ self.align = sizeof(self.c_type)
+ self.size = count * self.align
+ self.stride = self.size
+
+ def enable(self):
+ """Enable the attribute."""
+ glEnableVertexAttribArray(self.location)
+
+ def set_pointer(self, ptr):
+ """Setup this attribute to point to the currently bound buffer at
+ the given offset.
+
+ ``offset`` should be based on the currently bound buffer's ``ptr``
+ member.
+
+ :Parameters:
+ `offset` : int
+ Pointer offset to the currently bound buffer for this
+ attribute.
+
+ """
+ glVertexAttribPointer(self.location, self.count, self.gl_type, self.normalize, self.stride, ptr)
+
+ def get_region(self, buffer, start, count):
+ """Map a buffer region using this attribute as an accessor.
+
+ The returned region consists of a contiguous array of component
+ data elements. For example, if this attribute uses 3 floats per
+ vertex, and the `count` parameter is 4, the number of floats mapped
+ will be ``3 * 4 = 12``.
+
+ :Parameters:
+ `buffer` : `AbstractMappable`
+ The buffer to map.
+ `start` : int
+ Offset of the first vertex to map.
+ `count` : int
+ Number of vertices to map
+
+ :rtype: `AbstractBufferRegion`
+ """
+ byte_start = self.stride * start
+ byte_size = self.stride * count
+ array_count = self.count * count
+ ptr_type = POINTER(self.c_type * array_count)
+ return buffer.get_region(byte_start, byte_size, ptr_type)
+
+ def set_region(self, buffer, start, count, data):
+ """Set the data over a region of the buffer.
+
+ :Parameters:
+ `buffer` : AbstractMappable`
+ The buffer to modify.
+ `start` : int
+ Offset of the first vertex to set.
+ `count` : int
+ Number of vertices to set.
+ `data` : A sequence of data components.
+ """
+ byte_start = self.stride * start
+ byte_size = self.stride * count
+ array_count = self.count * count
+ data = (self.c_type * array_count)(*data)
+ buffer.set_data_region(data, byte_start, byte_size)
+
+ def __repr__(self):
+ return f"Attribute(name='{self.name}', location={self.location}, count={self.count})"
+
+
+class _Uniform:
+ __slots__ = 'program', 'name', 'type', 'location', 'length', 'count', 'get', 'set'
+
+ def __init__(self, program, name, uniform_type, location, dsa):
+ self.program = program
+ self.name = name
+ self.type = uniform_type
+ self.location = location
+
+ gl_type, gl_setter_legacy, gl_setter_dsa, length, count = _uniform_setters[uniform_type]
+ gl_setter = gl_setter_dsa if dsa else gl_setter_legacy
+ gl_getter = _uniform_getters[gl_type]
+
+ self.length = length
+ self.count = count
+
+ is_matrix = uniform_type in (GL_FLOAT_MAT2, GL_FLOAT_MAT2x3, GL_FLOAT_MAT2x4,
+ GL_FLOAT_MAT3, GL_FLOAT_MAT3x2, GL_FLOAT_MAT3x4,
+ GL_FLOAT_MAT4, GL_FLOAT_MAT4x2, GL_FLOAT_MAT4x3)
+
+ c_array = (gl_type * length)()
+ ptr = cast(c_array, POINTER(gl_type))
+
+ self.get = self._create_getter_func(program, location, gl_getter, c_array, length)
+ self.set = self._create_setter_func(program, location, gl_setter, c_array, length, count, ptr, is_matrix, dsa)
+
+ @staticmethod
+ def _create_getter_func(program, location, gl_getter, c_array, length):
+ """Factory function for creating simplified Uniform getters"""
+
+ if length == 1:
+ def getter_func():
+ gl_getter(program, location, c_array)
+ return c_array[0]
+ else:
+ def getter_func():
+ gl_getter(program, location, c_array)
+ return c_array[:]
+
+ return getter_func
+
+ @staticmethod
+ def _create_setter_func(program, location, gl_setter, c_array, length, count, ptr, is_matrix, dsa):
+ """Factory function for creating simplified Uniform setters"""
+ if dsa: # Bindless updates:
+
+ if is_matrix:
+ def setter_func(value):
+ c_array[:] = value
+ gl_setter(program, location, count, GL_FALSE, ptr)
+ elif length == 1 and count == 1:
+ def setter_func(value):
+ c_array[0] = value
+ gl_setter(program, location, count, ptr)
+ elif length > 1 and count == 1:
+ def setter_func(values):
+ c_array[:] = values
+ gl_setter(program, location, count, ptr)
+ else:
+ raise ShaderException("Uniform type not yet supported.")
+
+ return setter_func
+
+ else:
+
+ if is_matrix:
+ def setter_func(value):
+ glUseProgram(program)
+ c_array[:] = value
+ gl_setter(location, count, GL_FALSE, ptr)
+ elif length == 1 and count == 1:
+ def setter_func(value):
+ glUseProgram(program)
+ c_array[0] = value
+ gl_setter(location, count, ptr)
+ elif length > 1 and count == 1:
+ def setter_func(values):
+ glUseProgram(program)
+ c_array[:] = values
+ gl_setter(location, count, ptr)
+ else:
+ raise ShaderException("Uniform type not yet supported.")
+
+ return setter_func
+
+ def __repr__(self):
+ return f"Uniform('{self.name}', location={self.location}, length={self.length}, count={self.count})"
+
+
+class UniformBlock:
+ __slots__ = 'program', 'name', 'index', 'size', 'uniforms', 'view_cls'
+
+ def __init__(self, program, name, index, size, uniforms):
+ self.program = proxy(program)
+ self.name = name
+ self.index = index
+ self.size = size
+ self.uniforms = uniforms
+ self.view_cls = None
+
+ def create_ubo(self, index=0):
+ """
+ Create a new UniformBufferObject from this uniform block.
+
+ :Parameters:
+ `index` : int
+ The uniform buffer index the returned UBO will bind itself to.
+ By default, this is 0.
+
+ :rtype: :py:class:`~pyglet.graphics.shader.UniformBufferObject`
+ """
+ if self.view_cls is None:
+ self.view_cls = self._introspect_uniforms()
+ return UniformBufferObject(self.view_cls, self.size, index)
+
+ def _introspect_uniforms(self):
+ """Introspect the block's structure and return a ctypes struct for
+ manipulating the uniform block's members.
+ """
+ p_id = self.program.id
+ index = self.index
+
+ active_count = len(self.uniforms)
+
+ # Query the uniform index order and each uniform's offset:
+ indices = (GLuint * active_count)()
+ offsets = (GLint * active_count)()
+ indices_ptr = cast(addressof(indices), POINTER(GLint))
+ offsets_ptr = cast(addressof(offsets), POINTER(GLint))
+ glGetActiveUniformBlockiv(p_id, index, GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, indices_ptr)
+ glGetActiveUniformsiv(p_id, active_count, indices, GL_UNIFORM_OFFSET, offsets_ptr)
+
+ # Offsets may be returned in non-ascending order, sort them with the corresponding index:
+ _oi = sorted(zip(offsets, indices), key=lambda x: x[0])
+ offsets = [x[0] for x in _oi] + [self.size]
+ indices = (GLuint * active_count)(*(x[1] for x in _oi))
+
+ # # Query other uniform information:
+ # gl_types = (GLint * active_count)()
+ # mat_stride = (GLint * active_count)()
+ # gl_types_ptr = cast(addressof(gl_types), POINTER(GLint))
+ # stride_ptr = cast(addressof(mat_stride), POINTER(GLint))
+ # glGetActiveUniformsiv(p_id, active_count, indices, GL_UNIFORM_TYPE, gl_types_ptr)
+ # glGetActiveUniformsiv(p_id, active_count, indices, GL_UNIFORM_MATRIX_STRIDE, stride_ptr)
+
+ view_fields = []
+ for i in range(active_count):
+ u_name, gl_type, length = self.uniforms[indices[i]]
+ size = offsets[i+1] - offsets[i]
+ c_type_size = sizeof(gl_type)
+ actual_size = c_type_size * length
+ padding = size - actual_size
+
+ # TODO: handle stride for multiple matrixes in the same UBO (crashes now)
+ # m_stride = mat_stride[i]
+
+ arg = (u_name, gl_type * length) if length > 1 else (u_name, gl_type)
+ view_fields.append(arg)
+
+ if padding > 0:
+ padding_bytes = padding // c_type_size
+ view_fields.append((f'_padding{i}', gl_type * padding_bytes))
+
+ # Custom ctypes Structure for Uniform access:
+ class View(Structure):
+ _fields_ = view_fields
+
+ def __repr__(self):
+ return str(dict(self._fields_))
+
+ return View
+
+ def __repr__(self):
+ return f"{self.__class__.__name__}(name={self.name}, index={self.index})"
+
+
+class UniformBufferObject:
+ __slots__ = 'buffer', 'view', '_view_ptr', 'index'
+
+ def __init__(self, view_class, buffer_size, index):
+ self.buffer = BufferObject(buffer_size)
+ self.view = view_class()
+ self._view_ptr = pointer(self.view)
+ self.index = index
+
+ @property
+ def id(self):
+ return self.buffer.id
+
+ def bind(self, index=None):
+ glBindBufferBase(GL_UNIFORM_BUFFER, self.index if index is None else index, self.buffer.id)
+
+ def read(self):
+ """Read the byte contents of the buffer"""
+ glBindBuffer(GL_ARRAY_BUFFER, self.buffer.id)
+ ptr = glMapBufferRange(GL_ARRAY_BUFFER, 0, self.buffer.size, GL_MAP_READ_BIT)
+ data = string_at(ptr, size=self.buffer.size)
+ glUnmapBuffer(GL_ARRAY_BUFFER)
+ return data
+
+ def __enter__(self):
+ # Return the view to the user in a `with` context:
+ return self.view
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ self.bind()
+ self.buffer.set_data(self._view_ptr)
+
+ def __repr__(self):
+ return "{0}(id={1})".format(self.__class__.__name__, self.buffer.id)
+
+
+# Utility functions:
+
+def _get_number(program_id: int, variable_type: int) -> int:
+ """Get the number of active variables of the passed GL type."""
+ number = GLint(0)
+ glGetProgramiv(program_id, variable_type, byref(number))
+ return number.value
+
+
+def _query_attribute(program_id: int, index: int):
+ """Query the name, type, and size of an Attribute by index."""
+ asize = GLint()
+ atype = GLenum()
+ buf_size = 192
+ aname = create_string_buffer(buf_size)
+ try:
+ glGetActiveAttrib(program_id, index, buf_size, None, asize, atype, aname)
+ return aname.value.decode(), atype.value, asize.value
+ except GLException as exc:
+ raise ShaderException from exc
+
+
+def _introspect_attributes(program_id: int) -> dict:
+ """Introspect a Program's Attributes, and return a dict of accessors."""
+ attributes = {}
+
+ for index in range(_get_number(program_id, GL_ACTIVE_ATTRIBUTES)):
+ a_name, a_type, a_size = _query_attribute(program_id, index)
+ loc = glGetAttribLocation(program_id, create_string_buffer(a_name.encode('utf-8')))
+ count, fmt = _attribute_types[a_type]
+ attributes[a_name] = dict(type=a_type, size=a_size, location=loc, count=count, format=fmt)
+
+ if _debug_gl_shaders:
+ for attribute in attributes.values():
+ print(f" Found attribute: {attribute}")
+
+ return attributes
+
+
+def _link_program(*shaders) -> int:
+ """Link one or more Shaders into a ShaderProgram."""
+ program_id = glCreateProgram()
+ for shader in shaders:
+ glAttachShader(program_id, shader.id)
+ glLinkProgram(program_id)
+
+ # Check the link status of program
+ status = c_int()
+ glGetProgramiv(program_id, GL_LINK_STATUS, byref(status))
+ if not status.value:
+ length = c_int()
+ glGetProgramiv(program_id, GL_INFO_LOG_LENGTH, length)
+ log = c_buffer(length.value)
+ glGetProgramInfoLog(program_id, len(log), None, log)
+ raise ShaderException("Error linking shader program:\n{}".format(log.value.decode()))
+
+ # Shader objects no longer needed
+ for shader in shaders:
+ glDetachShader(program_id, shader.id)
+
+ return program_id
+
+
+def _get_program_log(program_id: int) -> str:
+ """Query a ShaderProgram link logs."""
+ result = c_int(0)
+ glGetProgramiv(program_id, GL_INFO_LOG_LENGTH, byref(result))
+ result_str = create_string_buffer(result.value)
+ glGetProgramInfoLog(program_id, result, None, result_str)
+
+ if result_str.value:
+ return f"OpenGL returned the following message when linking the program: \n{result_str.value}"
+ else:
+ return f"Program '{program_id}' linked successfully."
+
+
+def _query_uniform(program_id: int, index: int):
+ """Query the name, type, and size of a Uniform by index."""
+ usize = GLint()
+ utype = GLenum()
+ buf_size = 192
+ uname = create_string_buffer(buf_size)
+ try:
+ glGetActiveUniform(program_id, index, buf_size, None, usize, utype, uname)
+ return uname.value.decode(), utype.value, usize.value
+
+ except GLException as exc:
+ raise ShaderException from exc
+
+
+def _introspect_uniforms(program_id: int, have_dsa: bool) -> dict:
+ """Introspect a Program's uniforms, and return a dict of accessors."""
+ uniforms = {}
+
+ for index in range(_get_number(program_id, GL_ACTIVE_UNIFORMS)):
+ u_name, u_type, u_size = _query_uniform(program_id, index)
+ loc = glGetUniformLocation(program_id, create_string_buffer(u_name.encode('utf-8')))
+ if loc == -1: # Skip uniforms that may be inside a Uniform Block
+ continue
+ uniforms[u_name] = _Uniform(program_id, u_name, u_type, loc, have_dsa)
+
+ if _debug_gl_shaders:
+ for uniform in uniforms.values():
+ print(f" Found uniform: {uniform}")
+
+ return uniforms
+
+
+def _get_uniform_block_name(program_id: int, index: int) -> str:
+ """Query the name of a Uniform Block, by index"""
+ buf_size = 128
+ size = c_int(0)
+ name_buf = create_string_buffer(buf_size)
+ try:
+ glGetActiveUniformBlockName(program_id, index, buf_size, size, name_buf)
+ return name_buf.value.decode()
+ except GLException:
+ raise ShaderException(f"Unable to query UniformBlock name at index: {index}")
+
+
+def _introspect_uniform_blocks(program) -> dict:
+ uniform_blocks = {}
+ program_id = program.id
+
+ for index in range(_get_number(program_id, GL_ACTIVE_UNIFORM_BLOCKS)):
+ name = _get_uniform_block_name(program_id, index)
+
+ num_active = GLint()
+ block_data_size = GLint()
+
+ glGetActiveUniformBlockiv(program_id, index, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, num_active)
+ glGetActiveUniformBlockiv(program_id, index, GL_UNIFORM_BLOCK_DATA_SIZE, block_data_size)
+
+ indices = (GLuint * num_active.value)()
+ indices_ptr = cast(addressof(indices), POINTER(GLint))
+ glGetActiveUniformBlockiv(program_id, index, GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, indices_ptr)
+
+ uniforms = {}
+
+ for block_uniform_index in indices:
+ uniform_name, u_type, u_size = _query_uniform(program_id, block_uniform_index)
+
+ # Separate uniform name from block name (Only if instance name is provided on the Uniform Block)
+ try:
+ _, uniform_name = uniform_name.split(".")
+ except ValueError:
+ pass
+
+ gl_type, _, _, length, _ = _uniform_setters[u_type]
+ uniforms[block_uniform_index] = (uniform_name, gl_type, length)
+
+ uniform_blocks[name] = UniformBlock(program, name, index, block_data_size.value, uniforms)
+ # This might cause an error if index > GL_MAX_UNIFORM_BUFFER_BINDINGS, but surely no
+ # one would be crazy enough to use more than 36 uniform blocks, right?
+ glUniformBlockBinding(program_id, index, index)
+
+ if _debug_gl_shaders:
+ for block in uniform_blocks.values():
+ print(f" Found uniform block: {block}")
+
+ return uniform_blocks
+
+
+# Program definitions:
+
+class ShaderSource:
+ """GLSL source container for making source parsing simpler.
+
+ We support locating out attributes and applying #defines values.
+
+ NOTE: We do assume the source is neat enough to be parsed
+ this way and don't contain several statements in one line.
+ """
+
+ def __init__(self, source: str, source_type: GLenum):
+ """Create a shader source wrapper."""
+ self._lines = source.strip().splitlines()
+ self._type = source_type
+
+ if not self._lines:
+ raise ShaderException("Shader source is empty")
+
+ self._version = self._find_glsl_version()
+
+ if pyglet.gl.current_context.get_info().get_opengl_api() == "gles":
+ self._lines[0] = "#version 310 es"
+ self._lines.insert(1, "precision mediump float;")
+
+ if self._type == GL_GEOMETRY_SHADER:
+ self._lines.insert(1, "#extension GL_EXT_geometry_shader : require")
+
+ if self._type == GL_COMPUTE_SHADER:
+ self._lines.insert(1, "precision mediump image2D;")
+
+ self._version = self._find_glsl_version()
+
+ def validate(self) -> str:
+ """Return the validated shader source."""
+ return "\n".join(self._lines)
+
+ def _find_glsl_version(self) -> int:
+ if self._lines[0].strip().startswith("#version"):
+ try:
+ return int(self._lines[0].split()[1])
+ except (ValueError, IndexError):
+ pass
+
+ source = "\n".join(f"{str(i+1).zfill(3)}: {line} " for i, line in enumerate(self._lines))
+
+ raise ShaderException(("Cannot find #version flag in shader source. "
+ "A #version statement is required on the first line.\n"
+ "------------------------------------\n"
+ f"{source}"))
+
+
+class Shader:
+ """OpenGL shader.
+
+ Shader objects are compiled on instantiation.
+ You can reuse a Shader object in multiple ShaderPrograms.
+
+ `shader_type` is one of ``'compute'``, ``'fragment'``, ``'geometry'``,
+ ``'tesscontrol'``, ``'tessevaluation'``, or ``'vertex'``.
+ """
+
+ def __init__(self, source_string: str, shader_type: str):
+ self._id = None
+ self.type = shader_type
+
+ try:
+ shader_type = _shader_types[shader_type]
+ except KeyError as err:
+ raise ShaderException(f"shader_type '{shader_type}' is invalid."
+ f"Valid types are: {list(_shader_types)}") from err
+
+ source_string = ShaderSource(source_string, shader_type).validate()
+ shader_source_utf8 = source_string.encode("utf8")
+ source_buffer_pointer = cast(c_char_p(shader_source_utf8), POINTER(c_char))
+ source_length = c_int(len(shader_source_utf8))
+
+ shader_id = glCreateShader(shader_type)
+ glShaderSource(shader_id, 1, byref(source_buffer_pointer), source_length)
+ glCompileShader(shader_id)
+
+ status = c_int(0)
+ glGetShaderiv(shader_id, GL_COMPILE_STATUS, byref(status))
+
+ if status.value != GL_TRUE:
+ source = self._get_shader_source(shader_id)
+ source_lines = "{0}".format("\n".join(f"{str(i+1).zfill(3)}: {line} "
+ for i, line in enumerate(source.split("\n"))))
+
+ raise ShaderException(f"Shader compilation failed.\n"
+ f"{self._get_shader_log(shader_id)}"
+ "------------------------------------------------------------\n"
+ f"{source_lines}\n"
+ "------------------------------------------------------------")
+
+ elif _debug_gl_shaders:
+ print(self._get_shader_log(shader_id))
+
+ self._id = shader_id
+
+ @property
+ def id(self):
+ return self._id
+
+ def _get_shader_log(self, shader_id):
+ log_length = c_int(0)
+ glGetShaderiv(shader_id, GL_INFO_LOG_LENGTH, byref(log_length))
+ result_str = create_string_buffer(log_length.value)
+ glGetShaderInfoLog(shader_id, log_length, None, result_str)
+ if result_str.value:
+ return ("OpenGL returned the following message when compiling the '{0}' shader: "
+ "\n{1}".format(self.type, result_str.value.decode('utf8')))
+ else:
+ return f"{self.type.capitalize()} Shader '{shader_id}' compiled successfully."
+
+ @staticmethod
+ def _get_shader_source(shader_id):
+ """Get the shader source from the shader object"""
+ source_length = c_int(0)
+ glGetShaderiv(shader_id, GL_SHADER_SOURCE_LENGTH, source_length)
+ source_str = create_string_buffer(source_length.value)
+ glGetShaderSource(shader_id, source_length, None, source_str)
+ return source_str.value.decode('utf8')
+
+ def __del__(self):
+ try:
+ glDeleteShader(self._id)
+ if _debug_gl_shaders:
+ print(f"Destroyed {self.type} Shader '{self._id}'")
+
+ except Exception:
+ # Interpreter is shutting down,
+ # or Shader failed to compile.
+ pass
+
+ def __repr__(self):
+ return "{0}(id={1}, type={2})".format(self.__class__.__name__, self.id, self.type)
+
+
+class ShaderProgram:
+ """OpenGL shader program."""
+
+ __slots__ = '_id', '_context', '_attributes', '_uniforms', '_uniform_blocks', '__weakref__'
+
+ def __init__(self, *shaders: Shader):
+ assert shaders, "At least one Shader object is required."
+ self._id = _link_program(*shaders)
+ self._context = pyglet.gl.current_context
+
+ if _debug_gl_shaders:
+ print(_get_program_log(self._id))
+
+ # Query if Direct State Access is available:
+ have_dsa = gl_info.have_version(4, 1) or gl_info.have_extension("GL_ARB_separate_shader_objects")
+ self._attributes = _introspect_attributes(self._id)
+ self._uniforms = _introspect_uniforms(self._id, have_dsa)
+ self._uniform_blocks = _introspect_uniform_blocks(self)
+
+ @property
+ def id(self):
+ return self._id
+
+ @property
+ def attributes(self):
+ return self._attributes
+
+ @property
+ def uniforms(self):
+ return self._uniforms
+
+ @property
+ def uniform_blocks(self):
+ return self._uniform_blocks
+
+ def use(self):
+ glUseProgram(self._id)
+
+ @staticmethod
+ def stop():
+ glUseProgram(0)
+
+ __enter__ = use
+ bind = use
+ unbind = stop
+
+ def __exit__(self, *_):
+ glUseProgram(0)
+
+ def __del__(self):
+ try:
+ self._context.delete_shader_program(self.id)
+ except Exception:
+ # Interpreter is shutting down,
+ # or ShaderProgram failed to link.
+ pass
+
+ def __setitem__(self, key, value):
+ try:
+ uniform = self._uniforms[key]
+ except KeyError as err:
+ raise ShaderException(f"A Uniform with the name `{key}` was not found.\n"
+ f"The spelling may be incorrect, or if not in use it "
+ f"may have been optimized out by the OpenGL driver.") from err
+ try:
+ uniform.set(value)
+ except GLException as err:
+ raise ShaderException from err
+
+ def __getitem__(self, item):
+ try:
+ uniform = self._uniforms[item]
+ except KeyError as err:
+ raise ShaderException(f"A Uniform with the name `{item}` was not found.\n"
+ f"The spelling may be incorrect, or if not in use it "
+ f"may have been optimized out by the OpenGL driver.") from err
+ try:
+ return uniform.get()
+ except GLException as err:
+ raise ShaderException from err
+
+ def vertex_list(self, count, mode, batch=None, group=None, **data):
+ """Create a VertexList.
+
+ :Parameters:
+ `count` : int
+ The number of vertices in the list.
+ `mode` : int
+ OpenGL drawing mode enumeration; for example, one of
+ ``GL_POINTS``, ``GL_LINES``, ``GL_TRIANGLES``, etc.
+ This determines how the list is drawn in the given batch.
+ `batch` : `~pyglet.graphics.Batch`
+ Batch to add the VertexList to, or ``None`` if a Batch will not be used.
+ Using a Batch is strongly recommended.
+ `group` : `~pyglet.graphics.Group`
+ Group to add the VertexList to, or ``None`` if no group is required.
+ `**data` : str or tuple
+ Attribute formats and initial data for the vertex list.
+
+ :rtype: :py:class:`~pyglet.graphics.vertexdomain.VertexList`
+ """
+ attributes = self._attributes.copy()
+ initial_arrays = []
+
+ for name, fmt in data.items():
+ try:
+ if isinstance(fmt, tuple):
+ fmt, array = fmt
+ initial_arrays.append((name, array))
+ attributes[name] = {**attributes[name], **{'format': fmt}}
+ except KeyError:
+ raise ShaderException(f"\nThe attribute `{name}` doesn't exist. Valid names: \n{list(attributes)}")
+
+ batch = batch or pyglet.graphics.get_default_batch()
+ domain = batch.get_domain(False, mode, group, self, attributes)
+
+ # Create vertex list and initialize
+ vlist = domain.create(count)
+
+ for name, array in initial_arrays:
+ vlist.set_attribute_data(name, array)
+
+ return vlist
+
+ def vertex_list_indexed(self, count, mode, indices, batch=None, group=None, **data):
+ """Create a IndexedVertexList.
+
+ :Parameters:
+ `count` : int
+ The number of vertices in the list.
+ `mode` : int
+ OpenGL drawing mode enumeration; for example, one of
+ ``GL_POINTS``, ``GL_LINES``, ``GL_TRIANGLES``, etc.
+ This determines how the list is drawn in the given batch.
+ `indices` : sequence of int
+ Sequence of integers giving indices into the vertex list.
+ `batch` : `~pyglet.graphics.Batch`
+ Batch to add the VertexList to, or ``None`` if a Batch will not be used.
+ Using a Batch is strongly recommended.
+ `group` : `~pyglet.graphics.Group`
+ Group to add the VertexList to, or ``None`` if no group is required.
+ `**data` : str or tuple
+ Attribute formats and initial data for the vertex list.
+
+ :rtype: :py:class:`~pyglet.graphics.vertexdomain.IndexedVertexList`
+ """
+ attributes = self._attributes.copy()
+ initial_arrays = []
+
+ for name, fmt in data.items():
+ try:
+ if isinstance(fmt, tuple):
+ fmt, array = fmt
+ initial_arrays.append((name, array))
+ attributes[name] = {**attributes[name], **{'format': fmt}}
+ except KeyError:
+ raise ShaderException(f"\nThe attribute `{name}` doesn't exist. Valid names: \n{list(attributes)}")
+
+ batch = batch or pyglet.graphics.get_default_batch()
+ domain = batch.get_domain(True, mode, group, self, attributes)
+
+ # Create vertex list and initialize
+ vlist = domain.create(count, len(indices))
+ start = vlist.start
+ vlist.indices = [i + start for i in indices]
+
+ for name, array in initial_arrays:
+ vlist.set_attribute_data(name, array)
+
+ return vlist
+
+ def __repr__(self):
+ return "{0}(id={1})".format(self.__class__.__name__, self.id)
+
+
+class ComputeShaderProgram:
+ """OpenGL Compute Shader Program"""
+
+ __slots__ = '_shader', '_id', '_context', '_uniforms', '_uniform_blocks', '__weakref__', 'limits'
+
+ def __init__(self, source: str):
+ """Create an OpenGL ComputeShaderProgram from source."""
+ if not (gl_info.have_version(4, 3) or gl_info.have_extension("GL_ARB_compute_shader")):
+ raise ShaderException("Compute Shader not supported. OpenGL Context version must be at least "
+ "4.3 or higher, or 4.2 with the 'GL_ARB_compute_shader' extension.")
+
+ self._shader = Shader(source, 'compute')
+ self._context = pyglet.gl.current_context
+ self._id = _link_program(self._shader)
+
+ if _debug_gl_shaders:
+ print(_get_program_log(self._id))
+
+ self._uniforms = _introspect_uniforms(self._id, True)
+ self._uniform_blocks = _introspect_uniform_blocks(self)
+
+ self.limits = {
+ 'work_group_count': self._get_tuple(GL_MAX_COMPUTE_WORK_GROUP_COUNT),
+ 'work_group_size': self._get_tuple(GL_MAX_COMPUTE_WORK_GROUP_SIZE),
+ 'work_group_invocations': self._get_value(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS),
+ 'shared_memory_size': self._get_value(GL_MAX_COMPUTE_SHARED_MEMORY_SIZE),
+ }
+
+ @staticmethod
+ def _get_tuple(parameter: int):
+ val_x = GLint()
+ val_y = GLint()
+ val_z = GLint()
+ for i, value in enumerate((val_x, val_y, val_z)):
+ glGetIntegeri_v(parameter, i, byref(value))
+ return val_x.value, val_y.value, val_z.value
+
+ @staticmethod
+ def _get_value(parameter: int) -> int:
+ val = GLint()
+ glGetIntegerv(parameter, byref(val))
+ return val.value
+
+ @staticmethod
+ def dispatch(x: int = 1, y: int = 1, z: int = 1, barrier: int = GL_ALL_BARRIER_BITS) -> None:
+ """Launch one or more compute work groups.
+
+ The ComputeShaderProgram should be active (bound) before calling
+ this method. The x, y, and z parameters specify the number of local
+ work groups that will be dispatched in the X, Y and Z dimensions.
+ """
+ glDispatchCompute(x, y, z)
+ if barrier:
+ glMemoryBarrier(barrier)
+
+ @property
+ def id(self) -> int:
+ return self._id
+
+ @property
+ def uniforms(self) -> dict:
+ return self._uniforms
+
+ @property
+ def uniform_blocks(self) -> dict:
+ return self._uniform_blocks
+
+ def use(self) -> None:
+ glUseProgram(self._id)
+
+ @staticmethod
+ def stop():
+ glUseProgram(0)
+
+ __enter__ = use
+ bind = use
+ unbind = stop
+
+ def __exit__(self, *_):
+ glUseProgram(0)
+
+ def __del__(self):
+ try:
+ self._context.delete_shader_program(self.id)
+ except Exception:
+ # Interpreter is shutting down,
+ # or ShaderProgram failed to link.
+ pass
+
+ def __setitem__(self, key, value):
+ try:
+ uniform = self._uniforms[key]
+ except KeyError as err:
+ raise ShaderException(f"A Uniform with the name `{key}` was not found.\n"
+ f"The spelling may be incorrect, or if not in use it "
+ f"may have been optimized out by the OpenGL driver.") from err
+ try:
+ uniform.set(value)
+ except GLException as err:
+ raise ShaderException from err
+
+ def __getitem__(self, item):
+ try:
+ uniform = self._uniforms[item]
+ except KeyError as err:
+ raise ShaderException(f"A Uniform with the name `{item}` was not found.\n"
+ f"The spelling may be incorrect, or if not in use it "
+ f"may have been optimized out by the OpenGL driver.") from err
+ try:
+ return uniform.get()
+ except GLException as err:
+ raise ShaderException from err
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/vertexarray.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/vertexarray.py
new file mode 100644
index 0000000000000000000000000000000000000000..e4c2580120cd341abfe3c87d5a43ee90cc712ded
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/vertexarray.py
@@ -0,0 +1,48 @@
+import pyglet
+
+from pyglet.gl import GLuint, glGenVertexArrays, glDeleteVertexArrays, glBindVertexArray
+
+
+__all__ = ['VertexArray']
+
+
+class VertexArray:
+ """OpenGL Vertex Array Object"""
+
+ def __init__(self):
+ """Create an instance of a Vertex Array object."""
+ self._context = pyglet.gl.current_context
+ self._id = GLuint()
+ glGenVertexArrays(1, self._id)
+
+ @property
+ def id(self):
+ return self._id.value
+
+ def bind(self):
+ glBindVertexArray(self._id)
+
+ @staticmethod
+ def unbind():
+ glBindVertexArray(0)
+
+ def delete(self):
+ try:
+ glDeleteVertexArrays(1, self._id)
+ except Exception:
+ pass
+
+ __enter__ = bind
+
+ def __exit__(self, *_):
+ glBindVertexArray(0)
+
+ def __del__(self):
+ try:
+ self._context.delete_vao(self.id)
+ # Python interpreter is shutting down:
+ except ImportError:
+ pass
+
+ def __repr__(self):
+ return "{}(id={})".format(self.__class__.__name__, self._id.value)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/vertexbuffer.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/vertexbuffer.py
new file mode 100644
index 0000000000000000000000000000000000000000..ffbaa7fb31ff9bd03b8cab046824c719b9807888
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/vertexbuffer.py
@@ -0,0 +1,313 @@
+"""Byte abstractions of OpenGL Buffer Objects.
+
+Use `create_buffer` to create a Buffer Object.
+
+Buffers can optionally be created "mappable" (incorporating the
+`AbstractMappable` mix-in). In this case the buffer provides a ``get_region``
+method which provides the most efficient path for updating partial data within
+the buffer.
+"""
+
+import sys
+import ctypes
+
+import pyglet
+from pyglet.gl import *
+
+
+class AbstractBuffer:
+ """Abstract buffer of byte data.
+
+ :Ivariables:
+ `size` : int
+ Size of buffer, in bytes
+ `ptr` : int
+ Memory offset of the buffer, as used by the ``glVertexPointer``
+ family of functions
+ `usage` : int
+ OpenGL buffer usage, for example ``GL_DYNAMIC_DRAW``
+
+ """
+
+ ptr = 0
+ size = 0
+
+ def bind(self, target=GL_ARRAY_BUFFER):
+ """Bind this buffer to an OpenGL target."""
+ raise NotImplementedError('abstract')
+
+ def unbind(self):
+ """Reset the buffer's OpenGL target."""
+ raise NotImplementedError('abstract')
+
+ def set_data(self, data):
+ """Set the entire contents of the buffer.
+
+ :Parameters:
+ `data` : sequence of int or ctypes pointer
+ The byte array to set.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def set_data_region(self, data, start, length):
+ """Set part of the buffer contents.
+
+ :Parameters:
+ `data` : sequence of int or ctypes pointer
+ The byte array of data to set
+ `start` : int
+ Offset to start replacing data
+ `length` : int
+ Length of region to replace
+
+ """
+ raise NotImplementedError('abstract')
+
+ def map(self):
+ """Map the entire buffer into system memory.
+
+ The mapped region must be subsequently unmapped with `unmap` before
+ performing any other operations on the buffer.
+
+ :Parameters:
+ `invalidate` : bool
+ If True, the initial contents of the mapped block need not
+ reflect the actual contents of the buffer.
+
+ :rtype: ``POINTER(ctypes.c_ubyte)``
+ :return: Pointer to the mapped block in memory
+ """
+ raise NotImplementedError('abstract')
+
+ def unmap(self):
+ """Unmap a previously mapped memory block."""
+ raise NotImplementedError('abstract')
+
+ def resize(self, size):
+ """Resize the buffer to a new size.
+
+ :Parameters:
+ `size` : int
+ New size of the buffer, in bytes
+
+ """
+
+ def delete(self):
+ """Delete this buffer, reducing system resource usage."""
+ raise NotImplementedError('abstract')
+
+
+class AbstractMappable:
+
+ def get_region(self, start, size, ptr_type):
+ """Map a region of the buffer into a ctypes array of the desired
+ type. This region does not need to be unmapped, but will become
+ invalid if the buffer is resized.
+
+ Note that although a pointer type is required, an array is mapped.
+ For example::
+
+ get_region(0, ctypes.sizeof(c_int) * 20, ctypes.POINTER(c_int * 20))
+
+ will map bytes 0 to 80 of the buffer to an array of 20 ints.
+
+ Changes to the array may not be recognised until the region's
+ :py:meth:`AbstractBufferRegion.invalidate` method is called.
+
+ :Parameters:
+ `start` : int
+ Offset into the buffer to map from, in bytes
+ `size` : int
+ Size of the buffer region to map, in bytes
+ `ptr_type` : ctypes pointer type
+ Pointer type describing the array format to create
+
+ :rtype: :py:class:`AbstractBufferRegion`
+ """
+ raise NotImplementedError('abstract')
+
+
+class BufferObject(AbstractBuffer):
+ """Lightweight representation of an OpenGL Buffer Object.
+
+ The data in the buffer is not replicated in any system memory (unless it
+ is done so by the video driver). While this can improve memory usage and
+ possibly performance, updates to the buffer are relatively slow.
+ The target of the buffer is ``GL_ARRAY_BUFFER`` internally to avoid
+ accidentally overriding other states when altering the buffer contents.
+ The intended target can be set when binding the buffer.
+
+ This class does not implement :py:class:`AbstractMappable`, and so has no
+ :py:meth:`~AbstractMappable.get_region` method. See
+ :py:class:`MappableVertexBufferObject` for a Buffer class
+ that does implement :py:meth:`~AbstractMappable.get_region`.
+ """
+
+ def __init__(self, size, usage=GL_DYNAMIC_DRAW):
+ self.size = size
+ self.usage = usage
+ self._context = pyglet.gl.current_context
+
+ buffer_id = GLuint()
+ glGenBuffers(1, buffer_id)
+ self.id = buffer_id.value
+
+ glBindBuffer(GL_ARRAY_BUFFER, self.id)
+ data = (GLubyte * self.size)()
+ glBufferData(GL_ARRAY_BUFFER, self.size, data, self.usage)
+
+ def invalidate(self):
+ glBufferData(GL_ARRAY_BUFFER, self.size, None, self.usage)
+
+ def bind(self, target=GL_ARRAY_BUFFER):
+ glBindBuffer(target, self.id)
+
+ def unbind(self):
+ glBindBuffer(GL_ARRAY_BUFFER, 0)
+
+ def bind_to_index_buffer(self):
+ """Binds this buffer as an index buffer on the active vertex array."""
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, self.id)
+
+ def set_data(self, data):
+ glBindBuffer(GL_ARRAY_BUFFER, self.id)
+ glBufferData(GL_ARRAY_BUFFER, self.size, data, self.usage)
+
+ def set_data_region(self, data, start, length):
+ glBindBuffer(GL_ARRAY_BUFFER, self.id)
+ glBufferSubData(GL_ARRAY_BUFFER, start, length, data)
+
+ def map(self):
+ glBindBuffer(GL_ARRAY_BUFFER, self.id)
+ ptr = ctypes.cast(glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY), ctypes.POINTER(ctypes.c_byte * self.size)).contents
+ return ptr
+
+ def map_range(self, start, size, ptr_type):
+ glBindBuffer(GL_ARRAY_BUFFER, self.id)
+ ptr = ctypes.cast(glMapBufferRange(GL_ARRAY_BUFFER, start, size, GL_MAP_WRITE_BIT), ptr_type).contents
+ return ptr
+
+ def unmap(self):
+ glUnmapBuffer(GL_ARRAY_BUFFER)
+
+ def __del__(self):
+ try:
+ if self.id is not None:
+ self._context.delete_buffer(self.id)
+ except:
+ pass
+
+ def delete(self):
+ buffer_id = GLuint(self.id)
+ try:
+ glDeleteBuffers(1, buffer_id)
+ except Exception:
+ pass
+ self.id = None
+
+ def resize(self, size):
+ # Map, create a copy, then reinitialize.
+ temp = (ctypes.c_byte * size)()
+
+ glBindBuffer(GL_ARRAY_BUFFER, self.id)
+ data = glMapBufferRange(GL_ARRAY_BUFFER, 0, self.size, GL_MAP_READ_BIT)
+ ctypes.memmove(temp, data, min(size, self.size))
+ glUnmapBuffer(GL_ARRAY_BUFFER)
+
+ self.size = size
+ glBufferData(GL_ARRAY_BUFFER, self.size, temp, self.usage)
+
+ def __repr__(self):
+ return f"{self.__class__.__name__}(id={self.id}, size={self.size})"
+
+
+class MappableBufferObject(BufferObject, AbstractMappable):
+ """A buffer with system-memory backed store.
+
+ Updates to the data via `set_data`, `set_data_region` and `map` will be
+ held in local memory until `bind` is called. The advantage is that fewer
+ OpenGL calls are needed, increasing performance.
+
+ There may also be less performance penalty for resizing this buffer.
+
+ Updates to data via :py:meth:`map` are committed immediately.
+ """
+ def __init__(self, size, usage=GL_DYNAMIC_DRAW):
+ super(MappableBufferObject, self).__init__(size, usage)
+ self.data = (ctypes.c_byte * size)()
+ self.data_ptr = ctypes.addressof(self.data)
+ self._dirty_min = sys.maxsize
+ self._dirty_max = 0
+
+ def bind(self):
+ # Commit pending data
+ super(MappableBufferObject, self).bind()
+ size = self._dirty_max - self._dirty_min
+ if size > 0:
+ if size == self.size:
+ glBufferData(GL_ARRAY_BUFFER, self.size, self.data, self.usage)
+ else:
+ glBufferSubData(GL_ARRAY_BUFFER, self._dirty_min, size, self.data_ptr + self._dirty_min)
+ self._dirty_min = sys.maxsize
+ self._dirty_max = 0
+
+ def set_data(self, data):
+ super(MappableBufferObject, self).set_data(data)
+ ctypes.memmove(self.data, data, self.size)
+ self._dirty_min = 0
+ self._dirty_max = self.size
+
+ def set_data_region(self, data, start, length):
+ ctypes.memmove(self.data_ptr + start, data, length)
+ self._dirty_min = min(start, self._dirty_min)
+ self._dirty_max = max(start + length, self._dirty_max)
+
+ def map(self, invalidate=False):
+ self._dirty_min = 0
+ self._dirty_max = self.size
+ return self.data
+
+ def unmap(self):
+ pass
+
+ def get_region(self, start, size, ptr_type):
+ array = ctypes.cast(self.data_ptr + start, ptr_type).contents
+ return BufferObjectRegion(self, start, start + size, array)
+
+ def resize(self, size):
+ data = (ctypes.c_byte * size)()
+ ctypes.memmove(data, self.data, min(size, self.size))
+ self.data = data
+ self.data_ptr = ctypes.addressof(self.data)
+
+ self.size = size
+
+ glBindBuffer(GL_ARRAY_BUFFER, self.id)
+ glBufferData(GL_ARRAY_BUFFER, self.size, self.data, self.usage)
+
+ self._dirty_min = sys.maxsize
+ self._dirty_max = 0
+
+
+class BufferObjectRegion:
+ """A mapped region of a MappableBufferObject."""
+
+ __slots__ = 'buffer', 'start', 'end', 'array'
+
+ def __init__(self, buffer, start, end, array):
+ self.buffer = buffer
+ self.start = start
+ self.end = end
+ self.array = array
+
+ def invalidate(self):
+ """Mark this region as changed.
+
+ The buffer may not be updated with the latest contents of the
+ array until this method is called. (However, it may not be updated
+ until the next time the buffer is used, for efficiency).
+ """
+ buffer = self.buffer
+ buffer._dirty_min = min(buffer._dirty_min, self.start)
+ buffer._dirty_max = max(buffer._dirty_max, self.end)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/vertexdomain.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/vertexdomain.py
new file mode 100644
index 0000000000000000000000000000000000000000..2aa18b66112bc20656efe2ece5378154701398c7
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/graphics/vertexdomain.py
@@ -0,0 +1,566 @@
+"""Manage related vertex attributes within a single vertex domain.
+
+A vertex "domain" consists of a set of attribute descriptions that together
+describe the layout of one or more vertex buffers which are used together to
+specify the vertices in a primitive. Additionally, the domain manages the
+buffers used to store the data and will resize them as necessary to accommodate
+new vertices.
+
+Domains can optionally be indexed, in which case they also manage a buffer
+containing vertex indices. This buffer is grown separately and has no size
+relation to the attribute buffers.
+
+Applications can create vertices (and optionally, indices) within a domain
+with the :py:meth:`VertexDomain.create` method. This returns a
+:py:class:`VertexList` representing the list of vertices created. The vertex
+attribute data within the group can be modified, and the changes will be made
+to the underlying buffers automatically.
+
+The entire domain can be efficiently drawn in one step with the
+:py:meth:`VertexDomain.draw` method, assuming all the vertices comprise
+primitives of the same OpenGL primitive mode.
+"""
+
+import ctypes
+
+import pyglet
+
+from pyglet.gl import *
+from pyglet.graphics import allocation, shader, vertexarray
+from pyglet.graphics.vertexbuffer import BufferObject, MappableBufferObject
+
+
+def _nearest_pow2(v):
+ # From http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
+ # Credit: Sean Anderson
+ v -= 1
+ v |= v >> 1
+ v |= v >> 2
+ v |= v >> 4
+ v |= v >> 8
+ v |= v >> 16
+ return v + 1
+
+
+_c_types = {
+ GL_BYTE: ctypes.c_byte,
+ GL_UNSIGNED_BYTE: ctypes.c_ubyte,
+ GL_SHORT: ctypes.c_short,
+ GL_UNSIGNED_SHORT: ctypes.c_ushort,
+ GL_INT: ctypes.c_int,
+ GL_UNSIGNED_INT: ctypes.c_uint,
+ GL_FLOAT: ctypes.c_float,
+ GL_DOUBLE: ctypes.c_double,
+}
+
+
+_gl_types = {
+ 'b': GL_BYTE,
+ 'B': GL_UNSIGNED_BYTE,
+ 's': GL_SHORT,
+ 'S': GL_UNSIGNED_SHORT,
+ 'i': GL_INT,
+ 'I': GL_UNSIGNED_INT,
+ 'f': GL_FLOAT,
+ 'd': GL_DOUBLE,
+}
+
+
+class VertexDomain:
+ """Management of a set of vertex lists.
+
+ Construction of a vertex domain is usually done with the
+ :py:func:`create_domain` function.
+ """
+ version = 0
+ _initial_count = 16
+
+ def __init__(self, program, attribute_meta):
+ self.program = program
+ self.attribute_meta = attribute_meta
+ self.allocator = allocation.Allocator(self._initial_count)
+ self.vao = vertexarray.VertexArray()
+
+ self.attributes = []
+ self.buffer_attributes = [] # list of (buffer, attributes)
+
+ for name, meta in attribute_meta.items():
+ assert meta['format'][0] in _gl_types, f"'{meta['format']}' is not a valid atrribute format for '{name}'."
+ location = meta['location']
+ count = meta['count']
+ gl_type = _gl_types[meta['format'][0]]
+ normalize = 'n' in meta['format']
+ attribute = shader.Attribute(name, location, count, gl_type, normalize)
+ self.attributes.append(attribute)
+
+ # Create buffer:
+ attribute.buffer = MappableBufferObject(attribute.stride * self.allocator.capacity)
+ attribute.buffer.element_size = attribute.stride
+ attribute.buffer.attributes = (attribute,)
+ self.buffer_attributes.append((attribute.buffer, (attribute,)))
+
+ # Create named attributes for each attribute
+ self.attribute_names = {}
+ for attribute in self.attributes:
+ self.attribute_names[attribute.name] = attribute
+
+ def __del__(self):
+ # Break circular refs that Python GC seems to miss even when forced
+ # collection.
+ for attribute in self.attributes:
+ try:
+ del attribute.buffer
+ except AttributeError:
+ pass
+
+ def safe_alloc(self, count):
+ """Allocate vertices, resizing the buffers if necessary."""
+ try:
+ return self.allocator.alloc(count)
+ except allocation.AllocatorMemoryException as e:
+ capacity = _nearest_pow2(e.requested_capacity)
+ self.version += 1
+ for buffer, _ in self.buffer_attributes:
+ buffer.resize(capacity * buffer.element_size)
+ self.allocator.set_capacity(capacity)
+ return self.allocator.alloc(count)
+
+ def safe_realloc(self, start, count, new_count):
+ """Reallocate vertices, resizing the buffers if necessary."""
+ try:
+ return self.allocator.realloc(start, count, new_count)
+ except allocation.AllocatorMemoryException as e:
+ capacity = _nearest_pow2(e.requested_capacity)
+ self.version += 1
+ for buffer, _ in self.buffer_attributes:
+ buffer.resize(capacity * buffer.element_size)
+ self.allocator.set_capacity(capacity)
+ return self.allocator.realloc(start, count, new_count)
+
+ def create(self, count, index_count=None):
+ """Create a :py:class:`VertexList` in this domain.
+
+ :Parameters:
+ `count` : int
+ Number of vertices to create.
+ `index_count`: None
+ Ignored for non indexed VertexDomains
+
+ :rtype: :py:class:`VertexList`
+ """
+ start = self.safe_alloc(count)
+ return VertexList(self, start, count)
+
+ def draw(self, mode):
+ """Draw all vertices in the domain.
+
+ All vertices in the domain are drawn at once. This is the
+ most efficient way to render primitives.
+
+ :Parameters:
+ `mode` : int
+ OpenGL drawing mode, e.g. ``GL_POINTS``, ``GL_LINES``, etc.
+
+ """
+ self.vao.bind()
+
+ for buffer, attributes in self.buffer_attributes:
+ buffer.bind()
+ for attribute in attributes:
+ attribute.enable()
+ attribute.set_pointer(attribute.buffer.ptr)
+
+ starts, sizes = self.allocator.get_allocated_regions()
+ primcount = len(starts)
+ if primcount == 0:
+ pass
+ elif primcount == 1:
+ # Common case
+ glDrawArrays(mode, starts[0], sizes[0])
+ else:
+ starts = (GLint * primcount)(*starts)
+ sizes = (GLsizei * primcount)(*sizes)
+ glMultiDrawArrays(mode, starts, sizes, primcount)
+
+ for buffer, _ in self.buffer_attributes:
+ buffer.unbind()
+
+ def draw_subset(self, mode, vertex_list):
+ """Draw a specific VertexList in the domain.
+
+ The `vertex_list` parameter specifies a :py:class:`VertexList`
+ to draw. Only primitives in that list will be drawn.
+
+ :Parameters:
+ `mode` : int
+ OpenGL drawing mode, e.g. ``GL_POINTS``, ``GL_LINES``, etc.
+ `vertex_list` : `VertexList`
+ Vertex list to draw.
+
+ """
+ self.vao.bind()
+
+ for buffer, attributes in self.buffer_attributes:
+ buffer.bind()
+ for attribute in attributes:
+ attribute.enable()
+ attribute.set_pointer(attribute.buffer.ptr)
+
+ glDrawArrays(mode, vertex_list.start, vertex_list.count)
+
+ for buffer, _ in self.buffer_attributes:
+ buffer.unbind()
+
+ @property
+ def is_empty(self):
+ return not self.allocator.starts
+
+ def __repr__(self):
+ return '<%s@%x %s>' % (self.__class__.__name__, id(self), self.allocator)
+
+
+class VertexList:
+ """A list of vertices within a :py:class:`VertexDomain`. Use
+ :py:meth:`VertexDomain.create` to construct this list.
+ """
+ def __init__(self, domain, start, count):
+ self.domain = domain
+ self.start = start
+ self.count = count
+ self._caches = {}
+ self._cache_versions = {}
+
+ def draw(self, mode):
+ """Draw this vertex list in the given OpenGL mode.
+
+ :Parameters:
+ `mode` : int
+ OpenGL drawing mode, e.g. ``GL_POINTS``, ``GL_LINES``, etc.
+
+ """
+ self.domain.draw_subset(mode, self)
+
+ def resize(self, count, index_count=None):
+ """Resize this group.
+
+ :Parameters:
+ `count` : int
+ New number of vertices in the list.
+ `index_count`: None
+ Ignored for non indexed VertexDomains
+
+ """
+ new_start = self.domain.safe_realloc(self.start, self.count, count)
+ if new_start != self.start:
+ # Copy contents to new location
+ for attribute in self.domain.attributes:
+ old = attribute.get_region(attribute.buffer, self.start, self.count)
+ new = attribute.get_region(attribute.buffer, new_start, self.count)
+ new.array[:] = old.array[:]
+ new.invalidate()
+ self.start = new_start
+ self.count = count
+
+ for version in self._cache_versions:
+ self._cache_versions[version] = None
+
+ def delete(self):
+ """Delete this group."""
+ self.domain.allocator.dealloc(self.start, self.count)
+
+ def migrate(self, domain):
+ """Move this group from its current domain and add to the specified
+ one. Attributes on domains must match. (In practice, used to change
+ parent state of some vertices).
+
+ :Parameters:
+ `domain` : `VertexDomain`
+ Domain to migrate this vertex list to.
+
+ """
+ assert list(domain.attribute_names.keys()) == list(self.domain.attribute_names.keys()),\
+ 'Domain attributes must match.'
+
+ new_start = domain.safe_alloc(self.count)
+ for key, old_attribute in self.domain.attribute_names.items():
+ old = old_attribute.get_region(old_attribute.buffer, self.start, self.count)
+ new_attribute = domain.attribute_names[key]
+ new = new_attribute.get_region(new_attribute.buffer, new_start, self.count)
+ new.array[:] = old.array[:]
+ new.invalidate()
+
+ self.domain.allocator.dealloc(self.start, self.count)
+ self.domain = domain
+ self.start = new_start
+
+ for version in self._cache_versions:
+ self._cache_versions[version] = None
+
+ def set_attribute_data(self, name, data):
+ attribute = self.domain.attribute_names[name]
+ attribute.set_region(attribute.buffer, self.start, self.count, data)
+
+ def __getattr__(self, name):
+ """dynamic access to vertex attributes, for backwards compatibility.
+ """
+ domain = self.domain
+ if self._cache_versions.get(name, None) != domain.version:
+ attribute = domain.attribute_names[name]
+ self._caches[name] = attribute.get_region(attribute.buffer, self.start, self.count)
+ self._cache_versions[name] = domain.version
+
+ region = self._caches[name]
+ region.invalidate()
+ return region.array
+
+ def __setattr__(self, name, value):
+ # Allow setting vertex attributes directly without overwriting them:
+ if 'domain' in self.__dict__ and name in self.__dict__['domain'].attribute_names:
+ getattr(self, name)[:] = value
+ return
+ super().__setattr__(name, value)
+
+
+class IndexedVertexDomain(VertexDomain):
+ """Management of a set of indexed vertex lists.
+
+ Construction of an indexed vertex domain is usually done with the
+ :py:func:`create_domain` function.
+ """
+ _initial_index_count = 16
+
+ def __init__(self, program, attribute_meta, index_gl_type=GL_UNSIGNED_INT):
+ super(IndexedVertexDomain, self).__init__(program, attribute_meta)
+
+ self.index_allocator = allocation.Allocator(self._initial_index_count)
+
+ self.index_gl_type = index_gl_type
+ self.index_c_type = shader._c_types[index_gl_type]
+ self.index_element_size = ctypes.sizeof(self.index_c_type)
+ self.index_buffer = BufferObject(self.index_allocator.capacity * self.index_element_size)
+
+ def safe_index_alloc(self, count):
+ """Allocate indices, resizing the buffers if necessary."""
+ try:
+ return self.index_allocator.alloc(count)
+ except allocation.AllocatorMemoryException as e:
+ capacity = _nearest_pow2(e.requested_capacity)
+ self.version += 1
+ self.index_buffer.resize(capacity * self.index_element_size)
+ self.index_allocator.set_capacity(capacity)
+ return self.index_allocator.alloc(count)
+
+ def safe_index_realloc(self, start, count, new_count):
+ """Reallocate indices, resizing the buffers if necessary."""
+ try:
+ return self.index_allocator.realloc(start, count, new_count)
+ except allocation.AllocatorMemoryException as e:
+ capacity = _nearest_pow2(e.requested_capacity)
+ self.version += 1
+ self.index_buffer.resize(capacity * self.index_element_size)
+ self.index_allocator.set_capacity(capacity)
+ return self.index_allocator.realloc(start, count, new_count)
+
+ def create(self, count, index_count):
+ """Create an :py:class:`IndexedVertexList` in this domain.
+
+ :Parameters:
+ `count` : int
+ Number of vertices to create
+ `index_count`
+ Number of indices to create
+
+ """
+ start = self.safe_alloc(count)
+ index_start = self.safe_index_alloc(index_count)
+ return IndexedVertexList(self, start, count, index_start, index_count)
+
+ def get_index_region(self, start, count):
+ """Get a data from a region of the index buffer.
+
+ :Parameters:
+ `start` : int
+ Start of the region to map.
+ `count` : int
+ Number of indices to map.
+
+ :rtype: Array of int
+ """
+ byte_start = self.index_element_size * start
+ byte_count = self.index_element_size * count
+ ptr_type = ctypes.POINTER(self.index_c_type * count)
+ map_ptr = self.index_buffer.map_range(byte_start, byte_count, ptr_type)
+ data = map_ptr[:]
+ self.index_buffer.unmap()
+ return data
+
+ def set_index_region(self, start, count, data):
+ byte_start = self.index_element_size * start
+ byte_count = self.index_element_size * count
+ ptr_type = ctypes.POINTER(self.index_c_type * count)
+ map_ptr = self.index_buffer.map_range(byte_start, byte_count, ptr_type)
+ map_ptr[:] = data
+ self.index_buffer.unmap()
+
+ def draw(self, mode):
+ """Draw all vertices in the domain.
+
+ All vertices in the domain are drawn at once. This is the
+ most efficient way to render primitives.
+
+ :Parameters:
+ `mode` : int
+ OpenGL drawing mode, e.g. ``GL_POINTS``, ``GL_LINES``, etc.
+
+ """
+ self.vao.bind()
+
+ for buffer, attributes in self.buffer_attributes:
+ buffer.bind()
+ for attribute in attributes:
+ attribute.enable()
+ attribute.set_pointer(attribute.buffer.ptr)
+ self.index_buffer.bind_to_index_buffer()
+
+ starts, sizes = self.index_allocator.get_allocated_regions()
+ primcount = len(starts)
+ if primcount == 0:
+ pass
+ elif primcount == 1:
+ # Common case
+ glDrawElements(mode, sizes[0], self.index_gl_type,
+ self.index_buffer.ptr + starts[0] * self.index_element_size)
+ else:
+ starts = [s * self.index_element_size + self.index_buffer.ptr for s in starts]
+ starts = (ctypes.POINTER(GLvoid) * primcount)(*(GLintptr * primcount)(*starts))
+ sizes = (GLsizei * primcount)(*sizes)
+ glMultiDrawElements(mode, sizes, self.index_gl_type, starts, primcount)
+
+ self.index_buffer.unbind()
+ for buffer, _ in self.buffer_attributes:
+ buffer.unbind()
+
+ def draw_subset(self, mode, vertex_list):
+ """Draw a specific IndexedVertexList in the domain.
+
+ The `vertex_list` parameter specifies a :py:class:`IndexedVertexList`
+ to draw. Only primitives in that list will be drawn.
+
+ :Parameters:
+ `mode` : int
+ OpenGL drawing mode, e.g. ``GL_POINTS``, ``GL_LINES``, etc.
+ `vertex_list` : `IndexedVertexList`
+ Vertex list to draw.
+
+ """
+ self.vao.bind()
+
+ for buffer, attributes in self.buffer_attributes:
+ buffer.bind()
+ for attribute in attributes:
+ attribute.enable()
+ attribute.set_pointer(attribute.buffer.ptr)
+ self.index_buffer.bind_to_index_buffer()
+
+ glDrawElements(mode, vertex_list.index_count, self.index_gl_type,
+ self.index_buffer.ptr +
+ vertex_list.index_start * self.index_element_size)
+
+ self.index_buffer.unbind()
+ for buffer, _ in self.buffer_attributes:
+ buffer.unbind()
+
+
+class IndexedVertexList(VertexList):
+ """A list of vertices within an :py:class:`IndexedVertexDomain` that are
+ indexed. Use :py:meth:`IndexedVertexDomain.create` to construct this list.
+ """
+ _indices_cache = None
+ _indices_cache_version = None
+
+ def __init__(self, domain, start, count, index_start, index_count):
+ super().__init__(domain, start, count)
+ self.index_start = index_start
+ self.index_count = index_count
+
+ def resize(self, count, index_count):
+ """Resize this group.
+
+ :Parameters:
+ `count` : int
+ New number of vertices in the list.
+ `index_count` : int
+ New number of indices in the list.
+
+ """
+ old_start = self.start
+ super().resize(count)
+
+ # Change indices (because vertices moved)
+ if old_start != self.start:
+ diff = self.start - old_start
+ self.indices[:] = [i + diff for i in self.indices]
+
+ # Resize indices
+ new_start = self.domain.safe_index_realloc(self.index_start, self.index_count, index_count)
+ if new_start != self.index_start:
+ old = self.domain.get_index_region(self.index_start, self.index_count)
+ new = self.domain.get_index_region(self.index_start, self.index_count)
+ new.array[:] = old.array[:]
+ new.invalidate()
+
+ self.index_start = new_start
+ self.index_count = index_count
+ self._indices_cache_version = None
+
+ def delete(self):
+ """Delete this group."""
+ super().delete()
+ self.domain.index_allocator.dealloc(self.index_start, self.index_count)
+
+ def migrate(self, domain):
+ """Move this group from its current indexed domain and add to the
+ specified one. Attributes on domains must match. (In practice, used
+ to change parent state of some vertices).
+
+ :Parameters:
+ `domain` : `IndexedVertexDomain`
+ Indexed domain to migrate this vertex list to.
+
+ """
+ old_start = self.start
+ old_domain = self.domain
+ super().migrate(domain)
+
+ # Note: this code renumber the indices of the *original* domain
+ # because the vertices are in a new position in the new domain
+ if old_start != self.start:
+ diff = self.start - old_start
+ old_indices = old_domain.get_index_region(self.index_start, self.index_count)
+ old_domain.set_index_region(self.index_start, self.index_count, [i + diff for i in old_indices])
+
+ # copy indices to new domain
+ old_array = old_domain.get_index_region(self.index_start, self.index_count)
+ # must delloc before calling safe_index_alloc or else problems when same
+ # batch is migrated to because index_start changes after dealloc
+ old_domain.index_allocator.dealloc(self.index_start, self.index_count)
+
+ new_start = self.domain.safe_index_alloc(self.index_count)
+ self.domain.set_index_region(new_start, self.index_count, old_array)
+
+ self.index_start = new_start
+ self._indices_cache_version = None
+
+ @property
+ def indices(self):
+ """Array of index data."""
+ if self._indices_cache_version != self.domain.version:
+ domain = self.domain
+ self._indices_cache = domain.get_index_region(self.index_start, self.index_count)
+ self._indices_cache_version = domain.version
+
+ return self._indices_cache
+
+ @indices.setter
+ def indices(self, data):
+ self.domain.set_index_region(self.index_start, self.index_count, data)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gui/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gui/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..f5e5aebad799bfab0a8a9103a13464bfaa1e6742
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gui/__init__.py
@@ -0,0 +1,2 @@
+from .widgets import *
+from .frame import *
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gui/frame.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gui/frame.py
new file mode 100644
index 0000000000000000000000000000000000000000..5e51071a077c496238af98821092521cefbc1e7a
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gui/frame.py
@@ -0,0 +1,139 @@
+
+class Frame:
+ """The base Frame object, implementing a 2D spatial hash.
+
+ A `Frame` provides an efficient way to handle dispatching
+ keyboard and mouse events to Widgets. This is done by
+ implementing a 2D spatial hash. Only Widgets that are in the
+ vicinity of the mouse pointer will be passed Window events,
+ which can greatly improve efficiency when a large quantity
+ of Widgets are in use.
+ """
+
+ def __init__(self, window, cell_size=64, order=0):
+ """Create an instance of a Frame.
+
+ :Parameters:
+ `window` : `~pyglet.window.Window`
+ The SpatialHash will recieve events from this Window.
+ Appropriate events will be passed on to all added Widgets.
+ `cell_size` : int
+ The cell ("bucket") size for each cell in the hash.
+ Widgets may span multiple cells.
+ `order` : int
+ Widgets use internal OrderedGroups for draw sorting.
+ This is the base value for these Groups.
+ """
+ window.push_handlers(self)
+ self._cell_size = cell_size
+ self._cells = {}
+ self._active_widgets = set()
+ self._order = order
+ self._mouse_pos = 0, 0
+
+ def _hash(self, x, y):
+ """Normalize position to cell"""
+ return int(x / self._cell_size), int(y / self._cell_size)
+
+ def add_widget(self, widget):
+ """Add a Widget to the spatial hash."""
+ min_vec, max_vec = self._hash(*widget.aabb[0:2]), self._hash(*widget.aabb[2:4])
+ for i in range(min_vec[0], max_vec[0] + 1):
+ for j in range(min_vec[1], max_vec[1] + 1):
+ self._cells.setdefault((i, j), set()).add(widget)
+ widget.update_groups(self._order)
+
+ def remove_widget(self, widget):
+ """Remove a Widget from the spatial hash."""
+ min_vec, max_vec = self._hash(*widget.aabb[0:2]), self._hash(*widget.aabb[2:4])
+ for i in range(min_vec[0], max_vec[0] + 1):
+ for j in range(min_vec[1], max_vec[1] + 1):
+ self._cells.get((i, j)).remove(widget)
+
+ def on_mouse_press(self, x, y, buttons, modifiers):
+ """Pass the event to any widgets within range of the mouse"""
+ for widget in self._cells.get(self._hash(x, y), set()):
+ widget.on_mouse_press(x, y, buttons, modifiers)
+ self._active_widgets.add(widget)
+
+ def on_mouse_release(self, x, y, buttons, modifiers):
+ """Pass the event to any widgets that are currently active"""
+ for widget in self._active_widgets:
+ widget.on_mouse_release(x, y, buttons, modifiers)
+ self._active_widgets.clear()
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ """Pass the event to any widgets that are currently active"""
+ for widget in self._active_widgets:
+ widget.on_mouse_drag(x, y, dx, dy, buttons, modifiers)
+ self._mouse_pos = x, y
+
+ def on_mouse_scroll(self, x, y, index, direction):
+ """Pass the event to any widgets within range of the mouse"""
+ for widget in self._cells.get(self._hash(x, y), set()):
+ widget.on_mouse_scroll(x, y, index, direction)
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ """Pass the event to any widgets within range of the mouse"""
+ for widget in self._cells.get(self._hash(x, y), set()):
+ widget.on_mouse_motion(x, y, dx, dy)
+ self._mouse_pos = x, y
+
+ def on_text(self, text):
+ """Pass the event to any widgets within range of the mouse"""
+ for widget in self._cells.get(self._hash(*self._mouse_pos), set()):
+ widget.on_text(text)
+
+ def on_text_motion(self, motion):
+ """Pass the event to any widgets within range of the mouse"""
+ for widget in self._cells.get(self._hash(*self._mouse_pos), set()):
+ widget.on_text_motion(motion)
+
+ def on_text_motion_select(self, motion):
+ """Pass the event to any widgets within range of the mouse"""
+ for widget in self._cells.get(self._hash(*self._mouse_pos), set()):
+ widget.on_text_motion_select(motion)
+
+
+class MovableFrame(Frame):
+ """A Frame that allows Widget repositioning.
+
+ When a specified modifier key is held down, Widgets can be
+ repositioned by dragging them. Examples of modifier keys are
+ Ctrl, Alt, Shift. These are defined in the `pyglet.window.key`
+ module, and start witih `MOD_`. For example::
+
+ from pyglet.window.key import MOD_CTRL
+
+ frame = pyglet.gui.frame.MovableFrame(mywindow, modifier=MOD_CTRL)
+
+ For more information, see the `pyglet.window.key` submodule
+ API documentation.
+ """
+
+ def __init__(self, window, order=0, modifier=0):
+ super().__init__(window, order=order)
+ self._modifier = modifier
+ self._moving_widgets = set()
+
+ def on_mouse_press(self, x, y, buttons, modifiers):
+ if self._modifier & modifiers > 0:
+ for widget in self._cells.get(self._hash(x, y), set()):
+ if widget._check_hit(x, y):
+ self._moving_widgets.add(widget)
+ for widget in self._moving_widgets:
+ self.remove_widget(widget)
+ else:
+ super().on_mouse_press(x, y, buttons, modifiers)
+
+ def on_mouse_release(self, x, y, buttons, modifiers):
+ for widget in self._moving_widgets:
+ self.add_widget(widget)
+ self._moving_widgets.clear()
+ super().on_mouse_release(x, y, buttons, modifiers)
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ for widget in self._moving_widgets:
+ wx, wy = widget.position
+ widget.position = wx + dx, wy + dy
+ super().on_mouse_drag(x, y, dx, dy, buttons, modifiers)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gui/widgets.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gui/widgets.py
new file mode 100644
index 0000000000000000000000000000000000000000..f72b0085242d73402c98550ea6bc744303d22bdc
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/gui/widgets.py
@@ -0,0 +1,494 @@
+"""Display different types of interactive widgets.
+"""
+
+import pyglet
+
+from pyglet.event import EventDispatcher
+from pyglet.graphics import Group
+from pyglet.text.caret import Caret
+from pyglet.text.layout import IncrementalTextLayout
+
+
+class WidgetBase(EventDispatcher):
+
+ def __init__(self, x, y, width, height):
+ self._x = x
+ self._y = y
+ self._width = width
+ self._height = height
+ self._bg_group = None
+ self._fg_group = None
+ self.enabled = True
+
+ def update_groups(self, order):
+ pass
+
+ @property
+ def x(self):
+ """X coordinate of the widget.
+
+ :type: int
+ """
+ return self._x
+
+ @x.setter
+ def x(self, value):
+ self._x = value
+ self._update_position()
+
+ @property
+ def y(self):
+ """Y coordinate of the widget.
+
+ :type: int
+ """
+ return self._y
+
+ @y.setter
+ def y(self, value):
+ self._y = value
+ self._update_position()
+
+ @property
+ def position(self):
+ """The x, y coordinate of the widget as a tuple.
+
+ :type: tuple(int, int)
+ """
+ return self._x, self._y
+
+ @position.setter
+ def position(self, values):
+ self._x, self._y = values
+ self._update_position()
+
+ @property
+ def width(self):
+ """Width of the widget.
+
+ :type: int
+ """
+ return self._width
+
+ @property
+ def height(self):
+ """Height of the widget.
+
+ :type: int
+ """
+ return self._height
+
+ @property
+ def aabb(self):
+ """Bounding box of the widget.
+
+ Expressed as (x, y, x + width, y + height)
+
+ :type: (int, int, int, int)
+ """
+ return self._x, self._y, self._x + self._width, self._y + self._height
+
+ @property
+ def value(self):
+ """Query or set the Widget's value.
+
+ This property allows you to set the value of a Widget directly, without any
+ user input. This could be used, for example, to restore Widgets to a
+ previous state, or if some event in your program is meant to naturally
+ change the same value that the Widget controls. Note that events are not
+ dispatched when changing this property.
+ """
+ raise NotImplementedError("Value depends on control type!")
+
+ @value.setter
+ def value(self, value):
+ raise NotImplementedError("Value depends on control type!")
+
+ def _check_hit(self, x, y):
+ return self._x < x < self._x + self._width and self._y < y < self._y + self._height
+
+ def _update_position(self):
+ raise NotImplementedError("Unable to reposition this Widget")
+
+ def on_mouse_press(self, x, y, buttons, modifiers):
+ pass
+
+ def on_mouse_release(self, x, y, buttons, modifiers):
+ pass
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ pass
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ pass
+
+ def on_mouse_scroll(self, x, y, mouse, direction):
+ pass
+
+ def on_text(self, text):
+ pass
+
+ def on_text_motion(self, motion):
+ pass
+
+ def on_text_motion_select(self, motion):
+ pass
+
+
+class PushButton(WidgetBase):
+ """Instance of a push button.
+
+ Triggers the event 'on_press' when it is clicked by the mouse.
+ Triggers the event 'on_release' when the mouse is released.
+ """
+
+ def __init__(self, x, y, pressed, depressed, hover=None, batch=None, group=None):
+ """Create a push button.
+
+ :Parameters:
+ `x` : int
+ X coordinate of the push button.
+ `y` : int
+ Y coordinate of the push button.
+ `pressed` : `~pyglet.image.AbstractImage`
+ Image to display when the button is pressed.
+ `depresseed` : `~pyglet.image.AbstractImage`
+ Image to display when the button isn't pressed.
+ `hover` : `~pyglet.image.AbstractImage`
+ Image to display when the button is being hovered over.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the push button to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the push button.
+ """
+ super().__init__(x, y, depressed.width, depressed.height)
+ self._pressed_img = pressed
+ self._depressed_img = depressed
+ self._hover_img = hover or depressed
+
+ # TODO: add `draw` method or make Batch required.
+ self._batch = batch or pyglet.graphics.Batch()
+ self._user_group = group
+ bg_group = Group(order=0, parent=group)
+ self._sprite = pyglet.sprite.Sprite(self._depressed_img, x, y, batch=batch, group=bg_group)
+
+ self._pressed = False
+
+ def _update_position(self):
+ self._sprite.position = self._x, self._y, 0
+
+ @property
+ def value(self):
+ return self._pressed
+
+ @value.setter
+ def value(self, value):
+ assert type(value) is bool, "This Widget's value must be True or False."
+ self._pressed = value
+ self._sprite.image = self._pressed_img if self._pressed else self._depressed_img
+
+ def update_groups(self, order):
+ self._sprite.group = Group(order=order + 1, parent=self._user_group)
+
+ def on_mouse_press(self, x, y, buttons, modifiers):
+ if not self.enabled or not self._check_hit(x, y):
+ return
+ self._sprite.image = self._pressed_img
+ self._pressed = True
+ self.dispatch_event('on_press')
+
+ def on_mouse_release(self, x, y, buttons, modifiers):
+ if not self.enabled or not self._pressed:
+ return
+ self._sprite.image = self._hover_img if self._check_hit(x, y) else self._depressed_img
+ self._pressed = False
+ self.dispatch_event('on_release')
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ if not self.enabled or self._pressed:
+ return
+ self._sprite.image = self._hover_img if self._check_hit(x, y) else self._depressed_img
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ if not self.enabled or self._pressed:
+ return
+ self._sprite.image = self._hover_img if self._check_hit(x, y) else self._depressed_img
+
+
+PushButton.register_event_type('on_press')
+PushButton.register_event_type('on_release')
+
+
+class ToggleButton(PushButton):
+ """Instance of a toggle button.
+
+ Triggers the event 'on_toggle' when the mouse is pressed or released.
+ """
+
+ def _get_release_image(self, x, y):
+ return self._hover_img if self._check_hit(x, y) else self._depressed_img
+
+ def on_mouse_press(self, x, y, buttons, modifiers):
+ if not self.enabled or not self._check_hit(x, y):
+ return
+ self._pressed = not self._pressed
+ self._sprite.image = self._pressed_img if self._pressed else self._get_release_image(x, y)
+ self.dispatch_event('on_toggle', self._pressed)
+
+ def on_mouse_release(self, x, y, buttons, modifiers):
+ if not self.enabled or self._pressed:
+ return
+ self._sprite.image = self._get_release_image(x, y)
+
+
+ToggleButton.register_event_type('on_toggle')
+
+
+class Slider(WidgetBase):
+ """Instance of a slider made of a base and a knob image.
+
+ Triggers the event 'on_change' when the knob position is changed.
+ The knob position can be changed by dragging with the mouse, or
+ scrolling the mouse wheel.
+ """
+
+ def __init__(self, x, y, base, knob, edge=0, batch=None, group=None):
+ """Create a slider.
+
+ :Parameters:
+ `x` : int
+ X coordinate of the slider.
+ `y` : int
+ Y coordinate of the slider.
+ `base` : `~pyglet.image.AbstractImage`
+ Image to display as the background to the slider.
+ `knob` : `~pyglet.image.AbstractImage`
+ Knob that moves to show the position of the slider.
+ `edge` : int
+ Pixels from the maximum and minimum position of the slider,
+ to the edge of the base image.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the slider to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the slider.
+ """
+ super().__init__(x, y, base.width, knob.height)
+ self._edge = edge
+ self._base_img = base
+ self._knob_img = knob
+ self._half_knob_width = knob.width / 2
+ self._half_knob_height = knob.height / 2
+ self._knob_img.anchor_y = knob.height / 2
+
+ self._min_knob_x = x + edge
+ self._max_knob_x = x + base.width - knob.width - edge
+
+ self._user_group = group
+ bg_group = Group(order=0, parent=group)
+ fg_group = Group(order=1, parent=group)
+ self._base_spr = pyglet.sprite.Sprite(self._base_img, x, y, batch=batch, group=bg_group)
+ self._knob_spr = pyglet.sprite.Sprite(self._knob_img, x+edge, y+base.height/2, batch=batch, group=fg_group)
+
+ self._value = 0
+ self._in_update = False
+
+ def _update_position(self):
+ self._base_spr.position = self._x, self._y, 0
+ self._knob_spr.position = self._x + self._edge, self._y + self._base_img.height / 2, 0
+
+ @property
+ def value(self):
+ return self._value
+
+ @value.setter
+ def value(self, value):
+ assert type(value) in (int, float), "This Widget's value must be an int or float."
+ self._value = value
+ x = (self._max_knob_x - self._min_knob_x) * value / 100 + self._min_knob_x + self._half_knob_width
+ self._knob_spr.x = max(self._min_knob_x, min(x - self._half_knob_width, self._max_knob_x))
+
+ def update_groups(self, order):
+ self._base_spr.group = Group(order=order + 1, parent=self._user_group)
+ self._knob_spr.group = Group(order=order + 2, parent=self._user_group)
+
+ @property
+ def _min_x(self):
+ return self._x + self._edge
+
+ @property
+ def _max_x(self):
+ return self._x + self._width - self._edge
+
+ @property
+ def _min_y(self):
+ return self._y - self._half_knob_height
+
+ @property
+ def _max_y(self):
+ return self._y + self._half_knob_height + self._base_img.height / 2
+
+ def _check_hit(self, x, y):
+ return self._min_x < x < self._max_x and self._min_y < y < self._max_y
+
+ def _update_knob(self, x):
+ self._knob_spr.x = max(self._min_knob_x, min(x - self._half_knob_width, self._max_knob_x))
+ self._value = abs(((self._knob_spr.x - self._min_knob_x) * 100) / (self._min_knob_x - self._max_knob_x))
+ self.dispatch_event('on_change', self._value)
+
+ def on_mouse_press(self, x, y, buttons, modifiers):
+ if not self.enabled:
+ return
+ if self._check_hit(x, y):
+ self._in_update = True
+ self._update_knob(x)
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ if not self.enabled:
+ return
+ if self._in_update:
+ self._update_knob(x)
+
+ def on_mouse_scroll(self, x, y, mouse, direction):
+ if not self.enabled:
+ return
+ if self._check_hit(x, y):
+ self._update_knob(self._knob_spr.x + self._half_knob_width + direction)
+
+ def on_mouse_release(self, x, y, buttons, modifiers):
+ if not self.enabled:
+ return
+ self._in_update = False
+
+
+Slider.register_event_type('on_change')
+
+
+class TextEntry(WidgetBase):
+ """Instance of a text entry widget.
+
+ Allows the user to enter and submit text.
+ """
+
+ def __init__(self, text, x, y, width,
+ color=(255, 255, 255, 255), text_color=(0, 0, 0, 255), caret_color=(0, 0, 0),
+ batch=None, group=None):
+ """Create a text entry widget.
+
+ :Parameters:
+ `text` : str
+ Initial text to display.
+ `x` : int
+ X coordinate of the text entry widget.
+ `y` : int
+ Y coordinate of the text entry widget.
+ `width` : int
+ The width of the text entry widget.
+ `color` : (int, int, int, int)
+ The color of the outline box in RGBA format.
+ `text_color` : (int, int, int, int)
+ The color of the text in RGBA format.
+ `caret_color` : (int, int, int)
+ The color of the caret in RGB format.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the text entry widget to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of text entry widget.
+ """
+ self._doc = pyglet.text.document.UnformattedDocument(text)
+ self._doc.set_style(0, len(self._doc.text), dict(color=text_color))
+ font = self._doc.get_font()
+ height = font.ascent - font.descent
+
+ self._user_group = group
+ bg_group = Group(order=0, parent=group)
+ fg_group = Group(order=1, parent=group)
+
+ # Rectangular outline with 2-pixel pad:
+ self._pad = p = 2
+ self._outline = pyglet.shapes.Rectangle(x-p, y-p, width+p+p, height+p+p, color[:3], batch, bg_group)
+ self._outline.opacity = color[3]
+
+ # Text and Caret:
+ self._layout = IncrementalTextLayout(self._doc, width, height, multiline=False, batch=batch, group=fg_group)
+ self._layout.x = x
+ self._layout.y = y
+ self._caret = Caret(self._layout, color=caret_color)
+ self._caret.visible = False
+
+ self._focus = False
+
+ super().__init__(x, y, width, height)
+
+ def _update_position(self):
+ self._layout.position = self._x, self._y, 0
+ self._outline.position = self._x - self._pad, self._y - self._pad
+
+ @property
+ def value(self):
+ return self._doc.text
+
+ @value.setter
+ def value(self, value):
+ assert type(value) is str, "This Widget's value must be a string."
+ self._doc.text = value
+
+ def _check_hit(self, x, y):
+ return self._x < x < self._x + self._width and self._y < y < self._y + self._height
+
+ def _set_focus(self, value):
+ self._focus = value
+ self._caret.visible = value
+
+ def update_groups(self, order):
+ self._outline.group = Group(order=order + 1, parent=self._user_group)
+ self._layout.group = Group(order=order + 2, parent=self._user_group)
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ if not self.enabled:
+ return
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ if not self.enabled:
+ return
+ if self._focus:
+ self._caret.on_mouse_drag(x, y, dx, dy, buttons, modifiers)
+
+ def on_mouse_press(self, x, y, buttons, modifiers):
+ if not self.enabled:
+ return
+ if self._check_hit(x, y):
+ self._set_focus(True)
+ self._caret.on_mouse_press(x, y, buttons, modifiers)
+ else:
+ self._set_focus(False)
+
+ def on_text(self, text):
+ if not self.enabled:
+ return
+ if self._focus:
+ # Commit on Enter/Return:
+ if text in ('\r', '\n'):
+ self.dispatch_event('on_commit', self._layout.document.text)
+ self._set_focus(False)
+ return
+ self._caret.on_text(text)
+
+ def on_text_motion(self, motion):
+ if not self.enabled:
+ return
+ if self._focus:
+ self._caret.on_text_motion(motion)
+
+ def on_text_motion_select(self, motion):
+ if not self.enabled:
+ return
+ if self._focus:
+ self._caret.on_text_motion_select(motion)
+
+ def on_commit(self, text):
+ if not self.enabled:
+ return
+ """Text has been commited via Enter/Return key."""
+
+
+TextEntry.register_event_type('on_commit')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..9ccd1697e14de00df62a8f2debbc17810c979798
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/__init__.py
@@ -0,0 +1,2152 @@
+"""Image load, capture and high-level texture functions.
+
+Only basic functionality is described here; for full reference see the
+accompanying documentation.
+
+To load an image::
+
+ from pyglet import image
+ pic = image.load('picture.png')
+
+The supported image file types include PNG, BMP, GIF, JPG, and many more,
+somewhat depending on the operating system. To load an image from a file-like
+object instead of a filename::
+
+ pic = image.load('hint.jpg', file=fileobj)
+
+The hint helps the module locate an appropriate decoder to use based on the
+file extension. It is optional.
+
+Once loaded, images can be used directly by most other modules of pyglet. All
+images have a width and height you can access::
+
+ width, height = pic.width, pic.height
+
+You can extract a region of an image (this keeps the original image intact;
+the memory is shared efficiently)::
+
+ subimage = pic.get_region(x, y, width, height)
+
+Remember that y-coordinates are always increasing upwards.
+
+Drawing images
+--------------
+
+To draw an image at some point on the screen::
+
+ pic.blit(x, y, z)
+
+This assumes an appropriate view transform and projection have been applied.
+
+Some images have an intrinsic "anchor point": this is the point which will be
+aligned to the ``x`` and ``y`` coordinates when the image is drawn. By
+default the anchor point is the lower-left corner of the image. You can use
+the anchor point to center an image at a given point, for example::
+
+ pic.anchor_x = pic.width // 2
+ pic.anchor_y = pic.height // 2
+ pic.blit(x, y, z)
+
+Texture access
+--------------
+
+If you are using OpenGL directly, you can access the image as a texture::
+
+ texture = pic.get_texture()
+
+(This is the most efficient way to obtain a texture; some images are
+immediately loaded as textures, whereas others go through an intermediate
+form). To use a texture with pyglet.gl::
+
+ from pyglet.gl import *
+ glEnable(texture.target) # typically target is GL_TEXTURE_2D
+ glBindTexture(texture.target, texture.id)
+ # ... draw with the texture
+
+Pixel access
+------------
+
+To access raw pixel data of an image::
+
+ rawimage = pic.get_image_data()
+
+(If the image has just been loaded this will be a very quick operation;
+however if the image is a texture a relatively expensive readback operation
+will occur). The pixels can be accessed as a string::
+
+ format = 'RGBA'
+ pitch = rawimage.width * len(format)
+ pixels = rawimage.get_data(format, pitch)
+
+"format" strings consist of characters that give the byte order of each color
+component. For example, if rawimage.format is 'RGBA', there are four color
+components: red, green, blue and alpha, in that order. Other common format
+strings are 'RGB', 'LA' (luminance, alpha) and 'I' (intensity).
+
+The "pitch" of an image is the number of bytes in a row (this may validly be
+more than the number required to make up the width of the image, it is common
+to see this for word alignment). If "pitch" is negative the rows of the image
+are ordered from top to bottom, otherwise they are ordered from bottom to top.
+
+Retrieving data with the format and pitch given in `ImageData.format` and
+`ImageData.pitch` avoids the need for data conversion (assuming you can make
+use of the data in this arbitrary format).
+
+"""
+import re
+import weakref
+
+from ctypes import *
+from io import open, BytesIO
+
+import pyglet
+
+from pyglet.gl import *
+from pyglet.gl import gl_info
+from pyglet.util import asbytes
+
+from .codecs import ImageEncodeException, ImageDecodeException
+from .codecs import registry as _codec_registry
+from .codecs import add_default_codecs as _add_default_codecs
+
+from .animation import Animation, AnimationFrame
+from .buffer import *
+from . import atlas
+
+
+class ImageException(Exception):
+ pass
+
+
+def load(filename, file=None, decoder=None):
+ """Load an image from a file.
+
+ :note: You can make no assumptions about the return type; usually it will
+ be ImageData or CompressedImageData, but decoders are free to return
+ any subclass of AbstractImage.
+
+ :Parameters:
+ `filename` : str
+ Used to guess the image format, and to load the file if `file` is
+ unspecified.
+ `file` : file-like object or None
+ Source of image data in any supported format.
+ `decoder` : ImageDecoder or None
+ If unspecified, all decoders that are registered for the filename
+ extension are tried. If none succeed, the exception from the
+ first decoder is raised.
+
+ :rtype: AbstractImage
+ """
+ if decoder:
+ return decoder.decode(filename, file)
+ else:
+ return _codec_registry.decode(filename, file)
+
+
+def load_animation(filename, file=None, decoder=None):
+ """Load an animation from a file.
+
+ Currently, the only supported format is GIF.
+
+ :Parameters:
+ `filename` : str
+ Used to guess the animation format, and to load the file if `file`
+ is unspecified.
+ `file` : file-like object or None
+ File object containing the animation stream.
+ `decoder` : ImageDecoder or None
+ If unspecified, all decoders that are registered for the filename
+ extension are tried. If none succeed, the exception from the
+ first decoder is raised.
+
+ :rtype: Animation
+ """
+ if decoder:
+ return decoder.decode_animation(filename, file)
+ else:
+ return _codec_registry.decode_animation(filename, file)
+
+
+def create(width, height, pattern=None):
+ """Create an image optionally filled with the given pattern.
+
+ :note: You can make no assumptions about the return type; usually it will
+ be ImageData or CompressedImageData, but patterns are free to return
+ any subclass of AbstractImage.
+
+ :Parameters:
+ `width` : int
+ Width of image to create
+ `height` : int
+ Height of image to create
+ `pattern` : ImagePattern or None
+ Pattern to fill image with. If unspecified, the image will
+ initially be transparent.
+
+ :rtype: AbstractImage
+ """
+ if not pattern:
+ pattern = SolidColorImagePattern()
+ return pattern.create_image(width, height)
+
+
+def get_max_texture_size():
+ """Query the maximum texture size available"""
+ size = c_int()
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, size)
+ return size.value
+
+
+def get_max_array_texture_layers():
+ """Query the maximum TextureArray depth"""
+ max_layers = c_int()
+ glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, max_layers)
+ return max_layers.value
+
+
+def _color_as_bytes(color):
+ if len(color) != 4:
+ raise TypeError("color is expected to have 4 components")
+ return bytes(color)
+
+
+class ImagePattern:
+ """Abstract image creation class."""
+
+ def create_image(self, width, height):
+ """Create an image of the given size.
+
+ :Parameters:
+ `width` : int
+ Width of image to create
+ `height` : int
+ Height of image to create
+
+ :rtype: AbstractImage
+ """
+ raise NotImplementedError('abstract')
+
+
+class SolidColorImagePattern(ImagePattern):
+ """Creates an image filled with a solid color."""
+
+ def __init__(self, color=(0, 0, 0, 0)):
+ """Create a solid image pattern with the given color.
+
+ :Parameters:
+ `color` : (int, int, int, int)
+ 4-tuple of ints in range [0,255] giving RGBA components of
+ color to fill with.
+
+ """
+ self.color = _color_as_bytes(color)
+
+ def create_image(self, width, height):
+ data = self.color * width * height
+ return ImageData(width, height, 'RGBA', data)
+
+
+class CheckerImagePattern(ImagePattern):
+ """Create an image with a tileable checker image.
+ """
+
+ def __init__(self, color1=(150, 150, 150, 255), color2=(200, 200, 200, 255)):
+ """Initialise with the given colors.
+
+ :Parameters:
+ `color1` : (int, int, int, int)
+ 4-tuple of ints in range [0,255] giving RGBA components of
+ color to fill with. This color appears in the top-left and
+ bottom-right corners of the image.
+ `color2` : (int, int, int, int)
+ 4-tuple of ints in range [0,255] giving RGBA components of
+ color to fill with. This color appears in the top-right and
+ bottom-left corners of the image.
+
+ """
+ self.color1 = _color_as_bytes(color1)
+ self.color2 = _color_as_bytes(color2)
+
+ def create_image(self, width, height):
+ hw = width // 2
+ hh = height // 2
+ row1 = self.color1 * hw + self.color2 * hw
+ row2 = self.color2 * hw + self.color1 * hw
+ data = row1 * hh + row2 * hh
+ return ImageData(width, height, 'RGBA', data)
+
+
+class AbstractImage:
+ """Abstract class representing an image.
+
+ :Parameters:
+ `width` : int
+ Width of image
+ `height` : int
+ Height of image
+ `anchor_x` : int
+ X coordinate of anchor, relative to left edge of image data
+ `anchor_y` : int
+ Y coordinate of anchor, relative to bottom edge of image data
+ """
+ anchor_x = 0
+ anchor_y = 0
+
+ def __init__(self, width, height):
+ self.width = width
+ self.height = height
+
+ def __repr__(self):
+ return "{}(size={}x{})".format(self.__class__.__name__, self.width, self.height)
+
+ def get_image_data(self):
+ """Get an ImageData view of this image.
+
+ Changes to the returned instance may or may not be reflected in this
+ image.
+
+ :rtype: :py:class:`~pyglet.image.ImageData`
+
+ .. versionadded:: 1.1
+ """
+ raise ImageException('Cannot retrieve image data for %r' % self)
+
+ def get_texture(self, rectangle=False):
+ """A :py:class:`~pyglet.image.Texture` view of this image.
+
+ :Parameters:
+ `rectangle` : bool
+ Unused. Kept for compatibility.
+
+ .. versionadded:: 1.1.4.
+ :rtype: :py:class:`~pyglet.image.Texture`
+
+ .. versionadded:: 1.1
+ """
+ raise ImageException('Cannot retrieve texture for %r' % self)
+
+ def get_mipmapped_texture(self):
+ """Retrieve a :py:class:`~pyglet.image.Texture` instance with all mipmap levels filled in.
+
+ :rtype: :py:class:`~pyglet.image.Texture`
+
+ .. versionadded:: 1.1
+ """
+ raise ImageException('Cannot retrieve mipmapped texture for %r' % self)
+
+ def get_region(self, x, y, width, height):
+ """Retrieve a rectangular region of this image.
+
+ :Parameters:
+ `x` : int
+ Left edge of region.
+ `y` : int
+ Bottom edge of region.
+ `width` : int
+ Width of region.
+ `height` : int
+ Height of region.
+
+ :rtype: AbstractImage
+ """
+ raise ImageException('Cannot get region for %r' % self)
+
+ def save(self, filename=None, file=None, encoder=None):
+ """Save this image to a file.
+
+ :Parameters:
+ `filename` : str
+ Used to set the image file format, and to open the output file
+ if `file` is unspecified.
+ `file` : file-like object or None
+ File to write image data to.
+ `encoder` : ImageEncoder or None
+ If unspecified, all encoders matching the filename extension
+ are tried. If all fail, the exception from the first one
+ attempted is raised.
+
+ """
+ if not file:
+ file = open(filename, 'wb')
+
+ if encoder:
+ encoder.encode(self, filename, file)
+ else:
+ first_exception = None
+ for encoder in _codec_registry.get_encoders(filename):
+ try:
+ return encoder.encode(self, filename, file)
+ except ImageEncodeException as e:
+ first_exception = first_exception or e
+ file.seek(0)
+
+ if not first_exception:
+ raise ImageEncodeException('No image encoders are available')
+ raise first_exception
+
+ def blit(self, x, y, z=0):
+ """Draw this image to the active framebuffers.
+
+ The image will be drawn with the lower-left corner at
+ (``x -`` `anchor_x`, ``y -`` `anchor_y`, ``z``).
+ """
+ raise ImageException('Cannot blit %r.' % self)
+
+ def blit_into(self, source, x, y, z):
+ """Draw `source` on this image.
+
+ `source` will be copied into this image such that its anchor point
+ is aligned with the `x` and `y` parameters. If this image is a 3D
+ texture, the `z` coordinate gives the image slice to copy into.
+
+ Note that if `source` is larger than this image (or the positioning
+ would cause the copy to go out of bounds) then you must pass a
+ region of `source` to this method, typically using get_region().
+ """
+ raise ImageException('Cannot blit images onto %r.' % self)
+
+ def blit_to_texture(self, target, level, x, y, z=0):
+ """Draw this image on the currently bound texture at `target`.
+
+ This image is copied into the texture such that this image's anchor
+ point is aligned with the given `x` and `y` coordinates of the
+ destination texture. If the currently bound texture is a 3D texture,
+ the `z` coordinate gives the image slice to blit into.
+ """
+ raise ImageException('Cannot blit %r to a texture.' % self)
+
+
+class AbstractImageSequence:
+ """Abstract sequence of images.
+
+ The sequence is useful for storing image animations or slices of a volume.
+ For efficient access, use the `texture_sequence` member. The class
+ also implements the sequence interface (`__len__`, `__getitem__`,
+ `__setitem__`).
+ """
+
+ def get_texture_sequence(self):
+ """Get a TextureSequence.
+
+ :rtype: `TextureSequence`
+
+ .. versionadded:: 1.1
+ """
+ raise NotImplementedError('abstract')
+
+ def get_animation(self, period, loop=True):
+ """Create an animation over this image sequence for the given constant
+ framerate.
+
+ :Parameters
+ `period` : float
+ Number of seconds to display each frame.
+ `loop` : bool
+ If True, the animation will loop continuously.
+
+ :rtype: :py:class:`~pyglet.image.Animation`
+
+ .. versionadded:: 1.1
+ """
+ return Animation.from_image_sequence(self, period, loop)
+
+ def __getitem__(self, slice):
+ """Retrieve a (list of) image.
+
+ :rtype: AbstractImage
+ """
+ raise NotImplementedError('abstract')
+
+ def __setitem__(self, slice, image):
+ """Replace one or more images in the sequence.
+
+ :Parameters:
+ `image` : `~pyglet.image.AbstractImage`
+ The replacement image. The actual instance may not be used,
+ depending on this implementation.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def __len__(self):
+ raise NotImplementedError('abstract')
+
+ def __iter__(self):
+ """Iterate over the images in sequence.
+
+ :rtype: Iterator
+
+ .. versionadded:: 1.1
+ """
+ raise NotImplementedError('abstract')
+
+
+class TextureSequence(AbstractImageSequence):
+ """Interface for a sequence of textures.
+
+ Typical implementations store multiple :py:class:`~pyglet.image.TextureRegion` s within one
+ :py:class:`~pyglet.image.Texture` so as to minimise state changes.
+ """
+
+ def get_texture_sequence(self):
+ return self
+
+
+class UniformTextureSequence(TextureSequence):
+ """Interface for a sequence of textures, each with the same dimensions.
+
+ :Parameters:
+ `item_width` : int
+ Width of each texture in the sequence.
+ `item_height` : int
+ Height of each texture in the sequence.
+
+ """
+
+ def _get_item_width(self):
+ raise NotImplementedError('abstract')
+
+ def _get_item_height(self):
+ raise NotImplementedError('abstract')
+
+ @property
+ def item_width(self):
+ return self._get_item_width()
+
+ @property
+ def item_height(self):
+ return self._get_item_height()
+
+
+class ImageData(AbstractImage):
+ """An image represented as a string of unsigned bytes.
+
+ :Parameters:
+ `data` : str
+ Pixel data, encoded according to `format` and `pitch`.
+ `format` : str
+ The format string to use when reading or writing `data`.
+ `pitch` : int
+ Number of bytes per row. Negative values indicate a top-to-bottom
+ arrangement.
+
+ """
+ _swap1_pattern = re.compile(asbytes('(.)'), re.DOTALL)
+ _swap2_pattern = re.compile(asbytes('(.)(.)'), re.DOTALL)
+ _swap3_pattern = re.compile(asbytes('(.)(.)(.)'), re.DOTALL)
+ _swap4_pattern = re.compile(asbytes('(.)(.)(.)(.)'), re.DOTALL)
+
+ _current_texture = None
+ _current_mipmap_texture = None
+
+ def __init__(self, width, height, fmt, data, pitch=None):
+ """Initialise image data.
+
+ :Parameters:
+ `width` : int
+ Width of image data
+ `height` : int
+ Height of image data
+ `fmt` : str
+ A valid format string, such as 'RGB', 'RGBA', 'ARGB', etc.
+ `data` : sequence
+ String or array/list of bytes giving the decoded data.
+ `pitch` : int or None
+ If specified, the number of bytes per row. Negative values
+ indicate a top-to-bottom arrangement. Defaults to
+ ``width * len(format)``.
+
+ """
+ super().__init__(width, height)
+
+ self._current_format = self._desired_format = fmt.upper()
+ self._current_data = data
+ self.pitch = pitch or width * len(fmt)
+ self._current_pitch = self.pitch
+ self.mipmap_images = []
+
+ def __getstate__(self):
+ return {
+ 'width': self.width,
+ 'height': self.height,
+ '_current_data': self.get_data(self._current_format, self._current_pitch),
+ '_current_format': self._current_format,
+ '_desired_format': self._desired_format,
+ '_current_pitch': self._current_pitch,
+ 'pitch': self.pitch,
+ 'mipmap_images': self.mipmap_images
+ }
+
+ def get_image_data(self):
+ return self
+
+ @property
+ def format(self):
+ """Format string of the data. Read-write.
+
+ :type: str
+ """
+ return self._desired_format
+
+ @format.setter
+ def format(self, fmt):
+ self._desired_format = fmt.upper()
+ self._current_texture = None
+
+ def get_data(self, fmt=None, pitch=None):
+ """Get the byte data of the image.
+
+ :Parameters:
+ `fmt` : str
+ Format string of the return data.
+ `pitch` : int
+ Number of bytes per row. Negative values indicate a
+ top-to-bottom arrangement.
+
+ .. versionadded:: 1.1
+
+ :rtype: sequence of bytes, or str
+ """
+ fmt = fmt or self._desired_format
+ pitch = pitch or self._current_pitch
+
+ if fmt == self._current_format and pitch == self._current_pitch:
+ return self._current_data
+ return self._convert(fmt, pitch)
+
+ def set_data(self, fmt, pitch, data):
+ """Set the byte data of the image.
+
+ :Parameters:
+ `fmt` : str
+ Format string of the return data.
+ `pitch` : int
+ Number of bytes per row. Negative values indicate a
+ top-to-bottom arrangement.
+ `data` : str or sequence of bytes
+ Image data.
+
+ .. versionadded:: 1.1
+ """
+ self._current_format = fmt
+ self._current_pitch = pitch
+ self._current_data = data
+ self._current_texture = None
+ self._current_mipmap_texture = None
+
+ def set_mipmap_image(self, level, image):
+ """Set a mipmap image for a particular level.
+
+ The mipmap image will be applied to textures obtained via
+ `get_mipmapped_texture`.
+
+ :Parameters:
+ `level` : int
+ Mipmap level to set image at, must be >= 1.
+ `image` : AbstractImage
+ Image to set. Must have correct dimensions for that mipmap
+ level (i.e., width >> level, height >> level)
+ """
+
+ if level == 0:
+ raise ImageException('Cannot set mipmap image at level 0 (it is this image)')
+
+ # Check dimensions of mipmap
+ width, height = self.width, self.height
+ for i in range(level):
+ width >>= 1
+ height >>= 1
+ if width != image.width or height != image.height:
+ raise ImageException('Mipmap image has wrong dimensions for level %d' % level)
+
+ # Extend mipmap_images list to required level
+ self.mipmap_images += [None] * (level - len(self.mipmap_images))
+ self.mipmap_images[level - 1] = image
+
+ def create_texture(self, cls, rectangle=False):
+ """Create a texture containing this image.
+
+ :Parameters:
+ `cls` : class (subclass of Texture)
+ Class to construct.
+ `rectangle` : bool
+ Unused. kept for compatibility.
+
+ .. versionadded:: 1.1
+
+ :rtype: cls or cls.region_class
+ """
+ internalformat = self._get_internalformat(self._desired_format)
+ texture = cls.create(self.width, self.height, GL_TEXTURE_2D, internalformat, False, blank_data=False)
+ if self.anchor_x or self.anchor_y:
+ texture.anchor_x = self.anchor_x
+ texture.anchor_y = self.anchor_y
+
+ self.blit_to_texture(texture.target, texture.level, self.anchor_x, self.anchor_y, 0, None)
+
+ return texture
+
+ def get_texture(self, rectangle=False):
+ if not self._current_texture:
+ self._current_texture = self.create_texture(Texture, rectangle)
+ return self._current_texture
+
+ def get_mipmapped_texture(self):
+ """Return a Texture with mipmaps.
+
+ If :py:class:`~pyglet.image.set_mipmap_Image` has been called with at least one image, the set
+ of images defined will be used. Otherwise, mipmaps will be
+ automatically generated.
+
+ :rtype: :py:class:`~pyglet.image.Texture`
+
+ .. versionadded:: 1.1
+ """
+ if self._current_mipmap_texture:
+ return self._current_mipmap_texture
+
+ texture = Texture.create(self.width, self.height, GL_TEXTURE_2D, None, blank_data=False)
+ if self.anchor_x or self.anchor_y:
+ texture.anchor_x = self.anchor_x
+ texture.anchor_y = self.anchor_y
+
+ internalformat = self._get_internalformat(self.format)
+
+ glBindTexture(texture.target, texture.id)
+ glTexParameteri(texture.target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)
+
+ if self.mipmap_images:
+ self.blit_to_texture(texture.target, texture.level, self.anchor_x, self.anchor_y, 0, internalformat)
+ level = 0
+ for image in self.mipmap_images:
+ level += 1
+ if image:
+ image.blit_to_texture(texture.target, level, self.anchor_x, self.anchor_y, 0, internalformat)
+ # TODO: should set base and max mipmap level if some mipmaps are missing.
+ else:
+ glGenerateMipmap(texture.target)
+ self.blit_to_texture(texture.target, texture.level, self.anchor_x, self.anchor_y, 0, internalformat)
+
+ self._current_mipmap_texture = texture
+ return texture
+
+ def get_region(self, x, y, width, height):
+ """Retrieve a rectangular region of this image data.
+
+ :Parameters:
+ `x` : int
+ Left edge of region.
+ `y` : int
+ Bottom edge of region.
+ `width` : int
+ Width of region.
+ `height` : int
+ Height of region.
+
+ :rtype: ImageDataRegion
+ """
+ return ImageDataRegion(x, y, width, height, self)
+
+ def blit(self, x, y, z=0, width=None, height=None):
+ self.get_texture().blit(x, y, z, width, height)
+
+ def blit_to_texture(self, target, level, x, y, z, internalformat=None):
+ """Draw this image to to the currently bound texture at `target`.
+
+ This image's anchor point will be aligned to the given `x` and `y`
+ coordinates. If the currently bound texture is a 3D texture, the `z`
+ parameter gives the image slice to blit into.
+
+ If `internalformat` is specified, glTexImage is used to initialise
+ the texture; otherwise, glTexSubImage is used to update a region.
+ """
+ x -= self.anchor_x
+ y -= self.anchor_y
+
+ data_format = self.format
+ data_pitch = abs(self._current_pitch)
+
+ # Determine pixel format from format string
+ fmt, gl_type = self._get_gl_format_and_type(data_format)
+
+ if fmt is None:
+ # Need to convert data to a standard form
+ data_format = {
+ 1: 'R',
+ 2: 'RG',
+ 3: 'RGB',
+ 4: 'RGBA'}.get(len(data_format))
+ fmt, gl_type = self._get_gl_format_and_type(data_format)
+
+ # Get data in required format (hopefully will be the same format it's already
+ # in, unless that's an obscure format, upside-down or the driver is old).
+ data = self._convert(data_format, data_pitch)
+
+ if data_pitch & 0x1:
+ align = 1
+ elif data_pitch & 0x2:
+ align = 2
+ else:
+ align = 4
+ row_length = data_pitch // len(data_format)
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, align)
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length)
+ self._apply_region_unpack()
+
+ if target == GL_TEXTURE_3D or target == GL_TEXTURE_2D_ARRAY:
+ assert not internalformat
+ glTexSubImage3D(target, level,
+ x, y, z,
+ self.width, self.height, 1,
+ fmt, gl_type,
+ data)
+ elif internalformat:
+ glTexImage2D(target, level,
+ internalformat,
+ self.width, self.height,
+ 0,
+ fmt, gl_type,
+ data)
+ else:
+ glTexSubImage2D(target, level,
+ x, y,
+ self.width, self.height,
+ fmt, gl_type,
+ data)
+
+ # Unset GL_UNPACK_ROW_LENGTH:
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)
+ self._default_region_unpack()
+
+ # Flush image upload before data get GC'd:
+ glFlush()
+
+ def _apply_region_unpack(self):
+ pass
+
+ def _default_region_unpack(self):
+ pass
+
+ def _convert(self, fmt, pitch):
+ """Return data in the desired format; does not alter this instance's
+ current format or pitch.
+ """
+ if fmt == self._current_format and pitch == self._current_pitch:
+ if type(self._current_data) is str:
+ return asbytes(self._current_data)
+ return self._current_data
+
+ self._ensure_bytes()
+ data = self._current_data
+ current_pitch = self._current_pitch
+ current_format = self._current_format
+ sign_pitch = current_pitch // abs(current_pitch)
+ if fmt != self._current_format:
+ # Create replacement string, e.g. r'\4\1\2\3' to convert RGBA to ARGB
+ repl = asbytes('')
+ for c in fmt:
+ try:
+ idx = current_format.index(c) + 1
+ except ValueError:
+ idx = 1
+ repl += asbytes(r'\%d' % idx)
+
+ if len(current_format) == 1:
+ swap_pattern = self._swap1_pattern
+ elif len(current_format) == 2:
+ swap_pattern = self._swap2_pattern
+ elif len(current_format) == 3:
+ swap_pattern = self._swap3_pattern
+ elif len(current_format) == 4:
+ swap_pattern = self._swap4_pattern
+ else:
+ raise ImageException('Current image format is wider than 32 bits.')
+
+ packed_pitch = self.width * len(current_format)
+ if abs(self._current_pitch) != packed_pitch:
+ # Pitch is wider than pixel data, need to go row-by-row.
+ new_pitch = abs(self._current_pitch)
+ rows = [data[i:i+new_pitch] for i in range(0, len(data), new_pitch)]
+ rows = [swap_pattern.sub(repl, r[:packed_pitch]) for r in rows]
+ data = asbytes('').join(rows)
+ else:
+ # Rows are tightly packed, apply regex over whole image.
+ data = swap_pattern.sub(repl, data)
+
+ # After conversion, rows will always be tightly packed
+ current_pitch = sign_pitch * (len(fmt) * self.width)
+
+ if pitch != current_pitch:
+ diff = abs(current_pitch) - abs(pitch)
+ if diff > 0:
+ # New pitch is shorter than old pitch, chop bytes off each row
+ new_pitch = abs(pitch)
+ rows = [data[i:i+new_pitch-diff] for i in range(0, len(data), new_pitch)]
+ data = asbytes('').join(rows)
+
+ elif diff < 0:
+ # New pitch is longer than old pitch, add '0' bytes to each row
+ new_pitch = abs(current_pitch)
+ padding = asbytes(1) * -diff
+ rows = [data[i:i+new_pitch] + padding for i in range(0, len(data), new_pitch)]
+ data = asbytes('').join(rows)
+
+ if current_pitch * pitch < 0:
+ # Pitch differs in sign, swap row order
+ new_pitch = abs(pitch)
+ rows = [data[i:i+new_pitch] for i in range(0, len(data), new_pitch)]
+ rows.reverse()
+ data = asbytes('').join(rows)
+
+ return asbytes(data)
+
+ def _ensure_bytes(self):
+ if type(self._current_data) is not bytes:
+ self._current_data = asbytes(self._current_data)
+
+ @staticmethod
+ def _get_gl_format_and_type(fmt):
+ if fmt == 'R':
+ return GL_RED, GL_UNSIGNED_BYTE
+ elif fmt == 'RG':
+ return GL_RG, GL_UNSIGNED_BYTE
+ elif fmt == 'RGB':
+ return GL_RGB, GL_UNSIGNED_BYTE
+ elif fmt == 'BGR':
+ return GL_BGR, GL_UNSIGNED_BYTE
+ elif fmt == 'RGBA':
+ return GL_RGBA, GL_UNSIGNED_BYTE
+ elif fmt == 'BGRA':
+ return GL_BGRA, GL_UNSIGNED_BYTE
+
+ elif fmt == 'L':
+ return GL_LUMINANCE, GL_UNSIGNED_BYTE
+ elif fmt == 'A':
+ return GL_ALPHA, GL_UNSIGNED_BYTE
+
+ return None, None
+
+ @staticmethod
+ def _get_internalformat(fmt):
+ if fmt == 'R':
+ return GL_RED
+ elif fmt == 'RG':
+ return GL_RG
+ elif fmt == 'RGB':
+ return GL_RGB
+ elif fmt == 'RGBA':
+ return GL_RGBA
+ elif fmt == 'D':
+ return GL_DEPTH_COMPONENT
+ elif fmt == 'DS':
+ return GL_DEPTH_STENCIL
+
+ elif fmt == 'L':
+ return GL_LUMINANCE
+ elif fmt == 'A':
+ return GL_ALPHA
+
+ return GL_RGBA
+
+
+class ImageDataRegion(ImageData):
+ def __init__(self, x, y, width, height, image_data):
+ super().__init__(width, height,
+ image_data._current_format,
+ image_data._current_data,
+ image_data._current_pitch)
+ self.x = x
+ self.y = y
+
+ def __getstate__(self):
+ return {
+ 'width': self.width,
+ 'height': self.height,
+ '_current_data': self.get_data(self._current_format, self._current_pitch),
+ '_current_format': self._current_format,
+ '_desired_format': self._desired_format,
+ '_current_pitch': self._current_pitch,
+ 'pitch': self.pitch,
+ 'mipmap_images': self.mipmap_images,
+ 'x': self.x,
+ 'y': self.y
+ }
+
+ def get_data(self, fmt=None, pitch=None):
+ x1 = len(self._current_format) * self.x
+ x2 = len(self._current_format) * (self.x + self.width)
+
+ self._ensure_bytes()
+ data = self._convert(self._current_format, abs(self._current_pitch))
+ new_pitch = abs(self._current_pitch)
+ rows = [data[i:i+new_pitch] for i in range(0, len(data), new_pitch)]
+ rows = [row[x1:x2] for row in rows[self.y:self.y + self.height]]
+ self._current_data = b''.join(rows)
+ self._current_pitch = self.width * len(self._current_format)
+ self._current_texture = None
+ self.x = 0
+ self.y = 0
+
+ fmt = fmt or self._desired_format
+ pitch = pitch or self._current_pitch
+ return super().get_data(fmt, pitch)
+
+ def set_data(self, fmt, pitch, data):
+ self.x = 0
+ self.y = 0
+ super().set_data(fmt, pitch, data)
+
+ def _apply_region_unpack(self):
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, self.x)
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, self.y)
+
+ def _default_region_unpack(self):
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0)
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, 0)
+
+ def get_region(self, x, y, width, height):
+ x += self.x
+ y += self.y
+ return super().get_region(x, y, width, height)
+
+
+class CompressedImageData(AbstractImage):
+ """Image representing some compressed data suitable for direct uploading
+ to driver.
+ """
+
+ _current_texture = None
+ _current_mipmap_texture = None
+
+ def __init__(self, width, height, gl_format, data, extension=None, decoder=None):
+ """Construct a CompressedImageData with the given compressed data.
+
+ :Parameters:
+ `width` : int
+ Width of image
+ `height` : int
+ Height of image
+ `gl_format` : int
+ GL constant giving format of compressed data; for example,
+ ``GL_COMPRESSED_RGBA_S3TC_DXT5_EXT``.
+ `data` : sequence
+ String or array/list of bytes giving compressed image data.
+ `extension` : str or None
+ If specified, gives the name of a GL extension to check for
+ before creating a texture.
+ `decoder` : function(data, width, height) -> AbstractImage
+ A function to decode the compressed data, to be used if the
+ required extension is not present.
+
+ """
+ super().__init__(width, height)
+ self.data = data
+ self.gl_format = gl_format
+ self.extension = extension
+ self.decoder = decoder
+ self.mipmap_data = []
+
+ def set_mipmap_data(self, level, data):
+ """Set data for a mipmap level.
+
+ Supplied data gives a compressed image for the given mipmap level.
+ The image must be of the correct dimensions for the level
+ (i.e., width >> level, height >> level); but this is not checked. If
+ any mipmap levels are specified, they are used; otherwise, mipmaps for
+ `mipmapped_texture` are generated automatically.
+
+ :Parameters:
+ `level` : int
+ Level of mipmap image to set.
+ `data` : sequence
+ String or array/list of bytes giving compressed image data.
+ Data must be in same format as specified in constructor.
+
+ """
+ # Extend mipmap_data list to required level
+ self.mipmap_data += [None] * (level - len(self.mipmap_data))
+ self.mipmap_data[level - 1] = data
+
+ def _have_extension(self):
+ return self.extension is None or gl_info.have_extension(self.extension)
+
+ def _verify_driver_supported(self):
+ """Assert that the extension required for this image data is
+ supported.
+
+ Raises `ImageException` if not.
+ """
+
+ if not self._have_extension():
+ raise ImageException('%s is required to decode %r' % (self.extension, self))
+
+ def get_texture(self, rectangle=False):
+ if rectangle:
+ raise ImageException('Compressed texture rectangles not supported')
+
+ if self._current_texture:
+ return self._current_texture
+
+ texture = Texture.create(self.width, self.height, GL_TEXTURE_2D, None)
+
+ if self.anchor_x or self.anchor_y:
+ texture.anchor_x = self.anchor_x
+ texture.anchor_y = self.anchor_y
+
+ glBindTexture(texture.target, texture.id)
+ glTexParameteri(texture.target, GL_TEXTURE_MIN_FILTER, texture.min_filter)
+ glTexParameteri(texture.target, GL_TEXTURE_MAG_FILTER, texture.mag_filter)
+
+ if self._have_extension():
+ glCompressedTexImage2D(texture.target, texture.level,
+ self.gl_format,
+ self.width, self.height, 0,
+ len(self.data), self.data)
+ else:
+ image = self.decoder(self.data, self.width, self.height)
+ texture = image.get_texture()
+ assert texture.width == self.width
+ assert texture.height == self.height
+
+ glFlush()
+ self._current_texture = texture
+ return texture
+
+ def get_mipmapped_texture(self):
+ if self._current_mipmap_texture:
+ return self._current_mipmap_texture
+
+ if not self._have_extension():
+ # TODO mip-mapped software decoded compressed textures. For now,
+ # just return a non-mipmapped texture.
+ return self.get_texture()
+
+ texture = Texture.create(self.width, self.height, GL_TEXTURE_2D, None)
+
+ if self.anchor_x or self.anchor_y:
+ texture.anchor_x = self.anchor_x
+ texture.anchor_y = self.anchor_y
+
+ glBindTexture(texture.target, texture.id)
+
+ glTexParameteri(texture.target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)
+
+ if not self.mipmap_data:
+ glGenerateMipmap(texture.target)
+
+ glCompressedTexImage2D(texture.target, texture.level,
+ self.gl_format,
+ self.width, self.height, 0,
+ len(self.data), self.data)
+
+ width, height = self.width, self.height
+ level = 0
+ for data in self.mipmap_data:
+ width >>= 1
+ height >>= 1
+ level += 1
+ glCompressedTexImage2D(texture.target, level, self.gl_format, width, height, 0, len(data), data)
+
+ glFlush()
+
+ self._current_mipmap_texture = texture
+ return texture
+
+ def blit_to_texture(self, target, level, x, y, z):
+ self._verify_driver_supported()
+
+ if target == GL_TEXTURE_3D:
+ glCompressedTexSubImage3D(target, level,
+ x - self.anchor_x, y - self.anchor_y, z,
+ self.width, self.height, 1,
+ self.gl_format,
+ len(self.data), self.data)
+ else:
+ glCompressedTexSubImage2D(target, level,
+ x - self.anchor_x, y - self.anchor_y,
+ self.width, self.height,
+ self.gl_format,
+ len(self.data), self.data)
+
+
+class Texture(AbstractImage):
+ """An image loaded into video memory that can be efficiently drawn
+ to the framebuffer.
+
+ Typically, you will get an instance of Texture by accessing the `texture`
+ member of any other AbstractImage.
+
+ :Parameters:
+ `region_class` : class (subclass of TextureRegion)
+ Class to use when constructing regions of this texture.
+ `tex_coords` : tuple
+ 12-tuple of float, named (u1, v1, r1, u2, v2, r2, ...). u, v, r
+ give the 3D texture coordinates for vertices 1-4. The vertices
+ are specified in the order bottom-left, bottom-right, top-right
+ and top-left.
+ `target` : int
+ The GL texture target (e.g., ``GL_TEXTURE_2D``).
+ `level` : int
+ The mipmap level of this texture.
+
+ """
+
+ region_class = None # Set to TextureRegion after it's defined
+ tex_coords = (0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0)
+ tex_coords_order = (0, 1, 2, 3)
+ colors = (0, 0, 0, 0) * 4
+ level = 0
+ images = 1
+ x = y = z = 0
+ default_min_filter = GL_LINEAR
+ default_mag_filter = GL_LINEAR
+
+ def __init__(self, width, height, target, tex_id):
+ super().__init__(width, height)
+ self.target = target
+ self.id = tex_id
+ self._context = pyglet.gl.current_context
+
+ def __del__(self):
+ try:
+ self._context.delete_texture(self.id)
+ except Exception:
+ pass
+
+ def bind(self, texture_unit: int = 0):
+ """Bind to a specific Texture Unit by number."""
+ glActiveTexture(GL_TEXTURE0 + texture_unit)
+ glBindTexture(self.target, self.id)
+
+ def bind_image_texture(self, unit, level=0, layered=False, layer=0, access=GL_READ_WRITE, fmt=GL_RGBA32F):
+ """Bind as an ImageTexture for use with a :py:class:`~pyglet.shader.ComputeShaderProgram`.
+
+ ..note:: OpenGL 4.3, or 4.2 with the GL_ARB_compute_shader extention is required.
+ """
+ glBindImageTexture(unit, self.id, level, layered, layer, access, fmt)
+
+ @classmethod
+ def create(cls, width, height, target=GL_TEXTURE_2D, internalformat=GL_RGBA8, min_filter=None, mag_filter=None, fmt=GL_RGBA, blank_data=True):
+ """Create a Texture
+
+ Create a Texture with the specified dimentions, target and format.
+ On return, the texture will be bound.
+
+ :Parameters:
+ `width` : int
+ Width of texture in pixels.
+ `height` : int
+ Height of texture in pixels.
+ `target` : int
+ GL constant giving texture target to use, typically ``GL_TEXTURE_2D``.
+ `internalformat` : int
+ GL constant giving internal format of texture; for example, ``GL_RGBA``.
+ The internal format decides how the texture data will be stored internally.
+ If ``None``, the texture will be created but not initialized.
+ `min_filter` : int
+ The minifaction filter used for this texture, commonly ``GL_LINEAR`` or ``GL_NEAREST``
+ `mag_filter` : int
+ The magnification filter used for this texture, commonly ``GL_LINEAR`` or ``GL_NEAREST``
+ `fmt` : int
+ GL constant giving format of texture; for example, ``GL_RGBA``.
+ The format specifies what format the pixel data we're expecting to write
+ to the texture and should ideally be the same as for internal format.
+ `blank_data` : bool
+ Setting to True will initialize the texture data with all zeros. Setting False, will initialize Texture
+ with no data.
+
+ :rtype: :py:class:`~pyglet.image.Texture`
+ """
+ min_filter = min_filter or cls.default_min_filter
+ mag_filter = mag_filter or cls.default_mag_filter
+
+ tex_id = GLuint()
+ glGenTextures(1, byref(tex_id))
+ glBindTexture(target, tex_id.value)
+ glTexParameteri(target, GL_TEXTURE_MIN_FILTER, min_filter)
+ glTexParameteri(target, GL_TEXTURE_MAG_FILTER, mag_filter)
+
+ if internalformat is not None:
+ blank = (GLubyte * (width * height * 4))() if blank_data else None
+ glTexImage2D(target, 0,
+ internalformat,
+ width, height,
+ 0,
+ fmt,
+ GL_UNSIGNED_BYTE,
+ blank)
+ glFlush()
+
+ texture = cls(width, height, target, tex_id.value)
+ texture.min_filter = min_filter
+ texture.mag_filter = mag_filter
+ texture.tex_coords = cls.tex_coords
+
+ return texture
+
+ def get_image_data(self, z=0):
+ """Get the image data of this texture.
+
+ Changes to the returned instance will not be reflected in this
+ texture.
+
+ :Parameters:
+ `z` : int
+ For 3D textures, the image slice to retrieve.
+
+ :rtype: :py:class:`~pyglet.image.ImageData`
+ """
+ glBindTexture(self.target, self.id)
+
+ # Always extract complete RGBA data. Could check internalformat
+ # to only extract used channels. XXX
+ fmt = 'RGBA'
+ gl_format = GL_RGBA
+
+ buf = (GLubyte * (self.width * self.height * self.images * len(fmt)))()
+
+ # TODO: Clean up this temporary hack
+ if pyglet.gl.current_context.get_info().get_opengl_api() == "gles":
+ fbo = c_uint()
+ glGenFramebuffers(1, fbo)
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo.value)
+ glPixelStorei(GL_PACK_ALIGNMENT, 1)
+ glCheckFramebufferStatus(GL_FRAMEBUFFER)
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self.id, self.level)
+ glReadPixels(0, 0, self.width, self.height, gl_format, GL_UNSIGNED_BYTE, buf)
+ glBindFramebuffer(GL_FRAMEBUFFER, 0)
+ glDeleteFramebuffers(1, fbo)
+ else:
+ glPixelStorei(GL_PACK_ALIGNMENT, 1)
+ glGetTexImage(self.target, self.level, gl_format, GL_UNSIGNED_BYTE, buf)
+
+ data = ImageData(self.width, self.height, fmt, buf)
+ if self.images > 1:
+ data = data.get_region(0, z * self.height, self.width, self.height)
+ return data
+
+ def get_texture(self, rectangle=False):
+ return self
+
+ # no implementation of blit_to_texture yet
+
+ def blit(self, x, y, z=0, width=None, height=None):
+ x1 = x - self.anchor_x
+ y1 = y - self.anchor_y
+ x2 = x1 + (width is None and self.width or width)
+ y2 = y1 + (height is None and self.height or height)
+ vertices = x1, y1, z, x2, y1, z, x2, y2, z, x1, y2, z
+
+ glActiveTexture(GL_TEXTURE0)
+ glBindTexture(self.target, self.id)
+
+ pyglet.graphics.draw_indexed(4, GL_TRIANGLES, [0, 1, 2, 0, 2, 3],
+ position=('f', vertices),
+ tex_coords=('f', self.tex_coords),
+ colors=('Bn', self.colors))
+
+ glBindTexture(self.target, 0)
+
+ def blit_into(self, source, x, y, z):
+ glBindTexture(self.target, self.id)
+ source.blit_to_texture(self.target, self.level, x, y, z)
+
+ def get_region(self, x, y, width, height):
+ return self.region_class(x, y, 0, width, height, self)
+
+ def get_transform(self, flip_x=False, flip_y=False, rotate=0):
+ """Create a copy of this image applying a simple transformation.
+
+ The transformation is applied to the texture coordinates only;
+ :py:meth:`~pyglet.image.ImageData.get_image_data` will return the untransformed data. The
+ transformation is applied around the anchor point.
+
+ :Parameters:
+ `flip_x` : bool
+ If True, the returned image will be flipped horizontally.
+ `flip_y` : bool
+ If True, the returned image will be flipped vertically.
+ `rotate` : int
+ Degrees of clockwise rotation of the returned image. Only
+ 90-degree increments are supported.
+
+ :rtype: :py:class:`~pyglet.image.TextureRegion`
+ """
+ transform = self.get_region(0, 0, self.width, self.height)
+ bl, br, tr, tl = 0, 1, 2, 3
+ transform.anchor_x = self.anchor_x
+ transform.anchor_y = self.anchor_y
+ if flip_x:
+ bl, br, tl, tr = br, bl, tr, tl
+ transform.anchor_x = self.width - self.anchor_x
+ if flip_y:
+ bl, br, tl, tr = tl, tr, bl, br
+ transform.anchor_y = self.height - self.anchor_y
+ rotate %= 360
+ if rotate < 0:
+ rotate += 360
+ if rotate == 0:
+ pass
+ elif rotate == 90:
+ bl, br, tr, tl = br, tr, tl, bl
+ transform.anchor_x, transform.anchor_y = transform.anchor_y, transform.width - transform.anchor_x
+ elif rotate == 180:
+ bl, br, tr, tl = tr, tl, bl, br
+ transform.anchor_x = transform.width - transform.anchor_x
+ transform.anchor_y = transform.height - transform.anchor_y
+ elif rotate == 270:
+ bl, br, tr, tl = tl, bl, br, tr
+ transform.anchor_x, transform.anchor_y = transform.height - transform.anchor_y, transform.anchor_x
+ else:
+ assert False, 'Only 90 degree rotations are supported.'
+ if rotate in (90, 270):
+ transform.width, transform.height = transform.height, transform.width
+ transform._set_tex_coords_order(bl, br, tr, tl)
+ return transform
+
+ def _set_tex_coords_order(self, bl, br, tr, tl):
+ tex_coords = (self.tex_coords[:3],
+ self.tex_coords[3:6],
+ self.tex_coords[6:9],
+ self.tex_coords[9:])
+ self.tex_coords = tex_coords[bl] + tex_coords[br] + tex_coords[tr] + tex_coords[tl]
+
+ order = self.tex_coords_order
+ self.tex_coords_order = (order[bl], order[br], order[tr], order[tl])
+
+ def __repr__(self):
+ return "{}(id={}, size={}x{})".format(self.__class__.__name__, self.id, self.width, self.height)
+
+
+class TextureRegion(Texture):
+ """A rectangular region of a texture, presented as if it were a separate texture.
+ """
+
+ def __init__(self, x, y, z, width, height, owner):
+ super().__init__(width, height, owner.target, owner.id)
+
+ self.x = x
+ self.y = y
+ self.z = z
+ self.owner = owner
+ owner_u1 = owner.tex_coords[0]
+ owner_v1 = owner.tex_coords[1]
+ owner_u2 = owner.tex_coords[3]
+ owner_v2 = owner.tex_coords[7]
+ scale_u = owner_u2 - owner_u1
+ scale_v = owner_v2 - owner_v1
+ u1 = x / owner.width * scale_u + owner_u1
+ v1 = y / owner.height * scale_v + owner_v1
+ u2 = (x + width) / owner.width * scale_u + owner_u1
+ v2 = (y + height) / owner.height * scale_v + owner_v1
+ r = z / owner.images + owner.tex_coords[2]
+ self.tex_coords = (u1, v1, r, u2, v1, r, u2, v2, r, u1, v2, r)
+
+ def get_image_data(self):
+ image_data = self.owner.get_image_data(self.z)
+ return image_data.get_region(self.x, self.y, self.width, self.height)
+
+ def get_region(self, x, y, width, height):
+ x += self.x
+ y += self.y
+ region = self.region_class(x, y, self.z, width, height, self.owner)
+ region._set_tex_coords_order(*self.tex_coords_order)
+ return region
+
+ def blit_into(self, source, x, y, z):
+ self.owner.blit_into(source, x + self.x, y + self.y, z + self.z)
+
+ def __repr__(self):
+ return "{}(id={}, size={}x{}, owner={}x{})".format(self.__class__.__name__, self.id, self.width, self.height,
+ self.owner.width, self.owner.height)
+
+ def __del__(self):
+ # only the owner Texture should handle deletion
+ pass
+
+
+Texture.region_class = TextureRegion
+
+
+class Texture3D(Texture, UniformTextureSequence):
+ """A texture with more than one image slice.
+
+ Use `create_for_images` or `create_for_image_grid` classmethod to
+ construct.
+ """
+ item_width = 0
+ item_height = 0
+ items = ()
+
+ @classmethod
+ def create_for_images(cls, images, internalformat=GL_RGBA, blank_data=True):
+ item_width = images[0].width
+ item_height = images[0].height
+ for image in images:
+ if image.width != item_width or image.height != item_height:
+ raise ImageException('Images do not have same dimensions.')
+
+ depth = len(images)
+
+ texture = cls.create(item_width, item_height, GL_TEXTURE_3D, None)
+ if images[0].anchor_x or images[0].anchor_y:
+ texture.anchor_x = images[0].anchor_x
+ texture.anchor_y = images[0].anchor_y
+
+ texture.images = depth
+
+ blank = (GLubyte * (texture.width * texture.height * texture.images))() if blank_data else None
+ glBindTexture(texture.target, texture.id)
+ glTexImage3D(texture.target, texture.level,
+ internalformat,
+ texture.width, texture.height, texture.images, 0,
+ GL_ALPHA, GL_UNSIGNED_BYTE,
+ blank)
+
+ items = []
+ for i, image in enumerate(images):
+ item = cls.region_class(0, 0, i, item_width, item_height, texture)
+ items.append(item)
+ image.blit_to_texture(texture.target, texture.level, image.anchor_x, image.anchor_y, i)
+
+ glFlush()
+
+ texture.items = items
+ texture.item_width = item_width
+ texture.item_height = item_height
+ return texture
+
+ @classmethod
+ def create_for_image_grid(cls, grid, internalformat=GL_RGBA):
+ return cls.create_for_images(grid[:], internalformat)
+
+ def __len__(self):
+ return len(self.items)
+
+ def __getitem__(self, index):
+ return self.items[index]
+
+ def __setitem__(self, index, value):
+ if type(index) is slice:
+ for item, image in zip(self[index], value):
+ image.blit_to_texture(self.target, self.level, image.anchor_x, image.anchor_y, item.z)
+ else:
+ value.blit_to_texture(self.target, self.level, value.anchor_x, value.anchor_y, self[index].z)
+
+ def __iter__(self):
+ return iter(self.items)
+
+
+class TextureArrayRegion(TextureRegion):
+ """A region of a TextureArray, presented as if it were a separate texture.
+ """
+ def __init__(self, x, y, z, width, height, owner):
+ super().__init__(width, height, owner.target, owner.id)
+
+ self.x = x
+ self.y = y
+ self.z = z
+ self.owner = owner
+ owner_u1 = owner.tex_coords[0]
+ owner_v1 = owner.tex_coords[1]
+ owner_u2 = owner.tex_coords[3]
+ owner_v2 = owner.tex_coords[7]
+ scale_u = owner_u2 - owner_u1
+ scale_v = owner_v2 - owner_v1
+ u1 = x / owner.width * scale_u + owner_u1
+ v1 = y / owner.height * scale_v + owner_v1
+ u2 = (x + width) / owner.width * scale_u + owner_u1
+ v2 = (y + height) / owner.height * scale_v + owner_v1
+ z = float(z)
+ self.tex_coords = (u1, v1, z, u2, v1, z, u2, v2, z, u1, v2, z)
+
+ def __repr__(self):
+ return "{}(id={}, size={}x{}, layer={})".format(self.__class__.__name__, self.id, self.width, self.height, self.z)
+
+
+class TextureArray(Texture, UniformTextureSequence):
+ allow_smaller_pack = True
+
+ @classmethod
+ def create(cls, width, height, internalformat=GL_RGBA, min_filter=None, mag_filter=None, max_depth=256):
+ """Create an empty TextureArray.
+
+ You may specify the maximum depth, or layers, the Texture Array should have. This defaults
+ to 256, but will be hardware and driver dependent.
+
+ :Parameters:
+ `width` : int
+ Width of the texture.
+ `height` : int
+ Height of the texture.
+ `internalformat` : int
+ GL constant giving the internal format of the texture array; for example, ``GL_RGBA``.
+ `min_filter` : int
+ The minifaction filter used for this texture array, commonly ``GL_LINEAR`` or ``GL_NEAREST``
+ `mag_filter` : int
+ The magnification filter used for this texture array, commonly ``GL_LINEAR`` or ``GL_NEAREST``
+ `max_depth` : int
+ The number of layers in the texture array.
+
+ :rtype: :py:class:`~pyglet.image.TextureArray`
+
+ .. versionadded:: 2.0
+ """
+ min_filter = min_filter or cls.default_min_filter
+ mag_filter = mag_filter or cls.default_mag_filter
+
+ max_depth_limit = get_max_array_texture_layers()
+ assert max_depth <= max_depth_limit, "TextureArray max_depth supported is {}.".format(max_depth_limit)
+
+ tex_id = GLuint()
+ glGenTextures(1, byref(tex_id))
+ glBindTexture(GL_TEXTURE_2D_ARRAY, tex_id.value)
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, min_filter)
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, mag_filter)
+
+ glTexImage3D(GL_TEXTURE_2D_ARRAY, 0,
+ internalformat,
+ width, height, max_depth,
+ 0,
+ internalformat, GL_UNSIGNED_BYTE,
+ 0)
+ glFlush()
+
+ texture = cls(width, height, GL_TEXTURE_2D_ARRAY, tex_id.value)
+ texture.items = [] # No items on creation
+ texture.max_depth = max_depth
+ texture.min_filter = min_filter
+ texture.mag_filter = mag_filter
+
+ return texture
+
+ def _verify_size(self, image):
+ if image.width > self.width or image.height > self.height:
+ raise ImageException('Image ({0}x{1}) exceeds the size of the TextureArray ({2}x{3})'.format(
+ image.width, image.height, self.width, self.height))
+
+ def allocate(self, *images):
+ if len(self.items) + len(images) > self.max_depth:
+ raise Exception("The amount of images being added exceeds the depth of this TextureArray.")
+
+ textures = []
+ start_length = len(self.items)
+ for i, image in enumerate(images):
+ self._verify_size(image)
+ item = self.region_class(0, 0, start_length + i, image.width, image.height, self)
+ self.items.append(item)
+ image.blit_to_texture(self.target, self.level, image.anchor_x, image.anchor_y, start_length + i)
+
+ glFlush()
+
+ return self.items[start_length:]
+
+ @classmethod
+ def create_for_image_grid(cls, grid, internalformat=GL_RGBA):
+ texture_array = cls.create(grid[0].width, grid[0].height, internalformat, max_depth=len(grid))
+ texture_array.allocate(*grid[:])
+ return texture_array
+
+ def __len__(self):
+ return len(self.items)
+
+ def __getitem__(self, index):
+ return self.items[index]
+
+ def __setitem__(self, index, value):
+ if type(index) is slice:
+ for old_item, image in zip(self[index], value):
+ self._verify_size(image)
+ item = self.region_class(0, 0, old_item.z, image.width, image.height, self)
+ image.blit_to_texture(self.target, self.level, image.anchor_x, image.anchor_y, old_item.z)
+ self.items[old_item.z] = item
+ else:
+ self._verify_size(value)
+ item = self.region_class(0, 0, index, value.width, value.height, self)
+ value.blit_to_texture(self.target, self.level, value.anchor_x, value.anchor_y, index)
+ self.items[index] = item
+
+ def __iter__(self):
+ return iter(self.items)
+
+
+TextureArray.region_class = TextureArrayRegion
+TextureArrayRegion.region_class = TextureArrayRegion
+
+
+class TileableTexture(Texture):
+ """A texture that can be tiled efficiently.
+
+ Use :py:class:`~pyglet.image.create_for_image` classmethod to construct.
+ """
+
+ def get_region(self, x, y, width, height):
+ raise ImageException('Cannot get region of %r' % self)
+
+ def blit_tiled(self, x, y, z, width, height):
+ """Blit this texture tiled over the given area.
+
+ The image will be tiled with the bottom-left corner of the destination
+ rectangle aligned with the anchor point of this texture.
+ """
+ u1 = self.anchor_x / self.width
+ v1 = self.anchor_y / self.height
+ u2 = u1 + width / self.width
+ v2 = v1 + height / self.height
+ w, h = width, height
+ t = self.tex_coords
+
+ vertices = (x, y, z,
+ x + w, y, z,
+ x + w, y + h, z,
+ x, y + h, z)
+
+ tex_coords = (u1, v1, t[2],
+ u2, v1, t[5],
+ u2, v2, t[8],
+ u1, v2, t[11],)
+
+ glActiveTexture(GL_TEXTURE0)
+ glBindTexture(self.target, self.id)
+ pyglet.graphics.draw_indexed(4, GL_TRIANGLES, [0, 1, 2, 0, 2, 3],
+ position=('f', vertices),
+ tex_coords=('f', tex_coords))
+ glBindTexture(self.target, 0)
+
+ @classmethod
+ def create_for_image(cls, image):
+ image = image.get_image_data()
+ return image.create_texture(cls)
+
+
+class DepthTexture(Texture):
+ """A texture with depth samples (typically 24-bit)."""
+
+ def blit_into(self, source, x, y, z):
+ glBindTexture(self.target, self.id)
+ source.blit_to_texture(self.level, x, y, z)
+
+
+class ImageGrid(AbstractImage, AbstractImageSequence):
+ """An imaginary grid placed over an image allowing easy access to
+ regular regions of that image.
+
+ The grid can be accessed either as a complete image, or as a sequence
+ of images. The most useful applications are to access the grid
+ as a :py:class:`~pyglet.image.TextureGrid`::
+
+ image_grid = ImageGrid(...)
+ texture_grid = image_grid.get_texture_sequence()
+
+ or as a :py:class:`~pyglet.image.Texture3D`::
+
+ image_grid = ImageGrid(...)
+ texture_3d = Texture3D.create_for_image_grid(image_grid)
+
+ """
+ _items = ()
+ _texture_grid = None
+
+ def __init__(self, image, rows, columns, item_width=None, item_height=None, row_padding=0, column_padding=0):
+ """Construct a grid for the given image.
+
+ You can specify parameters for the grid, for example setting
+ the padding between cells. Grids are always aligned to the
+ bottom-left corner of the image.
+
+ :Parameters:
+ `image` : AbstractImage
+ Image over which to construct the grid.
+ `rows` : int
+ Number of rows in the grid.
+ `columns` : int
+ Number of columns in the grid.
+ `item_width` : int
+ Width of each column. If unspecified, is calculated such
+ that the entire image width is used.
+ `item_height` : int
+ Height of each row. If unspecified, is calculated such that
+ the entire image height is used.
+ `row_padding` : int
+ Pixels separating adjacent rows. The padding is only
+ inserted between rows, not at the edges of the grid.
+ `column_padding` : int
+ Pixels separating adjacent columns. The padding is only
+ inserted between columns, not at the edges of the grid.
+ """
+ super().__init__(image.width, image.height)
+ self.image = image
+ self.rows = rows
+ self.columns = columns
+ self.item_width = item_width or (image.width - column_padding * (columns - 1)) // columns
+ self.item_height = item_height or (image.height - row_padding * (rows - 1)) // rows
+ self.row_padding = row_padding
+ self.column_padding = column_padding
+
+ def get_texture(self, rectangle=False):
+ return self.image.get_texture(rectangle)
+
+ def get_image_data(self):
+ return self.image.get_image_data()
+
+ def get_texture_sequence(self):
+ if not self._texture_grid:
+ self._texture_grid = TextureGrid(self)
+ return self._texture_grid
+
+ def __len__(self):
+ return self.rows * self.columns
+
+ def _update_items(self):
+ if not self._items:
+ self._items = []
+ y = 0
+ for row in range(self.rows):
+ x = 0
+ for col in range(self.columns):
+ self._items.append(self.image.get_region(x, y, self.item_width, self.item_height))
+ x += self.item_width + self.column_padding
+ y += self.item_height + self.row_padding
+
+ def __getitem__(self, index):
+ self._update_items()
+ if type(index) is tuple:
+ row, column = index
+ assert 0 <= row < self.rows and 0 <= column < self.columns
+ return self._items[row * self.columns + column]
+ else:
+ return self._items[index]
+
+ def __iter__(self):
+ self._update_items()
+ return iter(self._items)
+
+
+class TextureGrid(TextureRegion, UniformTextureSequence):
+ """A texture containing a regular grid of texture regions.
+
+ To construct, create an :py:class:`~pyglet.image.ImageGrid` first::
+
+ image_grid = ImageGrid(...)
+ texture_grid = TextureGrid(image_grid)
+
+ The texture grid can be accessed as a single texture, or as a sequence
+ of :py:class:`~pyglet.image.TextureRegion`. When accessing as a sequence, you can specify
+ integer indexes, in which the images are arranged in rows from the
+ bottom-left to the top-right::
+
+ # assume the texture_grid is 3x3:
+ current_texture = texture_grid[3] # get the middle-left image
+
+ You can also specify tuples in the sequence methods, which are addressed
+ as ``row, column``::
+
+ # equivalent to the previous example:
+ current_texture = texture_grid[1, 0]
+
+ When using tuples in a slice, the returned sequence is over the
+ rectangular region defined by the slice::
+
+ # returns center, center-right, center-top, top-right images in that
+ # order:
+ images = texture_grid[(1,1):]
+ # equivalent to
+ images = texture_grid[(1,1):(3,3)]
+
+ """
+ items = ()
+ rows = 1
+ columns = 1
+ item_width = 0
+ item_height = 0
+
+ def __init__(self, grid):
+ image = grid.get_texture()
+ if isinstance(image, TextureRegion):
+ owner = image.owner
+ else:
+ owner = image
+
+ super().__init__(image.x, image.y, image.z, image.width, image.height, owner)
+
+ items = []
+ y = 0
+ for row in range(grid.rows):
+ x = 0
+ for col in range(grid.columns):
+ items.append(self.get_region(x, y, grid.item_width, grid.item_height))
+ x += grid.item_width + grid.column_padding
+ y += grid.item_height + grid.row_padding
+
+ self.items = items
+ self.rows = grid.rows
+ self.columns = grid.columns
+ self.item_width = grid.item_width
+ self.item_height = grid.item_height
+
+ def get(self, row, column):
+ return self[(row, column)]
+
+ def __getitem__(self, index):
+ if type(index) is slice:
+ if type(index.start) is not tuple and type(index.stop) is not tuple:
+ return self.items[index]
+ else:
+ row1 = 0
+ col1 = 0
+ row2 = self.rows
+ col2 = self.columns
+ if type(index.start) is tuple:
+ row1, col1 = index.start
+ elif type(index.start) is int:
+ row1 = index.start // self.columns
+ col1 = index.start % self.columns
+ assert 0 <= row1 < self.rows and 0 <= col1 < self.columns
+
+ if type(index.stop) is tuple:
+ row2, col2 = index.stop
+ elif type(index.stop) is int:
+ row2 = index.stop // self.columns
+ col2 = index.stop % self.columns
+ assert 0 <= row2 <= self.rows and 0 <= col2 <= self.columns
+
+ result = []
+ i = row1 * self.columns
+ for row in range(row1, row2):
+ result += self.items[i + col1:i + col2]
+ i += self.columns
+ return result
+ else:
+ if type(index) is tuple:
+ row, column = index
+ assert 0 <= row < self.rows and 0 <= column < self.columns
+ return self.items[row * self.columns + column]
+ elif type(index) is int:
+ return self.items[index]
+
+ def __setitem__(self, index, value):
+ if type(index) is slice:
+ for region, image in zip(self[index], value):
+ if image.width != self.item_width or image.height != self.item_height:
+ raise ImageException('Image has incorrect dimensions')
+ image.blit_into(region, image.anchor_x, image.anchor_y, 0)
+ else:
+ image = value
+ if image.width != self.item_width or image.height != self.item_height:
+ raise ImageException('Image has incorrect dimensions')
+ image.blit_into(self[index], image.anchor_x, image.anchor_y, 0)
+
+ def __len__(self):
+ return len(self.items)
+
+ def __iter__(self):
+ return iter(self.items)
+
+
+# Initialise default codecs
+_add_default_codecs()
+
+# Default Framebuffer classes:
+###############################################################
+
+
+class BufferManager:
+ """Manages the set of framebuffers for a context.
+
+ Use :py:func:`~pyglet.image.get_buffer_manager` to obtain the instance of this class for the
+ current context.
+ """
+
+ def __init__(self):
+ self.color_buffer = None
+ self.depth_buffer = None
+ self.free_stencil_bits = None
+ self.refs = []
+
+ @staticmethod
+ def get_viewport():
+ """Get the current OpenGL viewport dimensions.
+
+ :rtype: 4-tuple of float.
+ :return: Left, top, right and bottom dimensions.
+ """
+ viewport = (GLint * 4)()
+ glGetIntegerv(GL_VIEWPORT, viewport)
+ return viewport
+
+ def get_color_buffer(self):
+ """Get the color buffer.
+
+ :rtype: :py:class:`~pyglet.image.ColorBufferImage`
+ """
+ viewport = self.get_viewport()
+ viewport_width = viewport[2]
+ viewport_height = viewport[3]
+ if (not self.color_buffer or
+ viewport_width != self.color_buffer.width or
+ viewport_height != self.color_buffer.height):
+ self.color_buffer = ColorBufferImage(*viewport)
+ return self.color_buffer
+
+ def get_depth_buffer(self):
+ """Get the depth buffer.
+
+ :rtype: :py:class:`~pyglet.image.DepthBufferImage`
+ """
+ viewport = self.get_viewport()
+ viewport_width = viewport[2]
+ viewport_height = viewport[3]
+ if (not self.depth_buffer or
+ viewport_width != self.depth_buffer.width or
+ viewport_height != self.depth_buffer.height):
+ self.depth_buffer = DepthBufferImage(*viewport)
+ return self.depth_buffer
+
+ def get_buffer_mask(self):
+ """Get a free bitmask buffer.
+
+ A bitmask buffer is a buffer referencing a single bit in the stencil
+ buffer. If no bits are free, `ImageException` is raised. Bits are
+ released when the bitmask buffer is garbage collected.
+
+ :rtype: :py:class:`~pyglet.image.BufferImageMask`
+ """
+ if self.free_stencil_bits is None:
+ try:
+ stencil_bits = GLint()
+ glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER,
+ GL_STENCIL,
+ GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
+ stencil_bits)
+ self.free_stencil_bits = list(range(stencil_bits.value))
+ except GLException:
+ pass
+
+ if not self.free_stencil_bits:
+ raise ImageException('No free stencil bits are available.')
+
+ stencil_bit = self.free_stencil_bits.pop(0)
+ x, y, width, height = self.get_viewport()
+ bufimg = BufferImageMask(x, y, width, height)
+ bufimg.stencil_bit = stencil_bit
+
+ def release_buffer(ref, owner=self):
+ owner.free_stencil_bits.insert(0, stencil_bit)
+
+ self.refs.append(weakref.ref(bufimg, release_buffer))
+
+ return bufimg
+
+
+def get_buffer_manager():
+ """Get the buffer manager for the current OpenGL context.
+
+ :rtype: :py:class:`~pyglet.image.BufferManager`
+ """
+ context = pyglet.gl.current_context
+ if not hasattr(context, 'image_buffer_manager'):
+ context.image_buffer_manager = BufferManager()
+ return context.image_buffer_manager
+
+
+class BufferImage(AbstractImage):
+ """An abstract framebuffer.
+ """
+ #: The OpenGL read and write target for this buffer.
+ gl_buffer = GL_BACK
+
+ #: The OpenGL format constant for image data.
+ gl_format = 0
+
+ #: The format string used for image data.
+ format = ''
+
+ owner = None
+
+ # TODO: enable methods
+
+ def __init__(self, x, y, width, height):
+ super().__init__(width, height)
+ self.x = x
+ self.y = y
+ self.width = width
+ self.height = height
+
+ def get_image_data(self):
+ buf = (GLubyte * (len(self.format) * self.width * self.height))()
+
+ x = self.x
+ y = self.y
+ if self.owner:
+ x += self.owner.x
+ y += self.owner.y
+
+ glReadBuffer(self.gl_buffer)
+ glPixelStorei(GL_PACK_ALIGNMENT, 1)
+ glReadPixels(x, y, self.width, self.height, self.gl_format, GL_UNSIGNED_BYTE, buf)
+ return ImageData(self.width, self.height, self.format, buf)
+
+ def get_region(self, x, y, width, height):
+ if self.owner:
+ return self.owner.get_region(x + self.x, y + self.y, width, height)
+
+ region = self.__class__(x + self.x, y + self.y, width, height)
+ region.gl_buffer = self.gl_buffer
+ region.owner = self
+ return region
+
+
+class ColorBufferImage(BufferImage):
+ """A color framebuffer.
+
+ This class is used to wrap the primary color buffer (i.e., the back
+ buffer)
+ """
+ gl_format = GL_RGBA
+ format = 'RGBA'
+
+ def get_texture(self, rectangle=False):
+ texture = Texture.create(self.width, self.height, GL_TEXTURE_2D, GL_RGBA, blank_data=False)
+ self.blit_to_texture(texture.target, texture.level, self.anchor_x, self.anchor_y, 0)
+ return texture
+
+ def blit_to_texture(self, target, level, x, y, z):
+ glReadBuffer(self.gl_buffer)
+ glCopyTexSubImage2D(target, level, x-self.anchor_x, y-self.anchor_y, self.x, self.y, self.width, self.height)
+
+
+class DepthBufferImage(BufferImage):
+ """The depth buffer.
+ """
+ gl_format = GL_DEPTH_COMPONENT
+ format = 'L'
+
+ def get_texture(self, rectangle=False):
+ assert rectangle is False, 'Depth textures cannot be rectangular'
+
+ texture = DepthTexture.create(self.width, self.height, GL_TEXTURE_2D, None)
+ if self.anchor_x or self.anchor_y:
+ texture.anchor_x = self.anchor_x
+ texture.anchor_y = self.anchor_y
+
+ glReadBuffer(self.gl_buffer)
+ glCopyTexImage2D(texture.target, 0,
+ GL_DEPTH_COMPONENT,
+ self.x, self.y, self.width, self.height,
+ 0)
+ return texture
+
+ def blit_to_texture(self, target, level, x, y, z):
+ glReadBuffer(self.gl_buffer)
+ glCopyTexSubImage2D(target, level, x-self.anchor_x, y-self.anchor_y, self.x, self.y, self.width, self.height)
+
+
+class BufferImageMask(BufferImage):
+ """A single bit of the stencil buffer.
+ """
+ gl_format = GL_STENCIL_INDEX
+ format = 'L'
+
+ # TODO mask methods
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/animation.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/animation.py
new file mode 100644
index 0000000000000000000000000000000000000000..169dd5ecd6fda2f2faff6000ed7971247c9b91b7
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/animation.py
@@ -0,0 +1,179 @@
+"""2D Animations
+
+Animations can be used by the :py:class:`~pyglet.sprite.Sprite` class in place
+of static images. They are essentially containers for individual image frames,
+with a duration per frame. They can be infinitely looping, or stop at the last
+frame. You can load Animations from disk, such as from GIF files::
+
+ ani = pyglet.resource.animation('walking.gif')
+ sprite = pyglet.sprite.Sprite(img=ani)
+
+Alternatively, you can create your own Animations from a sequence of images
+by using the :py:meth:`~Animation.from_image_sequence` method::
+
+ images = [pyglet.resource.image('walk_a.png'),
+ pyglet.resource.image('walk_b.png'),
+ pyglet.resource.image('walk_c.png')]
+
+ ani = pyglet.image.Animation.from_image_sequence(images, duration=0.1, loop=True)
+
+You can also use an :py:class:`pyglet.image.ImageGrid`, which is iterable::
+
+ sprite_sheet = pyglet.resource.image('my_sprite_sheet.png')
+ image_grid = pyglet.image.ImageGrid(sprite_sheet, rows=1, columns=5)
+
+ ani = pyglet.image.Animation.from_image_sequence(image_grid, duration=0.1)
+
+In the above examples, all of the Animation Frames have the same duration.
+If you wish to adjust this, you can manually create the Animation from a list of
+:py:class:`~AnimationFrame`::
+
+ image_a = pyglet.resource.image('walk_a.png')
+ image_b = pyglet.resource.image('walk_b.png')
+ image_c = pyglet.resource.image('walk_c.png')
+
+ frame_a = pyglet.image.AnimationFrame(image_a, duration=0.1)
+ frame_b = pyglet.image.AnimationFrame(image_b, duration=0.2)
+ frame_c = pyglet.image.AnimationFrame(image_c, duration=0.1)
+
+ ani = pyglet.image.Animation(frames=[frame_a, frame_b, frame_c])
+
+"""
+
+
+class Animation:
+ """Sequence of images with timing information.
+
+ If no frames of the animation have a duration of ``None``, the animation
+ loops continuously; otherwise the animation stops at the first frame with
+ duration of ``None``.
+
+ :Ivariables:
+ `frames` : list of `~pyglet.image.AnimationFrame`
+ The frames that make up the animation.
+
+ """
+
+ def __init__(self, frames):
+ """Create an animation directly from a list of frames.
+
+ :Parameters:
+ `frames` : list of `~pyglet.image.AnimationFrame`
+ The frames that make up the animation.
+
+ """
+ assert len(frames)
+ self.frames = frames
+
+ def add_to_texture_bin(self, texture_bin, border=0):
+ """Add the images of the animation to a :py:class:`~pyglet.image.atlas.TextureBin`.
+
+ The animation frames are modified in-place to refer to the texture bin
+ regions.
+
+ :Parameters:
+ `texture_bin` : `~pyglet.image.atlas.TextureBin`
+ Texture bin to upload animation frames into.
+ `border` : int
+ Leaves specified pixels of blank space around
+ each image frame when adding to the TextureBin.
+
+ """
+ for frame in self.frames:
+ frame.image = texture_bin.add(frame.image, border)
+
+ def get_transform(self, flip_x=False, flip_y=False, rotate=0):
+ """Create a copy of this animation applying a simple transformation.
+
+ The transformation is applied around the image's anchor point of
+ each frame. The texture data is shared between the original animation
+ and the transformed animation.
+
+ :Parameters:
+ `flip_x` : bool
+ If True, the returned animation will be flipped horizontally.
+ `flip_y` : bool
+ If True, the returned animation will be flipped vertically.
+ `rotate` : int
+ Degrees of clockwise rotation of the returned animation. Only
+ 90-degree increments are supported.
+
+ :rtype: :py:class:`~pyglet.image.Animation`
+ """
+ frames = [AnimationFrame(frame.image.get_texture().get_transform(flip_x, flip_y, rotate),
+ frame.duration) for frame in self.frames]
+ return Animation(frames)
+
+ def get_duration(self):
+ """Get the total duration of the animation in seconds.
+
+ :rtype: float
+ """
+ return sum([frame.duration for frame in self.frames if frame.duration is not None])
+
+ def get_max_width(self):
+ """Get the maximum image frame width.
+
+ This method is useful for determining texture space requirements: due
+ to the use of ``anchor_x`` the actual required playback area may be
+ larger.
+
+ :rtype: int
+ """
+ return max([frame.image.width for frame in self.frames])
+
+ def get_max_height(self):
+ """Get the maximum image frame height.
+
+ This method is useful for determining texture space requirements: due
+ to the use of ``anchor_y`` the actual required playback area may be
+ larger.
+
+ :rtype: int
+ """
+ return max([frame.image.height for frame in self.frames])
+
+ @classmethod
+ def from_image_sequence(cls, sequence, duration, loop=True):
+ """Create an animation from a list of images and a constant framerate.
+
+ :Parameters:
+ `sequence` : list of `~pyglet.image.AbstractImage`
+ Images that make up the animation, in sequence.
+ `duration` : float
+ Number of seconds to display each image.
+ `loop` : bool
+ If True, the animation will loop continuously.
+
+ :rtype: :py:class:`~pyglet.image.Animation`
+ """
+ frames = [AnimationFrame(image, duration) for image in sequence]
+ if not loop:
+ frames[-1].duration = None
+ return cls(frames)
+
+ def __repr__(self):
+ return "Animation(frames={0})".format(len(self.frames))
+
+
+class AnimationFrame:
+ """A single frame of an animation."""
+
+ __slots__ = 'image', 'duration'
+
+ def __init__(self, image, duration):
+ """Create an animation frame from an image.
+
+ :Parameters:
+ `image` : `~pyglet.image.AbstractImage`
+ The image of this frame.
+ `duration` : float
+ Number of seconds to display the frame, or ``None`` if it is
+ the last frame in the animation.
+
+ """
+ self.image = image
+ self.duration = duration
+
+ def __repr__(self):
+ return "AnimationFrame({0}, duration={1})".format(self.image, self.duration)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/atlas.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/atlas.py
new file mode 100644
index 0000000000000000000000000000000000000000..dac670b83105d2bab6c817841738520bfbed31da
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/atlas.py
@@ -0,0 +1,241 @@
+"""Group multiple small images into larger textures.
+
+This module is used by :py:mod:`pyglet.resource` to efficiently pack small
+images into larger textures. :py:class:`~pyglet.image.atlas.TextureAtlas` maintains one texture;
+:py:class:`TextureBin` manages a collection of atlases of a given size.
+
+Example usage::
+
+ # Load images from disk
+ car_image = pyglet.image.load('car.png')
+ boat_image = pyglet.image.load('boat.png')
+
+ # Pack these images into one or more textures
+ bin = TextureBin()
+ car_texture = bin.add(car_image)
+ boat_texture = bin.add(boat_image)
+
+The result of :py:meth:`TextureBin.add` is a :py:class:`TextureRegion`
+containing the image. Once added, an image cannot be removed from a bin (or an
+atlas); nor can a list of images be obtained from a given bin or atlas -- it is
+the application's responsibility to keep track of the regions returned by the
+``add`` methods.
+
+.. versionadded:: 1.1
+"""
+
+import pyglet
+
+
+class AllocatorException(Exception):
+ """The allocator does not have sufficient free space for the requested
+ image size."""
+ pass
+
+
+class _Strip:
+ __slots__ = 'x', 'y', 'max_height', 'y2'
+
+ def __init__(self, y, max_height):
+ self.x = 0
+ self.y = y
+ self.max_height = max_height
+ self.y2 = y
+
+ def add(self, width, height):
+ assert width > 0 and height > 0
+ assert height <= self.max_height
+
+ x, y = self.x, self.y
+ self.x += width
+ self.y2 = max(self.y + height, self.y2)
+ return x, y
+
+ def compact(self):
+ self.max_height = self.y2 - self.y
+
+
+class Allocator:
+ """Rectangular area allocation algorithm.
+
+ Initialise with a given ``width`` and ``height``, then repeatedly
+ call `alloc` to retrieve free regions of the area and protect that
+ area from future allocations.
+
+ `Allocator` uses a fairly simple strips-based algorithm. It performs best
+ when rectangles are allocated in decreasing height order.
+ """
+ __slots__ = 'width', 'height', 'strips', 'used_area'
+
+ def __init__(self, width, height):
+ """Create an `Allocator` of the given size.
+
+ :Parameters:
+ `width` : int
+ Width of the allocation region.
+ `height` : int
+ Height of the allocation region.
+
+ """
+ assert width > 0 and height > 0
+ self.width = width
+ self.height = height
+ self.strips = [_Strip(0, height)]
+ self.used_area = 0
+
+ def alloc(self, width, height):
+ """Get a free area in the allocator of the given size.
+
+ After calling `alloc`, the requested area will no longer be used.
+ If there is not enough room to fit the given area `AllocatorException`
+ is raised.
+
+ :Parameters:
+ `width` : int
+ Width of the area to allocate.
+ `height` : int
+ Height of the area to allocate.
+
+ :rtype: int, int
+ :return: The X and Y coordinates of the bottom-left corner of the
+ allocated region.
+ """
+ for strip in self.strips:
+ if self.width - strip.x >= width and strip.max_height >= height:
+ self.used_area += width * height
+ return strip.add(width, height)
+
+ if self.width >= width and self.height - strip.y2 >= height:
+ self.used_area += width * height
+ strip.compact()
+ newstrip = _Strip(strip.y2, self.height - strip.y2)
+ self.strips.append(newstrip)
+ return newstrip.add(width, height)
+
+ raise AllocatorException('No more space in %r for box %dx%d' % (self, width, height))
+
+ def get_usage(self):
+ """Get the fraction of area already allocated.
+
+ This method is useful for debugging and profiling only.
+
+ :rtype: float
+ """
+ return self.used_area / float(self.width * self.height)
+
+ def get_fragmentation(self):
+ """Get the fraction of area that's unlikely to ever be used, based on
+ current allocation behaviour.
+
+ This method is useful for debugging and profiling only.
+
+ :rtype: float
+ """
+ # The total unused area in each compacted strip is summed.
+ if not self.strips:
+ return 0.0
+ possible_area = self.strips[-1].y2 * self.width
+ return 1.0 - self.used_area / float(possible_area)
+
+
+class TextureAtlas:
+ """Collection of images within a texture."""
+
+ def __init__(self, width=2048, height=2048):
+ """Create a texture atlas of the given size.
+
+ :Parameters:
+ `width` : int
+ Width of the underlying texture.
+ `height` : int
+ Height of the underlying texture.
+
+ """
+ max_texture_size = pyglet.image.get_max_texture_size()
+ width = min(width, max_texture_size)
+ height = min(height, max_texture_size)
+
+ self.texture = pyglet.image.Texture.create(width, height)
+ self.allocator = Allocator(width, height)
+
+ def add(self, img, border=0):
+ """Add an image to the atlas.
+
+ This method will fail if the given image cannot be transferred
+ directly to a texture (for example, if it is another texture).
+ :py:class:`~pyglet.image.ImageData` is the usual image type for this method.
+
+ `AllocatorException` will be raised if there is no room in the atlas
+ for the image.
+
+ :Parameters:
+ `img` : `~pyglet.image.AbstractImage`
+ The image to add.
+ `border` : int
+ Leaves specified pixels of blank space around
+ each image added to the Atlas.
+
+ :rtype: :py:class:`~pyglet.image.TextureRegion`
+ :return: The region of the atlas containing the newly added image.
+ """
+ x, y = self.allocator.alloc(img.width + border*2, img.height + border*2)
+ self.texture.blit_into(img, x+border, y+border, 0)
+ return self.texture.get_region(x+border, y+border, img.width, img.height)
+
+
+class TextureBin:
+ """Collection of texture atlases.
+
+ :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new
+ ones as necessary to accommodate images added to the bin.
+ """
+
+ def __init__(self, texture_width=2048, texture_height=2048):
+ """Create a texture bin for holding atlases of the given size.
+
+ :Parameters:
+ `texture_width` : int
+ Width of texture atlases to create.
+ `texture_height` : int
+ Height of texture atlases to create.
+ `border` : int
+ Leaves specified pixels of blank space around
+ each image added to the Atlases.
+
+ """
+ max_texture_size = pyglet.image.get_max_texture_size()
+ self.texture_width = min(texture_width, max_texture_size)
+ self.texture_height = min(texture_height, max_texture_size)
+ self.atlases = []
+
+ def add(self, img, border=0):
+ """Add an image into this texture bin.
+
+ This method calls `TextureAtlas.add` for the first atlas that has room
+ for the image.
+
+ `AllocatorException` is raised if the image exceeds the dimensions of
+ ``texture_width`` and ``texture_height``.
+
+ :Parameters:
+ `img` : `~pyglet.image.AbstractImage`
+ The image to add.
+ `border` : int
+ Leaves specified pixels of blank space around
+ each image added to the Atlas.
+
+ :rtype: :py:class:`~pyglet.image.TextureRegion`
+ :return: The region of an atlas containing the newly added image.
+ """
+ for atlas in list(self.atlases):
+ try:
+ return atlas.add(img, border)
+ except AllocatorException:
+ # Remove atlases that are no longer useful (so that their textures
+ # can later be freed if the images inside them get collected).
+ if img.width < 64 and img.height < 64:
+ self.atlases.remove(atlas)
+
+ atlas = TextureAtlas(self.texture_width, self.texture_height)
+ self.atlases.append(atlas)
+ return atlas.add(img, border)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/buffer.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/buffer.py
new file mode 100644
index 0000000000000000000000000000000000000000..c2ffdbd4385dd8234e880c0c188c16b401448159
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/buffer.py
@@ -0,0 +1,214 @@
+from pyglet.gl import *
+
+
+def get_max_color_attachments():
+ """Get the maximum allow Framebuffer Color attachements"""
+ number = GLint()
+ glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS, number)
+ return number.value
+
+
+class Renderbuffer:
+ """OpenGL Renderbuffer Object"""
+
+ def __init__(self, width, height, internal_format, samples=1):
+ """Create an instance of a Renderbuffer object."""
+ self._id = GLuint()
+ self._width = width
+ self._height = height
+ self._internal_format = internal_format
+
+ glGenRenderbuffers(1, self._id)
+ glBindRenderbuffer(GL_RENDERBUFFER, self._id)
+
+ if samples > 1:
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, internal_format, width, height)
+ else:
+ glRenderbufferStorage(GL_RENDERBUFFER, internal_format, width, height)
+
+ glBindRenderbuffer(GL_RENDERBUFFER, 0)
+
+ @property
+ def id(self):
+ return self._id.value
+
+ @property
+ def width(self):
+ return self._width
+
+ @property
+ def height(self):
+ return self._height
+
+ def bind(self):
+ glBindRenderbuffer(GL_RENDERBUFFER, self._id)
+
+ @staticmethod
+ def unbind():
+ glBindRenderbuffer(GL_RENDERBUFFER, 0)
+
+ def delete(self):
+ glDeleteRenderbuffers(1, self._id)
+
+ def __del__(self):
+ try:
+ glDeleteRenderbuffers(1, self._id)
+ # Python interpreter is shutting down:
+ except Exception:
+ pass
+
+ def __repr__(self):
+ return "{}(id={})".format(self.__class__.__name__, self._id.value)
+
+
+class Framebuffer:
+ """OpenGL Framebuffer Object"""
+
+ def __init__(self, target=GL_FRAMEBUFFER):
+ """Create an OpenGL Framebuffer object.
+
+ :rtype: :py:class:`~pyglet.image.Framebuffer`
+
+ .. versionadded:: 2.0
+ """
+ self._id = GLuint()
+ glGenFramebuffers(1, self._id)
+ self._attachment_types = 0
+ self._width = 0
+ self._height = 0
+ self.target = target
+
+ @property
+ def id(self):
+ return self._id.value
+
+ @property
+ def width(self):
+ """The width of the widest attachment."""
+ return self._width
+
+ @property
+ def height(self):
+ """The width of the widest attachment."""
+ return self._height
+
+ def bind(self):
+ glBindFramebuffer(self.target, self._id)
+
+ def unbind(self):
+ glBindFramebuffer(self.target, 0)
+
+ def clear(self):
+ if self._attachment_types:
+ self.bind()
+ glClear(self._attachment_types)
+ self.unbind()
+
+ def delete(self):
+ try:
+ glDeleteFramebuffers(1, self._id)
+ except Exception:
+ pass
+
+ @property
+ def is_complete(self):
+ return glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE
+
+ @staticmethod
+ def get_status():
+ states = {GL_FRAMEBUFFER_UNSUPPORTED: "Framebuffer unsupported. Try another format.",
+ GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: "Framebuffer incomplete attachment.",
+ GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: "Framebuffer missing attachment.",
+ GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: "Framebuffer unsupported dimension.",
+ GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: "Framebuffer incomplete formats.",
+ GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: "Framebuffer incomplete draw buffer.",
+ GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: "Framebuffer incomplete read buffer.",
+ GL_FRAMEBUFFER_COMPLETE: "Framebuffer is complete."}
+
+ gl_status = glCheckFramebufferStatus(GL_FRAMEBUFFER)
+
+ return states.get(gl_status, "Unknown error")
+
+ def attach_texture(self, texture, target=GL_FRAMEBUFFER, attachment=GL_COLOR_ATTACHMENT0):
+ """Attach a Texture to the Framebuffer
+
+ :Parameters:
+ `texture` : pyglet.image.Texture
+ Specifies the texture object to attach to the framebuffer attachment
+ point named by attachment.
+ `target` : int
+ Specifies the framebuffer target. target must be GL_DRAW_FRAMEBUFFER,
+ GL_READ_FRAMEBUFFER, or GL_FRAMEBUFFER. GL_FRAMEBUFFER is equivalent
+ to GL_DRAW_FRAMEBUFFER.
+ `attachment` : int
+ Specifies the attachment point of the framebuffer. attachment must be
+ GL_COLOR_ATTACHMENTi, GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT or
+ GL_DEPTH_STENCIL_ATTACHMENT.
+ """
+ self.bind()
+ glFramebufferTexture(target, attachment, texture.id, texture.level)
+ # glFramebufferTexture2D(target, attachment, texture.target, texture.id, texture.level)
+ self._attachment_types |= attachment
+ self._width = max(texture.width, self._width)
+ self._height = max(texture.height, self._height)
+ self.unbind()
+
+ def attach_texture_layer(self, texture, layer, level, target=GL_FRAMEBUFFER, attachment=GL_COLOR_ATTACHMENT0):
+ """Attach a Texture layer to the Framebuffer
+
+ :Parameters:
+ `texture` : pyglet.image.TextureArray
+ Specifies the texture object to attach to the framebuffer attachment
+ point named by attachment.
+ `layer` : int
+ Specifies the layer of texture to attach.
+ `level` : int
+ Specifies the mipmap level of texture to attach.
+ `target` : int
+ Specifies the framebuffer target. target must be GL_DRAW_FRAMEBUFFER,
+ GL_READ_FRAMEBUFFER, or GL_FRAMEBUFFER. GL_FRAMEBUFFER is equivalent
+ to GL_DRAW_FRAMEBUFFER.
+ `attachment` : int
+ Specifies the attachment point of the framebuffer. attachment must be
+ GL_COLOR_ATTACHMENTi, GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT or
+ GL_DEPTH_STENCIL_ATTACHMENT.
+ """
+ self.bind()
+ glFramebufferTextureLayer(target, attachment, texture.id, level, layer)
+ self._attachment_types |= attachment
+ self._width = max(texture.width, self._width)
+ self._height = max(texture.height, self._height)
+ self.unbind()
+
+ def attach_renderbuffer(self, renderbuffer, target=GL_FRAMEBUFFER, attachment=GL_COLOR_ATTACHMENT0):
+ """"Attach a Renderbuffer to the Framebuffer
+
+ :Parameters:
+ `renderbuffer` : pyglet.image.Renderbuffer
+ Specifies the Renderbuffer to attach to the framebuffer attachment
+ point named by attachment.
+ `target` : int
+ Specifies the framebuffer target. target must be GL_DRAW_FRAMEBUFFER,
+ GL_READ_FRAMEBUFFER, or GL_FRAMEBUFFER. GL_FRAMEBUFFER is equivalent
+ to GL_DRAW_FRAMEBUFFER.
+ `attachment` : int
+ Specifies the attachment point of the framebuffer. attachment must be
+ GL_COLOR_ATTACHMENTi, GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT or
+ GL_DEPTH_STENCIL_ATTACHMENT.
+ """
+ self.bind()
+ glFramebufferRenderbuffer(target, attachment, GL_RENDERBUFFER, renderbuffer.id)
+ self._attachment_types |= attachment
+ self._width = max(renderbuffer.width, self._width)
+ self._height = max(renderbuffer.height, self._height)
+ self.unbind()
+
+ def __del__(self):
+ try:
+ glDeleteFramebuffers(1, self._id)
+ # Python interpreter is shutting down:
+ except Exception:
+ pass
+
+ def __repr__(self):
+ return "{}(id={})".format(self.__class__.__name__, self._id.value)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..b91c30629d019acb05d029a11b5eca3ee7cc0b53
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/__init__.py
@@ -0,0 +1,203 @@
+"""Collection of image encoders and decoders.
+
+Modules must subclass ImageDecoder and ImageEncoder for each method of
+decoding/encoding they support.
+
+Modules must also implement the two functions::
+
+ def get_decoders():
+ # Return a list of ImageDecoder instances or []
+ return []
+
+ def get_encoders():
+ # Return a list of ImageEncoder instances or []
+ return []
+
+"""
+
+import os.path
+
+from pyglet.util import CodecRegistry, Decoder, Encoder, DecodeException, EncodeException
+from pyglet import compat_platform
+
+
+class _ImageCodecRegistry(CodecRegistry):
+ """Subclass of CodecRegistry that adds support for animation methods."""
+
+ def __init__(self):
+ self._decoder_animation_extensions = {}
+ super().__init__()
+
+ def add_decoders(self, module):
+ """Override the default method to also add animation decoders.
+ """
+ super().add_decoders(module)
+ for decoder in module.get_decoders():
+ for extension in decoder.get_animation_file_extensions():
+ if extension not in self._decoder_animation_extensions:
+ self._decoder_animation_extensions[extension] = []
+ self._decoder_animation_extensions[extension].append(decoder)
+
+ def get_animation_decoders(self, filename=None):
+ """Get a list of animation decoders. If a `filename` is provided, only
+ decoders supporting that extension will be returned. An empty list
+ will be return if no encoders for that extension are available.
+ """
+ if filename:
+ extension = os.path.splitext(filename)[1].lower()
+ return self._decoder_animation_extensions.get(extension, [])
+ return self._decoders
+
+ def decode_animation(self, filename, file, **kwargs):
+ first_exception = None
+
+ for decoder in self.get_animation_decoders(filename):
+ try:
+ return decoder.decode_animation(filename, file, **kwargs)
+ except DecodeException as e:
+ if not first_exception:
+ first_exception = e
+ if file:
+ file.seek(0)
+
+ for decoder in self.get_animation_decoders(): # Try ALL codecs
+ try:
+ return decoder.decode_animation(filename, file, **kwargs)
+ except DecodeException:
+ if file:
+ file.seek(0)
+
+ if not first_exception:
+ raise DecodeException(f"No decoders available for this file type: {filename}")
+ raise first_exception
+
+
+registry = _ImageCodecRegistry()
+add_decoders = registry.add_decoders
+add_encoders = registry.add_encoders
+get_animation_decoders = registry.get_animation_decoders
+get_decoders = registry.get_decoders
+get_encoders = registry.get_encoders
+
+
+class ImageDecodeException(DecodeException):
+ pass
+
+
+class ImageEncodeException(EncodeException):
+ pass
+
+
+class ImageDecoder(Decoder):
+
+ def get_animation_file_extensions(self):
+ """Return a list of accepted file extensions, e.g. ['.gif', '.flc']
+ Lower-case only.
+ """
+ return []
+
+ def decode(self, filename, file):
+ """Decode the given file object and return an instance of `Image`.
+ Throws ImageDecodeException if there is an error. filename
+ can be a file type hint.
+ """
+ raise NotImplementedError()
+
+ def decode_animation(self, filename, file):
+ """Decode the given file object and return an instance of :py:class:`~pyglet.image.Animation`.
+ Throws ImageDecodeException if there is an error. filename
+ can be a file type hint.
+ """
+ raise ImageDecodeException('This decoder cannot decode animations.')
+
+ def __repr__(self):
+ return "{0}{1}".format(self.__class__.__name__,
+ self.get_animation_file_extensions() +
+ self.get_file_extensions())
+
+
+class ImageEncoder(Encoder):
+
+ def encode(self, image, filename, file):
+ """Encode the given image to the given file. filename
+ provides a hint to the file format desired.
+ """
+ raise NotImplementedError()
+
+ def __repr__(self):
+ return "{0}{1}".format(self.__class__.__name__, self.get_file_extensions())
+
+
+def add_default_codecs():
+ # Add the codecs we know about. These should be listed in order of
+ # preference. This is called automatically by pyglet.image.
+
+ # Compressed texture in DDS format
+ try:
+ from pyglet.image.codecs import dds
+ registry.add_encoders(dds)
+ registry.add_decoders(dds)
+ except ImportError:
+ pass
+
+ # Mac OS X default: Quartz
+ if compat_platform == 'darwin':
+ try:
+ from pyglet.image.codecs import quartz
+ registry.add_encoders(quartz)
+ registry.add_decoders(quartz)
+ except ImportError:
+ pass
+
+ # Windows 7 default: Windows Imaging Component
+ if compat_platform in ('win32', 'cygwin'):
+ from pyglet.libs.win32.constants import WINDOWS_7_OR_GREATER
+ if WINDOWS_7_OR_GREATER: # Supports Vista and above.
+ try:
+ from pyglet.image.codecs import wic
+ registry.add_encoders(wic)
+ registry.add_decoders(wic)
+ except ImportError:
+ pass
+
+ # Windows XP default: GDI+
+ if compat_platform in ('win32', 'cygwin'):
+ try:
+ from pyglet.image.codecs import gdiplus
+ registry.add_encoders(gdiplus)
+ registry.add_decoders(gdiplus)
+ except ImportError:
+ pass
+
+ # Linux default: GdkPixbuf 2.0
+ if compat_platform.startswith('linux'):
+ try:
+ from pyglet.image.codecs import gdkpixbuf2
+ registry.add_encoders(gdkpixbuf2)
+ registry.add_decoders(gdkpixbuf2)
+ except ImportError:
+ pass
+
+ # Fallback: PIL
+ try:
+ from pyglet.image.codecs import pil
+ registry.add_encoders(pil)
+ registry.add_decoders(pil)
+ except ImportError:
+ pass
+
+ # Fallback: PNG loader (slow)
+ try:
+ from pyglet.image.codecs import png
+ registry.add_encoders(png)
+ registry.add_decoders(png)
+ except ImportError:
+ pass
+
+ # Fallback: BMP loader (slow)
+ try:
+ from pyglet.image.codecs import bmp
+ registry.add_encoders(bmp)
+ registry.add_decoders(bmp)
+ except ImportError:
+ pass
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/bmp.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/bmp.py
new file mode 100644
index 0000000000000000000000000000000000000000..ca22c3394dc464c3341609865bf1be16f9aaff3d
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/bmp.py
@@ -0,0 +1,322 @@
+"""Decoder for BMP files.
+
+Currently supports version 3 and 4 bitmaps with BI_RGB and BI_BITFIELDS
+encoding. Alpha channel is supported for 32-bit BI_RGB only.
+"""
+
+# Official docs are at
+# http://msdn2.microsoft.com/en-us/library/ms532311.aspx
+#
+# But some details including alignment and bit/byte order are omitted; see
+# http://www.fileformat.info/format/bmp/egff.htm
+
+import ctypes
+
+from pyglet.image import ImageData
+from pyglet.image.codecs import ImageDecoder, ImageDecodeException
+
+BYTE = ctypes.c_ubyte
+WORD = ctypes.c_uint16
+DWORD = ctypes.c_uint32
+LONG = ctypes.c_int32
+FXPT2DOT30 = ctypes.c_uint32
+
+BI_RGB = 0
+BI_RLE8 = 1
+BI_RLE4 = 2
+BI_BITFIELDS = 3
+
+class BITMAPFILEHEADER(ctypes.LittleEndianStructure):
+ _pack_ = 1
+ _fields_ = [
+ ('bfType', WORD),
+ ('bfSize', DWORD),
+ ('bfReserved1', WORD),
+ ('bfReserved2', WORD),
+ ('bfOffBits', DWORD)
+ ]
+
+class BITMAPINFOHEADER(ctypes.LittleEndianStructure):
+ _pack_ = 1
+ _fields_ = [
+ ('biSize', DWORD),
+ ('biWidth', LONG),
+ ('biHeight', LONG),
+ ('biPlanes', WORD),
+ ('biBitCount', WORD),
+ ('biCompression', DWORD),
+ ('biSizeImage', DWORD),
+ ('biXPelsPerMeter', LONG),
+ ('biYPelsPerMeter', LONG),
+ ('biClrUsed', DWORD),
+ ('biClrImportant', DWORD)
+ ]
+
+CIEXYZTRIPLE = FXPT2DOT30 * 9
+
+class BITMAPV4HEADER(ctypes.LittleEndianStructure):
+ _pack_ = 1
+ _fields_ = [
+ ('biSize', DWORD),
+ ('biWidth', LONG),
+ ('biHeight', LONG),
+ ('biPlanes', WORD),
+ ('biBitCount', WORD),
+ ('biCompression', DWORD),
+ ('biSizeImage', DWORD),
+ ('biXPelsPerMeter', LONG),
+ ('biYPelsPerMeter', LONG),
+ ('biClrUsed', DWORD),
+ ('biClrImportant', DWORD),
+ ('bV4RedMask', DWORD),
+ ('bV4GreenMask', DWORD),
+ ('bV4BlueMask', DWORD),
+ ('bV4AlphaMask', DWORD),
+ ('bV4CSType', DWORD),
+ ('bV4Endpoints', CIEXYZTRIPLE),
+ ('bV4GammaRed', DWORD),
+ ('bV4GammaGreen', DWORD),
+ ('bV4GammaBlue', DWORD),
+ ]
+
+class RGBFields(ctypes.LittleEndianStructure):
+ _pack_ = 1
+ _fields_ = [
+ ('red', DWORD),
+ ('green', DWORD),
+ ('blue', DWORD),
+ ]
+
+
+class RGBQUAD(ctypes.LittleEndianStructure):
+ _pack_ = 1
+ _fields_ = [
+ ('rgbBlue', BYTE),
+ ('rgbGreen', BYTE),
+ ('rgbRed', BYTE),
+ ('rgbReserved', BYTE)
+ ]
+
+ def __repr__(self):
+ return '<%d, %d, %d>' % (self.rgbRed, self.rgbGreen, self.rgbBlue)
+
+def ptr_add(ptr, offset):
+ address = ctypes.addressof(ptr.contents) + offset
+ return ctypes.pointer(type(ptr.contents).from_address(address))
+
+def to_ctypes(buffer, offset, type):
+ if offset + ctypes.sizeof(type) > len(buffer):
+ raise ImageDecodeException('BMP file is truncated')
+ ptr = ptr_add(ctypes.pointer(buffer), offset)
+ return ctypes.cast(ptr, ctypes.POINTER(type)).contents
+
+class BMPImageDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ return ['.bmp']
+
+ def decode(self, filename, file):
+ if not file:
+ file = open(filename, 'rb')
+ bytes = file.read()
+ buffer = ctypes.c_buffer(bytes)
+
+ if bytes[:2] != b'BM':
+ raise ImageDecodeException(
+ 'Not a Windows bitmap file: %r' % (filename or file))
+
+ file_header = to_ctypes(buffer, 0, BITMAPFILEHEADER)
+ bits_offset = file_header.bfOffBits
+ info_header_offset = ctypes.sizeof(BITMAPFILEHEADER)
+ info_header = to_ctypes(buffer, info_header_offset, BITMAPINFOHEADER)
+ palette_offset = info_header_offset + info_header.biSize
+
+ if info_header.biSize < ctypes.sizeof(BITMAPINFOHEADER):
+ raise ImageDecodeException(
+ 'Unsupported BMP type: %r' % (filename or file))
+
+ width = info_header.biWidth
+ height = info_header.biHeight
+ if width <= 0 or info_header.biPlanes != 1:
+ raise ImageDecodeException(
+ 'BMP file has corrupt parameters: %r' % (filename or file))
+ pitch_sign = height < 0 and -1 or 1
+ height = abs(height)
+
+ compression = info_header.biCompression
+ if compression not in (BI_RGB, BI_BITFIELDS):
+ raise ImageDecodeException(
+ 'Unsupported compression: %r' % (filename or file))
+
+ clr_used = 0
+ bitcount = info_header.biBitCount
+ if bitcount == 1:
+ pitch = (width + 7) // 8
+ bits_type = ctypes.c_ubyte
+ decoder = decode_1bit
+ elif bitcount == 4:
+ pitch = (width + 1) // 2
+ bits_type = ctypes.c_ubyte
+ decoder = decode_4bit
+ elif bitcount == 8:
+ bits_type = ctypes.c_ubyte
+ pitch = width
+ decoder = decode_8bit
+ elif bitcount == 16:
+ pitch = width * 2
+ bits_type = ctypes.c_uint16
+ decoder = decode_bitfields
+ elif bitcount == 24:
+ pitch = width * 3
+ bits_type = ctypes.c_ubyte
+ decoder = decode_24bit
+ elif bitcount == 32:
+ pitch = width * 4
+ if compression == BI_RGB:
+ decoder = decode_32bit_rgb
+ bits_type = ctypes.c_ubyte
+ elif compression == BI_BITFIELDS:
+ decoder = decode_bitfields
+ bits_type = ctypes.c_uint32
+ else:
+ raise ImageDecodeException(
+ 'Unsupported compression: %r' % (filename or file))
+ else:
+ raise ImageDecodeException(
+ 'Unsupported bit count %d: %r' % (bitcount, filename or file))
+
+ pitch = (pitch + 3) & ~3
+ packed_width = pitch // ctypes.sizeof(bits_type)
+
+ if bitcount < 16 and compression == BI_RGB:
+ clr_used = info_header.biClrUsed or (1 << bitcount)
+ palette = to_ctypes(buffer, palette_offset, RGBQUAD * clr_used)
+ bits = to_ctypes(buffer, bits_offset,
+ bits_type * packed_width * height)
+ return decoder(bits, palette, width, height, pitch, pitch_sign)
+ elif bitcount >= 16 and compression == BI_RGB:
+ bits = to_ctypes(buffer, bits_offset,
+ bits_type * (packed_width * height))
+ return decoder(bits, None, width, height, pitch, pitch_sign)
+ elif compression == BI_BITFIELDS:
+ if info_header.biSize >= ctypes.sizeof(BITMAPV4HEADER):
+ info_header = to_ctypes(buffer, info_header_offset,
+ BITMAPV4HEADER)
+ r_mask = info_header.bV4RedMask
+ g_mask = info_header.bV4GreenMask
+ b_mask = info_header.bV4BlueMask
+ else:
+ fields_offset = info_header_offset + \
+ ctypes.sizeof(BITMAPINFOHEADER)
+ fields = to_ctypes(buffer, fields_offset, RGBFields)
+ r_mask = fields.red
+ g_mask = fields.green
+ b_mask = fields.blue
+ class _BitsArray(ctypes.LittleEndianStructure):
+ _pack_ = 1
+ _fields_ = [
+ ('data', bits_type * packed_width * height),
+ ]
+ bits = to_ctypes(buffer, bits_offset, _BitsArray).data
+ return decoder(bits, r_mask, g_mask, b_mask,
+ width, height, pitch, pitch_sign)
+
+def decode_1bit(bits, palette, width, height, pitch, pitch_sign):
+ rgb_pitch = (((pitch << 3) + 7) & ~0x7) * 3
+ buffer = (ctypes.c_ubyte * (height * rgb_pitch))()
+ i = 0
+ for row in bits:
+ for packed in row:
+ for _ in range(8):
+ rgb = palette[(packed & 0x80) >> 7]
+ buffer[i] = rgb.rgbRed
+ buffer[i + 1] = rgb.rgbGreen
+ buffer[i + 2] = rgb.rgbBlue
+ i += 3
+ packed <<= 1
+
+ return ImageData(width, height, 'RGB', buffer, pitch_sign * rgb_pitch)
+
+def decode_4bit(bits, palette, width, height, pitch, pitch_sign):
+ rgb_pitch = (((pitch << 1) + 1) & ~0x1) * 3
+ buffer = (ctypes.c_ubyte * (height * rgb_pitch))()
+ i = 0
+ for row in bits:
+ for packed in row:
+ for index in ((packed & 0xf0) >> 4, packed & 0xf):
+ rgb = palette[index]
+ buffer[i] = rgb.rgbRed
+ buffer[i + 1] = rgb.rgbGreen
+ buffer[i + 2] = rgb.rgbBlue
+ i += 3
+
+ return ImageData(width, height, 'RGB', buffer, pitch_sign * rgb_pitch)
+
+def decode_8bit(bits, palette, width, height, pitch, pitch_sign):
+ rgb_pitch = pitch * 3
+ buffer = (ctypes.c_ubyte * (height * rgb_pitch))()
+ i = 0
+ for row in bits:
+ for index in row:
+ rgb = palette[index]
+ buffer[i] = rgb.rgbRed
+ buffer[i + 1] = rgb.rgbGreen
+ buffer[i + 2] = rgb.rgbBlue
+ i += 3
+
+ return ImageData(width, height, 'RGB', buffer, pitch_sign * rgb_pitch)
+
+
+def decode_24bit(bits, palette, width, height, pitch, pitch_sign):
+ buffer = (ctypes.c_ubyte * (height * pitch))()
+ ctypes.memmove(buffer, bits, len(buffer))
+ return ImageData(width, height, 'BGR', buffer, pitch_sign * pitch)
+
+def decode_32bit_rgb(bits, palette, width, height, pitch, pitch_sign):
+ buffer = (ctypes.c_ubyte * (height * pitch))()
+ ctypes.memmove(buffer, bits, len(buffer))
+ return ImageData(width, height, 'BGRA', buffer, pitch_sign * pitch)
+
+def get_shift(mask):
+ if not mask:
+ return 0
+
+ # Shift down
+ shift = 0
+ while not (1 << shift) & mask:
+ shift += 1
+
+ # Shift up
+ shift_up = 0
+ while (mask >> shift) >> shift_up:
+ shift_up += 1
+
+ s = shift - (8 - shift_up)
+ if s < 0:
+ return 0, -s
+ else:
+ return s, 0
+
+def decode_bitfields(bits, r_mask, g_mask, b_mask,
+ width, height, pitch, pitch_sign):
+ r_shift1, r_shift2 = get_shift(r_mask)
+ g_shift1, g_shift2 = get_shift(g_mask)
+ b_shift1, b_shift2 = get_shift(b_mask)
+
+ rgb_pitch = 3 * len(bits[0])
+ buffer = (ctypes.c_ubyte * (height * rgb_pitch))()
+
+ i = 0
+ for row in bits:
+ for packed in row:
+ buffer[i] = (packed & r_mask) >> r_shift1 << r_shift2
+ buffer[i+1] = (packed & g_mask) >> g_shift1 << g_shift2
+ buffer[i+2] = (packed & b_mask) >> b_shift1 << b_shift2
+ i += 3
+
+ return ImageData(width, height, 'RGB', buffer, pitch_sign * rgb_pitch)
+
+def get_decoders():
+ return [BMPImageDecoder()]
+
+def get_encoders():
+ return []
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/dds.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/dds.py
new file mode 100644
index 0000000000000000000000000000000000000000..f078a453d0f485173e717c7c0fd34909a48497b1
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/dds.py
@@ -0,0 +1,189 @@
+"""DDS texture loader.
+
+Reference: http://msdn2.microsoft.com/en-us/library/bb172993.aspx
+"""
+
+import struct
+import itertools
+
+from pyglet.gl import *
+from pyglet.image import CompressedImageData
+from pyglet.image import codecs
+from pyglet.image.codecs import s3tc, ImageDecodeException
+
+
+# dwFlags of DDSURFACEDESC2
+DDSD_CAPS = 0x00000001
+DDSD_HEIGHT = 0x00000002
+DDSD_WIDTH = 0x00000004
+DDSD_PITCH = 0x00000008
+DDSD_PIXELFORMAT = 0x00001000
+DDSD_MIPMAPCOUNT = 0x00020000
+DDSD_LINEARSIZE = 0x00080000
+DDSD_DEPTH = 0x00800000
+
+# ddpfPixelFormat of DDSURFACEDESC2
+DDPF_ALPHAPIXELS = 0x00000001
+DDPF_FOURCC = 0x00000004
+DDPF_RGB = 0x00000040
+
+# dwCaps1 of DDSCAPS2
+DDSCAPS_COMPLEX = 0x00000008
+DDSCAPS_TEXTURE = 0x00001000
+DDSCAPS_MIPMAP = 0x00400000
+
+# dwCaps2 of DDSCAPS2
+DDSCAPS2_CUBEMAP = 0x00000200
+DDSCAPS2_CUBEMAP_POSITIVEX = 0x00000400
+DDSCAPS2_CUBEMAP_NEGATIVEX = 0x00000800
+DDSCAPS2_CUBEMAP_POSITIVEY = 0x00001000
+DDSCAPS2_CUBEMAP_NEGATIVEY = 0x00002000
+DDSCAPS2_CUBEMAP_POSITIVEZ = 0x00004000
+DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x00008000
+DDSCAPS2_VOLUME = 0x00200000
+
+
+class _FileStruct:
+ _fields = []
+
+ def __init__(self, data):
+ if len(data) < self.get_size():
+ raise ImageDecodeException('Not a DDS file')
+ items = struct.unpack(self.get_format(), data)
+ for field, value in itertools.zip_longest(self._fields, items, fillvalue=None):
+ setattr(self, field[0], value)
+
+ def __repr__(self):
+ name = self.__class__.__name__
+ return '%s(%s)' % (name, (', \n%s' % (' ' * (len(name) + 1))).join(
+ ['%s = %s' % (field[0], repr(getattr(self, field[0]))) for field in self._fields]))
+
+ @classmethod
+ def get_format(cls):
+ return '<' + ''.join([f[1] for f in cls._fields])
+
+ @classmethod
+ def get_size(cls):
+ return struct.calcsize(cls.get_format())
+
+
+class DDSURFACEDESC2(_FileStruct):
+ _fields = [
+ ('dwMagic', '4s'),
+ ('dwSize', 'I'),
+ ('dwFlags', 'I'),
+ ('dwHeight', 'I'),
+ ('dwWidth', 'I'),
+ ('dwPitchOrLinearSize', 'I'),
+ ('dwDepth', 'I'),
+ ('dwMipMapCount', 'I'),
+ ('dwReserved1', '44s'),
+ ('ddpfPixelFormat', '32s'),
+ ('dwCaps1', 'I'),
+ ('dwCaps2', 'I'),
+ ('dwCapsReserved', '8s'),
+ ('dwReserved2', 'I')
+ ]
+
+ def __init__(self, data):
+ super(DDSURFACEDESC2, self).__init__(data)
+ self.ddpfPixelFormat = DDPIXELFORMAT(self.ddpfPixelFormat)
+
+
+class DDPIXELFORMAT(_FileStruct):
+ _fields = [
+ ('dwSize', 'I'),
+ ('dwFlags', 'I'),
+ ('dwFourCC', '4s'),
+ ('dwRGBBitCount', 'I'),
+ ('dwRBitMask', 'I'),
+ ('dwGBitMask', 'I'),
+ ('dwBBitMask', 'I'),
+ ('dwRGBAlphaBitMask', 'I')
+ ]
+
+
+_compression_formats = {
+ (b'DXT1', False): (GL_COMPRESSED_RGB_S3TC_DXT1_EXT, s3tc.decode_dxt1_rgb),
+ (b'DXT1', True): (GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, s3tc.decode_dxt1_rgba),
+ (b'DXT3', False): (GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, s3tc.decode_dxt3),
+ (b'DXT3', True): (GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, s3tc.decode_dxt3),
+ (b'DXT5', False): (GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, s3tc.decode_dxt5),
+ (b'DXT5', True): (GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, s3tc.decode_dxt5),
+}
+
+
+class DDSImageDecoder(codecs.ImageDecoder):
+ def get_file_extensions(self):
+ return ['.dds']
+
+ def decode(self, filename, file):
+ if not file:
+ file = open(filename, 'rb')
+
+ header = file.read(DDSURFACEDESC2.get_size())
+ desc = DDSURFACEDESC2(header)
+ if desc.dwMagic != b'DDS ' or desc.dwSize != 124:
+ raise ImageDecodeException('Invalid DDS file (incorrect header).')
+
+ width = desc.dwWidth
+ height = desc.dwHeight
+ mipmaps = 1
+
+ if desc.dwFlags & DDSD_DEPTH:
+ raise ImageDecodeException('Volume DDS files unsupported')
+
+ if desc.dwFlags & DDSD_MIPMAPCOUNT:
+ mipmaps = desc.dwMipMapCount
+
+ if desc.ddpfPixelFormat.dwSize != 32:
+ raise ImageDecodeException('Invalid DDS file (incorrect pixel format).')
+
+ if desc.dwCaps2 & DDSCAPS2_CUBEMAP:
+ raise ImageDecodeException('Cubemap DDS files unsupported')
+
+ if not desc.ddpfPixelFormat.dwFlags & DDPF_FOURCC:
+ raise ImageDecodeException('Uncompressed DDS textures not supported.')
+
+ has_alpha = desc.ddpfPixelFormat.dwRGBAlphaBitMask != 0
+
+ selector = (desc.ddpfPixelFormat.dwFourCC, has_alpha)
+ if selector not in _compression_formats:
+ raise ImageDecodeException('Unsupported texture compression %s' % desc.ddpfPixelFormat.dwFourCC)
+
+ dformat, decoder = _compression_formats[selector]
+ if dformat == GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ block_size = 8
+ else:
+ block_size = 16
+
+ datas = []
+ w, h = width, height
+ for i in range(mipmaps):
+ if not w and not h:
+ break
+ if not w:
+ w = 1
+ if not h:
+ h = 1
+ size = ((w + 3) // 4) * ((h + 3) // 4) * block_size
+ data = file.read(size)
+ datas.append(data)
+ w >>= 1
+ h >>= 1
+
+ image = CompressedImageData(width, height, dformat, datas[0], 'GL_EXT_texture_compression_s3tc', decoder)
+ level = 0
+ for data in datas[1:]:
+ level += 1
+ image.set_mipmap_data(level, data)
+
+ return image
+
+
+def get_decoders():
+ return [DDSImageDecoder()]
+
+
+def get_encoders():
+ return []
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/gdiplus.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/gdiplus.py
new file mode 100644
index 0000000000000000000000000000000000000000..235e1a76377bc910c12211ef1673fb7e0fcc88a3
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/gdiplus.py
@@ -0,0 +1,311 @@
+from pyglet.libs.win32.com import pIUnknown
+from pyglet.image import *
+from pyglet.image.codecs import *
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+from pyglet.libs.win32 import _kernel32 as kernel32
+from pyglet.libs.win32 import _ole32 as ole32
+
+
+gdiplus = windll.gdiplus
+
+REAL = c_float
+
+PixelFormat1bppIndexed = 196865
+PixelFormat4bppIndexed = 197634
+PixelFormat8bppIndexed = 198659
+PixelFormat16bppGrayScale = 1052676
+PixelFormat16bppRGB555 = 135173
+PixelFormat16bppRGB565 = 135174
+PixelFormat16bppARGB1555 = 397319
+PixelFormat24bppRGB = 137224
+PixelFormat32bppRGB = 139273
+PixelFormat32bppARGB = 2498570
+PixelFormat32bppPARGB = 925707
+PixelFormat48bppRGB = 1060876
+PixelFormat64bppARGB = 3424269
+PixelFormat64bppPARGB = 29622286
+PixelFormatMax = 15
+
+ImageLockModeRead = 1
+ImageLockModeWrite = 2
+ImageLockModeUserInputBuf = 4
+
+PropertyTagFrameDelay = 0x5100
+
+
+class GdiplusStartupInput(Structure):
+ _fields_ = [
+ ('GdiplusVersion', c_uint32),
+ ('DebugEventCallback', c_void_p),
+ ('SuppressBackgroundThread', BOOL),
+ ('SuppressExternalCodecs', BOOL)
+ ]
+
+
+class GdiplusStartupOutput(Structure):
+ _fields = [
+ ('NotificationHookProc', c_void_p),
+ ('NotificationUnhookProc', c_void_p)
+ ]
+
+
+class BitmapData(Structure):
+ _fields_ = [
+ ('Width', c_uint),
+ ('Height', c_uint),
+ ('Stride', c_int),
+ ('PixelFormat', c_int),
+ ('Scan0', POINTER(c_byte)),
+ ('Reserved', POINTER(c_uint))
+ ]
+
+
+class Rect(Structure):
+ _fields_ = [
+ ('X', c_int),
+ ('Y', c_int),
+ ('Width', c_int),
+ ('Height', c_int)
+ ]
+
+
+class PropertyItem(Structure):
+ _fields_ = [
+ ('id', c_uint),
+ ('length', c_ulong),
+ ('type', c_short),
+ ('value', c_void_p)
+ ]
+
+
+INT_PTR = POINTER(INT)
+UINT_PTR = POINTER(UINT)
+
+
+gdiplus.GdipBitmapLockBits.restype = c_int
+gdiplus.GdipBitmapLockBits.argtypes = [c_void_p, c_void_p, UINT, c_int, c_void_p]
+gdiplus.GdipBitmapUnlockBits.restype = c_int
+gdiplus.GdipBitmapUnlockBits.argtypes = [c_void_p, c_void_p]
+gdiplus.GdipCloneStringFormat.restype = c_int
+gdiplus.GdipCloneStringFormat.argtypes = [c_void_p, c_void_p]
+gdiplus.GdipCreateBitmapFromScan0.restype = c_int
+gdiplus.GdipCreateBitmapFromScan0.argtypes = [c_int, c_int, c_int, c_int, POINTER(BYTE), c_void_p]
+gdiplus.GdipCreateBitmapFromStream.restype = c_int
+gdiplus.GdipCreateBitmapFromStream.argtypes = [c_void_p, c_void_p]
+gdiplus.GdipCreateFont.restype = c_int
+gdiplus.GdipCreateFont.argtypes = [c_void_p, REAL, INT, c_int, c_void_p]
+gdiplus.GdipCreateFontFamilyFromName.restype = c_int
+gdiplus.GdipCreateFontFamilyFromName.argtypes = [c_wchar_p, c_void_p, c_void_p]
+gdiplus.GdipCreateMatrix.restype = None
+gdiplus.GdipCreateMatrix.argtypes = [c_void_p]
+gdiplus.GdipCreateSolidFill.restype = c_int
+gdiplus.GdipCreateSolidFill.argtypes = [c_int, c_void_p] # ARGB
+gdiplus.GdipDisposeImage.restype = c_int
+gdiplus.GdipDisposeImage.argtypes = [c_void_p]
+gdiplus.GdipDrawString.restype = c_int
+gdiplus.GdipDrawString.argtypes = [c_void_p, c_wchar_p, c_int, c_void_p, c_void_p, c_void_p, c_void_p]
+gdiplus.GdipGetFamilyName.restype = c_int
+gdiplus.GdipGetFamilyName.argtypes = [LONG_PTR, c_wchar_p, c_wchar]
+gdiplus.GdipFlush.restype = c_int
+gdiplus.GdipFlush.argtypes = [c_void_p, c_int]
+gdiplus.GdipGetFontCollectionFamilyCount.restype = c_int
+gdiplus.GdipGetFontCollectionFamilyCount.argtypes = [c_void_p, INT_PTR]
+gdiplus.GdipGetFontCollectionFamilyList.restype = c_int
+gdiplus.GdipGetFontCollectionFamilyList.argtypes = [c_void_p, INT, c_void_p, INT_PTR]
+gdiplus.GdipGetImageDimension.restype = c_int
+gdiplus.GdipGetImageDimension.argtypes = [c_void_p, POINTER(REAL), POINTER(REAL)]
+gdiplus.GdipGetImageGraphicsContext.restype = c_int
+gdiplus.GdipGetImageGraphicsContext.argtypes = [c_void_p, c_void_p]
+gdiplus.GdipGetImagePixelFormat.restype = c_int
+gdiplus.GdipGetImagePixelFormat.argtypes = [c_void_p, c_void_p]
+gdiplus.GdipGetPropertyItem.restype = c_int
+gdiplus.GdipGetPropertyItem.argtypes = [c_void_p, c_uint, c_uint, c_void_p]
+gdiplus.GdipGetPropertyItemSize.restype = c_int
+gdiplus.GdipGetPropertyItemSize.argtypes = [c_void_p, c_uint, UINT_PTR]
+gdiplus.GdipGraphicsClear.restype = c_int
+gdiplus.GdipGraphicsClear.argtypes = [c_void_p, c_int] # ARGB
+gdiplus.GdipImageGetFrameCount.restype = c_int
+gdiplus.GdipImageGetFrameCount.argtypes = [c_void_p, c_void_p, UINT_PTR]
+gdiplus.GdipImageGetFrameDimensionsCount.restype = c_int
+gdiplus.GdipImageGetFrameDimensionsCount.argtypes = [c_void_p, UINT_PTR]
+gdiplus.GdipImageGetFrameDimensionsList.restype = c_int
+gdiplus.GdipImageGetFrameDimensionsList.argtypes = [c_void_p, c_void_p, UINT]
+gdiplus.GdipImageSelectActiveFrame.restype = c_int
+gdiplus.GdipImageSelectActiveFrame.argtypes = [c_void_p, c_void_p, UINT]
+gdiplus.GdipMeasureString.restype = c_int
+gdiplus.GdipMeasureString.argtypes = [c_void_p, c_wchar_p, c_int, c_void_p, c_void_p, c_void_p, c_void_p, INT_PTR, INT_PTR]
+gdiplus.GdipNewPrivateFontCollection.restype = c_int
+gdiplus.GdipNewPrivateFontCollection.argtypes = [c_void_p]
+gdiplus.GdipPrivateAddMemoryFont.restype = c_int
+gdiplus.GdipPrivateAddMemoryFont.argtypes = [c_void_p, c_void_p, c_int]
+gdiplus.GdipSetPageUnit.restype = c_int
+gdiplus.GdipSetPageUnit.argtypes = [c_void_p, c_int]
+gdiplus.GdipSetStringFormatFlags.restype = c_int
+gdiplus.GdipSetStringFormatFlags.argtypes = [c_void_p, c_int]
+gdiplus.GdipSetTextRenderingHint.restype = c_int
+gdiplus.GdipSetTextRenderingHint.argtypes = [c_void_p, c_int]
+gdiplus.GdipStringFormatGetGenericTypographic.restype = c_int
+gdiplus.GdipStringFormatGetGenericTypographic.argtypes = [c_void_p]
+gdiplus.GdiplusShutdown.restype = None
+gdiplus.GdiplusShutdown.argtypes = [POINTER(ULONG)]
+gdiplus.GdiplusStartup.restype = c_int
+gdiplus.GdiplusStartup.argtypes = [c_void_p, c_void_p, c_void_p]
+
+
+class GDIPlusDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ return ['.bmp', '.gif', '.jpg', '.jpeg', '.exif', '.png', '.tif', '.tiff']
+
+ def get_animation_file_extensions(self):
+ # TIFF also supported as a multi-page image; but that's not really an
+ # animation, is it?
+ return ['.gif']
+
+ def _load_bitmap(self, filename, file):
+ data = file.read()
+
+ # Create a HGLOBAL with image data
+ hglob = kernel32.GlobalAlloc(GMEM_MOVEABLE, len(data))
+ ptr = kernel32.GlobalLock(hglob)
+ memmove(ptr, data, len(data))
+ kernel32.GlobalUnlock(hglob)
+
+ # Create IStream for the HGLOBAL
+ self.stream = pIUnknown()
+ ole32.CreateStreamOnHGlobal(hglob, True, byref(self.stream))
+
+ # Load image from stream
+ bitmap = c_void_p()
+ status = gdiplus.GdipCreateBitmapFromStream(self.stream, byref(bitmap))
+ if status != 0:
+ self.stream.Release()
+ raise ImageDecodeException('GDI+ cannot load %r' % (filename or file))
+
+ return bitmap
+
+ @staticmethod
+ def _get_image(bitmap):
+ # Get size of image (Bitmap subclasses Image)
+ width = REAL()
+ height = REAL()
+ gdiplus.GdipGetImageDimension(bitmap, byref(width), byref(height))
+ width = int(width.value)
+ height = int(height.value)
+
+ # Get image pixel format
+ pf = c_int()
+ gdiplus.GdipGetImagePixelFormat(bitmap, byref(pf))
+ pf = pf.value
+
+ # Reverse from what's documented because of Intel little-endianness.
+ fmt = 'BGRA'
+ if pf == PixelFormat24bppRGB:
+ fmt = 'BGR'
+ elif pf == PixelFormat32bppRGB:
+ pass
+ elif pf == PixelFormat32bppARGB:
+ pass
+ elif pf in (PixelFormat16bppARGB1555, PixelFormat32bppPARGB,
+ PixelFormat64bppARGB, PixelFormat64bppPARGB):
+ pf = PixelFormat32bppARGB
+ else:
+ fmt = 'BGR'
+ pf = PixelFormat24bppRGB
+
+ # Lock pixel data in best format
+ rect = Rect()
+ rect.X = 0
+ rect.Y = 0
+ rect.Width = width
+ rect.Height = height
+ bitmap_data = BitmapData()
+ gdiplus.GdipBitmapLockBits(bitmap, byref(rect), ImageLockModeRead, pf, byref(bitmap_data))
+
+ # Create buffer for RawImage
+ buffer = create_string_buffer(bitmap_data.Stride * height)
+ memmove(buffer, bitmap_data.Scan0, len(buffer))
+
+ # Unlock data
+ gdiplus.GdipBitmapUnlockBits(bitmap, byref(bitmap_data))
+
+ return ImageData(width, height, fmt, buffer, -bitmap_data.Stride)
+
+ def _delete_bitmap(self, bitmap):
+ # Release image and stream
+ gdiplus.GdipDisposeImage(bitmap)
+ self.stream.Release()
+
+ def decode(self, filename, file):
+ if not file:
+ file = open(filename, 'rb')
+ bitmap = self._load_bitmap(filename, file)
+ image = self._get_image(bitmap)
+ self._delete_bitmap(bitmap)
+ return image
+
+ def decode_animation(self, filename, file):
+ if not file:
+ file = open(filename, 'rb')
+ bitmap = self._load_bitmap(filename, file)
+
+ dimension_count = c_uint()
+ gdiplus.GdipImageGetFrameDimensionsCount(bitmap, byref(dimension_count))
+ if dimension_count.value < 1:
+ self._delete_bitmap(bitmap)
+ raise ImageDecodeException('Image has no frame dimensions')
+
+ # XXX Make sure this dimension is time?
+ dimensions = (c_void_p * dimension_count.value)()
+ gdiplus.GdipImageGetFrameDimensionsList(bitmap, dimensions, dimension_count.value)
+
+ frame_count = c_uint()
+ gdiplus.GdipImageGetFrameCount(bitmap, dimensions, byref(frame_count))
+
+ prop_id = PropertyTagFrameDelay
+ prop_size = c_uint()
+ gdiplus.GdipGetPropertyItemSize(bitmap, prop_id, byref(prop_size))
+
+ prop_buffer = c_buffer(prop_size.value)
+ prop_item = cast(prop_buffer, POINTER(PropertyItem)).contents
+ gdiplus.GdipGetPropertyItem(bitmap, prop_id, prop_size.value, prop_buffer)
+
+ n_delays = prop_item.length // sizeof(c_long)
+ delays = cast(prop_item.value, POINTER(c_long * n_delays)).contents
+
+ frames = []
+
+ for i in range(frame_count.value):
+ gdiplus.GdipImageSelectActiveFrame(bitmap, dimensions, i)
+ image = self._get_image(bitmap)
+
+ delay = delays[i]
+ if delay <= 1:
+ delay = 10
+ frames.append(AnimationFrame(image, delay/100.))
+
+ self._delete_bitmap(bitmap)
+
+ return Animation(frames)
+
+
+def get_decoders():
+ return [GDIPlusDecoder()]
+
+
+def get_encoders():
+ return []
+
+
+def init():
+ token = c_ulong()
+ startup_in = GdiplusStartupInput()
+ startup_in.GdiplusVersion = 1
+ startup_out = GdiplusStartupOutput()
+ gdiplus.GdiplusStartup(byref(token), byref(startup_in), byref(startup_out))
+
+ # Shutdown later?
+ # gdiplus.GdiplusShutdown(token)
+
+
+init()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/gdkpixbuf2.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/gdkpixbuf2.py
new file mode 100644
index 0000000000000000000000000000000000000000..8b88a2c24d063e544bf4858e1dab277a9bbbb4e0
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/gdkpixbuf2.py
@@ -0,0 +1,297 @@
+from ctypes import *
+
+from pyglet.gl import *
+from pyglet.image import *
+from pyglet.image.codecs import *
+from pyglet.image.codecs import gif
+
+import pyglet.lib
+import pyglet.window
+
+gdk = pyglet.lib.load_library('gdk-x11-2.0')
+gdkpixbuf = pyglet.lib.load_library('gdk_pixbuf-2.0')
+
+GdkPixbufLoader = c_void_p
+GdkPixbuf = c_void_p
+guchar = c_char
+gdkpixbuf.gdk_pixbuf_loader_new.restype = POINTER(GdkPixbufLoader)
+gdkpixbuf.gdk_pixbuf_loader_get_pixbuf.restype = POINTER(GdkPixbuf)
+gdkpixbuf.gdk_pixbuf_get_pixels.restype = POINTER(guchar)
+gdkpixbuf.gdk_pixbuf_loader_get_animation.restype = POINTER(c_void_p)
+gdkpixbuf.gdk_pixbuf_animation_get_iter.restype = POINTER(c_void_p)
+gdkpixbuf.gdk_pixbuf_animation_iter_get_pixbuf.restype = POINTER(GdkPixbuf)
+
+
+class GTimeVal(Structure):
+ _fields_ = [
+ ('tv_sec', c_long),
+ ('tv_usec', c_long)
+ ]
+
+
+GQuark = c_uint32
+gint = c_int
+gchar = c_char
+
+
+class GError(Structure):
+ _fields_ = [
+ ('domain', GQuark),
+ ('code', gint),
+ ('message', POINTER(gchar))
+ ]
+
+gerror_ptr = POINTER(GError)
+
+def _gerror_to_string(error):
+ """
+ Convert a GError to a string.
+ `error` should be a valid pointer to a GError struct.
+ """
+ return 'GdkPixBuf Error: domain[{}], code[{}]: {}'.format(error.contents.domain,
+ error.contents.code,
+ error.contents.message)
+
+
+class GdkPixBufLoader:
+ """
+ Wrapper around GdkPixBufLoader object.
+ """
+ def __init__(self, filename, file):
+ self.closed = False
+ self._file = file
+ self._filename = filename
+ self._loader = gdkpixbuf.gdk_pixbuf_loader_new()
+ if self._loader is None:
+ raise ImageDecodeException('Unable to instantiate gdk pixbuf loader')
+ self._load_file()
+
+ def __del__(self):
+ if self._loader is not None:
+ if not self.closed:
+ self._cancel_load()
+ gdk.g_object_unref(self._loader)
+
+ def _load_file(self):
+ self._file.seek(0)
+ data = self._file.read()
+ self.write(data)
+
+ def _finish_load(self):
+ assert not self.closed
+ error = gerror_ptr()
+ all_data_passed = gdkpixbuf.gdk_pixbuf_loader_close(self._loader, byref(error))
+ self.closed = True
+ if not all_data_passed:
+ raise ImageDecodeException(_gerror_to_string(error))
+
+ def _cancel_load(self):
+ assert not self.closed
+ gdkpixbuf.gdk_pixbuf_loader_close(self._loader, None)
+ self.closed = True
+
+ def write(self, data):
+ assert not self.closed, 'Cannot write after closing loader'
+ error = gerror_ptr()
+ if not gdkpixbuf.gdk_pixbuf_loader_write(self._loader, data, len(data), byref(error)):
+ raise ImageDecodeException(_gerror_to_string(error))
+
+ def get_pixbuf(self):
+ self._finish_load()
+ pixbuf = gdkpixbuf.gdk_pixbuf_loader_get_pixbuf(self._loader)
+ if pixbuf is None:
+ raise ImageDecodeException('Failed to get pixbuf from loader')
+ return GdkPixBuf(self, pixbuf)
+
+ def get_animation(self):
+ self._finish_load()
+ anim = gdkpixbuf.gdk_pixbuf_loader_get_animation(self._loader)
+ if anim is None:
+ raise ImageDecodeException('Failed to get animation from loader')
+ gif_delays = self._get_gif_delays()
+ return GdkPixBufAnimation(self, anim, gif_delays)
+
+ def _get_gif_delays(self):
+ # GDK pixbuf animations will loop indefinitely if looping is enabled for the
+ # gif, so get number of frames and delays from gif metadata
+ assert self._file is not None
+ self._file.seek(0)
+ gif_stream = gif.read(self._file)
+ return [image.delay for image in gif_stream.images]
+
+
+class GdkPixBuf:
+ """
+ Wrapper around GdkPixBuf object.
+ """
+ def __init__(self, loader, pixbuf):
+ # Keep reference to loader alive
+ self._loader = loader
+ self._pixbuf = pixbuf
+ gdk.g_object_ref(pixbuf)
+
+ def __del__(self):
+ if self._pixbuf is not None:
+ gdk.g_object_unref(self._pixbuf)
+
+ def load_next(self):
+ return self._pixbuf is not None
+
+ @property
+ def width(self):
+ assert self._pixbuf is not None
+ return gdkpixbuf.gdk_pixbuf_get_width(self._pixbuf)
+
+ @property
+ def height(self):
+ assert self._pixbuf is not None
+ return gdkpixbuf.gdk_pixbuf_get_height(self._pixbuf)
+
+ @property
+ def channels(self):
+ assert self._pixbuf is not None
+ return gdkpixbuf.gdk_pixbuf_get_n_channels(self._pixbuf)
+
+ @property
+ def rowstride(self):
+ assert self._pixbuf is not None
+ return gdkpixbuf.gdk_pixbuf_get_rowstride(self._pixbuf)
+
+ @property
+ def has_alpha(self):
+ assert self._pixbuf is not None
+ return gdkpixbuf.gdk_pixbuf_get_has_alpha(self._pixbuf) == 1
+
+ def get_pixels(self):
+ pixels = gdkpixbuf.gdk_pixbuf_get_pixels(self._pixbuf)
+ assert pixels is not None
+ buf = (c_ubyte * (self.rowstride * self.height))()
+ memmove(buf, pixels, self.rowstride * (self.height - 1) + self.width * self.channels)
+ return buf
+
+ def to_image(self):
+ if self.width < 1 or self.height < 1 or self.channels < 1 or self.rowstride < 1:
+ return None
+
+ pixels = self.get_pixels()
+
+ # Determine appropriate GL type
+ if self.channels == 3:
+ format = 'RGB'
+ else:
+ format = 'RGBA'
+
+ return ImageData(self.width, self.height, format, pixels, -self.rowstride)
+
+
+class GdkPixBufAnimation:
+ """
+ Wrapper for a GdkPixBufIter for an animation.
+ """
+ def __init__(self, loader, anim, gif_delays):
+ self._loader = loader
+ self._anim = anim
+ self._gif_delays = gif_delays
+ gdk.g_object_ref(anim)
+
+ def __del__(self):
+ if self._anim is not None:
+ gdk.g_object_unref(self._anim)
+
+ def __iter__(self):
+ time = GTimeVal(0, 0)
+ anim_iter = gdkpixbuf.gdk_pixbuf_animation_get_iter(self._anim, byref(time))
+ return GdkPixBufAnimationIterator(self._loader, anim_iter, time, self._gif_delays)
+
+ def to_animation(self):
+ return Animation(list(self))
+
+
+class GdkPixBufAnimationIterator:
+ def __init__(self, loader, anim_iter, start_time, gif_delays):
+ self._iter = anim_iter
+ self._first = True
+ self._time = start_time
+ self._loader = loader
+ self._gif_delays = gif_delays
+ self.delay_time = None
+
+ def __del__(self):
+ if self._iter is not None:
+ gdk.g_object_unref(self._iter)
+ # The pixbuf returned by the iter is owned by the iter, so no need to destroy that one
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ self._advance()
+ frame = self.get_frame()
+ if frame is None:
+ raise StopIteration
+ return frame
+
+ def _advance(self):
+ if not self._gif_delays:
+ raise StopIteration
+ self.delay_time = self._gif_delays.pop(0)
+
+ if self._first:
+ self._first = False
+ else:
+ if self.gdk_delay_time == -1:
+ raise StopIteration
+ else:
+ gdk_delay = self.gdk_delay_time * 1000 # milliseconds to microseconds
+ us = self._time.tv_usec + gdk_delay
+ self._time.tv_sec += us // 1000000
+ self._time.tv_usec = us % 1000000
+ gdkpixbuf.gdk_pixbuf_animation_iter_advance(self._iter, byref(self._time))
+
+ def get_frame(self):
+ pixbuf = gdkpixbuf.gdk_pixbuf_animation_iter_get_pixbuf(self._iter)
+ if pixbuf is None:
+ return None
+ image = GdkPixBuf(self._loader, pixbuf).to_image()
+ return AnimationFrame(image, self.delay_time)
+
+ @property
+ def gdk_delay_time(self):
+ assert self._iter is not None
+ return gdkpixbuf.gdk_pixbuf_animation_iter_get_delay_time(self._iter)
+
+
+class GdkPixbuf2ImageDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ return ['.png', '.xpm', '.jpg', '.jpeg', '.tif', '.tiff', '.pnm',
+ '.ras', '.bmp', '.gif']
+
+ def get_animation_file_extensions(self):
+ return ['.gif', '.ani']
+
+ def decode(self, filename, file):
+ if not file:
+ file = open(filename, 'rb')
+ loader = GdkPixBufLoader(filename, file)
+ return loader.get_pixbuf().to_image()
+
+ def decode_animation(self, filename, file):
+ if not file:
+ file = open(filename, 'rb')
+ loader = GdkPixBufLoader(filename, file)
+ return loader.get_animation().to_animation()
+
+
+def get_decoders():
+ return [GdkPixbuf2ImageDecoder()]
+
+
+def get_encoders():
+ return []
+
+
+def init():
+ gdk.g_type_init()
+
+
+init()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/gif.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/gif.py
new file mode 100644
index 0000000000000000000000000000000000000000..89dd13dad3b549c8a589d146868191ab68ed30aa
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/gif.py
@@ -0,0 +1,142 @@
+"""Read GIF control data.
+
+http://www.w3.org/Graphics/GIF/spec-gif89a.txt
+"""
+
+import struct
+
+from pyglet.image.codecs import ImageDecodeException
+
+
+class GIFStream:
+ def __init__(self):
+ self.images = []
+
+
+class GIFImage:
+ delay = None
+
+
+class GraphicsScope:
+ delay = None
+
+
+# Appendix A.
+LABEL_EXTENSION_INTRODUCER = 0x21
+LABEL_GRAPHIC_CONTROL_EXTENSION = 0xf9
+LABEL_IMAGE_DESCRIPTOR = 0x2c
+LABEL_TRAILER = 0x3b
+
+
+def unpack(fmt, file):
+ size = struct.calcsize(fmt)
+ data = file.read(size)
+ if len(data) < size:
+ raise ImageDecodeException('Unexpected EOF')
+ return struct.unpack(fmt, data)
+
+
+def read_byte(file):
+ data = file.read(1)
+ if not len(data):
+ raise ImageDecodeException('Unexpected EOF')
+ return ord(data)
+
+
+def read(file):
+ """Read a GIF file stream.
+
+ :rtype: GIFStream
+ """
+ # 17. Header
+ signature = file.read(3)
+ version = file.read(3)
+ if signature != b'GIF':
+ raise ImageDecodeException('Not a GIF stream')
+
+ stream = GIFStream()
+
+ # 18. Logical screen descriptor
+ (logical_screen_width,
+ logical_screen_height,
+ fields,
+ background_color_index,
+ pixel_aspect_ratio) = unpack('HHBBB', file)
+ global_color_table_flag = fields & 0x80
+ global_color_table_size = fields & 0x7
+
+ # 19. Global color table
+ if global_color_table_flag:
+ global_color_table = file.read(6 << global_color_table_size)
+
+ # *
+ graphics_scope = GraphicsScope()
+ block_type = read_byte(file)
+
+ while block_type != LABEL_TRAILER:
+ if block_type == LABEL_IMAGE_DESCRIPTOR:
+ read_table_based_image(file, stream, graphics_scope)
+ graphics_scope = GraphicsScope()
+ elif block_type == LABEL_EXTENSION_INTRODUCER:
+ extension_block_type = read_byte(file)
+ if extension_block_type == LABEL_GRAPHIC_CONTROL_EXTENSION:
+ read_graphic_control_extension(file, stream, graphics_scope)
+ else:
+ skip_data_sub_blocks(file)
+ else:
+ # Skip bytes until a valid start character is found
+ print(block_type)
+ pass
+ block_type = read_byte(file)
+
+ return stream
+
+
+def skip_data_sub_blocks(file):
+ # 15. Data sub-blocks
+ block_size = read_byte(file)
+ while block_size != 0:
+ data = file.read(block_size)
+ block_size = read_byte(file)
+
+
+def read_table_based_image(file, stream, graphics_scope):
+ gif_image = GIFImage()
+ stream.images.append(gif_image)
+ gif_image.delay = graphics_scope.delay
+
+ # 20. Image descriptor
+ (image_left_position,
+ image_top_position,
+ image_width,
+ image_height,
+ fields) = unpack('HHHHB', file)
+
+ local_color_table_flag = fields & 0x80
+ local_color_table_size = fields & 0x7
+
+ # 21. Local color table
+ if local_color_table_flag:
+ local_color_table = file.read(6 << local_color_table_size)
+
+ # 22. Table based image data
+ lzw_code_size = file.read(1)
+ skip_data_sub_blocks(file)
+
+
+def read_graphic_control_extension(file, stream, graphics_scope):
+ # 23. Graphic control extension
+ (block_size,
+ fields,
+ delay_time,
+ transparent_color_index,
+ terminator) = unpack('BBHBB', file)
+ if block_size != 4:
+ raise ImageDecodeException('Incorrect block size')
+
+ if delay_time:
+ # Follow Firefox/Mac behaviour: use 100ms delay for any delay
+ # less than 10ms.
+ if delay_time <= 1:
+ delay_time = 10
+ graphics_scope.delay = float(delay_time) / 100
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/pil.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/pil.py
new file mode 100644
index 0000000000000000000000000000000000000000..d8a016ae31bd9c45e7dc59504cb4a4f3245cd231
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/pil.py
@@ -0,0 +1,82 @@
+import os.path
+
+from pyglet.image import *
+from pyglet.image.codecs import *
+
+from PIL import Image
+
+
+class PILImageDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ # Only most common ones shown here
+ return ['.bmp', '.cur', '.gif', '.ico', '.jpg', '.jpeg', '.pcx', '.png',
+ '.tga', '.tif', '.tiff', '.xbm', '.xpm']
+
+ # def get_animation_file_extensions(self):
+ # return ['.gif', '.ani']
+
+ def decode(self, filename, file):
+ if not file:
+ file = open(filename, 'rb')
+
+ try:
+ image = Image.open(file)
+ except Exception as e:
+ raise ImageDecodeException('PIL cannot read %r: %s' % (filename or file, e))
+
+ try:
+ image = image.transpose(Image.FLIP_TOP_BOTTOM)
+ except Exception as e:
+ raise ImageDecodeException('PIL failed to transpose %r: %s' % (filename or file, e))
+
+ # Convert bitmap and palette images to component
+ if image.mode in ('1', 'P'):
+ image = image.convert()
+
+ if image.mode not in ('L', 'LA', 'RGB', 'RGBA'):
+ raise ImageDecodeException('Unsupported mode "%s"' % image.mode)
+ width, height = image.size
+
+ return ImageData(width, height, image.mode, image.tobytes())
+
+
+class PILImageEncoder(ImageEncoder):
+ def get_file_extensions(self):
+ # Most common only
+ return ['.bmp', '.eps', '.gif', '.jpg', '.jpeg',
+ '.pcx', '.png', '.ppm', '.tiff', '.xbm']
+
+ def encode(self, image, filename, file):
+ # File format is guessed from filename extension, otherwise defaults to PNG.
+ pil_format = (filename and os.path.splitext(filename)[1][1:]) or 'png'
+
+ if pil_format.lower() == 'jpg':
+ pil_format = 'JPEG'
+
+ image = image.get_image_data()
+ fmt = image.format
+ if fmt != 'RGB':
+ # Only save in RGB or RGBA formats.
+ fmt = 'RGBA'
+ pitch = -(image.width * len(fmt))
+
+ # fromstring is deprecated, replaced by frombytes in Pillow (PIL fork)
+ # (1.1.7) PIL still uses it
+ try:
+ image_from_fn = getattr(Image, "frombytes")
+ except AttributeError:
+ image_from_fn = getattr(Image, "fromstring")
+ pil_image = image_from_fn(fmt, (image.width, image.height), image.get_data(fmt, pitch))
+
+ try:
+ pil_image.save(file, pil_format)
+ except Exception as e:
+ raise ImageEncodeException(e)
+
+
+def get_decoders():
+ return [PILImageDecoder()]
+
+
+def get_encoders():
+ return [PILImageEncoder()]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/png.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/png.py
new file mode 100644
index 0000000000000000000000000000000000000000..ca8cc04fefb64dda5b41e39cae8bbb758389a27a
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/png.py
@@ -0,0 +1,78 @@
+"""Encoder and decoder for PNG files, using PyPNG (png.py).
+"""
+
+import array
+import itertools
+
+from pyglet.image import ImageData, ImageDecodeException
+from pyglet.image.codecs import ImageDecoder, ImageEncoder
+
+import pyglet.extlibs.png as pypng
+
+
+class PNGImageDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ return ['.png']
+
+ def decode(self, filename, file):
+ if not file:
+ file = open(filename, 'rb')
+
+ try:
+ reader = pypng.Reader(file=file)
+ width, height, pixels, metadata = reader.asDirect()
+ except Exception as e:
+ raise ImageDecodeException('PyPNG cannot read %r: %s' % (filename or file, e))
+
+ if metadata['greyscale']:
+ if metadata['alpha']:
+ fmt = 'LA'
+ else:
+ fmt = 'L'
+ else:
+ if metadata['alpha']:
+ fmt = 'RGBA'
+ else:
+ fmt = 'RGB'
+ pitch = len(fmt) * width
+
+ pixels = array.array('BH'[metadata['bitdepth'] > 8], itertools.chain(*pixels))
+ return ImageData(width, height, fmt, pixels.tobytes(), -pitch)
+
+
+class PNGImageEncoder(ImageEncoder):
+ def get_file_extensions(self):
+ return ['.png']
+
+ def encode(self, image, filename, file):
+ image = image.get_image_data()
+
+ has_alpha = 'A' in image.format
+ greyscale = len(image.format) < 3
+ if has_alpha:
+ if greyscale:
+ image.format = 'LA'
+ else:
+ image.format = 'RGBA'
+ else:
+ if greyscale:
+ image.format = 'L'
+ else:
+ image.format = 'RGB'
+
+ image.pitch = -(image.width * len(image.format))
+
+ writer = pypng.Writer(image.width, image.height, greyscale=greyscale, alpha=has_alpha)
+
+ data = array.array('B')
+ data.frombytes(image.get_data(image.format, image.pitch))
+
+ writer.write_array(file, data)
+
+
+def get_decoders():
+ return [PNGImageDecoder()]
+
+
+def get_encoders():
+ return [PNGImageEncoder()]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/quartz.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/quartz.py
new file mode 100644
index 0000000000000000000000000000000000000000..9b33fe22f3cb5a1a1bcb636fef3d68e26695c1f9
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/quartz.py
@@ -0,0 +1,109 @@
+from ctypes import c_void_p, c_ubyte
+
+from pyglet.image import ImageData, Animation, AnimationFrame
+from pyglet.image.codecs import *
+
+from pyglet.libs.darwin.cocoapy import cf, quartz, NSMakeRect
+from pyglet.libs.darwin.cocoapy import cfnumber_to_number
+from pyglet.libs.darwin.cocoapy import kCGImageAlphaPremultipliedLast
+from pyglet.libs.darwin.cocoapy import kCGImagePropertyGIFDictionary
+from pyglet.libs.darwin.cocoapy import kCGImagePropertyGIFDelayTime
+
+
+class QuartzImageDecoder(ImageDecoder):
+ def get_file_extensions(self):
+ # Quartz can actually decode many more formats, but these are the most common.
+ return [ '.bmp', '.cur', '.gif', '.ico', '.jp2', '.jpg', '.jpeg',
+ '.pcx', '.png', '.tga', '.tif', '.tiff', '.xbm', '.xpm' ]
+
+ def get_animation_file_extensions(self):
+ return ['.gif']
+
+ def _get_pyglet_ImageData_from_source_at_index(self, sourceRef, index):
+ imageRef = c_void_p(quartz.CGImageSourceCreateImageAtIndex(sourceRef, index, None))
+
+ # Regardless of the internal format of the image (L, LA, RGB, RGBA, etc)
+ # we just automatically convert everything to an RGBA format.
+ format = 'RGBA'
+ rgbColorSpace = c_void_p(quartz.CGColorSpaceCreateDeviceRGB())
+ bitsPerComponent = 8
+ width = quartz.CGImageGetWidth(imageRef)
+ height = quartz.CGImageGetHeight(imageRef)
+ bytesPerRow = 4 * width
+
+ # Create a buffer to store the RGBA formatted data.
+ bufferSize = height * bytesPerRow
+ buffer = (c_ubyte * bufferSize)()
+
+ # Create a bitmap context for the RGBA formatted data.
+ # Note that premultiplied alpha is required:
+ # http://developer.apple.com/library/mac/#qa/qa1037/_index.html
+ bitmap = c_void_p(quartz.CGBitmapContextCreate(buffer,
+ width, height,
+ bitsPerComponent,
+ bytesPerRow,
+ rgbColorSpace,
+ kCGImageAlphaPremultipliedLast))
+
+ # Write the image data into the bitmap.
+ quartz.CGContextDrawImage(bitmap, NSMakeRect(0,0,width,height), imageRef)
+
+ quartz.CGImageRelease(imageRef)
+ quartz.CGContextRelease(bitmap)
+ quartz.CGColorSpaceRelease(rgbColorSpace)
+
+ pitch = bytesPerRow
+ return ImageData(width, height, format, buffer, -pitch)
+
+ def decode(self, filename, file):
+ if not file:
+ file = open(filename, 'rb')
+ file_bytes = file.read()
+ data = c_void_p(cf.CFDataCreate(None, file_bytes, len(file_bytes)))
+ # Second argument is an options dictionary. It might be a good idea to provide
+ # a value for kCGImageSourceTypeIdentifierHint here using filename extension.
+ sourceRef = c_void_p(quartz.CGImageSourceCreateWithData(data, None))
+ image = self._get_pyglet_ImageData_from_source_at_index(sourceRef, 0)
+
+ cf.CFRelease(data)
+ cf.CFRelease(sourceRef)
+
+ return image
+
+ def decode_animation(self, filename, file):
+ if not file:
+ file = open(filename, 'rb')
+ # If file is not an animated GIF, it will be loaded as a single-frame animation.
+ file_bytes = file.read()
+ data = c_void_p(cf.CFDataCreate(None, file_bytes, len(file_bytes)))
+ sourceRef = c_void_p(quartz.CGImageSourceCreateWithData(data, None))
+
+ # Get number of frames in the animation.
+ count = quartz.CGImageSourceGetCount(sourceRef)
+
+ frames = []
+
+ for index in range(count):
+ # Try to determine frame duration from GIF properties dictionary.
+ duration = 0.1 # default duration if none found
+ props = c_void_p(quartz.CGImageSourceCopyPropertiesAtIndex(sourceRef, index, None))
+ if cf.CFDictionaryContainsKey(props, kCGImagePropertyGIFDictionary):
+ gif_props = c_void_p(cf.CFDictionaryGetValue(props, kCGImagePropertyGIFDictionary))
+ if cf.CFDictionaryContainsKey(gif_props, kCGImagePropertyGIFDelayTime):
+ duration = cfnumber_to_number(c_void_p(cf.CFDictionaryGetValue(gif_props, kCGImagePropertyGIFDelayTime)))
+
+ cf.CFRelease(props)
+ image = self._get_pyglet_ImageData_from_source_at_index(sourceRef, index)
+ frames.append( AnimationFrame(image, duration) )
+
+ cf.CFRelease(data)
+ cf.CFRelease(sourceRef)
+
+ return Animation(frames)
+
+
+def get_decoders():
+ return [ QuartzImageDecoder() ]
+
+def get_encoders():
+ return []
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/s3tc.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/s3tc.py
new file mode 100644
index 0000000000000000000000000000000000000000..918226bb6653064bca6692971e11aa469f97fede
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/s3tc.py
@@ -0,0 +1,354 @@
+"""Software decoder for S3TC compressed texture (i.e., DDS).
+
+http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt
+"""
+
+import re
+import ctypes
+
+from pyglet.gl import *
+from pyglet.gl import gl_info
+from pyglet.image import AbstractImage, Texture
+
+split_8byte = re.compile('.' * 8, flags=re.DOTALL)
+split_16byte = re.compile('.' * 16, flags=re.DOTALL)
+
+
+class PackedImageData(AbstractImage):
+ _current_texture = None
+
+ def __init__(self, width, height, fmt, packed_format, data):
+ super().__init__(width, height)
+ self.format = fmt
+ self.packed_format = packed_format
+ self.data = data
+
+ def unpack(self):
+ if self.packed_format == GL_UNSIGNED_SHORT_5_6_5:
+ # Unpack to GL_RGB. Assume self.data is already 16-bit
+ i = 0
+ out = (ctypes.c_ubyte * (self.width * self.height * 3))()
+ for c in self.data:
+ out[i + 2] = (c & 0x1f) << 3
+ out[i + 1] = (c & 0x7e0) >> 3
+ out[i] = (c & 0xf800) >> 8
+ i += 3
+ self.data = out
+ self.packed_format = GL_UNSIGNED_BYTE
+
+ def _get_texture(self):
+ if self._current_texture:
+ return self._current_texture
+
+ texture = Texture.create(self.width, self.height, GL_TEXTURE_2D, None)
+ glBindTexture(texture.target, texture.id)
+ glTexParameteri(texture.target, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
+
+ if not gl_info.have_version(1, 2) or True:
+ self.unpack()
+
+ glTexImage2D(texture.target, texture.level,
+ self.format, self.width, self.height, 0,
+ self.format, self.packed_format, self.data)
+
+ self._current_texture = texture
+ return texture
+
+ texture = property(_get_texture)
+
+ def get_texture(self, rectangle=False, force_rectangle=False):
+ """The parameters 'rectangle' and 'force_rectangle' are ignored.
+ See the documentation of the method 'AbstractImage.get_texture' for
+ a more detailed documentation of the method. """
+ return self._get_texture()
+
+
+def decode_dxt1_rgb(data, width, height):
+ # Decode to 16-bit RGB UNSIGNED_SHORT_5_6_5
+ out = (ctypes.c_uint16 * (width * height))()
+
+ # Read 8 bytes at a time
+ image_offset = 0
+ for c0_lo, c0_hi, c1_lo, c1_hi, b0, b1, b2, b3 in split_8byte.findall(data):
+ color0 = ord(c0_lo) | ord(c0_hi) << 8
+ color1 = ord(c1_lo) | ord(c1_hi) << 8
+ bits = ord(b0) | ord(b1) << 8 | ord(b2) << 16 | ord(b3) << 24
+
+ r0 = color0 & 0x1f
+ g0 = (color0 & 0x7e0) >> 5
+ b0 = (color0 & 0xf800) >> 11
+ r1 = color1 & 0x1f
+ g1 = (color1 & 0x7e0) >> 5
+ b1 = (color1 & 0xf800) >> 11
+
+ # i is the dest ptr for this block
+ i = image_offset
+ for y in range(4):
+ for x in range(4):
+ code = bits & 0x3
+
+ if code == 0:
+ out[i] = color0
+ elif code == 1:
+ out[i] = color1
+ elif code == 3 and color0 <= color1:
+ out[i] = 0
+ else:
+ if code == 2 and color0 > color1:
+ r = (2 * r0 + r1) // 3
+ g = (2 * g0 + g1) // 3
+ b = (2 * b0 + b1) // 3
+ elif code == 3 and color0 > color1:
+ r = (r0 + 2 * r1) // 3
+ g = (g0 + 2 * g1) // 3
+ b = (b0 + 2 * b1) // 3
+ else:
+ assert code == 2 and color0 <= color1
+ r = (r0 + r1) // 2
+ g = (g0 + g1) // 2
+ b = (b0 + b1) // 2
+ out[i] = r | g << 5 | b << 11
+
+ bits >>= 2
+ i += 1
+ i += width - 4
+
+ # Move dest ptr to next 4x4 block
+ advance_row = (image_offset + 4) % width == 0
+ image_offset += width * 3 * advance_row + 4
+
+ return PackedImageData(width, height, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, out)
+
+
+def decode_dxt1_rgba(data, width, height):
+ # Decode to GL_RGBA
+ out = (ctypes.c_ubyte * (width * height * 4))()
+ pitch = width << 2
+
+ # Read 8 bytes at a time
+ image_offset = 0
+ for c0_lo, c0_hi, c1_lo, c1_hi, b0, b1, b2, b3 in split_8byte.findall(data):
+ color0 = ord(c0_lo) | ord(c0_hi) << 8
+ color1 = ord(c1_lo) | ord(c1_hi) << 8
+ bits = ord(b0) | ord(b1) << 8 | ord(b2) << 16 | ord(b3) << 24
+
+ r0 = color0 & 0x1f
+ g0 = (color0 & 0x7e0) >> 5
+ b0 = (color0 & 0xf800) >> 11
+ r1 = color1 & 0x1f
+ g1 = (color1 & 0x7e0) >> 5
+ b1 = (color1 & 0xf800) >> 11
+
+ # i is the dest ptr for this block
+ i = image_offset
+ for y in range(4):
+ for x in range(4):
+ code = bits & 0x3
+ a = 255
+
+ if code == 0:
+ r, g, b = r0, g0, b0
+ elif code == 1:
+ r, g, b = r1, g1, b1
+ elif code == 3 and color0 <= color1:
+ r = g = b = a = 0
+ else:
+ if code == 2 and color0 > color1:
+ r = (2 * r0 + r1) // 3
+ g = (2 * g0 + g1) // 3
+ b = (2 * b0 + b1) // 3
+ elif code == 3 and color0 > color1:
+ r = (r0 + 2 * r1) // 3
+ g = (g0 + 2 * g1) // 3
+ b = (b0 + 2 * b1) // 3
+ else:
+ assert code == 2 and color0 <= color1
+ r = (r0 + r1) // 2
+ g = (g0 + g1) // 2
+ b = (b0 + b1) // 2
+
+ out[i] = b << 3
+ out[i + 1] = g << 2
+ out[i + 2] = r << 3
+ out[i + 3] = a << 4
+
+ bits >>= 2
+ i += 4
+ i += pitch - 16
+
+ # Move dest ptr to next 4x4 block
+ advance_row = (image_offset + 16) % pitch == 0
+ image_offset += pitch * 3 * advance_row + 16
+
+ return PackedImageData(width, height, GL_RGBA, GL_UNSIGNED_BYTE, out)
+
+
+def decode_dxt3(data, width, height):
+ # Decode to GL_RGBA
+ out = (ctypes.c_ubyte * (width * height * 4))()
+ pitch = width << 2
+
+ # Read 16 bytes at a time
+ image_offset = 0
+ for (a0, a1, a2, a3, a4, a5, a6, a7,
+ c0_lo, c0_hi, c1_lo, c1_hi,
+ b0, b1, b2, b3) in split_16byte.findall(data):
+ color0 = ord(c0_lo) | ord(c0_hi) << 8
+ color1 = ord(c1_lo) | ord(c1_hi) << 8
+ bits = ord(b0) | ord(b1) << 8 | ord(b2) << 16 | ord(b3) << 24
+ alpha = ord(a0) | ord(a1) << 8 | ord(a2) << 16 | ord(a3) << 24 | \
+ ord(a4) << 32 | ord(a5) << 40 | ord(a6) << 48 | ord(a7) << 56
+
+ r0 = color0 & 0x1f
+ g0 = (color0 & 0x7e0) >> 5
+ b0 = (color0 & 0xf800) >> 11
+ r1 = color1 & 0x1f
+ g1 = (color1 & 0x7e0) >> 5
+ b1 = (color1 & 0xf800) >> 11
+
+ # i is the dest ptr for this block
+ i = image_offset
+ for y in range(4):
+ for x in range(4):
+ code = bits & 0x3
+ a = alpha & 0xf
+
+ if code == 0:
+ r, g, b = r0, g0, b0
+ elif code == 1:
+ r, g, b = r1, g1, b1
+ elif code == 3 and color0 <= color1:
+ r = g = b = 0
+ else:
+ if code == 2 and color0 > color1:
+ r = (2 * r0 + r1) // 3
+ g = (2 * g0 + g1) // 3
+ b = (2 * b0 + b1) // 3
+ elif code == 3 and color0 > color1:
+ r = (r0 + 2 * r1) // 3
+ g = (g0 + 2 * g1) // 3
+ b = (b0 + 2 * b1) // 3
+ else:
+ assert code == 2 and color0 <= color1
+ r = (r0 + r1) // 2
+ g = (g0 + g1) // 2
+ b = (b0 + b1) // 2
+
+ out[i] = b << 3
+ out[i + 1] = g << 2
+ out[i + 2] = r << 3
+ out[i + 3] = a << 4
+
+ bits >>= 2
+ alpha >>= 4
+ i += 4
+ i += pitch - 16
+
+ # Move dest ptr to next 4x4 block
+ advance_row = (image_offset + 16) % pitch == 0
+ image_offset += pitch * 3 * advance_row + 16
+
+ return PackedImageData(width, height, GL_RGBA, GL_UNSIGNED_BYTE, out)
+
+
+def decode_dxt5(data, width, height):
+ # Decode to GL_RGBA
+ out = (ctypes.c_ubyte * (width * height * 4))()
+ pitch = width << 2
+
+ # Read 16 bytes at a time
+ image_offset = 0
+ for (alpha0, alpha1, ab0, ab1, ab2, ab3, ab4, ab5,
+ c0_lo, c0_hi, c1_lo, c1_hi,
+ b0, b1, b2, b3) in split_16byte.findall(data):
+ color0 = ord(c0_lo) | ord(c0_hi) << 8
+ color1 = ord(c1_lo) | ord(c1_hi) << 8
+ alpha0 = ord(alpha0)
+ alpha1 = ord(alpha1)
+ bits = ord(b0) | ord(b1) << 8 | ord(b2) << 16 | ord(b3) << 24
+ abits = ord(ab0) | ord(ab1) << 8 | ord(ab2) << 16 | ord(ab3) << 24 | \
+ ord(ab4) << 32 | ord(ab5) << 40
+
+ r0 = color0 & 0x1f
+ g0 = (color0 & 0x7e0) >> 5
+ b0 = (color0 & 0xf800) >> 11
+ r1 = color1 & 0x1f
+ g1 = (color1 & 0x7e0) >> 5
+ b1 = (color1 & 0xf800) >> 11
+
+ # i is the dest ptr for this block
+ i = image_offset
+ for y in range(4):
+ for x in range(4):
+ code = bits & 0x3
+ acode = abits & 0x7
+
+ if code == 0:
+ r, g, b = r0, g0, b0
+ elif code == 1:
+ r, g, b = r1, g1, b1
+ elif code == 3 and color0 <= color1:
+ r = g = b = 0
+ else:
+ if code == 2 and color0 > color1:
+ r = (2 * r0 + r1) // 3
+ g = (2 * g0 + g1) // 3
+ b = (2 * b0 + b1) // 3
+ elif code == 3 and color0 > color1:
+ r = (r0 + 2 * r1) // 3
+ g = (g0 + 2 * g1) // 3
+ b = (b0 + 2 * b1) // 3
+ else:
+ assert code == 2 and color0 <= color1
+ r = (r0 + r1) / 2
+ g = (g0 + g1) / 2
+ b = (b0 + b1) / 2
+
+ if acode == 0:
+ a = alpha0
+ elif acode == 1:
+ a = alpha1
+ elif alpha0 > alpha1:
+ if acode == 2:
+ a = (6 * alpha0 + 1 * alpha1) // 7
+ elif acode == 3:
+ a = (5 * alpha0 + 2 * alpha1) // 7
+ elif acode == 4:
+ a = (4 * alpha0 + 3 * alpha1) // 7
+ elif acode == 5:
+ a = (3 * alpha0 + 4 * alpha1) // 7
+ elif acode == 6:
+ a = (2 * alpha0 + 5 * alpha1) // 7
+ else:
+ assert acode == 7
+ a = (1 * alpha0 + 6 * alpha1) // 7
+ else:
+ if acode == 2:
+ a = (4 * alpha0 + 1 * alpha1) // 5
+ elif acode == 3:
+ a = (3 * alpha0 + 2 * alpha1) // 5
+ elif acode == 4:
+ a = (2 * alpha0 + 3 * alpha1) // 5
+ elif acode == 5:
+ a = (1 * alpha0 + 4 * alpha1) // 5
+ elif acode == 6:
+ a = 0
+ else:
+ assert acode == 7
+ a = 255
+
+ out[i] = b << 3
+ out[i + 1] = g << 2
+ out[i + 2] = r << 3
+ out[i + 3] = a
+
+ bits >>= 2
+ abits >>= 3
+ i += 4
+ i += pitch - 16
+
+ # Move dest ptr to next 4x4 block
+ advance_row = (image_offset + 16) % pitch == 0
+ image_offset += pitch * 3 * advance_row + 16
+
+ return PackedImageData(width, height, GL_RGBA, GL_UNSIGNED_BYTE, out)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/wic.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/wic.py
new file mode 100644
index 0000000000000000000000000000000000000000..41925ab2456918e3bd0707753cf3f8c1d07ce614
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/image/codecs/wic.py
@@ -0,0 +1,638 @@
+import warnings
+
+from pyglet.image import *
+from pyglet.image.codecs import *
+from pyglet.libs.win32 import _kernel32 as kernel32
+from pyglet.libs.win32 import _ole32 as ole32
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+
+CLSID_WICImagingFactory1 = com.GUID(0xcacaf262, 0x9370, 0x4615, 0xa1, 0x3b, 0x9f, 0x55, 0x39, 0xda, 0x4c, 0xa)
+CLSID_WICImagingFactory2 = com.GUID(0x317d06e8, 0x5f24, 0x433d, 0xbd, 0xf7, 0x79, 0xce, 0x68, 0xd8, 0xab, 0xc2)
+
+# This is available with Windows 7 with a Platform Update, but unable to detect as it wasn't a version change to the OS,
+# but a KB update. Available in atleast 8+.
+if WINDOWS_8_OR_GREATER:
+ CLSID_WICImagingFactory = CLSID_WICImagingFactory2
+else:
+ CLSID_WICImagingFactory = CLSID_WICImagingFactory1
+
+WICBitmapCreateCacheOption = UINT
+WICBitmapNoCache = 0
+WICBitmapCacheOnDemand = 0x1
+WICBitmapCacheOnLoad = 0x2
+WICBITMAPCREATECACHEOPTION_FORCE_DWORD = 0x7fffffff
+
+WICBitmapPaletteType = UINT
+WICBitmapPaletteTypeCustom = 0
+
+WICBitmapTransformOptions = UINT
+WICBitmapTransformRotate0 = 0
+WICBitmapTransformRotate90 = 0x1
+WICBitmapTransformRotate180 = 0x2
+WICBitmapTransformRotate270 = 0x3
+WICBitmapTransformFlipHorizontal = 0x8
+WICBitmapTransformFlipVertical = 0x10
+
+WICBitmapDitherType = UINT
+WICBitmapDitherTypeNone = 0
+WICBitmapDitherTypeSolid = 0
+WICBitmapDitherTypeOrdered4x4 = 0x1
+WICBitmapDitherTypeOrdered8x8 = 0x2
+WICBitmapDitherTypeOrdered16x16 = 0x3
+WICBitmapDitherTypeSpiral4x4 = 0x4
+WICBitmapDitherTypeSpiral8x8 = 0x5
+WICBitmapDitherTypeDualSpiral4x4 = 0x6
+WICBitmapDitherTypeDualSpiral8x8 = 0x7
+WICBitmapDitherTypeErrorDiffusion = 0x8
+WICBITMAPDITHERTYPE_FORCE_DWORD = 0x7fffffff
+WICBITMAPTRANSFORMOPTIONS_FORCE_DWORD = 0x7fffffff
+
+WICDecodeOptions = UINT
+WICDecodeMetadataCacheOnDemand = 0
+WICDecodeMetadataCacheOnLoad = 0x1
+WICMETADATACACHEOPTION_FORCE_DWORD = 0x7fffffff
+
+WICBitmapEncoderCacheOption = UINT
+WICBitmapEncoderCacheInMemory = 0x0
+WICBitmapEncoderCacheTempFile = 0x1
+WICBitmapEncoderNoCache = 0x2
+WICBITMAPENCODERCACHEOPTION_FORCE_DWORD = 0x7fffffff
+
+# Different pixel formats.
+REFWICPixelFormatGUID = com.GUID
+GUID_WICPixelFormatDontCare = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x00)
+GUID_WICPixelFormat1bppIndexed = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x01)
+GUID_WICPixelFormat2bppIndexed = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x02)
+GUID_WICPixelFormat4bppIndexed = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x03)
+GUID_WICPixelFormat8bppIndexed = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x04)
+GUID_WICPixelFormatBlackWhite = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x05)
+GUID_WICPixelFormat2bppGray = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x06)
+GUID_WICPixelFormat4bppGray = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x07)
+GUID_WICPixelFormat8bppGray = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x08)
+GUID_WICPixelFormat8bppAlpha = com.GUID(0xe6cd0116, 0xeeba, 0x4161, 0xaa, 0x85, 0x27, 0xdd, 0x9f, 0xb3, 0xa8, 0x95)
+GUID_WICPixelFormat16bppBGR555 = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x09)
+GUID_WICPixelFormat16bppBGR565 = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0a)
+GUID_WICPixelFormat16bppBGRA5551 = com.GUID(0x05ec7c2b, 0xf1e6, 0x4961, 0xad, 0x46, 0xe1, 0xcc, 0x81, 0x0a, 0x87, 0xd2)
+GUID_WICPixelFormat16bppGray = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0b)
+GUID_WICPixelFormat24bppBGR = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0c)
+GUID_WICPixelFormat24bppRGB = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0d)
+GUID_WICPixelFormat32bppBGR = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0e)
+GUID_WICPixelFormat32bppBGRA = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x0f)
+GUID_WICPixelFormat32bppPBGRA = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x10)
+GUID_WICPixelFormat32bppRGB = com.GUID(0xd98c6b95, 0x3efe, 0x47d6, 0xbb, 0x25, 0xeb, 0x17, 0x48, 0xab, 0x0c,
+ 0xf1) # 7 platform update?
+GUID_WICPixelFormat32bppRGBA = com.GUID(0xf5c7ad2d, 0x6a8d, 0x43dd, 0xa7, 0xa8, 0xa2, 0x99, 0x35, 0x26, 0x1a, 0xe9)
+GUID_WICPixelFormat32bppPRGBA = com.GUID(0x3cc4a650, 0xa527, 0x4d37, 0xa9, 0x16, 0x31, 0x42, 0xc7, 0xeb, 0xed, 0xba)
+GUID_WICPixelFormat48bppRGB = com.GUID(0x6fddc324, 0x4e03, 0x4bfe, 0xb1, 0x85, 0x3d, 0x77, 0x76, 0x8d, 0xc9, 0x15)
+GUID_WICPixelFormat48bppBGR = com.GUID(0xe605a384, 0xb468, 0x46ce, 0xbb, 0x2e, 0x36, 0xf1, 0x80, 0xe6, 0x43, 0x13)
+
+GUID_ContainerFormatBmp = com.GUID(0x0af1d87e, 0xfcfe, 0x4188, 0xbd, 0xeb, 0xa7, 0x90, 0x64, 0x71, 0xcb, 0xe3)
+GUID_ContainerFormatPng = com.GUID(0x1b7cfaf4, 0x713f, 0x473c, 0xbb, 0xcd, 0x61, 0x37, 0x42, 0x5f, 0xae, 0xaf)
+GUID_ContainerFormatIco = com.GUID(0xa3a860c4, 0x338f, 0x4c17, 0x91, 0x9a, 0xfb, 0xa4, 0xb5, 0x62, 0x8f, 0x21)
+GUID_ContainerFormatJpeg = com.GUID(0x19e4a5aa, 0x5662, 0x4fc5, 0xa0, 0xc0, 0x17, 0x58, 0x02, 0x8e, 0x10, 0x57)
+GUID_ContainerFormatTiff = com.GUID(0x163bcc30, 0xe2e9, 0x4f0b, 0x96, 0x1d, 0xa3, 0xe9, 0xfd, 0xb7, 0x88, 0xa3)
+GUID_ContainerFormatGif = com.GUID(0x1f8a5601, 0x7d4d, 0x4cbd, 0x9c, 0x82, 0x1b, 0xc8, 0xd4, 0xee, 0xb9, 0xa5)
+GUID_ContainerFormatWmp = com.GUID(0x57a37caa, 0x367a, 0x4540, 0x91, 0x6b, 0xf1, 0x83, 0xc5, 0x09, 0x3a, 0x4b)
+
+
+class IPropertyBag2(com.pIUnknown):
+ _methods_ = [
+ ('Read',
+ com.STDMETHOD()),
+ ('Write',
+ com.STDMETHOD()),
+ ('CountProperties',
+ com.STDMETHOD()),
+ ('GetPropertyInfo',
+ com.STDMETHOD()),
+ ('LoadObject',
+ com.STDMETHOD())
+ ]
+
+
+class IWICPalette(com.pIUnknown):
+ _methods_ = [
+ ('InitializePredefined',
+ com.STDMETHOD()),
+ ('InitializeCustom',
+ com.STDMETHOD()),
+ ('InitializeFromBitmap',
+ com.STDMETHOD()),
+ ('InitializeFromPalette',
+ com.STDMETHOD()),
+ ('GetType',
+ com.STDMETHOD()),
+ ('GetColorCount',
+ com.STDMETHOD()),
+ ('GetColors',
+ com.STDMETHOD()),
+ ('IsBlackWhite',
+ com.STDMETHOD()),
+ ('IsGrayscale',
+ com.STDMETHOD()),
+ ('HasAlpha',
+ com.STDMETHOD()),
+ ]
+
+
+class IWICStream(IStream, com.pIUnknown):
+ _methods_ = [
+ ('InitializeFromIStream',
+ com.STDMETHOD(IStream)),
+ ('InitializeFromFilename',
+ com.STDMETHOD(LPCWSTR, DWORD)),
+ ('InitializeFromMemory',
+ com.STDMETHOD(POINTER(BYTE), DWORD)),
+ ('InitializeFromIStreamRegion',
+ com.STDMETHOD()),
+ ]
+
+
+class IWICBitmapFrameEncode(com.pIUnknown):
+ _methods_ = [
+ ('Initialize',
+ com.STDMETHOD(IPropertyBag2)),
+ ('SetSize',
+ com.STDMETHOD(UINT, UINT)),
+ ('SetResolution',
+ com.STDMETHOD()),
+ ('SetPixelFormat',
+ com.STDMETHOD(POINTER(REFWICPixelFormatGUID))),
+ ('SetColorContexts',
+ com.STDMETHOD()),
+ ('SetPalette',
+ com.STDMETHOD(IWICPalette)),
+ ('SetThumbnail',
+ com.STDMETHOD()),
+ ('WritePixels',
+ com.STDMETHOD(UINT, UINT, UINT, POINTER(BYTE))),
+ ('WriteSource',
+ com.STDMETHOD()),
+ ('Commit',
+ com.STDMETHOD()),
+ ('GetMetadataQueryWriter',
+ com.STDMETHOD())
+ ]
+
+
+class IWICBitmapEncoder(com.pIUnknown):
+ _methods_ = [
+ ('Initialize',
+ com.STDMETHOD(IWICStream, WICBitmapEncoderCacheOption)),
+ ('GetContainerFormat',
+ com.STDMETHOD()),
+ ('GetEncoderInfo',
+ com.STDMETHOD()),
+ ('SetColorContexts',
+ com.STDMETHOD()),
+ ('SetPalette',
+ com.STDMETHOD()),
+ ('SetThumbnail',
+ com.STDMETHOD()),
+ ('SetPreview',
+ com.STDMETHOD()),
+ ('CreateNewFrame',
+ com.STDMETHOD(POINTER(IWICBitmapFrameEncode), POINTER(IPropertyBag2))),
+ ('Commit',
+ com.STDMETHOD()),
+ ('GetMetadataQueryWriter',
+ com.STDMETHOD())
+ ]
+
+
+class IWICComponentInfo(com.pIUnknown):
+ _methods_ = [
+ ('GetComponentType',
+ com.STDMETHOD()),
+ ('GetCLSID',
+ com.STDMETHOD()),
+ ('GetSigningStatus',
+ com.STDMETHOD()),
+ ('GetAuthor',
+ com.STDMETHOD()),
+ ('GetVendorGUID',
+ com.STDMETHOD()),
+ ('GetVersion',
+ com.STDMETHOD()),
+ ('GetSpecVersion',
+ com.STDMETHOD()),
+ ('GetFriendlyName',
+ com.STDMETHOD())
+ ]
+
+
+class IWICPixelFormatInfo(IWICComponentInfo, com.pIUnknown):
+ _methods_ = [
+ ('GetFormatGUID',
+ com.STDMETHOD(POINTER(com.GUID))),
+ ('GetColorContext',
+ com.STDMETHOD()),
+ ('GetBitsPerPixel',
+ com.STDMETHOD(POINTER(UINT))),
+ ('GetChannelCount',
+ com.STDMETHOD(POINTER(UINT))),
+ ('GetChannelMask',
+ com.STDMETHOD())
+ ]
+
+
+class IWICBitmapSource(com.pIUnknown):
+ _methods_ = [
+ ('GetSize',
+ com.STDMETHOD(POINTER(UINT), POINTER(UINT))),
+ ('GetPixelFormat',
+ com.STDMETHOD(POINTER(REFWICPixelFormatGUID))),
+ ('GetResolution',
+ com.STDMETHOD(POINTER(DOUBLE), POINTER(DOUBLE))),
+ ('CopyPalette',
+ com.STDMETHOD()),
+ ('CopyPixels',
+ com.STDMETHOD(c_void_p, UINT, UINT, c_void_p)),
+ ]
+
+
+class IWICFormatConverter(IWICBitmapSource, com.pIUnknown):
+ _methods_ = [
+ ('Initialize',
+ com.STDMETHOD(IWICBitmapSource, POINTER(REFWICPixelFormatGUID), WICBitmapDitherType, c_void_p, DOUBLE,
+ WICBitmapPaletteType)),
+ ('CanConvert',
+ com.STDMETHOD(POINTER(REFWICPixelFormatGUID), POINTER(REFWICPixelFormatGUID), POINTER(BOOL))),
+ ]
+
+
+class IWICMetadataQueryReader(com.pIUnknown):
+ _methods_ = [
+ ('GetContainerFormat',
+ com.STDMETHOD()),
+ ('GetLocation',
+ com.STDMETHOD()),
+ ('GetMetadataByName',
+ com.STDMETHOD(LPCWSTR, c_void_p)),
+ ('GetEnumerator',
+ com.STDMETHOD()),
+ ]
+
+
+class IWICBitmapFrameDecode(IWICBitmapSource, com.pIUnknown):
+ _methods_ = [
+ ('GetMetadataQueryReader',
+ com.STDMETHOD(POINTER(IWICMetadataQueryReader))),
+ ('GetColorContexts',
+ com.STDMETHOD()),
+ ('GetThumbnail',
+ com.STDMETHOD(POINTER(IWICBitmapSource))),
+ ]
+
+
+class IWICBitmapFlipRotator(IWICBitmapSource, com.pIUnknown):
+ _methods_ = [
+ ('Initialize',
+ com.STDMETHOD(IWICBitmapSource, WICBitmapTransformOptions)),
+ ]
+
+
+class IWICBitmap(IWICBitmapSource, com.pIUnknown):
+ _methods_ = [
+ ('Lock',
+ com.STDMETHOD()),
+ ('SetPalette',
+ com.STDMETHOD()),
+ ('SetResolution',
+ com.STDMETHOD())
+ ]
+
+
+class IWICBitmapDecoder(com.pIUnknown):
+ _methods_ = [
+ ('QueryCapability',
+ com.STDMETHOD()),
+ ('Initialize',
+ com.STDMETHOD()),
+ ('GetContainerFormat',
+ com.STDMETHOD()),
+ ('GetDecoderInfo',
+ com.STDMETHOD()),
+ ('CopyPalette',
+ com.STDMETHOD()),
+ ('GetMetadataQueryReader',
+ com.STDMETHOD(POINTER(IWICMetadataQueryReader))),
+ ('GetPreview',
+ com.STDMETHOD()),
+ ('GetColorContexts',
+ com.STDMETHOD()),
+ ('GetThumbnail',
+ com.STDMETHOD()),
+ ('GetFrameCount',
+ com.STDMETHOD(POINTER(UINT))),
+ ('GetFrame',
+ com.STDMETHOD(UINT, POINTER(IWICBitmapFrameDecode))),
+ ]
+
+
+IID_IWICImagingFactory1 = com.GUID(0xec5ec8a9, 0xc395, 0x4314, 0x9c, 0x77, 0x54, 0xd7, 0xa9, 0x35, 0xff, 0x70)
+IID_IWICImagingFactory2 = com.GUID(0x7B816B45, 0x1996, 0x4476, 0xB1, 0x32, 0xDE, 0x9E, 0x24, 0x7C, 0x8A, 0xF0)
+
+if WINDOWS_8_OR_GREATER:
+ IID_IWICImagingFactory = IID_IWICImagingFactory2
+else:
+ IID_IWICImagingFactory = IID_IWICImagingFactory1
+
+IID_IWICPixelFormatInfo = com.GUID(0xE8EDA601, 0x3D48, 0x431a, 0xAB, 0x44, 0x69, 0x05, 0x9B, 0xE8, 0x8B, 0xBE)
+
+
+class IWICImagingFactory(com.pIUnknown):
+ _methods_ = [
+ ('CreateDecoderFromFilename',
+ com.STDMETHOD(LPCWSTR, com.GUID, DWORD, WICDecodeOptions, POINTER(IWICBitmapDecoder))),
+ ('CreateDecoderFromStream',
+ com.STDMETHOD(com.pIUnknown, c_void_p, WICDecodeOptions, POINTER(IWICBitmapDecoder))),
+ ('CreateDecoderFromFileHandle',
+ com.STDMETHOD()),
+ ('CreateComponentInfo',
+ com.STDMETHOD(com.GUID, POINTER(IWICComponentInfo))),
+ ('CreateDecoder',
+ com.STDMETHOD()),
+ ('CreateEncoder',
+ com.STDMETHOD(POINTER(com.GUID), POINTER(com.GUID), POINTER(IWICBitmapEncoder))),
+ ('CreatePalette',
+ com.STDMETHOD(POINTER(IWICPalette))),
+ ('CreateFormatConverter',
+ com.STDMETHOD(POINTER(IWICFormatConverter))),
+ ('CreateBitmapScaler',
+ com.STDMETHOD()),
+ ('CreateBitmapClipper',
+ com.STDMETHOD()),
+ ('CreateBitmapFlipRotator',
+ com.STDMETHOD(POINTER(IWICBitmapFlipRotator))),
+ ('CreateStream',
+ com.STDMETHOD(POINTER(IWICStream))),
+ ('CreateColorContext',
+ com.STDMETHOD()),
+ ('CreateColorTransformer',
+ com.STDMETHOD()),
+ ('CreateBitmap',
+ com.STDMETHOD(UINT, UINT, POINTER(REFWICPixelFormatGUID), WICBitmapCreateCacheOption, POINTER(IWICBitmap))),
+ ('CreateBitmapFromSource',
+ com.STDMETHOD()),
+ ('CreateBitmapFromSourceRect',
+ com.STDMETHOD()),
+ ('CreateBitmapFromMemory',
+ com.STDMETHOD(UINT, UINT, REFWICPixelFormatGUID, UINT, UINT, POINTER(BYTE), POINTER(IWICBitmap))),
+ ('CreateBitmapFromHBITMAP',
+ com.STDMETHOD()),
+ ('CreateBitmapFromHICON',
+ com.STDMETHOD()),
+ ('CreateComponentEnumerator',
+ com.STDMETHOD()),
+ ('CreateFastMetadataEncoderFromDecoder',
+ com.STDMETHOD()),
+ ('CreateFastMetadataEncoderFromFrameDecode',
+ com.STDMETHOD()),
+ ('CreateQueryWriter',
+ com.STDMETHOD()),
+ ('CreateQueryWriterFromReader',
+ com.STDMETHOD())
+ ]
+
+
+_factory = IWICImagingFactory()
+
+ole32.CoCreateInstance(CLSID_WICImagingFactory,
+ None,
+ CLSCTX_INPROC_SERVER,
+ IID_IWICImagingFactory,
+ byref(_factory))
+
+
+class WICDecoder(ImageDecoder):
+ """Windows Imaging Component.
+ This decoder is a replacement for GDI and GDI+ starting with Windows 7 with more features up to Windows 10."""
+
+ def __init__(self):
+ super(ImageDecoder, self).__init__()
+ self._factory = _factory
+
+ def get_file_extensions(self):
+ return ['.bmp', '.jpg', '.jpeg', '.png', '.tif', '.tiff', '.ico', '.jxr', '.hdp', '.wdp']
+
+ def _load_bitmap_decoder(self, filename, file):
+ data = file.read()
+
+ # Create a HGLOBAL with image data
+ hglob = kernel32.GlobalAlloc(GMEM_MOVEABLE, len(data))
+ ptr = kernel32.GlobalLock(hglob)
+ memmove(ptr, data, len(data))
+ kernel32.GlobalUnlock(hglob)
+
+ # Create IStream for the HGLOBAL
+ stream = com.pIUnknown()
+ ole32.CreateStreamOnHGlobal(hglob, True, byref(stream))
+
+ # Load image from stream
+ decoder = IWICBitmapDecoder()
+ status = self._factory.CreateDecoderFromStream(stream, None, WICDecodeMetadataCacheOnDemand, byref(decoder))
+ if status != 0:
+ stream.Release()
+ raise ImageDecodeException('WIC cannot load %r' % (filename or file))
+
+ return decoder, stream
+
+ def _get_bitmap_frame(self, bitmap_decoder, frame_index):
+ bitmap = IWICBitmapFrameDecode()
+ bitmap_decoder.GetFrame(frame_index, byref(bitmap))
+ return bitmap
+
+ def get_image(self, bitmap, target_fmt=GUID_WICPixelFormat32bppBGRA):
+ """Get's image from bitmap, specifying target format, bitmap is released before returning."""
+ width = UINT()
+ height = UINT()
+
+ bitmap.GetSize(byref(width), byref(height))
+
+ width = int(width.value)
+ height = int(height.value)
+
+ # Get image pixel format
+ pf = com.GUID(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ bitmap.GetPixelFormat(byref(pf))
+
+ fmt = 'BGRA'
+ # If target format is not what we want (32bit BGRA) convert it.
+ if pf != target_fmt:
+ converter = IWICFormatConverter()
+ self._factory.CreateFormatConverter(byref(converter))
+
+ conversion_possible = BOOL()
+ converter.CanConvert(pf, target_fmt, byref(conversion_possible))
+
+ # 99% of the time conversion will be possible to default.
+ # However, we check to be safe and fallback to 24 bit BGR if not possible.
+ if not conversion_possible:
+ target_fmt = GUID_WICPixelFormat24bppBGR
+ fmt = 'BGR'
+
+ converter.Initialize(bitmap, target_fmt, WICBitmapDitherTypeNone, None, 0, WICBitmapPaletteTypeCustom)
+
+ bitmap.Release()
+ bitmap = converter
+
+ # Most images are loaded with a negative pitch, which requires list comprehension to fix.
+ # Create a flipped bitmap through the decoder rather through Python to increase performance.
+ flipper = IWICBitmapFlipRotator()
+ self._factory.CreateBitmapFlipRotator(byref(flipper))
+
+ flipper.Initialize(bitmap, WICBitmapTransformFlipVertical)
+
+ stride = len(fmt) * width
+ buffer_size = stride * height
+
+ buffer = (BYTE * buffer_size)()
+
+ flipper.CopyPixels(None, stride, buffer_size, byref(buffer))
+
+ flipper.Release()
+ bitmap.Release() # Can be converter.
+
+ return ImageData(width, height, fmt, buffer)
+
+ def _delete_bitmap_decoder(self, bitmap_decoder, stream):
+ # Release decoder and stream
+ bitmap_decoder.Release()
+ stream.Release()
+
+ def decode(self, filename, file):
+ if not file:
+ file = open(filename, 'rb')
+ bitmap_decoder, stream = self._load_bitmap_decoder(filename, file)
+ bitmap = self._get_bitmap_frame(bitmap_decoder, 0)
+ image = self.get_image(bitmap)
+ self._delete_bitmap_decoder(bitmap_decoder, stream)
+ return image
+
+ @staticmethod
+ def get_property_value(reader, metadata_name):
+ """
+ Uses a metadata name and reader to return a single value. Can be used to get metadata from images.
+ If failure, returns 0.
+ Also handles cleanup of PROPVARIANT.
+ """
+ try:
+ prop = PROPVARIANT()
+ reader.GetMetadataByName(metadata_name, byref(prop))
+ value = prop.llVal
+ ole32.PropVariantClear(byref(prop))
+ except OSError:
+ value = 0
+
+ return value
+
+
+def get_decoders():
+ return [WICDecoder()]
+
+
+extension_to_container = {
+ '.bmp': GUID_ContainerFormatBmp,
+ '.jpg': GUID_ContainerFormatJpeg,
+ '.jpeg': GUID_ContainerFormatJpeg,
+ '.tif': GUID_ContainerFormatTiff,
+ '.tiff': GUID_ContainerFormatTiff,
+ '.wmp': GUID_ContainerFormatWmp,
+ '.jxr': GUID_ContainerFormatWmp,
+ '.wdp': GUID_ContainerFormatWmp,
+ '.png': GUID_ContainerFormatPng,
+}
+
+
+class WICEncoder(ImageEncoder):
+ def get_file_extensions(self):
+ return [ext for ext in extension_to_container]
+
+ def encode(self, image, filename, file):
+ image = image.get_image_data()
+
+ wicstream = IWICStream()
+ encoder = IWICBitmapEncoder()
+ frame = IWICBitmapFrameEncode()
+ property_bag = IPropertyBag2()
+
+ ext = (filename and os.path.splitext(filename)[1]) or '.png'
+
+ # Choose container based on extension. Default to PNG.
+ container = extension_to_container.get(ext, GUID_ContainerFormatPng)
+
+ _factory.CreateStream(byref(wicstream))
+ # https://docs.microsoft.com/en-us/windows/win32/wic/-wic-codec-native-pixel-formats#native-image-formats
+ if container == GUID_ContainerFormatJpeg:
+ # Expects BGR, no transparency available. Hard coded.
+ fmt = 'BGR'
+ default_format = GUID_WICPixelFormat24bppBGR
+ else:
+ # Windows encodes in BGRA.
+ if len(image.format) == 3:
+ fmt = 'BGR'
+ default_format = GUID_WICPixelFormat24bppBGR
+ else:
+ fmt = 'BGRA'
+ default_format = GUID_WICPixelFormat32bppBGRA
+
+ pitch = image.width * len(fmt)
+
+ image_data = image.get_data(fmt, -pitch)
+
+ size = pitch * image.height
+
+ if file:
+ istream = IStream()
+ ole32.CreateStreamOnHGlobal(None, True, byref(istream))
+ wicstream.InitializeFromIStream(istream)
+ else:
+ wicstream.InitializeFromFilename(filename, GENERIC_WRITE)
+
+ _factory.CreateEncoder(container, None, byref(encoder))
+
+ encoder.Initialize(wicstream, WICBitmapEncoderNoCache)
+
+ encoder.CreateNewFrame(byref(frame), byref(property_bag))
+
+ frame.Initialize(property_bag)
+
+ frame.SetSize(image.width, image.height)
+
+ frame.SetPixelFormat(byref(default_format))
+
+ data = (c_byte * size).from_buffer(bytearray(image_data))
+
+ frame.WritePixels(image.height, abs(image.pitch), size, data)
+
+ frame.Commit()
+
+ encoder.Commit()
+
+ if file:
+ sts = STATSTG()
+ istream.Stat(byref(sts), 0)
+ stream_size = sts.cbSize
+ istream.Seek(0, STREAM_SEEK_SET, None)
+
+ buf = (BYTE * stream_size)()
+ written = ULONG()
+ istream.Read(byref(buf), stream_size, byref(written))
+
+ if written.value == stream_size:
+ file.write(buf)
+ else:
+ print(f"Failed to read all of the data from stream attempting to save {file}")
+
+ istream.Release()
+
+ encoder.Release()
+ frame.Release()
+ property_bag.Release()
+ wicstream.Release()
+
+
+def get_encoders():
+ return [WICEncoder()]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/info.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/info.py
new file mode 100644
index 0000000000000000000000000000000000000000..7625b87f9e2f4c708e5f70a20c9dea4e0ce16a62
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/info.py
@@ -0,0 +1,203 @@
+"""Get environment information useful for debugging.
+
+Intended usage is to create a file for bug reports, e.g.::
+
+ python -m pyglet.info > info.txt
+
+"""
+
+_first_heading = True
+
+
+def _heading(heading):
+ global _first_heading
+ if not _first_heading:
+ print()
+ else:
+ _first_heading = False
+ print(heading)
+ print('-' * 78)
+
+
+def dump_platform():
+ """Dump OS specific """
+ import platform
+ print('platform: ', platform.platform())
+ print('release: ', platform.release())
+ print('machine: ', platform.machine())
+
+
+def dump_python():
+ """Dump Python version and environment to stdout."""
+ import os
+ import sys
+ import platform
+ print('implementation:', platform.python_implementation())
+ print('sys.version:', sys.version)
+ print('sys.maxint:', sys.maxsize)
+ if sys.platform == 'darwin':
+ try:
+ from objc import __version__ as pyobjc_version
+ print('objc.__version__:', pyobjc_version)
+ except:
+ print('PyObjC not available')
+ print('os.getcwd():', os.getcwd())
+ for key, value in os.environ.items():
+ if key.startswith('PYGLET_'):
+ print(f"os.environ['{key}']: {value}")
+
+
+def dump_pyglet():
+ """Dump pyglet version and options."""
+ import pyglet
+ print('pyglet.version:', pyglet.version)
+ print('pyglet.compat_platform:', pyglet.compat_platform)
+ print('pyglet.__file__:', pyglet.__file__)
+ for key, value in pyglet.options.items():
+ print(f"pyglet.options['{key}'] = {value!r}")
+
+
+def dump_window():
+ """Dump display, window, screen and default config info."""
+ from pyglet.gl import gl_info
+ if not gl_info.have_version(3):
+ print(f"Insufficient OpenGL version: {gl_info.get_version_string()}")
+ return
+ import pyglet.window
+ display = pyglet.canvas.get_display()
+ print('display:', repr(display))
+ screens = display.get_screens()
+ for i, screen in enumerate(screens):
+ print(f'screens[{i}]: {screen!r}')
+ window = pyglet.window.Window(visible=False)
+ for key, value in window.config.get_gl_attributes():
+ print(f"config['{key}'] = {value!r}")
+ print('context:', repr(window.context))
+
+ _heading('window.context._info')
+ dump_gl(window.context)
+ window.close()
+
+
+def dump_gl(context=None):
+ """Dump GL info."""
+ if context is not None:
+ info = context.get_info()
+ else:
+ from pyglet.gl import gl_info as info
+ print('gl_info.get_version():', info.get_version())
+ print('gl_info.get_vendor():', info.get_vendor())
+ print('gl_info.get_renderer():', info.get_renderer())
+ print('gl_info.get_extensions():')
+ extensions = list(info.get_extensions())
+ extensions.sort()
+ for name in extensions:
+ print(' ', name)
+
+
+def dump_glx():
+ """Dump GLX info."""
+ try:
+ from pyglet.gl import glx_info
+ except:
+ print('GLX not available.')
+ return
+ import pyglet
+ window = pyglet.window.Window(visible=False)
+ print('context.is_direct():', window.context.is_direct())
+ window.close()
+
+ if not glx_info.have_version(1, 1):
+ print('Version: < 1.1')
+ else:
+ print('glx_info.get_server_vendor():', glx_info.get_server_vendor())
+ print('glx_info.get_server_version():', glx_info.get_server_version())
+ print('glx_info.get_server_extensions():')
+ for name in glx_info.get_server_extensions():
+ print(' ', name)
+ print('glx_info.get_client_vendor():', glx_info.get_client_vendor())
+ print('glx_info.get_client_version():', glx_info.get_client_version())
+ print('glx_info.get_client_extensions():')
+ for name in glx_info.get_client_extensions():
+ print(' ', name)
+ print('glx_info.get_extensions():')
+ for name in glx_info.get_extensions():
+ print(' ', name)
+
+
+def dump_media():
+ """Dump pyglet.media info."""
+ import pyglet.media
+ print('audio driver:', pyglet.media.get_audio_driver())
+
+
+def dump_ffmpeg():
+ """Dump FFmpeg info."""
+ import pyglet
+ pyglet.options['search_local_libs'] = True
+ import pyglet.media
+
+ if pyglet.media.have_ffmpeg():
+ from pyglet.media.codecs.ffmpeg import get_version
+ print('FFmpeg version:', get_version())
+ else:
+ print('FFmpeg not available.')
+
+
+def dump_al():
+ """Dump OpenAL info."""
+ try:
+ from pyglet.media.drivers import openal
+ except:
+ print('OpenAL not available.')
+ return
+ print('Library:', openal.lib_openal._lib)
+
+ driver = openal.create_audio_driver()
+ print('Version: {}.{}'.format(*driver.get_version()))
+ print('Extensions:')
+ for extension in driver.get_extensions():
+ print(' ', extension)
+
+
+def dump_wintab():
+ """Dump WinTab info."""
+ try:
+ from pyglet.input.win32 import wintab
+ except:
+ print('WinTab not available.')
+ return
+
+ interface_name = wintab.get_interface_name()
+ impl_version = wintab.get_implementation_version()
+ spec_version = wintab.get_spec_version()
+
+ print('WinTab: {0} {1}.{2} (Spec {3}.{4})'.format(interface_name,
+ impl_version >> 8, impl_version & 0xff,
+ spec_version >> 8, spec_version & 0xff))
+
+
+def _try_dump(heading, func):
+ _heading(heading)
+ try:
+ func()
+ except:
+ import traceback
+ traceback.print_exc()
+
+
+def dump():
+ """Dump all information to stdout."""
+ _try_dump('Platform', dump_platform)
+ _try_dump('Python', dump_python)
+ _try_dump('pyglet', dump_pyglet)
+ _try_dump('pyglet.window', dump_window)
+ _try_dump('pyglet.gl.glx_info', dump_glx)
+ _try_dump('pyglet.media', dump_media)
+ _try_dump('pyglet.media.ffmpeg', dump_ffmpeg)
+ _try_dump('pyglet.media.drivers.openal', dump_al)
+ _try_dump('pyglet.input.wintab', dump_wintab)
+
+
+if __name__ == '__main__':
+ dump()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..d6cdeb23d6de5b86bde6f993eaf8d2b0395593bf
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/__init__.py
@@ -0,0 +1,162 @@
+"""Joystick, Game Controller, Tablet and USB HID device support.
+
+This module provides a unified interface to almost any input device, besides
+the regular mouse and keyboard support provided by
+:py:class:`~pyglet.window.Window`. At the lowest
+level, :py:func:`get_devices` can be used to retrieve a list of all supported
+devices, including joysticks, tablets, space controllers, wheels, pedals, remote
+controls, keyboards and mice. The set of returned devices varies greatly
+depending on the operating system (and, of course, what's plugged in).
+
+At this level pyglet does not try to interpret *what* a particular device is,
+merely what controls it provides. A :py:class:`Control` can be either a button,
+whose value is either ``True`` or ``False``, or a relative or absolute-valued
+axis, whose value is a float. Sometimes the name of a control can be provided
+(for example, ``x``, representing the horizontal axis of a joystick), but often
+not. In these cases the device API may still be useful -- the user will have
+to be asked to press each button in turn or move each axis separately to
+identify them.
+
+Higher-level interfaces are provided for joysticks, game controllers, tablets
+and the Apple remote control. These devices can usually be identified by pyglet
+positively, and a base level of functionality for each one provided through a
+common interface.
+
+To use an input device:
+
+1. Call :py:func:`get_devices`, :py:func:`get_apple_remote`,
+ :py:func:`get_controllers` or :py:func:`get_joysticks` to retrieve and
+ identify the device.
+2. For low-level devices (retrieved by :py:func:`get_devices`), query the
+ devices list of controls and determine which ones you are interested in. For
+ high-level interfaces the set of controls is provided by the interface.
+3. Optionally attach event handlers to controls on the device. For high-level
+ interfaces, additional events are available.
+4. Call :py:meth:`Device.open` to begin receiving events on the device. You can
+ begin querying the control values after this time; they will be updated
+ asynchronously.
+5. Call :py:meth:`Device.close` when you are finished with the device (not
+ needed if your application quits at this time).
+
+To use a tablet, follow the procedure above using :py:func:`get_tablets`, but
+note that no control list is available; instead, calling :py:meth:`Tablet.open`
+returns a :py:class:`TabletCanvas` onto which you should set your event
+handlers.
+
+For game controllers, the :py:class:`ControllerManager` is available. This
+provides a convenient way to handle hot-plugging of controllers.
+
+.. versionadded:: 1.2
+
+"""
+
+import sys
+
+import pyglet
+from .base import Device, Control, RelativeAxis, AbsoluteAxis, ControllerManager
+from .base import Button, Joystick, AppleRemote, Tablet, Controller
+from .base import DeviceException, DeviceOpenException, DeviceExclusiveException
+
+_is_pyglet_doc_run = hasattr(sys, "is_pyglet_doc_run") and sys.is_pyglet_doc_run
+
+
+def get_apple_remote(display=None):
+ """Get the Apple remote control device.
+
+ The Apple remote is the small white 6-button remote control that
+ accompanies most recent Apple desktops and laptops. The remote can only
+ be used with Mac OS X.
+
+ :Parameters:
+ display : `~pyglet.canvas.Display`
+ Currently ignored.
+
+ :rtype: AppleRemote
+ :return: The remote device, or `None` if the computer does not support it.
+ """
+ return None
+
+
+if _is_pyglet_doc_run:
+ def get_devices(display=None):
+ """Get a list of all attached input devices.
+
+ :Parameters:
+ display : `~pyglet.canvas.Display`
+ The display device to query for input devices. Ignored on Mac
+ OS X and Windows. On Linux, defaults to the default display
+ device.
+
+ :rtype: list of :py:class:`Device`
+ """
+
+
+ def get_joysticks(display=None):
+ """Get a list of attached joysticks.
+
+ :Parameters:
+ display : `~pyglet.canvas.Display`
+ The display device to query for input devices. Ignored on Mac
+ OS X and Windows. On Linux, defaults to the default display
+ device.
+
+ :rtype: list of :py:class:`Joystick`
+ """
+
+
+ def get_controllers(display=None):
+ """Get a list of attached controllers.
+
+ :Parameters:
+ display : `~pyglet.canvas.Display`
+ The display device to query for input devices. Ignored on Mac
+ OS X and Windows. On Linux, defaults to the default display
+ device.
+
+ :rtype: list of :py:class:`Controller`
+ """
+
+
+ def get_tablets(display=None):
+ """Get a list of tablets.
+
+ This function may return a valid tablet device even if one is not
+ attached (for example, it is not possible on Mac OS X to determine if
+ a tablet device is connected). Despite returning a list of tablets,
+ pyglet does not currently support multiple tablets, and the behaviour
+ is undefined if more than one is attached.
+
+ :Parameters:
+ display : `~pyglet.canvas.Display`
+ The display device to query for input devices. Ignored on Mac
+ OS X and Windows. On Linux, defaults to the default display
+ device.
+
+ :rtype: list of :py:class:`Tablet`
+ """
+
+else:
+
+ from pyglet import compat_platform
+
+ if compat_platform.startswith('linux'):
+ from .linux import get_devices
+ from .linux import get_joysticks
+ from .linux import get_controllers
+ from .linux import get_tablets
+ from .linux import ControllerManager
+
+ elif compat_platform in ('cygwin', 'win32'):
+ from .win32 import get_devices
+ from .win32 import get_joysticks
+ from .win32 import get_controllers
+ from .win32 import get_tablets
+ from .win32 import Win32ControllerManager as ControllerManager
+
+ elif compat_platform == 'darwin':
+ from .macos import get_devices
+ from .macos import get_joysticks
+ from .macos import get_apple_remote
+ from .macos import get_controllers
+ from .macos import get_tablets
+ from .macos import ControllerManager
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/base.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..c99f00fa7a0fd67ea475685bdb10f26388713610
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/base.py
@@ -0,0 +1,1169 @@
+"""Interface classes for `pyglet.input`.
+
+.. versionadded:: 1.2
+"""
+
+import sys
+
+from pyglet.event import EventDispatcher
+
+
+_is_pyglet_doc_run = hasattr(sys, "is_pyglet_doc_run") and sys.is_pyglet_doc_run
+
+
+class DeviceException(Exception):
+ pass
+
+
+class DeviceOpenException(DeviceException):
+ pass
+
+
+class DeviceExclusiveException(DeviceException):
+ pass
+
+
+class Device:
+ """Input device.
+
+ :Ivariables:
+ display : `pyglet.canvas.Display`
+ Display this device is connected to.
+ name : str
+ Name of the device, as described by the device firmware.
+ manufacturer : str
+ Name of the device manufacturer, or ``None`` if the information is
+ not available.
+ """
+
+ def __init__(self, display, name):
+ self.display = display
+ self.name = name
+ self.manufacturer = None
+ self._is_open = False
+
+ @property
+ def is_open(self):
+ return self._is_open
+
+ def open(self, window=None, exclusive=False):
+ """Open the device to begin receiving input from it.
+
+ :Parameters:
+ `window` : Window
+ Optional window to associate with the device. The behaviour
+ of this parameter is device and operating system dependant.
+ It can usually be omitted for most devices.
+ `exclusive` : bool
+ If ``True`` the device will be opened exclusively so that no
+ other application can use it. The method will raise
+ `DeviceExclusiveException` if the device cannot be opened this
+ way (for example, because another application has already
+ opened it).
+ """
+
+ if self._is_open:
+ raise DeviceOpenException('Device is already open.')
+
+ self._is_open = True
+
+ def close(self):
+ """Close the device. """
+ self._is_open = False
+
+ def get_controls(self):
+ """Get a list of controls provided by the device.
+
+ :rtype: list of `Control`
+ """
+ raise NotImplementedError('abstract')
+
+ def get_guid(self):
+ """Get the device GUID, in SDL2 format.
+
+ Return a str containing a unique device identification
+ string. This is generated from the hardware identifiers,
+ and is in the same format as was popularized by SDL2.
+ GUIDs differ between platforms, but are generally 32
+ hexidecimal characters.
+
+ :rtype: str containing the device's GUID.
+ """
+ raise NotImplementedError('abstract')
+
+ def __repr__(self):
+ return f"{self.__class__.__name__}(name={self.name})"
+
+
+class Control(EventDispatcher):
+ """Single value input provided by a device.
+
+ A control's value can be queried when the device is open. Event handlers
+ can be attached to the control to be called when the value changes.
+
+ The `min` and `max` properties are provided as advertised by the
+ device; in some cases the control's value will be outside this range.
+
+ :Ivariables:
+ `name` : str
+ Name of the control, or ``None`` if unknown
+ `raw_name` : str
+ Unmodified name of the control, as presented by the operating
+ system; or ``None`` if unknown.
+ `inverted` : bool
+ If ``True``, the value reported is actually inverted from what the
+ device reported; usually this is to provide consistency across
+ operating systems.
+ """
+
+ def __init__(self, name, raw_name=None, inverted=False):
+ self.name = name
+ self.raw_name = raw_name
+ self.inverted = inverted
+ self._value = None
+
+ @property
+ def value(self):
+ """Current value of the control.
+
+ The range of the value is device-dependent; for absolute controls
+ the range is given by ``min`` and ``max`` (however the value may exceed
+ this range); for relative controls the range is undefined.
+
+ :type: float
+ """
+ return self._value
+
+ @value.setter
+ def value(self, newvalue):
+ if newvalue == self._value:
+ return
+ self._value = newvalue
+ self.dispatch_event('on_change', newvalue)
+
+ def __repr__(self):
+ if self.name:
+ return f"{self.__class__.__name__}(name={self.name}, raw_name={self.raw_name})"
+ else:
+ return f"{self.__class__.__name__}(raw_name={self.raw_name})"
+
+ def on_change(self, value):
+ """The value changed.
+
+ :Parameters:
+ `value` : float
+ Current value of the control.
+
+ :event:
+ """
+
+
+Control.register_event_type('on_change')
+
+
+class RelativeAxis(Control):
+ """An axis whose value represents a relative change from the previous
+ value.
+ """
+
+ #: Name of the horizontal axis control
+ X = 'x'
+ #: Name of the vertical axis control
+ Y = 'y'
+ #: Name of the Z axis control.
+ Z = 'z'
+ #: Name of the rotational-X axis control
+ RX = 'rx'
+ #: Name of the rotational-Y axis control
+ RY = 'ry'
+ #: Name of the rotational-Z axis control
+ RZ = 'rz'
+ #: Name of the scroll wheel control
+ WHEEL = 'wheel'
+
+ @property
+ def value(self):
+ return self._value
+
+ @value.setter
+ def value(self, value):
+ self._value = value
+ self.dispatch_event('on_change', value)
+
+
+class AbsoluteAxis(Control):
+ """An axis whose value represents a physical measurement from the device.
+
+ The value is advertised to range over ``minimum`` and ``maximum``.
+
+ :Ivariables:
+ `minimum` : float
+ Minimum advertised value.
+ `maximum` : float
+ Maximum advertised value.
+ """
+
+ #: Name of the horizontal axis control
+ X = 'x'
+ #: Name of the vertical axis control
+ Y = 'y'
+ #: Name of the Z axis control.
+ Z = 'z'
+ #: Name of the rotational-X axis control
+ RX = 'rx'
+ #: Name of the rotational-Y axis control
+ RY = 'ry'
+ #: Name of the rotational-Z axis control
+ RZ = 'rz'
+ #: Name of the hat (POV) control, when a single control enumerates all of
+ #: the hat's positions.
+ HAT = 'hat'
+ #: Name of the hat's (POV's) horizontal control, when the hat position is
+ #: described by two orthogonal controls.
+ HAT_X = 'hat_x'
+ #: Name of the hat's (POV's) vertical control, when the hat position is
+ #: described by two orthogonal controls.
+ HAT_Y = 'hat_y'
+
+ def __init__(self, name, minimum, maximum, raw_name=None, inverted=False):
+ super().__init__(name, raw_name, inverted)
+ self.min = minimum
+ self.max = maximum
+
+
+class Button(Control):
+ """A control whose value is boolean. """
+
+ @property
+ def value(self):
+ return bool(self._value)
+
+ @value.setter
+ def value(self, newvalue):
+ if newvalue == self._value:
+ return
+ self._value = newvalue
+ self.dispatch_event('on_change', bool(newvalue))
+ if newvalue:
+ self.dispatch_event('on_press')
+ else:
+ self.dispatch_event('on_release')
+
+ if _is_pyglet_doc_run:
+ def on_press(self):
+ """The button was pressed.
+
+ :event:
+ """
+
+ def on_release(self):
+ """The button was released.
+
+ :event:
+ """
+
+
+Button.register_event_type('on_press')
+Button.register_event_type('on_release')
+
+
+class Joystick(EventDispatcher):
+ """High-level interface for joystick-like devices. This includes a wide range
+ of analog and digital joysticks, gamepads, controllers, and possibly even
+ steering wheels and other input devices. There is unfortunately no easy way to
+ distinguish between most of these different device types.
+
+ For a simplified subset of Joysticks, see the :py:class:`~pyglet.input.Controller`
+ interface. This covers a variety of popular game console controllers. Unlike
+ Joysticks, Controllers have strictly defined layouts and inputs.
+
+ To use a joystick, first call `open`, then in your game loop examine
+ the values of `x`, `y`, and so on. These values are normalized to the
+ range [-1.0, 1.0].
+
+ To receive events when the value of an axis changes, attach an
+ on_joyaxis_motion event handler to the joystick. The :py:class:`~pyglet.input.Joystick` instance,
+ axis name, and current value are passed as parameters to this event.
+
+ To handle button events, you should attach on_joybutton_press and
+ on_joy_button_release event handlers to the joystick. Both the :py:class:`~pyglet.input.Joystick`
+ instance and the index of the changed button are passed as parameters to
+ these events.
+
+ Alternately, you may attach event handlers to each individual button in
+ `button_controls` to receive on_press or on_release events.
+
+ To use the hat switch, attach an on_joyhat_motion event handler to the
+ joystick. The handler will be called with both the hat_x and hat_y values
+ whenever the value of the hat switch changes.
+
+ The device name can be queried to get the name of the joystick.
+
+ :Ivariables:
+ `device` : `Device`
+ The underlying device used by this joystick interface.
+ `x` : float
+ Current X (horizontal) value ranging from -1.0 (left) to 1.0
+ (right).
+ `y` : float
+ Current y (vertical) value ranging from -1.0 (top) to 1.0
+ (bottom).
+ `z` : float
+ Current Z value ranging from -1.0 to 1.0. On joysticks the Z
+ value is usually the throttle control. On controllers the Z
+ value is usually the secondary thumb vertical axis.
+ `rx` : float
+ Current rotational X value ranging from -1.0 to 1.0.
+ `ry` : float
+ Current rotational Y value ranging from -1.0 to 1.0.
+ `rz` : float
+ Current rotational Z value ranging from -1.0 to 1.0. On joysticks
+ the RZ value is usually the twist of the stick. On game
+ controllers the RZ value is usually the secondary thumb horizontal
+ axis.
+ `hat_x` : int
+ Current hat (POV) horizontal position; one of -1 (left), 0
+ (centered) or 1 (right).
+ `hat_y` : int
+ Current hat (POV) vertical position; one of -1 (bottom), 0
+ (centered) or 1 (top).
+ `buttons` : list of bool
+ List of boolean values representing current states of the buttons.
+ These are in order, so that button 1 has value at ``buttons[0]``,
+ and so on.
+ `x_control` : `AbsoluteAxis`
+ Underlying control for `x` value, or ``None`` if not available.
+ `y_control` : `AbsoluteAxis`
+ Underlying control for `y` value, or ``None`` if not available.
+ `z_control` : `AbsoluteAxis`
+ Underlying control for `z` value, or ``None`` if not available.
+ `rx_control` : `AbsoluteAxis`
+ Underlying control for `rx` value, or ``None`` if not available.
+ `ry_control` : `AbsoluteAxis`
+ Underlying control for `ry` value, or ``None`` if not available.
+ `rz_control` : `AbsoluteAxis`
+ Underlying control for `rz` value, or ``None`` if not available.
+ `hat_x_control` : `AbsoluteAxis`
+ Underlying control for `hat_x` value, or ``None`` if not available.
+ `hat_y_control` : `AbsoluteAxis`
+ Underlying control for `hat_y` value, or ``None`` if not available.
+ `button_controls` : list of `Button`
+ Underlying controls for `buttons` values.
+ """
+
+ def __init__(self, device):
+ self.device = device
+
+ self.x = 0
+ self.y = 0
+ self.z = 0
+ self.rx = 0
+ self.ry = 0
+ self.rz = 0
+ self.hat_x = 0
+ self.hat_y = 0
+ self.buttons = []
+
+ self.x_control = None
+ self.y_control = None
+ self.z_control = None
+ self.rx_control = None
+ self.ry_control = None
+ self.rz_control = None
+ self.hat_x_control = None
+ self.hat_y_control = None
+ self.button_controls = []
+
+ def add_axis(control):
+ name = control.name
+ scale = 2.0 / (control.max - control.min)
+ bias = -1.0 - control.min * scale
+ if control.inverted:
+ scale = -scale
+ bias = -bias
+ setattr(self, name + '_control', control)
+
+ @control.event
+ def on_change(value):
+ normalized_value = value * scale + bias
+ setattr(self, name, normalized_value)
+ self.dispatch_event('on_joyaxis_motion', self, name, normalized_value)
+
+ def add_button(control):
+ i = len(self.buttons)
+ self.buttons.append(False)
+ self.button_controls.append(control)
+
+ @control.event
+ def on_change(value):
+ self.buttons[i] = value
+
+ @control.event
+ def on_press():
+ self.dispatch_event('on_joybutton_press', self, i)
+
+ @control.event
+ def on_release():
+ self.dispatch_event('on_joybutton_release', self, i)
+
+ def add_hat(control):
+ # 8-directional hat encoded as a single control (Windows/Mac)
+ self.hat_x_control = control
+ self.hat_y_control = control
+
+ @control.event
+ def on_change(value):
+ if value & 0xffff == 0xffff:
+ self.hat_x = self.hat_y = 0
+ else:
+ if control.max > 8: # DirectInput: scale value
+ value //= 0xfff
+ if 0 <= value < 8:
+ self.hat_x, self.hat_y = (( 0, 1),
+ ( 1, 1),
+ ( 1, 0),
+ ( 1, -1),
+ ( 0, -1),
+ (-1, -1),
+ (-1, 0),
+ (-1, 1))[value]
+ else:
+ # Out of range
+ self.hat_x = self.hat_y = 0
+ self.dispatch_event('on_joyhat_motion', self, self.hat_x, self.hat_y)
+
+ for control in device.get_controls():
+ if isinstance(control, AbsoluteAxis):
+ if control.name in ('x', 'y', 'z', 'rx', 'ry', 'rz', 'hat_x', 'hat_y'):
+ add_axis(control)
+ elif control.name == 'hat':
+ add_hat(control)
+ elif isinstance(control, Button):
+ add_button(control)
+
+ def open(self, window=None, exclusive=False):
+ """Open the joystick device. See `Device.open`. """
+ self.device.open(window, exclusive)
+
+ def close(self):
+ """Close the joystick device. See `Device.close`. """
+ self.device.close()
+
+ def on_joyaxis_motion(self, joystick, axis, value):
+ """The value of a joystick axis changed.
+
+ :Parameters:
+ `joystick` : `Joystick`
+ The joystick device whose axis changed.
+ `axis` : string
+ The name of the axis that changed.
+ `value` : float
+ The current value of the axis, normalized to [-1, 1].
+ """
+
+ def on_joybutton_press(self, joystick, button):
+ """A button on the joystick was pressed.
+
+ :Parameters:
+ `joystick` : `Joystick`
+ The joystick device whose button was pressed.
+ `button` : int
+ The index (in `button_controls`) of the button that was pressed.
+ """
+
+ def on_joybutton_release(self, joystick, button):
+ """A button on the joystick was released.
+
+ :Parameters:
+ `joystick` : `Joystick`
+ The joystick device whose button was released.
+ `button` : int
+ The index (in `button_controls`) of the button that was released.
+ """
+
+ def on_joyhat_motion(self, joystick, hat_x, hat_y):
+ """The value of the joystick hat switch changed.
+
+ :Parameters:
+ `joystick` : `Joystick`
+ The joystick device whose hat control changed.
+ `hat_x` : int
+ Current hat (POV) horizontal position; one of -1 (left), 0
+ (centered) or 1 (right).
+ `hat_y` : int
+ Current hat (POV) vertical position; one of -1 (bottom), 0
+ (centered) or 1 (top).
+ """
+
+ def __repr__(self):
+ return f"Joystick(device={self.device.name})"
+
+
+Joystick.register_event_type('on_joyaxis_motion')
+Joystick.register_event_type('on_joybutton_press')
+Joystick.register_event_type('on_joybutton_release')
+Joystick.register_event_type('on_joyhat_motion')
+
+
+class Controller(EventDispatcher):
+
+ __slots__ = ('device', 'guid', '_mapping', 'name', 'a', 'b', 'x', 'y',
+ 'back', 'start', 'guide', 'leftshoulder', 'rightshoulder',
+ 'leftstick', 'rightstick', 'lefttrigger', 'righttrigger',
+ 'leftx', 'lefty', 'rightx', 'righty', 'dpup', 'dpdown', 'dpleft',
+ 'dpright', '_button_controls', '_axis_controls', '_hat_control',
+ '_hat_x_control', '_hat_y_control')
+
+ def __init__(self, device, mapping):
+ """High-level interface for Game Controllers.
+
+ Unlike Joysticks, Controllers have a strictly defined set of inputs
+ that matches the layout of popular home video game console Controllers.
+ This includes a variety of face and shoulder buttons, analog sticks and
+ triggers, a directional pad, and optional rumble (force feedback)
+ effects.
+
+ To use a Controller, you must first call `open`. Controllers will then
+ dispatch a variety of events whenever the inputs change. They can also
+ be polled at any time to find the current value of any inputs. Analog
+ inputs are normalized to the range [-1.0, 1.0].
+
+ :note: A running application event loop is required
+
+ The following event types are dispatched:
+ `on_button_press`
+ `on_button_release`
+ `on_stick_motion`
+ `on_dpad_motion`
+ `on_trigger_motion`
+
+ The device name can be queried to get the name of the joystick.
+
+ :Ivariables:
+ `device` : `Device`
+ The underlying device used by this joystick interface.
+ `name` : str
+ The name of the Controller as reported by the OS.
+ `guid` : str
+ The unique device identification string, in SDL2 format.
+ `a` : bool
+ `b` : bool
+ `x` : bool
+ `x` : bool
+ `back` : bool
+ `start` : bool
+ `guide` : bool
+ `leftshoulder` : bool
+ `rightshoulder` : bool
+ `leftstick` : bool
+ `rightstick` : bool
+ `leftx` : float
+ `lefty` : float
+ `rightx` : float
+ `righty` : float
+ `lefttrigger` : float
+ `righttrigger` : float
+ `dpup` : bool
+ `dpdown` : bool
+ `dpleft` : bool
+ `dpright` : bool
+
+ .. versionadded:: 2.0
+ """
+
+ self.device = device
+ self._mapping = mapping
+
+ self.name = mapping.get('name')
+ self.guid = mapping.get('guid')
+
+ self.a = False
+ self.b = False
+ self.x = False
+ self.y = False
+ self.back = False
+ self.start = False
+ self.guide = False
+ self.leftshoulder = False
+ self.rightshoulder = False
+ self.leftstick = False # stick press button
+ self.rightstick = False # stick press button
+ self.lefttrigger = 0
+ self.righttrigger = 0
+ self.leftx = 0
+ self.lefty = 0
+ self.rightx = 0
+ self.righty = 0
+ self.dpup = False
+ self.dpdown = False
+ self.dpleft = False
+ self.dpright = False
+
+ self._button_controls = []
+ self._axis_controls = []
+ self._hat_control = None
+ self._hat_x_control = None
+ self._hat_y_control = None
+
+ self._initialize_controls()
+
+ def _initialize_controls(self):
+
+ def add_axis(control, axis_name):
+ tscale = 1.0 / (control.max - control.min)
+ scale = 2.0 / (control.max - control.min)
+ bias = -1.0 - control.min * scale
+ if control.inverted:
+ scale = -scale
+ bias = -bias
+
+ if axis_name in ("dpup", "dpdown"):
+ @control.event
+ def on_change(value):
+ normalized_value = value * scale + bias
+ self.dpup = self.dpdown = False
+ if normalized_value > 0.1:
+ self.dpup = True
+ if normalized_value < -0.1:
+ self.dpdown = True
+ self.dispatch_event('on_dpad_motion', self,
+ self.dpleft, self.dpright, self.dpup, self.dpdown)
+
+ elif axis_name in ("dpleft", "dpright"):
+ @control.event
+ def on_change(value):
+ normalized_value = value * scale + bias
+ self.dpleft = self.dpright = False
+ if normalized_value > 0.1:
+ self.dpright = True
+ if normalized_value < -0.1:
+ self.dpleft = True
+ self.dispatch_event('on_dpad_motion', self, self.dpleft, self.dpright, self.dpup, self.dpdown)
+
+ elif axis_name in ("lefttrigger", "righttrigger"):
+ @control.event
+ def on_change(value):
+ normalized_value = value * tscale
+ setattr(self, axis_name, normalized_value)
+ self.dispatch_event('on_trigger_motion', self, axis_name, normalized_value)
+
+ elif axis_name in ("leftx", "lefty"):
+ @control.event
+ def on_change(value):
+ normalized_value = value * scale + bias
+ setattr(self, axis_name, normalized_value)
+ self.dispatch_event('on_stick_motion', self,
+ "leftstick", self.leftx, -self.lefty)
+
+ elif axis_name in ("rightx", "righty"):
+ @control.event
+ def on_change(value):
+ normalized_value = value * scale + bias
+ setattr(self, axis_name, normalized_value)
+ self.dispatch_event('on_stick_motion', self,
+ "rightstick", self.rightx, -self.righty)
+
+ def add_button(control, button_name):
+ if button_name in ("dpleft", "dpright", "dpup", "dpdown"):
+ @control.event
+ def on_change(value):
+ setattr(self, button_name, value)
+ self.dispatch_event('on_dpad_motion', self,
+ self.dpleft, self.dpright, self.dpup, self.dpdown)
+ else:
+ @control.event
+ def on_change(value):
+ setattr(self, button_name, value)
+
+ @control.event
+ def on_press():
+ self.dispatch_event('on_button_press', self, button_name)
+
+ @control.event
+ def on_release():
+ self.dispatch_event('on_button_release', self, button_name)
+
+ def add_dedicated_hat(control):
+ # 8-directional hat encoded as a single control (Windows/Mac)
+ @control.event
+ def on_change(value):
+ if value & 0xffff == 0xffff:
+ self.dpleft = self.dpright = self.dpup = self.dpdown = False
+ else:
+ if control.max > 8: # DirectInput: scale value
+ value //= 0xfff
+ if 0 <= value < 8:
+ self.dpleft, self.dpright, self.dpup, self.dpdown = (
+ (False, False, True, False),
+ (False, True, True, False),
+ (False, True, False, False),
+ (False, True, False, True),
+ (False, False, False, True),
+ (True, False, False, True),
+ (True, False, False, False),
+ (True, False, True, False))[value]
+ else:
+ # Out of range
+ self.dpleft = self.dpright = self.dpup = self.dpdown = False
+ self.dispatch_event('on_dpad_motion', self,
+ self.dpleft, self.dpright, self.dpup, self.dpdown)
+
+ for control in self.device.get_controls():
+ """Categorize the various control types"""
+ if isinstance(control, Button):
+ self._button_controls.append(control)
+
+ elif isinstance(control, AbsoluteAxis):
+ if control.name in ('x', 'y', 'z', 'rx', 'ry', 'rz'):
+ self._axis_controls.append(control)
+ elif control.name == "hat_x":
+ self._hat_x_control = control
+ elif control.name == "hat_y":
+ self._hat_y_control = control
+ elif control.name == "hat":
+ self._hat_control = control
+
+ for name, relation in self._mapping.items():
+
+ if relation is None or type(relation) is str:
+ continue
+
+ if relation.control_type == "button":
+ try:
+ add_button(self._button_controls[relation.index], name)
+ except IndexError:
+ continue
+ elif relation.control_type == "axis":
+ try:
+ add_axis(self._axis_controls[relation.index], name)
+ except IndexError:
+ continue
+ elif relation.control_type == "hat0":
+ if self._hat_control:
+ # TODO: test this on Windows/Mac.
+ add_dedicated_hat(self._hat_control)
+ else:
+ if relation.index == 1: # 1 == UP
+ add_axis(self._hat_y_control, "dpup")
+ elif relation.index == 2: # 2 == RIGHT
+ add_axis(self._hat_x_control, "dpright")
+ elif relation.index == 4: # 4 == DOWN
+ add_axis(self._hat_y_control, "dpdown")
+ elif relation.index == 8: # 8 == LEFT
+ add_axis(self._hat_x_control, "dpleft")
+
+ def open(self, window=None, exclusive=False):
+ """Open the controller. See `Device.open`. """
+ self.device.open(window, exclusive)
+
+ def close(self):
+ """Close the controller. See `Device.close`. """
+ self.device.close()
+
+ # Rumble (force feedback) methods:
+
+ def rumble_play_weak(self, strength=1.0, duration=0.5):
+ """Play a rumble effect on the weak motor.
+
+ :Parameters:
+ `strength` : float
+ The strength of the effect, from 0 to 1.
+ `duration` : float
+ The duration of the effect in seconds.
+ """
+
+ def rumble_play_strong(self, strength=1.0, duration=0.5):
+ """Play a rumble effect on the strong motor.
+
+ :Parameters:
+ `strength` : float
+ The strength of the effect, from 0 to 1.
+ `duration` : float
+ The duration of the effect in seconds.
+ """
+
+ def rumble_stop_weak(self):
+ """Stop playing rumble effects on the weak motor."""
+
+ def rumble_stop_strong(self):
+ """Stop playing rumble effects on the strong motor."""
+
+ # Input Event types:
+
+ def on_stick_motion(self, controller, stick, xvalue, yvalue):
+ """The value of a controller analogue stick changed.
+
+ :Parameters:
+ `controller` : `Controller`
+ The controller whose analogue stick changed.
+ `stick` : string
+ The name of the stick that changed.
+ `xvalue` : float
+ The current X axis value, normalized to [-1, 1].
+ `yvalue` : float
+ The current Y axis value, normalized to [-1, 1].
+ """
+
+ def on_dpad_motion(self, controller, dpleft, dpright, dpup, dpdown):
+ """The direction pad of the controller changed.
+
+ :Parameters:
+ `controller` : `Controller`
+ The controller whose hat control changed.
+ `dpleft` : boolean
+ True if left is pressed on the directional pad.
+ `dpright` : boolean
+ True if right is pressed on the directional pad.
+ `dpup` : boolean
+ True if up is pressed on the directional pad.
+ `dpdown` : boolean
+ True if down is pressed on the directional pad.
+ """
+
+ def on_trigger_motion(self, controller, trigger, value):
+ """The value of a controller analogue stick changed.
+
+ :Parameters:
+ `controller` : `Controller`
+ The controller whose analogue stick changed.
+ `trigger` : string
+ The name of the trigger that changed.
+ `value` : float
+ The current value of the trigger, normalized to [-1, 1].
+ """
+
+ def on_button_press(self, controller, button):
+ """A button on the controller was pressed.
+
+ :Parameters:
+ `controller` : :py:class:`Controller`
+ The controller whose button was pressed.
+ `button` : string
+ The name of the button that was pressed.
+ """
+
+ def on_button_release(self, controller, button):
+ """A button on the joystick was released.
+
+ :Parameters:
+ `controller` : `Controller`
+ The controller whose button was released.
+ `button` : string
+ The name of the button that was released.
+ """
+
+ def __repr__(self):
+ return f"Controller(name={self.name})"
+
+
+Controller.register_event_type('on_button_press')
+Controller.register_event_type('on_button_release')
+Controller.register_event_type('on_stick_motion')
+Controller.register_event_type('on_dpad_motion')
+Controller.register_event_type('on_trigger_motion')
+
+
+class AppleRemote(EventDispatcher):
+ """High-level interface for Apple remote control.
+
+ This interface provides access to the 6 button controls on the remote.
+ Pressing and holding certain buttons on the remote is interpreted as
+ a separate control.
+
+ :Ivariables:
+ `device` : `Device`
+ The underlying device used by this interface.
+ `left_control` : `Button`
+ Button control for the left (prev) button.
+ `left_hold_control` : `Button`
+ Button control for holding the left button (rewind).
+ `right_control` : `Button`
+ Button control for the right (next) button.
+ `right_hold_control` : `Button`
+ Button control for holding the right button (fast forward).
+ `up_control` : `Button`
+ Button control for the up (volume increase) button.
+ `down_control` : `Button`
+ Button control for the down (volume decrease) button.
+ `select_control` : `Button`
+ Button control for the select (play/pause) button.
+ `select_hold_control` : `Button`
+ Button control for holding the select button.
+ `menu_control` : `Button`
+ Button control for the menu button.
+ `menu_hold_control` : `Button`
+ Button control for holding the menu button.
+ """
+
+ def __init__(self, device):
+ def add_button(control):
+ setattr(self, control.name + '_control', control)
+
+ @control.event
+ def on_press():
+ self.dispatch_event('on_button_press', control.name)
+
+ @control.event
+ def on_release():
+ self.dispatch_event('on_button_release', control.name)
+
+ self.device = device
+ for control in device.get_controls():
+ if control.name in ('left', 'left_hold', 'right', 'right_hold', 'up', 'down',
+ 'menu', 'select', 'menu_hold', 'select_hold'):
+ add_button(control)
+
+ def open(self, window=None, exclusive=False):
+ """Open the device. See `Device.open`. """
+ self.device.open(window, exclusive)
+
+ def close(self):
+ """Close the device. See `Device.close`. """
+ self.device.close()
+
+ def on_button_press(self, button):
+ """A button on the remote was pressed.
+
+ Only the 'up' and 'down' buttons will generate an event when the
+ button is first pressed. All other buttons on the remote will wait
+ until the button is released and then send both the press and release
+ events at the same time.
+
+ :Parameters:
+ `button` : unicode
+ The name of the button that was pressed. The valid names are
+ 'up', 'down', 'left', 'right', 'left_hold', 'right_hold',
+ 'menu', 'menu_hold', 'select', and 'select_hold'
+
+ :event:
+ """
+
+ def on_button_release(self, button):
+ """A button on the remote was released.
+
+ The 'select_hold' and 'menu_hold' button release events are sent
+ immediately after the corresponding press events regardless of
+ whether the user has released the button.
+
+ :Parameters:
+ `button` : str
+ The name of the button that was released. The valid names are
+ 'up', 'down', 'left', 'right', 'left_hold', 'right_hold',
+ 'menu', 'menu_hold', 'select', and 'select_hold'
+
+ :event:
+ """
+
+
+AppleRemote.register_event_type('on_button_press')
+AppleRemote.register_event_type('on_button_release')
+
+
+class Tablet:
+ """High-level interface to tablet devices.
+
+ Unlike other devices, tablets must be opened for a specific window,
+ and cannot be opened exclusively. The `open` method returns a
+ `TabletCanvas` object, which supports the events provided by the tablet.
+
+ Currently only one tablet device can be used, though it can be opened on
+ multiple windows. If more than one tablet is connected, the behaviour is
+ undefined.
+ """
+
+ def open(self, window):
+ """Open a tablet device for a window.
+
+ :Parameters:
+ `window` : `Window`
+ The window on which the tablet will be used.
+
+ :rtype: `TabletCanvas`
+ """
+ raise NotImplementedError('abstract')
+
+
+class TabletCanvas(EventDispatcher):
+ """Event dispatcher for tablets.
+
+ Use `Tablet.open` to obtain this object for a particular tablet device and
+ window. Events may be generated even if the tablet stylus is outside of
+ the window; this is operating-system dependent.
+
+ The events each provide the `TabletCursor` that was used to generate the
+ event; for example, to distinguish between a stylus and an eraser. Only
+ one cursor can be used at a time, otherwise the results are undefined.
+
+ :Ivariables:
+ `window` : Window
+ The window on which this tablet was opened.
+ """
+ # OS X: Active window receives tablet events only when cursor is in window
+ # Windows: Active window receives all tablet events
+ #
+ # Note that this means enter/leave pairs are not always consistent (normal
+ # usage).
+
+ def __init__(self, window):
+ self.window = window
+
+ def close(self):
+ """Close the tablet device for this window.
+ """
+ raise NotImplementedError('abstract')
+
+ if _is_pyglet_doc_run:
+ def on_enter(self, cursor):
+ """A cursor entered the proximity of the window. The cursor may
+ be hovering above the tablet surface, but outside of the window
+ bounds, or it may have entered the window bounds.
+
+ Note that you cannot rely on `on_enter` and `on_leave` events to
+ be generated in pairs; some events may be lost if the cursor was
+ out of the window bounds at the time.
+
+ :Parameters:
+ `cursor` : `TabletCursor`
+ The cursor that entered proximity.
+
+ :event:
+ """
+
+ def on_leave(self, cursor):
+ """A cursor left the proximity of the window. The cursor may have
+ moved too high above the tablet surface to be detected, or it may
+ have left the bounds of the window.
+
+ Note that you cannot rely on `on_enter` and `on_leave` events to
+ be generated in pairs; some events may be lost if the cursor was
+ out of the window bounds at the time.
+
+ :Parameters:
+ `cursor` : `TabletCursor`
+ The cursor that left proximity.
+
+ :event:
+ """
+
+ def on_motion(self, cursor, x, y, pressure, tilt_x, tilt_y, buttons):
+ """The cursor moved on the tablet surface.
+
+ If `pressure` is 0, then the cursor is actually hovering above the
+ tablet surface, not in contact.
+
+ :Parameters:
+ `cursor` : `TabletCursor`
+ The cursor that moved.
+ `x` : int
+ The X position of the cursor, in window coordinates.
+ `y` : int
+ The Y position of the cursor, in window coordinates.
+ `pressure` : float
+ The pressure applied to the cursor, in range 0.0 (no
+ pressure) to 1.0 (full pressure).
+ `tilt_x` : float
+ Currently undefined.
+ `tilt_y` : float
+ Currently undefined.
+ `buttons` : int
+ Button state may be provided if the platform supports it.
+ Supported on: Windows
+
+ :event:
+ """
+
+
+TabletCanvas.register_event_type('on_enter')
+TabletCanvas.register_event_type('on_leave')
+TabletCanvas.register_event_type('on_motion')
+
+
+class TabletCursor:
+ """A distinct cursor used on a tablet.
+
+ Most tablets support at least a *stylus* and an *erasor* cursor; this
+ object is used to distinguish them when tablet events are generated.
+
+ :Ivariables:
+ `name` : str
+ Name of the cursor.
+ """
+
+ # TODO well-defined names for stylus and eraser.
+
+ def __init__(self, name):
+ self.name = name
+
+ def __repr__(self):
+ return '%s(%s)' % (self.__class__.__name__, self.name)
+
+
+class ControllerManager(EventDispatcher):
+ """High level interface for managing game Controllers.
+
+ This class provides a convenient way to handle the
+ connection and disconnection of devices. A list of all
+ connected Controllers can be queried at any time with the
+ `get_controllers` method. For hot-plugging, events are
+ dispatched for `on_connect` and `on_disconnect`.
+ To use the ControllerManager, first make an instance::
+
+ controller_man = pyglet.input.ControllerManager()
+
+ At the start of your game, query for any Controllers
+ that are already connected::
+
+ controllers = controller_man.get_controllers()
+
+ To handle Controllers that are connected or disconnected
+ after the start of your game, register handlers for the
+ appropriate events::
+
+ @controller_man.event
+ def on_connect(controller):
+ # code to handle newly connected
+ # (or re-connected) controllers
+ controller.open()
+ print("Connect:", controller)
+
+ @controller_man.event
+ def on_disconnect(controller):
+ # code to handle disconnected Controller
+ print("Disconnect:", controller)
+
+ .. versionadded:: 1.2
+ """
+
+ def get_controllers(self):
+ """Get a list of all connected Controllers
+
+ :rtype: list of :py:class:`Controller`
+ """
+ raise NotImplementedError
+
+ def on_connect(self, controller):
+ """A Controller has been connected. If this is
+ a previously dissconnected Controller that is
+ being re-connected, the same Controller instance
+ will be returned.
+
+ :Parameters:
+ `controller` : :py:class:`Controller`
+ An un-opened Controller instance.
+
+ :event:
+ """
+
+ def on_disconnect(self, controller):
+ """A Controller has been disconnected.
+
+ :Parameters:
+ `controller` : :py:class:`Controller`
+ An un-opened Controller instance.
+
+ :event:
+ """
+
+
+ControllerManager.register_event_type('on_connect')
+ControllerManager.register_event_type('on_disconnect')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/controller.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/controller.py
new file mode 100644
index 0000000000000000000000000000000000000000..6385172d437c7fea6d7819dd7e9d1d9759ec7f44
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/controller.py
@@ -0,0 +1,162 @@
+"""Game Controller support.
+
+This module provides an interface for Game Controller devices, which are a
+subset of Joysticks. Game Controllers have consistent button and axis mapping,
+which resembles common dual-stick home video game console controllers.
+Devices that are of this design can be automatically mapped to the "virtual"
+Game Controller layout, providing a consistent abstraction for a large number
+of different devices, with no tedious button and axis mapping for each one.
+To achieve this, an internal mapping database contains lists of device ids
+and their corresponding button and axis mappings. The mapping database is in
+the same format as originated by the `SDL` library, which has become a
+semi-standard and is in common use. Most popular controllers are included in
+the built-in database, and additional mappings can be added at runtime.
+
+
+Some Joysticks, such as Flight Sticks, etc., do not necessarily fit into the
+layout (and limitations) of GameControllers. For those such devices, it is
+recommended to use the Joystick interface instead.
+
+To query which GameControllers are available, call :py:func:`get_controllers`.
+
+.. versionadded:: 2.0
+"""
+import os as _os
+import sys as _sys
+import warnings as _warnings
+
+from .controller_db import mapping_list
+
+
+_env_config = _os.environ.get('SDL_GAMECONTROLLERCONFIG')
+if _env_config:
+ # insert at the front of the list
+ mapping_list.insert(0, _env_config)
+
+
+def _swap_le16(value):
+ """Ensure 16bit value is in Big Endian format"""
+ if _sys.byteorder == "little":
+ return ((value << 8) | (value >> 8)) & 0xFFFF
+ return value
+
+
+def create_guid(bus: int, vendor: int, product: int, version: int, name: str, signature: int, data: int) -> str:
+ # byte size 16 16 16 16 str 8 8
+ """Create an SDL2 style GUID string from a device's identifiers."""
+ bus = _swap_le16(bus)
+ vendor = _swap_le16(vendor)
+ product = _swap_le16(product)
+ version = _swap_le16(version)
+
+ return f"{bus:04x}0000{vendor:04x}0000{product:04x}0000{version:04x}0000"
+
+
+class Relation:
+ __slots__ = 'control_type', 'index', 'inverted'
+
+ def __init__(self, control_type, index, inverted=False):
+ self.control_type = control_type
+ self.index = index
+ self.inverted = inverted
+
+ def __repr__(self):
+ return f"Relation(type={self.control_type}, index={self.index}, inverted={self.inverted})"
+
+
+def _parse_mapping(mapping_string):
+ """Parse a SDL2 style GameController mapping string.
+
+ :Parameters:
+ `mapping_string` : str
+ A raw string containing an SDL style controller mapping.
+
+ :rtype: A dict containing axis/button mapping relations.
+ """
+
+ valid_keys = ['guide', 'back', 'start', 'a', 'b', 'x', 'y',
+ 'leftshoulder', 'leftstick', 'rightshoulder', 'rightstick',
+ 'dpup', 'dpdown', 'dpleft', 'dpright',
+ 'lefttrigger', 'righttrigger', 'leftx', 'lefty', 'rightx', 'righty']
+
+ split_mapping = mapping_string.strip().split(",")
+ relations = dict(guid=split_mapping[0], name=split_mapping[1])
+
+ for item in split_mapping[2:]:
+ # looking for items like: a:b0, b:b1, etc.
+ if ':' not in item:
+ continue
+
+ key, relation_string, *etc = item.split(':')
+
+ if key not in valid_keys:
+ continue
+
+ # Look for specific flags to signify inverted axis:
+ if "+" in relation_string:
+ relation_string = relation_string.strip('+')
+ inverted = False
+ elif "-" in relation_string:
+ relation_string = relation_string.strip('-')
+ inverted = True
+ elif "~" in relation_string:
+ relation_string = relation_string.strip('~')
+ inverted = True
+ else:
+ inverted = False
+
+ # All relations will be one of (Button, Axis, or Hat).
+ if relation_string.startswith("b"): # Button
+ relations[key] = Relation("button", int(relation_string[1:]), inverted)
+ elif relation_string.startswith("a"): # Axis
+ relations[key] = Relation("axis", int(relation_string[1:]), inverted)
+ elif relation_string.startswith("h0"): # Hat
+ relations[key] = Relation("hat0", int(relation_string.split(".")[1]), inverted)
+
+ return relations
+
+
+def get_mapping(guid):
+ """Return a mapping for the passed device GUID.
+
+ :Parameters:
+ `guid` : str
+ A pyglet input device GUID
+
+ :rtype: dict of axis/button mapping relations, or None
+ if no mapping is available for this Controller.
+ """
+ for mapping in mapping_list:
+ if mapping.startswith(guid):
+ try:
+ return _parse_mapping(mapping)
+ except ValueError:
+ _warnings.warn(f"Unable to parse Controller mapping: {mapping}")
+ continue
+
+
+def add_mappings_from_file(filename) -> None:
+ """Add mappings from a file.
+
+ Given a file path, open and parse the file for mappings.
+
+ :Parameters:
+ `filename` : str
+ A file path.
+ """
+ with open(filename) as f:
+ add_mappings_from_string(f.read())
+
+
+def add_mappings_from_string(string) -> None:
+ """Add one or more mappings from a raw string.
+
+ :Parameters:
+ `string` : str
+ A string containing one or more mappings,
+ """
+ for line in string.splitlines():
+ if line.startswith('#'):
+ continue
+ line = line.strip()
+ mapping_list.append(line)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/controller_db.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/controller_db.py
new file mode 100644
index 0000000000000000000000000000000000000000..61b70ae9c6764fc10dda0364979d98ed9ea6e30a
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/controller_db.py
@@ -0,0 +1,837 @@
+from pyglet import compat_platform
+
+
+# This file is automatically generated by 'pyglet/tools/gen_controller_db.py'
+# Generated on: Wed Jan 18 14:06:46 2023
+
+if compat_platform.startswith("linux"):
+ mapping_list = [
+"xinput,*,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00001038000000010000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000650000011010000,8BitDo M30 Gamepad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a5,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00005106000000010000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001590000011010000,8BitDo N30 Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001590000011010000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00006528000000010000,8BitDo N30 Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00006528000000010000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000003512000012ab000010010000,8BitDo NES30 Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000003512000012ab000010010000,8BitDo NES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000022000000090000011010000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000022000000090000011010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000190000011010000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000190000011010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000203800000900000000010000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000203800000900000000010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00002038000000010000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00002038000000010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000660000011010000,8BitDo Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000660000011010000,8BitDo Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00000660000000010000,8BitDo Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00000660000000010000,8BitDo Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00000061000000010000,8BitDo SF30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00000061000000010000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000102800000900000000010000,8BitDo SFC30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000102800000900000000010000,8BitDo SFC30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00003028000000010000,8BitDo SFC30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00003028000000010000,8BitDo SFC30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000260000011010000,8BitDo SN30 Pro+,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000260000011010000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00000261000000010000,8BitDo SN30 Pro+,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00000261000000010000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000160000011010000,8BitDo SN30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000160000011010000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000003512000020ab000010010000,8BitDo SNES30 Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000003512000020ab000010010000,8BitDo SNES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000202800000900000000010000,8BitDo SNES30 Gamepad,a:b0,b:b1,back:b10,dpdown:b122,dpleft:b119,dpright:b120,dpup:b117,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000202800000900000000010000,8BitDo SNES30 Gamepad,a:b1,b:b0,back:b10,dpdown:b122,dpleft:b119,dpright:b120,dpup:b117,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001130000011010000,8BitDo Ultimate Wired Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b26,paddle1:b24,paddle2:b25,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000c82d00001330000011010000,8BitDo Ultimate Wireless Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b26,paddle1:b23,paddle2:b19,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000c82d00001890000011010000,8BitDo Zero 2,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001890000011010000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00003032000000010000,8BitDo Zero 2,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00003032000000010000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000a00500003232000001000000,8BitDo Zero Gamepad,a:b0,b:b1,back:b10,dpdown:b122,dpleft:b119,dpright:b120,dpup:b117,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000a00500003232000001000000,8BitDo Zero Gamepad,a:b1,b:b0,back:b10,dpdown:b122,dpleft:b119,dpright:b120,dpup:b117,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000a00500003232000008010000,8BitDo Zero Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000a00500003232000008010000,8BitDo Zero Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000031000011010000,8Bitdo Receiver,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,",
+"03000000c82d00001290000011010000,8Bitdo SN30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001290000011010000,8Bitdo SN30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00006228000000010000,8Bitdo SN30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000c82d00006228000000010000,8Bitdo SN30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"05000000050b00000045000031000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,",
+"05000000050b00000045000040000000,ASUS Gamepad,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b10,x:b2,y:b3,",
+"03000000050b00000579000011010000,ASUS ROG Kunai 3 Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b36,paddle1:b52,paddle2:b53,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"05000000050b00000679000000010000,ASUS ROG Kunai 3 Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b21,paddle1:b22,paddle2:b23,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"030000006f0e00003901000020060000,Afterglow Controller for Xbox One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000006f0e00003901000000430000,Afterglow Prismatic Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000006f0e00001302000000010000,Afterglow,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"05000000491900000204000021000000,Amazon Fire Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b17,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b12,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000491900001904000011010000,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,",
+"05000000710100001904000000010000,Amazon Luna Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b11,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
+"03000000790000003018000011010000,Arcade Fightstick F300,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"03000000503200000110000000000000,Atari Classic Controller,a:b0,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,x:b1,",
+"05000000503200000110000000000000,Atari Classic Controller,a:b0,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,x:b1,",
+"03000000503200000210000000000000,Atari Game Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a2,righty:a3,start:b8,x:b2,y:b3,",
+"05000000503200000210000000000000,Atari Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,",
+"030000005e0400008e02000047010000,Atari Xbox 360 Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000c62400001b89000011010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000d62000002a79000011010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000120c0000f70e000011010000,Brook Universal Fighting Board,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:,lefty:,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:,righty:,start:b9,x:b0,y:b3,",
+"03000000b40400000a01000000010000,CYPRESS USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,",
+"03000000ffff0000ffff000000010000,Chinese-made Xbox Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,",
+"03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000260900008888000000010000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,",
+"03000000a306000022f6000011010000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,",
+"03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,",
+"030000006f0e00003001000001010000,EA Sports PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000b40400001124000011010000,Flydigi Vader 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b12,lefttrigger:a5,leftx:a0,lefty:a1,paddle1:b2,paddle2:b5,paddle4:b17,rightshoulder:b7,rightstick:b13,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"05000000151900004000000001000000,Flydigi Vader 2,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"0300000079000000d418000000010000,GPD Win 2 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"0500000047532067616d657061640000,GS Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000341a000005f7000010010000,GameCube {HuiJia USB box},a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
+"03000000bc2000000055000011010000,GameSir G3w,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"0500000049190000020400001b010000,GameSir T4 Pro,crc:8283,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b23,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000ac0500001a06000011010000,GameSir-T3 2.02,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000c01100000140000011010000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000008f0e00000800000010010000,Gasia Co. Ltd PS(R) Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"030000006f0e00001304000000010000,Generic X-Box pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000f0250000c183000010010000,Goodbetterbest Ltd USB Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000d11800000094000011010000,Google Stadia Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
+"03000000280400000140000000010000,Gravis Gamepad Pro USB ,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000008f0e00000610000000010000,GreenAsia Electronics 4Axes 12Keys Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,",
+"030000008f0e00001200000010010000,GreenAsia Inc. USB Joystick,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
+"03000000c9110000f055000011010000,HJC Game GAMEPAD,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"030000000d0f00001000000011010000,HORI CO. LTD. FIGHTING STICK 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000000d0f00002200000011010000,HORI CO. LTD. REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000000d0f00006a00000011010000,HORI CO. LTD. Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00006b00000011010000,HORI CO. LTD. Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00005001000009040000,HORI Fighting Commander OCTA,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000000d0f00008400000011010000,HORI Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00008500000010010000,HORI Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00008800000011010000,HORI Fighting Stick mini 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000000d0f00008700000011010000,HORI Fighting Stick mini 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,rightshoulder:b5,rightstick:b11,righttrigger:a4,start:b9,x:b0,y:b3,",
+"030000000d0f0000d800000072056800,HORI Real Arcade Pro S,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
+"030000000d0f0000aa00000011010000,HORI Real Arcade Pro,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"030000000d0f00006e00000011010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00006600000011010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00006700000001010000,HORIPAD ONE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"06000000adde0000efbe000002010000,Hidromancer Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000d81400000862000011010000,HitBox (PS3/PC) Analog Mode,a:b1,b:b2,back:b8,guide:b9,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b12,x:b0,y:b3,",
+"030000000d0f00005f00000011010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00005e00000011010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00008600000002010000,Hori Fighting Commander,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000ad1b000001f5000033050000,Hori Pad EX Turbo 2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000008f0e00001330000010010000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,",
+"03000000242e00008816000001010000,Hyperkin X91,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000d80400008200000003000000,IMS PCU#0 Gamepad Interface,a:b1,b:b0,back:b4,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,start:b5,x:b3,y:b2,",
+"03000000fd0500000030000000010000,InterAct GoPad I-73000 (Fighting Game Layout),a:b3,b:b4,back:b6,leftx:a0,lefty:a1,rightshoulder:b2,righttrigger:b5,start:b7,x:b0,y:b1,",
+"05000000491900000204000000000000,Ipega PG-9087S,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"030000006e0500000320000010010000,JC-U3613M - DirectInput Mode,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,",
+"03000000300f00001001000010010000,Jess Tech Dual Analog Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,",
+"03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
+"030000006f0e00000103000000020000,Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d04000016c2000010010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d04000016c2000011010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d04000011c2000010010000,Logitech WingMan Cordless RumblePad,a:b0,b:b1,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b10,rightx:a3,righty:a4,start:b8,x:b3,y:b4,",
+"03000000c62400002b89000011010000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"05000000c62400002a89000000010000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b22,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"05000000c62400001a89000000010000,MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000250900006688000000010000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,",
+"05000000380700006652000025010000,Mad Catz C.T.R.L.R ,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000380700005032000011010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000380700005082000011010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000380700008433000011010000,Mad Catz FightStick TE S+ (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000380700008483000011010000,Mad Catz FightStick TE S+ (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000ad1b00002ef0000090040000,Mad Catz Fightpad SFxT,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b2,y:b3,",
+"03000000380700003847000090040000,Mad Catz Wired Xbox 360 Controller (SFIV),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000380700001647000010040000,Mad Catz Wired Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000ad1b000016f0000090040000,Mad Catz Xbox 360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000380700008034000011010000,Mad Catz fightstick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000380700008084000011010000,Mad Catz fightstick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000380700001888000010010000,MadCatz PC USB Wired Stick 8818,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000380700003888000010010000,MadCatz PC USB Wired Stick 8838,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:a0,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000790000004418000010010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
+"03000000780000000600000010010000,Microntek USB Joystick,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,",
+"030000005e0400000e00000000010000,Microsoft SideWinder,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,rightshoulder:b7,start:b8,x:b3,y:b4,",
+"030000005e0400008e02000004010000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e0400008e02000062230000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e040000d102000003020000,Microsoft X-Box One pad v2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e040000d102000001010000,Microsoft X-Box One pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e0400008502000000010000,Microsoft X-Box pad (Japan),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,",
+"030000005e0400008902000021010000,Microsoft X-Box pad v2 (US),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,",
+"030000005e0400008902000020010000,Microsoft Xbox Controller S,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,",
+"05000000d6200000ad0d000001000000,Moga Pro,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
+"030000006b140000010c000010010000,NACON GC-400ES,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,",
+"03000000550900001472000011010000,NVIDIA Controller v01.04,a:b0,b:b1,back:b14,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b17,leftshoulder:b4,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,",
+"03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
+"030000004b120000014d000000010000,NYKO AIRFLO EX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
+"03000000451300000830000010010000,NYKO CORE,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000790000004318000010010000,Nintendo GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000790000004318000010010000,Nintendo GameCube Controller,a:b1,b:b0,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000007e0500003703000000016800,Nintendo GameCube Controller,a:b0,b:b2,dpdown:b6,dpleft:b4,dpright:b5,dpup:b7,lefttrigger:a4,leftx:a0,lefty:a1~,rightshoulder:b9,righttrigger:a5,rightx:a2,righty:a3~,start:b8,x:b1,y:b3,",
+"050000007e0500000620000001800000,Nintendo Switch Joy-Con (L),a:b15,b:b16,guide:b4,leftshoulder:b6,leftstick:b12,leftx:a1,lefty:a0~,rightshoulder:b8,start:b9,x:b17,y:b14,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e0500000620000001800000,Nintendo Switch Joy-Con (L),a:b16,b:b15,guide:b4,leftshoulder:b6,leftstick:b12,leftx:a1,lefty:a0~,rightshoulder:b8,start:b9,x:b14,y:b17,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"060000007e0500000620000000000000,Nintendo Switch Joy-Con (L/R),a:b1,b:b0,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"060000007e0500000620000000000000,Nintendo Switch Joy-Con (L/R),a:b0,b:b1,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"060000007e0500000820000000000000,Nintendo Switch Joy-Con (L/R),a:b1,b:b0,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"060000007e0500000820000000000000,Nintendo Switch Joy-Con (L/R),a:b0,b:b1,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e0500000720000001800000,Nintendo Switch Joy-Con (R),a:b2,b:b1,guide:b9,leftshoulder:b4,leftstick:b10,leftx:a1~,lefty:a0,rightshoulder:b6,start:b8,x:b3,y:b0,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e0500000720000001800000,Nintendo Switch Joy-Con (R),a:b1,b:b2,guide:b9,leftshoulder:b4,leftstick:b10,leftx:a1~,lefty:a0,rightshoulder:b6,start:b8,x:b0,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000d620000013a7000011010000,Nintendo Switch PowerA Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000d620000013a7000011010000,Nintendo Switch PowerA Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000d620000011a7000011010000,Nintendo Switch PowerA Core Plus Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000d620000011a7000011010000,Nintendo Switch PowerA Core Plus Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000007e0500000920000011810000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,misc1:b4,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000007e0500000920000011810000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,misc1:b4,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000004c69632050726f20436f6e00,Nintendo Switch Pro Controller,crc:15b7,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000004c69632050726f20436f6e00,Nintendo Switch Pro Controller,crc:15b7,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e0500000920000001800000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e0500000920000001800000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e0500000603000000060000,Nintendo Wii Remote Classic Controller,crc:0d8a,a:b0,b:b1,back:b10,dpdown:b14,dpleft:b12,dpright:b13,dpup:b11,guide:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b9,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e0500000603000000060000,Nintendo Wii Remote Classic Controller,crc:0d8a,a:b1,b:b0,back:b10,dpdown:b14,dpleft:b12,dpright:b13,dpup:b11,guide:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b9,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b1,b:b0,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e0500000603000000060000,Nintendo Wii Remote,crc:60be,a:b1,b:b0,back:b4,dpdown:b8,dpleft:b6,dpright:b7,dpup:b5,guide:b2,start:b3,x:b9,y:b10,",
+"05000000010000000100000003000000,Nintendo Wiimote,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"030000000d0500000308000010010000,Nostromo n45 Dual Analog Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,",
+"05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,",
+"05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,",
+"030000005e0400000202000000010000,Old Xbox pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,",
+"03000000ff1100003133000010010000,PC Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"030000006f0e00006401000001010000,PDP Battlefield One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000006f0e00000901000011010000,PDP Versus Fighting Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"03000000ff1100004133000010010000,PS2 Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,",
+"03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000004c0500006802000010010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
+"030000004c0500006802000010810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+"030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:a12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:a13,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
+"030000004c0500006802000011810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+"030000006f0e00001402000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000008f0e00000300000010010000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"050000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:a12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:a13,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
+"050000004c0500006802000000800000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+"050000004c0500006802000000810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+"05000000504c415953544154494f4e00,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
+"060000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
+"030000004c050000a00b000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004c050000a00b000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+"030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004c050000c405000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+"030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004c050000cc09000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004c050000cc09000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+"050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"050000004c050000c405000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+"050000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"050000004c050000cc09000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+"050000004c050000cc09000001800000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+"030000004c050000e60c000000010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004c050000e60c000011010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004c050000e60c000011810000,PS5 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+"050000004c050000e60c000000010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"050000004c050000e60c000000810000,PS5 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,",
+"030000004c050000da0c000011010000,Playstation Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,",
+"03000000c62400003a54000001010000,PowerA XBox One Controller,a:b0,b:b1,back:b6,dpdown:h0.7,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000c62400000053000000010000,PowerA,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,",
+"03000000222c00000225000011010000,Qanba Dragon Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000222c00000025000011010000,Qanba Dragon Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000222c00000020000011010000,Qanba Drone Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,",
+"03000000222c00000223000011010000,Qanba Obsidian Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000222c00000023000011010000,Qanba Obsidian Arcade Joystick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000008916000001fd000024010000,Razer Onza Classic Edition,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000321500000204000011010000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000321500000104000011010000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000321500000010000011010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000321500000507000000010000,Razer Raiju Mobile,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b21,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000321500000011000011010000,Razer Raion Fightpad for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000008916000000fe000024010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000c6240000045d000024010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000c6240000045d000025010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000321500000009000011010000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
+"050000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
+"0300000032150000030a000001010000,Razer Wildcat,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"0300000000f000000300000000010000,RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,",
+"03000000790000001100000010010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,",
+"030000006b140000130d000011010000,Revolution Pro Controller 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000006b140000010d000011010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000006f0e00001e01000011010000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006f0e00004601000001010000,Rock Candy Xbox One Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000006f0e00001f01000000010000,Rock Candy,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000632500007505000010010000,SHANWAN PS3/PC Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000341a00000908000010010000,SL-6566,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000457500002211000010010000,SZMY-POWER PC Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000a306000023f6000011010000,Saitek Cyborg V.1 Game Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,",
+"03000000a30600000cff000010010000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,",
+"03000000a30600000c04000011010000,Saitek P2900 Wireless Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b12,x:b0,y:b3,",
+"03000000a30600000901000000010000,Saitek P880,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,",
+"03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,",
+"03000000a306000018f5000010010000,Saitek PLC Saitek P3200 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,",
+"03000000c01600008704000011010000,Serial/Keyboard/Mouse/Joystick,a:b12,b:b10,back:b4,dpdown:b2,dpleft:b3,dpright:b1,dpup:b0,leftshoulder:b9,leftstick:b14,lefttrigger:b6,leftx:a1,lefty:a0,rightshoulder:b8,rightstick:b15,righttrigger:b7,rightx:a2,righty:a3,start:b5,x:b13,y:b11,",
+"03000000f025000021c1000010010000,ShanWan Gioteck PS3 Wired Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000632500002305000010010000,ShanWan USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,",
+"030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+"03000000de2800000112000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b5,",
+"03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+"03000000de2800000211000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b5,",
+"03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+"03000000de2800004211000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b5,",
+"03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+"05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+"05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
+"03000000de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"0500000011010000311400001b010000,SteelSeries Stratus Duo,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b32,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"05000000110100001914000009010000,SteelSeries Stratus XL,a:b0,b:b1,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b18,leftshoulder:b6,leftstick:b13,lefttrigger:+a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:+a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000ad1b000038f0000090040000,Street Fighter IV FightStick TE,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000666600000488000000010000,Super Joy Box 5 Pro,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,",
+"0300000000f00000f100000000010000,Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,",
+"030000004f0400000ed0000011010000,ThrustMaster eSwap PRO Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004f04000020b3000010010000,Thrustmaster 2 in 1 DT,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,",
+"030000004f04000015b3000001010000,Thrustmaster Dual Analog 3.2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,",
+"030000004f04000015b3000010010000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,",
+"030000004f04000023b3000000010000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,",
+"030000004f04000009d0000000010000,Thrustmaster Run N Drive Wireless PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000004f04000008d0000000010000,Thrustmaster Run N Drive Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000bd12000015d0000010010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,",
+"03000000d814000007cd000011010000,Toodles 2008 Chimp PC/PS3,a:b0,b:b1,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b3,y:b2,",
+"03000000100800000100000010010000,Twin USB PS2 Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
+"03000000100800000300000010010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
+"03000000790000000600000007010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,",
+"03000000790000001100000000010000,USB Gamepad1,a:b2,b:b1,back:b8,dpdown:a0,dpleft:a1,dpright:a2,dpup:a4,start:b9,",
+"05000000ac0500003232000001000000,VR-BOX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
+"030000006f0e00000302000011010000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000006f0e00000702000011010000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e040000a102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000450c00002043000010010000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"0000000058626f782033363020576900,Xbox 360 Wireless Controller,a:b0,b:b1,back:b14,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,guide:b7,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,",
+"030000005e040000a102000014010000,Xbox 360 Wireless Receiver (XBOX),a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
+"050000005e040000050b000002090000,Xbox One Elite Series 2,a:b0,b:b1,back:b136,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a6,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"050000005e040000050b000003090000,Xbox One Elite Series 2,a:b0,b:b1,back:b121,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"050000005e040000e302000002090000,Xbox One Elite,a:b0,b:b1,back:b136,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a6,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"030000005e040000ea02000000000000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e040000ea02000001030000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"050000005e040000130b000007050000,Xbox Series X Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"050000005e040000130b000011050000,Xbox Series X Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,",
+"03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,",
+"03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000666600006706000000010000,boom PSX to PC Converter,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,",
+"030000000d0f00000d00000000010000,hori,a:b0,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftx:b4,lefty:b5,rightshoulder:b7,start:b9,x:b1,y:b2,",
+"03000000830500006020000010010000,iBuffalo SNES Controller,a:b0,b:b1,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000006964726f69643a636f6e0000,idroid:con,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000b50700001503000010010000,impact,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,",
+"030000009b2800008000000020020000,raphnet technologies 1-player WUSBMote v2.2,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,leftshoulder:b6,rightshoulder:b7,start:b3,x:b0,y:b5,",
+"030000009b2800000300000001010000,raphnet.net 4nes4snes v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,",
+]
+elif compat_platform.startswith("darwin"):
+ mapping_list = [
+"03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000650000001000000,8BitDo M30 Gamepad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a5,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000650000001000000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a5,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00005106000000010000,8BitDo M30 Gamepad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00005106000000010000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001590000001000000,8BitDo N30 Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001590000001000000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00006528000000010000,8BitDo N30 Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00006528000000010000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000003512000012ab000001000000,8BitDo NES30 Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000003512000012ab000001000000,8BitDo NES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000022000000090000001000000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000022000000090000001000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000203800000900000000010000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000203800000900000000010000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000660000000020000,8BitDo Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000660000000020000,8BitDo Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000102800000900000000000000,8BitDo SFC30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000102800000900000000000000,8BitDo SFC30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001290000001000000,8BitDo SN30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001290000001000000,8BitDo SN30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000260000001000000,8BitDo SN30 Pro+,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000260000001000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000261000000010000,8BitDo SN30 Pro+,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000261000000010000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000160000001000000,8BitDo SN30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000160000001000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001130000000020000,8BitDo Ultimate Wired Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b26,paddle1:b24,paddle2:b25,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000c82d00001330000000020000,8BitDo Ultimate Wireless Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b26,paddle1:b23,paddle2:b19,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000c82d00001890000001000000,8BitDo Zero 2,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001890000001000000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00003032000000010000,8BitDo Zero 2,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00003032000000010000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000a00500003232000008010000,8BitDo Zero Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000a00500003232000008010000,8BitDo Zero Gamepad,a:b1,b:b2,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000a00500003232000009010000,8BitDo Zero Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000a00500003232000009010000,8BitDo Zero Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000050b00000579000000010000,ASUS ROG Kunai 3 Gamepad,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b14,leftshoulder:b6,leftstick:b15,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b42,paddle1:b9,paddle2:b11,rightshoulder:b7,rightstick:b16,righttrigger:a4,rightx:a2,righty:a3,start:b13,x:b3,y:b4,",
+"03000000050b00000679000000010000,ASUS ROG Kunai 3 Gamepad,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b14,leftshoulder:b6,leftstick:b15,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b23,rightshoulder:b7,rightstick:b16,righttrigger:a4,rightx:a2,righty:a3,start:b13,x:b3,y:b4,",
+"03000000491900001904000001010000,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,",
+"03000000710100001904000000010000,Amazon Luna Controller,a:b0,b:b1,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
+"03000000c62400001a89000000010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b14,leftshoulder:b6,leftstick:b15,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b16,righttrigger:a4,rightx:a2,righty:a3,start:b13,x:b3,y:b4,",
+"03000000c62400001b89000000010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000d62000002a79000000010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,",
+"03000000a306000022f6000001030000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,",
+"030000000d0f00008400000000010000,Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00008500000000010000,Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000151900004000000001000000,Flydigi Vader 2,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000b40400001124000000000000,Flydigi Vader 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b12,lefttrigger:b8,leftx:a0,lefty:a1,paddle1:b4,paddle2:b5,paddle3:b17,rightshoulder:b7,rightstick:b13,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b2,y:b3,",
+"03000000790000000600000000000000,G-Shark GS-GP702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000ac0500001a06000002020000,GameSir-T3 2.02,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000c01100000140000000010000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000ad1b000001f9000000000000,Gamestop BB-070 X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+"03000000d11800000094000000010000,Google Stadia Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
+"030000000d0f00005f00000000000000,HORI Fighting Commander 4 PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00005e00000000000000,HORI Fighting Commander 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00008800000000010000,HORI Fighting Stick mini 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000000d0f00008700000000010000,HORI Fighting Stick mini 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000000d0f00004d00000000000000,HORI Gem Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f0000aa00000072050000,HORI Real Arcade Pro,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"030000000d0f00006e00000000010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00006600000000010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00006600000000000000,HORIPAD FPS PLUS 4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00005f00000000010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00005e00000000010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000008f0e00001330000011010000,HuiJia SNES Controller,a:b4,b:b2,back:b16,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b12,rightshoulder:b14,start:b18,x:b6,y:b0,",
+"030000006d04000016c2000000020000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d04000016c2000000030000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d04000016c2000014040000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d04000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d04000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d0400001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+"030000006d04000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000d8140000cecf000000000000,MC Cthulhu,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"03000000c62400002a89000000010000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b21,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000c62400002b89000000010000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000380700005032000000010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000380700005082000000010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000380700008433000000010000,Mad Catz FightStick TE S+ (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000380700008483000000010000,Mad Catz FightStick TE S+ (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000790000004418000000010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
+"0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,",
+"03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b4,b:b8,back:b32,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b16,leftstick:b40,lefttrigger:b24,leftx:a0,lefty:a4,rightshoulder:b20,rightstick:b44,righttrigger:b28,rightx:a8,righty:a12,start:b36,x:b0,y:b12,",
+"030000001008000001e5000006010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,",
+"03000000550900001472000025050000,NVIDIA Controller v01.04,a:b0,b:b1,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b4,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,",
+"030000004b120000014d000000010000,NYKO AIRFLO EX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
+"030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"050000007e05000009200000ff070000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"050000007e05000009200000ff070000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000006f0e00000901000002010000,PDP Versus Fighting Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
+"030000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,",
+"030000004c050000a00b000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"050000004c050000e60c000000010000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
+"03000000222c00000225000000010000,Qanba Dragon Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000008916000000fd000000000000,Razer Onza TE,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+"03000000321500000204000000010000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000321500000104000000010000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000321500000010000000010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000321500000507000001010000,Razer Raiju Mobile,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b21,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000321500000011000000010000,Razer Raion Fightpad for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000321500000009000000020000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
+"0300000032150000030a000000000000,Razer Wildcat,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+"03000000790000001100000000000000,Retrolink Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a3,lefty:a4,rightshoulder:b5,start:b9,x:b3,y:b0,",
+"03000000790000001100000006010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,",
+"030000006b140000130d000000010000,Revolution Pro Controller 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000006b140000010d000000010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000003512000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,",
+"03000000457500002211000000010000,SZMY-POWER PC Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000b40400000a01000000000000,Sega Saturn USB Gamepad,a:b0,b:b1,back:b5,guide:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,x:b3,y:b4,",
+"03000000811700007e05000000000000,Sega Saturn,a:b2,b:b4,dpdown:b16,dpleft:b15,dpright:b14,dpup:b17,leftshoulder:b8,lefttrigger:a5,leftx:a0,lefty:a2,rightshoulder:b9,righttrigger:a4,start:b13,x:b0,y:b6,",
+"030000004c050000cc09000000000000,Sony DualShock 4 V2,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004c050000a00b000000000000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000005e0400008e02000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+"050000004e696d6275732b0000000000,SteelSeries Nimbus+,a:b0,b:b1,back:b15,dpdown:b11,dpleft:b13,dpright:b12,dpup:b10,guide:b16,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3~,start:b14,x:b2,y:b3,",
+"03000000110100002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,",
+"03000000110100002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,",
+"03000000381000002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,",
+"03000000110100001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,",
+"03000000110100001714000020010000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,",
+"030000004f0400000ed0000000020000,ThrustMaster eSwap PRO Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004f04000015b3000000000000,Thrustmaster Dual Analog 3.2,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,",
+"030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,",
+"03000000bd12000015d0000000000000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,",
+"03000000bd12000015d0000000010000,Tomee SNES USB Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,",
+"03000000100800000100000000000000,Twin USB Joystick,a:b4,b:b2,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b12,leftstick:b20,lefttrigger:b8,leftx:a0,lefty:a2,rightshoulder:b14,rightstick:b22,righttrigger:b10,rightx:a6,righty:a4,start:b18,x:b6,y:b0,",
+"030000006f0e00000302000025040000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000006f0e00000702000003060000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,back:b7,dpdown:b3,dpleft:b0,dpright:b1,dpup:b2,guide:b8,leftshoulder:b11,lefttrigger:b12,leftx:a0,lefty:a1,start:b6,x:b10,y:b9,",
+"050000005769696d6f74652028313800,Wii U Pro Controller,a:b16,b:b15,back:b7,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b8,leftshoulder:b19,leftstick:b23,lefttrigger:b21,leftx:a0,lefty:a1,rightshoulder:b20,rightstick:b24,righttrigger:b22,rightx:a2,righty:a3,start:b6,x:b18,y:b17,",
+"030000005e0400008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+"03000000c6240000045d000000000000,Xbox 360 Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+"030000005e040000050b000003090000,Xbox Elite Wireless Controller,a:b0,b:b1,back:b38,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"030000005e040000d102000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+"030000005e040000dd02000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+"030000005e040000e302000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+"030000005e040000200b000011050000,Xbox Wireless Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"030000005e040000e002000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e040000e002000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000005e040000ea02000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,",
+"030000005e040000fd02000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,",
+"03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000120c0000101e000000010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000830500006020000000010000,iBuffalo SNES Controller,a:b0,b:b1,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,",
+]
+elif compat_platform.startswith("win"):
+ mapping_list = [
+"03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,",
+"03000000c82d00000090000000000000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000090000000000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001038000000000000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001038000000000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000650000000000000,8BitDo M30 Gamepad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000650000000000000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00005106000000000000,8BitDo M30 Gamepad,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00005106000000000000,8BitDo M30 Gamepad,a:b1,b:b0,back:b10,guide:b2,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001590000000000000,8BitDo N30 Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001590000000000000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00006528000000000000,8BitDo N30 Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00006528000000000000,8BitDo N30 Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000003512000012ab000000000000,8BitDo NES30 Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000003512000012ab000000000000,8BitDo NES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000022000000090000000000000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000022000000090000000000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000203800000900000000000000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000203800000900000000000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00002038000000000000,8BitDo NES30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00002038000000000000,8BitDo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000660000000000000,8BitDo Pro 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000660000000000000,8BitDo Pro 2,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000060000000000000,8BitDo SF30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000060000000000000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000061000000000000,8BitDo SF30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000061000000000000,8BitDo SF30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000102800000900000000000000,8BitDo SFC30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000102800000900000000000000,8BitDo SFC30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001290000000000000,8BitDo SN30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001290000000000000,8BitDo SN30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00006228000000000000,8BitDo SN30 Gamepad,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00006228000000000000,8BitDo SN30 Gamepad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000260000000000000,8BitDo SN30 Pro+,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000260000000000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000261000000000000,8BitDo SN30 Pro+,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000261000000000000,8BitDo SN30 Pro+,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000160000000000000,8BitDo SN30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00000160000000000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000003512000020ab000000000000,8BitDo SNES30 Gamepad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000003512000020ab000000000000,8BitDo SNES30 Gamepad,a:b1,b:b0,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001130000000000000,8BitDo Ultimate Wired Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,misc1:b26,paddle1:b24,paddle2:b25,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000c82d00001330000000000000,8BitDo Ultimate Wireless Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,misc1:b26,paddle1:b23,paddle2:b19,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000c82d00001890000000000000,8BitDo Zero 2,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00001890000000000000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00003032000000000000,8BitDo Zero 2,a:b0,b:b1,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000c82d00003032000000000000,8BitDo Zero 2,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000a00500003232000000000000,8BitDo Zero Gamepad,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000a00500003232000000000000,8BitDo Zero Gamepad,a:b1,b:b0,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000050b00000579000000000000,ASUS ROG Kunai 3 Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000050b00000679000000000000,ASUS ROG Kunai 3 Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,misc1:b15,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"030000008f0e00001200000000000000,Acme GA-02,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
+"03000000fa190000f0ff000000000000,Acteck AGJ-3200,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000341a00003608000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006f0e00000263000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006f0e00001101000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006f0e00001401000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006f0e00001402000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006f0e00001901000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006f0e00001a01000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000d62000001d57000000000000,Airflo PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000491900001904000000000000,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,",
+"03000000d62000002a79000000000000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000d81d00000b00000000000000,BUFFALO BSGP1601 Series ,a:b5,b:b3,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b13,x:b4,y:b2,",
+"03000000d6200000e557000000000000,Batarang,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000c01100001352000000000000,Battalife Joystick,a:b6,b:b7,back:b2,leftshoulder:b0,leftx:a0,lefty:a1,rightshoulder:b1,start:b3,x:b4,y:b5,",
+"030000006f0e00003201000000000000,Battlefield 4 PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000bc2000006012000000000000,Betop 2126F,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000bc2000000055000000000000,Betop BFM Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000bc2000006312000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000bc2000006412000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000c01100000555000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000c01100000655000000000000,Betop Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000790000000700000000000000,Betop Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,",
+"03000000808300000300000000000000,Betop Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,",
+"030000006b1400000055000000000000,Bigben PS3 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"030000006b1400000103000000000000,Bigben PS3 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,",
+"0300000066f700000500000000000000,BrutalLegendTest,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,",
+"03000000e82000006058000000000000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000260900008888000000000000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a4,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,",
+"03000000a306000022f6000000000000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,",
+"03000000451300000830000000000000,Defender Game Racer X7,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000791d00000103000000000000,Dual Box WII,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000bd12000002e0000000000000,Dual USB Vibration Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,",
+"030000006f0e00003001000000000000,EA SPORTS PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000341a00000108000000000000,EXEQ RF USB Gamepad 8206,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"030000008f0e00000f31000000000000,EXEQ,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,",
+"03000000b80500000410000000000000,Elecom Gamepad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,",
+"03000000b80500000610000000000000,Elecom Gamepad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,",
+"03000000852100000201000000000000,FF-GP1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00002700000000000000,FIGHTING STICK V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"03000000151900004000000000000000,Flydigi Vader 2,a:b11,b:b10,back:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b7,leftstick:b1,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b0,righttrigger:b4,rightx:a3,righty:a4,start:b2,x:b9,y:b8,",
+"03000000b40400001124000000000000,Flydigi Vader 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b12,lefttrigger:b8,leftx:a0,lefty:a1,paddle1:b4,paddle2:b5,paddle4:b17,rightshoulder:b7,rightstick:b13,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b2,y:b3,",
+"03000000790000000600000000000000,G-Shark GS-GP702,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"030000008f0e00000d31000000000000,GAMEPAD 3 TURBO,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000300f00000b01000000000000,GGE909 Recoil Pad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
+"03000000790000002201000000000000,Game Controller for PC,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"0300000066f700000100000000000000,Game VIB Joystick,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,start:b11,x:b0,y:b1,",
+"03000000491900000204000000000000,GameSir T4 Pro,crc:1aa4,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000ac0500003d03000000000000,GameSir,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000ac0500004d04000000000000,GameSir,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000ac0500001a06000000000000,GameSir-T3 2.02,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000ffff00000000000000000000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000c01100000140000000000000,GameStop PS4 Fun Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000260900002625000000000000,Gamecube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,lefttrigger:a4,leftx:a0,lefty:a1,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
+"03000000280400000140000000000000,Gamepad Pro USB,a:b1,b:b2,back:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000005c1a00003330000000000000,Genius MaxFire Grandias 12V,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
+"030000008305000031b0000000000000,Genius Maxfire Blaze 3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000451300000010000000000000,Genius Maxfire Grandias 12,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"030000008305000009a0000000000000,Genius,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000f025000021c1000000000000,Gioteck PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000f0250000c383000000000000,Gioteck VX2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000f0250000c483000000000000,Gioteck VX2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000f0250000c283000000000000,Gioteck,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000d11800000094000000000000,Google Stadia Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b11,rightx:a3,righty:a4,start:b9,x:b2,y:b3,",
+"03000000632500002605000000000000,HJD-X,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"030000000d0f00008400000000000000,HORI Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00008500000000000000,HORI Fighting Commander,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00008800000000000000,HORI Fighting Stick mini 4 (PS3),a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,",
+"030000000d0f00008700000000000000,HORI Fighting Stick mini 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000000d0f00006e00000000000000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00006600000000000000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f0000ee00000000000000,HORIPAD mini4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000250900000017000000000000,HRAP2 on PS/SS/N64 Joypad to USB BOX,a:b2,b:b1,back:b9,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b8,x:b3,y:b0,",
+"03000000341a00000302000000000000,Hama Scorpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00004900000000000000,Hatsune Miku Sho Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000d81400000862000000000000,HitBox Edition Cthulhu+,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,",
+"030000000d0f00005f00000000000000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00005e00000000000000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00004000000000000000,Hori Fighting Stick Mini 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b4,rightshoulder:b7,righttrigger:b6,start:b9,x:b0,y:b3,",
+"030000000d0f00000900000000000000,Hori Pad 3 Turbo,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00005400000000000000,Hori Pad 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00004d00000000000000,Hori Pad A,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f0000c100000000000000,Horipad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000008f0e00001330000000000000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,",
+"030000006f0e00002401000000000000,INJUSTICE FightStick PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"03000000ac0500002c02000000000000,IPEGA,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b13,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b14,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000b50700001403000000000000,Impact Black,a:b2,b:b3,back:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,",
+"03000000491900000204000000000000,Ipega PG-9023,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"030000006e0500000520000000000000,JC-P301U,a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,",
+"030000006e0500000320000000000000,JC-U3613M (DInput),a:b2,b:b3,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,start:b11,x:b0,y:b1,",
+"030000006e0500000720000000000000,JC-W01U,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,",
+"03000000790000000200000000000000,King PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,",
+"030000006d040000d1ca000000000000,Logitech ChillStream,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d040000d2ca000000000000,Logitech Cordless Precision,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d04000011c2000000000000,Logitech Cordless Wingman,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b5,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b2,righttrigger:b7,rightx:a3,righty:a4,x:b4,",
+"030000006d04000016c2000000000000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d04000018c2000000000000,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d04000019c2000000000000,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006d0400001ac2000000000000,Logitech Precision Gamepad,a:b1,b:b2,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"03000000380700008081000000000000,MADCATZ SFV Arcade FightStick Alpha PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000380700006382000000000000,MLG Gamepad PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000c62400002a89000000000000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000c62400002b89000000000000,MOGA XP5-A Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000c62400001a89000000000000,MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000c62400001b89000000000000,MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000250900006688000000000000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,",
+"03000000380700006652000000000000,Mad Catz C.T.R.L.R,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,",
+"03000000380700005032000000000000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000380700005082000000000000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000380700008433000000000000,Mad Catz FightStick TE S+ (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000380700008483000000000000,Mad Catz FightStick TE S+ (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000380700008134000000000000,Mad Catz FightStick TE2+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b7,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b4,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000380700008184000000000000,Mad Catz FightStick TE2+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,leftstick:b10,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b4,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000380700006252000000000000,Mad Catz Micro C.T.R.L.R,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,",
+"03000000380700008034000000000000,Mad Catz TE2 PS3 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000380700008084000000000000,Mad Catz TE2 PS4 Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000380700001888000000000000,MadCatz SFIV FightStick PS3,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b5,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,righttrigger:b6,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000380700008532000000000000,Madcatz Arcade Fightstick TE S PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000380700003888000000000000,Madcatz Arcade Fightstick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000002a0600001024000000000000,Matricom,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b2,y:b3,",
+"03000000250900000128000000000000,Mayflash Arcade Stick,a:b1,b:b2,back:b8,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b5,y:b6,",
+"03000000790000004418000000000000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
+"030000008f0e00001030000000000000,Mayflash USB Adapter for original Sega Saturn controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b5,rightshoulder:b2,righttrigger:b7,start:b9,x:b3,y:b4,",
+"0300000025090000e803000000000000,Mayflash Wii Classic Controller,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,",
+"03000000790000000018000000000000,Mayflash WiiU Pro Game Controller Adapter (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000efbe0000edfe000000000000,Monect Virtual Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b0,",
+"030000006b140000010c000000000000,NACON GC-400ES,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"030000001008000001e5000000000000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,",
+"03000000152000000182000000000000,NGDS,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,",
+"030000005509000000b4000000000000,NVIDIA Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000004b120000014d000000000000,NYKO AIRFLO EX,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,",
+"03000000790000004318000000000000,Nintendo GameCube Controller,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000790000004318000000000000,Nintendo GameCube Controller,a:b1,b:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000bd12000015d0000000000000,Nintendo Retrolink USB Super SNES Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,",
+"030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000000d0500000308000000000000,Nostromo N45,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,",
+"03000000d62000006d57000000000000,OPP PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000362800000100000000000000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,x:b1,y:b2,",
+"03000000782300000a10000000000000,Onlive Wireless Controller,a:b15,b:b14,back:b7,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b11,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b13,y:b12,",
+"030000006b14000001a1000000000000,Orange Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b2,y:b3,",
+"03000000120c0000f60e000000000000,P4 Wired Gamepad,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b7,rightshoulder:b4,righttrigger:b6,start:b9,x:b0,y:b3,",
+"030000006f0e00000901000000000000,PDP Versus Fighting Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"03000000632500002306000000000000,PS Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
+"03000000e30500009605000000000000,PS to USB convert cable,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,",
+"03000000100800000100000000000000,PS1 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
+"030000008f0e00007530000000000000,PS1 Controller,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b1,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000100800000300000000000000,PS2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,",
+"03000000250900008888000000000000,PS2 Controller,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,",
+"03000000666600006706000000000000,PS2 Controller,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,",
+"030000006b1400000303000000000000,PS2 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"030000009d0d00001330000000000000,PS2 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000250900000500000000000000,PS3 Controller,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,",
+"030000004c0500006802000000000000,PS3 Controller,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b10,lefttrigger:a3~,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:a4~,rightx:a2,righty:a5,start:b8,x:b3,y:b0,",
+"03000000632500007505000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000888800000803000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,",
+"030000008f0e00001431000000000000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000003807000056a8000000000000,PS3 RF pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000100000008200000000000000,PS360+ v1.66,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:h0.4,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000004c050000a00b000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,touchpad:b13,x:b0,y:b3,",
+"030000004c050000cc09000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004c050000e60c000000000000,PS5 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000008f0e00000300000000000000,Piranha xtreme,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
+"03000000d62000006dca000000000000,PowerA Pro Ex,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000d62000009557000000000000,Pro Elite PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000d62000009f31000000000000,Pro Ex mini PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000d6200000c757000000000000,Pro Ex mini PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000222c00000020000000000000,QANBA DRONE ARCADE JOYSTICK,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,",
+"03000000300f00000011000000000000,QanBa Arcade JoyStick 1008,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b10,x:b0,y:b3,",
+"03000000300f00001611000000000000,QanBa Arcade JoyStick 4018,a:b1,b:b2,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b8,x:b0,y:b3,",
+"03000000300f00001210000000000000,QanBa Joystick Plus,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b2,y:b3,",
+"03000000341a00000104000000000000,QanBa Joystick Q4RAF,a:b5,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b0,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b3,righttrigger:b7,start:b9,x:b1,y:b2,",
+"03000000222c00000025000000000000,Qanba Dragon Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000222c00000223000000000000,Qanba Obsidian Arcade Joystick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000222c00000023000000000000,Qanba Obsidian Arcade Joystick (PS4),a:b1,b:b2,back:b13,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00001100000000000000,REAL ARCADE PRO.3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000000d0f00007000000000000000,REAL ARCADE PRO.4 VLX,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000000d0f00002200000000000000,REAL ARCADE Pro.V3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000050b00005819000000000000,ROG Chakram Core,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,",
+"03000000050b0000181a000000000000,ROG Chakram X,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,",
+"03000000050b00001a1a000000000000,ROG Chakram X,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,",
+"03000000050b00001c1a000000000000,ROG Chakram X,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,",
+"03000000050b0000e318000000000000,ROG Chakram,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,",
+"03000000050b0000e518000000000000,ROG Chakram,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,",
+"03000000321500000003000000000000,Razer Hydra,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000321500000204000000000000,Razer Panthera (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000321500000104000000000000,Razer Panthera (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000321500000507000000000000,Razer Raiju Mobile,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000321500000707000000000000,Razer Raiju Mobile,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000321500000011000000000000,Razer Raion Fightpad for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000321500000009000000000000,Razer Serval,+lefty:+a2,-lefty:-a1,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,leftx:a0,rightshoulder:b5,rightstick:b9,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"030000000d0f00006a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00006b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00008a00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00008b00000000000000,Real Arcade Pro.4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000000d0f00005b00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000000d0f00005c00000000000000,Real Arcade Pro.V4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"0300000000f000000300000000000000,RetroUSB.com RetroPad,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,",
+"0300000000f00000f100000000000000,RetroUSB.com Super RetroPort,a:b1,b:b5,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b0,y:b4,",
+"03000000790000001100000000000000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,",
+"030000006b140000130d000000000000,Revolution Pro Controller 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000006b140000010d000000000000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000006f0e00001e01000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006f0e00002801000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000006f0e00002f01000000000000,Rock Candy PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000341a00000208000000000000,SL-6555-SBK,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:-a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a3,righty:a2,start:b7,x:b2,y:b3,",
+"03000000341a00000908000000000000,SL-6566,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000790000001c18000000000000,STK-7024X,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000ff1100003133000000000000,SVEN X-PAD,a:b2,b:b3,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a4,start:b5,x:b0,y:b1,",
+"03000000457500002211000000000000,SZMY-POWER PC Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000a306000023f6000000000000,Saitek Cyborg V.1 Game pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,",
+"03000000a30600001af5000000000000,Saitek Cyborg,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b0,y:b3,",
+"03000000300f00001201000000000000,Saitek Dual Analog Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,",
+"03000000a30600000cff000000000000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,x:b0,y:b1,",
+"03000000a30600000c04000000000000,Saitek P2900,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,",
+"03000000300f00001001000000000000,Saitek P480 Rumble Pad,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,",
+"03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,",
+"03000000a30600000b04000000000000,Saitek P990,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,",
+"03000000a30600002106000000000000,Saitek PS1000,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,",
+"03000000a306000020f6000000000000,Saitek PS2700,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,",
+"03000000300f00001101000000000000,Saitek Rumble Pad,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,",
+"0300000000050000289b000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,",
+"030000009b2800000500000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,",
+"030000008f0e00000800000000000000,SpeedLink Strike FX,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000c01100000591000000000000,Speedlink Torid,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000de280000ff11000000000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
+"03000000110100003114000000000000,SteelSeries Stratus Duo,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000381000001814000000000000,SteelSeries Stratus XL,a:b0,b:b1,back:b18,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b19,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b2,y:b3,",
+"03000000110100001914000000000000,SteelSeries,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:,leftstick:b13,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:,rightstick:b14,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000d620000011a7000000000000,Switch,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000004f04000007d0000000000000,T Mini Wireless,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000fa1900000706000000000000,Team 5,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000b50700001203000000000000,Techmobility X6-38V,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,",
+"030000004f0400000ed0000000000000,ThrustMaster eSwap PRO Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004f04000015b3000000000000,Thrustmaster Dual Analog 4,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,",
+"030000004f04000023b3000000000000,Thrustmaster Dual Trigger 3-in-1,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"030000004f04000004b3000000000000,Thrustmaster Firestorm Dual Power 3,a:b0,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b1,y:b3,",
+"030000004f04000000b3000000000000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b11,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b10,x:b1,y:b3,",
+"03000000666600000488000000000000,TigerGame PS/PS2 Game Controller Adapter,a:b2,b:b1,back:b9,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,",
+"03000000d62000006000000000000000,Tournament PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"030000005f140000c501000000000000,Trust Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000b80500000210000000000000,Trust Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000d90400000200000000000000,TwinShock PS2,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
+"03000000300f00000701000000000000,USB 4-Axis 12-Button Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,",
+"03000000341a00002308000000000000,USB Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"030000006b1400000203000000000000,USB Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000790000000a00000000000000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,",
+"03000000f0250000c183000000000000,USB Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
+"03000000ff1100004133000000000000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a4,righty:a2,start:b9,x:b3,y:b0,",
+"03000000632500002305000000000000,USB Vibration Joystick (BM),a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000790000001b18000000000000,Venom Arcade Joystick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000006f0e00000302000000000000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"030000006f0e00000702000000000000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
+"03000000450c00002043000000000000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000341a00000608000000000000,Xeox,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+"03000000172700004431000000000000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a7,rightx:a2,righty:a5,start:b11,x:b3,y:b4,",
+"03000000790000004f18000000000000,ZD-T Android,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,",
+"03000000120c0000101e000000000000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000d81d00000f00000000000000,iBUFFALO BSGP1204 Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000d81d00001000000000000000,iBUFFALO BSGP1204P Series,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+"03000000830500006020000000000000,iBuffalo SNES Controller,a:b0,b:b1,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"03000000830500006020000000000000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
+"030000004f04000003d0000000000000,run'n'drive,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b7,leftshoulder:a3,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:a4,rightstick:b11,righttrigger:b5,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
+"03000000101c0000171c000000000000,uRage Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
+]
+else:
+ mapping_list = []
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..873d0ba4b72738b4b2541c4c49fea02313188061
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/__init__.py
@@ -0,0 +1,10 @@
+from .evdev import get_devices as evdev_get_devices
+from .evdev import get_joysticks
+from .evdev import get_controllers
+from .evdev import EvdevControllerManager as ControllerManager
+from .x11_xinput_tablet import get_tablets
+from .x11_xinput import get_devices as x11xinput_get_devices
+
+
+def get_devices(display=None):
+ return evdev_get_devices(display) + x11xinput_get_devices(display)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/evdev.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/evdev.py
new file mode 100644
index 0000000000000000000000000000000000000000..9b53b1f026612be34c2be41f5a45ae4d9e322cce
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/evdev.py
@@ -0,0 +1,655 @@
+import os
+import time
+import fcntl
+import ctypes
+import warnings
+
+from ctypes import c_uint16 as _u16
+from ctypes import c_int16 as _s16
+from ctypes import c_uint32 as _u32
+from ctypes import c_int32 as _s32
+from ctypes import c_int64 as _s64
+from concurrent.futures import ThreadPoolExecutor
+
+from typing import List
+
+import pyglet
+
+from .evdev_constants import *
+from pyglet.app.xlib import XlibSelectDevice
+from pyglet.input.base import Device, RelativeAxis, AbsoluteAxis, Button, Joystick, Controller
+from pyglet.input.base import DeviceOpenException, ControllerManager
+from pyglet.input.controller import get_mapping, Relation, create_guid
+
+_IOC_NRBITS = 8
+_IOC_TYPEBITS = 8
+_IOC_SIZEBITS = 14
+_IOC_DIRBITS = 2
+
+_IOC_NRSHIFT = 0
+_IOC_TYPESHIFT = (_IOC_NRSHIFT + _IOC_NRBITS)
+_IOC_SIZESHIFT = (_IOC_TYPESHIFT + _IOC_TYPEBITS)
+_IOC_DIRSHIFT = (_IOC_SIZESHIFT + _IOC_SIZEBITS)
+
+_IOC_NONE = 0
+_IOC_WRITE = 1
+_IOC_READ = 2
+
+
+def _IOC(dir, type, nr, size):
+ return ((dir << _IOC_DIRSHIFT) |
+ (type << _IOC_TYPESHIFT) |
+ (nr << _IOC_NRSHIFT) |
+ (size << _IOC_SIZESHIFT))
+
+
+def _IOR(type, nr, struct):
+ request = _IOC(_IOC_READ, ord(type), nr, ctypes.sizeof(struct))
+
+ def f(fileno):
+ buffer = struct()
+ fcntl.ioctl(fileno, request, buffer)
+ return buffer
+
+ return f
+
+
+def _IOR_len(type, nr):
+ def f(fileno, buffer):
+ request = _IOC(_IOC_READ, ord(type), nr, ctypes.sizeof(buffer))
+ fcntl.ioctl(fileno, request, buffer)
+ return buffer
+
+ return f
+
+
+def _IOR_str(type, nr):
+ g = _IOR_len(type, nr)
+
+ def f(fileno, length=256):
+ return g(fileno, ctypes.create_string_buffer(length)).value
+
+ return f
+
+
+def _IOW(type, nr):
+
+ def f(fileno, buffer):
+ request = _IOC(_IOC_WRITE, ord(type), nr, ctypes.sizeof(buffer))
+ fcntl.ioctl(fileno, request, buffer)
+
+ return f
+
+
+# Structures from /linux/blob/master/include/uapi/linux/input.h
+
+class Timeval(ctypes.Structure):
+ _fields_ = (
+ ('tv_sec', _s64),
+ ('tv_usec', _s64)
+ )
+
+
+class InputEvent(ctypes.Structure):
+ _fields_ = (
+ ('time', Timeval),
+ ('type', _u16),
+ ('code', _u16),
+ ('value', _s32)
+ )
+
+
+class InputID(ctypes.Structure):
+ _fields_ = (
+ ('bustype', _u16),
+ ('vendor', _u16),
+ ('product', _u16),
+ ('version', _u16),
+ )
+
+
+class InputABSInfo(ctypes.Structure):
+ _fields_ = (
+ ('value', _s32),
+ ('minimum', _s32),
+ ('maximum', _s32),
+ ('fuzz', _s32),
+ ('flat', _s32),
+ )
+
+
+class FFReplay(ctypes.Structure):
+ _fields_ = (
+ ('length', _u16),
+ ('delay', _u16)
+ )
+
+
+class FFTrigger(ctypes.Structure):
+ _fields_ = (
+ ('button', _u16),
+ ('interval', _u16)
+ )
+
+
+class FFEnvelope(ctypes.Structure):
+ _fields_ = [
+ ('attack_length', _u16),
+ ('attack_level', _u16),
+ ('fade_length', _u16),
+ ('fade_level', _u16),
+ ]
+
+
+class FFConstantEffect(ctypes.Structure):
+ _fields_ = [
+ ('level', _s16),
+ ('ff_envelope', FFEnvelope),
+ ]
+
+
+class FFRampEffect(ctypes.Structure):
+ _fields_ = [
+ ('start_level', _s16),
+ ('end_level', _s16),
+ ('ff_envelope', FFEnvelope),
+ ]
+
+
+class FFConditionEffect(ctypes.Structure):
+ _fields_ = [
+ ('right_saturation', _u16),
+ ('left_saturation', _u16),
+ ('right_coeff', _s16),
+ ('left_coeff', _s16),
+ ('deadband', _u16),
+ ('center', _s16),
+ ]
+
+
+class FFPeriodicEffect(ctypes.Structure):
+ _fields_ = [
+ ('waveform', _u16),
+ ('period', _u16),
+ ('magnitude', _s16),
+ ('offset', _s16),
+ ('phase', _u16),
+ ('envelope', FFEnvelope),
+ ('custom_len', _u32),
+ ('custom_data', ctypes.POINTER(_s16)),
+ ]
+
+
+class FFRumbleEffect(ctypes.Structure):
+ _fields_ = (
+ ('strong_magnitude', _u16),
+ ('weak_magnitude', _u16)
+ )
+
+
+class FFEffectType(ctypes.Union):
+ _fields_ = (
+ ('ff_constant_effect', FFConstantEffect),
+ ('ff_ramp_effect', FFRampEffect),
+ ('ff_periodic_effect', FFPeriodicEffect),
+ ('ff_condition_effect', FFConditionEffect * 2),
+ ('ff_rumble_effect', FFRumbleEffect),
+ )
+
+
+class FFEvent(ctypes.Structure):
+ _fields_ = (
+ ('type', _u16),
+ ('id', _s16),
+ ('direction', _u16),
+ ('ff_trigger', FFTrigger),
+ ('ff_replay', FFReplay),
+ ('u', FFEffectType)
+ )
+
+
+EVIOCGVERSION = _IOR('E', 0x01, ctypes.c_int)
+EVIOCGID = _IOR('E', 0x02, InputID)
+EVIOCGNAME = _IOR_str('E', 0x06)
+EVIOCGPHYS = _IOR_str('E', 0x07)
+EVIOCGUNIQ = _IOR_str('E', 0x08)
+EVIOCSFF = _IOW('E', 0x80)
+
+
+def EVIOCGBIT(fileno, ev, buffer):
+ return _IOR_len('E', 0x20 + ev)(fileno, buffer)
+
+
+def EVIOCGABS(fileno, abs):
+ buffer = InputABSInfo()
+ return _IOR_len('E', 0x40 + abs)(fileno, buffer)
+
+
+def get_set_bits(bytestring):
+ bits = set()
+ j = 0
+ for byte in bytestring:
+ for i in range(8):
+ if byte & 1:
+ bits.add(j + i)
+ byte >>= 1
+ j += 8
+ return bits
+
+
+_abs_names = {
+ ABS_X: AbsoluteAxis.X,
+ ABS_Y: AbsoluteAxis.Y,
+ ABS_Z: AbsoluteAxis.Z,
+ ABS_RX: AbsoluteAxis.RX,
+ ABS_RY: AbsoluteAxis.RY,
+ ABS_RZ: AbsoluteAxis.RZ,
+ ABS_HAT0X: AbsoluteAxis.HAT_X,
+ ABS_HAT0Y: AbsoluteAxis.HAT_Y,
+}
+
+_rel_names = {
+ REL_X: RelativeAxis.X,
+ REL_Y: RelativeAxis.Y,
+ REL_Z: RelativeAxis.Z,
+ REL_RX: RelativeAxis.RX,
+ REL_RY: RelativeAxis.RY,
+ REL_RZ: RelativeAxis.RZ,
+ REL_WHEEL: RelativeAxis.WHEEL,
+}
+
+
+def _create_control(fileno, event_type, event_code):
+ if event_type == EV_ABS:
+ raw_name = abs_raw_names.get(event_code, 'EV_ABS(%x)' % event_code)
+ name = _abs_names.get(event_code)
+ absinfo = EVIOCGABS(fileno, event_code)
+ value = absinfo.value
+ minimum = absinfo.minimum
+ maximum = absinfo.maximum
+ control = AbsoluteAxis(name, minimum, maximum, raw_name)
+ control.value = value
+ if name == 'hat_y':
+ control.inverted = True
+ elif event_type == EV_REL:
+ raw_name = rel_raw_names.get(event_code, 'EV_REL(%x)' % event_code)
+ name = _rel_names.get(event_code)
+ # TODO min/max?
+ control = RelativeAxis(name, raw_name)
+ elif event_type == EV_KEY:
+ raw_name = key_raw_names.get(event_code, 'EV_KEY(%x)' % event_code)
+ name = None
+ control = Button(name, raw_name)
+ else:
+ value = minimum = maximum = 0 # TODO
+ return None
+ control._event_type = event_type
+ control._event_code = event_code
+ return control
+
+
+event_types = {
+ EV_KEY: KEY_MAX,
+ EV_REL: REL_MAX,
+ EV_ABS: ABS_MAX,
+ EV_MSC: MSC_MAX,
+ EV_LED: LED_MAX,
+ EV_SND: SND_MAX,
+ EV_FF: FF_MAX,
+}
+
+
+class EvdevDevice(XlibSelectDevice, Device):
+ _fileno = None
+
+ def __init__(self, display, filename):
+ self._filename = filename
+
+ fileno = os.open(filename, os.O_RDONLY)
+ # event_version = EVIOCGVERSION(fileno).value
+
+ self._id = EVIOCGID(fileno)
+ self.id_bustype = self._id.bustype
+ self.id_vendor = hex(self._id.vendor)
+ self.id_product = hex(self._id.product)
+ self.id_version = self._id.version
+
+ name = EVIOCGNAME(fileno)
+ try:
+ name = name.decode('utf-8')
+ except UnicodeDecodeError:
+ try:
+ name = name.decode('latin-1')
+ except UnicodeDecodeError:
+ pass
+
+ try:
+ self.phys = EVIOCGPHYS(fileno)
+ except OSError:
+ self.phys = ''
+ try:
+ self.uniq = EVIOCGUNIQ(fileno)
+ except OSError:
+ self.uniq = ''
+
+ self.controls = []
+ self.control_map = {}
+ self.ff_types = []
+
+ event_types_bits = (ctypes.c_byte * 4)()
+ EVIOCGBIT(fileno, 0, event_types_bits)
+ for event_type in get_set_bits(event_types_bits):
+ if event_type not in event_types:
+ continue
+ max_code = event_types[event_type]
+ nbytes = max_code // 8 + 1
+ event_codes_bits = (ctypes.c_byte * nbytes)()
+ EVIOCGBIT(fileno, event_type, event_codes_bits)
+ if event_type == EV_FF:
+ self.ff_types.extend(get_set_bits(event_codes_bits))
+ else:
+ for event_code in get_set_bits(event_codes_bits):
+ control = _create_control(fileno, event_type, event_code)
+ if control:
+ self.control_map[(event_type, event_code)] = control
+ self.controls.append(control)
+
+ self.controls.sort(key=lambda c: c._event_code)
+ os.close(fileno)
+
+ super().__init__(display, name)
+
+ def get_guid(self):
+ """Get the device's SDL2 style GUID string"""
+ _id = self._id
+ return create_guid(_id.bustype, _id.vendor, _id.product, _id.version, self.name, 0, 0)
+
+ def open(self, window=None, exclusive=False):
+ super().open(window, exclusive)
+
+ try:
+ self._fileno = os.open(self._filename, os.O_RDWR | os.O_NONBLOCK)
+ except OSError as e:
+ raise DeviceOpenException(e)
+
+ pyglet.app.platform_event_loop.select_devices.add(self)
+
+ def close(self):
+ super().close()
+
+ if not self._fileno:
+ return
+
+ pyglet.app.platform_event_loop.select_devices.remove(self)
+ os.close(self._fileno)
+ self._fileno = None
+
+ def get_controls(self):
+ return self.controls
+
+ # Force Feedback methods
+
+ def ff_upload_effect(self, structure):
+ os.write(self._fileno, structure)
+
+ # XlibSelectDevice interface
+
+ def fileno(self):
+ return self._fileno
+
+ def poll(self):
+ return False
+
+ def select(self):
+ if not self._fileno:
+ return
+
+ try:
+ events = (InputEvent * 64)()
+ bytes_read = os.readv(self._fileno, events)
+ except OSError:
+ self.close()
+ return
+
+ n_events = bytes_read // ctypes.sizeof(InputEvent)
+ for event in events[:n_events]:
+ try:
+ control = self.control_map[(event.type, event.code)]
+ control.value = event.value
+ except KeyError:
+ pass
+
+
+class FFController(Controller):
+ """Controller that supports force-feedback"""
+ _fileno = None
+ _weak_effect = None
+ _play_weak_event = None
+ _stop_weak_event = None
+ _strong_effect = None
+ _play_strong_event = None
+ _stop_strong_event = None
+
+ def open(self, window=None, exclusive=False):
+ super().open(window, exclusive)
+ self._fileno = self.device.fileno()
+ # Create Force Feedback effects & events when opened:
+ # https://www.kernel.org/doc/html/latest/input/ff.html
+ self._weak_effect = FFEvent(FF_RUMBLE, -1)
+ EVIOCSFF(self._fileno, self._weak_effect)
+ self._play_weak_event = InputEvent(Timeval(), EV_FF, self._weak_effect.id, 1)
+ self._stop_weak_event = InputEvent(Timeval(), EV_FF, self._weak_effect.id, 0)
+
+ self._strong_effect = FFEvent(FF_RUMBLE, -1)
+ EVIOCSFF(self._fileno, self._strong_effect)
+ self._play_strong_event = InputEvent(Timeval(), EV_FF, self._strong_effect.id, 1)
+ self._stop_strong_event = InputEvent(Timeval(), EV_FF, self._strong_effect.id, 0)
+
+ def rumble_play_weak(self, strength=1.0, duration=0.5):
+ effect = self._weak_effect
+ effect.u.ff_rumble_effect.weak_magnitude = int(max(min(1.0, strength), 0) * 0xFFFF)
+ effect.ff_replay.length = int(duration * 1000)
+ EVIOCSFF(self._fileno, effect)
+ self.device.ff_upload_effect(self._play_weak_event)
+
+ def rumble_play_strong(self, strength=1.0, duration=0.5):
+ effect = self._strong_effect
+ effect.u.ff_rumble_effect.strong_magnitude = int(max(min(1.0, strength), 0) * 0xFFFF)
+ effect.ff_replay.length = int(duration * 1000)
+ EVIOCSFF(self._fileno, effect)
+ self.device.ff_upload_effect(self._play_strong_event)
+
+ def rumble_stop_weak(self):
+ self.device.ff_upload_effect(self._stop_weak_event)
+
+ def rumble_stop_strong(self):
+ self.device.ff_upload_effect(self._stop_strong_event)
+
+
+class EvdevControllerManager(ControllerManager, XlibSelectDevice):
+
+ def __init__(self, display=None):
+ super().__init__()
+ self._display = display
+ self._devices_file = open('/proc/bus/input/devices')
+ self._device_names = self._get_device_names()
+ self._controllers = {}
+ self._thread_pool = ThreadPoolExecutor(max_workers=1)
+
+ for name in self._device_names:
+ path = os.path.join('/dev/input', name)
+ try:
+ device = EvdevDevice(self._display, path)
+ except OSError:
+ continue
+ controller = _create_controller(device)
+ if controller:
+ self._controllers[name] = controller
+
+ pyglet.app.platform_event_loop.select_devices.add(self)
+
+ def __del__(self):
+ self._devices_file.close()
+
+ def fileno(self):
+ """Allow this class to be Selectable"""
+ return self._devices_file.fileno()
+
+ @staticmethod
+ def _get_device_names():
+ return {name for name in os.listdir('/dev/input') if name.startswith('event')}
+
+ def _make_device_callback(self, future):
+ name, device = future.result()
+ if not device:
+ return
+
+ if name in self._controllers:
+ controller = self._controllers.get(name)
+ else:
+ controller = _create_controller(device)
+ self._controllers[name] = controller
+
+ if controller:
+ # Dispatch event in main thread:
+ pyglet.app.platform_event_loop.post_event(self, 'on_connect', controller)
+
+ def _make_device(self, name, count=1):
+ path = os.path.join('/dev/input', name)
+ while count > 0:
+ try:
+ return name, EvdevDevice(self._display, path)
+ except OSError:
+ if count > 0:
+ time.sleep(0.1)
+ count -= 1
+ return None, None
+
+ def select(self):
+ """Triggered whenever the devices_file changes."""
+ new_device_files = self._get_device_names()
+ appeared = new_device_files - self._device_names
+ disappeared = self._device_names - new_device_files
+ self._device_names = new_device_files
+
+ for name in appeared:
+ future = self._thread_pool.submit(self._make_device, name, count=10)
+ future.add_done_callback(self._make_device_callback)
+
+ for name in disappeared:
+ controller = self._controllers.get(name)
+ if controller:
+ self.dispatch_event('on_disconnect', controller)
+
+ def get_controllers(self) -> List[Controller]:
+ return list(self._controllers.values())
+
+
+def get_devices(display=None):
+ _devices = {}
+ base = '/dev/input'
+ for filename in os.listdir(base):
+ if filename.startswith('event'):
+ path = os.path.join(base, filename)
+ if path in _devices:
+ continue
+
+ try:
+ _devices[path] = EvdevDevice(display, path)
+ except OSError:
+ pass
+
+ return list(_devices.values())
+
+
+def _create_joystick(device):
+ # Look for something with an ABS X and ABS Y axis, and a joystick 0 button
+ have_x = False
+ have_y = False
+ have_button = False
+ for control in device.controls:
+ if control._event_type == EV_ABS and control._event_code == ABS_X:
+ have_x = True
+ elif control._event_type == EV_ABS and control._event_code == ABS_Y:
+ have_y = True
+ elif control._event_type == EV_KEY and control._event_code in (BTN_JOYSTICK, BTN_GAMEPAD):
+ have_button = True
+ if not (have_x and have_y and have_button):
+ return
+
+ return Joystick(device)
+
+
+def get_joysticks(display=None):
+ return [joystick for joystick in
+ [_create_joystick(device) for device in get_devices(display)]
+ if joystick is not None]
+
+
+def _detect_controller_mapping(device):
+ # If no explicit mapping is available, we can
+ # detect it from the Linux gamepad specification:
+ # https://www.kernel.org/doc/html/v4.13/input/gamepad.html
+ # Note: legacy device drivers don't always adhere to this.
+ mapping = dict(guid=device.get_guid(), name=device.name)
+
+ _aliases = {BTN_MODE: 'guide', BTN_SELECT: 'back', BTN_START: 'start',
+ BTN_SOUTH: 'a', BTN_EAST: 'b', BTN_WEST: 'x', BTN_NORTH: 'y',
+ BTN_TL: 'leftshoulder', BTN_TR: 'rightshoulder',
+ BTN_TL2: 'lefttrigger', BTN_TR2: 'righttrigger',
+ BTN_THUMBL: 'leftstick', BTN_THUMBR: 'rightstick',
+ BTN_DPAD_UP: 'dpup', BTN_DPAD_DOWN: 'dpdown',
+ BTN_DPAD_LEFT: 'dpleft', BTN_DPAD_RIGHT: 'dpright',
+
+ ABS_HAT0X: 'dpleft', # 'dpright',
+ ABS_HAT0Y: 'dpup', # 'dpdown',
+ ABS_Z: 'lefttrigger', ABS_RZ: 'righttrigger',
+ ABS_X: 'leftx', ABS_Y: 'lefty', ABS_RX: 'rightx', ABS_RY: 'righty'}
+
+ button_controls = [control for control in device.controls if isinstance(control, Button)]
+ axis_controls = [control for control in device.controls if isinstance(control, AbsoluteAxis)]
+ hat_controls = [control for control in device.controls if control.name in ('hat_x', 'hat_y')]
+
+ for i, control in enumerate(button_controls):
+ name = _aliases.get(control._event_code)
+ if name:
+ mapping[name] = Relation('button', i)
+
+ for i, control in enumerate(axis_controls):
+ name = _aliases.get(control._event_code)
+ if name:
+ mapping[name] = Relation('axis', i)
+
+ for i, control in enumerate(hat_controls):
+ name = _aliases.get(control._event_code)
+ if name:
+ index = 1 + i << 1
+ mapping[name] = Relation('hat0', index)
+
+ return mapping
+
+
+def _create_controller(device):
+ for control in device.controls:
+ if control._event_type == EV_KEY and control._event_code == BTN_GAMEPAD:
+ break
+ else:
+ return None # Game Controllers must have a BTN_GAMEPAD
+
+ mapping = get_mapping(device.get_guid())
+ if not mapping:
+ warnings.warn(f"Warning: {device} (GUID: {device.get_guid()}) "
+ f"has no controller mappings. Update the mappings in the Controller DB.\n"
+ f"Auto-detecting as defined by the 'Linux gamepad specification'")
+ mapping = _detect_controller_mapping(device)
+
+ if FF_RUMBLE in device.ff_types:
+ return FFController(device, mapping)
+ else:
+ return Controller(device, mapping)
+
+
+def get_controllers(display=None):
+ return [controller for controller in
+ [_create_controller(device) for device in get_devices(display)]
+ if controller is not None]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/evdev_constants.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/evdev_constants.py
new file mode 100644
index 0000000000000000000000000000000000000000..a8a2a6d1988ded60a8050d335b8886fb8257d211
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/evdev_constants.py
@@ -0,0 +1,588 @@
+"""Event constants from /usr/include/linux/input.h """
+
+EV_SYN = 0x00
+EV_KEY = 0x01
+EV_REL = 0x02
+EV_ABS = 0x03
+EV_MSC = 0x04
+EV_LED = 0x11
+EV_SND = 0x12
+EV_REP = 0x14
+EV_FF = 0x15
+EV_PWR = 0x16
+EV_FF_STATUS = 0x17
+EV_MAX = 0x1f
+
+# Synchronization events.
+
+SYN_REPORT = 0
+SYN_CONFIG = 1
+
+# Keys and buttons
+
+KEY_RESERVED = 0
+KEY_ESC = 1
+KEY_1 = 2
+KEY_2 = 3
+KEY_3 = 4
+KEY_4 = 5
+KEY_5 = 6
+KEY_6 = 7
+KEY_7 = 8
+KEY_8 = 9
+KEY_9 = 10
+KEY_0 = 11
+KEY_MINUS = 12
+KEY_EQUAL = 13
+KEY_BACKSPACE = 14
+KEY_TAB = 15
+KEY_Q = 16
+KEY_W = 17
+KEY_E = 18
+KEY_R = 19
+KEY_T = 20
+KEY_Y = 21
+KEY_U = 22
+KEY_I = 23
+KEY_O = 24
+KEY_P = 25
+KEY_LEFTBRACE = 26
+KEY_RIGHTBRACE = 27
+KEY_ENTER = 28
+KEY_LEFTCTRL = 29
+KEY_A = 30
+KEY_S = 31
+KEY_D = 32
+KEY_F = 33
+KEY_G = 34
+KEY_H = 35
+KEY_J = 36
+KEY_K = 37
+KEY_L = 38
+KEY_SEMICOLON = 39
+KEY_APOSTROPHE = 40
+KEY_GRAVE = 41
+KEY_LEFTSHIFT = 42
+KEY_BACKSLASH = 43
+KEY_Z = 44
+KEY_X = 45
+KEY_C = 46
+KEY_V = 47
+KEY_B = 48
+KEY_N = 49
+KEY_M = 50
+KEY_COMMA = 51
+KEY_DOT = 52
+KEY_SLASH = 53
+KEY_RIGHTSHIFT = 54
+KEY_KPASTERISK = 55
+KEY_LEFTALT = 56
+KEY_SPACE = 57
+KEY_CAPSLOCK = 58
+KEY_F1 = 59
+KEY_F2 = 60
+KEY_F3 = 61
+KEY_F4 = 62
+KEY_F5 = 63
+KEY_F6 = 64
+KEY_F7 = 65
+KEY_F8 = 66
+KEY_F9 = 67
+KEY_F10 = 68
+KEY_NUMLOCK = 69
+KEY_SCROLLLOCK = 70
+KEY_KP7 = 71
+KEY_KP8 = 72
+KEY_KP9 = 73
+KEY_KPMINUS = 74
+KEY_KP4 = 75
+KEY_KP5 = 76
+KEY_KP6 = 77
+KEY_KPPLUS = 78
+KEY_KP1 = 79
+KEY_KP2 = 80
+KEY_KP3 = 81
+KEY_KP0 = 82
+KEY_KPDOT = 83
+
+KEY_ZENKAKUHANKAKU = 85
+KEY_102ND = 86
+KEY_F11 = 87
+KEY_F12 = 88
+KEY_RO = 89
+KEY_KATAKANA = 90
+KEY_HIRAGANA = 91
+KEY_HENKAN = 92
+KEY_KATAKANAHIRAGANA = 93
+KEY_MUHENKAN = 94
+KEY_KPJPCOMMA = 95
+KEY_KPENTER = 96
+KEY_RIGHTCTRL = 97
+KEY_KPSLASH = 98
+KEY_SYSRQ = 99
+KEY_RIGHTALT = 100
+KEY_LINEFEED = 101
+KEY_HOME = 102
+KEY_UP = 103
+KEY_PAGEUP = 104
+KEY_LEFT = 105
+KEY_RIGHT = 106
+KEY_END = 107
+KEY_DOWN = 108
+KEY_PAGEDOWN = 109
+KEY_INSERT = 110
+KEY_DELETE = 111
+KEY_MACRO = 112
+KEY_MUTE = 113
+KEY_VOLUMEDOWN = 114
+KEY_VOLUMEUP = 115
+KEY_POWER = 116
+KEY_KPEQUAL = 117
+KEY_KPPLUSMINUS = 118
+KEY_PAUSE = 119
+
+KEY_KPCOMMA = 121
+KEY_HANGUEL = 122
+KEY_HANJA = 123
+KEY_YEN = 124
+KEY_LEFTMETA = 125
+KEY_RIGHTMETA = 126
+KEY_COMPOSE = 127
+
+KEY_STOP = 128
+KEY_AGAIN = 129
+KEY_PROPS = 130
+KEY_UNDO = 131
+KEY_FRONT = 132
+KEY_COPY = 133
+KEY_OPEN = 134
+KEY_PASTE = 135
+KEY_FIND = 136
+KEY_CUT = 137
+KEY_HELP = 138
+KEY_MENU = 139
+KEY_CALC = 140
+KEY_SETUP = 141
+KEY_SLEEP = 142
+KEY_WAKEUP = 143
+KEY_FILE = 144
+KEY_SENDFILE = 145
+KEY_DELETEFILE = 146
+KEY_XFER = 147
+KEY_PROG1 = 148
+KEY_PROG2 = 149
+KEY_WWW = 150
+KEY_MSDOS = 151
+KEY_COFFEE = 152
+KEY_DIRECTION = 153
+KEY_CYCLEWINDOWS = 154
+KEY_MAIL = 155
+KEY_BOOKMARKS = 156
+KEY_COMPUTER = 157
+KEY_BACK = 158
+KEY_FORWARD = 159
+KEY_CLOSECD = 160
+KEY_EJECTCD = 161
+KEY_EJECTCLOSECD = 162
+KEY_NEXTSONG = 163
+KEY_PLAYPAUSE = 164
+KEY_PREVIOUSSONG = 165
+KEY_STOPCD = 166
+KEY_RECORD = 167
+KEY_REWIND = 168
+KEY_PHONE = 169
+KEY_ISO = 170
+KEY_CONFIG = 171
+KEY_HOMEPAGE = 172
+KEY_REFRESH = 173
+KEY_EXIT = 174
+KEY_MOVE = 175
+KEY_EDIT = 176
+KEY_SCROLLUP = 177
+KEY_SCROLLDOWN = 178
+KEY_KPLEFTPAREN = 179
+KEY_KPRIGHTPAREN = 180
+
+KEY_F13 = 183
+KEY_F14 = 184
+KEY_F15 = 185
+KEY_F16 = 186
+KEY_F17 = 187
+KEY_F18 = 188
+KEY_F19 = 189
+KEY_F20 = 190
+KEY_F21 = 191
+KEY_F22 = 192
+KEY_F23 = 193
+KEY_F24 = 194
+
+KEY_PLAYCD = 200
+KEY_PAUSECD = 201
+KEY_PROG3 = 202
+KEY_PROG4 = 203
+KEY_SUSPEND = 205
+KEY_CLOSE = 206
+KEY_PLAY = 207
+KEY_FASTFORWARD = 208
+KEY_BASSBOOST = 209
+KEY_PRINT = 210
+KEY_HP = 211
+KEY_CAMERA = 212
+KEY_SOUND = 213
+KEY_QUESTION = 214
+KEY_EMAIL = 215
+KEY_CHAT = 216
+KEY_SEARCH = 217
+KEY_CONNECT = 218
+KEY_FINANCE = 219
+KEY_SPORT = 220
+KEY_SHOP = 221
+KEY_ALTERASE = 222
+KEY_CANCEL = 223
+KEY_BRIGHTNESSDOWN = 224
+KEY_BRIGHTNESSUP = 225
+KEY_MEDIA = 226
+
+KEY_UNKNOWN = 240
+
+BTN_MISC = 0x100
+BTN_0 = 0x100
+BTN_1 = 0x101
+BTN_2 = 0x102
+BTN_3 = 0x103
+BTN_4 = 0x104
+BTN_5 = 0x105
+BTN_6 = 0x106
+BTN_7 = 0x107
+BTN_8 = 0x108
+BTN_9 = 0x109
+
+BTN_MOUSE = 0x110
+BTN_LEFT = 0x110
+BTN_RIGHT = 0x111
+BTN_MIDDLE = 0x112
+BTN_SIDE = 0x113
+BTN_EXTRA = 0x114
+BTN_FORWARD = 0x115
+BTN_BACK = 0x116
+BTN_TASK = 0x117
+
+BTN_JOYSTICK = 0x120
+BTN_TRIGGER = 0x120
+BTN_THUMB = 0x121
+BTN_THUMB2 = 0x122
+BTN_TOP = 0x123
+BTN_TOP2 = 0x124
+BTN_PINKIE = 0x125
+BTN_BASE = 0x126
+BTN_BASE2 = 0x127
+BTN_BASE3 = 0x128
+BTN_BASE4 = 0x129
+BTN_BASE5 = 0x12a
+BTN_BASE6 = 0x12b
+BTN_DEAD = 0x12f
+
+BTN_GAMEPAD = 0x130
+BTN_SOUTH = 0x130
+BTN_A = 0x130
+BTN_EAST = 0x131
+BTN_B = 0x131
+BTN_C = 0x132
+BTN_NORTH = 0x133
+BTN_X = 0x133
+BTN_WEST = 0x134
+BTN_Y = 0x134
+BTN_Z = 0x135
+BTN_TL = 0x136
+BTN_TR = 0x137
+BTN_TL2 = 0x138
+BTN_TR2 = 0x139
+BTN_SELECT = 0x13a
+BTN_START = 0x13b
+BTN_MODE = 0x13c
+BTN_THUMBL = 0x13d
+BTN_THUMBR = 0x13e
+
+BTN_DIGI = 0x140
+BTN_TOOL_PEN = 0x140
+BTN_TOOL_RUBBER = 0x141
+BTN_TOOL_BRUSH = 0x142
+BTN_TOOL_PENCIL = 0x143
+BTN_TOOL_AIRBRUSH = 0x144
+BTN_TOOL_FINGER = 0x145
+BTN_TOOL_MOUSE = 0x146
+BTN_TOOL_LENS = 0x147
+BTN_TOUCH = 0x14a
+BTN_STYLUS = 0x14b
+BTN_STYLUS2 = 0x14c
+BTN_TOOL_DOUBLETAP = 0x14d
+BTN_TOOL_TRIPLETAP = 0x14e
+
+BTN_WHEEL = 0x150
+BTN_GEAR_DOWN = 0x150
+BTN_GEAR_UP = 0x151
+
+KEY_OK = 0x160
+KEY_SELECT = 0x161
+KEY_GOTO = 0x162
+KEY_CLEAR = 0x163
+KEY_POWER2 = 0x164
+KEY_OPTION = 0x165
+KEY_INFO = 0x166
+KEY_TIME = 0x167
+KEY_VENDOR = 0x168
+KEY_ARCHIVE = 0x169
+KEY_PROGRAM = 0x16a
+KEY_CHANNEL = 0x16b
+KEY_FAVORITES = 0x16c
+KEY_EPG = 0x16d
+KEY_PVR = 0x16e
+KEY_MHP = 0x16f
+KEY_LANGUAGE = 0x170
+KEY_TITLE = 0x171
+KEY_SUBTITLE = 0x172
+KEY_ANGLE = 0x173
+KEY_ZOOM = 0x174
+KEY_MODE = 0x175
+KEY_KEYBOARD = 0x176
+KEY_SCREEN = 0x177
+KEY_PC = 0x178
+KEY_TV = 0x179
+KEY_TV2 = 0x17a
+KEY_VCR = 0x17b
+KEY_VCR2 = 0x17c
+KEY_SAT = 0x17d
+KEY_SAT2 = 0x17e
+KEY_CD = 0x17f
+KEY_TAPE = 0x180
+KEY_RADIO = 0x181
+KEY_TUNER = 0x182
+KEY_PLAYER = 0x183
+KEY_TEXT = 0x184
+KEY_DVD = 0x185
+KEY_AUX = 0x186
+KEY_MP3 = 0x187
+KEY_AUDIO = 0x188
+KEY_VIDEO = 0x189
+KEY_DIRECTORY = 0x18a
+KEY_LIST = 0x18b
+KEY_MEMO = 0x18c
+KEY_CALENDAR = 0x18d
+KEY_RED = 0x18e
+KEY_GREEN = 0x18f
+KEY_YELLOW = 0x190
+KEY_BLUE = 0x191
+KEY_CHANNELUP = 0x192
+KEY_CHANNELDOWN = 0x193
+KEY_FIRST = 0x194
+KEY_LAST = 0x195
+KEY_AB = 0x196
+KEY_NEXT = 0x197
+KEY_RESTART = 0x198
+KEY_SLOW = 0x199
+KEY_SHUFFLE = 0x19a
+KEY_BREAK = 0x19b
+KEY_PREVIOUS = 0x19c
+KEY_DIGITS = 0x19d
+KEY_TEEN = 0x19e
+KEY_TWEN = 0x19f
+
+KEY_DEL_EOL = 0x1c0
+KEY_DEL_EOS = 0x1c1
+KEY_INS_LINE = 0x1c2
+KEY_DEL_LINE = 0x1c3
+
+KEY_FN = 0x1d0
+KEY_FN_ESC = 0x1d1
+KEY_FN_F1 = 0x1d2
+KEY_FN_F2 = 0x1d3
+KEY_FN_F3 = 0x1d4
+KEY_FN_F4 = 0x1d5
+KEY_FN_F5 = 0x1d6
+KEY_FN_F6 = 0x1d7
+KEY_FN_F7 = 0x1d8
+KEY_FN_F8 = 0x1d9
+KEY_FN_F9 = 0x1da
+KEY_FN_F10 = 0x1db
+KEY_FN_F11 = 0x1dc
+KEY_FN_F12 = 0x1dd
+KEY_FN_1 = 0x1de
+KEY_FN_2 = 0x1df
+KEY_FN_D = 0x1e0
+KEY_FN_E = 0x1e1
+KEY_FN_F = 0x1e2
+KEY_FN_S = 0x1e3
+KEY_FN_B = 0x1e4
+
+BTN_DPAD_UP = 0x220
+BTN_DPAD_DOWN = 0x221
+BTN_DPAD_LEFT = 0x222
+BTN_DPAD_RIGHT = 0x223
+
+BTN_TRIGGER_HAPPY = 0x2c0
+BTN_TRIGGER_HAPPY1 = 0x2c0
+BTN_TRIGGER_HAPPY2 = 0x2c1
+BTN_TRIGGER_HAPPY3 = 0x2c2
+BTN_TRIGGER_HAPPY4 = 0x2c3
+BTN_TRIGGER_HAPPY5 = 0x2c4
+BTN_TRIGGER_HAPPY6 = 0x2c5
+BTN_TRIGGER_HAPPY7 = 0x2c6
+BTN_TRIGGER_HAPPY8 = 0x2c7
+BTN_TRIGGER_HAPPY9 = 0x2c8
+BTN_TRIGGER_HAPPY10 = 0x2c9
+BTN_TRIGGER_HAPPY11 = 0x2ca
+BTN_TRIGGER_HAPPY12 = 0x2cb
+BTN_TRIGGER_HAPPY13 = 0x2cc
+BTN_TRIGGER_HAPPY14 = 0x2cd
+BTN_TRIGGER_HAPPY15 = 0x2ce
+BTN_TRIGGER_HAPPY16 = 0x2cf
+BTN_TRIGGER_HAPPY17 = 0x2d0
+BTN_TRIGGER_HAPPY18 = 0x2d1
+BTN_TRIGGER_HAPPY19 = 0x2d2
+BTN_TRIGGER_HAPPY20 = 0x2d3
+BTN_TRIGGER_HAPPY21 = 0x2d4
+BTN_TRIGGER_HAPPY22 = 0x2d5
+BTN_TRIGGER_HAPPY23 = 0x2d6
+BTN_TRIGGER_HAPPY24 = 0x2d7
+BTN_TRIGGER_HAPPY25 = 0x2d8
+BTN_TRIGGER_HAPPY26 = 0x2d9
+BTN_TRIGGER_HAPPY27 = 0x2da
+BTN_TRIGGER_HAPPY28 = 0x2db
+BTN_TRIGGER_HAPPY29 = 0x2dc
+BTN_TRIGGER_HAPPY30 = 0x2dd
+BTN_TRIGGER_HAPPY31 = 0x2de
+BTN_TRIGGER_HAPPY32 = 0x2df
+BTN_TRIGGER_HAPPY33 = 0x2e0
+BTN_TRIGGER_HAPPY34 = 0x2e1
+BTN_TRIGGER_HAPPY35 = 0x2e2
+BTN_TRIGGER_HAPPY36 = 0x2e3
+BTN_TRIGGER_HAPPY37 = 0x2e4
+BTN_TRIGGER_HAPPY38 = 0x2e5
+BTN_TRIGGER_HAPPY39 = 0x2e6
+BTN_TRIGGER_HAPPY40 = 0x2e7
+
+KEY_MAX = 0x2ff
+
+# Relative axes
+
+REL_X = 0x00
+REL_Y = 0x01
+REL_Z = 0x02
+REL_RX = 0x03
+REL_RY = 0x04
+REL_RZ = 0x05
+REL_HWHEEL = 0x06
+REL_DIAL = 0x07
+REL_WHEEL = 0x08
+REL_MISC = 0x09
+REL_MAX = 0x0f
+
+# Absolute axes
+
+ABS_X = 0x00
+ABS_Y = 0x01
+ABS_Z = 0x02
+ABS_RX = 0x03
+ABS_RY = 0x04
+ABS_RZ = 0x05
+ABS_THROTTLE = 0x06
+ABS_RUDDER = 0x07
+ABS_WHEEL = 0x08
+ABS_GAS = 0x09
+ABS_BRAKE = 0x0a
+ABS_HAT0X = 0x10
+ABS_HAT0Y = 0x11
+ABS_HAT1X = 0x12
+ABS_HAT1Y = 0x13
+ABS_HAT2X = 0x14
+ABS_HAT2Y = 0x15
+ABS_HAT3X = 0x16
+ABS_HAT3Y = 0x17
+ABS_PRESSURE = 0x18
+ABS_DISTANCE = 0x19
+ABS_TILT_X = 0x1a
+ABS_TILT_Y = 0x1b
+ABS_TOOL_WIDTH = 0x1c
+ABS_VOLUME = 0x20
+ABS_MISC = 0x28
+ABS_MAX = 0x3f
+
+# Misc events
+
+MSC_SERIAL = 0x00
+MSC_PULSELED = 0x01
+MSC_GESTURE = 0x02
+MSC_RAW = 0x03
+MSC_SCAN = 0x04
+MSC_MAX = 0x07
+
+# LEDs
+
+LED_NUML = 0x00
+LED_CAPSL = 0x01
+LED_SCROLLL = 0x02
+LED_COMPOSE = 0x03
+LED_KANA = 0x04
+LED_SLEEP = 0x05
+LED_SUSPEND = 0x06
+LED_MUTE = 0x07
+LED_MISC = 0x08
+LED_MAIL = 0x09
+LED_CHARGING = 0x0a
+LED_MAX = 0x0f
+
+# Autorepeat values
+
+REP_DELAY = 0x00
+REP_PERIOD = 0x01
+REP_MAX = 0x01
+
+# Sounds
+
+SND_CLICK = 0x00
+SND_BELL = 0x01
+SND_TONE = 0x02
+SND_MAX = 0x07
+
+# IDs.
+
+ID_BUS = 0
+ID_VENDOR = 1
+ID_PRODUCT = 2
+ID_VERSION = 3
+
+BUS_PCI = 0x01
+BUS_ISAPNP = 0x02
+BUS_USB = 0x03
+BUS_HIL = 0x04
+BUS_BLUETOOTH = 0x05
+
+BUS_ISA = 0x10
+BUS_I8042 = 0x11
+BUS_XTKBD = 0x12
+BUS_RS232 = 0x13
+BUS_GAMEPORT = 0x14
+BUS_PARPORT = 0x15
+BUS_AMIGA = 0x16
+BUS_ADB = 0x17
+BUS_I2C = 0x18
+BUS_HOST = 0x19
+
+# Values describing the status of an effect
+FF_STATUS_STOPPED = 0x00
+FF_STATUS_PLAYING = 0x01
+FF_STATUS_MAX = 0x01
+FF_RUMBLE = 0x50
+FF_MAX = 0x7f
+FF_CNT = FF_MAX + 1
+
+rel_raw_names = {}
+abs_raw_names = {}
+key_raw_names = {}
+for _name, _val in locals().copy().items():
+ if _name.startswith('REL_'):
+ rel_raw_names[_val] = _name
+ elif _name.startswith('ABS_'):
+ abs_raw_names[_val] = _name
+ elif _name.startswith('KEY_') or _name.startswith('BTN_'):
+ key_raw_names[_val] = _name
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/x11_xinput.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/x11_xinput.py
new file mode 100644
index 0000000000000000000000000000000000000000..5b02fa2854958064ebc37277bbf6f34846d1ce85
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/x11_xinput.py
@@ -0,0 +1,325 @@
+import ctypes
+import pyglet
+from pyglet.input.base import Device, DeviceOpenException
+from pyglet.input.base import Button, RelativeAxis, AbsoluteAxis
+from pyglet.libs.x11 import xlib
+from pyglet.util import asstr
+
+try:
+ from pyglet.libs.x11 import xinput as xi
+
+ _have_xinput = True
+except:
+ _have_xinput = False
+
+
+def ptr_add(ptr, offset):
+ address = ctypes.addressof(ptr.contents) + offset
+ return ctypes.pointer(type(ptr.contents).from_address(address))
+
+
+class DeviceResponder:
+ def _key_press(self, e):
+ pass
+
+ def _key_release(self, e):
+ pass
+
+ def _button_press(self, e):
+ pass
+
+ def _button_release(self, e):
+ pass
+
+ def _motion(self, e):
+ pass
+
+ def _proximity_in(self, e):
+ pass
+
+ def _proximity_out(self, e):
+ pass
+
+
+class XInputDevice(DeviceResponder, Device):
+ def __init__(self, display, device_info):
+ super(XInputDevice, self).__init__(display, asstr(device_info.name))
+
+ self._device_id = device_info.id
+ self._device = None
+
+ # Read device info
+ self.buttons = []
+ self.keys = []
+ self.axes = []
+
+ ptr = device_info.inputclassinfo
+ for i in range(device_info.num_classes):
+ cp = ctypes.cast(ptr, ctypes.POINTER(xi.XAnyClassInfo))
+ cls_class = getattr(cp.contents, 'class')
+
+ if cls_class == xi.KeyClass:
+ cp = ctypes.cast(ptr, ctypes.POINTER(xi.XKeyInfo))
+ self.min_keycode = cp.contents.min_keycode
+ num_keys = cp.contents.num_keys
+ for i in range(num_keys):
+ self.keys.append(Button('key%d' % i))
+
+ elif cls_class == xi.ButtonClass:
+ cp = ctypes.cast(ptr, ctypes.POINTER(xi.XButtonInfo))
+ num_buttons = cp.contents.num_buttons
+ # Pointer buttons start at index 1, with 0 as 'AnyButton'
+ for i in range(num_buttons + 1):
+ self.buttons.append(Button('button%d' % i))
+
+ elif cls_class == xi.ValuatorClass:
+ cp = ctypes.cast(ptr, ctypes.POINTER(xi.XValuatorInfo))
+ num_axes = cp.contents.num_axes
+ mode = cp.contents.mode
+ axes = ctypes.cast(cp.contents.axes,
+ ctypes.POINTER(xi.XAxisInfo))
+ for i in range(num_axes):
+ axis = axes[i]
+ if mode == xi.Absolute:
+ self.axes.append(AbsoluteAxis('axis%d' % i, axis.min_value, axis.max_value))
+ elif mode == xi.Relative:
+ self.axes.append(RelativeAxis('axis%d' % i))
+
+ cls = cp.contents
+ ptr = ptr_add(ptr, cls.length)
+
+ self.controls = self.buttons + self.keys + self.axes
+
+ # Can't detect proximity class event without opening device. Just
+ # assume there is the possibility of a control if there are any axes.
+ if self.axes:
+ self.proximity_control = Button('proximity')
+ self.controls.append(self.proximity_control)
+ else:
+ self.proximity_control = None
+
+ def get_controls(self):
+ return self.controls
+
+ def open(self, window=None, exclusive=False):
+ # Checks for is_open and raises if already open.
+ # TODO allow opening on multiple windows.
+ super(XInputDevice, self).open(window, exclusive)
+
+ if window is None:
+ self.is_open = False
+ raise DeviceOpenException('XInput devices require a window')
+
+ if window.display._display != self.display._display:
+ self.is_open = False
+ raise DeviceOpenException('Window and device displays differ')
+
+ if exclusive:
+ self.is_open = False
+ raise DeviceOpenException('Cannot open XInput device exclusive')
+
+ self._device = xi.XOpenDevice(self.display._display, self._device_id)
+ if not self._device:
+ self.is_open = False
+ raise DeviceOpenException('Cannot open device')
+
+ self._install_events(window)
+
+ def close(self):
+ super(XInputDevice, self).close()
+
+ if not self._device:
+ return
+
+ # TODO: uninstall events
+ xi.XCloseDevice(self.display._display, self._device)
+
+ def _install_events(self, window):
+ dispatcher = XInputWindowEventDispatcher.get_dispatcher(window)
+ dispatcher.open_device(self._device_id, self._device, self)
+
+ # DeviceResponder interface
+
+ def _key_press(self, e):
+ self.keys[e.keycode - self.min_keycode].value = True
+
+ def _key_release(self, e):
+ self.keys[e.keycode - self.min_keycode].value = False
+
+ def _button_press(self, e):
+ self.buttons[e.button].value = True
+
+ def _button_release(self, e):
+ self.buttons[e.button].value = False
+
+ def _motion(self, e):
+ for i in range(e.axes_count):
+ self.axes[i].value = e.axis_data[i]
+
+ def _proximity_in(self, e):
+ if self.proximity_control:
+ self.proximity_control.value = True
+
+ def _proximity_out(self, e):
+ if self.proximity_control:
+ self.proximity_control.value = False
+
+
+class XInputWindowEventDispatcher:
+ def __init__(self, window):
+ self.window = window
+ self._responders = {}
+
+ @staticmethod
+ def get_dispatcher(window):
+ try:
+ dispatcher = window.__xinput_window_event_dispatcher
+ except AttributeError:
+ dispatcher = window.__xinput_window_event_dispatcher = XInputWindowEventDispatcher(window)
+ return dispatcher
+
+ def set_responder(self, device_id, responder):
+ self._responders[device_id] = responder
+
+ def remove_responder(self, device_id):
+ del self._responders[device_id]
+
+ def open_device(self, device_id, device, responder):
+ self.set_responder(device_id, responder)
+ device = device.contents
+ if not device.num_classes:
+ return
+
+ # Bind matching extended window events to bound instance methods
+ # on this object.
+ #
+ # This is inspired by test.c of xinput package by Frederic
+ # Lepied available at x.org.
+ #
+ # In C, this stuff is normally handled by the macro DeviceKeyPress and
+ # friends. Since we don't have access to those macros here, we do it
+ # this way.
+ events = []
+
+ def add(class_info, event, handler):
+ _type = class_info.event_type_base + event
+ _class = device_id << 8 | _type
+ events.append(_class)
+ self.window._event_handlers[_type] = handler
+
+ for i in range(device.num_classes):
+ class_info = device.classes[i]
+ if class_info.input_class == xi.KeyClass:
+ add(class_info, xi._deviceKeyPress, self._event_xinput_key_press)
+ add(class_info, xi._deviceKeyRelease, self._event_xinput_key_release)
+
+ elif class_info.input_class == xi.ButtonClass:
+ add(class_info, xi._deviceButtonPress, self._event_xinput_button_press)
+ add(class_info, xi._deviceButtonRelease, self._event_xinput_button_release)
+
+ elif class_info.input_class == xi.ValuatorClass:
+ add(class_info, xi._deviceMotionNotify, self._event_xinput_motion)
+
+ elif class_info.input_class == xi.ProximityClass:
+ add(class_info, xi._proximityIn, self._event_xinput_proximity_in)
+ add(class_info, xi._proximityOut, self._event_xinput_proximity_out)
+
+ elif class_info.input_class == xi.FeedbackClass:
+ pass
+
+ elif class_info.input_class == xi.FocusClass:
+ pass
+
+ elif class_info.input_class == xi.OtherClass:
+ pass
+
+ array = (xi.XEventClass * len(events))(*events)
+ xi.XSelectExtensionEvent(self.window._x_display, self.window._window, array, len(array))
+
+ @pyglet.window.xlib.XlibEventHandler(0)
+ def _event_xinput_key_press(self, ev):
+ e = ctypes.cast(ctypes.byref(ev), ctypes.POINTER(xi.XDeviceKeyEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._key_press(e)
+
+ @pyglet.window.xlib.XlibEventHandler(0)
+ def _event_xinput_key_release(self, ev):
+ e = ctypes.cast(ctypes.byref(ev), ctypes.POINTER(xi.XDeviceKeyEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._key_release(e)
+
+ @pyglet.window.xlib.XlibEventHandler(0)
+ def _event_xinput_button_press(self, ev):
+ e = ctypes.cast(ctypes.byref(ev), ctypes.POINTER(xi.XDeviceButtonEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._button_press(e)
+
+ @pyglet.window.xlib.XlibEventHandler(0)
+ def _event_xinput_button_release(self, ev):
+ e = ctypes.cast(ctypes.byref(ev), ctypes.POINTER(xi.XDeviceButtonEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._button_release(e)
+
+ @pyglet.window.xlib.XlibEventHandler(0)
+ def _event_xinput_motion(self, ev):
+ e = ctypes.cast(ctypes.byref(ev), ctypes.POINTER(xi.XDeviceMotionEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._motion(e)
+
+ @pyglet.window.xlib.XlibEventHandler(0)
+ def _event_xinput_proximity_in(self, ev):
+ e = ctypes.cast(ctypes.byref(ev), ctypes.POINTER(xi.XProximityNotifyEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._proximity_in(e)
+
+ @pyglet.window.xlib.XlibEventHandler(-1)
+ def _event_xinput_proximity_out(self, ev):
+ e = ctypes.cast(ctypes.byref(ev), ctypes.POINTER(xi.XProximityNotifyEvent)).contents
+
+ device = self._responders.get(e.deviceid)
+ if device is not None:
+ device._proximity_out(e)
+
+
+def _check_extension(display):
+ major_opcode = ctypes.c_int()
+ first_event = ctypes.c_int()
+ first_error = ctypes.c_int()
+ xlib.XQueryExtension(display._display,
+ b'XInputExtension',
+ ctypes.byref(major_opcode),
+ ctypes.byref(first_event),
+ ctypes.byref(first_error))
+ return bool(major_opcode.value)
+
+
+def get_devices(display=None):
+ if display is None:
+ display = pyglet.canvas.get_display()
+
+ if not _have_xinput or not _check_extension(display):
+ return []
+
+ devices = []
+ count = ctypes.c_int(0)
+ device_list = xi.XListInputDevices(display._display, count)
+
+ for i in range(count.value):
+ device_info = device_list[i]
+ devices.append(XInputDevice(display, device_info))
+
+ xi.XFreeDeviceList(device_list)
+
+ return devices
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/x11_xinput_tablet.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/x11_xinput_tablet.py
new file mode 100644
index 0000000000000000000000000000000000000000..a2ca288fd0a8dddee30fa55b5450ce02b643c949
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/linux/x11_xinput_tablet.py
@@ -0,0 +1,91 @@
+from pyglet.input.base import Tablet, TabletCanvas
+from pyglet.input.base import TabletCursor, DeviceOpenException
+from pyglet.input.linux.x11_xinput import XInputWindowEventDispatcher
+from pyglet.input.linux.x11_xinput import get_devices, DeviceResponder
+
+
+try:
+ from pyglet.libs.x11 import xinput as xi
+ _have_xinput = True
+except:
+ _have_xinput = False
+
+
+class XInputTablet(Tablet):
+ name = 'XInput Tablet'
+
+ def __init__(self, cursors):
+ self.cursors = cursors
+
+ def open(self, window):
+ return XInputTabletCanvas(window, self.cursors)
+
+
+class XInputTabletCanvas(DeviceResponder, TabletCanvas):
+ def __init__(self, window, cursors):
+ super(XInputTabletCanvas, self).__init__(window)
+ self.cursors = cursors
+
+ dispatcher = XInputWindowEventDispatcher.get_dispatcher(window)
+
+ self.display = window.display
+ self._open_devices = []
+ self._cursor_map = {}
+ for cursor in cursors:
+ device = cursor.device
+ device_id = device._device_id
+ self._cursor_map[device_id] = cursor
+
+ cursor.max_pressure = device.axes[2].max
+
+ if self.display._display != device.display._display:
+ raise DeviceOpenException('Window and device displays differ')
+
+ open_device = xi.XOpenDevice(device.display._display, device_id)
+ if not open_device:
+ # Ignore this cursor; fail if no cursors added
+ continue
+ self._open_devices.append(open_device)
+
+ dispatcher.open_device(device_id, open_device, self)
+
+ def close(self):
+ for device in self._open_devices:
+ xi.XCloseDevice(self.display._display, device)
+
+ def _motion(self, e):
+ cursor = self._cursor_map.get(e.deviceid)
+ x = e.x
+ y = self.window.height - e.y
+ pressure = e.axis_data[2] / float(cursor.max_pressure)
+ self.dispatch_event('on_motion', cursor, x, y, pressure, 0.0, 0.0, 0.0)
+
+ def _proximity_in(self, e):
+ cursor = self._cursor_map.get(e.deviceid)
+ self.dispatch_event('on_enter', cursor)
+
+ def _proximity_out(self, e):
+ cursor = self._cursor_map.get(e.deviceid)
+ self.dispatch_event('on_leave', cursor)
+
+
+class XInputTabletCursor(TabletCursor):
+ def __init__(self, device):
+ super(XInputTabletCursor, self).__init__(device.name)
+ self.device = device
+
+
+def get_tablets(display=None):
+ # Each cursor appears as a separate xinput device; find devices that look
+ # like Wacom tablet cursors and amalgamate them into a single tablet.
+ valid_names = ('stylus', 'cursor', 'eraser', 'pen', 'pad')
+ cursors = []
+ devices = get_devices(display)
+ for device in devices:
+ dev_name = device.name.lower().split()
+ if any(n in dev_name for n in valid_names) and len(device.axes) >= 3:
+ cursors.append(XInputTabletCursor(device))
+
+ if cursors:
+ return [XInputTablet(cursors)]
+ return []
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/macos/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/macos/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..4655c3c45d1be516046feb5d0c1ea0939cac26e4
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/macos/__init__.py
@@ -0,0 +1,11 @@
+from .darwin_hid import get_devices
+from .darwin_hid import get_joysticks
+from .darwin_hid import get_apple_remote
+from .darwin_hid import get_controllers
+from .darwin_hid import DarwinControllerManager as ControllerManager
+
+
+def get_tablets(display=None):
+ import warnings
+ warnings.warn("Tablets not yet supported on macOS.")
+ return []
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/macos/darwin_hid.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/macos/darwin_hid.py
new file mode 100644
index 0000000000000000000000000000000000000000..0ed7323c1b95a93f458d34bc69fc728bfb57a57e
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/macos/darwin_hid.py
@@ -0,0 +1,640 @@
+import sys
+import warnings
+
+from ctypes import CFUNCTYPE, byref, c_void_p, c_int, c_ubyte, c_bool, c_uint32, c_uint64
+
+import pyglet
+
+from pyglet.event import EventDispatcher
+from pyglet.input.base import Device, AbsoluteAxis, RelativeAxis, Button
+from pyglet.input.base import Joystick, Controller, AppleRemote, ControllerManager
+from pyglet.input.controller import get_mapping, create_guid
+
+from pyglet.libs.darwin.cocoapy import CFSTR, CFIndex, CFTypeID, known_cftypes
+from pyglet.libs.darwin.cocoapy import kCFRunLoopDefaultMode, CFAllocatorRef, cf
+from pyglet.libs.darwin.cocoapy import cfset_to_set, cftype_to_value, cfarray_to_list
+
+
+__LP64__ = (sys.maxsize > 2 ** 32)
+
+# Uses the HID API introduced in Mac OS X version 10.5
+# http://developer.apple.com/library/mac/#technotes/tn2007/tn2187.html
+iokit = pyglet.lib.load_library(framework='IOKit')
+
+# IOKit constants from
+# /System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDKeys.h
+kIOHIDOptionsTypeNone = 0x00
+kIOHIDOptionsTypeSeizeDevice = 0x01
+
+kIOHIDElementTypeInput_Misc = 1
+kIOHIDElementTypeInput_Button = 2
+kIOHIDElementTypeInput_Axis = 3
+kIOHIDElementTypeInput_ScanCodes = 4
+kIOHIDElementTypeOutput = 129
+kIOHIDElementTypeFeature = 257
+kIOHIDElementTypeCollection = 513
+
+# /System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDUsageTables.h
+kHIDPage_GenericDesktop = 0x01
+kHIDPage_Consumer = 0x0C
+kHIDUsage_GD_SystemSleep = 0x82
+kHIDUsage_GD_SystemWakeUp = 0x83
+kHIDUsage_GD_SystemAppMenu = 0x86
+kHIDUsage_GD_SystemMenu = 0x89
+kHIDUsage_GD_SystemMenuRight = 0x8A
+kHIDUsage_GD_SystemMenuLeft = 0x8B
+kHIDUsage_GD_SystemMenuUp = 0x8C
+kHIDUsage_GD_SystemMenuDown = 0x8D
+kHIDUsage_Csmr_Menu = 0x40
+kHIDUsage_Csmr_FastForward = 0xB3
+kHIDUsage_Csmr_Rewind = 0xB4
+kHIDUsage_Csmr_Eject = 0xB8
+kHIDUsage_Csmr_Mute = 0xE2
+kHIDUsage_Csmr_VolumeIncrement = 0xE9
+kHIDUsage_Csmr_VolumeDecrement = 0xEA
+
+IOReturn = c_int # IOReturn.h
+IOOptionBits = c_uint32 # IOTypes.h
+
+# IOHIDKeys.h
+IOHIDElementType = c_int
+IOHIDElementCollectionType = c_int
+IOHIDElementCookie = c_uint32 if __LP64__ else c_void_p
+
+iokit.IOHIDDeviceClose.restype = IOReturn
+iokit.IOHIDDeviceClose.argtypes = [c_void_p, IOOptionBits]
+
+iokit.IOHIDDeviceConformsTo.restype = c_ubyte
+iokit.IOHIDDeviceConformsTo.argtypes = [c_void_p, c_uint32, c_uint32]
+
+iokit.IOHIDDeviceCopyMatchingElements.restype = c_void_p
+iokit.IOHIDDeviceCopyMatchingElements.argtypes = [c_void_p, c_void_p, IOOptionBits]
+
+iokit.IOHIDDeviceGetProperty.restype = c_void_p
+iokit.IOHIDDeviceGetProperty.argtypes = [c_void_p, c_void_p]
+
+iokit.IOHIDDeviceGetTypeID.restype = CFTypeID
+iokit.IOHIDDeviceGetTypeID.argtypes = []
+
+iokit.IOHIDDeviceGetValue.restype = IOReturn
+iokit.IOHIDDeviceGetValue.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDDeviceOpen.restype = IOReturn
+iokit.IOHIDDeviceOpen.argtypes = [c_void_p, IOOptionBits]
+
+iokit.IOHIDDeviceRegisterInputValueCallback.restype = None
+iokit.IOHIDDeviceRegisterInputValueCallback.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDDeviceScheduleWithRunLoop.restype = None
+iokit.IOHIDDeviceScheduleWithRunLoop.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDDeviceUnscheduleFromRunLoop.restype = None
+iokit.IOHIDDeviceUnscheduleFromRunLoop.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDElementGetCollectionType.restype = IOHIDElementCollectionType
+iokit.IOHIDElementGetCollectionType.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetCookie.restype = IOHIDElementCookie
+iokit.IOHIDElementGetCookie.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetLogicalMax.restype = CFIndex
+iokit.IOHIDElementGetLogicalMax.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetLogicalMin.restype = CFIndex
+iokit.IOHIDElementGetLogicalMin.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetName.restype = c_void_p
+iokit.IOHIDElementGetName.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetPhysicalMax.restype = CFIndex
+iokit.IOHIDElementGetPhysicalMax.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetPhysicalMin.restype = CFIndex
+iokit.IOHIDElementGetPhysicalMin.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetReportCount.restype = c_uint32
+iokit.IOHIDElementGetReportCount.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetReportID.restype = c_uint32
+iokit.IOHIDElementGetReportID.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetReportSize.restype = c_uint32
+iokit.IOHIDElementGetReportSize.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetType.restype = IOHIDElementType
+iokit.IOHIDElementGetType.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetTypeID.restype = CFTypeID
+iokit.IOHIDElementGetTypeID.argtypes = []
+
+iokit.IOHIDElementGetUnit.restype = c_uint32
+iokit.IOHIDElementGetUnit.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetUnitExponent.restype = c_uint32
+iokit.IOHIDElementGetUnitExponent.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetUsage.restype = c_uint32
+iokit.IOHIDElementGetUsage.argtypes = [c_void_p]
+
+iokit.IOHIDElementGetUsagePage.restype = c_uint32
+iokit.IOHIDElementGetUsagePage.argtypes = [c_void_p]
+
+iokit.IOHIDElementHasNullState.restype = c_bool
+iokit.IOHIDElementHasNullState.argtypes = [c_void_p]
+
+iokit.IOHIDElementHasPreferredState.restype = c_bool
+iokit.IOHIDElementHasPreferredState.argtypes = [c_void_p]
+
+iokit.IOHIDElementIsArray.restype = c_bool
+iokit.IOHIDElementIsArray.argtypes = [c_void_p]
+
+iokit.IOHIDElementIsNonLinear.restype = c_bool
+iokit.IOHIDElementIsNonLinear.argtypes = [c_void_p]
+
+iokit.IOHIDElementIsRelative.restype = c_bool
+iokit.IOHIDElementIsRelative.argtypes = [c_void_p]
+
+iokit.IOHIDElementIsVirtual.restype = c_bool
+iokit.IOHIDElementIsVirtual.argtypes = [c_void_p]
+
+iokit.IOHIDElementIsWrapping.restype = c_bool
+iokit.IOHIDElementIsWrapping.argtypes = [c_void_p]
+
+iokit.IOHIDManagerCreate.restype = c_void_p
+iokit.IOHIDManagerCreate.argtypes = [CFAllocatorRef, IOOptionBits]
+
+iokit.IOHIDManagerCopyDevices.restype = c_void_p
+iokit.IOHIDManagerCopyDevices.argtypes = [c_void_p]
+
+iokit.IOHIDManagerRegisterDeviceMatchingCallback.restype = None
+iokit.IOHIDManagerRegisterDeviceMatchingCallback.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDManagerRegisterDeviceRemovalCallback.restype = None
+iokit.IOHIDManagerRegisterDeviceRemovalCallback.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDManagerScheduleWithRunLoop.restype = c_void_p
+iokit.IOHIDManagerScheduleWithRunLoop.argtypes = [c_void_p, c_void_p, c_void_p]
+
+iokit.IOHIDManagerSetDeviceMatching.restype = None
+iokit.IOHIDManagerSetDeviceMatching.argtypes = [c_void_p, c_void_p]
+
+iokit.IOHIDValueGetElement.restype = c_void_p
+iokit.IOHIDValueGetElement.argtypes = [c_void_p]
+
+iokit.IOHIDValueGetIntegerValue.restype = CFIndex
+iokit.IOHIDValueGetIntegerValue.argtypes = [c_void_p]
+
+iokit.IOHIDValueGetLength.restype = CFIndex
+iokit.IOHIDValueGetLength.argtypes = [c_void_p]
+
+iokit.IOHIDValueGetTimeStamp.restype = c_uint64
+iokit.IOHIDValueGetTimeStamp.argtypes = [c_void_p]
+
+iokit.IOHIDValueGetTypeID.restype = CFTypeID
+iokit.IOHIDValueGetTypeID.argtypes = []
+
+# Callback function types
+HIDManagerCallback = CFUNCTYPE(None, c_void_p, c_int, c_void_p, c_void_p)
+HIDDeviceCallback = CFUNCTYPE(None, c_void_p, c_int, c_void_p)
+HIDDeviceValueCallback = CFUNCTYPE(None, c_void_p, c_int, c_void_p, c_void_p)
+
+######################################################################
+# HID Class Wrappers
+
+# Lookup tables cache python objects for the devices and elements so that
+# we can avoid creating multiple wrapper objects for the same device.
+_device_lookup = {} # IOHIDDeviceRef to python HIDDevice object
+
+
+class HIDValue:
+ def __init__(self, value_ref):
+ # Check that this is a valid IOHIDValue.
+ assert value_ref
+ assert cf.CFGetTypeID(value_ref) == iokit.IOHIDValueGetTypeID()
+ self.value_ref = value_ref
+ self.timestamp = iokit.IOHIDValueGetTimeStamp(value_ref)
+ self.length = iokit.IOHIDValueGetLength(value_ref)
+ if self.length <= 4:
+ self.intvalue = iokit.IOHIDValueGetIntegerValue(value_ref)
+ else:
+ # Values may be byte data rather than integers.
+ # e.g. the PS3 controller has a 39-byte HIDValue element.
+ # We currently do not try to handle these cases.
+ self.intvalue = None
+ element_ref = c_void_p(iokit.IOHIDValueGetElement(value_ref))
+ self.element = HIDDeviceElement.get_element(element_ref)
+
+
+class HIDDevice:
+ @classmethod
+ def get_device(cls, device_ref):
+ # device_ref is a c_void_p pointing to an IOHIDDeviceRef
+ if device_ref.value in _device_lookup:
+ return _device_lookup[device_ref.value]
+ else:
+ device = HIDDevice(device_ref)
+ return device
+
+ def __init__(self, device_ref):
+ _device_lookup[device_ref.value] = self
+ self.device_ref = device_ref
+ # Set attributes from device properties.
+ self.transport = self.get_property("Transport")
+ self.vendorID = self.get_property("VendorID")
+ self.vendorIDSource = self.get_property("VendorIDSource")
+ self.productID = self.get_property("ProductID")
+ self.versionNumber = self.get_property("VersionNumber")
+ self.manufacturer = self.get_property("Manufacturer")
+ self.product = self.get_property("Product")
+ self.serialNumber = self.get_property("SerialNumber") # always returns None; apple bug?
+ self.locationID = self.get_property("LocationID")
+ self.primaryUsage = self.get_property("PrimaryUsage")
+ self.primaryUsagePage = self.get_property("PrimaryUsagePage")
+ # Populate self.elements with our device elements.
+ self.elements = self._get_elements()
+ # Set up callback functions.
+ self.value_observers = set()
+ self.value_callback = self._register_input_value_callback()
+
+ def get_guid(self):
+ """Generate an SDL2 style GUID from the product guid."""
+ # TODO: in what situation should 0x05 be used?
+ # 0x03: USB
+ # 0x05: Bluetooth
+ bustype = 0x03
+ vendor = self.vendorID or 0
+ product = self.productID or 0
+ version = self.versionNumber or 0
+ name = self.product or ""
+ return create_guid(bustype, vendor, product, version, name, 0, 0)
+
+ def get_property(self, name):
+ cfname = CFSTR(name)
+ cfvalue = c_void_p(iokit.IOHIDDeviceGetProperty(self.device_ref, cfname))
+ cf.CFRelease(cfname)
+ return cftype_to_value(cfvalue)
+
+ def open(self, exclusive_mode=False):
+ if exclusive_mode:
+ options = kIOHIDOptionsTypeSeizeDevice
+ else:
+ options = kIOHIDOptionsTypeNone
+ return bool(iokit.IOHIDDeviceOpen(self.device_ref, options))
+
+ def close(self):
+ return bool(iokit.IOHIDDeviceClose(self.device_ref, kIOHIDOptionsTypeNone))
+
+ def schedule_with_run_loop(self):
+ iokit.IOHIDDeviceScheduleWithRunLoop(
+ self.device_ref,
+ c_void_p(cf.CFRunLoopGetCurrent()),
+ kCFRunLoopDefaultMode)
+
+ def unschedule_from_run_loop(self):
+ iokit.IOHIDDeviceUnscheduleFromRunLoop(
+ self.device_ref,
+ c_void_p(cf.CFRunLoopGetCurrent()),
+ kCFRunLoopDefaultMode)
+
+ def _get_elements(self):
+ cfarray = c_void_p(iokit.IOHIDDeviceCopyMatchingElements(self.device_ref, None, 0))
+ if not cfarray:
+ # requires "Security & Privacy / Input Monitoring", see #95
+ return []
+ elements = cfarray_to_list(cfarray)
+ cf.CFRelease(cfarray)
+ return elements
+
+ # Page and usage IDs are from the HID usage tables located at
+ # https://usb.org/sites/default/files/hut1_3_0.pdf
+ def conforms_to(self, page, usage):
+ return bool(iokit.IOHIDDeviceConformsTo(self.device_ref, page, usage))
+
+ def is_pointer(self):
+ return self.conforms_to(0x01, 0x01)
+
+ def is_mouse(self):
+ return self.conforms_to(0x01, 0x02)
+
+ def is_joystick(self):
+ return self.conforms_to(0x01, 0x04)
+
+ def is_gamepad(self):
+ return self.conforms_to(0x01, 0x05)
+
+ def is_keyboard(self):
+ return self.conforms_to(0x01, 0x06)
+
+ def is_keypad(self):
+ return self.conforms_to(0x01, 0x07)
+
+ def is_multi_axis(self):
+ return self.conforms_to(0x01, 0x08)
+
+ def py_value_callback(self, context, result, sender, value):
+ v = HIDValue(c_void_p(value))
+ # Dispatch value changed message to all observers.
+ for x in self.value_observers:
+ if hasattr(x, 'device_value_changed'):
+ x.device_value_changed(self, v)
+
+ def _register_input_value_callback(self):
+ value_callback = HIDDeviceValueCallback(self.py_value_callback)
+ iokit.IOHIDDeviceRegisterInputValueCallback(self.device_ref, value_callback, None)
+ return value_callback
+
+ def add_value_observer(self, observer):
+ self.value_observers.add(observer)
+
+ def get_value(self, element):
+ # If the device is not open, then returns None
+ value_ref = c_void_p()
+ iokit.IOHIDDeviceGetValue(self.device_ref, element.element_ref, byref(value_ref))
+ if value_ref:
+ return HIDValue(value_ref)
+ else:
+ return None
+
+ def __repr__(self):
+ return f"{self.__class__.__name__}(name={self.product})"
+
+
+class HIDDeviceElement:
+
+ @classmethod
+ def get_element(cls, element_ref):
+ # element_ref is a c_void_p pointing to an IOHIDDeviceElementRef
+ return HIDDeviceElement(element_ref)
+
+ def __init__(self, element_ref):
+ self.element_ref = element_ref
+ # Set element properties as attributes.
+ self.cookie = iokit.IOHIDElementGetCookie(element_ref)
+ self.type = iokit.IOHIDElementGetType(element_ref)
+ if self.type == kIOHIDElementTypeCollection:
+ self.collectionType = iokit.IOHIDElementGetCollectionType(element_ref)
+ else:
+ self.collectionType = None
+ self.usagePage = iokit.IOHIDElementGetUsagePage(element_ref)
+ self.usage = iokit.IOHIDElementGetUsage(element_ref)
+ self.isVirtual = bool(iokit.IOHIDElementIsVirtual(element_ref))
+ self.isRelative = bool(iokit.IOHIDElementIsRelative(element_ref))
+ self.isWrapping = bool(iokit.IOHIDElementIsWrapping(element_ref))
+ self.isArray = bool(iokit.IOHIDElementIsArray(element_ref))
+ self.isNonLinear = bool(iokit.IOHIDElementIsNonLinear(element_ref))
+ self.hasPreferredState = bool(iokit.IOHIDElementHasPreferredState(element_ref))
+ self.hasNullState = bool(iokit.IOHIDElementHasNullState(element_ref))
+ self.name = cftype_to_value(iokit.IOHIDElementGetName(element_ref))
+ self.reportID = iokit.IOHIDElementGetReportID(element_ref)
+ self.reportSize = iokit.IOHIDElementGetReportSize(element_ref)
+ self.reportCount = iokit.IOHIDElementGetReportCount(element_ref)
+ self.unit = iokit.IOHIDElementGetUnit(element_ref)
+ self.unitExponent = iokit.IOHIDElementGetUnitExponent(element_ref)
+ self.logicalMin = iokit.IOHIDElementGetLogicalMin(element_ref)
+ self.logicalMax = iokit.IOHIDElementGetLogicalMax(element_ref)
+ self.physicalMin = iokit.IOHIDElementGetPhysicalMin(element_ref)
+ self.physicalMax = iokit.IOHIDElementGetPhysicalMax(element_ref)
+
+
+class HIDManager(EventDispatcher):
+ def __init__(self):
+ """Create an instance of an HIDManager."""
+ self.manager_ref = c_void_p(iokit.IOHIDManagerCreate(None, kIOHIDOptionsTypeNone))
+ self.schedule_with_run_loop()
+
+ self.devices = self._get_devices()
+ self.matching_callback = self._register_matching_callback()
+ self.removal_callback = self._register_removal_callback()
+
+ def _get_devices(self):
+ try:
+ # Tell manager that we are willing to match *any* device.
+ # (Alternatively, we could restrict by device usage, or usage page.)
+ iokit.IOHIDManagerSetDeviceMatching(self.manager_ref, None)
+ # Copy the device set and convert it to python.
+ cfset = c_void_p(iokit.IOHIDManagerCopyDevices(self.manager_ref))
+ devices = cfset_to_set(cfset)
+ cf.CFRelease(cfset)
+ except:
+ return set()
+ return devices
+
+ def open(self):
+ iokit.IOHIDManagerOpen(self.manager_ref, kIOHIDOptionsTypeNone)
+
+ def close(self):
+ iokit.IOHIDManagerClose(self.manager_ref, kIOHIDOptionsTypeNone)
+
+ def schedule_with_run_loop(self):
+ iokit.IOHIDManagerScheduleWithRunLoop(
+ self.manager_ref,
+ c_void_p(cf.CFRunLoopGetCurrent()),
+ kCFRunLoopDefaultMode)
+
+ def unschedule_from_run_loop(self):
+ iokit.IOHIDManagerUnscheduleFromRunLoop(
+ self.manager_ref,
+ c_void_p(cf.CFRunLoopGetCurrent()),
+ kCFRunLoopDefaultMode)
+
+ # Device add/remove callbacks:
+
+ def _py_matching_callback(self, context, result, sender, device):
+ d = HIDDevice.get_device(c_void_p(device))
+ if d not in self.devices:
+ self.devices.add(d)
+ self.dispatch_event("on_connect", d)
+
+ def _register_matching_callback(self):
+ matching_callback = HIDManagerCallback(self._py_matching_callback)
+ iokit.IOHIDManagerRegisterDeviceMatchingCallback(self.manager_ref, matching_callback, None)
+ return matching_callback
+
+ def _py_removal_callback(self, context, result, sender, device):
+ d = HIDDevice.get_device(c_void_p(device))
+ d.close()
+ if d in self.devices:
+ self.devices.remove(d)
+ self.dispatch_event("on_disconnect", d)
+
+ def _register_removal_callback(self):
+ removal_callback = HIDManagerCallback(self._py_removal_callback)
+ iokit.IOHIDManagerRegisterDeviceRemovalCallback(self.manager_ref, removal_callback, None)
+ return removal_callback
+
+
+HIDManager.register_event_type('on_connect')
+HIDManager.register_event_type('on_disconnect')
+
+
+######################################################################
+# Add conversion methods for IOHIDDevices and IOHIDDeviceElements
+# to the list of known types used by cftype_to_value.
+known_cftypes[iokit.IOHIDDeviceGetTypeID()] = HIDDevice.get_device
+known_cftypes[iokit.IOHIDElementGetTypeID()] = HIDDeviceElement.get_element
+######################################################################
+
+# Pyglet interface to HID
+
+
+_axis_names = {
+ (0x01, 0x30): 'x',
+ (0x01, 0x31): 'y',
+ (0x01, 0x32): 'z',
+ (0x01, 0x33): 'rx',
+ (0x01, 0x34): 'ry',
+ (0x01, 0x35): 'rz',
+ (0x01, 0x38): 'wheel',
+ (0x01, 0x39): 'hat',
+}
+
+
+_button_names = {
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemSleep): 'sleep',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemWakeUp): 'wakeup',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemAppMenu): 'menu',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenu): 'select',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenuRight): 'right',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenuLeft): 'left',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenuUp): 'up',
+ (kHIDPage_GenericDesktop, kHIDUsage_GD_SystemMenuDown): 'down',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_FastForward): 'right_hold',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_Rewind): 'left_hold',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_Menu): 'menu_hold',
+ (0xff01, 0x23): 'select_hold',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_Eject): 'eject',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_Mute): 'mute',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_VolumeIncrement): 'volume_up',
+ (kHIDPage_Consumer, kHIDUsage_Csmr_VolumeDecrement): 'volume_down'
+}
+
+
+class PygletDevice(Device):
+ def __init__(self, display, device):
+ super().__init__(display=display, name=device.product)
+ self.device = device
+ self.device.add_value_observer(self)
+ self._create_controls()
+
+ def open(self, window=None, exclusive=False):
+ super().open(window, exclusive)
+ self.device.open(exclusive)
+ self._set_initial_control_values()
+
+ def close(self):
+ super().close()
+ self.device.close()
+
+ def get_controls(self):
+ return list(self._controls.values())
+
+ def get_guid(self):
+ return self.device.get_guid()
+
+ def device_value_changed(self, hid_device, hid_value):
+ # Called by device when input value changes.
+ control = self._controls[hid_value.element.cookie]
+ control.value = hid_value.intvalue
+
+ def _create_controls(self):
+ controls = []
+
+ for element in self.device.elements:
+ raw_name = element.name or '0x%x:%x' % (element.usagePage, element.usage)
+ if element.type in (kIOHIDElementTypeInput_Misc, kIOHIDElementTypeInput_Axis):
+ name = _axis_names.get((element.usagePage, element.usage))
+ if element.isRelative:
+ control = RelativeAxis(name, raw_name)
+ else:
+ control = AbsoluteAxis(name, element.logicalMin, element.logicalMax, raw_name)
+ elif element.type == kIOHIDElementTypeInput_Button:
+ name = _button_names.get((element.usagePage, element.usage))
+ control = Button(name, raw_name)
+ else:
+ continue
+
+ control._cookie = element.cookie
+ control._usage = element.usage
+ controls.append(control)
+
+ controls.sort(key=lambda c: c._usage)
+ self._controls = {control._cookie: control for control in controls}
+
+ def _set_initial_control_values(self):
+ # Must be called AFTER the device has been opened.
+ for element in self.device.elements:
+ if element.cookie in self._controls:
+ control = self._controls[element.cookie]
+ hid_value = self.device.get_value(element)
+ if hid_value:
+ control.value = hid_value.intvalue
+
+ def __repr__(self):
+ return f"{self.__class__.__name__}({self.device})"
+
+######################################################################
+
+
+_hid_manager = HIDManager()
+
+
+class DarwinControllerManager(ControllerManager):
+
+ def __init__(self, display=None):
+ self._controllers = {}
+
+ for device in _hid_manager.devices:
+ if controller := _create_controller(device, display):
+ self._controllers[device] = controller
+
+ @_hid_manager.event
+ def on_connect(hiddevice):
+ if _controller := _create_controller(hiddevice, display):
+ self._controllers[hiddevice] = _controller
+ pyglet.app.platform_event_loop.post_event(self, 'on_connect', _controller)
+
+ @_hid_manager.event
+ def on_disconnect(hiddevice):
+ if hiddevice in self._controllers:
+ _controller = self._controllers[hiddevice]
+ del self._controllers[hiddevice]
+ pyglet.app.platform_event_loop.post_event(self, 'on_disconnect', _controller)
+
+ def get_controllers(self):
+ return list(self._controllers.values())
+
+
+def get_devices(display=None):
+ return [PygletDevice(display, device) for device in _hid_manager.devices]
+
+
+def get_joysticks(display=None):
+ return [Joystick(PygletDevice(display, device)) for device in _hid_manager.devices
+ if device.is_joystick() or device.is_gamepad() or device.is_multi_axis()]
+
+
+def get_apple_remote(display=None):
+ for device in _hid_manager.devices:
+ if device.product == 'Apple IR':
+ return AppleRemote(PygletDevice(display, device))
+
+
+def _create_controller(device, display):
+
+ if not device.transport and device.transport.upper() in ('USB', 'BLUETOOTH'):
+ return
+
+ if device.is_joystick() or device.is_gamepad() or device.is_multi_axis():
+
+ if mapping := get_mapping(device.get_guid()):
+ return Controller(PygletDevice(display, device), mapping)
+ else:
+ warnings.warn(f"Warning: {device} (GUID: {device.get_guid()}) "
+ f"has no controller mappings. Update the mappings in the Controller DB.")
+
+
+def get_controllers(display=None):
+ return [controller for controller in
+ [_create_controller(device, display) for device in _hid_manager.devices
+ if device.is_joystick() or device.is_gamepad() or device.is_multi_axis()]
+ if controller is not None]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/win32/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/win32/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..cde1490008e51bd51c5352228639c9ff92384274
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/win32/__init__.py
@@ -0,0 +1,116 @@
+from typing import Dict, Optional
+
+import pyglet
+
+from pyglet.input import base
+from pyglet.input.win32.directinput import DirectInputDevice, _create_controller
+from pyglet.input.win32.directinput import _di_manager as _di_device_manager
+
+from pyglet.input.win32.directinput import get_devices as dinput_get_devices
+from pyglet.input.win32.directinput import get_controllers as dinput_get_controllers
+from pyglet.input.win32.directinput import get_joysticks
+
+try:
+ from pyglet.input.win32.wintab import get_tablets
+except:
+ def get_tablets(display=None):
+ import warnings
+ warnings.warn("Failed to initialize wintab framework.")
+ return []
+
+
+_xinput_enabled = False
+if not pyglet.options["win32_disable_xinput"]:
+ try:
+ from pyglet.input.win32.xinput import XInputControllerManager, XInputController, XInputDevice
+ from pyglet.input.win32.xinput import _device_manager as _xinput_device_manager
+ from pyglet.input.win32.xinput import get_devices as xinput_get_devices
+ from pyglet.input.win32.xinput import get_controllers as xinput_get_controllers
+
+ _xinput_enabled = True
+ except OSError:
+ # Fail to import XInput.
+ pass
+
+
+class Win32ControllerManager(base.ControllerManager):
+ """This class manages XInput and DirectInput as a combined manager.
+ XInput will override any XInput compatible DirectInput devices.
+ Any devices not supported by XInput will fall back to DirectInput.
+ """
+
+ def __init__(self):
+ self._di_controllers: Dict[DirectInputDevice, base.Controller] = {}
+
+ if _xinput_enabled:
+ self._xinput_controllers: Dict[XInputDevice, XInputController] = {}
+
+ for xdevice in _xinput_device_manager.all_devices: # All 4 devices are initialized.
+ meta = {'name': xdevice.name, 'guid': "XINPUTCONTROLLER"}
+ self._xinput_controllers[xdevice] = XInputController(xdevice, meta)
+
+ @_xinput_device_manager.event
+ def on_connect(xdevice):
+ self.dispatch_event('on_connect', self._xinput_controllers[xdevice])
+
+ @_xinput_device_manager.event
+ def on_disconnect(xdevice):
+ self.dispatch_event('on_disconnect', self._xinput_controllers[xdevice])
+
+ self._set_initial_didevices()
+
+ @_di_device_manager.event
+ def on_connect(di_device):
+ if di_device not in self._di_controllers:
+ if self._add_di_controller(di_device):
+ pyglet.app.platform_event_loop.post_event(self, 'on_connect', self._di_controllers[di_device])
+
+ @_di_device_manager.event
+ def on_disconnect(di_device):
+ if di_device in self._di_controllers:
+ _controller = self._di_controllers[di_device]
+ del self._di_controllers[di_device]
+ pyglet.app.platform_event_loop.post_event(self, 'on_disconnect', _controller)
+
+ def _set_initial_didevices(self):
+ if not _di_device_manager.registered:
+ _di_device_manager.register_device_events()
+ _di_device_manager.set_current_devices()
+
+ for device in _di_device_manager.devices:
+ self._add_di_controller(device)
+
+ def _add_di_controller(self, device: DirectInputDevice) -> Optional[base.Controller]:
+ controller = _create_controller(device)
+ if controller:
+ self._di_controllers[device] = controller
+ return controller
+
+ return None
+
+ def _get_xinput_controllers(self) -> list:
+ if not _xinput_enabled:
+ return []
+ return [ctlr for ctlr in self._xinput_controllers.values() if ctlr.device.connected]
+
+ def _get_di_controllers(self) -> list:
+ return list(self._di_controllers.values())
+
+ def get_controllers(self):
+ return self._get_xinput_controllers() + self._get_di_controllers()
+
+
+def xinput_get_devices():
+ return []
+
+
+def xinput_get_controllers():
+ return []
+
+
+def get_devices(display=None):
+ return xinput_get_devices() + dinput_get_devices(display)
+
+
+def get_controllers(display=None):
+ return xinput_get_controllers() + dinput_get_controllers(display)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/win32/directinput.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/win32/directinput.py
new file mode 100644
index 0000000000000000000000000000000000000000..1f6376b979d4ef51649af6e29a1b99316918e1bc
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/win32/directinput.py
@@ -0,0 +1,458 @@
+import ctypes
+import warnings
+
+from typing import List, Dict, Optional
+
+from pyglet.libs.win32.constants import WM_DEVICECHANGE, DBT_DEVICEARRIVAL, DBT_DEVICEREMOVECOMPLETE, \
+ DBT_DEVTYP_DEVICEINTERFACE, DEVICE_NOTIFY_WINDOW_HANDLE
+
+from pyglet.event import EventDispatcher
+
+import pyglet
+from pyglet.input import base
+from pyglet.libs import win32
+from pyglet.libs.win32 import dinput, _user32, DEV_BROADCAST_DEVICEINTERFACE, com, DEV_BROADCAST_HDR
+from pyglet.libs.win32 import _kernel32
+from pyglet.input.controller import get_mapping
+from pyglet.input.base import ControllerManager
+
+# These instance names are not defined anywhere, obtained by experiment. The
+# GUID names (which seem to be ideally what are needed) are wrong/missing for
+# most of my devices.
+
+_abs_instance_names = {
+ 0: 'x',
+ 1: 'y',
+ 2: 'z',
+ 3: 'rx',
+ 4: 'ry',
+ 5: 'rz',
+}
+
+_rel_instance_names = {
+ 0: 'x',
+ 1: 'y',
+ 2: 'wheel',
+}
+
+_btn_instance_names = {}
+
+
+def _create_control(object_instance):
+ raw_name = object_instance.tszName
+ ctrl_type = object_instance.dwType
+ instance = dinput.DIDFT_GETINSTANCE(ctrl_type)
+
+ if ctrl_type & dinput.DIDFT_ABSAXIS:
+ name = _abs_instance_names.get(instance)
+ control = base.AbsoluteAxis(name, 0, 0xffff, raw_name)
+ elif ctrl_type & dinput.DIDFT_RELAXIS:
+ name = _rel_instance_names.get(instance)
+ control = base.RelativeAxis(name, raw_name)
+ elif ctrl_type & dinput.DIDFT_BUTTON:
+ name = _btn_instance_names.get(instance)
+ control = base.Button(name, raw_name)
+ elif ctrl_type & dinput.DIDFT_POV:
+ control = base.AbsoluteAxis(base.AbsoluteAxis.HAT, 0, 0xffffffff, raw_name)
+ else:
+ return
+
+ control._type = object_instance.dwType
+ return control
+
+
+class DirectInputDevice(base.Device):
+ def __init__(self, display, device, device_instance):
+ name = device_instance.tszInstanceName
+ super(DirectInputDevice, self).__init__(display, name)
+
+ self._type = device_instance.dwDevType & 0xff
+ self._subtype = device_instance.dwDevType & 0xff00
+ self._device = device
+ self._init_controls()
+ self._set_format()
+
+ self.id_name = device_instance.tszProductName
+ self.id_product_guid = format(device_instance.guidProduct.Data1, "08x")
+
+ def __del__(self):
+ self._device.Release()
+
+ def get_guid(self):
+ """Generate an SDL2 style GUID from the product guid."""
+ first = self.id_product_guid[6:8] + self.id_product_guid[4:6]
+ second = self.id_product_guid[2:4] + self.id_product_guid[0:2]
+ return f"03000000{first}0000{second}000000000000"
+
+ def _init_controls(self):
+ self.controls = []
+ self._device.EnumObjects(dinput.LPDIENUMDEVICEOBJECTSCALLBACK(self._object_enum), None, dinput.DIDFT_ALL)
+ self.controls.sort(key=lambda c: c._type)
+
+ def _object_enum(self, object_instance, arg):
+ control = _create_control(object_instance.contents)
+ if control:
+ self.controls.append(control)
+ return dinput.DIENUM_CONTINUE
+
+ def _set_format(self):
+ if not self.controls:
+ return
+
+ object_formats = (dinput.DIOBJECTDATAFORMAT * len(self.controls))()
+ offset = 0
+ for object_format, control in zip(object_formats, self.controls):
+ object_format.dwOfs = offset
+ object_format.dwType = control._type
+ offset += 4
+
+ fmt = dinput.DIDATAFORMAT()
+ fmt.dwSize = ctypes.sizeof(fmt)
+ fmt.dwObjSize = ctypes.sizeof(dinput.DIOBJECTDATAFORMAT)
+ fmt.dwFlags = 0
+ fmt.dwDataSize = offset
+ fmt.dwNumObjs = len(object_formats)
+ fmt.rgodf = ctypes.cast(ctypes.pointer(object_formats), dinput.LPDIOBJECTDATAFORMAT)
+ self._device.SetDataFormat(fmt)
+
+ prop = dinput.DIPROPDWORD()
+ prop.diph.dwSize = ctypes.sizeof(prop)
+ prop.diph.dwHeaderSize = ctypes.sizeof(prop.diph)
+ prop.diph.dwObj = 0
+ prop.diph.dwHow = dinput.DIPH_DEVICE
+ prop.dwData = 64 * ctypes.sizeof(dinput.DIDATAFORMAT)
+ self._device.SetProperty(dinput.DIPROP_BUFFERSIZE, ctypes.byref(prop.diph))
+
+ def open(self, window=None, exclusive=False):
+ if not self.controls:
+ return
+
+ if window is None:
+ # Pick any open window, or the shadow window if no windows
+ # have been created yet.
+ window = pyglet.gl._shadow_window
+ for window in pyglet.app.windows:
+ break
+
+ flags = dinput.DISCL_BACKGROUND
+ if exclusive:
+ flags |= dinput.DISCL_EXCLUSIVE
+ else:
+ flags |= dinput.DISCL_NONEXCLUSIVE
+
+ self._wait_object = _kernel32.CreateEventW(None, False, False, None)
+ self._device.SetEventNotification(self._wait_object)
+ pyglet.app.platform_event_loop.add_wait_object(self._wait_object, self._dispatch_events)
+
+ self._device.SetCooperativeLevel(window._hwnd, flags)
+ self._device.Acquire()
+
+ def close(self):
+ if not self.controls:
+ return
+
+ pyglet.app.platform_event_loop.remove_wait_object(self._wait_object)
+
+ self._device.Unacquire()
+ self._device.SetEventNotification(None)
+
+ _kernel32.CloseHandle(self._wait_object)
+
+ def get_controls(self):
+ return self.controls
+
+ def _dispatch_events(self):
+ if not self.controls:
+ return
+
+ events = (dinput.DIDEVICEOBJECTDATA * 64)()
+ n_events = win32.DWORD(len(events))
+ try:
+ self._device.GetDeviceData(ctypes.sizeof(dinput.DIDEVICEOBJECTDATA),
+ ctypes.cast(ctypes.pointer(events),
+ dinput.LPDIDEVICEOBJECTDATA),
+ ctypes.byref(n_events),
+ 0)
+ except OSError:
+ return
+
+ for event in events[:n_events.value]:
+ index = event.dwOfs // 4
+ self.controls[index].value = event.dwData
+
+ def matches(self, guid_id, device_instance):
+ if (self.id_product_guid == guid_id and
+ self.id_name == device_instance.contents.tszProductName and
+ self._type == device_instance.contents.dwDevType & 0xff and
+ self._subtype == device_instance.contents.dwDevType & 0xff00):
+ return True
+
+ return False
+
+
+def _init_directinput():
+ _i_dinput = dinput.IDirectInput8()
+ module_handle = _kernel32.GetModuleHandleW(None)
+ dinput.DirectInput8Create(module_handle,
+ dinput.DIRECTINPUT_VERSION,
+ dinput.IID_IDirectInput8W,
+ ctypes.byref(_i_dinput),
+ None)
+
+ return _i_dinput
+
+
+_i_dinput = _init_directinput()
+
+GUID_DEVINTERFACE_HID = com.GUID(0x4D1E55B2, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30)
+
+
+class DIDeviceManager(EventDispatcher):
+ def __init__(self):
+ self.registered = False
+ self.window = None
+ self._devnotify = None
+ self.devices: List[DirectInputDevice] = []
+
+ if self.register_device_events(skip_warning=True):
+ self.set_current_devices()
+
+ def set_current_devices(self):
+ """Sets all currently discovered devices in the devices list.
+ Be careful when using this, as this creates new device objects. Should only be called on initialization of
+ the manager and if for some reason the window connection event isn't registered.
+ """
+ new_devices, _ = self._get_devices()
+ self.devices = new_devices
+
+ def register_device_events(self, skip_warning=False, window=None):
+ """Register the first OS Window to receive events of disconnect and connection of devices.
+ Returns True if events were successfully registered.
+ """
+ if not self.registered:
+ # If a specific window is not specified, find one.
+ if not window:
+ # Pick any open window, or the shadow window if no windows have been created yet.
+ window = pyglet.gl._shadow_window
+ if not window:
+ for window in pyglet.app.windows:
+ break
+
+ self.window = window
+ if self.window is not None:
+ dbi = DEV_BROADCAST_DEVICEINTERFACE()
+ dbi.dbcc_size = ctypes.sizeof(dbi)
+ dbi.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE
+ dbi.dbcc_classguid = GUID_DEVINTERFACE_HID
+
+ # Register we look for HID device unplug/plug.
+ self._devnotify = _user32.RegisterDeviceNotificationW(self.window._hwnd, ctypes.byref(dbi), DEVICE_NOTIFY_WINDOW_HANDLE)
+
+ self.window._event_handlers[WM_DEVICECHANGE] = self._event_devicechange
+ self.registered = True
+ self.window.push_handlers(self)
+ return True
+ else:
+ if not skip_warning:
+ warnings.warn("DirectInput Device Manager requires a window to receive device connection events.")
+
+ return False
+
+ def _unregister_device_events(self):
+ del self.window._event_handlers[WM_DEVICECHANGE]
+ _user32.UnregisterDeviceNotification(self._devnotify)
+ self.registered = False
+ self._devnotify = None
+
+ def on_close(self):
+ if self.registered:
+ self._unregister_device_events()
+
+ import pyglet.app
+ if len(pyglet.app.windows) != 0:
+ # At this point the closed windows aren't removed from the app.windows list. Check for non-current window.
+ for existing_window in pyglet.app.windows:
+ if existing_window != self.window:
+ self.register_device_events(skip_warning=True, window=existing_window)
+ return
+
+ self.window = None
+
+ def __del__(self):
+ if self.registered:
+ self._unregister_device_events()
+
+ def _get_devices(self, display=None):
+ """Enumerate all the devices on the system.
+ Returns two values: new devices, missing devices"""
+ _missing_devices = list(self.devices)
+ _new_devices = []
+ _xinput_devices = []
+
+ if not pyglet.options["win32_disable_xinput"]:
+ try:
+ from pyglet.input.win32.xinput import get_xinput_guids
+ _xinput_devices = get_xinput_guids()
+ except ImportError:
+ pass
+
+ def _device_enum(device_instance, arg): # DIDEVICEINSTANCE
+ guid_id = format(device_instance.contents.guidProduct.Data1, "08x")
+ # Only XInput should handle XInput compatible devices if enabled. Filter them out.
+ if guid_id in _xinput_devices:
+ return dinput.DIENUM_CONTINUE
+
+ # Check if device already exists.
+ for dev in list(_missing_devices):
+ if dev.matches(guid_id, device_instance):
+ _missing_devices.remove(dev)
+ return dinput.DIENUM_CONTINUE
+
+ device = dinput.IDirectInputDevice8()
+ _i_dinput.CreateDevice(device_instance.contents.guidInstance, ctypes.byref(device), None)
+ di_dev = DirectInputDevice(display, device, device_instance.contents)
+
+ _new_devices.append(di_dev)
+ return dinput.DIENUM_CONTINUE
+
+ _i_dinput.EnumDevices(dinput.DI8DEVCLASS_ALL,
+ dinput.LPDIENUMDEVICESCALLBACK(_device_enum),
+ None,
+ dinput.DIEDFL_ATTACHEDONLY)
+ return _new_devices, _missing_devices
+
+ def _recheck_devices(self):
+ new_devices, missing_devices = self._get_devices()
+ if new_devices:
+ self.devices.extend(new_devices)
+ for device in new_devices:
+ self.dispatch_event('on_connect', device)
+
+ if missing_devices:
+ for device in missing_devices:
+ self.devices.remove(device)
+ self.dispatch_event('on_disconnect', device)
+
+ def _event_devicechange(self, msg, wParam, lParam):
+ if lParam == 0:
+ return
+
+ if wParam == DBT_DEVICEARRIVAL or wParam == DBT_DEVICEREMOVECOMPLETE:
+ hdr_ptr = ctypes.cast(lParam, ctypes.POINTER(DEV_BROADCAST_HDR))
+ if hdr_ptr.contents.dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE:
+ # Need to call this outside the generate OS event to prevent COM deadlock.
+ pyglet.app.platform_event_loop.post_event(self, '_recheck_devices')
+
+
+DIDeviceManager.register_event_type('on_connect')
+DIDeviceManager.register_event_type('on_disconnect')
+DIDeviceManager.register_event_type('_recheck_devices') # Not to be used by subclasses!
+
+_di_manager = DIDeviceManager()
+
+
+class DIControllerManager(ControllerManager):
+
+ def __init__(self, display=None):
+ self._display = display
+ self._controllers: Dict[DirectInputDevice, base.Controller] = {}
+
+ for device in _di_manager.devices:
+ self._add_controller(device)
+
+ @_di_manager.event
+ def on_connect(di_device):
+ if di_device not in self._controllers:
+ if self._add_controller(di_device):
+ pyglet.app.platform_event_loop.post_event(self, 'on_connect', self._controllers[di_device])
+
+ @_di_manager.event
+ def on_disconnect(di_device):
+ if di_device in self._controllers:
+ _controller = self._controllers[di_device]
+ del self._controllers[di_device]
+ pyglet.app.platform_event_loop.post_event(self, 'on_disconnect', _controller)
+
+ def _add_controller(self, device: DirectInputDevice) -> Optional[base.Controller]:
+ controller = _create_controller(device)
+ if controller:
+ self._controllers[device] = controller
+ return controller
+
+ return None
+
+ def get_controllers(self):
+ if not _di_manager.registered:
+ _di_manager.register_device_events()
+ _di_manager.set_current_devices()
+
+ return list(self._controllers.values())
+
+
+def get_devices(display=None):
+ _init_directinput()
+ _devices = []
+ _xinput_devices = []
+
+ if not pyglet.options["win32_disable_xinput"]:
+ try:
+ from pyglet.input.win32.xinput import get_xinput_guids
+ _xinput_devices = get_xinput_guids()
+ except ImportError:
+ pass
+
+ def _device_enum(device_instance, arg):
+ guid_id = format(device_instance.contents.guidProduct.Data1, "08x")
+ # Only XInput should handle DirectInput devices if enabled. Filter them out.
+ if guid_id in _xinput_devices:
+ # Log somewhere?
+ return dinput.DIENUM_CONTINUE
+
+ device = dinput.IDirectInputDevice8()
+ _i_dinput.CreateDevice(device_instance.contents.guidInstance, ctypes.byref(device), None)
+ _devices.append(DirectInputDevice(display, device, device_instance.contents))
+ return dinput.DIENUM_CONTINUE
+
+ _i_dinput.EnumDevices(dinput.DI8DEVCLASS_ALL,
+ dinput.LPDIENUMDEVICESCALLBACK(_device_enum),
+ None,
+ dinput.DIEDFL_ATTACHEDONLY)
+ return _devices
+
+
+def _create_controller(device):
+ mapping = get_mapping(device.get_guid())
+ if device._type in (dinput.DI8DEVTYPE_JOYSTICK, dinput.DI8DEVTYPE_1STPERSON, dinput.DI8DEVTYPE_GAMEPAD):
+ if mapping is not None:
+ return base.Controller(device, mapping)
+ else:
+ warnings.warn(f"Warning: {device} (GUID: {device.get_guid()}) "
+ f"has no controller mappings. Update the mappings in the Controller DB.")
+
+
+def _create_joystick(device):
+ if device._type in (dinput.DI8DEVTYPE_JOYSTICK,
+ dinput.DI8DEVTYPE_1STPERSON,
+ dinput.DI8DEVTYPE_GAMEPAD,
+ dinput.DI8DEVTYPE_SUPPLEMENTAL):
+ return base.Joystick(device)
+
+
+def get_joysticks(display=None):
+ if not _di_manager.registered:
+ _di_manager.register_device_events()
+ _di_manager.set_current_devices()
+
+ return [joystick for joystick in
+ [_create_joystick(device) for device in _di_manager.devices]
+ if joystick is not None]
+
+
+def get_controllers(display=None):
+ if not _di_manager.registered:
+ _di_manager.register_device_events()
+ _di_manager.set_current_devices()
+
+ return [controller for controller in
+ [_create_controller(device) for device in _di_manager.devices]
+ if controller is not None]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/win32/wintab.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/win32/wintab.py
new file mode 100644
index 0000000000000000000000000000000000000000..e4890e109f53a3d904e3874f4e97e7c8e31aa03c
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/win32/wintab.py
@@ -0,0 +1,401 @@
+import ctypes
+from collections import defaultdict
+import pyglet
+from pyglet.input.base import DeviceOpenException
+from pyglet.input.base import Tablet, TabletCanvas
+from pyglet.libs.win32 import libwintab as wintab
+from pyglet.util import debug_print
+
+_debug = debug_print('debug_input')
+
+lib = wintab.lib
+
+
+def wtinfo(category, index, buffer):
+ size = lib.WTInfoW(category, index, None)
+ assert size <= ctypes.sizeof(buffer)
+ lib.WTInfoW(category, index, ctypes.byref(buffer))
+ return buffer
+
+
+def wtinfo_string(category, index):
+ size = lib.WTInfoW(category, index, None)
+ buffer = ctypes.create_unicode_buffer(size)
+ lib.WTInfoW(category, index, buffer)
+ return buffer.value
+
+
+def wtinfo_uint(category, index):
+ buffer = wintab.UINT()
+ lib.WTInfoW(category, index, ctypes.byref(buffer))
+ return buffer.value
+
+
+def wtinfo_word(category, index):
+ buffer = wintab.WORD()
+ lib.WTInfoW(category, index, ctypes.byref(buffer))
+ return buffer.value
+
+
+def wtinfo_dword(category, index):
+ buffer = wintab.DWORD()
+ lib.WTInfoW(category, index, ctypes.byref(buffer))
+ return buffer.value
+
+
+def wtinfo_wtpkt(category, index):
+ buffer = wintab.WTPKT()
+ lib.WTInfoW(category, index, ctypes.byref(buffer))
+ return buffer.value
+
+
+def wtinfo_bool(category, index):
+ buffer = wintab.BOOL()
+ lib.WTInfoW(category, index, ctypes.byref(buffer))
+ return bool(buffer.value)
+
+
+class WintabTablet(Tablet):
+ def __init__(self, index):
+ self._device = wintab.WTI_DEVICES + index
+ self.name = wtinfo_string(self._device, wintab.DVC_NAME).strip()
+ self.id = wtinfo_string(self._device, wintab.DVC_PNPID)
+
+ hardware = wtinfo_uint(self._device, wintab.DVC_HARDWARE)
+ # phys_cursors = hardware & wintab.HWC_PHYSID_CURSORS
+
+ n_cursors = wtinfo_uint(self._device, wintab.DVC_NCSRTYPES)
+ first_cursor = wtinfo_uint(self._device, wintab.DVC_FIRSTCSR)
+
+ self.pressure_axis = wtinfo(self._device, wintab.DVC_NPRESSURE, wintab.AXIS())
+
+ self.cursors = []
+ self._cursor_map = {}
+
+ for i in range(n_cursors):
+ cursor = WintabTabletCursor(self, i + first_cursor)
+ if not cursor.bogus:
+ self.cursors.append(cursor)
+ self._cursor_map[i + first_cursor] = cursor
+
+ def open(self, window):
+ return WintabTabletCanvas(self, window)
+
+
+class WintabTabletCanvas(TabletCanvas):
+ override_keys = False
+
+ def __init__(self, device, window, msg_base=wintab.WT_DEFBASE):
+ super(WintabTabletCanvas, self).__init__(window)
+
+ self.device = device
+ self.msg_base = msg_base
+
+ # Get the extension masks available. Only need to do this once.
+ global _extension_masks
+ if not _extension_masks:
+ _extension_masks = get_extension_masks()
+
+ # Just use system context, for similarity w/ os x and xinput.
+ # WTI_DEFCONTEXT detaches mouse from tablet, which is nice, but not
+ # possible on os x afiak.
+ self.context_info = context_info = wintab.LOGCONTEXT()
+ wtinfo(wintab.WTI_DEFSYSCTX, 0, context_info)
+ context_info.lcMsgBase = msg_base
+ context_info.lcOptions |= wintab.CXO_MESSAGES
+
+ # If you change this, change definition of PACKET also.
+ context_info.lcPktData = (
+ wintab.PK_CHANGED | wintab.PK_CURSOR | wintab.PK_BUTTONS |
+ wintab.PK_X | wintab.PK_Y | wintab.PK_Z |
+ wintab.PK_NORMAL_PRESSURE | wintab.PK_TANGENT_PRESSURE |
+ wintab.PK_ORIENTATION) | _extension_masks
+ context_info.lcPktMode = 0 # All absolute (PACKETMODE)
+
+ self._context = lib.WTOpenW(window._hwnd, ctypes.byref(context_info), True)
+ if not self._context:
+ raise DeviceOpenException("Couldn't open tablet context")
+
+ window._event_handlers[msg_base + wintab.WT_PACKET] = self._event_wt_packet
+ window._event_handlers[msg_base + wintab.WT_PROXIMITY] = self._event_wt_proximity
+
+ if _extension_masks:
+ window._event_handlers[msg_base + wintab.WT_PACKETEXT] = self._event_wt_packetext
+
+ self._current_cursor = None
+ self._pressure_scale = device.pressure_axis.get_scale()
+ self._pressure_bias = device.pressure_axis.get_bias()
+
+ self.express_keys = defaultdict(lambda: defaultdict(bool)) # [control_id][location_id]
+ self.express_key_ct = 0
+ self.touchrings = [] # Not currently implemented.
+ self.touchstrips = [] # Not currently implemented.
+
+ # Override test
+ for tablet_id in range(get_tablet_count()):
+ control_count = self.extension_get(wintab.WTX_EXPKEYS2, tablet_id, 0, 0,
+ wintab.TABLET_PROPERTY_CONTROLCOUNT)
+ self.express_key_ct = control_count
+ assert _debug(f"Controls Found: {control_count}")
+ if self.override_keys is True:
+ for control_id in range(control_count):
+ function_count = self.extension_get(wintab.WTX_EXPKEYS2, tablet_id, control_id, 0,
+ wintab.TABLET_PROPERTY_FUNCCOUNT)
+ for function_id in range(function_count):
+ self.extension_set(wintab.WTX_EXPKEYS2, tablet_id, control_id, function_id,
+ wintab.TABLET_PROPERTY_OVERRIDE, wintab.BOOL(True))
+
+ def extension_get(self, extension, tablet_id, control_id, function_id, property_id, value_type=wintab.UINT):
+ prop = wintab.EXTPROPERTY()
+
+ prop.version = 0
+ prop.tabletIndex = tablet_id
+ prop.controlIndex = control_id
+ prop.functionIndex = function_id
+ prop.propertyID = property_id
+ prop.reserved = 0
+ prop.dataSize = ctypes.sizeof(value_type)
+
+ success = lib.WTExtGet(self._context, extension, ctypes.byref(prop))
+ if success:
+ return ctypes.cast(prop.data, ctypes.POINTER(value_type)).contents.value
+
+ return 0
+
+ def extension_set(self, extension, tablet_id, control_id, function_id, property_id, value):
+ prop = wintab.EXTPROPERTY()
+ prop.version = 0
+ prop.tabletIndex = tablet_id
+ prop.controlIndex = control_id
+ prop.functionIndex = function_id
+ prop.propertyID = property_id
+ prop.reserved = 0
+ prop.dataSize = ctypes.sizeof(value)
+ prop.data[0] = value.value
+
+ success = lib.WTExtSet(self._context, extension, ctypes.byref(prop))
+ if success:
+ return True
+
+ return False
+
+ def close(self):
+ lib.WTClose(self._context)
+ self._context = None
+
+ del self.window._event_handlers[self.msg_base + wintab.WT_PACKET]
+ del self.window._event_handlers[self.msg_base + wintab.WT_PROXIMITY]
+
+ if _extension_masks:
+ del self.window._event_handlers[self.msg_base + wintab.WT_PACKETEXT]
+
+ def _set_current_cursor(self, cursor_type):
+ if self._current_cursor:
+ self.dispatch_event('on_leave', self._current_cursor)
+
+ self._current_cursor = self.device._cursor_map.get(cursor_type, None)
+
+ if self._current_cursor:
+ self.dispatch_event('on_enter', self._current_cursor)
+
+ @pyglet.window.win32.Win32EventHandler(0)
+ def _event_wt_packet(self, msg, wParam, lParam):
+ if lParam != self._context:
+ return
+
+ packet = wintab.PACKET()
+ if lib.WTPacket(self._context, wParam, ctypes.byref(packet)) == 0:
+ return
+
+ if not packet.pkChanged:
+ return
+
+ window_x, window_y = self.window.get_location() # TODO cache on window
+ window_y = self.window.screen.height - window_y - self.window.height
+ x = packet.pkX - window_x
+ y = packet.pkY - window_y
+ pressure = (packet.pkNormalPressure + self._pressure_bias) * self._pressure_scale
+
+ if self._current_cursor is None:
+ self._set_current_cursor(packet.pkCursor)
+
+ self.dispatch_event('on_motion', self._current_cursor, x, y, pressure, 0., 0., packet.pkButtons)
+
+ @pyglet.window.win32.Win32EventHandler(0)
+ def _event_wt_packetext(self, msg, wParam, lParam):
+ packet = wintab.PACKETEXT()
+ if lib.WTPacket(lParam, wParam, ctypes.byref(packet)) == 0:
+ return
+
+ # Proper context exists in the packet, not the lParam.
+ if packet.pkBase.nContext == self._context:
+ if packet.pkExpKeys.nControl < self.express_key_ct:
+ current_state = self.express_keys[packet.pkExpKeys.nControl][packet.pkExpKeys.nLocation]
+ new_state = bool(packet.pkExpKeys.nState)
+ if current_state != new_state:
+ event_type = "on_express_key_press" if new_state else "on_express_key_release"
+
+ self.express_keys[packet.pkExpKeys.nControl][packet.pkExpKeys.nLocation] = new_state
+
+ self.dispatch_event(event_type, packet.pkExpKeys.nControl, packet.pkExpKeys.nLocation)
+
+ @pyglet.window.win32.Win32EventHandler(0)
+ def _event_wt_proximity(self, msg, wParam, lParam):
+ if wParam != self._context:
+ return
+
+ if not lParam & 0xffff0000:
+ # Not a hardware proximity event
+ return
+
+ if not lParam & 0xffff:
+ # Going out
+ self.dispatch_event('on_leave', self._current_cursor)
+
+ # If going in, proximity event will be generated by next event, which
+ # can actually grab a cursor id.
+ self._current_cursor = None
+
+ def on_express_key_press(self, control_id: int, location_id: int):
+ """An event called when an ExpressKey is pressed down.
+
+ :Parameters:
+ `control_id` : int
+ Zero-based index number given to the assigned key by the driver.
+ The same control_id may exist in multiple locations, which the location_id is used to differentiate.
+ `location_id: int
+ Zero-based index indicating side of tablet where control id was found.
+ Some tablets may have clusters of ExpressKey's on various areas of the tablet.
+ (0 = left, 1 = right, 2 = top, 3 = bottom, 4 = transducer).
+
+ :event:
+ """
+
+ def on_express_key_release(self, control_id: int, location_id: int):
+ """An event called when an ExpressKey is released.
+
+ :Parameters:
+ `control_id` : int
+ Zero-based index number given to the assigned key by the driver.
+ The same control_id may exist in multiple locations, which the location_id is used to differentiate.
+ `location_id: int
+ Zero-based index indicating side of tablet where control id was found.
+ Some tablets may have clusters of ExpressKey's on various areas of the tablet.
+ (0 = left, 1 = right, 2 = top, 3 = bottom, 4 = transducer).
+
+ :event:
+ """
+
+
+WintabTabletCanvas.register_event_type('on_express_key_press')
+WintabTabletCanvas.register_event_type('on_express_key_release')
+
+
+class WintabTabletCursor:
+ def __init__(self, device, index):
+ self.device = device
+ self._cursor = wintab.WTI_CURSORS + index
+
+ self.name = wtinfo_string(self._cursor, wintab.CSR_NAME).strip()
+ self.active = wtinfo_bool(self._cursor, wintab.CSR_ACTIVE)
+ pktdata = wtinfo_wtpkt(self._cursor, wintab.CSR_PKTDATA)
+
+ # A whole bunch of cursors are reported by the driver, but most of
+ # them are hogwash. Make sure a cursor has at least X and Y data
+ # before adding it to the device.
+ self.bogus = not (pktdata & wintab.PK_X and pktdata & wintab.PK_Y)
+ if self.bogus:
+ return
+
+ self.id = (wtinfo_dword(self._cursor, wintab.CSR_TYPE) << 32) | \
+ wtinfo_dword(self._cursor, wintab.CSR_PHYSID)
+
+ def __repr__(self):
+ return 'WintabCursor(%r)' % self.name
+
+
+def get_spec_version():
+ spec_version = wtinfo_word(wintab.WTI_INTERFACE, wintab.IFC_SPECVERSION)
+ return spec_version
+
+
+def get_interface_name():
+ interface_name = wtinfo_string(wintab.WTI_INTERFACE, wintab.IFC_WINTABID)
+ return interface_name
+
+
+def get_implementation_version():
+ impl_version = wtinfo_word(wintab.WTI_INTERFACE, wintab.IFC_IMPLVERSION)
+ return impl_version
+
+
+def extension_index(ext):
+ """Check if a particular extension exists within the driver."""
+ exists = True
+ i = 0
+ index = 0xFFFFFFFF
+
+ while exists:
+ tag = wintab.UINT()
+ exists = lib.WTInfoW(wintab.WTI_EXTENSIONS + i, wintab.EXT_TAG, ctypes.byref(tag))
+ if tag.value == ext:
+ index = i
+ break
+
+ i += 1
+
+ if index != 0xFFFFFFFF:
+ return index
+
+ return None
+
+
+def get_extension_masks():
+ """Determine which extension support is available by getting the masks."""
+ masks = 0
+ tr_idx = extension_index(wintab.WTX_TOUCHRING)
+ if tr_idx is not None:
+ assert _debug("Touchring support found")
+ masks |= wtinfo_uint(wintab.WTI_EXTENSIONS + tr_idx, wintab.EXT_MASK)
+ else:
+ assert _debug("Touchring extension not found.")
+
+ ts_idx = extension_index(wintab.WTX_TOUCHSTRIP)
+ if ts_idx is not None:
+ assert _debug("Touchstrip support found.")
+ masks |= wtinfo_uint(wintab.WTI_EXTENSIONS + ts_idx, wintab.EXT_MASK)
+ else:
+ assert _debug("Touchstrip extension not found.")
+
+ expkeys_idx = extension_index(wintab.WTX_EXPKEYS2)
+ if expkeys_idx is not None:
+ assert _debug("ExpressKey support found.")
+ masks |= wtinfo_uint(wintab.WTI_EXTENSIONS + expkeys_idx, wintab.EXT_MASK)
+ else:
+ assert _debug("ExpressKey extension not found.")
+
+ return masks
+
+
+def get_tablet_count():
+ """Return just the number of current devices."""
+ spec_version = get_spec_version()
+ assert _debug(f"Wintab Version: {spec_version}")
+ if spec_version < 0x101:
+ return 0
+
+ n_devices = wtinfo_uint(wintab.WTI_INTERFACE, wintab.IFC_NDEVICES)
+ return n_devices
+
+
+_extension_masks = None
+
+
+def get_tablets(display=None):
+ # Require spec version 1.1 or greater
+ n_devices = get_tablet_count()
+ if not n_devices:
+ return []
+
+ devices = [WintabTablet(i) for i in range(n_devices)]
+ return devices
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/win32/xinput.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/win32/xinput.py
new file mode 100644
index 0000000000000000000000000000000000000000..0e41e6b33f9bcfa6f24db8e9040c2380c7754b1b
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/input/win32/xinput.py
@@ -0,0 +1,643 @@
+import time
+import weakref
+import threading
+
+import pyglet
+
+from pyglet.libs.win32 import com
+from pyglet.event import EventDispatcher
+from pyglet.libs.win32.types import *
+from pyglet.libs.win32 import _ole32 as ole32, _oleaut32 as oleaut32
+from pyglet.libs.win32.constants import CLSCTX_INPROC_SERVER
+from pyglet.input.base import Device, Controller, Button, AbsoluteAxis, ControllerManager
+
+
+for library_name in ['xinput1_4', 'xinput9_1_0', 'xinput1_3']:
+ try:
+ lib = ctypes.windll.LoadLibrary(library_name)
+ break
+ except OSError:
+ continue
+else:
+ raise OSError('Could not import XInput')
+
+
+XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE = 7849
+XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE = 8689
+XINPUT_GAMEPAD_TRIGGER_THRESHOLD = 30
+
+BATTERY_DEVTYPE_GAMEPAD = 0x00
+BATTERY_DEVTYPE_HEADSET = 0x01
+BATTERY_TYPE_DISCONNECTED = 0x00
+BATTERY_TYPE_WIRED = 0x01
+BATTERY_TYPE_ALKALINE = 0x02
+BATTERY_TYPE_NIMH = 0x03
+BATTERY_TYPE_UNKNOWN = 0xFF
+
+BATTERY_LEVEL_EMPTY = 0x00
+BATTERY_LEVEL_LOW = 0x01
+BATTERY_LEVEL_MEDIUM = 0x02
+BATTERY_LEVEL_FULL = 0x03
+
+XINPUT_GAMEPAD_DPAD_UP = 0x0001
+XINPUT_GAMEPAD_DPAD_DOWN = 0x0002
+XINPUT_GAMEPAD_DPAD_LEFT = 0x0004
+XINPUT_GAMEPAD_DPAD_RIGHT = 0x0008
+XINPUT_GAMEPAD_START = 0x0010
+XINPUT_GAMEPAD_BACK = 0x0020
+XINPUT_GAMEPAD_LEFT_THUMB = 0x0040
+XINPUT_GAMEPAD_RIGHT_THUMB = 0x0080
+XINPUT_GAMEPAD_LEFT_SHOULDER = 0x0100
+XINPUT_GAMEPAD_RIGHT_SHOULDER = 0x0200
+XINPUT_GAMEPAD_GUIDE = 0x0400
+XINPUT_GAMEPAD_A = 0x1000
+XINPUT_GAMEPAD_B = 0x2000
+XINPUT_GAMEPAD_X = 0x4000
+XINPUT_GAMEPAD_Y = 0x8000
+
+XINPUT_KEYSTROKE_KEYDOWN = 0x0001
+XINPUT_KEYSTROKE_KEYUP = 0x0002
+XINPUT_KEYSTROKE_REPEAT = 0x0004
+
+XINPUT_DEVTYPE_GAMEPAD = 0x01
+XINPUT_DEVSUBTYPE_GAMEPAD = 0x01
+XINPUT_DEVSUBTYPE_WHEEL = 0x02
+XINPUT_DEVSUBTYPE_ARCADE_STICK = 0x03
+XINPUT_DEVSUBTYPE_FLIGHT_SICK = 0x04
+XINPUT_DEVSUBTYPE_DANCE_PAD = 0x05
+XINPUT_DEVSUBTYPE_GUITAR = 0x06
+XINPUT_DEVSUBTYPE_DRUM_KIT = 0x08
+
+VK_PAD_A = 0x5800
+VK_PAD_B = 0x5801
+VK_PAD_X = 0x5802
+VK_PAD_Y = 0x5803
+VK_PAD_RSHOULDER = 0x5804
+VK_PAD_LSHOULDER = 0x5805
+VK_PAD_LTRIGGER = 0x5806
+VK_PAD_RTRIGGER = 0x5807
+VK_PAD_DPAD_UP = 0x5810
+VK_PAD_DPAD_DOWN = 0x5811
+VK_PAD_DPAD_LEFT = 0x5812
+VK_PAD_DPAD_RIGHT = 0x5813
+VK_PAD_START = 0x5814
+VK_PAD_BACK = 0x5815
+VK_PAD_LTHUMB_PRESS = 0x5816
+VK_PAD_RTHUMB_PRESS = 0x5817
+VK_PAD_LTHUMB_UP = 0x5820
+VK_PAD_LTHUMB_DOWN = 0x5821
+VK_PAD_LTHUMB_RIGHT = 0x5822
+VK_PAD_LTHUMB_LEFT = 0x5823
+VK_PAD_LTHUMB_UPLEFT = 0x5824
+VK_PAD_LTHUMB_UPRIGHT = 0x5825
+VK_PAD_LTHUMB_DOWNRIGHT = 0x5826
+VK_PAD_LTHUMB_DOWNLEFT = 0x5827
+VK_PAD_RTHUMB_UP = 0x5830
+VK_PAD_RTHUMB_DOWN = 0x5831
+VK_PAD_RTHUMB_RIGHT = 0x5832
+VK_PAD_RTHUMB_LEFT = 0x5833
+VK_PAD_RTHUMB_UPLEFT = 0x5834
+VK_PAD_RTHUMB_UPRIGHT = 0x5835
+VK_PAD_RTHUMB_DOWNRIGHT = 0x5836
+VK_PAD_RTHUMB_DOWNLEFT = 0x5837
+
+XUSER_MAX_COUNT = 4 # Cannot go over this number.
+XUSER_INDEX_ANY = 0x000000FF
+
+
+ERROR_DEVICE_NOT_CONNECTED = 1167
+ERROR_EMPTY = 4306
+ERROR_SUCCESS = 0
+
+
+class XINPUT_GAMEPAD(Structure):
+ _fields_ = [
+ ('wButtons', WORD),
+ ('bLeftTrigger', UBYTE),
+ ('bRightTrigger', UBYTE),
+ ('sThumbLX', SHORT),
+ ('sThumbLY', SHORT),
+ ('sThumbRX', SHORT),
+ ('sThumbRY', SHORT),
+ ]
+
+
+class XINPUT_STATE(Structure):
+ _fields_ = [
+ ('dwPacketNumber', DWORD),
+ ('Gamepad', XINPUT_GAMEPAD)
+ ]
+
+
+class XINPUT_VIBRATION(Structure):
+ _fields_ = [
+ ("wLeftMotorSpeed", WORD),
+ ("wRightMotorSpeed", WORD),
+ ]
+
+
+class XINPUT_CAPABILITIES(Structure):
+ _fields_ = [
+ ('Type', BYTE),
+ ('SubType', BYTE),
+ ('Flags', WORD),
+ ('Gamepad', XINPUT_GAMEPAD),
+ ('Vibration', XINPUT_VIBRATION)
+ ]
+
+
+class XINPUT_BATTERY_INFORMATION(Structure):
+ _fields_ = [
+ ("BatteryType", BYTE),
+ ("BatteryLevel", BYTE),
+ ]
+
+
+class XINPUT_CAPABILITIES_EX(Structure):
+ _fields_ = [
+ ('Capabilities', XINPUT_CAPABILITIES),
+ ('vendorId', WORD),
+ ('productId', WORD),
+ ('revisionId', WORD),
+ ('a4', DWORD)
+ ]
+
+
+if library_name == "xinput1_4":
+ # Only available for 1.4+
+ XInputGetBatteryInformation = lib.XInputGetBatteryInformation
+ XInputGetBatteryInformation.argtypes = [DWORD, BYTE, POINTER(XINPUT_BATTERY_INFORMATION)]
+ XInputGetBatteryInformation.restype = DWORD
+
+ XInputGetState = lib[100]
+ XInputGetState.restype = DWORD
+ XInputGetState.argtypes = [DWORD, POINTER(XINPUT_STATE)]
+
+ # Hidden function
+ XInputGetCapabilities = lib[108]
+ XInputGetCapabilities.restype = DWORD
+ XInputGetCapabilities.argtypes = [DWORD, DWORD, DWORD, POINTER(XINPUT_CAPABILITIES_EX)]
+
+else:
+ XInputGetBatteryInformation = None
+
+ XInputGetState = lib.XInputGetState
+ XInputGetState.restype = DWORD
+ XInputGetState.argtypes = [DWORD, POINTER(XINPUT_STATE)]
+
+ XInputGetCapabilities = lib.XInputGetCapabilities
+ XInputGetCapabilities.restype = DWORD
+ XInputGetCapabilities.argtypes = [DWORD, DWORD, POINTER(XINPUT_CAPABILITIES)]
+
+
+XInputSetState = lib.XInputSetState
+XInputSetState.argtypes = [DWORD, POINTER(XINPUT_VIBRATION)]
+XInputSetState.restype = DWORD
+
+
+# wbemcli #################################################
+
+BSTR = LPCWSTR
+IWbemContext = c_void_p
+
+RPC_C_AUTHN_WINNT = 10
+RPC_C_AUTHZ_NONE = 0
+RPC_C_AUTHN_LEVEL_CALL = 0x03
+RPC_C_IMP_LEVEL_IMPERSONATE = 3
+EOAC_NONE = 0
+VT_BSTR = 8
+
+CLSID_WbemLocator = com.GUID(0x4590f811, 0x1d3a, 0x11d0, 0x89, 0x1f, 0x00, 0xaa, 0x00, 0x4b, 0x2e, 0x24)
+IID_IWbemLocator = com.GUID(0xdc12a687, 0x737f, 0x11cf, 0x88, 0x4d, 0x00, 0xaa, 0x00, 0x4b, 0x2e, 0x24)
+
+
+class IWbemClassObject(com.pIUnknown):
+ _methods_ = [
+ ('GetQualifierSet',
+ com.STDMETHOD()),
+ ('Get',
+ com.STDMETHOD(BSTR, LONG, POINTER(VARIANT), c_void_p, c_void_p))
+ # ... long, unneeded
+ ]
+
+
+class IEnumWbemClassObject(com.pIUnknown):
+ _methods_ = [
+ ('Reset',
+ com.STDMETHOD()),
+ ('Next',
+ com.STDMETHOD(LONG, ULONG, POINTER(IWbemClassObject), POINTER(ULONG))),
+ ('NextAsync',
+ com.STDMETHOD()),
+ ('Clone',
+ com.STDMETHOD()),
+ ('Skip',
+ com.STDMETHOD())
+ ]
+
+
+class IWbemServices(com.pIUnknown):
+ _methods_ = [
+ ('OpenNamespace',
+ com.STDMETHOD()),
+ ('CancelAsyncCall',
+ com.STDMETHOD()),
+ ('QueryObjectSink',
+ com.STDMETHOD()),
+ ('GetObject',
+ com.STDMETHOD()),
+ ('GetObjectAsync',
+ com.STDMETHOD()),
+ ('PutClass',
+ com.STDMETHOD()),
+ ('PutClassAsync',
+ com.STDMETHOD()),
+ ('DeleteClass',
+ com.STDMETHOD()),
+ ('DeleteClassAsync',
+ com.STDMETHOD()),
+ ('CreateClassEnum',
+ com.STDMETHOD()),
+ ('CreateClassEnumAsync',
+ com.STDMETHOD()),
+ ('PutInstance',
+ com.STDMETHOD()),
+ ('PutInstanceAsync',
+ com.STDMETHOD()),
+ ('DeleteInstance',
+ com.STDMETHOD()),
+ ('DeleteInstanceAsync',
+ com.STDMETHOD()),
+ ('CreateInstanceEnum',
+ com.STDMETHOD(BSTR, LONG, IWbemContext, POINTER(IEnumWbemClassObject))),
+ ('CreateInstanceEnumAsync',
+ com.STDMETHOD()),
+ # ... much more.
+ ]
+
+
+class IWbemLocator(com.pIUnknown):
+ _methods_ = [
+ ('ConnectServer',
+ com.STDMETHOD(BSTR, BSTR, BSTR, LONG, LONG, BSTR, IWbemContext, POINTER(IWbemServices))),
+ ]
+
+
+def get_xinput_guids():
+ """We iterate over all devices in the system looking for IG_ in the device ID, which indicates it's an
+ XInput device. Returns a list of strings containing pid/vid.
+ Monstrosity found at: https://docs.microsoft.com/en-us/windows/win32/xinput/xinput-and-directinput
+ """
+ guids_found = []
+
+ locator = IWbemLocator()
+ services = IWbemServices()
+ enum_devices = IEnumWbemClassObject()
+ devices = (IWbemClassObject * 20)()
+
+ ole32.CoCreateInstance(CLSID_WbemLocator, None, CLSCTX_INPROC_SERVER, IID_IWbemLocator, byref(locator))
+
+ name_space = BSTR("\\\\.\\root\\cimv2")
+ class_name = BSTR("Win32_PNPEntity")
+ device_id = BSTR("DeviceID")
+
+ # Connect to WMI
+ hr = locator.ConnectServer(name_space, None, None, 0, 0, None, None, byref(services))
+ if hr != 0:
+ return guids_found
+
+ # Switch security level to IMPERSONATE.
+ hr = ole32.CoSetProxyBlanket(services, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, None, RPC_C_AUTHN_LEVEL_CALL,
+ RPC_C_IMP_LEVEL_IMPERSONATE, None, EOAC_NONE)
+
+ if hr != 0:
+ return guids_found
+
+ hr = services.CreateInstanceEnum(class_name, 0, None, byref(enum_devices))
+
+ if hr != 0:
+ return guids_found
+
+ var = VARIANT()
+ oleaut32.VariantInit(byref(var))
+
+ while True:
+ returned = ULONG()
+ _hr = enum_devices.Next(10000, len(devices), devices, byref(returned))
+ if returned.value == 0:
+ break
+ for i in range(returned.value):
+ result = devices[i].Get(device_id, 0, byref(var), None, None)
+ if result == 0:
+ if var.vt == VT_BSTR and var.bstrVal != "":
+ if 'IG_' in var.bstrVal:
+ guid = var.bstrVal
+
+ pid_start = guid.index("PID_") + 4
+ dev_pid = guid[pid_start:pid_start + 4]
+
+ vid_start = guid.index("VID_") + 4
+ dev_vid = guid[vid_start:vid_start + 4]
+
+ sdl_guid = f"{dev_pid}{dev_vid}".lower()
+
+ if sdl_guid not in guids_found:
+ guids_found.append(sdl_guid)
+
+ oleaut32.VariantClear(byref(var))
+ return guids_found
+
+
+# #########################################################
+
+controller_api_to_pyglet = {
+ XINPUT_GAMEPAD_DPAD_UP: "dpup",
+ XINPUT_GAMEPAD_DPAD_DOWN: "dpdown",
+ XINPUT_GAMEPAD_DPAD_LEFT: "dpleft",
+ XINPUT_GAMEPAD_DPAD_RIGHT: "dpright",
+ XINPUT_GAMEPAD_START: "start",
+ XINPUT_GAMEPAD_BACK: "back",
+ XINPUT_GAMEPAD_GUIDE: "guide",
+ XINPUT_GAMEPAD_LEFT_THUMB: "leftstick",
+ XINPUT_GAMEPAD_RIGHT_THUMB: "rightstick",
+ XINPUT_GAMEPAD_LEFT_SHOULDER: "leftshoulder",
+ XINPUT_GAMEPAD_RIGHT_SHOULDER: "rightshoulder",
+ XINPUT_GAMEPAD_A: "a",
+ XINPUT_GAMEPAD_B: "b",
+ XINPUT_GAMEPAD_X: "x",
+ XINPUT_GAMEPAD_Y: "y",
+}
+
+
+class XInputDevice(Device):
+
+ def __init__(self, index, manager):
+ super().__init__(None, f"XInput{index}")
+ self.index = index
+ self._manager = weakref.proxy(manager)
+ self.connected = False
+
+ self.xinput_state = XINPUT_STATE()
+ self.packet_number = 0
+
+ self.vibration = XINPUT_VIBRATION()
+ self.weak_duration = None
+ self.strong_duration = None
+
+ self.controls = {
+ 'a': Button('a'),
+ 'b': Button('b'),
+ 'x': Button('x'),
+ 'y': Button('y'),
+ 'back': Button('back'),
+ 'start': Button('start'),
+ 'guide': Button('guide'),
+ 'leftshoulder': Button('leftshoulder'),
+ 'rightshoulder': Button('rightshoulder'),
+ 'leftstick': Button('leftstick'),
+ 'rightstick': Button('rightstick'),
+ 'dpup': Button('dpup'),
+ 'dpdown': Button('dpdown'),
+ 'dpleft': Button('dpleft'),
+ 'dpright': Button('dpright'),
+
+ 'leftx': AbsoluteAxis('leftx', -32768, 32768),
+ 'lefty': AbsoluteAxis('lefty', -32768, 32768),
+ 'rightx': AbsoluteAxis('rightx', -32768, 32768),
+ 'righty': AbsoluteAxis('righty', -32768, 32768),
+ 'lefttrigger': AbsoluteAxis('lefttrigger', 0, 255),
+ 'righttrigger': AbsoluteAxis('righttrigger', 0, 255)
+ }
+
+ def set_rumble_state(self):
+ XInputSetState(self.index, byref(self.vibration))
+
+ def get_controls(self):
+ return list(self.controls.values())
+
+ def get_guid(self):
+ return "XINPUTCONTROLLER"
+
+
+class XInputDeviceManager(EventDispatcher):
+
+ def __init__(self):
+ self.all_devices = [XInputDevice(i, self) for i in range(XUSER_MAX_COUNT)]
+ self._connected_devices = set()
+
+ for i in range(XUSER_MAX_COUNT):
+ device = self.all_devices[i]
+ if XInputGetState(i, byref(device.xinput_state)) == ERROR_DEVICE_NOT_CONNECTED:
+ continue
+ device.connected = True
+ self._connected_devices.add(i)
+
+ self._polling_rate = 0.016
+ self._detection_rate = 2.0
+ self._exit = threading.Event()
+ self._dev_lock = threading.Lock()
+ self._thread = threading.Thread(target=self._get_state, daemon=True)
+ self._thread.start()
+
+ def get_devices(self):
+ with self._dev_lock:
+ return [dev for dev in self.all_devices if dev.connected]
+
+ # Threaded method:
+ def _get_state(self):
+ xuser_max_count = set(range(XUSER_MAX_COUNT)) # {0, 1, 2, 3}
+ polling_rate = self._polling_rate
+ detect_rate = self._detection_rate
+ elapsed = 0.0
+
+ while not self._exit.is_set():
+ self._dev_lock.acquire()
+ elapsed += polling_rate
+
+ # Every few seconds check for new connections:
+ if elapsed >= detect_rate:
+ # Only check if not currently connected:
+ for i in xuser_max_count - self._connected_devices:
+ device = self.all_devices[i]
+ if XInputGetState(i, byref(device.xinput_state)) == ERROR_DEVICE_NOT_CONNECTED:
+ continue
+
+ # Found a new connection:
+ device.connected = True
+ self._connected_devices.add(i)
+ # Dispatch event in main thread:
+ pyglet.app.platform_event_loop.post_event(self, 'on_connect', device)
+
+ elapsed = 0.0
+
+ # At the set polling rate, update all connected and
+ # opened devices. Skip unopened devices to save CPU:
+ for i in self._connected_devices.copy():
+ device = self.all_devices[i]
+ result = XInputGetState(i, byref(device.xinput_state))
+
+ if result == ERROR_DEVICE_NOT_CONNECTED:
+ # Newly disconnected device:
+ if device.connected:
+ device.connected = False
+ device.close()
+ self._connected_devices.remove(i)
+ # Dispatch event in main thread:
+ pyglet.app.platform_event_loop.post_event(self, 'on_disconnect', device)
+ continue
+
+ elif result == ERROR_SUCCESS and device.is_open:
+
+ # Stop Rumble effects if a duration is set:
+ if device.weak_duration:
+ device.weak_duration -= polling_rate
+ if device.weak_duration <= 0:
+ device.weak_duration = None
+ device.vibration.wRightMotorSpeed = 0
+ device.set_rumble_state()
+ if device.strong_duration:
+ device.strong_duration -= polling_rate
+ if device.strong_duration <= 0:
+ device.strong_duration = None
+ device.vibration.wLeftMotorSpeed = 0
+ device.set_rumble_state()
+
+ # Don't update the Control values if XInput has no new input:
+ if device.xinput_state.dwPacketNumber == device.packet_number:
+ continue
+
+ for button, name in controller_api_to_pyglet.items():
+ device.controls[name].value = device.xinput_state.Gamepad.wButtons & button
+
+ device.controls['lefttrigger'].value = device.xinput_state.Gamepad.bLeftTrigger
+ device.controls['righttrigger'].value = device.xinput_state.Gamepad.bRightTrigger
+ device.controls['leftx'].value = device.xinput_state.Gamepad.sThumbLX
+ device.controls['lefty'].value = device.xinput_state.Gamepad.sThumbLY
+ device.controls['rightx'].value = device.xinput_state.Gamepad.sThumbRX
+ device.controls['righty'].value = device.xinput_state.Gamepad.sThumbRY
+
+ device.packet_number = device.xinput_state.dwPacketNumber
+
+ self._dev_lock.release()
+ time.sleep(polling_rate)
+
+ def on_connect(self, device):
+ """A device was connected."""
+
+ def on_disconnect(self, device):
+ """A device was disconnected"""
+
+
+XInputDeviceManager.register_event_type('on_connect')
+XInputDeviceManager.register_event_type('on_disconnect')
+
+
+_device_manager = XInputDeviceManager()
+
+
+class XInputController(Controller):
+
+ def _initialize_controls(self):
+
+ for button_name in controller_api_to_pyglet.values():
+ control = self.device.controls[button_name]
+ self._button_controls.append(control)
+ self._add_button(control, button_name)
+
+ for axis_name in "leftx", "lefty", "rightx", "righty", "lefttrigger", "righttrigger":
+ control = self.device.controls[axis_name]
+ self._axis_controls.append(control)
+ self._add_axis(control, axis_name)
+
+ def _add_axis(self, control, name):
+ tscale = 1.0 / (control.max - control.min)
+ scale = 2.0 / (control.max - control.min)
+ bias = -1.0 - control.min * scale
+
+ if name in ("lefttrigger", "righttrigger"):
+ @control.event
+ def on_change(value):
+ normalized_value = value * tscale
+ setattr(self, name, normalized_value)
+ self.dispatch_event('on_trigger_motion', self, name, normalized_value)
+
+ elif name in ("leftx", "lefty"):
+ @control.event
+ def on_change(value):
+ normalized_value = value * scale + bias
+ setattr(self, name, normalized_value)
+ self.dispatch_event('on_stick_motion', self, "leftstick", self.leftx, self.lefty)
+
+ elif name in ("rightx", "righty"):
+ @control.event
+ def on_change(value):
+ normalized_value = value * scale + bias
+ setattr(self, name, normalized_value)
+ self.dispatch_event('on_stick_motion', self, "rightstick", self.rightx, self.righty)
+
+ def _add_button(self, control, name):
+
+ if name in ("dpleft", "dpright", "dpup", "dpdown"):
+ @control.event
+ def on_change(value):
+ setattr(self, name, value)
+ self.dispatch_event('on_dpad_motion', self, self.dpleft, self.dpright, self.dpup, self.dpdown)
+ else:
+ @control.event
+ def on_change(value):
+ setattr(self, name, value)
+
+ @control.event
+ def on_press():
+ self.dispatch_event('on_button_press', self, name)
+
+ @control.event
+ def on_release():
+ self.dispatch_event('on_button_release', self, name)
+
+ def rumble_play_weak(self, strength=1.0, duration=0.5):
+ self.device.vibration.wRightMotorSpeed = int(max(min(1.0, strength), 0) * 0xFFFF)
+ self.device.weak_duration = duration
+ self.device.set_rumble_state()
+
+ def rumble_play_strong(self, strength=1.0, duration=0.5):
+ self.device.vibration.wLeftMotorSpeed = int(max(min(1.0, strength), 0) * 0xFFFF)
+ self.device.strong_duration = duration
+ self.device.set_rumble_state()
+
+ def rumble_stop_weak(self):
+ self.device.vibration.wRightMotorSpeed = 0
+ self.device.set_rumble_state()
+
+ def rumble_stop_strong(self):
+ self.device.vibration.wLeftMotorSpeed = 0
+ self.device.set_rumble_state()
+
+
+class XInputControllerManager(ControllerManager):
+
+ def __init__(self):
+ self._controllers = {}
+
+ for device in _device_manager.all_devices:
+ meta = {'name': device.name, 'guid': "XINPUTCONTROLLER"}
+ self._controllers[device] = XInputController(device, meta)
+
+ @_device_manager.event
+ def on_connect(xdevice):
+ self.dispatch_event('on_connect', self._controllers[xdevice])
+
+ @_device_manager.event
+ def on_disconnect(xdevice):
+ self.dispatch_event('on_disconnect', self._controllers[xdevice])
+
+ def get_controllers(self):
+ return [ctlr for ctlr in self._controllers.values() if ctlr.device.connected]
+
+
+def get_devices():
+ return _device_manager.get_devices()
+
+
+def get_controllers():
+ return [XInputController(device, {'name': device.name, 'guid': device.get_guid()}) for device in get_devices()]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/lib.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/lib.py
new file mode 100644
index 0000000000000000000000000000000000000000..d264fcfd795741c42a65ad27ec39d88de30bbfc3
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/lib.py
@@ -0,0 +1,324 @@
+"""Functions for loading dynamic libraries.
+
+These extend and correct ctypes functions.
+"""
+
+import os
+import re
+import sys
+
+import ctypes
+import ctypes.util
+
+import pyglet
+
+_debug_lib = pyglet.options['debug_lib']
+_debug_trace = pyglet.options['debug_trace']
+
+_is_pyglet_doc_run = getattr(sys, "is_pyglet_doc_run", False)
+
+if pyglet.options['search_local_libs']:
+ script_path = pyglet.resource.get_script_home()
+ cwd = os.getcwd()
+ _local_lib_paths = [script_path, os.path.join(script_path, 'lib'), os.path.join(cwd, 'lib')]
+ if pyglet.compat_platform == 'win32':
+ os.environ["PATH"] += os.pathsep + os.pathsep.join(_local_lib_paths)
+else:
+ _local_lib_paths = None
+
+
+class _TraceFunction:
+ def __init__(self, func):
+ self.__dict__['_func'] = func
+
+ def __str__(self):
+ return self._func.__name__
+
+ def __call__(self, *args, **kwargs):
+ return self._func(*args, **kwargs)
+
+ def __getattr__(self, name):
+ return getattr(self._func, name)
+
+ def __setattr__(self, name, value):
+ setattr(self._func, name, value)
+
+
+class _TraceLibrary:
+ def __init__(self, library):
+ self._library = library
+ print(library)
+
+ def __getattr__(self, name):
+ func = getattr(self._library, name)
+ f = _TraceFunction(func)
+ return f
+
+
+if _is_pyglet_doc_run:
+ class LibraryMock:
+ """Mock library used when generating documentation."""
+ def __getattr__(self, name):
+ return LibraryMock()
+
+ def __setattr__(self, name, value):
+ pass
+
+ def __call__(self, *args, **kwargs):
+ return LibraryMock()
+
+ def __rshift__(self, other):
+ return 0
+
+
+class LibraryLoader:
+
+ platform = pyglet.compat_platform
+ # this is only for library loading, don't include it in pyglet.platform
+ if platform == 'cygwin':
+ platform = 'win32'
+
+ def load_library(self, *names, **kwargs):
+ """Find and load a library.
+
+ More than one name can be specified, they will be tried in order.
+ Platform-specific library names (given as kwargs) are tried first.
+
+ Raises ImportError if library is not found.
+ """
+ if _is_pyglet_doc_run:
+ return LibraryMock()
+
+ if 'framework' in kwargs and self.platform == 'darwin':
+ return self.load_framework(kwargs['framework'])
+
+ if not names:
+ raise ImportError("No library name specified")
+
+ platform_names = kwargs.get(self.platform, [])
+ if isinstance(platform_names, str):
+ platform_names = [platform_names]
+ elif type(platform_names) is tuple:
+ platform_names = list(platform_names)
+
+ if self.platform.startswith('linux'):
+ for name in names:
+ libname = self.find_library(name)
+ platform_names.append(libname or f'lib{name}.so')
+
+ platform_names.extend(names)
+ for name in platform_names:
+ try:
+ lib = ctypes.cdll.LoadLibrary(name)
+ if _debug_lib:
+ print(name, self.find_library(name))
+ if _debug_trace:
+ lib = _TraceLibrary(lib)
+ return lib
+ except OSError as o:
+ path = self.find_library(name)
+ if path:
+ try:
+ lib = ctypes.cdll.LoadLibrary(path)
+ if _debug_lib:
+ print(path)
+ if _debug_trace:
+ lib = _TraceLibrary(lib)
+ return lib
+ except OSError:
+ pass
+ elif self.platform == "win32" and o.winerror != 126:
+ if _debug_lib:
+ print(f"Unexpected error loading library {name}: {str(o)}")
+
+ raise ImportError(f'Library "{names[0]}" not found.')
+
+ def find_library(self, name):
+ return ctypes.util.find_library(name)
+
+ @staticmethod
+ def load_framework(name):
+ raise RuntimeError("Can't load framework on this platform.")
+
+
+class MachOLibraryLoader(LibraryLoader):
+ def __init__(self):
+ if 'LD_LIBRARY_PATH' in os.environ:
+ self.ld_library_path = os.environ['LD_LIBRARY_PATH'].split(':')
+ else:
+ self.ld_library_path = []
+
+ if _local_lib_paths:
+ # search first for local libs
+ self.ld_library_path = _local_lib_paths + self.ld_library_path
+ os.environ['LD_LIBRARY_PATH'] = ':'.join(self.ld_library_path)
+
+ if 'DYLD_LIBRARY_PATH' in os.environ:
+ self.dyld_library_path = os.environ['DYLD_LIBRARY_PATH'].split(':')
+ else:
+ self.dyld_library_path = []
+
+ if 'DYLD_FALLBACK_LIBRARY_PATH' in os.environ:
+ self.dyld_fallback_library_path = os.environ['DYLD_FALLBACK_LIBRARY_PATH'].split(':')
+ else:
+ self.dyld_fallback_library_path = [os.path.expanduser('~/lib'), '/usr/local/lib', '/usr/lib']
+
+ def find_library(self, path):
+ """Implements the dylib search as specified in Apple documentation:
+
+ http://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryUsageGuidelines.html
+
+ Before commencing the standard search, the method first checks
+ the bundle's ``Frameworks`` directory if the application is running
+ within a bundle (OS X .app).
+ """
+
+ libname = os.path.basename(path)
+ search_path = []
+
+ if '.dylib' not in libname:
+ libname = 'lib' + libname + '.dylib'
+
+ # py2app support
+ if getattr(sys, 'frozen', None) == 'macosx_app' and 'RESOURCEPATH' in os.environ:
+ search_path.append(os.path.join(os.environ['RESOURCEPATH'],
+ '..',
+ 'Frameworks',
+ libname))
+
+ # conda support
+ if os.environ.get('CONDA_PREFIX', False):
+ search_path.append(os.path.join(os.environ['CONDA_PREFIX'], 'lib', libname))
+
+ # pyinstaller.py sets sys.frozen to True, and puts dylibs in
+ # Contents/macOS, which path pyinstaller puts in sys._MEIPASS
+ if getattr(sys, 'frozen', False) and getattr(sys, '_MEIPASS', None):
+ meipass = getattr(sys, '_MEIPASS')
+ search_path.append(os.path.join(meipass, libname))
+
+ # conda support
+ if os.environ.get('CONDA_PREFIX', False):
+ search_path.append(os.path.join(os.environ['CONDA_PREFIX'], 'lib', libname))
+
+ if '/' in path:
+ search_path.extend([os.path.join(p, libname) for p in self.dyld_library_path])
+ search_path.append(path)
+ search_path.extend([os.path.join(p, libname) for p in self.dyld_fallback_library_path])
+ else:
+ search_path.extend([os.path.join(p, libname) for p in self.ld_library_path])
+ search_path.extend([os.path.join(p, libname) for p in self.dyld_library_path])
+ search_path.append(path)
+ search_path.extend([os.path.join(p, libname) for p in self.dyld_fallback_library_path])
+
+ for path in search_path:
+ if os.path.exists(path):
+ return path
+
+ return None
+
+ @staticmethod
+ def load_framework(name):
+ path = ctypes.util.find_library(name)
+
+ # Hack for compatibility with macOS > 11.0
+ if path is None:
+ frameworks = {
+ 'AGL': '/System/Library/Frameworks/AGL.framework/AGL',
+ 'IOKit': '/System/Library/Frameworks/IOKit.framework/IOKit',
+ 'OpenAL': '/System/Library/Frameworks/OpenAL.framework/OpenAL',
+ 'OpenGL': '/System/Library/Frameworks/OpenGL.framework/OpenGL'
+ }
+ path = frameworks.get(name)
+
+ if path:
+ lib = ctypes.cdll.LoadLibrary(path)
+ if _debug_lib:
+ print(path)
+ if _debug_trace:
+ lib = _TraceLibrary(lib)
+ return lib
+
+ raise ImportError(f"Can't find framework {name}.")
+
+
+class LinuxLibraryLoader(LibraryLoader):
+ _ld_so_cache = None
+ _local_libs_cache = None
+
+ @staticmethod
+ def _find_libs(directories):
+ cache = {}
+ lib_re = re.compile(r'lib(.*)\.so(?:$|\.)')
+ for directory in directories:
+ try:
+ for file in os.listdir(directory):
+ match = lib_re.match(file)
+ if match:
+ # Index by filename
+ path = os.path.join(directory, file)
+ if file not in cache:
+ cache[file] = path
+ # Index by library name
+ library = match.group(1)
+ if library not in cache:
+ cache[library] = path
+ except OSError:
+ pass
+ return cache
+
+ def _create_ld_so_cache(self):
+ # Recreate search path followed by ld.so. This is going to be
+ # slow to build, and incorrect (ld.so uses ld.so.cache, which may
+ # not be up-to-date). Used only as fallback for distros without
+ # /sbin/ldconfig.
+ #
+ # We assume the DT_RPATH and DT_RUNPATH binary sections are omitted.
+
+ directories = []
+ try:
+ directories.extend(os.environ['LD_LIBRARY_PATH'].split(':'))
+ except KeyError:
+ pass
+
+ try:
+ with open('/etc/ld.so.conf') as fid:
+ directories.extend([directory.strip() for directory in fid])
+ except IOError:
+ pass
+
+ directories.extend(['/lib', '/usr/lib'])
+
+ self._ld_so_cache = self._find_libs(directories)
+
+ def find_library(self, path):
+
+ # search first for local libs
+ if _local_lib_paths:
+ if not self._local_libs_cache:
+ self._local_libs_cache = self._find_libs(_local_lib_paths)
+ if path in self._local_libs_cache:
+ return self._local_libs_cache[path]
+
+ # ctypes tries ldconfig, gcc and objdump. If none of these are
+ # present, we implement the ld-linux.so search path as described in
+ # the man page.
+
+ result = ctypes.util.find_library(path)
+
+ if result:
+ return result
+
+ if self._ld_so_cache is None:
+ self._create_ld_so_cache()
+
+ return self._ld_so_cache.get(path)
+
+
+if pyglet.compat_platform == 'darwin':
+ loader = MachOLibraryLoader()
+elif pyglet.compat_platform.startswith('linux'):
+ loader = LinuxLibraryLoader()
+else:
+ loader = LibraryLoader()
+
+load_library = loader.load_library
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/__init__.py
@@ -0,0 +1 @@
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..075f48532d4d6483a9095fc2e379df3796a3e26e
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/__init__.py
@@ -0,0 +1 @@
+from .cocoapy import *
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/cocoapy/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/cocoapy/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..165d832d3c5bee85df795a06af0e169a47949bbd
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/cocoapy/__init__.py
@@ -0,0 +1,37 @@
+# objective-ctypes
+#
+# Copyright (c) 2011, Phillip Nguyen
+# 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 objective-ctypes 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 HOLDER 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.
+
+from .runtime import objc, send_message, send_super
+from .runtime import get_selector
+from .runtime import ObjCClass, ObjCInstance, ObjCSubclass
+
+from .cocoatypes import *
+from .cocoalibs import *
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/cocoapy/cocoalibs.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/cocoapy/cocoalibs.py
new file mode 100644
index 0000000000000000000000000000000000000000..835156957974fdbdb29dd53012b25079b5cf2d9e
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/cocoapy/cocoalibs.py
@@ -0,0 +1,573 @@
+from ctypes import *
+from ctypes import util
+
+from .runtime import send_message, ObjCInstance
+from .cocoatypes import *
+
+######################################################################
+
+# CORE FOUNDATION
+lib = util.find_library('CoreFoundation')
+
+# Hack for compatibility with macOS > 11.0
+if lib is None:
+ lib = '/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation'
+
+cf = cdll.LoadLibrary(lib)
+
+kCFStringEncodingUTF8 = 0x08000100
+
+CFAllocatorRef = c_void_p
+CFStringEncoding = c_uint32
+
+cf.CFStringCreateWithCString.restype = c_void_p
+cf.CFStringCreateWithCString.argtypes = [CFAllocatorRef, c_char_p, CFStringEncoding]
+
+cf.CFRelease.restype = c_void_p
+cf.CFRelease.argtypes = [c_void_p]
+
+cf.CFStringGetLength.restype = CFIndex
+cf.CFStringGetLength.argtypes = [c_void_p]
+
+cf.CFStringGetMaximumSizeForEncoding.restype = CFIndex
+cf.CFStringGetMaximumSizeForEncoding.argtypes = [CFIndex, CFStringEncoding]
+
+cf.CFStringGetCString.restype = c_bool
+cf.CFStringGetCString.argtypes = [c_void_p, c_char_p, CFIndex, CFStringEncoding]
+
+cf.CFStringGetTypeID.restype = CFTypeID
+cf.CFStringGetTypeID.argtypes = []
+
+cf.CFAttributedStringCreate.restype = c_void_p
+cf.CFAttributedStringCreate.argtypes = [CFAllocatorRef, c_void_p, c_void_p]
+
+# Core Foundation type to Python type conversion functions
+
+def CFSTR(string):
+ return ObjCInstance(c_void_p(cf.CFStringCreateWithCString(
+ None, string.encode('utf8'), kCFStringEncodingUTF8)))
+
+# Other possible names for this method:
+# at, ampersat, arobe, apenstaartje (little monkey tail), strudel,
+# klammeraffe (spider monkey), little_mouse, arroba, sobachka (doggie)
+# malpa (monkey), snabel (trunk), papaki (small duck), afna (monkey),
+# kukac (caterpillar).
+def get_NSString(string):
+ """Autoreleased version of CFSTR"""
+ return CFSTR(string).autorelease()
+
+def cfstring_to_string(cfstring):
+ length = cf.CFStringGetLength(cfstring)
+ size = cf.CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8)
+ buffer = c_buffer(size + 1)
+ result = cf.CFStringGetCString(cfstring, buffer, len(buffer), kCFStringEncodingUTF8)
+ if result:
+ return str(buffer.value, 'utf-8')
+
+cf.CFDataCreate.restype = c_void_p
+cf.CFDataCreate.argtypes = [c_void_p, c_void_p, CFIndex]
+
+cf.CFDataGetBytes.restype = None
+cf.CFDataGetBytes.argtypes = [c_void_p, CFRange, c_void_p]
+
+cf.CFDataGetLength.restype = CFIndex
+cf.CFDataGetLength.argtypes = [c_void_p]
+
+cf.CFDictionaryGetValue.restype = c_void_p
+cf.CFDictionaryGetValue.argtypes = [c_void_p, c_void_p]
+
+cf.CFDictionaryAddValue.restype = None
+cf.CFDictionaryAddValue.argtypes = [c_void_p, c_void_p, c_void_p]
+
+cf.CFDictionaryCreateMutable.restype = c_void_p
+cf.CFDictionaryCreateMutable.argtypes = [CFAllocatorRef, CFIndex, c_void_p, c_void_p]
+
+cf.CFNumberCreate.restype = c_void_p
+cf.CFNumberCreate.argtypes = [CFAllocatorRef, CFNumberType, c_void_p]
+
+cf.CFNumberGetType.restype = CFNumberType
+cf.CFNumberGetType.argtypes = [c_void_p]
+
+cf.CFNumberGetValue.restype = c_ubyte
+cf.CFNumberGetValue.argtypes = [c_void_p, CFNumberType, c_void_p]
+
+cf.CFNumberGetTypeID.restype = CFTypeID
+cf.CFNumberGetTypeID.argtypes = []
+
+cf.CFGetTypeID.restype = CFTypeID
+cf.CFGetTypeID.argtypes = [c_void_p]
+
+# CFNumber.h
+kCFNumberSInt8Type = 1
+kCFNumberSInt16Type = 2
+kCFNumberSInt32Type = 3
+kCFNumberSInt64Type = 4
+kCFNumberFloat32Type = 5
+kCFNumberFloat64Type = 6
+kCFNumberCharType = 7
+kCFNumberShortType = 8
+kCFNumberIntType = 9
+kCFNumberLongType = 10
+kCFNumberLongLongType = 11
+kCFNumberFloatType = 12
+kCFNumberDoubleType = 13
+kCFNumberCFIndexType = 14
+kCFNumberNSIntegerType = 15
+kCFNumberCGFloatType = 16
+kCFNumberMaxType = 16
+
+def cfnumber_to_number(cfnumber):
+ """Convert CFNumber to python int or float."""
+ numeric_type = cf.CFNumberGetType(cfnumber)
+ cfnum_to_ctype = {kCFNumberSInt8Type:c_int8, kCFNumberSInt16Type:c_int16,
+ kCFNumberSInt32Type:c_int32, kCFNumberSInt64Type:c_int64,
+ kCFNumberFloat32Type:c_float, kCFNumberFloat64Type:c_double,
+ kCFNumberCharType:c_byte, kCFNumberShortType:c_short,
+ kCFNumberIntType:c_int, kCFNumberLongType:c_long,
+ kCFNumberLongLongType:c_longlong, kCFNumberFloatType:c_float,
+ kCFNumberDoubleType:c_double, kCFNumberCFIndexType:CFIndex,
+ kCFNumberCGFloatType:CGFloat}
+
+ if numeric_type in cfnum_to_ctype:
+ t = cfnum_to_ctype[numeric_type]
+ result = t()
+ if cf.CFNumberGetValue(cfnumber, numeric_type, byref(result)):
+ return result.value
+ else:
+ raise Exception('cfnumber_to_number: unhandled CFNumber type %d' % numeric_type)
+
+# Dictionary of cftypes matched to the method converting them to python values.
+known_cftypes = { cf.CFStringGetTypeID() : cfstring_to_string,
+ cf.CFNumberGetTypeID() : cfnumber_to_number
+ }
+
+def cftype_to_value(cftype):
+ """Convert a CFType into an equivalent python type.
+ The convertible CFTypes are taken from the known_cftypes
+ dictionary, which may be added to if another library implements
+ its own conversion methods."""
+ if not cftype:
+ return None
+ typeID = cf.CFGetTypeID(cftype)
+ if typeID in known_cftypes:
+ convert_function = known_cftypes[typeID]
+ return convert_function(cftype)
+ else:
+ return cftype
+
+cf.CFSetGetCount.restype = CFIndex
+cf.CFSetGetCount.argtypes = [c_void_p]
+
+cf.CFSetGetValues.restype = None
+# PyPy 1.7 is fine with 2nd arg as POINTER(c_void_p),
+# but CPython ctypes 1.1.0 complains, so just use c_void_p.
+cf.CFSetGetValues.argtypes = [c_void_p, c_void_p]
+
+def cfset_to_set(cfset):
+ """Convert CFSet to python set."""
+ count = cf.CFSetGetCount(cfset)
+ buffer = (c_void_p * count)()
+ cf.CFSetGetValues(cfset, byref(buffer))
+ return set([ cftype_to_value(c_void_p(buffer[i])) for i in range(count) ])
+
+cf.CFArrayGetCount.restype = CFIndex
+cf.CFArrayGetCount.argtypes = [c_void_p]
+
+cf.CFArrayGetValueAtIndex.restype = c_void_p
+cf.CFArrayGetValueAtIndex.argtypes = [c_void_p, CFIndex]
+
+def cfarray_to_list(cfarray):
+ """Convert CFArray to python list."""
+ count = cf.CFArrayGetCount(cfarray)
+ return [ cftype_to_value(c_void_p(cf.CFArrayGetValueAtIndex(cfarray, i)))
+ for i in range(count) ]
+
+
+kCFRunLoopDefaultMode = c_void_p.in_dll(cf, 'kCFRunLoopDefaultMode')
+
+cf.CFRunLoopGetCurrent.restype = c_void_p
+cf.CFRunLoopGetCurrent.argtypes = []
+
+cf.CFRunLoopGetMain.restype = c_void_p
+cf.CFRunLoopGetMain.argtypes = []
+
+######################################################################
+
+# APPLICATION KIT
+
+# Even though we don't use this directly, it must be loaded so that
+# we can find the NSApplication, NSWindow, and NSView classes.
+lib = util.find_library('AppKit')
+
+# Hack for compatibility with macOS > 11.0
+if lib is None:
+ lib = '/System/Library/Frameworks/AppKit.framework/AppKit'
+
+appkit = cdll.LoadLibrary(lib)
+
+NSDefaultRunLoopMode = c_void_p.in_dll(appkit, 'NSDefaultRunLoopMode')
+NSEventTrackingRunLoopMode = c_void_p.in_dll(appkit, 'NSEventTrackingRunLoopMode')
+NSApplicationDidHideNotification = c_void_p.in_dll(appkit, 'NSApplicationDidHideNotification')
+NSApplicationDidUnhideNotification = c_void_p.in_dll(appkit, 'NSApplicationDidUnhideNotification')
+
+# /System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h
+NSAnyEventMask = 0xFFFFFFFF # NSUIntegerMax
+
+NSKeyDown = 10
+NSKeyUp = 11
+NSFlagsChanged = 12
+NSApplicationDefined = 15
+
+NSAlphaShiftKeyMask = 1 << 16
+NSShiftKeyMask = 1 << 17
+NSControlKeyMask = 1 << 18
+NSAlternateKeyMask = 1 << 19
+NSCommandKeyMask = 1 << 20
+NSNumericPadKeyMask = 1 << 21
+NSHelpKeyMask = 1 << 22
+NSFunctionKeyMask = 1 << 23
+
+NSInsertFunctionKey = 0xF727
+NSDeleteFunctionKey = 0xF728
+NSHomeFunctionKey = 0xF729
+NSBeginFunctionKey = 0xF72A
+NSEndFunctionKey = 0xF72B
+NSPageUpFunctionKey = 0xF72C
+NSPageDownFunctionKey = 0xF72D
+
+# /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h
+NSBorderlessWindowMask = 0
+NSTitledWindowMask = 1 << 0
+NSClosableWindowMask = 1 << 1
+NSMiniaturizableWindowMask = 1 << 2
+NSResizableWindowMask = 1 << 3
+
+# /System/Library/Frameworks/AppKit.framework/Headers/NSPanel.h
+NSUtilityWindowMask = 1 << 4
+
+# /System/Library/Frameworks/AppKit.framework/Headers/NSGraphics.h
+NSBackingStoreRetained = 0
+NSBackingStoreNonretained = 1
+NSBackingStoreBuffered = 2
+
+# /System/Library/Frameworks/AppKit.framework/Headers/NSTrackingArea.h
+NSTrackingMouseEnteredAndExited = 0x01
+NSTrackingMouseMoved = 0x02
+NSTrackingCursorUpdate = 0x04
+NSTrackingActiveInActiveApp = 0x40
+
+# /System/Library/Frameworks/AppKit.framework/Headers/NSOpenGL.h
+NSOpenGLPFAAllRenderers = 1 # choose from all available renderers
+NSOpenGLPFADoubleBuffer = 5 # choose a double buffered pixel format
+NSOpenGLPFAStereo = 6 # stereo buffering supported
+NSOpenGLPFAAuxBuffers = 7 # number of aux buffers
+NSOpenGLPFAColorSize = 8 # number of color buffer bits
+NSOpenGLPFAAlphaSize = 11 # number of alpha component bits
+NSOpenGLPFADepthSize = 12 # number of depth buffer bits
+NSOpenGLPFAStencilSize = 13 # number of stencil buffer bits
+NSOpenGLPFAAccumSize = 14 # number of accum buffer bits
+NSOpenGLPFAMinimumPolicy = 51 # never choose smaller buffers than requested
+NSOpenGLPFAMaximumPolicy = 52 # choose largest buffers of type requested
+NSOpenGLPFAOffScreen = 53 # choose an off-screen capable renderer
+NSOpenGLPFAFullScreen = 54 # choose a full-screen capable renderer
+NSOpenGLPFASampleBuffers = 55 # number of multi sample buffers
+NSOpenGLPFASamples = 56 # number of samples per multi sample buffer
+NSOpenGLPFAAuxDepthStencil = 57 # each aux buffer has its own depth stencil
+NSOpenGLPFAColorFloat = 58 # color buffers store floating point pixels
+NSOpenGLPFAMultisample = 59 # choose multisampling
+NSOpenGLPFASupersample = 60 # choose supersampling
+NSOpenGLPFASampleAlpha = 61 # request alpha filtering
+NSOpenGLPFARendererID = 70 # request renderer by ID
+NSOpenGLPFASingleRenderer = 71 # choose a single renderer for all screens
+NSOpenGLPFANoRecovery = 72 # disable all failure recovery systems
+NSOpenGLPFAAccelerated = 73 # choose a hardware accelerated renderer
+NSOpenGLPFAClosestPolicy = 74 # choose the closest color buffer to request
+NSOpenGLPFARobust = 75 # renderer does not need failure recovery
+NSOpenGLPFABackingStore = 76 # back buffer contents are valid after swap
+NSOpenGLPFAMPSafe = 78 # renderer is multi-processor safe
+NSOpenGLPFAWindow = 80 # can be used to render to an onscreen window
+NSOpenGLPFAMultiScreen = 81 # single window can span multiple screens
+NSOpenGLPFACompliant = 83 # renderer is opengl compliant
+NSOpenGLPFAScreenMask = 84 # bit mask of supported physical screens
+NSOpenGLPFAPixelBuffer = 90 # can be used to render to a pbuffer
+NSOpenGLPFARemotePixelBuffer = 91 # can be used to render offline to a pbuffer
+NSOpenGLPFAAllowOfflineRenderers = 96 # allow use of offline renderers
+NSOpenGLPFAAcceleratedCompute = 97 # choose a hardware accelerated compute device
+NSOpenGLPFAOpenGLProfile = 99 # specify an OpenGL Profile to use
+NSOpenGLPFAVirtualScreenCount = 128 # number of virtual screens in this format
+
+NSOpenGLProfileVersionLegacy = 0x1000 # choose a Legacy/Pre-OpenGL 3.0 Implementation
+NSOpenGLProfileVersion3_2Core = 0x3200 # choose an OpenGL 3.2 Core Implementation
+NSOpenGLProfileVersion4_1Core = 0x4100 # choose an OpenGL 4.1 Core Implementation
+
+NSOpenGLCPSwapInterval = 222
+
+
+# /System/Library/Frameworks/ApplicationServices.framework/Frameworks/...
+# CoreGraphics.framework/Headers/CGImage.h
+kCGImageAlphaNone = 0
+kCGImageAlphaPremultipliedLast = 1
+kCGImageAlphaPremultipliedFirst = 2
+kCGImageAlphaLast = 3
+kCGImageAlphaFirst = 4
+kCGImageAlphaNoneSkipLast = 5
+kCGImageAlphaNoneSkipFirst = 6
+kCGImageAlphaOnly = 7
+
+kCGImageAlphaPremultipliedLast = 1
+
+kCGBitmapAlphaInfoMask = 0x1F
+kCGBitmapFloatComponents = 1 << 8
+
+kCGBitmapByteOrderMask = 0x7000
+kCGBitmapByteOrderDefault = 0 << 12
+kCGBitmapByteOrder16Little = 1 << 12
+kCGBitmapByteOrder32Little = 2 << 12
+kCGBitmapByteOrder16Big = 3 << 12
+kCGBitmapByteOrder32Big = 4 << 12
+
+# NSApplication.h
+NSApplicationPresentationDefault = 0
+NSApplicationPresentationHideDock = 1 << 1
+NSApplicationPresentationHideMenuBar = 1 << 3
+NSApplicationPresentationDisableProcessSwitching = 1 << 5
+NSApplicationPresentationDisableHideApplication = 1 << 8
+
+# NSRunningApplication.h
+NSApplicationActivationPolicyRegular = 0
+NSApplicationActivationPolicyAccessory = 1
+NSApplicationActivationPolicyProhibited = 2
+
+######################################################################
+
+# QUARTZ / COREGRAPHICS
+lib = util.find_library('Quartz')
+
+# Hack for compatibility with macOS > 11.0
+if lib is None:
+ lib = '/System/Library/Frameworks/Quartz.framework/Quartz'
+
+quartz = cdll.LoadLibrary(lib)
+
+CGDirectDisplayID = c_uint32 # CGDirectDisplay.h
+CGError = c_int32 # CGError.h
+CGBitmapInfo = c_uint32 # CGImage.h
+
+# /System/Library/Frameworks/ApplicationServices.framework/Frameworks/...
+# ImageIO.framework/Headers/CGImageProperties.h
+kCGImagePropertyGIFDictionary = c_void_p.in_dll(quartz, 'kCGImagePropertyGIFDictionary')
+kCGImagePropertyGIFDelayTime = c_void_p.in_dll(quartz, 'kCGImagePropertyGIFDelayTime')
+
+# /System/Library/Frameworks/ApplicationServices.framework/Frameworks/...
+# CoreGraphics.framework/Headers/CGColorSpace.h
+kCGRenderingIntentDefault = 0
+
+quartz.CGDisplayIDToOpenGLDisplayMask.restype = c_uint32
+quartz.CGDisplayIDToOpenGLDisplayMask.argtypes = [c_uint32]
+
+quartz.CGMainDisplayID.restype = CGDirectDisplayID
+quartz.CGMainDisplayID.argtypes = []
+
+quartz.CGShieldingWindowLevel.restype = c_int32
+quartz.CGShieldingWindowLevel.argtypes = []
+
+quartz.CGCursorIsVisible.restype = c_bool
+
+quartz.CGDisplayCopyAllDisplayModes.restype = c_void_p
+quartz.CGDisplayCopyAllDisplayModes.argtypes = [CGDirectDisplayID, c_void_p]
+
+quartz.CGDisplaySetDisplayMode.restype = CGError
+quartz.CGDisplaySetDisplayMode.argtypes = [CGDirectDisplayID, c_void_p, c_void_p]
+
+quartz.CGDisplayCapture.restype = CGError
+quartz.CGDisplayCapture.argtypes = [CGDirectDisplayID]
+
+quartz.CGDisplayRelease.restype = CGError
+quartz.CGDisplayRelease.argtypes = [CGDirectDisplayID]
+
+quartz.CGDisplayCopyDisplayMode.restype = c_void_p
+quartz.CGDisplayCopyDisplayMode.argtypes = [CGDirectDisplayID]
+
+quartz.CGDisplayModeGetRefreshRate.restype = c_double
+quartz.CGDisplayModeGetRefreshRate.argtypes = [c_void_p]
+
+quartz.CGDisplayModeRetain.restype = c_void_p
+quartz.CGDisplayModeRetain.argtypes = [c_void_p]
+
+quartz.CGDisplayModeRelease.restype = None
+quartz.CGDisplayModeRelease.argtypes = [c_void_p]
+
+quartz.CGDisplayModeGetWidth.restype = c_size_t
+quartz.CGDisplayModeGetWidth.argtypes = [c_void_p]
+
+quartz.CGDisplayModeGetHeight.restype = c_size_t
+quartz.CGDisplayModeGetHeight.argtypes = [c_void_p]
+
+quartz.CGDisplayModeCopyPixelEncoding.restype = c_void_p
+quartz.CGDisplayModeCopyPixelEncoding.argtypes = [c_void_p]
+
+quartz.CGGetActiveDisplayList.restype = CGError
+quartz.CGGetActiveDisplayList.argtypes = [c_uint32, POINTER(CGDirectDisplayID), POINTER(c_uint32)]
+
+quartz.CGDisplayBounds.restype = CGRect
+quartz.CGDisplayBounds.argtypes = [CGDirectDisplayID]
+
+quartz.CGImageSourceCreateWithData.restype = c_void_p
+quartz.CGImageSourceCreateWithData.argtypes = [c_void_p, c_void_p]
+
+quartz.CGImageSourceCreateImageAtIndex.restype = c_void_p
+quartz.CGImageSourceCreateImageAtIndex.argtypes = [c_void_p, c_size_t, c_void_p]
+
+quartz.CGImageSourceCopyPropertiesAtIndex.restype = c_void_p
+quartz.CGImageSourceCopyPropertiesAtIndex.argtypes = [c_void_p, c_size_t, c_void_p]
+
+quartz.CGImageGetDataProvider.restype = c_void_p
+quartz.CGImageGetDataProvider.argtypes = [c_void_p]
+
+quartz.CGDataProviderCopyData.restype = c_void_p
+quartz.CGDataProviderCopyData.argtypes = [c_void_p]
+
+quartz.CGDataProviderCreateWithCFData.restype = c_void_p
+quartz.CGDataProviderCreateWithCFData.argtypes = [c_void_p]
+
+quartz.CGImageCreate.restype = c_void_p
+quartz.CGImageCreate.argtypes = [c_size_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_uint32, c_void_p, c_void_p, c_bool, c_int]
+
+quartz.CGImageRelease.restype = None
+quartz.CGImageRelease.argtypes = [c_void_p]
+
+quartz.CGImageGetBytesPerRow.restype = c_size_t
+quartz.CGImageGetBytesPerRow.argtypes = [c_void_p]
+
+quartz.CGImageGetWidth.restype = c_size_t
+quartz.CGImageGetWidth.argtypes = [c_void_p]
+
+quartz.CGImageGetHeight.restype = c_size_t
+quartz.CGImageGetHeight.argtypes = [c_void_p]
+
+quartz.CGImageGetBitsPerPixel.restype = c_size_t
+quartz.CGImageGetBitsPerPixel.argtypes = [c_void_p]
+
+quartz.CGImageGetBitmapInfo.restype = CGBitmapInfo
+quartz.CGImageGetBitmapInfo.argtypes = [c_void_p]
+
+quartz.CGColorSpaceCreateDeviceRGB.restype = c_void_p
+quartz.CGColorSpaceCreateDeviceRGB.argtypes = []
+
+quartz.CGDataProviderRelease.restype = None
+quartz.CGDataProviderRelease.argtypes = [c_void_p]
+
+quartz.CGColorSpaceRelease.restype = None
+quartz.CGColorSpaceRelease.argtypes = [c_void_p]
+
+quartz.CGWarpMouseCursorPosition.restype = CGError
+quartz.CGWarpMouseCursorPosition.argtypes = [CGPoint]
+
+quartz.CGDisplayMoveCursorToPoint.restype = CGError
+quartz.CGDisplayMoveCursorToPoint.argtypes = [CGDirectDisplayID, CGPoint]
+
+quartz.CGAssociateMouseAndMouseCursorPosition.restype = CGError
+quartz.CGAssociateMouseAndMouseCursorPosition.argtypes = [c_bool]
+
+quartz.CGBitmapContextCreate.restype = c_void_p
+quartz.CGBitmapContextCreate.argtypes = [c_void_p, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, CGBitmapInfo]
+
+quartz.CGBitmapContextCreateImage.restype = c_void_p
+quartz.CGBitmapContextCreateImage.argtypes = [c_void_p]
+
+quartz.CGFontCreateWithDataProvider.restype = c_void_p
+quartz.CGFontCreateWithDataProvider.argtypes = [c_void_p]
+
+quartz.CGFontCreateWithFontName.restype = c_void_p
+quartz.CGFontCreateWithFontName.argtypes = [c_void_p]
+
+quartz.CGContextDrawImage.restype = None
+quartz.CGContextDrawImage.argtypes = [c_void_p, CGRect, c_void_p]
+
+quartz.CGContextRelease.restype = None
+quartz.CGContextRelease.argtypes = [c_void_p]
+
+quartz.CGContextSetTextPosition.restype = None
+quartz.CGContextSetTextPosition.argtypes = [c_void_p, CGFloat, CGFloat]
+
+quartz.CGContextSetShouldAntialias.restype = None
+quartz.CGContextSetShouldAntialias.argtypes = [c_void_p, c_bool]
+
+######################################################################
+
+# CORETEXT
+lib = util.find_library('CoreText')
+
+# Hack for compatibility with macOS > 11.0
+if lib is None:
+ lib = '/System/Library/Frameworks/CoreText.framework/CoreText'
+
+ct = cdll.LoadLibrary(lib)
+
+# Types
+CTFontOrientation = c_uint32 # CTFontDescriptor.h
+CTFontSymbolicTraits = c_uint32 # CTFontTraits.h
+
+# CoreText constants
+kCTFontAttributeName = c_void_p.in_dll(ct, 'kCTFontAttributeName')
+kCTFontFamilyNameAttribute = c_void_p.in_dll(ct, 'kCTFontFamilyNameAttribute')
+kCTFontSymbolicTrait = c_void_p.in_dll(ct, 'kCTFontSymbolicTrait')
+kCTFontWeightTrait = c_void_p.in_dll(ct, 'kCTFontWeightTrait')
+kCTFontTraitsAttribute = c_void_p.in_dll(ct, 'kCTFontTraitsAttribute')
+
+# constants from CTFontTraits.h
+kCTFontItalicTrait = (1 << 0)
+kCTFontBoldTrait = (1 << 1)
+
+ct.CTLineCreateWithAttributedString.restype = c_void_p
+ct.CTLineCreateWithAttributedString.argtypes = [c_void_p]
+
+ct.CTLineDraw.restype = None
+ct.CTLineDraw.argtypes = [c_void_p, c_void_p]
+
+ct.CTFontGetBoundingRectsForGlyphs.restype = CGRect
+ct.CTFontGetBoundingRectsForGlyphs.argtypes = [c_void_p, CTFontOrientation, POINTER(CGGlyph), POINTER(CGRect), CFIndex]
+
+ct.CTFontGetAdvancesForGlyphs.restype = c_double
+ct.CTFontGetAdvancesForGlyphs.argtypes = [c_void_p, CTFontOrientation, POINTER(CGGlyph), POINTER(CGSize), CFIndex]
+
+ct.CTFontGetAscent.restype = CGFloat
+ct.CTFontGetAscent.argtypes = [c_void_p]
+
+ct.CTFontGetDescent.restype = CGFloat
+ct.CTFontGetDescent.argtypes = [c_void_p]
+
+ct.CTFontGetSymbolicTraits.restype = CTFontSymbolicTraits
+ct.CTFontGetSymbolicTraits.argtypes = [c_void_p]
+
+ct.CTFontGetGlyphsForCharacters.restype = c_bool
+ct.CTFontGetGlyphsForCharacters.argtypes = [c_void_p, POINTER(UniChar), POINTER(CGGlyph), CFIndex]
+
+ct.CTFontCreateWithGraphicsFont.restype = c_void_p
+ct.CTFontCreateWithGraphicsFont.argtypes = [c_void_p, CGFloat, c_void_p, c_void_p]
+
+ct.CTFontCopyFamilyName.restype = c_void_p
+ct.CTFontCopyFamilyName.argtypes = [c_void_p]
+
+ct.CTFontCopyFullName.restype = c_void_p
+ct.CTFontCopyFullName.argtypes = [c_void_p]
+
+ct.CTFontCreateWithFontDescriptor.restype = c_void_p
+ct.CTFontCreateWithFontDescriptor.argtypes = [c_void_p, CGFloat, c_void_p]
+
+ct.CTFontDescriptorCreateWithAttributes.restype = c_void_p
+ct.CTFontDescriptorCreateWithAttributes.argtypes = [c_void_p]
+
+######################################################################
+
+# FOUNDATION
+lib = util.find_library('Foundation')
+
+# Hack for compatibility with macOS > 11.0
+if lib is None:
+ lib = '/System/Library/Frameworks/Foundation.framework/Foundation'
+
+foundation = cdll.LoadLibrary(lib)
+
+foundation.NSMouseInRect.restype = c_bool
+foundation.NSMouseInRect.argtypes = [NSPoint, NSRect, c_bool]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/cocoapy/cocoatypes.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/cocoapy/cocoatypes.py
new file mode 100644
index 0000000000000000000000000000000000000000..b30019e89576030042d6bd399d6f7c56afe56287
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/cocoapy/cocoatypes.py
@@ -0,0 +1,85 @@
+from ctypes import *
+
+import sys, platform, struct
+
+__LP64__ = (8*struct.calcsize("P") == 64)
+__i386__ = (platform.machine() == 'i386')
+
+PyObjectEncoding = b'{PyObject=@}'
+
+def encoding_for_ctype(vartype):
+ typecodes = {c_char:b'c', c_int:b'i', c_short:b's', c_long:b'l', c_longlong:b'q',
+ c_ubyte:b'C', c_uint:b'I', c_ushort:b'S', c_ulong:b'L', c_ulonglong:b'Q',
+ c_float:b'f', c_double:b'd', c_bool:b'B', c_char_p:b'*', c_void_p:b'@',
+ py_object:PyObjectEncoding}
+ return typecodes.get(vartype, b'?')
+
+# Note CGBase.h located at
+# /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Headers/CGBase.h
+# defines CGFloat as double if __LP64__, otherwise it's a float.
+if __LP64__:
+ NSInteger = c_long
+ NSUInteger = c_ulong
+ CGFloat = c_double
+ NSPointEncoding = b'{CGPoint=dd}'
+ NSSizeEncoding = b'{CGSize=dd}'
+ NSRectEncoding = b'{CGRect={CGPoint=dd}{CGSize=dd}}'
+ NSRangeEncoding = b'{_NSRange=QQ}'
+else:
+ NSInteger = c_int
+ NSUInteger = c_uint
+ CGFloat = c_float
+ NSPointEncoding = b'{_NSPoint=ff}'
+ NSSizeEncoding = b'{_NSSize=ff}'
+ NSRectEncoding = b'{_NSRect={_NSPoint=ff}{_NSSize=ff}}'
+ NSRangeEncoding = b'{_NSRange=II}'
+
+NSIntegerEncoding = encoding_for_ctype(NSInteger)
+NSUIntegerEncoding = encoding_for_ctype(NSUInteger)
+CGFloatEncoding = encoding_for_ctype(CGFloat)
+
+# Special case so that NSImage.initWithCGImage_size_() will work.
+CGImageEncoding = b'{CGImage=}'
+
+NSZoneEncoding = b'{_NSZone=}'
+
+# from /System/Library/Frameworks/Foundation.framework/Headers/NSGeometry.h
+class NSPoint(Structure):
+ _fields_ = [ ("x", CGFloat), ("y", CGFloat) ]
+CGPoint = NSPoint
+
+class NSSize(Structure):
+ _fields_ = [ ("width", CGFloat), ("height", CGFloat) ]
+CGSize = NSSize
+
+class NSRect(Structure):
+ _fields_ = [ ("origin", NSPoint), ("size", NSSize) ]
+CGRect = NSRect
+
+def NSMakeSize(w, h):
+ return NSSize(w, h)
+
+def NSMakeRect(x, y, w, h):
+ return NSRect(NSPoint(x, y), NSSize(w, h))
+
+# NSDate.h
+NSTimeInterval = c_double
+
+CFIndex = c_long
+UniChar = c_ushort
+unichar = c_wchar # (actually defined as c_ushort in NSString.h, but need ctypes to convert properly)
+CGGlyph = c_ushort
+
+# CFRange struct defined in CFBase.h
+# This replaces the CFRangeMake(LOC, LEN) macro.
+class CFRange(Structure):
+ _fields_ = [ ("location", CFIndex), ("length", CFIndex) ]
+
+# NSRange.h (Note, not defined the same as CFRange)
+class NSRange(Structure):
+ _fields_ = [ ("location", NSUInteger), ("length", NSUInteger) ]
+
+NSZeroPoint = NSPoint(0,0)
+
+CFTypeID = c_ulong
+CFNumberType = c_uint32
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/cocoapy/runtime.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/cocoapy/runtime.py
new file mode 100644
index 0000000000000000000000000000000000000000..ba60086681243de4fbed3bf9718128e66999c85f
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/cocoapy/runtime.py
@@ -0,0 +1,1251 @@
+# objective-ctypes
+#
+# Copyright (c) 2011, Phillip Nguyen
+# 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 objective-ctypes 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 HOLDER 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.
+
+import sys
+import platform
+import struct
+
+from ctypes import *
+from ctypes import util
+
+from .cocoatypes import *
+
+__LP64__ = (8 * struct.calcsize("P") == 64)
+__i386__ = (platform.machine() == 'i386')
+__arm64__ = (platform.machine() == 'arm64')
+
+if sizeof(c_void_p) == 4:
+ c_ptrdiff_t = c_int32
+elif sizeof(c_void_p) == 8:
+ c_ptrdiff_t = c_int64
+
+######################################################################
+
+lib = util.find_library('objc')
+
+# Hack for compatibility with macOS > 11.0
+if lib is None:
+ lib = '/usr/lib/libobjc.dylib'
+
+objc = cdll.LoadLibrary(lib)
+
+######################################################################
+
+# BOOL class_addIvar(Class cls, const char *name, size_t size, uint8_t alignment, const char *types)
+objc.class_addIvar.restype = c_bool
+objc.class_addIvar.argtypes = [c_void_p, c_char_p, c_size_t, c_uint8, c_char_p]
+
+# BOOL class_addMethod(Class cls, SEL name, IMP imp, const char *types)
+objc.class_addMethod.restype = c_bool
+
+# BOOL class_addProtocol(Class cls, Protocol *protocol)
+objc.class_addProtocol.restype = c_bool
+objc.class_addProtocol.argtypes = [c_void_p, c_void_p]
+
+# BOOL class_conformsToProtocol(Class cls, Protocol *protocol)
+objc.class_conformsToProtocol.restype = c_bool
+objc.class_conformsToProtocol.argtypes = [c_void_p, c_void_p]
+
+# Ivar * class_copyIvarList(Class cls, unsigned int *outCount)
+# Returns an array of pointers of type Ivar describing instance variables.
+# The array has *outCount pointers followed by a NULL terminator.
+# You must free() the returned array.
+objc.class_copyIvarList.restype = POINTER(c_void_p)
+objc.class_copyIvarList.argtypes = [c_void_p, POINTER(c_uint)]
+
+# Method * class_copyMethodList(Class cls, unsigned int *outCount)
+# Returns an array of pointers of type Method describing instance methods.
+# The array has *outCount pointers followed by a NULL terminator.
+# You must free() the returned array.
+objc.class_copyMethodList.restype = POINTER(c_void_p)
+objc.class_copyMethodList.argtypes = [c_void_p, POINTER(c_uint)]
+
+# objc_property_t * class_copyPropertyList(Class cls, unsigned int *outCount)
+# Returns an array of pointers of type objc_property_t describing properties.
+# The array has *outCount pointers followed by a NULL terminator.
+# You must free() the returned array.
+objc.class_copyPropertyList.restype = POINTER(c_void_p)
+objc.class_copyPropertyList.argtypes = [c_void_p, POINTER(c_uint)]
+
+# Protocol ** class_copyProtocolList(Class cls, unsigned int *outCount)
+# Returns an array of pointers of type Protocol* describing protocols.
+# The array has *outCount pointers followed by a NULL terminator.
+# You must free() the returned array.
+objc.class_copyProtocolList.restype = POINTER(c_void_p)
+objc.class_copyProtocolList.argtypes = [c_void_p, POINTER(c_uint)]
+
+# id class_createInstance(Class cls, size_t extraBytes)
+objc.class_createInstance.restype = c_void_p
+objc.class_createInstance.argtypes = [c_void_p, c_size_t]
+
+# Method class_getClassMethod(Class aClass, SEL aSelector)
+# Will also search superclass for implementations.
+objc.class_getClassMethod.restype = c_void_p
+objc.class_getClassMethod.argtypes = [c_void_p, c_void_p]
+
+# Ivar class_getClassVariable(Class cls, const char* name)
+objc.class_getClassVariable.restype = c_void_p
+objc.class_getClassVariable.argtypes = [c_void_p, c_char_p]
+
+# Method class_getInstanceMethod(Class aClass, SEL aSelector)
+# Will also search superclass for implementations.
+objc.class_getInstanceMethod.restype = c_void_p
+objc.class_getInstanceMethod.argtypes = [c_void_p, c_void_p]
+
+# size_t class_getInstanceSize(Class cls)
+objc.class_getInstanceSize.restype = c_size_t
+objc.class_getInstanceSize.argtypes = [c_void_p]
+
+# Ivar class_getInstanceVariable(Class cls, const char* name)
+objc.class_getInstanceVariable.restype = c_void_p
+objc.class_getInstanceVariable.argtypes = [c_void_p, c_char_p]
+
+# const char *class_getIvarLayout(Class cls)
+objc.class_getIvarLayout.restype = c_char_p
+objc.class_getIvarLayout.argtypes = [c_void_p]
+
+# IMP class_getMethodImplementation(Class cls, SEL name)
+objc.class_getMethodImplementation.restype = c_void_p
+objc.class_getMethodImplementation.argtypes = [c_void_p, c_void_p]
+
+# The function is marked as OBJC_ARM64_UNAVAILABLE.
+if not __arm64__:
+ # IMP class_getMethodImplementation_stret(Class cls, SEL name)
+ objc.class_getMethodImplementation_stret.restype = c_void_p
+ objc.class_getMethodImplementation_stret.argtypes = [c_void_p, c_void_p]
+
+# const char * class_getName(Class cls)
+objc.class_getName.restype = c_char_p
+objc.class_getName.argtypes = [c_void_p]
+
+# objc_property_t class_getProperty(Class cls, const char *name)
+objc.class_getProperty.restype = c_void_p
+objc.class_getProperty.argtypes = [c_void_p, c_char_p]
+
+# Class class_getSuperclass(Class cls)
+objc.class_getSuperclass.restype = c_void_p
+objc.class_getSuperclass.argtypes = [c_void_p]
+
+# int class_getVersion(Class theClass)
+objc.class_getVersion.restype = c_int
+objc.class_getVersion.argtypes = [c_void_p]
+
+# const char *class_getWeakIvarLayout(Class cls)
+objc.class_getWeakIvarLayout.restype = c_char_p
+objc.class_getWeakIvarLayout.argtypes = [c_void_p]
+
+# BOOL class_isMetaClass(Class cls)
+objc.class_isMetaClass.restype = c_bool
+objc.class_isMetaClass.argtypes = [c_void_p]
+
+# IMP class_replaceMethod(Class cls, SEL name, IMP imp, const char *types)
+objc.class_replaceMethod.restype = c_void_p
+objc.class_replaceMethod.argtypes = [c_void_p, c_void_p, c_void_p, c_char_p]
+
+# BOOL class_respondsToSelector(Class cls, SEL sel)
+objc.class_respondsToSelector.restype = c_bool
+objc.class_respondsToSelector.argtypes = [c_void_p, c_void_p]
+
+# void class_setIvarLayout(Class cls, const char *layout)
+objc.class_setIvarLayout.restype = None
+objc.class_setIvarLayout.argtypes = [c_void_p, c_char_p]
+
+# Class class_setSuperclass(Class cls, Class newSuper)
+objc.class_setSuperclass.restype = c_void_p
+objc.class_setSuperclass.argtypes = [c_void_p, c_void_p]
+
+# void class_setVersion(Class theClass, int version)
+objc.class_setVersion.restype = None
+objc.class_setVersion.argtypes = [c_void_p, c_int]
+
+# void class_setWeakIvarLayout(Class cls, const char *layout)
+objc.class_setWeakIvarLayout.restype = None
+objc.class_setWeakIvarLayout.argtypes = [c_void_p, c_char_p]
+
+######################################################################
+
+# const char * ivar_getName(Ivar ivar)
+objc.ivar_getName.restype = c_char_p
+objc.ivar_getName.argtypes = [c_void_p]
+
+# ptrdiff_t ivar_getOffset(Ivar ivar)
+objc.ivar_getOffset.restype = c_ptrdiff_t
+objc.ivar_getOffset.argtypes = [c_void_p]
+
+# const char * ivar_getTypeEncoding(Ivar ivar)
+objc.ivar_getTypeEncoding.restype = c_char_p
+objc.ivar_getTypeEncoding.argtypes = [c_void_p]
+
+######################################################################
+
+# char * method_copyArgumentType(Method method, unsigned int index)
+# You must free() the returned string.
+objc.method_copyArgumentType.restype = c_char_p
+objc.method_copyArgumentType.argtypes = [c_void_p, c_uint]
+
+# char * method_copyReturnType(Method method)
+# You must free() the returned string.
+objc.method_copyReturnType.restype = c_char_p
+objc.method_copyReturnType.argtypes = [c_void_p]
+
+# void method_exchangeImplementations(Method m1, Method m2)
+objc.method_exchangeImplementations.restype = None
+objc.method_exchangeImplementations.argtypes = [c_void_p, c_void_p]
+
+# void method_getArgumentType(Method method, unsigned int index, char *dst, size_t dst_len)
+# Functionally similar to strncpy(dst, parameter_type, dst_len).
+objc.method_getArgumentType.restype = None
+objc.method_getArgumentType.argtypes = [c_void_p, c_uint, c_char_p, c_size_t]
+
+# IMP method_getImplementation(Method method)
+objc.method_getImplementation.restype = c_void_p
+objc.method_getImplementation.argtypes = [c_void_p]
+
+# SEL method_getName(Method method)
+objc.method_getName.restype = c_void_p
+objc.method_getName.argtypes = [c_void_p]
+
+# unsigned method_getNumberOfArguments(Method method)
+objc.method_getNumberOfArguments.restype = c_uint
+objc.method_getNumberOfArguments.argtypes = [c_void_p]
+
+# void method_getReturnType(Method method, char *dst, size_t dst_len)
+# Functionally similar to strncpy(dst, return_type, dst_len)
+objc.method_getReturnType.restype = None
+objc.method_getReturnType.argtypes = [c_void_p, c_char_p, c_size_t]
+
+# const char * method_getTypeEncoding(Method method)
+objc.method_getTypeEncoding.restype = c_char_p
+objc.method_getTypeEncoding.argtypes = [c_void_p]
+
+# IMP method_setImplementation(Method method, IMP imp)
+objc.method_setImplementation.restype = c_void_p
+objc.method_setImplementation.argtypes = [c_void_p, c_void_p]
+
+######################################################################
+
+# Class objc_allocateClassPair(Class superclass, const char *name, size_t extraBytes)
+objc.objc_allocateClassPair.restype = c_void_p
+objc.objc_allocateClassPair.argtypes = [c_void_p, c_char_p, c_size_t]
+
+# Protocol **objc_copyProtocolList(unsigned int *outCount)
+# Returns an array of *outcount pointers followed by NULL terminator.
+# You must free() the array.
+objc.objc_copyProtocolList.restype = POINTER(c_void_p)
+objc.objc_copyProtocolList.argtypes = [POINTER(c_int)]
+
+# id objc_getAssociatedObject(id object, void *key)
+objc.objc_getAssociatedObject.restype = c_void_p
+objc.objc_getAssociatedObject.argtypes = [c_void_p, c_void_p]
+
+# id objc_getClass(const char *name)
+objc.objc_getClass.restype = c_void_p
+objc.objc_getClass.argtypes = [c_char_p]
+
+# int objc_getClassList(Class *buffer, int bufferLen)
+# Pass None for buffer to obtain just the total number of classes.
+objc.objc_getClassList.restype = c_int
+objc.objc_getClassList.argtypes = [c_void_p, c_int]
+
+# id objc_getMetaClass(const char *name)
+objc.objc_getMetaClass.restype = c_void_p
+objc.objc_getMetaClass.argtypes = [c_char_p]
+
+# Protocol *objc_getProtocol(const char *name)
+objc.objc_getProtocol.restype = c_void_p
+objc.objc_getProtocol.argtypes = [c_char_p]
+
+# You should set return and argument types depending on context.
+# id objc_msgSend(id theReceiver, SEL theSelector, ...)
+# id objc_msgSendSuper(struct objc_super *super, SEL op, ...)
+
+# The function is marked as OBJC_ARM64_UNAVAILABLE.
+if not __arm64__:
+ # void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...)
+ objc.objc_msgSendSuper_stret.restype = None
+
+# double objc_msgSend_fpret(id self, SEL op, ...)
+# objc.objc_msgSend_fpret.restype = c_double
+
+# The function is marked as OBJC_ARM64_UNAVAILABLE.
+if not __arm64__:
+ # void objc_msgSend_stret(void * stretAddr, id theReceiver, SEL theSelector, ...)
+ objc.objc_msgSend_stret.restype = None
+
+# void objc_registerClassPair(Class cls)
+objc.objc_registerClassPair.restype = None
+objc.objc_registerClassPair.argtypes = [c_void_p]
+
+# void objc_removeAssociatedObjects(id object)
+objc.objc_removeAssociatedObjects.restype = None
+objc.objc_removeAssociatedObjects.argtypes = [c_void_p]
+
+# void objc_setAssociatedObject(id object, void *key, id value, objc_AssociationPolicy policy)
+objc.objc_setAssociatedObject.restype = None
+objc.objc_setAssociatedObject.argtypes = [c_void_p, c_void_p, c_void_p, c_int]
+
+######################################################################
+
+# id object_copy(id obj, size_t size)
+objc.object_copy.restype = c_void_p
+objc.object_copy.argtypes = [c_void_p, c_size_t]
+
+# id object_dispose(id obj)
+objc.object_dispose.restype = c_void_p
+objc.object_dispose.argtypes = [c_void_p]
+
+# Class object_getClass(id object)
+objc.object_getClass.restype = c_void_p
+objc.object_getClass.argtypes = [c_void_p]
+
+# const char *object_getClassName(id obj)
+objc.object_getClassName.restype = c_char_p
+objc.object_getClassName.argtypes = [c_void_p]
+
+# Ivar object_getInstanceVariable(id obj, const char *name, void **outValue)
+objc.object_getInstanceVariable.restype = c_void_p
+objc.object_getInstanceVariable.argtypes = [c_void_p, c_char_p, c_void_p]
+
+# id object_getIvar(id object, Ivar ivar)
+objc.object_getIvar.restype = c_void_p
+objc.object_getIvar.argtypes = [c_void_p, c_void_p]
+
+# Class object_setClass(id object, Class cls)
+objc.object_setClass.restype = c_void_p
+objc.object_setClass.argtypes = [c_void_p, c_void_p]
+
+# Ivar object_setInstanceVariable(id obj, const char *name, void *value)
+# Set argtypes based on the data type of the instance variable.
+objc.object_setInstanceVariable.restype = c_void_p
+
+# void object_setIvar(id object, Ivar ivar, id value)
+objc.object_setIvar.restype = None
+objc.object_setIvar.argtypes = [c_void_p, c_void_p, c_void_p]
+
+######################################################################
+
+# const char *property_getAttributes(objc_property_t property)
+objc.property_getAttributes.restype = c_char_p
+objc.property_getAttributes.argtypes = [c_void_p]
+
+# const char *property_getName(objc_property_t property)
+objc.property_getName.restype = c_char_p
+objc.property_getName.argtypes = [c_void_p]
+
+######################################################################
+
+# BOOL protocol_conformsToProtocol(Protocol *proto, Protocol *other)
+objc.protocol_conformsToProtocol.restype = c_bool
+objc.protocol_conformsToProtocol.argtypes = [c_void_p, c_void_p]
+
+
+class OBJC_METHOD_DESCRIPTION(Structure):
+ _fields_ = [("name", c_void_p), ("types", c_char_p)]
+
+
+# struct objc_method_description *protocol_copyMethodDescriptionList(Protocol *p, BOOL isRequiredMethod, BOOL isInstanceMethod, unsigned int *outCount)
+# You must free() the returned array.
+objc.protocol_copyMethodDescriptionList.restype = POINTER(OBJC_METHOD_DESCRIPTION)
+objc.protocol_copyMethodDescriptionList.argtypes = [c_void_p, c_bool, c_bool, POINTER(c_uint)]
+
+# objc_property_t * protocol_copyPropertyList(Protocol *protocol, unsigned int *outCount)
+objc.protocol_copyPropertyList.restype = c_void_p
+objc.protocol_copyPropertyList.argtypes = [c_void_p, POINTER(c_uint)]
+
+# Protocol **protocol_copyProtocolList(Protocol *proto, unsigned int *outCount)
+objc.protocol_copyProtocolList = POINTER(c_void_p)
+objc.protocol_copyProtocolList.argtypes = [c_void_p, POINTER(c_uint)]
+
+# struct objc_method_description protocol_getMethodDescription(Protocol *p, SEL aSel, BOOL isRequiredMethod, BOOL isInstanceMethod)
+objc.protocol_getMethodDescription.restype = OBJC_METHOD_DESCRIPTION
+objc.protocol_getMethodDescription.argtypes = [c_void_p, c_void_p, c_bool, c_bool]
+
+# const char *protocol_getName(Protocol *p)
+objc.protocol_getName.restype = c_char_p
+objc.protocol_getName.argtypes = [c_void_p]
+
+######################################################################
+
+# const char* sel_getName(SEL aSelector)
+objc.sel_getName.restype = c_char_p
+objc.sel_getName.argtypes = [c_void_p]
+
+# SEL sel_getUid(const char *str)
+# Use sel_registerName instead.
+
+# BOOL sel_isEqual(SEL lhs, SEL rhs)
+objc.sel_isEqual.restype = c_bool
+objc.sel_isEqual.argtypes = [c_void_p, c_void_p]
+
+# SEL sel_registerName(const char *str)
+objc.sel_registerName.restype = c_void_p
+objc.sel_registerName.argtypes = [c_char_p]
+
+
+######################################################################
+
+def ensure_bytes(x):
+ if isinstance(x, bytes):
+ return x
+ return x.encode('ascii')
+
+
+######################################################################
+
+def get_selector(name):
+ return c_void_p(objc.sel_registerName(ensure_bytes(name)))
+
+
+def get_class(name):
+ return c_void_p(objc.objc_getClass(ensure_bytes(name)))
+
+
+def get_object_class(obj):
+ return c_void_p(objc.object_getClass(obj))
+
+
+def get_metaclass(name):
+ return c_void_p(objc.objc_getMetaClass(ensure_bytes(name)))
+
+
+def get_superclass_of_object(obj):
+ cls = c_void_p(objc.object_getClass(obj))
+ return c_void_p(objc.class_getSuperclass(cls))
+
+
+# http://www.sealiesoftware.com/blog/archive/2008/10/30/objc_explain_objc_msgSend_stret.html
+# http://www.x86-64.org/documentation/abi-0.99.pdf (pp.17-23)
+# executive summary: on x86-64, who knows?
+def x86_should_use_stret(restype):
+ """Try to figure out when a return type will be passed on stack."""
+ if type(restype) != type(Structure):
+ return False
+ if not __LP64__ and sizeof(restype) <= 8:
+ return False
+ if __LP64__ and sizeof(restype) <= 16: # maybe? I don't know?
+ return False
+ return True
+
+
+# http://www.sealiesoftware.com/blog/archive/2008/11/16/objc_explain_objc_msgSend_fpret.html
+def should_use_fpret(restype):
+ """Determine if objc_msgSend_fpret is required to return a floating point type."""
+ if not __i386__:
+ # Unneeded on non-intel processors
+ return False
+ if __LP64__ and restype == c_longdouble:
+ # Use only for long double on x86_64
+ return True
+ if not __LP64__ and restype in (c_float, c_double, c_longdouble):
+ return True
+ return False
+
+
+# By default, assumes that restype is c_void_p
+# and that all arguments are wrapped inside c_void_p.
+# Use the restype and argtypes keyword arguments to
+# change these values. restype should be a ctypes type
+# and argtypes should be a list of ctypes types for
+# the arguments of the message only.
+def send_message(receiver, selName, *args, **kwargs):
+ if isinstance(receiver, str):
+ receiver = get_class(receiver)
+ selector = get_selector(selName)
+ restype = kwargs.get('restype', c_void_p)
+ # print('send_message', receiver, selName, args, kwargs)
+ argtypes = kwargs.get('argtypes', [])
+ # Choose the correct version of objc_msgSend based on return type.
+ if should_use_fpret(restype):
+ objc.objc_msgSend_fpret.restype = restype
+ objc.objc_msgSend_fpret.argtypes = [c_void_p, c_void_p] + argtypes
+ result = objc.objc_msgSend_fpret(receiver, selector, *args)
+ elif x86_should_use_stret(restype):
+ objc.objc_msgSend_stret.argtypes = [POINTER(restype), c_void_p, c_void_p] + argtypes
+ result = restype()
+ objc.objc_msgSend_stret(byref(result), receiver, selector, *args)
+ else:
+ objc.objc_msgSend.restype = restype
+ objc.objc_msgSend.argtypes = [c_void_p, c_void_p] + argtypes
+ result = objc.objc_msgSend(receiver, selector, *args)
+ if restype == c_void_p:
+ result = c_void_p(result)
+ return result
+
+
+class OBJC_SUPER(Structure):
+ _fields_ = [('receiver', c_void_p), ('class', c_void_p)]
+
+
+OBJC_SUPER_PTR = POINTER(OBJC_SUPER)
+
+
+# http://stackoverflow.com/questions/3095360/what-exactly-is-super-in-objective-c
+#
+# `superclass_name` is optional and can be used to force finding the superclass
+# by name. It is used to circumvent a bug in which the superclass was resolved
+# incorrectly which lead to an infinite recursion:
+# https://github.com/pyglet/pyglet/issues/5
+def send_super(receiver, selName, *args, superclass_name=None, **kwargs):
+ if hasattr(receiver, '_as_parameter_'):
+ receiver = receiver._as_parameter_
+ if superclass_name is None:
+ superclass = get_superclass_of_object(receiver)
+ else:
+ superclass = get_class(superclass_name)
+ super_struct = OBJC_SUPER(receiver, superclass)
+ selector = get_selector(selName)
+ restype = kwargs.get('restype', c_void_p)
+ argtypes = kwargs.get('argtypes', None)
+ objc.objc_msgSendSuper.restype = restype
+ if argtypes:
+ objc.objc_msgSendSuper.argtypes = [OBJC_SUPER_PTR, c_void_p] + argtypes
+ else:
+ objc.objc_msgSendSuper.argtypes = None
+ result = objc.objc_msgSendSuper(byref(super_struct), selector, *args)
+ if restype == c_void_p:
+ result = c_void_p(result)
+ return result
+
+
+######################################################################
+
+cfunctype_table = {}
+
+
+def parse_type_encoding(encoding):
+ """Takes a type encoding string and outputs a list of the separated type codes.
+ Currently does not handle unions or bitfields and strips out any field width
+ specifiers or type specifiers from the encoding. For Python 3.2+, encoding is
+ assumed to be a bytes object and not unicode.
+
+ Examples:
+ parse_type_encoding('^v16@0:8') --> ['^v', '@', ':']
+ parse_type_encoding('{CGSize=dd}40@0:8{CGSize=dd}16Q32') --> ['{CGSize=dd}', '@', ':', '{CGSize=dd}', 'Q']
+ """
+ type_encodings = []
+ brace_count = 0 # number of unclosed curly braces
+ bracket_count = 0 # number of unclosed square brackets
+ typecode = b''
+ for c in encoding:
+ # In Python 3, c comes out as an integer in the range 0-255. In Python 2, c is a single character string.
+ # To fix the disparity, we convert c to a bytes object if necessary.
+ if isinstance(c, int):
+ c = bytes([c])
+
+ if c == b'{':
+ # Check if this marked the end of previous type code.
+ if typecode and typecode[-1:] != b'^' and brace_count == 0 and bracket_count == 0:
+ type_encodings.append(typecode)
+ typecode = b''
+ typecode += c
+ brace_count += 1
+ elif c == b'}':
+ typecode += c
+ brace_count -= 1
+ assert (brace_count >= 0)
+ elif c == b'[':
+ # Check if this marked the end of previous type code.
+ if typecode and typecode[-1:] != b'^' and brace_count == 0 and bracket_count == 0:
+ type_encodings.append(typecode)
+ typecode = b''
+ typecode += c
+ bracket_count += 1
+ elif c == b']':
+ typecode += c
+ bracket_count -= 1
+ assert (bracket_count >= 0)
+ elif brace_count or bracket_count:
+ # Anything encountered while inside braces or brackets gets stuck on.
+ typecode += c
+ elif c in b'0123456789':
+ # Ignore field width specifiers for now.
+ pass
+ elif c in b'rnNoORV':
+ # Also ignore type specifiers.
+ pass
+ elif c in b'^cislqCISLQfdBv*@#:b?':
+ if typecode and typecode[-1:] == b'^':
+ # Previous char was pointer specifier, so keep going.
+ typecode += c
+ else:
+ # Add previous type code to the list.
+ if typecode:
+ type_encodings.append(typecode)
+ # Start a new type code.
+ typecode = c
+
+ # Add the last type code to the list
+ if typecode:
+ type_encodings.append(typecode)
+
+ return type_encodings
+
+
+# Limited to basic types and pointers to basic types.
+# Does not try to handle arrays, arbitrary structs, unions, or bitfields.
+# Assume that encoding is a bytes object and not unicode.
+def cfunctype_for_encoding(encoding):
+ # Check if we've already created a CFUNCTYPE for this encoding.
+ # If so, then return the cached CFUNCTYPE.
+ if encoding in cfunctype_table:
+ return cfunctype_table[encoding]
+
+ # Otherwise, create a new CFUNCTYPE for the encoding.
+ typecodes = {b'c': c_char, b'i': c_int, b's': c_short, b'l': c_long, b'q': c_longlong,
+ b'C': c_ubyte, b'I': c_uint, b'S': c_ushort, b'L': c_ulong, b'Q': c_ulonglong,
+ b'f': c_float, b'd': c_double, b'B': c_bool, b'v': None, b'*': c_char_p,
+ b'@': c_void_p, b'#': c_void_p, b':': c_void_p, NSPointEncoding: NSPoint,
+ NSSizeEncoding: NSSize, NSRectEncoding: NSRect, NSRangeEncoding: NSRange,
+ PyObjectEncoding: py_object}
+ argtypes = []
+ for code in parse_type_encoding(encoding):
+ if code in typecodes:
+ argtypes.append(typecodes[code])
+ elif code[0:1] == b'^' and code[1:] in typecodes:
+ argtypes.append(POINTER(typecodes[code[1:]]))
+ else:
+ raise Exception('unknown type encoding: ' + code)
+
+ cfunctype = CFUNCTYPE(*argtypes)
+
+ # Cache the new CFUNCTYPE in the cfunctype_table.
+ # We do this mainly because it prevents the CFUNCTYPE
+ # from being garbage-collected while we need it.
+ cfunctype_table[encoding] = cfunctype
+ return cfunctype
+
+
+######################################################################
+
+# After calling create_subclass, you must first register
+# it with register_subclass before you may use it.
+# You can add new methods after the class is registered,
+# but you cannot add any new ivars.
+def create_subclass(superclass, name):
+ if isinstance(superclass, str):
+ superclass = get_class(superclass)
+ return c_void_p(objc.objc_allocateClassPair(superclass, ensure_bytes(name), 0))
+
+
+def register_subclass(subclass):
+ objc.objc_registerClassPair(subclass)
+
+
+# types is a string encoding the argument types of the method.
+# The first type code of types is the return type (e.g. 'v' if void)
+# The second type code must be '@' for id self.
+# The third type code must be ':' for SEL cmd.
+# Additional type codes are for types of other arguments if any.
+def add_method(cls, selName, method, types):
+ type_encodings = parse_type_encoding(types)
+ assert (type_encodings[1] == b'@') # ensure id self typecode
+ assert (type_encodings[2] == b':') # ensure SEL cmd typecode
+ selector = get_selector(selName)
+ cfunctype = cfunctype_for_encoding(types)
+ imp = cfunctype(method)
+ objc.class_addMethod.argtypes = [c_void_p, c_void_p, cfunctype, c_char_p]
+ objc.class_addMethod(cls, selector, imp, types)
+ return imp
+
+
+def add_ivar(cls, name, vartype):
+ return objc.class_addIvar(cls, ensure_bytes(name), sizeof(vartype), alignment(vartype), encoding_for_ctype(vartype))
+
+
+def set_instance_variable(obj, varname, value, vartype):
+ objc.object_setInstanceVariable.argtypes = [c_void_p, c_char_p, vartype]
+ objc.object_setInstanceVariable(obj, ensure_bytes(varname), value)
+
+
+def get_instance_variable(obj, varname, vartype):
+ variable = vartype()
+ objc.object_getInstanceVariable(obj, ensure_bytes(varname), byref(variable))
+ return variable.value
+
+
+######################################################################
+
+class ObjCMethod:
+ """This represents an unbound Objective-C method (really an IMP)."""
+
+ # Note, need to map 'c' to c_byte rather than c_char, because otherwise
+ # ctypes converts the value into a one-character string which is generally
+ # not what we want at all, especially when the 'c' represents a bool var.
+ typecodes = {b'c': c_byte, b'i': c_int, b's': c_short, b'l': c_long, b'q': c_longlong,
+ b'C': c_ubyte, b'I': c_uint, b'S': c_ushort, b'L': c_ulong, b'Q': c_ulonglong,
+ b'f': c_float, b'd': c_double, b'B': c_bool, b'v': None, b'Vv': None, b'*': c_char_p,
+ b'@': c_void_p, b'#': c_void_p, b':': c_void_p, b'^v': c_void_p, b'?': c_void_p,
+ NSPointEncoding: NSPoint, NSSizeEncoding: NSSize, NSRectEncoding: NSRect,
+ NSRangeEncoding: NSRange,
+ PyObjectEncoding: py_object}
+
+ cfunctype_table = {}
+
+ def __init__(self, method):
+ """Initialize with an Objective-C Method pointer. We then determine
+ the return type and argument type information of the method."""
+ self.selector = c_void_p(objc.method_getName(method))
+ self.name = objc.sel_getName(self.selector)
+ self.pyname = self.name.replace(b':', b'_')
+ self.encoding = objc.method_getTypeEncoding(method)
+ self.return_type = objc.method_copyReturnType(method)
+ self.nargs = objc.method_getNumberOfArguments(method)
+ self.imp = c_void_p(objc.method_getImplementation(method))
+ self.argument_types = []
+ for i in range(self.nargs):
+ buffer = c_buffer(512)
+ objc.method_getArgumentType(method, i, buffer, len(buffer))
+ self.argument_types.append(buffer.value)
+ # Get types for all the arguments.
+ try:
+ self.argtypes = [self.ctype_for_encoding(t) for t in self.argument_types]
+ except:
+ # print(f'no argtypes encoding for {self.name} ({self.argument_types})')
+ self.argtypes = None
+ # Get types for the return type.
+ try:
+ if self.return_type == b'@':
+ self.restype = ObjCInstance
+ elif self.return_type == b'#':
+ self.restype = ObjCClass
+ else:
+ self.restype = self.ctype_for_encoding(self.return_type)
+ except:
+ # print(f'no restype encoding for {self.name} ({self.return_type})')
+ self.restype = None
+ self.func = None
+
+ def ctype_for_encoding(self, encoding):
+ """Return ctypes type for an encoded Objective-C type."""
+ if encoding in self.typecodes:
+ return self.typecodes[encoding]
+ elif encoding[0:1] == b'^' and encoding[1:] in self.typecodes:
+ return POINTER(self.typecodes[encoding[1:]])
+ elif encoding[0:1] == b'^' and encoding[1:] in [CGImageEncoding, NSZoneEncoding]:
+ # special cases
+ return c_void_p
+ elif encoding[0:1] == b'r' and encoding[1:] in self.typecodes:
+ # const decorator, don't care
+ return self.typecodes[encoding[1:]]
+ elif encoding[0:2] == b'r^' and encoding[2:] in self.typecodes:
+ # const pointer, also don't care
+ return POINTER(self.typecodes[encoding[2:]])
+ else:
+ raise Exception('unknown encoding for %s: %s' % (self.name, encoding))
+
+ def get_prototype(self):
+ """Returns a ctypes CFUNCTYPE for the method."""
+ if self.restype == ObjCInstance or self.restype == ObjCClass:
+ # Some hacky stuff to get around ctypes issues on 64-bit. Can't let
+ # ctypes convert the return value itself, because it truncates the pointer
+ # along the way. So instead, we must do set the return type to c_void_p to
+ # ensure we get 64-bit addresses and then convert the return value manually.
+ self.prototype = CFUNCTYPE(c_void_p, *self.argtypes)
+ else:
+ self.prototype = CFUNCTYPE(self.restype, *self.argtypes)
+ return self.prototype
+
+ def __repr__(self):
+ return "" % (self.name, self.encoding)
+
+ def get_callable(self):
+ """Returns a python-callable version of the method's IMP."""
+ if not self.func:
+ prototype = self.get_prototype()
+ self.func = cast(self.imp, prototype)
+ if self.restype == ObjCInstance or self.restype == ObjCClass:
+ self.func.restype = c_void_p
+ else:
+ self.func.restype = self.restype
+ self.func.argtypes = self.argtypes
+ return self.func
+
+ def __call__(self, objc_id, *args):
+ """Call the method with the given id and arguments. You do not need
+ to pass in the selector as an argument since it will be automatically
+ provided."""
+ f = self.get_callable()
+ try:
+ result = f(objc_id, self.selector, *args)
+ # Convert result to python type if it is a instance or class pointer.
+ if self.restype == ObjCInstance:
+ result = ObjCInstance(result)
+ elif self.restype == ObjCClass:
+ result = ObjCClass(result)
+ return result
+ except ArgumentError as error:
+ # Add more useful info to argument error exceptions, then reraise.
+ error.args += ('selector = ' + str(self.name),
+ 'argtypes =' + str(self.argtypes),
+ 'encoding = ' + str(self.encoding))
+ raise
+
+
+######################################################################
+
+class ObjCBoundMethod:
+ """This represents an Objective-C method (an IMP) which has been bound
+ to some id which will be passed as the first parameter to the method."""
+
+ def __init__(self, method, objc_id):
+ """Initialize with a method and ObjCInstance or ObjCClass object."""
+ self.method = method
+ self.objc_id = objc_id
+
+ def __repr__(self):
+ return '' % (self.method.name, self.objc_id)
+
+ def __call__(self, *args):
+ """Call the method with the given arguments."""
+ return self.method(self.objc_id, *args)
+
+
+######################################################################
+
+class ObjCClass:
+ """Python wrapper for an Objective-C class."""
+
+ # We only create one Python object for each Objective-C class.
+ # Any future calls with the same class will return the previously
+ # created Python object. Note that these aren't weak references.
+ # After you create an ObjCClass, it will exist until the end of the
+ # program.
+ _registered_classes = {}
+
+ def __new__(cls, class_name_or_ptr):
+ """Create a new ObjCClass instance or return a previously created
+ instance for the given Objective-C class. The argument may be either
+ the name of the class to retrieve, or a pointer to the class."""
+ # Determine name and ptr values from passed in argument.
+ if isinstance(class_name_or_ptr, str):
+ name = class_name_or_ptr
+ ptr = get_class(name)
+ else:
+ ptr = class_name_or_ptr
+ # Make sure that ptr value is wrapped in c_void_p object
+ # for safety when passing as ctypes argument.
+ if not isinstance(ptr, c_void_p):
+ ptr = c_void_p(ptr)
+ name = objc.class_getName(ptr)
+
+ # Check if we've already created a Python object for this class
+ # and if so, return it rather than making a new one.
+ if name in cls._registered_classes:
+ return cls._registered_classes[name]
+
+ # Otherwise create a new Python object and then initialize it.
+ objc_class = super(ObjCClass, cls).__new__(cls)
+ objc_class.ptr = ptr
+ objc_class.name = name
+ objc_class.instance_methods = {} # mapping of name -> instance method
+ objc_class.class_methods = {} # mapping of name -> class method
+ objc_class._as_parameter_ = ptr # for ctypes argument passing
+
+ # Store the new class in dictionary of registered classes.
+ cls._registered_classes[name] = objc_class
+
+ # Not sure this is necessary...
+ objc_class.cache_instance_methods()
+ objc_class.cache_class_methods()
+
+ return objc_class
+
+ def __repr__(self):
+ return "" % (self.name, str(self.ptr.value))
+
+ def cache_instance_methods(self):
+ """Create and store python representations of all instance methods
+ implemented by this class (but does not find methods of superclass)."""
+ count = c_uint()
+ method_array = objc.class_copyMethodList(self.ptr, byref(count))
+ for i in range(count.value):
+ method = c_void_p(method_array[i])
+ objc_method = ObjCMethod(method)
+ self.instance_methods[objc_method.pyname] = objc_method
+
+ def cache_class_methods(self):
+ """Create and store python representations of all class methods
+ implemented by this class (but does not find methods of superclass)."""
+ count = c_uint()
+ method_array = objc.class_copyMethodList(objc.object_getClass(self.ptr), byref(count))
+ for i in range(count.value):
+ method = c_void_p(method_array[i])
+ objc_method = ObjCMethod(method)
+ self.class_methods[objc_method.pyname] = objc_method
+
+ def get_instance_method(self, name):
+ """Returns a python representation of the named instance method,
+ either by looking it up in the cached list of methods or by searching
+ for and creating a new method object."""
+ if name in self.instance_methods:
+ return self.instance_methods[name]
+ else:
+ # If method name isn't in the cached list, it might be a method of
+ # the superclass, so call class_getInstanceMethod to check.
+ selector = get_selector(name.replace(b'_', b':'))
+ method = c_void_p(objc.class_getInstanceMethod(self.ptr, selector))
+ if method.value:
+ objc_method = ObjCMethod(method)
+ self.instance_methods[name] = objc_method
+ return objc_method
+ return None
+
+ def get_class_method(self, name):
+ """Returns a python representation of the named class method,
+ either by looking it up in the cached list of methods or by searching
+ for and creating a new method object."""
+ if name in self.class_methods:
+ return self.class_methods[name]
+ else:
+ # If method name isn't in the cached list, it might be a method of
+ # the superclass, so call class_getInstanceMethod to check.
+ selector = get_selector(name.replace(b'_', b':'))
+ method = c_void_p(objc.class_getClassMethod(self.ptr, selector))
+ if method.value:
+ objc_method = ObjCMethod(method)
+ self.class_methods[name] = objc_method
+ return objc_method
+ return None
+
+ def __getattr__(self, name):
+ """Returns a callable method object with the given name."""
+ # If name refers to a class method, then return a callable object
+ # for the class method with self.ptr as hidden first parameter.
+ name = ensure_bytes(name)
+ method = self.get_class_method(name)
+ if method:
+ return ObjCBoundMethod(method, self.ptr)
+ # If name refers to an instance method, then simply return the method.
+ # The caller will need to supply an instance as the first parameter.
+ method = self.get_instance_method(name)
+ if method:
+ return method
+ # Otherwise, raise an exception.
+ raise AttributeError('ObjCClass %s has no attribute %s' % (self.name, name))
+
+
+######################################################################
+
+class ObjCInstance:
+ """Python wrapper for an Objective-C instance."""
+
+ _cached_objects = {}
+
+ def __new__(cls, object_ptr):
+ """Create a new ObjCInstance or return a previously created one
+ for the given object_ptr which should be an Objective-C id."""
+ # Make sure that object_ptr is wrapped in a c_void_p.
+ if not isinstance(object_ptr, c_void_p):
+ object_ptr = c_void_p(object_ptr)
+
+ # If given a nil pointer, return None.
+ if not object_ptr.value:
+ return None
+
+ # Check if we've already created an python ObjCInstance for this
+ # object_ptr id and if so, then return it. A single ObjCInstance will
+ # be created for any object pointer when it is first encountered.
+ # This same ObjCInstance will then persist until the object is
+ # deallocated.
+ if object_ptr.value in cls._cached_objects:
+ return cls._cached_objects[object_ptr.value]
+
+ # Otherwise, create a new ObjCInstance.
+ objc_instance = super(ObjCInstance, cls).__new__(cls)
+ objc_instance.ptr = object_ptr
+ objc_instance._as_parameter_ = object_ptr
+ # Determine class of this object.
+ class_ptr = c_void_p(objc.object_getClass(object_ptr))
+ objc_instance.objc_class = ObjCClass(class_ptr)
+
+ # Store new object in the dictionary of cached objects, keyed
+ # by the (integer) memory address pointed to by the object_ptr.
+ cls._cached_objects[object_ptr.value] = objc_instance
+
+ # Create a DeallocationObserver and associate it with this object.
+ # When the Objective-C object is deallocated, the observer will remove
+ # the ObjCInstance corresponding to the object from the cached objects
+ # dictionary, effectively destroying the ObjCInstance.
+ observer = send_message(send_message('DeallocationObserver', 'alloc'), 'initWithObject:', objc_instance)
+ objc.objc_setAssociatedObject(objc_instance, observer, observer, 0x301)
+ # The observer is retained by the object we associate it to. We release
+ # the observer now so that it will be deallocated when the associated
+ # object is deallocated.
+ send_message(observer, 'release')
+
+ return objc_instance
+
+ def __repr__(self):
+ if self.objc_class.name == b'NSCFString':
+ # Display contents of NSString objects
+ from .cocoalibs import cfstring_to_string
+ string = cfstring_to_string(self)
+ return "" % (id(self), self.objc_class.name, string, str(self.ptr.value))
+
+ return "" % (id(self), self.objc_class.name, str(self.ptr.value))
+
+ def __getattr__(self, name):
+ """Returns a callable method object with the given name."""
+ # Search for named instance method in the class object and if it
+ # exists, return callable object with self as hidden argument.
+ # Note: you should give self and not self.ptr as a parameter to
+ # ObjCBoundMethod, so that it will be able to keep the ObjCInstance
+ # alive for chained calls like MyClass.alloc().init() where the
+ # object created by alloc() is not assigned to a variable.
+ name = ensure_bytes(name)
+ method = self.objc_class.get_instance_method(name)
+ if method:
+ return ObjCBoundMethod(method, self)
+ # Else, search for class method with given name in the class object.
+ # If it exists, return callable object with a pointer to the class
+ # as a hidden argument.
+ method = self.objc_class.get_class_method(name)
+ if method:
+ return ObjCBoundMethod(method, self.objc_class.ptr)
+ # Otherwise raise an exception.
+ raise AttributeError('ObjCInstance %s has no attribute %s' % (self.objc_class.name, name))
+
+
+######################################################################
+
+def convert_method_arguments(encoding, args):
+ """Used by ObjCSubclass to convert Objective-C method arguments to
+ Python values before passing them on to the Python-defined method."""
+ new_args = []
+ arg_encodings = parse_type_encoding(encoding)[3:]
+ for e, a in zip(arg_encodings, args):
+ if e == b'@':
+ new_args.append(ObjCInstance(a))
+ elif e == b'#':
+ new_args.append(ObjCClass(a))
+ else:
+ new_args.append(a)
+ return new_args
+
+
+# ObjCSubclass is used to define an Objective-C subclass of an existing
+# class registered with the runtime. When you create an instance of
+# ObjCSubclass, it registers the new subclass with the Objective-C
+# runtime and creates a set of function decorators that you can use to
+# add instance methods or class methods to the subclass.
+#
+# Typical usage would be to first create and register the subclass:
+#
+# MySubclass = ObjCSubclass('NSObject', 'MySubclassName')
+#
+# then add methods with:
+#
+# @MySubclass.method('v')
+# def methodThatReturnsVoid(self):
+# pass
+#
+# @MySubclass.method('Bi')
+# def boolReturningMethodWithInt_(self, x):
+# return True
+#
+# @MySubclass.classmethod('@')
+# def classMethodThatReturnsId(self):
+# return self
+#
+# It is probably a good idea to organize the code related to a single
+# subclass by either putting it in its own module (note that you don't
+# actually need to expose any of the method names or the ObjCSubclass)
+# or by bundling it all up inside a python class definition, perhaps
+# called MySubclassImplementation.
+#
+# It is also possible to add Objective-C ivars to the subclass, however
+# if you do so, you must call the __init__ method with register=False,
+# and then call the register method after the ivars have been added.
+# But rather than creating the ivars in Objective-C land, it is easier
+# to just define python-based instance variables in your subclass's init
+# method.
+#
+# This class is used only to *define* the interface and implementation
+# of an Objective-C subclass from python. It should not be used in
+# any other way. If you want a python representation of the resulting
+# class, create it with ObjCClass.
+#
+# Instances are created as a pointer to the objc object by using:
+#
+# myinstance = send_message('MySubclassName', 'alloc')
+# myinstance = send_message(myinstance, 'init')
+#
+# or wrapped inside an ObjCInstance object by using:
+#
+# myclass = ObjCClass('MySubclassName')
+# myinstance = myclass.alloc().init()
+#
+class ObjCSubclass:
+ """Use this to create a subclass of an existing Objective-C class.
+ It consists primarily of function decorators which you use to add methods
+ to the subclass."""
+
+ def __init__(self, superclass, name, register=True):
+ self._imp_table = {}
+ self.name = name
+ self.objc_cls = create_subclass(superclass, name)
+ self._as_parameter_ = self.objc_cls
+ if register:
+ self.register()
+
+ def register(self):
+ """Register the new class with the Objective-C runtime."""
+ objc.objc_registerClassPair(self.objc_cls)
+ # We can get the metaclass only after the class is registered.
+ self.objc_metaclass = get_metaclass(self.name)
+
+ def add_ivar(self, varname, vartype):
+ """Add instance variable named varname to the subclass.
+ varname should be a string.
+ vartype is a ctypes type.
+ The class must be registered AFTER adding instance variables."""
+ return add_ivar(self.objc_cls, varname, vartype)
+
+ def add_method(self, method, name, encoding):
+ imp = add_method(self.objc_cls, name, method, encoding)
+ self._imp_table[name] = imp
+
+ # http://iphonedevelopment.blogspot.com/2008/08/dynamically-adding-class-objects.html
+ def add_class_method(self, method, name, encoding):
+ imp = add_method(self.objc_metaclass, name, method, encoding)
+ self._imp_table[name] = imp
+
+ def rawmethod(self, encoding):
+ """Decorator for instance methods without any fancy shenanigans.
+ The function must have the signature f(self, cmd, *args)
+ where both self and cmd are just pointers to objc objects."""
+ # Add encodings for hidden self and cmd arguments.
+ encoding = ensure_bytes(encoding)
+ typecodes = parse_type_encoding(encoding)
+ typecodes.insert(1, b'@:')
+ encoding = b''.join(typecodes)
+
+ def decorator(f):
+ name = f.__name__.replace('_', ':')
+ self.add_method(f, name, encoding)
+ return f
+
+ return decorator
+
+ def method(self, encoding):
+ """Function decorator for instance methods."""
+ # Add encodings for hidden self and cmd arguments.
+ encoding = ensure_bytes(encoding)
+ typecodes = parse_type_encoding(encoding)
+ typecodes.insert(1, b'@:')
+ encoding = b''.join(typecodes)
+
+ def decorator(f):
+ def objc_method(objc_self, objc_cmd, *args):
+ py_self = ObjCInstance(objc_self)
+ py_self.objc_cmd = objc_cmd
+ args = convert_method_arguments(encoding, args)
+ result = f(py_self, *args)
+ if isinstance(result, ObjCClass):
+ result = result.ptr.value
+ elif isinstance(result, ObjCInstance):
+ result = result.ptr.value
+ return result
+
+ name = f.__name__.replace('_', ':')
+ self.add_method(objc_method, name, encoding)
+ return objc_method
+
+ return decorator
+
+ def classmethod(self, encoding):
+ """Function decorator for class methods."""
+ # Add encodings for hidden self and cmd arguments.
+ encoding = ensure_bytes(encoding)
+ typecodes = parse_type_encoding(encoding)
+ typecodes.insert(1, b'@:')
+ encoding = b''.join(typecodes)
+
+ def decorator(f):
+ def objc_class_method(objc_cls, objc_cmd, *args):
+ py_cls = ObjCClass(objc_cls)
+ py_cls.objc_cmd = objc_cmd
+ args = convert_method_arguments(encoding, args)
+ result = f(py_cls, *args)
+ if isinstance(result, ObjCClass):
+ result = result.ptr.value
+ elif isinstance(result, ObjCInstance):
+ result = result.ptr.value
+ return result
+
+ name = f.__name__.replace('_', ':')
+ self.add_class_method(objc_class_method, name, encoding)
+ return objc_class_method
+
+ return decorator
+
+
+######################################################################
+
+# Instances of DeallocationObserver are associated with every
+# Objective-C object that gets wrapped inside an ObjCInstance.
+# Their sole purpose is to watch for when the Objective-C object
+# is deallocated, and then remove the object from the dictionary
+# of cached ObjCInstance objects kept by the ObjCInstance class.
+#
+# The methods of the class defined below are decorated with
+# rawmethod() instead of method() because DeallocationObservers
+# are created inside of ObjCInstance's __new__ method and we have
+# to be careful to not create another ObjCInstance here (which
+# happens when the usual method decorator turns the self argument
+# into an ObjCInstance), or else get trapped in an infinite recursion.
+class DeallocationObserver_Implementation:
+ DeallocationObserver = ObjCSubclass('NSObject', 'DeallocationObserver', register=False)
+ DeallocationObserver.add_ivar('observed_object', c_void_p)
+ DeallocationObserver.register()
+
+ @DeallocationObserver.rawmethod('@@')
+ def initWithObject_(self, cmd, anObject):
+ self = send_super(self, 'init')
+ self = self.value
+ set_instance_variable(self, 'observed_object', anObject, c_void_p)
+ return self
+
+ @DeallocationObserver.rawmethod('v')
+ def dealloc(self, cmd):
+ anObject = get_instance_variable(self, 'observed_object', c_void_p)
+ ObjCInstance._cached_objects.pop(anObject, None)
+ send_super(self, 'dealloc')
+
+ @DeallocationObserver.rawmethod('v')
+ def finalize(self, cmd):
+ # Called instead of dealloc if using garbage collection.
+ # (which would have to be explicitly started with
+ # objc_startCollectorThread(), so probably not too much reason
+ # to have this here, but I guess it can't hurt.)
+ anObject = get_instance_variable(self, 'observed_object', c_void_p)
+ ObjCInstance._cached_objects.pop(anObject, None)
+ send_super(self, 'finalize')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/quartzkey.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/quartzkey.py
new file mode 100644
index 0000000000000000000000000000000000000000..7f841facaaa5633dc4679d5bc3871158d90ff160
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/darwin/quartzkey.py
@@ -0,0 +1,264 @@
+from pyglet.window import key
+
+# From SDL: src/video/quartz/SDL_QuartzKeys.h
+# These are the Macintosh key scancode constants -- from Inside Macintosh
+# http://boredzo.org/blog/wp-content/uploads/2007/05/imtx-virtual-keycodes.png
+# Renamed QZ_RALT, QZ_LALT to QZ_ROPTION, QZ_LOPTION
+# and QZ_RMETA, QZ_LMETA to QZ_RCOMMAND, QZ_LCOMMAND.
+#
+# See also:
+# /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Headers/Events.h
+
+QZ_ESCAPE = 0x35
+QZ_F1 = 0x7A
+QZ_F2 = 0x78
+QZ_F3 = 0x63
+QZ_F4 = 0x76
+QZ_F5 = 0x60
+QZ_F6 = 0x61
+QZ_F7 = 0x62
+QZ_F8 = 0x64
+QZ_F9 = 0x65
+QZ_F10 = 0x6D
+QZ_F11 = 0x67
+QZ_F12 = 0x6F
+QZ_F13 = 0x69
+QZ_F14 = 0x6B
+QZ_F15 = 0x71
+QZ_F16 = 0x6A
+QZ_F17 = 0x40
+QZ_F18 = 0x4F
+QZ_F19 = 0x50
+QZ_F20 = 0x5A
+QZ_BACKQUOTE = 0x32
+QZ_1 = 0x12
+QZ_2 = 0x13
+QZ_3 = 0x14
+QZ_4 = 0x15
+QZ_5 = 0x17
+QZ_6 = 0x16
+QZ_7 = 0x1A
+QZ_8 = 0x1C
+QZ_9 = 0x19
+QZ_0 = 0x1D
+QZ_MINUS = 0x1B
+QZ_EQUALS = 0x18
+QZ_BACKSPACE = 0x33
+QZ_INSERT = 0x72
+QZ_HOME = 0x73
+QZ_PAGEUP = 0x74
+QZ_NUMLOCK = 0x47
+QZ_KP_EQUALS = 0x51
+QZ_KP_DIVIDE = 0x4B
+QZ_KP_MULTIPLY = 0x43
+QZ_TAB = 0x30
+QZ_q = 0x0C
+QZ_w = 0x0D
+QZ_e = 0x0E
+QZ_r = 0x0F
+QZ_t = 0x11
+QZ_y = 0x10
+QZ_u = 0x20
+QZ_i = 0x22
+QZ_o = 0x1F
+QZ_p = 0x23
+QZ_LEFTBRACKET = 0x21
+QZ_RIGHTBRACKET = 0x1E
+QZ_BACKSLASH = 0x2A
+QZ_DELETE = 0x75
+QZ_END = 0x77
+QZ_PAGEDOWN = 0x79
+QZ_KP7 = 0x59
+QZ_KP8 = 0x5B
+QZ_KP9 = 0x5C
+QZ_KP_MINUS = 0x4E
+QZ_CAPSLOCK = 0x39
+QZ_a = 0x00
+QZ_s = 0x01
+QZ_d = 0x02
+QZ_f = 0x03
+QZ_g = 0x05
+QZ_h = 0x04
+QZ_j = 0x26
+QZ_k = 0x28
+QZ_l = 0x25
+QZ_SEMICOLON = 0x29
+QZ_QUOTE = 0x27
+QZ_RETURN = 0x24
+QZ_KP4 = 0x56
+QZ_KP5 = 0x57
+QZ_KP6 = 0x58
+QZ_KP_PLUS = 0x45
+QZ_LSHIFT = 0x38
+QZ_z = 0x06
+QZ_x = 0x07
+QZ_c = 0x08
+QZ_v = 0x09
+QZ_b = 0x0B
+QZ_n = 0x2D
+QZ_m = 0x2E
+QZ_COMMA = 0x2B
+QZ_PERIOD = 0x2F
+QZ_SLASH = 0x2C
+QZ_RSHIFT = 0x3C
+QZ_UP = 0x7E
+QZ_KP1 = 0x53
+QZ_KP2 = 0x54
+QZ_KP3 = 0x55
+QZ_KP_ENTER = 0x4C
+QZ_LCTRL = 0x3B
+QZ_LOPTION = 0x3A
+QZ_LCOMMAND = 0x37
+QZ_SPACE = 0x31
+QZ_RCOMMAND = 0x36
+QZ_ROPTION = 0x3D
+QZ_RCTRL = 0x3E
+QZ_FUNCTION = 0x3F
+QZ_LEFT = 0x7B
+QZ_DOWN = 0x7D
+QZ_RIGHT = 0x7C
+QZ_KP0 = 0x52
+QZ_KP_PERIOD = 0x41
+
+# This map contains only keys that can be directly translated independent of
+# keyboard layout and locale
+keymap = {
+ QZ_ESCAPE: key.ESCAPE,
+ QZ_F1: key.F1,
+ QZ_F2: key.F2,
+ QZ_F3: key.F3,
+ QZ_F4: key.F4,
+ QZ_F5: key.F5,
+ QZ_F6: key.F6,
+ QZ_F7: key.F7,
+ QZ_F8: key.F8,
+ QZ_F9: key.F9,
+ QZ_F10: key.F10,
+ QZ_F11: key.F11,
+ QZ_F12: key.F12,
+ QZ_F13: key.F13,
+ QZ_F14: key.F14,
+ QZ_F15: key.F15,
+ QZ_F16: key.F16,
+ QZ_F17: key.F17,
+ QZ_F18: key.F18,
+ QZ_F19: key.F19,
+ QZ_F20: key.F20,
+ QZ_BACKSPACE: key.BACKSPACE,
+ QZ_INSERT: key.INSERT,
+ QZ_HOME: key.HOME,
+ QZ_PAGEUP: key.PAGEUP,
+ QZ_NUMLOCK: key.NUMLOCK,
+ QZ_KP_EQUALS: key.NUM_EQUAL,
+ QZ_KP_DIVIDE: key.NUM_DIVIDE,
+ QZ_KP_MULTIPLY: key.NUM_MULTIPLY,
+ QZ_TAB: key.TAB,
+ QZ_BACKSLASH: key.BACKSLASH,
+ QZ_DELETE: key.DELETE,
+ QZ_END: key.END,
+ QZ_PAGEDOWN: key.PAGEDOWN,
+ QZ_KP7: key.NUM_7,
+ QZ_KP8: key.NUM_8,
+ QZ_KP9: key.NUM_9,
+ QZ_KP_MINUS: key.NUM_SUBTRACT,
+ QZ_CAPSLOCK: key.CAPSLOCK,
+ QZ_RETURN: key.RETURN,
+ QZ_KP4: key.NUM_4,
+ QZ_KP5: key.NUM_5,
+ QZ_KP6: key.NUM_6,
+ QZ_KP_PLUS: key.NUM_ADD,
+ QZ_LSHIFT: key.LSHIFT,
+ QZ_RSHIFT: key.RSHIFT,
+ QZ_UP: key.UP,
+ QZ_KP1: key.NUM_1,
+ QZ_KP2: key.NUM_2,
+ QZ_KP3: key.NUM_3,
+ QZ_KP_ENTER: key.NUM_ENTER,
+ QZ_LCTRL: key.LCTRL,
+ QZ_LOPTION: key.LOPTION,
+ QZ_LCOMMAND: key.LCOMMAND,
+ QZ_SPACE: key.SPACE,
+ QZ_RCOMMAND: key.RCOMMAND,
+ QZ_ROPTION: key.ROPTION,
+ QZ_RCTRL: key.RCTRL,
+ QZ_FUNCTION: key.FUNCTION,
+ QZ_LEFT: key.LEFT,
+ QZ_DOWN: key.DOWN,
+ QZ_RIGHT: key.RIGHT,
+ QZ_KP0: key.NUM_0,
+ QZ_KP_PERIOD: key.NUM_DECIMAL,
+}
+
+charmap = {
+ ' ': key.SPACE,
+ '!': key.EXCLAMATION,
+ '"': key.DOUBLEQUOTE,
+ '#': key.HASH,
+ '#': key.POUND,
+ '$': key.DOLLAR,
+ '%': key.PERCENT,
+ '&': key.AMPERSAND,
+ "'": key.APOSTROPHE,
+ '(': key.PARENLEFT,
+ ')': key.PARENRIGHT,
+ '*': key.ASTERISK,
+ '+': key.PLUS,
+ ',': key.COMMA,
+ '-': key.MINUS,
+ '.': key.PERIOD,
+ '/': key.SLASH,
+ '0': key._0,
+ '1': key._1,
+ '2': key._2,
+ '3': key._3,
+ '4': key._4,
+ '5': key._5,
+ '6': key._6,
+ '7': key._7,
+ '8': key._8,
+ '9': key._9,
+ ':': key.COLON,
+ ';': key.SEMICOLON,
+ '<': key.LESS,
+ '=': key.EQUAL,
+ '>': key.GREATER,
+ '?': key.QUESTION,
+ '@': key.AT,
+ '[': key.BRACKETLEFT,
+ '\\': key.BACKSLASH,
+ ']': key.BRACKETRIGHT,
+ '^': key.ASCIICIRCUM,
+ '_': key.UNDERSCORE,
+ '`': key.GRAVE,
+ '`': key.QUOTELEFT,
+ 'A': key.A,
+ 'B': key.B,
+ 'C': key.C,
+ 'D': key.D,
+ 'E': key.E,
+ 'F': key.F,
+ 'G': key.G,
+ 'H': key.H,
+ 'I': key.I,
+ 'J': key.J,
+ 'K': key.K,
+ 'L': key.L,
+ 'M': key.M,
+ 'N': key.N,
+ 'O': key.O,
+ 'P': key.P,
+ 'Q': key.Q,
+ 'R': key.R,
+ 'S': key.S,
+ 'T': key.T,
+ 'U': key.U,
+ 'V': key.V,
+ 'W': key.W,
+ 'X': key.X,
+ 'Y': key.Y,
+ 'Z': key.Z,
+ '{': key.BRACELEFT,
+ '|': key.BAR,
+ '}': key.BRACERIGHT,
+ '~': key.ASCIITILDE
+}
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/egl/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/egl/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/egl/egl.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/egl/egl.py
new file mode 100644
index 0000000000000000000000000000000000000000..2bd4808c080912201829e0e80db48e947d32d145
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/egl/egl.py
@@ -0,0 +1,568 @@
+"""Wrapper for /usr/include/EGL/egl
+
+Generated with:
+wrap.py -o lib_egl.py /usr/include/EGL/egl.h
+
+Do not modify this file.
+"""
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('EGL')
+
+
+__egl_h_ = 1 # /usr/include/EGL/egl.h:2
+EGL_EGL_PROTOTYPES = 1 # /usr/include/EGL/egl.h:42
+EGL_VERSION_1_0 = 1 # /usr/include/EGL/egl.h:57
+EGLBoolean = c_uint # /usr/include/EGL/egl.h:58
+EGLDisplay = POINTER(None) # /usr/include/EGL/egl.h:59
+EGLConfig = POINTER(None) # /usr/include/EGL/egl.h:62
+EGLSurface = POINTER(None) # /usr/include/EGL/egl.h:63
+EGLContext = POINTER(None) # /usr/include/EGL/egl.h:64
+__eglMustCastToProperFunctionPointerType = CFUNCTYPE(None) # /usr/include/EGL/egl.h:65
+EGL_ALPHA_SIZE = 12321 # /usr/include/EGL/egl.h:66
+EGL_BAD_ACCESS = 12290 # /usr/include/EGL/egl.h:67
+EGL_BAD_ALLOC = 12291 # /usr/include/EGL/egl.h:68
+EGL_BAD_ATTRIBUTE = 12292 # /usr/include/EGL/egl.h:69
+EGL_BAD_CONFIG = 12293 # /usr/include/EGL/egl.h:70
+EGL_BAD_CONTEXT = 12294 # /usr/include/EGL/egl.h:71
+EGL_BAD_CURRENT_SURFACE = 12295 # /usr/include/EGL/egl.h:72
+EGL_BAD_DISPLAY = 12296 # /usr/include/EGL/egl.h:73
+EGL_BAD_MATCH = 12297 # /usr/include/EGL/egl.h:74
+EGL_BAD_NATIVE_PIXMAP = 12298 # /usr/include/EGL/egl.h:75
+EGL_BAD_NATIVE_WINDOW = 12299 # /usr/include/EGL/egl.h:76
+EGL_BAD_PARAMETER = 12300 # /usr/include/EGL/egl.h:77
+EGL_BAD_SURFACE = 12301 # /usr/include/EGL/egl.h:78
+EGL_BLUE_SIZE = 12322 # /usr/include/EGL/egl.h:79
+EGL_BUFFER_SIZE = 12320 # /usr/include/EGL/egl.h:80
+EGL_CONFIG_CAVEAT = 12327 # /usr/include/EGL/egl.h:81
+EGL_CONFIG_ID = 12328 # /usr/include/EGL/egl.h:82
+EGL_CORE_NATIVE_ENGINE = 12379 # /usr/include/EGL/egl.h:83
+EGL_DEPTH_SIZE = 12325 # /usr/include/EGL/egl.h:84
+EGL_DRAW = 12377 # /usr/include/EGL/egl.h:86
+EGL_EXTENSIONS = 12373 # /usr/include/EGL/egl.h:87
+EGL_FALSE = 0 # /usr/include/EGL/egl.h:88
+EGL_GREEN_SIZE = 12323 # /usr/include/EGL/egl.h:89
+EGL_HEIGHT = 12374 # /usr/include/EGL/egl.h:90
+EGL_LARGEST_PBUFFER = 12376 # /usr/include/EGL/egl.h:91
+EGL_LEVEL = 12329 # /usr/include/EGL/egl.h:92
+EGL_MAX_PBUFFER_HEIGHT = 12330 # /usr/include/EGL/egl.h:93
+EGL_MAX_PBUFFER_PIXELS = 12331 # /usr/include/EGL/egl.h:94
+EGL_MAX_PBUFFER_WIDTH = 12332 # /usr/include/EGL/egl.h:95
+EGL_NATIVE_RENDERABLE = 12333 # /usr/include/EGL/egl.h:96
+EGL_NATIVE_VISUAL_ID = 12334 # /usr/include/EGL/egl.h:97
+EGL_NATIVE_VISUAL_TYPE = 12335 # /usr/include/EGL/egl.h:98
+EGL_NONE = 12344 # /usr/include/EGL/egl.h:99
+EGL_NON_CONFORMANT_CONFIG = 12369 # /usr/include/EGL/egl.h:100
+EGL_NOT_INITIALIZED = 12289 # /usr/include/EGL/egl.h:101
+EGL_PBUFFER_BIT = 1 # /usr/include/EGL/egl.h:105
+EGL_PIXMAP_BIT = 2 # /usr/include/EGL/egl.h:106
+EGL_READ = 12378 # /usr/include/EGL/egl.h:107
+EGL_RED_SIZE = 12324 # /usr/include/EGL/egl.h:108
+EGL_SAMPLES = 12337 # /usr/include/EGL/egl.h:109
+EGL_SAMPLE_BUFFERS = 12338 # /usr/include/EGL/egl.h:110
+EGL_SLOW_CONFIG = 12368 # /usr/include/EGL/egl.h:111
+EGL_STENCIL_SIZE = 12326 # /usr/include/EGL/egl.h:112
+EGL_SUCCESS = 12288 # /usr/include/EGL/egl.h:113
+EGL_SURFACE_TYPE = 12339 # /usr/include/EGL/egl.h:114
+EGL_TRANSPARENT_BLUE_VALUE = 12341 # /usr/include/EGL/egl.h:115
+EGL_TRANSPARENT_GREEN_VALUE = 12342 # /usr/include/EGL/egl.h:116
+EGL_TRANSPARENT_RED_VALUE = 12343 # /usr/include/EGL/egl.h:117
+EGL_TRANSPARENT_RGB = 12370 # /usr/include/EGL/egl.h:118
+EGL_TRANSPARENT_TYPE = 12340 # /usr/include/EGL/egl.h:119
+EGL_TRUE = 1 # /usr/include/EGL/egl.h:120
+EGL_VENDOR = 12371 # /usr/include/EGL/egl.h:121
+EGL_VERSION = 12372 # /usr/include/EGL/egl.h:122
+EGL_WIDTH = 12375 # /usr/include/EGL/egl.h:123
+EGL_WINDOW_BIT = 4 # /usr/include/EGL/egl.h:124
+khronos_int32_t = c_int32 # /usr/include/KHR/khrplatform.h:150
+EGLint = khronos_int32_t # /usr/include/EGL/eglplatform.h:166
+PFNEGLCHOOSECONFIGPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, POINTER(EGLint), POINTER(EGLConfig), EGLint, POINTER(EGLint)) # /usr/include/EGL/egl.h:125
+XID = c_ulong # /usr/include/X11/X.h:66
+Pixmap = XID # /usr/include/X11/X.h:102
+EGLNativePixmapType = Pixmap # /usr/include/EGL/eglplatform.h:132
+PFNEGLCOPYBUFFERSPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLSurface, EGLNativePixmapType) # /usr/include/EGL/egl.h:126
+PFNEGLCREATECONTEXTPROC = CFUNCTYPE(EGLContext, EGLDisplay, EGLConfig, EGLContext, POINTER(EGLint)) # /usr/include/EGL/egl.h:127
+PFNEGLCREATEPBUFFERSURFACEPROC = CFUNCTYPE(EGLSurface, EGLDisplay, EGLConfig, POINTER(EGLint)) # /usr/include/EGL/egl.h:128
+PFNEGLCREATEPIXMAPSURFACEPROC = CFUNCTYPE(EGLSurface, EGLDisplay, EGLConfig, EGLNativePixmapType, POINTER(EGLint)) # /usr/include/EGL/egl.h:129
+Window = XID # /usr/include/X11/X.h:96
+EGLNativeWindowType = Window # /usr/include/EGL/eglplatform.h:133
+PFNEGLCREATEWINDOWSURFACEPROC = CFUNCTYPE(EGLSurface, EGLDisplay, EGLConfig, EGLNativeWindowType, POINTER(EGLint)) # /usr/include/EGL/egl.h:130
+PFNEGLDESTROYCONTEXTPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLContext) # /usr/include/EGL/egl.h:131
+PFNEGLDESTROYSURFACEPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLSurface) # /usr/include/EGL/egl.h:132
+PFNEGLGETCONFIGATTRIBPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLConfig, EGLint, POINTER(EGLint)) # /usr/include/EGL/egl.h:133
+PFNEGLGETCONFIGSPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, POINTER(EGLConfig), EGLint, POINTER(EGLint)) # /usr/include/EGL/egl.h:134
+PFNEGLGETCURRENTDISPLAYPROC = CFUNCTYPE(EGLDisplay) # /usr/include/EGL/egl.h:135
+PFNEGLGETCURRENTSURFACEPROC = CFUNCTYPE(EGLSurface, EGLint) # /usr/include/EGL/egl.h:136
+
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+Display = struct__XDisplay # /usr/include/X11/Xlib.h:487
+EGLNativeDisplayType = POINTER(Display) # /usr/include/EGL/eglplatform.h:131
+PFNEGLGETDISPLAYPROC = CFUNCTYPE(EGLDisplay, EGLNativeDisplayType) # /usr/include/EGL/egl.h:137
+PFNEGLGETERRORPROC = CFUNCTYPE(EGLint) # /usr/include/EGL/egl.h:138
+PFNEGLGETPROCADDRESSPROC = CFUNCTYPE(__eglMustCastToProperFunctionPointerType, c_char_p) # /usr/include/EGL/egl.h:139
+PFNEGLINITIALIZEPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, POINTER(EGLint), POINTER(EGLint)) # /usr/include/EGL/egl.h:140
+PFNEGLMAKECURRENTPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLSurface, EGLSurface, EGLContext) # /usr/include/EGL/egl.h:141
+PFNEGLQUERYCONTEXTPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLContext, EGLint, POINTER(EGLint)) # /usr/include/EGL/egl.h:142
+PFNEGLQUERYSTRINGPROC = CFUNCTYPE(c_char_p, EGLDisplay, EGLint) # /usr/include/EGL/egl.h:143
+PFNEGLQUERYSURFACEPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLSurface, EGLint, POINTER(EGLint)) # /usr/include/EGL/egl.h:144
+PFNEGLSWAPBUFFERSPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLSurface) # /usr/include/EGL/egl.h:145
+PFNEGLTERMINATEPROC = CFUNCTYPE(EGLBoolean, EGLDisplay) # /usr/include/EGL/egl.h:146
+PFNEGLWAITGLPROC = CFUNCTYPE(EGLBoolean) # /usr/include/EGL/egl.h:147
+PFNEGLWAITNATIVEPROC = CFUNCTYPE(EGLBoolean, EGLint) # /usr/include/EGL/egl.h:148
+# /usr/include/EGL/egl.h:150
+eglChooseConfig = _lib.eglChooseConfig
+eglChooseConfig.restype = EGLBoolean
+eglChooseConfig.argtypes = [EGLDisplay, POINTER(EGLint), POINTER(EGLConfig), EGLint, POINTER(EGLint)]
+
+# /usr/include/EGL/egl.h:151
+eglCopyBuffers = _lib.eglCopyBuffers
+eglCopyBuffers.restype = EGLBoolean
+eglCopyBuffers.argtypes = [EGLDisplay, EGLSurface, EGLNativePixmapType]
+
+# /usr/include/EGL/egl.h:152
+eglCreateContext = _lib.eglCreateContext
+eglCreateContext.restype = EGLContext
+eglCreateContext.argtypes = [EGLDisplay, EGLConfig, EGLContext, POINTER(EGLint)]
+
+# /usr/include/EGL/egl.h:153
+eglCreatePbufferSurface = _lib.eglCreatePbufferSurface
+eglCreatePbufferSurface.restype = EGLSurface
+eglCreatePbufferSurface.argtypes = [EGLDisplay, EGLConfig, POINTER(EGLint)]
+
+# /usr/include/EGL/egl.h:154
+eglCreatePixmapSurface = _lib.eglCreatePixmapSurface
+eglCreatePixmapSurface.restype = EGLSurface
+eglCreatePixmapSurface.argtypes = [EGLDisplay, EGLConfig, EGLNativePixmapType, POINTER(EGLint)]
+
+# /usr/include/EGL/egl.h:155
+eglCreateWindowSurface = _lib.eglCreateWindowSurface
+eglCreateWindowSurface.restype = EGLSurface
+eglCreateWindowSurface.argtypes = [EGLDisplay, EGLConfig, EGLNativeWindowType, POINTER(EGLint)]
+
+# /usr/include/EGL/egl.h:156
+eglDestroyContext = _lib.eglDestroyContext
+eglDestroyContext.restype = EGLBoolean
+eglDestroyContext.argtypes = [EGLDisplay, EGLContext]
+
+# /usr/include/EGL/egl.h:157
+eglDestroySurface = _lib.eglDestroySurface
+eglDestroySurface.restype = EGLBoolean
+eglDestroySurface.argtypes = [EGLDisplay, EGLSurface]
+
+# /usr/include/EGL/egl.h:158
+eglGetConfigAttrib = _lib.eglGetConfigAttrib
+eglGetConfigAttrib.restype = EGLBoolean
+eglGetConfigAttrib.argtypes = [EGLDisplay, EGLConfig, EGLint, POINTER(EGLint)]
+
+# /usr/include/EGL/egl.h:159
+eglGetConfigs = _lib.eglGetConfigs
+eglGetConfigs.restype = EGLBoolean
+eglGetConfigs.argtypes = [EGLDisplay, POINTER(EGLConfig), EGLint, POINTER(EGLint)]
+
+# /usr/include/EGL/egl.h:160
+eglGetCurrentDisplay = _lib.eglGetCurrentDisplay
+eglGetCurrentDisplay.restype = EGLDisplay
+eglGetCurrentDisplay.argtypes = []
+
+# /usr/include/EGL/egl.h:161
+eglGetCurrentSurface = _lib.eglGetCurrentSurface
+eglGetCurrentSurface.restype = EGLSurface
+eglGetCurrentSurface.argtypes = [EGLint]
+
+# /usr/include/EGL/egl.h:162
+eglGetDisplay = _lib.eglGetDisplay
+eglGetDisplay.restype = EGLDisplay
+eglGetDisplay.argtypes = [EGLNativeDisplayType]
+
+# /usr/include/EGL/egl.h:163
+eglGetError = _lib.eglGetError
+eglGetError.restype = EGLint
+eglGetError.argtypes = []
+
+# /usr/include/EGL/egl.h:164
+eglGetProcAddress = _lib.eglGetProcAddress
+eglGetProcAddress.restype = __eglMustCastToProperFunctionPointerType
+eglGetProcAddress.argtypes = [c_char_p]
+
+# /usr/include/EGL/egl.h:165
+eglInitialize = _lib.eglInitialize
+eglInitialize.restype = EGLBoolean
+eglInitialize.argtypes = [EGLDisplay, POINTER(EGLint), POINTER(EGLint)]
+
+# /usr/include/EGL/egl.h:166
+eglMakeCurrent = _lib.eglMakeCurrent
+eglMakeCurrent.restype = EGLBoolean
+eglMakeCurrent.argtypes = [EGLDisplay, EGLSurface, EGLSurface, EGLContext]
+
+# /usr/include/EGL/egl.h:167
+eglQueryContext = _lib.eglQueryContext
+eglQueryContext.restype = EGLBoolean
+eglQueryContext.argtypes = [EGLDisplay, EGLContext, EGLint, POINTER(EGLint)]
+
+# /usr/include/EGL/egl.h:168
+eglQueryString = _lib.eglQueryString
+eglQueryString.restype = c_char_p
+eglQueryString.argtypes = [EGLDisplay, EGLint]
+
+# /usr/include/EGL/egl.h:169
+eglQuerySurface = _lib.eglQuerySurface
+eglQuerySurface.restype = EGLBoolean
+eglQuerySurface.argtypes = [EGLDisplay, EGLSurface, EGLint, POINTER(EGLint)]
+
+# /usr/include/EGL/egl.h:170
+eglSwapBuffers = _lib.eglSwapBuffers
+eglSwapBuffers.restype = EGLBoolean
+eglSwapBuffers.argtypes = [EGLDisplay, EGLSurface]
+
+# /usr/include/EGL/egl.h:171
+eglTerminate = _lib.eglTerminate
+eglTerminate.restype = EGLBoolean
+eglTerminate.argtypes = [EGLDisplay]
+
+# /usr/include/EGL/egl.h:172
+eglWaitGL = _lib.eglWaitGL
+eglWaitGL.restype = EGLBoolean
+eglWaitGL.argtypes = []
+
+# /usr/include/EGL/egl.h:173
+eglWaitNative = _lib.eglWaitNative
+eglWaitNative.restype = EGLBoolean
+eglWaitNative.argtypes = [EGLint]
+
+EGL_VERSION_1_1 = 1 # /usr/include/EGL/egl.h:178
+EGL_BACK_BUFFER = 12420 # /usr/include/EGL/egl.h:179
+EGL_BIND_TO_TEXTURE_RGB = 12345 # /usr/include/EGL/egl.h:180
+EGL_BIND_TO_TEXTURE_RGBA = 12346 # /usr/include/EGL/egl.h:181
+EGL_CONTEXT_LOST = 12302 # /usr/include/EGL/egl.h:182
+EGL_MIN_SWAP_INTERVAL = 12347 # /usr/include/EGL/egl.h:183
+EGL_MAX_SWAP_INTERVAL = 12348 # /usr/include/EGL/egl.h:184
+EGL_MIPMAP_TEXTURE = 12418 # /usr/include/EGL/egl.h:185
+EGL_MIPMAP_LEVEL = 12419 # /usr/include/EGL/egl.h:186
+EGL_NO_TEXTURE = 12380 # /usr/include/EGL/egl.h:187
+EGL_TEXTURE_2D = 12383 # /usr/include/EGL/egl.h:188
+EGL_TEXTURE_FORMAT = 12416 # /usr/include/EGL/egl.h:189
+EGL_TEXTURE_RGB = 12381 # /usr/include/EGL/egl.h:190
+EGL_TEXTURE_RGBA = 12382 # /usr/include/EGL/egl.h:191
+EGL_TEXTURE_TARGET = 12417 # /usr/include/EGL/egl.h:192
+PFNEGLBINDTEXIMAGEPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLSurface, EGLint) # /usr/include/EGL/egl.h:193
+PFNEGLRELEASETEXIMAGEPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLSurface, EGLint) # /usr/include/EGL/egl.h:194
+PFNEGLSURFACEATTRIBPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLSurface, EGLint, EGLint) # /usr/include/EGL/egl.h:195
+PFNEGLSWAPINTERVALPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLint) # /usr/include/EGL/egl.h:196
+# /usr/include/EGL/egl.h:198
+eglBindTexImage = _lib.eglBindTexImage
+eglBindTexImage.restype = EGLBoolean
+eglBindTexImage.argtypes = [EGLDisplay, EGLSurface, EGLint]
+
+# /usr/include/EGL/egl.h:199
+eglReleaseTexImage = _lib.eglReleaseTexImage
+eglReleaseTexImage.restype = EGLBoolean
+eglReleaseTexImage.argtypes = [EGLDisplay, EGLSurface, EGLint]
+
+# /usr/include/EGL/egl.h:200
+eglSurfaceAttrib = _lib.eglSurfaceAttrib
+eglSurfaceAttrib.restype = EGLBoolean
+eglSurfaceAttrib.argtypes = [EGLDisplay, EGLSurface, EGLint, EGLint]
+
+# /usr/include/EGL/egl.h:201
+eglSwapInterval = _lib.eglSwapInterval
+eglSwapInterval.restype = EGLBoolean
+eglSwapInterval.argtypes = [EGLDisplay, EGLint]
+
+EGL_VERSION_1_2 = 1 # /usr/include/EGL/egl.h:206
+EGLenum = c_uint # /usr/include/EGL/egl.h:207
+EGLClientBuffer = POINTER(None) # /usr/include/EGL/egl.h:208
+EGL_ALPHA_FORMAT = 12424 # /usr/include/EGL/egl.h:209
+EGL_ALPHA_FORMAT_NONPRE = 12427 # /usr/include/EGL/egl.h:210
+EGL_ALPHA_FORMAT_PRE = 12428 # /usr/include/EGL/egl.h:211
+EGL_ALPHA_MASK_SIZE = 12350 # /usr/include/EGL/egl.h:212
+EGL_BUFFER_PRESERVED = 12436 # /usr/include/EGL/egl.h:213
+EGL_BUFFER_DESTROYED = 12437 # /usr/include/EGL/egl.h:214
+EGL_CLIENT_APIS = 12429 # /usr/include/EGL/egl.h:215
+EGL_COLORSPACE = 12423 # /usr/include/EGL/egl.h:216
+EGL_COLORSPACE_sRGB = 12425 # /usr/include/EGL/egl.h:217
+EGL_COLORSPACE_LINEAR = 12426 # /usr/include/EGL/egl.h:218
+EGL_COLOR_BUFFER_TYPE = 12351 # /usr/include/EGL/egl.h:219
+EGL_CONTEXT_CLIENT_TYPE = 12439 # /usr/include/EGL/egl.h:220
+EGL_DISPLAY_SCALING = 10000 # /usr/include/EGL/egl.h:221
+EGL_HORIZONTAL_RESOLUTION = 12432 # /usr/include/EGL/egl.h:222
+EGL_LUMINANCE_BUFFER = 12431 # /usr/include/EGL/egl.h:223
+EGL_LUMINANCE_SIZE = 12349 # /usr/include/EGL/egl.h:224
+EGL_OPENGL_ES_BIT = 1 # /usr/include/EGL/egl.h:225
+EGL_OPENVG_BIT = 2 # /usr/include/EGL/egl.h:226
+EGL_OPENGL_ES_API = 12448 # /usr/include/EGL/egl.h:227
+EGL_OPENVG_API = 12449 # /usr/include/EGL/egl.h:228
+EGL_OPENVG_IMAGE = 12438 # /usr/include/EGL/egl.h:229
+EGL_PIXEL_ASPECT_RATIO = 12434 # /usr/include/EGL/egl.h:230
+EGL_RENDERABLE_TYPE = 12352 # /usr/include/EGL/egl.h:231
+EGL_RENDER_BUFFER = 12422 # /usr/include/EGL/egl.h:232
+EGL_RGB_BUFFER = 12430 # /usr/include/EGL/egl.h:233
+EGL_SINGLE_BUFFER = 12421 # /usr/include/EGL/egl.h:234
+EGL_SWAP_BEHAVIOR = 12435 # /usr/include/EGL/egl.h:235
+EGL_VERTICAL_RESOLUTION = 12433 # /usr/include/EGL/egl.h:237
+PFNEGLBINDAPIPROC = CFUNCTYPE(EGLBoolean, EGLenum) # /usr/include/EGL/egl.h:238
+PFNEGLQUERYAPIPROC = CFUNCTYPE(EGLenum) # /usr/include/EGL/egl.h:239
+PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC = CFUNCTYPE(EGLSurface, EGLDisplay, EGLenum, EGLClientBuffer, EGLConfig, POINTER(EGLint)) # /usr/include/EGL/egl.h:240
+PFNEGLRELEASETHREADPROC = CFUNCTYPE(EGLBoolean) # /usr/include/EGL/egl.h:241
+PFNEGLWAITCLIENTPROC = CFUNCTYPE(EGLBoolean) # /usr/include/EGL/egl.h:242
+# /usr/include/EGL/egl.h:244
+eglBindAPI = _lib.eglBindAPI
+eglBindAPI.restype = EGLBoolean
+eglBindAPI.argtypes = [EGLenum]
+
+# /usr/include/EGL/egl.h:245
+eglQueryAPI = _lib.eglQueryAPI
+eglQueryAPI.restype = EGLenum
+eglQueryAPI.argtypes = []
+
+# /usr/include/EGL/egl.h:246
+eglCreatePbufferFromClientBuffer = _lib.eglCreatePbufferFromClientBuffer
+eglCreatePbufferFromClientBuffer.restype = EGLSurface
+eglCreatePbufferFromClientBuffer.argtypes = [EGLDisplay, EGLenum, EGLClientBuffer, EGLConfig, POINTER(EGLint)]
+
+# /usr/include/EGL/egl.h:247
+eglReleaseThread = _lib.eglReleaseThread
+eglReleaseThread.restype = EGLBoolean
+eglReleaseThread.argtypes = []
+
+# /usr/include/EGL/egl.h:248
+eglWaitClient = _lib.eglWaitClient
+eglWaitClient.restype = EGLBoolean
+eglWaitClient.argtypes = []
+
+EGL_VERSION_1_3 = 1 # /usr/include/EGL/egl.h:253
+EGL_CONFORMANT = 12354 # /usr/include/EGL/egl.h:254
+EGL_CONTEXT_CLIENT_VERSION = 12440 # /usr/include/EGL/egl.h:255
+EGL_MATCH_NATIVE_PIXMAP = 12353 # /usr/include/EGL/egl.h:256
+EGL_OPENGL_ES2_BIT = 4 # /usr/include/EGL/egl.h:257
+EGL_VG_ALPHA_FORMAT = 12424 # /usr/include/EGL/egl.h:258
+EGL_VG_ALPHA_FORMAT_NONPRE = 12427 # /usr/include/EGL/egl.h:259
+EGL_VG_ALPHA_FORMAT_PRE = 12428 # /usr/include/EGL/egl.h:260
+EGL_VG_ALPHA_FORMAT_PRE_BIT = 64 # /usr/include/EGL/egl.h:261
+EGL_VG_COLORSPACE = 12423 # /usr/include/EGL/egl.h:262
+EGL_VG_COLORSPACE_sRGB = 12425 # /usr/include/EGL/egl.h:263
+EGL_VG_COLORSPACE_LINEAR = 12426 # /usr/include/EGL/egl.h:264
+EGL_VG_COLORSPACE_LINEAR_BIT = 32 # /usr/include/EGL/egl.h:265
+EGL_VERSION_1_4 = 1 # /usr/include/EGL/egl.h:269
+EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 512 # /usr/include/EGL/egl.h:271
+EGL_MULTISAMPLE_RESOLVE = 12441 # /usr/include/EGL/egl.h:272
+EGL_MULTISAMPLE_RESOLVE_DEFAULT = 12442 # /usr/include/EGL/egl.h:273
+EGL_MULTISAMPLE_RESOLVE_BOX = 12443 # /usr/include/EGL/egl.h:274
+EGL_OPENGL_API = 12450 # /usr/include/EGL/egl.h:275
+EGL_OPENGL_BIT = 8 # /usr/include/EGL/egl.h:276
+EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 1024 # /usr/include/EGL/egl.h:277
+PFNEGLGETCURRENTCONTEXTPROC = CFUNCTYPE(EGLContext) # /usr/include/EGL/egl.h:278
+# /usr/include/EGL/egl.h:280
+eglGetCurrentContext = _lib.eglGetCurrentContext
+eglGetCurrentContext.restype = EGLContext
+eglGetCurrentContext.argtypes = []
+
+EGL_VERSION_1_5 = 1 # /usr/include/EGL/egl.h:285
+EGLSync = POINTER(None) # /usr/include/EGL/egl.h:286
+intptr_t = c_long # /usr/include/stdint.h:87
+EGLAttrib = intptr_t # /usr/include/EGL/egl.h:287
+khronos_uint64_t = c_uint64 # /usr/include/KHR/khrplatform.h:153
+khronos_utime_nanoseconds_t = khronos_uint64_t # /usr/include/KHR/khrplatform.h:267
+EGLTime = khronos_utime_nanoseconds_t # /usr/include/EGL/egl.h:288
+EGLImage = POINTER(None) # /usr/include/EGL/egl.h:289
+EGL_CONTEXT_MAJOR_VERSION = 12440 # /usr/include/EGL/egl.h:290
+EGL_CONTEXT_MINOR_VERSION = 12539 # /usr/include/EGL/egl.h:291
+EGL_CONTEXT_OPENGL_PROFILE_MASK = 12541 # /usr/include/EGL/egl.h:292
+EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY = 12733 # /usr/include/EGL/egl.h:293
+EGL_NO_RESET_NOTIFICATION = 12734 # /usr/include/EGL/egl.h:294
+EGL_LOSE_CONTEXT_ON_RESET = 12735 # /usr/include/EGL/egl.h:295
+EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT = 1 # /usr/include/EGL/egl.h:296
+EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT = 2 # /usr/include/EGL/egl.h:297
+EGL_CONTEXT_OPENGL_DEBUG = 12720 # /usr/include/EGL/egl.h:298
+EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE = 12721 # /usr/include/EGL/egl.h:299
+EGL_CONTEXT_OPENGL_ROBUST_ACCESS = 12722 # /usr/include/EGL/egl.h:300
+EGL_OPENGL_ES3_BIT = 64 # /usr/include/EGL/egl.h:301
+EGL_CL_EVENT_HANDLE = 12444 # /usr/include/EGL/egl.h:302
+EGL_SYNC_CL_EVENT = 12542 # /usr/include/EGL/egl.h:303
+EGL_SYNC_CL_EVENT_COMPLETE = 12543 # /usr/include/EGL/egl.h:304
+EGL_SYNC_PRIOR_COMMANDS_COMPLETE = 12528 # /usr/include/EGL/egl.h:305
+EGL_SYNC_TYPE = 12535 # /usr/include/EGL/egl.h:306
+EGL_SYNC_STATUS = 12529 # /usr/include/EGL/egl.h:307
+EGL_SYNC_CONDITION = 12536 # /usr/include/EGL/egl.h:308
+EGL_SIGNALED = 12530 # /usr/include/EGL/egl.h:309
+EGL_UNSIGNALED = 12531 # /usr/include/EGL/egl.h:310
+EGL_SYNC_FLUSH_COMMANDS_BIT = 1 # /usr/include/EGL/egl.h:311
+EGL_FOREVER = 18446744073709551615 # /usr/include/EGL/egl.h:312
+EGL_TIMEOUT_EXPIRED = 12533 # /usr/include/EGL/egl.h:313
+EGL_CONDITION_SATISFIED = 12534 # /usr/include/EGL/egl.h:314
+EGL_SYNC_FENCE = 12537 # /usr/include/EGL/egl.h:316
+EGL_GL_COLORSPACE = 12445 # /usr/include/EGL/egl.h:317
+EGL_GL_COLORSPACE_SRGB = 12425 # /usr/include/EGL/egl.h:318
+EGL_GL_COLORSPACE_LINEAR = 12426 # /usr/include/EGL/egl.h:319
+EGL_GL_RENDERBUFFER = 12473 # /usr/include/EGL/egl.h:320
+EGL_GL_TEXTURE_2D = 12465 # /usr/include/EGL/egl.h:321
+EGL_GL_TEXTURE_LEVEL = 12476 # /usr/include/EGL/egl.h:322
+EGL_GL_TEXTURE_3D = 12466 # /usr/include/EGL/egl.h:323
+EGL_GL_TEXTURE_ZOFFSET = 12477 # /usr/include/EGL/egl.h:324
+EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X = 12467 # /usr/include/EGL/egl.h:325
+EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 12468 # /usr/include/EGL/egl.h:326
+EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 12469 # /usr/include/EGL/egl.h:327
+EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 12470 # /usr/include/EGL/egl.h:328
+EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 12471 # /usr/include/EGL/egl.h:329
+EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 12472 # /usr/include/EGL/egl.h:330
+EGL_IMAGE_PRESERVED = 12498 # /usr/include/EGL/egl.h:331
+PFNEGLCREATESYNCPROC = CFUNCTYPE(EGLSync, EGLDisplay, EGLenum, POINTER(EGLAttrib)) # /usr/include/EGL/egl.h:333
+PFNEGLDESTROYSYNCPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLSync) # /usr/include/EGL/egl.h:334
+PFNEGLCLIENTWAITSYNCPROC = CFUNCTYPE(EGLint, EGLDisplay, EGLSync, EGLint, EGLTime) # /usr/include/EGL/egl.h:335
+PFNEGLGETSYNCATTRIBPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLSync, EGLint, POINTER(EGLAttrib)) # /usr/include/EGL/egl.h:336
+PFNEGLCREATEIMAGEPROC = CFUNCTYPE(EGLImage, EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, POINTER(EGLAttrib)) # /usr/include/EGL/egl.h:337
+PFNEGLDESTROYIMAGEPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLImage) # /usr/include/EGL/egl.h:338
+PFNEGLGETPLATFORMDISPLAYPROC = CFUNCTYPE(EGLDisplay, EGLenum, POINTER(None), POINTER(EGLAttrib)) # /usr/include/EGL/egl.h:339
+PFNEGLCREATEPLATFORMWINDOWSURFACEPROC = CFUNCTYPE(EGLSurface, EGLDisplay, EGLConfig, POINTER(None), POINTER(EGLAttrib)) # /usr/include/EGL/egl.h:340
+PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC = CFUNCTYPE(EGLSurface, EGLDisplay, EGLConfig, POINTER(None), POINTER(EGLAttrib)) # /usr/include/EGL/egl.h:341
+PFNEGLWAITSYNCPROC = CFUNCTYPE(EGLBoolean, EGLDisplay, EGLSync, EGLint) # /usr/include/EGL/egl.h:342
+# /usr/include/EGL/egl.h:344
+eglCreateSync = _lib.eglCreateSync
+eglCreateSync.restype = EGLSync
+eglCreateSync.argtypes = [EGLDisplay, EGLenum, POINTER(EGLAttrib)]
+
+# /usr/include/EGL/egl.h:345
+eglDestroySync = _lib.eglDestroySync
+eglDestroySync.restype = EGLBoolean
+eglDestroySync.argtypes = [EGLDisplay, EGLSync]
+
+# /usr/include/EGL/egl.h:346
+eglClientWaitSync = _lib.eglClientWaitSync
+eglClientWaitSync.restype = EGLint
+eglClientWaitSync.argtypes = [EGLDisplay, EGLSync, EGLint, EGLTime]
+
+# /usr/include/EGL/egl.h:347
+eglGetSyncAttrib = _lib.eglGetSyncAttrib
+eglGetSyncAttrib.restype = EGLBoolean
+eglGetSyncAttrib.argtypes = [EGLDisplay, EGLSync, EGLint, POINTER(EGLAttrib)]
+
+# /usr/include/EGL/egl.h:348
+eglCreateImage = _lib.eglCreateImage
+eglCreateImage.restype = EGLImage
+eglCreateImage.argtypes = [EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, POINTER(EGLAttrib)]
+
+# /usr/include/EGL/egl.h:349
+eglDestroyImage = _lib.eglDestroyImage
+eglDestroyImage.restype = EGLBoolean
+eglDestroyImage.argtypes = [EGLDisplay, EGLImage]
+
+# /usr/include/EGL/egl.h:350
+eglGetPlatformDisplay = _lib.eglGetPlatformDisplay
+eglGetPlatformDisplay.restype = EGLDisplay
+eglGetPlatformDisplay.argtypes = [EGLenum, POINTER(None), POINTER(EGLAttrib)]
+
+# /usr/include/EGL/egl.h:351
+eglCreatePlatformWindowSurface = _lib.eglCreatePlatformWindowSurface
+eglCreatePlatformWindowSurface.restype = EGLSurface
+eglCreatePlatformWindowSurface.argtypes = [EGLDisplay, EGLConfig, POINTER(None), POINTER(EGLAttrib)]
+
+# /usr/include/EGL/egl.h:352
+eglCreatePlatformPixmapSurface = _lib.eglCreatePlatformPixmapSurface
+eglCreatePlatformPixmapSurface.restype = EGLSurface
+eglCreatePlatformPixmapSurface.argtypes = [EGLDisplay, EGLConfig, POINTER(None), POINTER(EGLAttrib)]
+
+# /usr/include/EGL/egl.h:353
+eglWaitSync = _lib.eglWaitSync
+eglWaitSync.restype = EGLBoolean
+eglWaitSync.argtypes = [EGLDisplay, EGLSync, EGLint]
+
+
+__all__ = ['__egl_h_', 'EGL_EGL_PROTOTYPES', 'EGL_VERSION_1_0', 'EGLBoolean', 'EGLint',
+'EGLDisplay', 'EGLConfig', 'EGLSurface', 'EGLContext',
+'__eglMustCastToProperFunctionPointerType', 'EGL_ALPHA_SIZE',
+'EGL_BAD_ACCESS', 'EGL_BAD_ALLOC', 'EGL_BAD_ATTRIBUTE', 'EGL_BAD_CONFIG',
+'EGL_BAD_CONTEXT', 'EGL_BAD_CURRENT_SURFACE', 'EGL_BAD_DISPLAY',
+'EGL_BAD_MATCH', 'EGL_BAD_NATIVE_PIXMAP', 'EGL_BAD_NATIVE_WINDOW',
+'EGL_BAD_PARAMETER', 'EGL_BAD_SURFACE', 'EGL_BLUE_SIZE', 'EGL_BUFFER_SIZE',
+'EGL_CONFIG_CAVEAT', 'EGL_CONFIG_ID', 'EGL_CORE_NATIVE_ENGINE',
+'EGL_DEPTH_SIZE', 'EGL_DRAW', 'EGL_EXTENSIONS', 'EGL_FALSE', 'EGL_GREEN_SIZE',
+'EGL_HEIGHT', 'EGL_LARGEST_PBUFFER', 'EGL_LEVEL', 'EGL_MAX_PBUFFER_HEIGHT',
+'EGL_MAX_PBUFFER_PIXELS', 'EGL_MAX_PBUFFER_WIDTH', 'EGL_NATIVE_RENDERABLE',
+'EGL_NATIVE_VISUAL_ID', 'EGL_NATIVE_VISUAL_TYPE', 'EGL_NONE',
+'EGL_NON_CONFORMANT_CONFIG', 'EGL_NOT_INITIALIZED', 'EGL_PBUFFER_BIT',
+'EGL_PIXMAP_BIT', 'EGL_READ', 'EGL_RED_SIZE', 'EGL_SAMPLES',
+'EGL_SAMPLE_BUFFERS', 'EGL_SLOW_CONFIG', 'EGL_STENCIL_SIZE', 'EGL_SUCCESS',
+'EGL_SURFACE_TYPE', 'EGL_TRANSPARENT_BLUE_VALUE',
+'EGL_TRANSPARENT_GREEN_VALUE', 'EGL_TRANSPARENT_RED_VALUE',
+'EGL_TRANSPARENT_RGB', 'EGL_TRANSPARENT_TYPE', 'EGL_TRUE', 'EGL_VENDOR',
+'EGL_VERSION', 'EGL_WIDTH', 'EGL_WINDOW_BIT', 'PFNEGLCHOOSECONFIGPROC',
+'PFNEGLCOPYBUFFERSPROC', 'PFNEGLCREATECONTEXTPROC',
+'PFNEGLCREATEPBUFFERSURFACEPROC', 'PFNEGLCREATEPIXMAPSURFACEPROC',
+'PFNEGLCREATEWINDOWSURFACEPROC', 'PFNEGLDESTROYCONTEXTPROC',
+'PFNEGLDESTROYSURFACEPROC', 'PFNEGLGETCONFIGATTRIBPROC',
+'PFNEGLGETCONFIGSPROC', 'PFNEGLGETCURRENTDISPLAYPROC',
+'PFNEGLGETCURRENTSURFACEPROC', 'PFNEGLGETDISPLAYPROC', 'PFNEGLGETERRORPROC',
+'PFNEGLGETPROCADDRESSPROC', 'PFNEGLINITIALIZEPROC', 'PFNEGLMAKECURRENTPROC',
+'PFNEGLQUERYCONTEXTPROC', 'PFNEGLQUERYSTRINGPROC', 'PFNEGLQUERYSURFACEPROC',
+'PFNEGLSWAPBUFFERSPROC', 'PFNEGLTERMINATEPROC', 'PFNEGLWAITGLPROC',
+'PFNEGLWAITNATIVEPROC', 'eglChooseConfig', 'eglCopyBuffers',
+'eglCreateContext', 'eglCreatePbufferSurface', 'eglCreatePixmapSurface',
+'eglCreateWindowSurface', 'eglDestroyContext', 'eglDestroySurface',
+'eglGetConfigAttrib', 'eglGetConfigs', 'eglGetCurrentDisplay',
+'eglGetCurrentSurface', 'eglGetDisplay', 'eglGetError', 'eglGetProcAddress',
+'eglInitialize', 'eglMakeCurrent', 'eglQueryContext', 'eglQueryString',
+'eglQuerySurface', 'eglSwapBuffers', 'eglTerminate', 'eglWaitGL',
+'eglWaitNative', 'EGL_VERSION_1_1', 'EGL_BACK_BUFFER',
+'EGL_BIND_TO_TEXTURE_RGB', 'EGL_BIND_TO_TEXTURE_RGBA', 'EGL_CONTEXT_LOST',
+'EGL_MIN_SWAP_INTERVAL', 'EGL_MAX_SWAP_INTERVAL', 'EGL_MIPMAP_TEXTURE',
+'EGL_MIPMAP_LEVEL', 'EGL_NO_TEXTURE', 'EGL_TEXTURE_2D', 'EGL_TEXTURE_FORMAT',
+'EGL_TEXTURE_RGB', 'EGL_TEXTURE_RGBA', 'EGL_TEXTURE_TARGET',
+'PFNEGLBINDTEXIMAGEPROC', 'PFNEGLRELEASETEXIMAGEPROC',
+'PFNEGLSURFACEATTRIBPROC', 'PFNEGLSWAPINTERVALPROC', 'eglBindTexImage',
+'eglReleaseTexImage', 'eglSurfaceAttrib', 'eglSwapInterval',
+'EGL_VERSION_1_2', 'EGLenum', 'EGLClientBuffer', 'EGL_ALPHA_FORMAT',
+'EGL_ALPHA_FORMAT_NONPRE', 'EGL_ALPHA_FORMAT_PRE', 'EGL_ALPHA_MASK_SIZE',
+'EGL_BUFFER_PRESERVED', 'EGL_BUFFER_DESTROYED', 'EGL_CLIENT_APIS',
+'EGL_COLORSPACE', 'EGL_COLORSPACE_sRGB', 'EGL_COLORSPACE_LINEAR',
+'EGL_COLOR_BUFFER_TYPE', 'EGL_CONTEXT_CLIENT_TYPE', 'EGL_DISPLAY_SCALING',
+'EGL_HORIZONTAL_RESOLUTION', 'EGL_LUMINANCE_BUFFER', 'EGL_LUMINANCE_SIZE',
+'EGL_OPENGL_ES_BIT', 'EGL_OPENVG_BIT', 'EGL_OPENGL_ES_API', 'EGL_OPENVG_API',
+'EGL_OPENVG_IMAGE', 'EGL_PIXEL_ASPECT_RATIO', 'EGL_RENDERABLE_TYPE',
+'EGL_RENDER_BUFFER', 'EGL_RGB_BUFFER', 'EGL_SINGLE_BUFFER',
+'EGL_SWAP_BEHAVIOR', 'EGL_VERTICAL_RESOLUTION', 'PFNEGLBINDAPIPROC',
+'PFNEGLQUERYAPIPROC', 'PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC',
+'PFNEGLRELEASETHREADPROC', 'PFNEGLWAITCLIENTPROC', 'eglBindAPI',
+'eglQueryAPI', 'eglCreatePbufferFromClientBuffer', 'eglReleaseThread',
+'eglWaitClient', 'EGL_VERSION_1_3', 'EGL_CONFORMANT',
+'EGL_CONTEXT_CLIENT_VERSION', 'EGL_MATCH_NATIVE_PIXMAP', 'EGL_OPENGL_ES2_BIT',
+'EGL_VG_ALPHA_FORMAT', 'EGL_VG_ALPHA_FORMAT_NONPRE',
+'EGL_VG_ALPHA_FORMAT_PRE', 'EGL_VG_ALPHA_FORMAT_PRE_BIT', 'EGL_VG_COLORSPACE',
+'EGL_VG_COLORSPACE_sRGB', 'EGL_VG_COLORSPACE_LINEAR',
+'EGL_VG_COLORSPACE_LINEAR_BIT', 'EGL_VERSION_1_4',
+'EGL_MULTISAMPLE_RESOLVE_BOX_BIT', 'EGL_MULTISAMPLE_RESOLVE',
+'EGL_MULTISAMPLE_RESOLVE_DEFAULT', 'EGL_MULTISAMPLE_RESOLVE_BOX',
+'EGL_OPENGL_API', 'EGL_OPENGL_BIT', 'EGL_SWAP_BEHAVIOR_PRESERVED_BIT',
+'PFNEGLGETCURRENTCONTEXTPROC', 'eglGetCurrentContext', 'EGL_VERSION_1_5',
+'EGLSync', 'EGLAttrib', 'EGLTime', 'EGLImage', 'EGL_CONTEXT_MAJOR_VERSION',
+'EGL_CONTEXT_MINOR_VERSION', 'EGL_CONTEXT_OPENGL_PROFILE_MASK',
+'EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY', 'EGL_NO_RESET_NOTIFICATION',
+'EGL_LOSE_CONTEXT_ON_RESET', 'EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT',
+'EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT', 'EGL_CONTEXT_OPENGL_DEBUG',
+'EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE', 'EGL_CONTEXT_OPENGL_ROBUST_ACCESS',
+'EGL_OPENGL_ES3_BIT', 'EGL_CL_EVENT_HANDLE', 'EGL_SYNC_CL_EVENT',
+'EGL_SYNC_CL_EVENT_COMPLETE', 'EGL_SYNC_PRIOR_COMMANDS_COMPLETE',
+'EGL_SYNC_TYPE', 'EGL_SYNC_STATUS', 'EGL_SYNC_CONDITION', 'EGL_SIGNALED',
+'EGL_UNSIGNALED', 'EGL_SYNC_FLUSH_COMMANDS_BIT', 'EGL_FOREVER',
+'EGL_TIMEOUT_EXPIRED', 'EGL_CONDITION_SATISFIED', 'EGL_SYNC_FENCE',
+'EGL_GL_COLORSPACE', 'EGL_GL_COLORSPACE_SRGB', 'EGL_GL_COLORSPACE_LINEAR',
+'EGL_GL_RENDERBUFFER', 'EGL_GL_TEXTURE_2D', 'EGL_GL_TEXTURE_LEVEL',
+'EGL_GL_TEXTURE_3D', 'EGL_GL_TEXTURE_ZOFFSET',
+'EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X', 'EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X',
+'EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y', 'EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y',
+'EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z', 'EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z',
+'EGL_IMAGE_PRESERVED', 'PFNEGLCREATESYNCPROC', 'PFNEGLDESTROYSYNCPROC',
+'PFNEGLCLIENTWAITSYNCPROC', 'PFNEGLGETSYNCATTRIBPROC',
+'PFNEGLCREATEIMAGEPROC', 'PFNEGLDESTROYIMAGEPROC',
+'PFNEGLGETPLATFORMDISPLAYPROC', 'PFNEGLCREATEPLATFORMWINDOWSURFACEPROC',
+'PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC', 'PFNEGLWAITSYNCPROC',
+'eglCreateSync', 'eglDestroySync', 'eglClientWaitSync', 'eglGetSyncAttrib',
+'eglCreateImage', 'eglDestroyImage', 'eglGetPlatformDisplay',
+'eglCreatePlatformWindowSurface', 'eglCreatePlatformPixmapSurface',
+'eglWaitSync']
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/egl/eglext.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/egl/eglext.py
new file mode 100644
index 0000000000000000000000000000000000000000..718182b332608f2a4fc056a89e0d3d8006d1bf37
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/egl/eglext.py
@@ -0,0 +1,17 @@
+from ctypes import *
+from pyglet.libs.egl import egl
+from pyglet.libs.egl.lib import link_EGL as _link_function
+
+
+EGL_PLATFORM_GBM_MESA = 12759
+EGL_PLATFORM_DEVICE_EXT = 12607
+EGLDeviceEXT = POINTER(None)
+
+eglGetPlatformDisplayEXT = _link_function('eglGetPlatformDisplayEXT', egl.EGLDisplay, [egl.EGLenum, POINTER(None), POINTER(egl.EGLint)], None)
+eglCreatePlatformWindowSurfaceEXT = _link_function('eglCreatePlatformWindowSurfaceEXT', egl.EGLSurface, [egl.EGLDisplay, egl.EGLConfig, POINTER(None), POINTER(egl.EGLAttrib)], None)
+eglQueryDevicesEXT = _link_function('eglQueryDevicesEXT', egl.EGLBoolean, [egl.EGLint, POINTER(EGLDeviceEXT), POINTER(egl.EGLint)], None)
+
+
+__all__ = ['EGL_PLATFORM_DEVICE_EXT', 'EGL_PLATFORM_GBM_MESA',
+ 'EGLDeviceEXT', 'eglGetPlatformDisplayEXT', 'eglCreatePlatformWindowSurfaceEXT',
+ 'eglQueryDevicesEXT']
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/egl/lib.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/egl/lib.py
new file mode 100644
index 0000000000000000000000000000000000000000..0707518877e96b03c04a628614201f08270bac24
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/egl/lib.py
@@ -0,0 +1,31 @@
+from ctypes import *
+
+import pyglet
+import pyglet.util
+
+
+__all__ = ['link_EGL']
+
+egl_lib = pyglet.lib.load_library('EGL')
+
+# Look for eglGetProcAddress
+eglGetProcAddress = getattr(egl_lib, 'eglGetProcAddress')
+eglGetProcAddress.restype = POINTER(CFUNCTYPE(None))
+eglGetProcAddress.argtypes = [POINTER(c_ubyte)]
+
+
+def link_EGL(name, restype, argtypes, requires=None, suggestions=None):
+ try:
+ func = getattr(egl_lib, name)
+ func.restype = restype
+ func.argtypes = argtypes
+ return func
+ except AttributeError:
+ bname = cast(pointer(create_string_buffer(pyglet.util.asbytes(name))), POINTER(c_ubyte))
+ addr = eglGetProcAddress(bname)
+ if addr:
+ ftype = CFUNCTYPE(*((restype,) + tuple(argtypes)))
+ func = cast(addr, ftype)
+ return func
+
+ return pyglet.gl.lib.missing_function(name, requires, suggestions)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e5c6d7b26b184347e00538c77a567390abf708c6
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/__init__.py
@@ -0,0 +1,304 @@
+import atexit
+import struct
+import warnings
+
+import pyglet
+from . import com
+from . import constants
+from .types import *
+
+IS64 = struct.calcsize("P") == 8
+
+_debug_win32 = pyglet.options['debug_win32']
+
+DebugLibrary = lambda lib: ctypes.WinDLL(lib, use_last_error=True if _debug_win32 else False)
+
+_gdi32 = DebugLibrary('gdi32')
+_kernel32 = DebugLibrary('kernel32')
+_user32 = DebugLibrary('user32')
+_dwmapi = DebugLibrary('dwmapi')
+_shell32 = DebugLibrary('shell32')
+_ole32 = DebugLibrary('ole32')
+_oleaut32 = DebugLibrary('oleaut32')
+
+# _gdi32
+_gdi32.AddFontMemResourceEx.restype = HANDLE
+_gdi32.AddFontMemResourceEx.argtypes = [PVOID, DWORD, PVOID, POINTER(DWORD)]
+_gdi32.ChoosePixelFormat.restype = c_int
+_gdi32.ChoosePixelFormat.argtypes = [HDC, POINTER(PIXELFORMATDESCRIPTOR)]
+_gdi32.CreateBitmap.restype = HBITMAP
+_gdi32.CreateBitmap.argtypes = [c_int, c_int, UINT, UINT, c_void_p]
+_gdi32.CreateCompatibleDC.restype = HDC
+_gdi32.CreateCompatibleDC.argtypes = [HDC]
+_gdi32.CreateDIBitmap.restype = HBITMAP
+_gdi32.CreateDIBitmap.argtypes = [HDC, POINTER(BITMAPINFOHEADER), DWORD, c_void_p, POINTER(BITMAPINFO), UINT]
+_gdi32.CreateDIBSection.restype = HBITMAP
+_gdi32.CreateDIBSection.argtypes = [HDC, c_void_p, UINT, c_void_p, HANDLE, DWORD] # POINTER(BITMAPINFO)
+_gdi32.CreateFontIndirectA.restype = HFONT
+_gdi32.CreateFontIndirectA.argtypes = [POINTER(LOGFONT)]
+_gdi32.CreateFontIndirectW.restype = HFONT
+_gdi32.CreateFontIndirectW.argtypes = [POINTER(LOGFONTW)]
+_gdi32.DeleteDC.restype = BOOL
+_gdi32.DeleteDC.argtypes = [HDC]
+_gdi32.DeleteObject.restype = BOOL
+_gdi32.DeleteObject.argtypes = [HGDIOBJ]
+_gdi32.DescribePixelFormat.restype = c_int
+_gdi32.DescribePixelFormat.argtypes = [HDC, c_int, UINT, POINTER(PIXELFORMATDESCRIPTOR)]
+_gdi32.ExtTextOutA.restype = BOOL
+_gdi32.ExtTextOutA.argtypes = [HDC, c_int, c_int, UINT, LPRECT, c_char_p, UINT, POINTER(INT)]
+_gdi32.GdiFlush.restype = BOOL
+_gdi32.GdiFlush.argtypes = []
+_gdi32.GetCharABCWidthsW.restype = BOOL
+_gdi32.GetCharABCWidthsW.argtypes = [HDC, UINT, UINT, POINTER(ABC)]
+_gdi32.GetCharWidth32W.restype = BOOL
+_gdi32.GetCharWidth32W.argtypes = [HDC, UINT, UINT, POINTER(INT)]
+_gdi32.GetStockObject.restype = HGDIOBJ
+_gdi32.GetStockObject.argtypes = [c_int]
+_gdi32.GetTextMetricsA.restype = BOOL
+_gdi32.GetTextMetricsA.argtypes = [HDC, POINTER(TEXTMETRIC)]
+_gdi32.SelectObject.restype = HGDIOBJ
+_gdi32.SelectObject.argtypes = [HDC, HGDIOBJ]
+_gdi32.SetBkColor.restype = COLORREF
+_gdi32.SetBkColor.argtypes = [HDC, COLORREF]
+_gdi32.SetBkMode.restype = c_int
+_gdi32.SetBkMode.argtypes = [HDC, c_int]
+_gdi32.SetPixelFormat.restype = BOOL
+_gdi32.SetPixelFormat.argtypes = [HDC, c_int, POINTER(PIXELFORMATDESCRIPTOR)]
+_gdi32.SetTextColor.restype = COLORREF
+_gdi32.SetTextColor.argtypes = [HDC, COLORREF]
+_gdi32.SwapBuffers.restype = BOOL
+_gdi32.SwapBuffers.argtypes = [HDC]
+
+_kernel32.CloseHandle.restype = BOOL
+_kernel32.CloseHandle.argtypes = [HANDLE]
+_kernel32.CreateEventW.restype = HANDLE
+_kernel32.CreateEventW.argtypes = [POINTER(SECURITY_ATTRIBUTES), BOOL, BOOL, c_wchar_p]
+_kernel32.CreateWaitableTimerA.restype = HANDLE
+_kernel32.CreateWaitableTimerA.argtypes = [POINTER(SECURITY_ATTRIBUTES), BOOL, c_char_p]
+_kernel32.GetCurrentThreadId.restype = DWORD
+_kernel32.GetCurrentThreadId.argtypes = []
+_kernel32.GetModuleHandleW.restype = HMODULE
+_kernel32.GetModuleHandleW.argtypes = [c_wchar_p]
+_kernel32.GlobalAlloc.restype = HGLOBAL
+_kernel32.GlobalAlloc.argtypes = [UINT, c_size_t]
+_kernel32.GlobalLock.restype = LPVOID
+_kernel32.GlobalLock.argtypes = [HGLOBAL]
+_kernel32.GlobalUnlock.restype = BOOL
+_kernel32.GlobalUnlock.argtypes = [HGLOBAL]
+_kernel32.SetLastError.restype = DWORD
+_kernel32.SetLastError.argtypes = [DWORD]
+_kernel32.SetWaitableTimer.restype = BOOL
+_kernel32.SetWaitableTimer.argtypes = [HANDLE, POINTER(LARGE_INTEGER), LONG, LPVOID, LPVOID, BOOL] # TIMERAPCPROC
+_kernel32.WaitForSingleObject.restype = DWORD
+_kernel32.WaitForSingleObject.argtypes = [HANDLE, DWORD]
+
+_user32.AdjustWindowRectEx.restype = BOOL
+_user32.AdjustWindowRectEx.argtypes = [LPRECT, DWORD, BOOL, DWORD]
+_user32.ChangeDisplaySettingsExW.restype = LONG
+_user32.ChangeDisplaySettingsExW.argtypes = [c_wchar_p, POINTER(DEVMODE), HWND, DWORD, LPVOID]
+_user32.ClientToScreen.restype = BOOL
+_user32.ClientToScreen.argtypes = [HWND, LPPOINT]
+_user32.ClipCursor.restype = BOOL
+_user32.ClipCursor.argtypes = [LPRECT]
+_user32.CreateIconIndirect.restype = HICON
+_user32.CreateIconIndirect.argtypes = [POINTER(ICONINFO)]
+_user32.CreateWindowExW.restype = HWND
+_user32.CreateWindowExW.argtypes = [DWORD, c_wchar_p, c_wchar_p, DWORD, c_int, c_int, c_int, c_int, HWND, HMENU,
+ HINSTANCE, LPVOID]
+_user32.DefWindowProcW.restype = LRESULT
+_user32.DefWindowProcW.argtypes = [HWND, UINT, WPARAM, LPARAM]
+_user32.DestroyWindow.restype = BOOL
+_user32.DestroyWindow.argtypes = [HWND]
+_user32.DispatchMessageW.restype = LRESULT
+_user32.DispatchMessageW.argtypes = [LPMSG]
+_user32.EnumDisplayMonitors.restype = BOOL
+_user32.EnumDisplayMonitors.argtypes = [HDC, LPRECT, MONITORENUMPROC, LPARAM]
+_user32.EnumDisplaySettingsW.restype = BOOL
+_user32.EnumDisplaySettingsW.argtypes = [c_wchar_p, DWORD, POINTER(DEVMODE)]
+_user32.FillRect.restype = c_int
+_user32.FillRect.argtypes = [HDC, LPRECT, HBRUSH]
+_user32.GetClientRect.restype = BOOL
+_user32.GetClientRect.argtypes = [HWND, LPRECT]
+_user32.GetCursorPos.restype = BOOL
+_user32.GetCursorPos.argtypes = [LPPOINT]
+# workaround for win 64-bit, see issue #664
+_user32.GetDC.restype = c_void_p # HDC
+_user32.GetDC.argtypes = [c_void_p] # [HWND]
+_user32.GetDesktopWindow.restype = HWND
+_user32.GetDesktopWindow.argtypes = []
+_user32.GetKeyState.restype = c_short
+_user32.GetKeyState.argtypes = [c_int]
+_user32.GetMessageW.restype = BOOL
+_user32.GetMessageW.argtypes = [LPMSG, HWND, UINT, UINT]
+_user32.GetMonitorInfoW.restype = BOOL
+_user32.GetMonitorInfoW.argtypes = [HMONITOR, POINTER(MONITORINFOEX)]
+_user32.GetQueueStatus.restype = DWORD
+_user32.GetQueueStatus.argtypes = [UINT]
+_user32.GetSystemMetrics.restype = c_int
+_user32.GetSystemMetrics.argtypes = [c_int]
+_user32.LoadCursorW.restype = HCURSOR
+_user32.LoadCursorW.argtypes = [HINSTANCE, c_wchar_p]
+_user32.LoadIconW.restype = HICON
+_user32.LoadIconW.argtypes = [HINSTANCE, c_wchar_p]
+_user32.LoadImageW.restype = HICON
+_user32.LoadImageW.argtypes = [HINSTANCE, LPCWSTR, UINT, c_int, c_int, UINT]
+_user32.MapVirtualKeyW.restype = UINT
+_user32.MapVirtualKeyW.argtypes = [UINT, UINT]
+_user32.MapWindowPoints.restype = c_int
+_user32.MapWindowPoints.argtypes = [HWND, HWND, c_void_p, UINT] # HWND, HWND, LPPOINT, UINT
+_user32.MsgWaitForMultipleObjects.restype = DWORD
+_user32.MsgWaitForMultipleObjects.argtypes = [DWORD, POINTER(HANDLE), BOOL, DWORD, DWORD]
+_user32.PeekMessageW.restype = BOOL
+_user32.PeekMessageW.argtypes = [LPMSG, HWND, UINT, UINT, UINT]
+_user32.PostThreadMessageW.restype = BOOL
+_user32.PostThreadMessageW.argtypes = [DWORD, UINT, WPARAM, LPARAM]
+_user32.RegisterClassW.restype = ATOM
+_user32.RegisterClassW.argtypes = [POINTER(WNDCLASS)]
+_user32.RegisterHotKey.restype = BOOL
+_user32.RegisterHotKey.argtypes = [HWND, c_int, UINT, UINT]
+_user32.ReleaseCapture.restype = BOOL
+_user32.ReleaseCapture.argtypes = []
+# workaround for win 64-bit, see issue #664
+_user32.ReleaseDC.restype = c_int32 # c_int
+_user32.ReleaseDC.argtypes = [c_void_p, c_void_p] # [HWND, HDC]
+_user32.ScreenToClient.restype = BOOL
+_user32.ScreenToClient.argtypes = [HWND, LPPOINT]
+_user32.SetCapture.restype = HWND
+_user32.SetCapture.argtypes = [HWND]
+_user32.SetClassLongW.restype = DWORD
+_user32.SetClassLongW.argtypes = [HWND, c_int, LONG]
+if IS64:
+ _user32.SetClassLongPtrW.restype = ULONG
+ _user32.SetClassLongPtrW.argtypes = [HWND, c_int, LONG_PTR]
+else:
+ _user32.SetClassLongPtrW = _user32.SetClassLongW
+_user32.SetCursor.restype = HCURSOR
+_user32.SetCursor.argtypes = [HCURSOR]
+_user32.SetCursorPos.restype = BOOL
+_user32.SetCursorPos.argtypes = [c_int, c_int]
+_user32.SetFocus.restype = HWND
+_user32.SetFocus.argtypes = [HWND]
+_user32.SetForegroundWindow.restype = BOOL
+_user32.SetForegroundWindow.argtypes = [HWND]
+_user32.SetTimer.restype = UINT_PTR
+_user32.SetTimer.argtypes = [HWND, UINT_PTR, UINT, TIMERPROC]
+_user32.SetWindowLongW.restype = LONG
+_user32.SetWindowLongW.argtypes = [HWND, c_int, LONG]
+_user32.SetWindowPos.restype = BOOL
+_user32.SetWindowPos.argtypes = [HWND, HWND, c_int, c_int, c_int, c_int, UINT]
+_user32.SetWindowTextW.restype = BOOL
+_user32.SetWindowTextW.argtypes = [HWND, c_wchar_p]
+_user32.ShowCursor.restype = c_int
+_user32.ShowCursor.argtypes = [BOOL]
+_user32.ShowWindow.restype = BOOL
+_user32.ShowWindow.argtypes = [HWND, c_int]
+_user32.TrackMouseEvent.restype = BOOL
+_user32.TrackMouseEvent.argtypes = [POINTER(TRACKMOUSEEVENT)]
+_user32.TranslateMessage.restype = BOOL
+_user32.TranslateMessage.argtypes = [LPMSG]
+_user32.UnregisterClassW.restype = BOOL
+_user32.UnregisterClassW.argtypes = [c_wchar_p, HINSTANCE]
+_user32.UnregisterHotKey.restype = BOOL
+_user32.UnregisterHotKey.argtypes = [HWND, c_int]
+# Raw inputs
+_user32.RegisterRawInputDevices.restype = BOOL
+_user32.RegisterRawInputDevices.argtypes = [PCRAWINPUTDEVICE, UINT, UINT]
+_user32.GetRawInputData.restype = UINT
+_user32.GetRawInputData.argtypes = [HRAWINPUT, UINT, LPVOID, PUINT, UINT]
+_user32.ChangeWindowMessageFilterEx.restype = BOOL
+_user32.ChangeWindowMessageFilterEx.argtypes = [HWND, UINT, DWORD, c_void_p]
+_user32.RegisterDeviceNotificationW.restype = HANDLE
+_user32.RegisterDeviceNotificationW.argtypes = [HANDLE, LPVOID, DWORD]
+_user32.UnregisterDeviceNotification.restype = BOOL
+_user32.UnregisterDeviceNotification.argtypes = [HANDLE]
+
+
+# dwmapi
+_dwmapi.DwmIsCompositionEnabled.restype = c_int
+_dwmapi.DwmIsCompositionEnabled.argtypes = [POINTER(INT)]
+_dwmapi.DwmFlush.restype = c_int
+_dwmapi.DwmFlush.argtypes = []
+
+# _shell32
+_shell32.DragAcceptFiles.restype = c_void
+_shell32.DragAcceptFiles.argtypes = [HWND, BOOL]
+_shell32.DragFinish.restype = c_void
+_shell32.DragFinish.argtypes = [HDROP]
+_shell32.DragQueryFileW.restype = UINT
+_shell32.DragQueryFileW.argtypes = [HDROP, UINT, LPWSTR, UINT]
+_shell32.DragQueryPoint.restype = BOOL
+_shell32.DragQueryPoint.argtypes = [HDROP, LPPOINT]
+
+# ole32
+_ole32.CreateStreamOnHGlobal.argtypes = [HGLOBAL, BOOL, LPSTREAM]
+_ole32.CoInitialize.restype = HRESULT
+_ole32.CoInitialize.argtypes = [LPVOID]
+_ole32.CoInitializeEx.restype = HRESULT
+_ole32.CoInitializeEx.argtypes = [LPVOID, DWORD]
+_ole32.CoUninitialize.restype = HRESULT
+_ole32.CoUninitialize.argtypes = []
+_ole32.PropVariantClear.restype = HRESULT
+_ole32.PropVariantClear.argtypes = [c_void_p]
+_ole32.CoCreateInstance.restype = HRESULT
+_ole32.CoCreateInstance.argtypes = [com.REFIID, c_void_p, DWORD, com.REFIID, c_void_p]
+_ole32.CoSetProxyBlanket.restype = HRESULT
+_ole32.CoSetProxyBlanket.argtypes = (c_void_p, DWORD, DWORD, c_void_p, DWORD, DWORD, c_void_p, DWORD)
+
+# oleaut32
+_oleaut32.VariantInit.restype = c_void_p
+_oleaut32.VariantInit.argtypes = [c_void_p]
+_oleaut32.VariantClear.restype = HRESULT
+_oleaut32.VariantClear.argtypes = [c_void_p]
+
+if _debug_win32:
+ import traceback
+
+ _log_win32 = open('debug_win32.log', 'w')
+
+
+ def win32_errcheck(result, func, args):
+ last_err = ctypes.get_last_error()
+ if last_err != 0: # If the result is not success and last error is invalid.
+ for entry in traceback.format_list(traceback.extract_stack()[:-1]):
+ _log_win32.write(entry)
+ print(f"[Result {result}] Error #{last_err} - {ctypes.FormatError(last_err)}", file=_log_win32)
+ return args
+
+
+ def set_errchecks(lib):
+ """Set errcheck hook on all functions we have defined."""
+ for key in lib.__dict__:
+ if key.startswith('_'): # Ignore builtins.
+ continue
+ lib.__dict__[key].errcheck = win32_errcheck
+
+
+ set_errchecks(_gdi32)
+ set_errchecks(_kernel32)
+ set_errchecks(_user32)
+ set_errchecks(_dwmapi)
+ set_errchecks(_shell32)
+ set_errchecks(_ole32)
+ set_errchecks(_oleaut32)
+
+# Initialize COM. Required for: WIC (DirectWrite), WMF, and XInput
+try:
+ if pyglet.options["com_mta"] is True:
+ _ole32.CoInitializeEx(None, constants.COINIT_MULTITHREADED)
+ else:
+ _ole32.CoInitializeEx(None, constants.COINIT_APARTMENTTHREADED)
+except OSError as err:
+ if err.winerror == constants.RPC_E_CHANGED_MODE:
+ warnings.warn("COM mode set by another library in a different mode. Unexpected behavior may occur.")
+ else:
+ warnings.warn("COM was already initialized by another library.")
+
+
+def _uninitialize():
+ try:
+ _ole32.CoUninitialize()
+ except OSError:
+ pass
+
+
+atexit.register(_uninitialize)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/com.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/com.py
new file mode 100644
index 0000000000000000000000000000000000000000..a636aebed8cdd15a7c642d6e68612ead2920e81f
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/com.py
@@ -0,0 +1,340 @@
+"""Minimal Windows COM interface.
+
+Allows pyglet to use COM interfaces on Windows without comtypes. Unlike
+comtypes, this module does not provide property interfaces, read typelibs,
+nice-ify return values. We don't need anything that sophisticated to work with COM's.
+
+Interfaces should derive from pIUnknown if their implementation is returned by the COM.
+The Python COM interfaces are actually pointers to the implementation (take note
+when translating methods that take an interface as argument).
+(example: A Double Pointer is simply POINTER(MyInterface) as pInterface is already a POINTER.)
+
+Interfaces can define methods::
+
+ class IDirectSound8(com.pIUnknown):
+ _methods_ = [
+ ('CreateSoundBuffer', com.STDMETHOD()),
+ ('GetCaps', com.STDMETHOD(LPDSCAPS)),
+ ...
+ ]
+
+Only use STDMETHOD or METHOD for the method types (not ordinary ctypes
+function types). The 'this' pointer is bound automatically... e.g., call::
+
+ device = IDirectSound8()
+ DirectSoundCreate8(None, ctypes.byref(device), None)
+
+ caps = DSCAPS()
+ device.GetCaps(caps)
+
+Because STDMETHODs use HRESULT as the return type, there is no need to check
+the return value.
+
+Don't forget to manually manage memory... call Release() when you're done with
+an interface.
+"""
+
+import sys
+import ctypes
+
+from pyglet.util import debug_print
+
+_debug_com = debug_print('debug_com')
+
+if sys.platform != 'win32':
+ raise ImportError('pyglet.libs.win32.com requires a Windows build of Python')
+
+
+class GUID(ctypes.Structure):
+ _fields_ = [
+ ('Data1', ctypes.c_ulong),
+ ('Data2', ctypes.c_ushort),
+ ('Data3', ctypes.c_ushort),
+ ('Data4', ctypes.c_ubyte * 8)
+ ]
+
+ def __init__(self, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8):
+ self.Data1 = l
+ self.Data2 = w1
+ self.Data3 = w2
+ self.Data4[:] = (b1, b2, b3, b4, b5, b6, b7, b8)
+
+ def __repr__(self):
+ b1, b2, b3, b4, b5, b6, b7, b8 = self.Data4
+ return 'GUID(%x, %x, %x, %x, %x, %x, %x, %x, %x, %x, %x)' % (
+ self.Data1, self.Data2, self.Data3, b1, b2, b3, b4, b5, b6, b7, b8)
+
+ def __cmp__(self, other):
+ if isinstance(other, GUID):
+ return ctypes.cmp(bytes(self), bytes(other))
+ return -1
+
+ def __eq__(self, other):
+ return isinstance(other, GUID) and bytes(self) == bytes(other)
+
+ def __hash__(self):
+ return hash(bytes(self))
+
+
+LPGUID = ctypes.POINTER(GUID)
+IID = GUID
+REFIID = ctypes.POINTER(IID)
+
+
+class METHOD:
+ """COM method."""
+
+ def __init__(self, restype, *args):
+ self.restype = restype
+ self.argtypes = args
+
+ def get_field(self):
+ # ctypes caches WINFUNCTYPE's so this should be ok.
+ return ctypes.WINFUNCTYPE(self.restype, *self.argtypes)
+
+
+class STDMETHOD(METHOD):
+ """COM method with HRESULT return value."""
+
+ def __init__(self, *args):
+ super(STDMETHOD, self).__init__(ctypes.HRESULT, *args)
+
+
+class COMMethodInstance:
+ """Binds a COM interface method."""
+
+ def __init__(self, name, i, method):
+ self.name = name
+ self.i = i
+ self.method = method
+
+ def __get__(self, obj, tp):
+ if obj is not None:
+ def _call(*args):
+ assert _debug_com('COM: #{} IN {}({}, {})'.format(self.i, self.name, obj.__class__.__name__, args))
+ ret = self.method.get_field()(self.i, self.name)(obj, *args)
+ assert _debug_com('COM: #{} OUT {}({}, {})'.format(self.i, self.name, obj.__class__.__name__, args))
+ assert _debug_com('COM: RETURN {}'.format(ret))
+ return ret
+
+ return _call
+
+ raise AttributeError()
+
+
+class COMInterface(ctypes.Structure):
+ """Dummy struct to serve as the type of all COM pointers."""
+ _fields_ = [
+ ('lpVtbl', ctypes.c_void_p),
+ ]
+
+
+class InterfacePtrMeta(type(ctypes.POINTER(COMInterface))):
+ """Allows interfaces to be subclassed as ctypes POINTER and expects to be populated with data from a COM object.
+ TODO: Phase this out and properly use POINTER(Interface) where applicable.
+ """
+
+ def __new__(cls, name, bases, dct):
+ methods = []
+ for base in bases[::-1]:
+ methods.extend(base.__dict__.get('_methods_', ()))
+ methods.extend(dct.get('_methods_', ()))
+
+ for i, (n, method) in enumerate(methods):
+ dct[n] = COMMethodInstance(n, i, method)
+
+ dct['_type_'] = COMInterface
+
+ return super(InterfacePtrMeta, cls).__new__(cls, name, bases, dct)
+
+
+# pyglet.util.with_metaclass does not work here, as the base class is from _ctypes.lib
+# See https://wiki.python.org/moin/PortingToPy3k/BilingualQuickRef
+pInterface = InterfacePtrMeta(str('Interface'),
+ (ctypes.POINTER(COMInterface),),
+ {'__doc__': 'Base COM interface pointer.'})
+
+
+class COMInterfaceMeta(type):
+ """This differs in the original as an implemented interface object, not a POINTER object.
+ Used when the user must implement their own functions within an interface rather than
+ being created and generated by the COM object itself. The types are automatically inserted in the ctypes type
+ cache so it can recognize the type arguments.
+ """
+
+ def __new__(mcs, name, bases, dct):
+ methods = dct.pop("_methods_", None)
+ cls = type.__new__(mcs, name, bases, dct)
+
+ if methods is not None:
+ cls._methods_ = methods
+
+ if not bases:
+ _ptr_bases = (cls, COMPointer)
+ else:
+ _ptr_bases = (cls, ctypes.POINTER(bases[0]))
+
+ # Class type is dynamically created inside __new__ based on metaclass inheritence; update ctypes cache manually.
+ from ctypes import _pointer_type_cache
+ _pointer_type_cache[cls] = type(COMPointer)("POINTER({})".format(cls.__name__),
+ _ptr_bases,
+ {"__interface__": cls})
+
+ return cls
+
+ def __get_subclassed_methodcount(self):
+ """Returns the amount of COM methods in all subclasses to determine offset of methods.
+ Order must be exact from the source when calling COM methods.
+ """
+ try:
+ result = 0
+ for itf in self.mro()[1:-1]:
+ result += len(itf.__dict__["_methods_"])
+ return result
+ except KeyError as err:
+ (name,) = err.args
+ if name == "_methods_":
+ raise TypeError("Interface '{}' requires a _methods_ attribute.".format(itf.__name__))
+ raise
+
+
+class COMPointerMeta(type(ctypes.c_void_p), COMInterfaceMeta):
+ """Required to prevent metaclass conflicts with inheritance."""
+
+
+class COMPointer(ctypes.c_void_p, metaclass=COMPointerMeta):
+ """COM Pointer base, could use c_void_p but need to override from_param ."""
+
+ @classmethod
+ def from_param(cls, obj):
+ """Allows obj to return ctypes pointers, even if its base is not a ctype.
+ In this case, all we simply want is a ctypes pointer matching the cls interface from the obj.
+ """
+ if obj is None:
+ return
+
+ try:
+ ptr_dct = obj._pointers
+ except AttributeError:
+ raise Exception("Interface method argument specified incorrectly, or passed wrong argument.", cls)
+ else:
+ try:
+ return ptr_dct[cls.__interface__]
+ except KeyError:
+ raise TypeError("Interface {} doesn't have a pointer in this class.".format(cls.__name__))
+
+
+def _missing_impl(interface_name, method_name):
+ """Functions that are not implemented use this to prevent errors when called."""
+
+ def missing_cb_func(*args):
+ """Return E_NOTIMPL because the method is not implemented."""
+ assert _debug_com("Undefined method: {0} was called in interface: {1}".format(method_name, interface_name))
+ return 0
+
+ return missing_cb_func
+
+
+def _found_impl(interface_name, method_name, method_func):
+ """If a method was found in class, we can set it as a callback."""
+
+ def cb_func(*args, **kw):
+ try:
+ result = method_func(*args, **kw)
+ except Exception as err:
+ raise err
+
+ if not result: # QOL so callbacks don't need to specify a return for assumed OK's.
+ return 0
+
+ return result
+
+ return cb_func
+
+
+def _make_callback_func(interface, name, method_func):
+ """Create a callback function for ctypes if possible."""
+ if method_func is None:
+ return _missing_impl(interface, name)
+
+ return _found_impl(interface, name, method_func)
+
+
+# Store structures with same fields to prevent duplicate table creations.
+_cached_structures = {}
+
+
+def create_vtbl_structure(fields, interface):
+ """Create virtual table structure with fields for use in COM's."""
+ try:
+ return _cached_structures[fields]
+ except KeyError:
+ Vtbl = type("Vtbl_{}".format(interface.__name__), (ctypes.Structure,), {"_fields_": fields})
+ _cached_structures[fields] = Vtbl
+ return Vtbl
+
+
+class COMObject:
+ """A base class for defining a COM object for use with callbacks and custom implementations."""
+ _interfaces_ = []
+
+ def __new__(cls, *args, **kw):
+ new_cls = super(COMObject, cls).__new__(cls)
+ assert len(cls._interfaces_) > 0, "Atleast one interface must be defined to use a COMObject."
+ new_cls._pointers = {}
+ new_cls.__create_interface_pointers()
+ return new_cls
+
+ def __create_interface_pointers(cls):
+ """Create a custom ctypes structure to handle COM functions in a COM Object."""
+ interfaces = tuple(cls._interfaces_)
+ for itf in interfaces[::-1]:
+ methods = []
+ fields = []
+ for interface in itf.__mro__[-2::-1]:
+ for method in interface._methods_:
+ name, com_method = method
+
+ found_method = getattr(cls, name, None)
+ mth = _make_callback_func(itf.__name__, name, found_method)
+
+ proto = ctypes.WINFUNCTYPE(com_method.restype, *com_method.argtypes)
+
+ fields.append((name, proto))
+ methods.append(proto(mth))
+
+ # Make a structure dynamically with the fields given.
+ itf_structure = create_vtbl_structure(tuple(fields), interface)
+
+ # Assign the methods to the fields
+ vtbl = itf_structure(*methods)
+
+ cls._pointers[itf] = ctypes.pointer(ctypes.pointer(vtbl))
+
+ @property
+ def pointers(self):
+ """Returns pointers to the implemented interfaces in this COMObject. Read-only.
+
+ :type: dict
+ """
+ return self._pointers
+
+class Interface(metaclass=COMInterfaceMeta):
+ _methods_ = []
+
+
+class IUnknown(metaclass=COMInterfaceMeta):
+ """These methods are not implemented by default yet. Strictly for COM method ordering."""
+ _methods_ = [
+ ('QueryInterface', STDMETHOD(ctypes.c_void_p, REFIID, ctypes.c_void_p)),
+ ('AddRef', METHOD(ctypes.c_int, ctypes.c_void_p)),
+ ('Release', METHOD(ctypes.c_int, ctypes.c_void_p))
+ ]
+
+
+class pIUnknown(pInterface):
+ _methods_ = [
+ ('QueryInterface', STDMETHOD(REFIID, ctypes.c_void_p)),
+ ('AddRef', METHOD(ctypes.c_int)),
+ ('Release', METHOD(ctypes.c_int))
+ ]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/constants.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/constants.py
new file mode 100644
index 0000000000000000000000000000000000000000..5525dc766ae2cc4436ca4eeb49031c9c70123824
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/constants.py
@@ -0,0 +1,5080 @@
+import sys
+
+# Most of this file is win32con.py from Python for Windows Extensions:
+# http://www.python.net/crew/mhammond/win32/
+
+# From Windows 2000 API SuperBible:
+
+VK_OEM_1 = 0xba
+VK_OEM_PLUS = 0xbb
+VK_OEM_COMMA = 0xbc
+VK_OEM_MINUS = 0xbd
+VK_OEM_PERIOD = 0xbe
+VK_OEM_2 = 0xbf
+VK_OEM_3 = 0xc0
+VK_OEM_4 = 0xdb
+VK_OEM_5 = 0xdc
+VK_OEM_6 = 0xdd
+VK_OEM_7 = 0xde
+VK_OEM_8 = 0xdf
+VK_OEM_102 = 0xe2
+
+# Copyright (c) 1994-2001, Mark Hammond
+# 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 name of Mark Hammond nor the name of 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 REGENTS 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. P
+
+# From WinGDI.h
+PFD_TYPE_RGBA = 0
+PFD_TYPE_COLORINDEX = 1
+PFD_MAIN_PLANE = 0
+PFD_OVERLAY_PLANE = 1
+PFD_UNDERLAY_PLANE = (-1)
+PFD_DOUBLEBUFFER = 0x00000001
+PFD_STEREO = 0x00000002
+PFD_DRAW_TO_WINDOW = 0x00000004
+PFD_DRAW_TO_BITMAP = 0x00000008
+PFD_SUPPORT_GDI = 0x00000010
+PFD_SUPPORT_OPENGL = 0x00000020
+PFD_GENERIC_FORMAT = 0x00000040
+PFD_NEED_PALETTE = 0x00000080
+PFD_NEED_SYSTEM_PALETTE = 0x00000100
+PFD_SWAP_EXCHANGE = 0x00000200
+PFD_SWAP_COPY = 0x00000400
+PFD_SWAP_LAYER_BUFFERS = 0x00000800
+PFD_GENERIC_ACCELERATED = 0x00001000
+PFD_SUPPORT_DIRECTDRAW = 0x00002000
+PFD_DEPTH_DONTCARE = 0x20000000
+PFD_DOUBLEBUFFER_DONTCARE = 0x40000000
+PFD_STEREO_DONTCARE = 0x80000000
+
+# Generated by h2py from commdlg.h (plus modifications 4jan98)
+WINVER = 1280
+WM_USER = 1024
+PY_0U = 0
+OFN_READONLY = 1
+OFN_OVERWRITEPROMPT = 2
+OFN_HIDEREADONLY = 4
+OFN_NOCHANGEDIR = 8
+OFN_SHOWHELP = 16
+OFN_ENABLEHOOK = 32
+OFN_ENABLETEMPLATE = 64
+OFN_ENABLETEMPLATEHANDLE = 128
+OFN_NOVALIDATE = 256
+OFN_ALLOWMULTISELECT = 512
+OFN_EXTENSIONDIFFERENT = 1024
+OFN_PATHMUSTEXIST = 2048
+OFN_FILEMUSTEXIST = 4096
+OFN_CREATEPROMPT = 8192
+OFN_SHAREAWARE = 16384
+OFN_NOREADONLYRETURN = 32768
+OFN_NOTESTFILECREATE = 65536
+OFN_NONETWORKBUTTON = 131072
+OFN_NOLONGNAMES = 262144
+OFN_EXPLORER = 524288 # new look commdlg
+OFN_NODEREFERENCELINKS = 1048576
+OFN_LONGNAMES = 2097152 # force long names for 3.x modules
+OFN_ENABLEINCLUDENOTIFY = 4194304 # send include message to callback
+OFN_ENABLESIZING = 8388608
+OFN_DONTADDTORECENT = 33554432
+OFN_FORCESHOWHIDDEN = 268435456 # Show All files including System and hidden files
+OFN_EX_NOPLACESBAR = 1
+OFN_SHAREFALLTHROUGH = 2
+OFN_SHARENOWARN = 1
+OFN_SHAREWARN = 0
+CDN_FIRST = (PY_0U-601)
+CDN_LAST = (PY_0U-699)
+CDN_INITDONE = (CDN_FIRST - 0)
+CDN_SELCHANGE = (CDN_FIRST - 1)
+CDN_FOLDERCHANGE = (CDN_FIRST - 2)
+CDN_SHAREVIOLATION = (CDN_FIRST - 3)
+CDN_HELP = (CDN_FIRST - 4)
+CDN_FILEOK = (CDN_FIRST - 5)
+CDN_TYPECHANGE = (CDN_FIRST - 6)
+CDN_INCLUDEITEM = (CDN_FIRST - 7)
+CDM_FIRST = (WM_USER + 100)
+CDM_LAST = (WM_USER + 200)
+CDM_GETSPEC = (CDM_FIRST + 0)
+CDM_GETFILEPATH = (CDM_FIRST + 1)
+CDM_GETFOLDERPATH = (CDM_FIRST + 2)
+CDM_GETFOLDERIDLIST = (CDM_FIRST + 3)
+CDM_SETCONTROLTEXT = (CDM_FIRST + 4)
+CDM_HIDECONTROL = (CDM_FIRST + 5)
+CDM_SETDEFEXT = (CDM_FIRST + 6)
+CC_RGBINIT = 1
+CC_FULLOPEN = 2
+CC_PREVENTFULLOPEN = 4
+CC_SHOWHELP = 8
+CC_ENABLEHOOK = 16
+CC_ENABLETEMPLATE = 32
+CC_ENABLETEMPLATEHANDLE = 64
+CC_SOLIDCOLOR = 128
+CC_ANYCOLOR = 256
+FR_DOWN = 1
+FR_WHOLEWORD = 2
+FR_MATCHCASE = 4
+FR_FINDNEXT = 8
+FR_REPLACE = 16
+FR_REPLACEALL = 32
+FR_DIALOGTERM = 64
+FR_SHOWHELP = 128
+FR_ENABLEHOOK = 256
+FR_ENABLETEMPLATE = 512
+FR_NOUPDOWN = 1024
+FR_NOMATCHCASE = 2048
+FR_NOWHOLEWORD = 4096
+FR_ENABLETEMPLATEHANDLE = 8192
+FR_HIDEUPDOWN = 16384
+FR_HIDEMATCHCASE = 32768
+FR_HIDEWHOLEWORD = 65536
+CF_SCREENFONTS = 1
+CF_PRINTERFONTS = 2
+CF_BOTH = (CF_SCREENFONTS | CF_PRINTERFONTS)
+CF_SHOWHELP = 4
+CF_ENABLEHOOK = 8
+CF_ENABLETEMPLATE = 16
+CF_ENABLETEMPLATEHANDLE = 32
+CF_INITTOLOGFONTSTRUCT = 64
+CF_USESTYLE = 128
+CF_EFFECTS = 256
+CF_APPLY = 512
+CF_ANSIONLY = 1024
+CF_SCRIPTSONLY = CF_ANSIONLY
+CF_NOVECTORFONTS = 2048
+CF_NOOEMFONTS = CF_NOVECTORFONTS
+CF_NOSIMULATIONS = 4096
+CF_LIMITSIZE = 8192
+CF_FIXEDPITCHONLY = 16384
+CF_WYSIWYG = 32768 # must also have CF_SCREENFONTS & CF_PRINTERFONTS
+CF_FORCEFONTEXIST = 65536
+CF_SCALABLEONLY = 131072
+CF_TTONLY = 262144
+CF_NOFACESEL = 524288
+CF_NOSTYLESEL = 1048576
+CF_NOSIZESEL = 2097152
+CF_SELECTSCRIPT = 4194304
+CF_NOSCRIPTSEL = 8388608
+CF_NOVERTFONTS = 16777216
+SIMULATED_FONTTYPE = 32768
+PRINTER_FONTTYPE = 16384
+SCREEN_FONTTYPE = 8192
+BOLD_FONTTYPE = 256
+ITALIC_FONTTYPE = 512
+REGULAR_FONTTYPE = 1024
+OPENTYPE_FONTTYPE = 65536
+TYPE1_FONTTYPE = 131072
+DSIG_FONTTYPE = 262144
+WM_CHOOSEFONT_GETLOGFONT = (WM_USER + 1)
+WM_CHOOSEFONT_SETLOGFONT = (WM_USER + 101)
+WM_CHOOSEFONT_SETFLAGS = (WM_USER + 102)
+LBSELCHSTRINGA = "commdlg_LBSelChangedNotify"
+SHAREVISTRINGA = "commdlg_ShareViolation"
+FILEOKSTRINGA = "commdlg_FileNameOK"
+COLOROKSTRINGA = "commdlg_ColorOK"
+SETRGBSTRINGA = "commdlg_SetRGBColor"
+HELPMSGSTRINGA = "commdlg_help"
+FINDMSGSTRINGA = "commdlg_FindReplace"
+LBSELCHSTRING = LBSELCHSTRINGA
+SHAREVISTRING = SHAREVISTRINGA
+FILEOKSTRING = FILEOKSTRINGA
+COLOROKSTRING = COLOROKSTRINGA
+SETRGBSTRING = SETRGBSTRINGA
+HELPMSGSTRING = HELPMSGSTRINGA
+FINDMSGSTRING = FINDMSGSTRINGA
+CD_LBSELNOITEMS = -1
+CD_LBSELCHANGE = 0
+CD_LBSELSUB = 1
+CD_LBSELADD = 2
+PD_ALLPAGES = 0
+PD_SELECTION = 1
+PD_PAGENUMS = 2
+PD_NOSELECTION = 4
+PD_NOPAGENUMS = 8
+PD_COLLATE = 16
+PD_PRINTTOFILE = 32
+PD_PRINTSETUP = 64
+PD_NOWARNING = 128
+PD_RETURNDC = 256
+PD_RETURNIC = 512
+PD_RETURNDEFAULT = 1024
+PD_SHOWHELP = 2048
+PD_ENABLEPRINTHOOK = 4096
+PD_ENABLESETUPHOOK = 8192
+PD_ENABLEPRINTTEMPLATE = 16384
+PD_ENABLESETUPTEMPLATE = 32768
+PD_ENABLEPRINTTEMPLATEHANDLE = 65536
+PD_ENABLESETUPTEMPLATEHANDLE = 131072
+PD_USEDEVMODECOPIES = 262144
+PD_DISABLEPRINTTOFILE = 524288
+PD_HIDEPRINTTOFILE = 1048576
+PD_NONETWORKBUTTON = 2097152
+DN_DEFAULTPRN = 1
+WM_PSD_PAGESETUPDLG = (WM_USER )
+WM_PSD_FULLPAGERECT = (WM_USER+1)
+WM_PSD_MINMARGINRECT = (WM_USER+2)
+WM_PSD_MARGINRECT = (WM_USER+3)
+WM_PSD_GREEKTEXTRECT = (WM_USER+4)
+WM_PSD_ENVSTAMPRECT = (WM_USER+5)
+WM_PSD_YAFULLPAGERECT = (WM_USER+6)
+PSD_DEFAULTMINMARGINS = 0 # default (printer's)
+PSD_INWININIINTLMEASURE = 0 # 1st of 4 possible
+PSD_MINMARGINS = 1 # use caller's
+PSD_MARGINS = 2 # use caller's
+PSD_INTHOUSANDTHSOFINCHES = 4 # 2nd of 4 possible
+PSD_INHUNDREDTHSOFMILLIMETERS = 8 # 3rd of 4 possible
+PSD_DISABLEMARGINS = 16
+PSD_DISABLEPRINTER = 32
+PSD_NOWARNING = 128 # must be same as PD_*
+PSD_DISABLEORIENTATION = 256
+PSD_RETURNDEFAULT = 1024 # must be same as PD_*
+PSD_DISABLEPAPER = 512
+PSD_SHOWHELP = 2048 # must be same as PD_*
+PSD_ENABLEPAGESETUPHOOK = 8192 # must be same as PD_*
+PSD_ENABLEPAGESETUPTEMPLATE = 32768 # must be same as PD_*
+PSD_ENABLEPAGESETUPTEMPLATEHANDLE = 131072 # must be same as PD_*
+PSD_ENABLEPAGEPAINTHOOK = 262144
+PSD_DISABLEPAGEPAINTING = 524288
+PSD_NONETWORKBUTTON = 2097152 # must be same as PD_*
+
+# Generated by h2py from winreg.h
+HKEY_CLASSES_ROOT = -2147483648
+HKEY_CURRENT_USER = -2147483647
+HKEY_LOCAL_MACHINE = -2147483646
+HKEY_USERS = -2147483645
+HKEY_PERFORMANCE_DATA = -2147483644
+HKEY_CURRENT_CONFIG = -2147483643
+HKEY_DYN_DATA = -2147483642
+HKEY_PERFORMANCE_TEXT = -2147483568 # ?? 4Jan98
+HKEY_PERFORMANCE_NLSTEXT = -2147483552 # ?? 4Jan98
+
+# Generated by h2py from winuser.h
+HWND_BROADCAST = 65535
+HWND_DESKTOP = 0
+HWND_TOP = 0
+HWND_BOTTOM = 1
+HWND_TOPMOST = -1
+HWND_NOTOPMOST = -2
+HWND_MESSAGE = -3
+
+# winuser.h line 4601
+SM_CXSCREEN = 0
+SM_CYSCREEN = 1
+SM_CXVSCROLL = 2
+SM_CYHSCROLL = 3
+SM_CYCAPTION = 4
+SM_CXBORDER = 5
+SM_CYBORDER = 6
+SM_CXDLGFRAME = 7
+SM_CYDLGFRAME = 8
+SM_CYVTHUMB = 9
+SM_CXHTHUMB = 10
+SM_CXICON = 11
+SM_CYICON = 12
+SM_CXCURSOR = 13
+SM_CYCURSOR = 14
+SM_CYMENU = 15
+SM_CXFULLSCREEN = 16
+SM_CYFULLSCREEN = 17
+SM_CYKANJIWINDOW = 18
+SM_MOUSEPRESENT = 19
+SM_CYVSCROLL = 20
+SM_CXHSCROLL = 21
+SM_DEBUG = 22
+SM_SWAPBUTTON = 23
+SM_RESERVED1 = 24
+SM_RESERVED2 = 25
+SM_RESERVED3 = 26
+SM_RESERVED4 = 27
+SM_CXMIN = 28
+SM_CYMIN = 29
+SM_CXSIZE = 30
+SM_CYSIZE = 31
+SM_CXFRAME = 32
+SM_CYFRAME = 33
+SM_CXMINTRACK = 34
+SM_CYMINTRACK = 35
+SM_CXDOUBLECLK = 36
+SM_CYDOUBLECLK = 37
+SM_CXICONSPACING = 38
+SM_CYICONSPACING = 39
+SM_MENUDROPALIGNMENT = 40
+SM_PENWINDOWS = 41
+SM_DBCSENABLED = 42
+SM_CMOUSEBUTTONS = 43
+SM_CXFIXEDFRAME = SM_CXDLGFRAME
+SM_CYFIXEDFRAME = SM_CYDLGFRAME
+SM_CXSIZEFRAME = SM_CXFRAME
+SM_CYSIZEFRAME = SM_CYFRAME
+SM_SECURE = 44
+SM_CXEDGE = 45
+SM_CYEDGE = 46
+SM_CXMINSPACING = 47
+SM_CYMINSPACING = 48
+SM_CXSMICON = 49
+SM_CYSMICON = 50
+SM_CYSMCAPTION = 51
+SM_CXSMSIZE = 52
+SM_CYSMSIZE = 53
+SM_CXMENUSIZE = 54
+SM_CYMENUSIZE = 55
+SM_ARRANGE = 56
+SM_CXMINIMIZED = 57
+SM_CYMINIMIZED = 58
+SM_CXMAXTRACK = 59
+SM_CYMAXTRACK = 60
+SM_CXMAXIMIZED = 61
+SM_CYMAXIMIZED = 62
+SM_NETWORK = 63
+SM_CLEANBOOT = 67
+SM_CXDRAG = 68
+SM_CYDRAG = 69
+SM_SHOWSOUNDS = 70
+SM_CXMENUCHECK = 71
+SM_CYMENUCHECK = 72
+SM_SLOWMACHINE = 73
+SM_MIDEASTENABLED = 74
+SM_MOUSEWHEELPRESENT = 75
+SM_XVIRTUALSCREEN = 76
+SM_YVIRTUALSCREEN = 77
+SM_CXVIRTUALSCREEN = 78
+SM_CYVIRTUALSCREEN = 79
+SM_CMONITORS = 80
+SM_SAMEDISPLAYFORMAT = 81
+SM_CMETRICS = 83
+MNC_IGNORE = 0
+MNC_CLOSE = 1
+MNC_EXECUTE = 2
+MNC_SELECT = 3
+MNS_NOCHECK = -2147483648
+MNS_MODELESS = 1073741824
+MNS_DRAGDROP = 536870912
+MNS_AUTODISMISS = 268435456
+MNS_NOTIFYBYPOS = 134217728
+MNS_CHECKORBMP = 67108864
+MIM_MAXHEIGHT = 1
+MIM_BACKGROUND = 2
+MIM_HELPID = 4
+MIM_MENUDATA = 8
+MIM_STYLE = 16
+MIM_APPLYTOSUBMENUS = -2147483648
+MND_CONTINUE = 0
+MND_ENDMENU = 1
+MNGOF_GAP = 3
+MNGO_NOINTERFACE = 0
+MNGO_NOERROR = 1
+MIIM_STATE = 1
+MIIM_ID = 2
+MIIM_SUBMENU = 4
+MIIM_CHECKMARKS = 8
+MIIM_TYPE = 16
+MIIM_DATA = 32
+MIIM_STRING = 64
+MIIM_BITMAP = 128
+MIIM_FTYPE = 256
+HBMMENU_CALLBACK = -1
+HBMMENU_SYSTEM = 1
+HBMMENU_MBAR_RESTORE = 2
+HBMMENU_MBAR_MINIMIZE = 3
+HBMMENU_MBAR_CLOSE = 5
+HBMMENU_MBAR_CLOSE_D = 6
+HBMMENU_MBAR_MINIMIZE_D = 7
+HBMMENU_POPUP_CLOSE = 8
+HBMMENU_POPUP_RESTORE = 9
+HBMMENU_POPUP_MAXIMIZE = 10
+HBMMENU_POPUP_MINIMIZE = 11
+GMDI_USEDISABLED = 1
+GMDI_GOINTOPOPUPS = 2
+TPM_LEFTBUTTON = 0
+TPM_RIGHTBUTTON = 2
+TPM_LEFTALIGN = 0
+TPM_CENTERALIGN = 4
+TPM_RIGHTALIGN = 8
+TPM_TOPALIGN = 0
+TPM_VCENTERALIGN = 16
+TPM_BOTTOMALIGN = 32
+TPM_HORIZONTAL = 0
+TPM_VERTICAL = 64
+TPM_NONOTIFY = 128
+TPM_RETURNCMD = 256
+TPM_RECURSE = 1
+DOF_EXECUTABLE = 32769
+DOF_DOCUMENT = 32770
+DOF_DIRECTORY = 32771
+DOF_MULTIPLE = 32772
+DOF_PROGMAN = 1
+DOF_SHELLDATA = 2
+DO_DROPFILE = 1162627398
+DO_PRINTFILE = 1414419024
+DT_TOP = 0
+DT_LEFT = 0
+DT_CENTER = 1
+DT_RIGHT = 2
+DT_VCENTER = 4
+DT_BOTTOM = 8
+DT_WORDBREAK = 16
+DT_SINGLELINE = 32
+DT_EXPANDTABS = 64
+DT_TABSTOP = 128
+DT_NOCLIP = 256
+DT_EXTERNALLEADING = 512
+DT_CALCRECT = 1024
+DT_NOPREFIX = 2048
+DT_INTERNAL = 4096
+DT_EDITCONTROL = 8192
+DT_PATH_ELLIPSIS = 16384
+DT_END_ELLIPSIS = 32768
+DT_MODIFYSTRING = 65536
+DT_RTLREADING = 131072
+DT_WORD_ELLIPSIS = 262144
+DST_COMPLEX = 0
+DST_TEXT = 1
+DST_PREFIXTEXT = 2
+DST_ICON = 3
+DST_BITMAP = 4
+DSS_NORMAL = 0
+DSS_UNION = 16
+DSS_DISABLED = 32
+DSS_MONO = 128
+DSS_RIGHT = 32768
+DCX_WINDOW = 1
+DCX_CACHE = 2
+DCX_NORESETATTRS = 4
+DCX_CLIPCHILDREN = 8
+DCX_CLIPSIBLINGS = 16
+DCX_PARENTCLIP = 32
+DCX_EXCLUDERGN = 64
+DCX_INTERSECTRGN = 128
+DCX_EXCLUDEUPDATE = 256
+DCX_INTERSECTUPDATE = 512
+DCX_LOCKWINDOWUPDATE = 1024
+DCX_VALIDATE = 2097152
+CUDR_NORMAL = 0
+CUDR_NOSNAPTOGRID = 1
+CUDR_NORESOLVEPOSITIONS = 2
+CUDR_NOCLOSEGAPS = 4
+CUDR_NEGATIVECOORDS = 8
+CUDR_NOPRIMARY = 16
+RDW_INVALIDATE = 1
+RDW_INTERNALPAINT = 2
+RDW_ERASE = 4
+RDW_VALIDATE = 8
+RDW_NOINTERNALPAINT = 16
+RDW_NOERASE = 32
+RDW_NOCHILDREN = 64
+RDW_ALLCHILDREN = 128
+RDW_UPDATENOW = 256
+RDW_ERASENOW = 512
+RDW_FRAME = 1024
+RDW_NOFRAME = 2048
+SW_SCROLLCHILDREN = 1
+SW_INVALIDATE = 2
+SW_ERASE = 4
+SW_SMOOTHSCROLL = 16 # Use smooth scrolling
+ESB_ENABLE_BOTH = 0
+ESB_DISABLE_BOTH = 3
+ESB_DISABLE_LEFT = 1
+ESB_DISABLE_RIGHT = 2
+ESB_DISABLE_UP = 1
+ESB_DISABLE_DOWN = 2
+ESB_DISABLE_LTUP = ESB_DISABLE_LEFT
+ESB_DISABLE_RTDN = ESB_DISABLE_RIGHT
+HELPINFO_WINDOW = 1
+HELPINFO_MENUITEM = 2
+MB_OK = 0
+MB_OKCANCEL = 1
+MB_ABORTRETRYIGNORE = 2
+MB_YESNOCANCEL = 3
+MB_YESNO = 4
+MB_RETRYCANCEL = 5
+MB_ICONHAND = 16
+MB_ICONQUESTION = 32
+MB_ICONEXCLAMATION = 48
+MB_ICONASTERISK = 64
+MB_ICONWARNING = MB_ICONEXCLAMATION
+MB_ICONERROR = MB_ICONHAND
+MB_ICONINFORMATION = MB_ICONASTERISK
+MB_ICONSTOP = MB_ICONHAND
+MB_DEFBUTTON1 = 0
+MB_DEFBUTTON2 = 256
+MB_DEFBUTTON3 = 512
+MB_DEFBUTTON4 = 768
+MB_APPLMODAL = 0
+MB_SYSTEMMODAL = 4096
+MB_TASKMODAL = 8192
+MB_HELP = 16384
+MB_NOFOCUS = 32768
+MB_SETFOREGROUND = 65536
+MB_DEFAULT_DESKTOP_ONLY = 131072
+MB_TOPMOST = 262144
+MB_RIGHT = 524288
+MB_RTLREADING = 1048576
+MB_SERVICE_NOTIFICATION = 2097152
+MB_TYPEMASK = 15
+MB_USERICON = 128
+MB_ICONMASK = 240
+MB_DEFMASK = 3840
+MB_MODEMASK = 12288
+MB_MISCMASK = 49152
+# winuser.h line 6373
+CWP_ALL = 0
+CWP_SKIPINVISIBLE = 1
+CWP_SKIPDISABLED = 2
+CWP_SKIPTRANSPARENT = 4
+CTLCOLOR_MSGBOX = 0
+CTLCOLOR_EDIT = 1
+CTLCOLOR_LISTBOX = 2
+CTLCOLOR_BTN = 3
+CTLCOLOR_DLG = 4
+CTLCOLOR_SCROLLBAR = 5
+CTLCOLOR_STATIC = 6
+CTLCOLOR_MAX = 7
+COLOR_SCROLLBAR = 0
+COLOR_BACKGROUND = 1
+COLOR_ACTIVECAPTION = 2
+COLOR_INACTIVECAPTION = 3
+COLOR_MENU = 4
+COLOR_WINDOW = 5
+COLOR_WINDOWFRAME = 6
+COLOR_MENUTEXT = 7
+COLOR_WINDOWTEXT = 8
+COLOR_CAPTIONTEXT = 9
+COLOR_ACTIVEBORDER = 10
+COLOR_INACTIVEBORDER = 11
+COLOR_APPWORKSPACE = 12
+COLOR_HIGHLIGHT = 13
+COLOR_HIGHLIGHTTEXT = 14
+COLOR_BTNFACE = 15
+COLOR_BTNSHADOW = 16
+COLOR_GRAYTEXT = 17
+COLOR_BTNTEXT = 18
+COLOR_INACTIVECAPTIONTEXT = 19
+COLOR_BTNHIGHLIGHT = 20
+COLOR_3DDKSHADOW = 21
+COLOR_3DLIGHT = 22
+COLOR_INFOTEXT = 23
+COLOR_INFOBK = 24
+COLOR_HOTLIGHT = 26
+COLOR_GRADIENTACTIVECAPTION = 27
+COLOR_GRADIENTINACTIVECAPTION = 28
+COLOR_DESKTOP = COLOR_BACKGROUND
+COLOR_3DFACE = COLOR_BTNFACE
+COLOR_3DSHADOW = COLOR_BTNSHADOW
+COLOR_3DHIGHLIGHT = COLOR_BTNHIGHLIGHT
+COLOR_3DHILIGHT = COLOR_BTNHIGHLIGHT
+COLOR_BTNHILIGHT = COLOR_BTNHIGHLIGHT
+GW_HWNDFIRST = 0
+GW_HWNDLAST = 1
+GW_HWNDNEXT = 2
+GW_HWNDPREV = 3
+GW_OWNER = 4
+GW_CHILD = 5
+GW_ENABLEDPOPUP = 6
+GW_MAX = 6
+MF_INSERT = 0
+MF_CHANGE = 128
+MF_APPEND = 256
+MF_DELETE = 512
+MF_REMOVE = 4096
+MF_BYCOMMAND = 0
+MF_BYPOSITION = 1024
+MF_SEPARATOR = 2048
+MF_ENABLED = 0
+MF_GRAYED = 1
+MF_DISABLED = 2
+MF_UNCHECKED = 0
+MF_CHECKED = 8
+MF_USECHECKBITMAPS = 512
+MF_STRING = 0
+MF_BITMAP = 4
+MF_OWNERDRAW = 256
+MF_POPUP = 16
+MF_MENUBARBREAK = 32
+MF_MENUBREAK = 64
+MF_UNHILITE = 0
+MF_HILITE = 128
+MF_DEFAULT = 4096
+MF_SYSMENU = 8192
+MF_HELP = 16384
+MF_RIGHTJUSTIFY = 16384
+MF_MOUSESELECT = 32768
+MF_END = 128
+MFT_STRING = MF_STRING
+MFT_BITMAP = MF_BITMAP
+MFT_MENUBARBREAK = MF_MENUBARBREAK
+MFT_MENUBREAK = MF_MENUBREAK
+MFT_OWNERDRAW = MF_OWNERDRAW
+MFT_RADIOCHECK = 512
+MFT_SEPARATOR = MF_SEPARATOR
+MFT_RIGHTORDER = 8192
+MFT_RIGHTJUSTIFY = MF_RIGHTJUSTIFY
+MFS_GRAYED = 3
+MFS_DISABLED = MFS_GRAYED
+MFS_CHECKED = MF_CHECKED
+MFS_HILITE = MF_HILITE
+MFS_ENABLED = MF_ENABLED
+MFS_UNCHECKED = MF_UNCHECKED
+MFS_UNHILITE = MF_UNHILITE
+MFS_DEFAULT = MF_DEFAULT
+MFS_MASK = 4235
+MFS_HOTTRACKDRAWN = 268435456
+MFS_CACHEDBMP = 536870912
+MFS_BOTTOMGAPDROP = 1073741824
+MFS_TOPGAPDROP = -2147483648
+MFS_GAPDROP = -1073741824
+SC_SIZE = 61440
+SC_MOVE = 61456
+SC_MINIMIZE = 61472
+SC_MAXIMIZE = 61488
+SC_NEXTWINDOW = 61504
+SC_PREVWINDOW = 61520
+SC_CLOSE = 61536
+SC_VSCROLL = 61552
+SC_HSCROLL = 61568
+SC_MOUSEMENU = 61584
+SC_KEYMENU = 61696
+SC_ARRANGE = 61712
+SC_RESTORE = 61728
+SC_TASKLIST = 61744
+SC_SCREENSAVE = 61760
+SC_HOTKEY = 61776
+SC_DEFAULT = 61792
+SC_MONITORPOWER = 61808
+SC_CONTEXTHELP = 61824
+SC_SEPARATOR = 61455
+SC_ICON = SC_MINIMIZE
+SC_ZOOM = SC_MAXIMIZE
+IDC_ARROW = 32512
+IDC_IBEAM = 32513
+IDC_WAIT = 32514
+IDC_CROSS = 32515
+IDC_UPARROW = 32516
+IDC_SIZE = 32640 # OBSOLETE: use IDC_SIZEALL
+IDC_ICON = 32641 # OBSOLETE: use IDC_ARROW
+IDC_SIZENWSE = 32642
+IDC_SIZENESW = 32643
+IDC_SIZEWE = 32644
+IDC_SIZENS = 32645
+IDC_SIZEALL = 32646
+IDC_NO = 32648
+IDC_HAND = 32649
+IDC_APPSTARTING = 32650
+IDC_HELP = 32651
+IMAGE_BITMAP = 0
+IMAGE_ICON = 1
+IMAGE_CURSOR = 2
+IMAGE_ENHMETAFILE = 3
+LR_DEFAULTCOLOR = 0
+LR_MONOCHROME = 1
+LR_COLOR = 2
+LR_COPYRETURNORG = 4
+LR_COPYDELETEORG = 8
+LR_LOADFROMFILE = 16
+LR_LOADTRANSPARENT = 32
+LR_DEFAULTSIZE = 64
+LR_LOADREALSIZE = 128
+LR_LOADMAP3DCOLORS = 4096
+LR_CREATEDIBSECTION = 8192
+LR_COPYFROMRESOURCE = 16384
+LR_SHARED = 32768
+DI_MASK = 1
+DI_IMAGE = 2
+DI_NORMAL = 3
+DI_COMPAT = 4
+DI_DEFAULTSIZE = 8
+RES_ICON = 1
+RES_CURSOR = 2
+OBM_CLOSE = 32754
+OBM_UPARROW = 32753
+OBM_DNARROW = 32752
+OBM_RGARROW = 32751
+OBM_LFARROW = 32750
+OBM_REDUCE = 32749
+OBM_ZOOM = 32748
+OBM_RESTORE = 32747
+OBM_REDUCED = 32746
+OBM_ZOOMD = 32745
+OBM_RESTORED = 32744
+OBM_UPARROWD = 32743
+OBM_DNARROWD = 32742
+OBM_RGARROWD = 32741
+OBM_LFARROWD = 32740
+OBM_MNARROW = 32739
+OBM_COMBO = 32738
+OBM_UPARROWI = 32737
+OBM_DNARROWI = 32736
+OBM_RGARROWI = 32735
+OBM_LFARROWI = 32734
+OBM_OLD_CLOSE = 32767
+OBM_SIZE = 32766
+OBM_OLD_UPARROW = 32765
+OBM_OLD_DNARROW = 32764
+OBM_OLD_RGARROW = 32763
+OBM_OLD_LFARROW = 32762
+OBM_BTSIZE = 32761
+OBM_CHECK = 32760
+OBM_CHECKBOXES = 32759
+OBM_BTNCORNERS = 32758
+OBM_OLD_REDUCE = 32757
+OBM_OLD_ZOOM = 32756
+OBM_OLD_RESTORE = 32755
+OCR_NORMAL = 32512
+OCR_IBEAM = 32513
+OCR_WAIT = 32514
+OCR_CROSS = 32515
+OCR_UP = 32516
+OCR_SIZE = 32640
+OCR_ICON = 32641
+OCR_SIZENWSE = 32642
+OCR_SIZENESW = 32643
+OCR_SIZEWE = 32644
+OCR_SIZENS = 32645
+OCR_SIZEALL = 32646
+OCR_ICOCUR = 32647
+OCR_NO = 32648
+OCR_HAND = 32649
+OCR_APPSTARTING = 32650
+# winuser.h line 7455
+OIC_SAMPLE = 32512
+OIC_HAND = 32513
+OIC_QUES = 32514
+OIC_BANG = 32515
+OIC_NOTE = 32516
+OIC_WINLOGO = 32517
+OIC_WARNING = OIC_BANG
+OIC_ERROR = OIC_HAND
+OIC_INFORMATION = OIC_NOTE
+ORD_LANGDRIVER = 1
+IDI_APPLICATION = 32512
+IDI_HAND = 32513
+IDI_QUESTION = 32514
+IDI_EXCLAMATION = 32515
+IDI_ASTERISK = 32516
+IDI_WINLOGO = 32517
+IDI_WARNING = IDI_EXCLAMATION
+IDI_ERROR = IDI_HAND
+IDI_INFORMATION = IDI_ASTERISK
+IDOK = 1
+IDCANCEL = 2
+IDABORT = 3
+IDRETRY = 4
+IDIGNORE = 5
+IDYES = 6
+IDNO = 7
+IDCLOSE = 8
+IDHELP = 9
+ES_LEFT = 0
+ES_CENTER = 1
+ES_RIGHT = 2
+ES_MULTILINE = 4
+ES_UPPERCASE = 8
+ES_LOWERCASE = 16
+ES_PASSWORD = 32
+ES_AUTOVSCROLL = 64
+ES_AUTOHSCROLL = 128
+ES_NOHIDESEL = 256
+ES_OEMCONVERT = 1024
+ES_READONLY = 2048
+ES_WANTRETURN = 4096
+ES_NUMBER = 8192
+EN_SETFOCUS = 256
+EN_KILLFOCUS = 512
+EN_CHANGE = 768
+EN_UPDATE = 1024
+EN_ERRSPACE = 1280
+EN_MAXTEXT = 1281
+EN_HSCROLL = 1537
+EN_VSCROLL = 1538
+EC_LEFTMARGIN = 1
+EC_RIGHTMARGIN = 2
+EC_USEFONTINFO = 65535
+EMSIS_COMPOSITIONSTRING = 1
+EIMES_GETCOMPSTRATONCE = 1
+EIMES_CANCELCOMPSTRINFOCUS = 2
+EIMES_COMPLETECOMPSTRKILLFOCUS = 4
+EM_GETSEL = 176
+EM_SETSEL = 177
+EM_GETRECT = 178
+EM_SETRECT = 179
+EM_SETRECTNP = 180
+EM_SCROLL = 181
+EM_LINESCROLL = 182
+EM_SCROLLCARET = 183
+EM_GETMODIFY = 184
+EM_SETMODIFY = 185
+EM_GETLINECOUNT = 186
+EM_LINEINDEX = 187
+EM_SETHANDLE = 188
+EM_GETHANDLE = 189
+EM_GETTHUMB = 190
+EM_LINELENGTH = 193
+EM_REPLACESEL = 194
+EM_GETLINE = 196
+EM_LIMITTEXT = 197
+EM_CANUNDO = 198
+EM_UNDO = 199
+EM_FMTLINES = 200
+EM_LINEFROMCHAR = 201
+EM_SETTABSTOPS = 203
+EM_SETPASSWORDCHAR = 204
+EM_EMPTYUNDOBUFFER = 205
+EM_GETFIRSTVISIBLELINE = 206
+EM_SETREADONLY = 207
+EM_SETWORDBREAKPROC = 208
+EM_GETWORDBREAKPROC = 209
+EM_GETPASSWORDCHAR = 210
+EM_SETMARGINS = 211
+EM_GETMARGINS = 212
+EM_SETLIMITTEXT = EM_LIMITTEXT
+EM_GETLIMITTEXT = 213
+EM_POSFROMCHAR = 214
+EM_CHARFROMPOS = 215
+EM_SETIMESTATUS = 216
+EM_GETIMESTATUS = 217
+WB_LEFT = 0
+WB_RIGHT = 1
+WB_ISDELIMITER = 2
+BS_PUSHBUTTON = 0
+BS_DEFPUSHBUTTON = 1
+BS_CHECKBOX = 2
+BS_AUTOCHECKBOX = 3
+BS_RADIOBUTTON = 4
+BS_3STATE = 5
+BS_AUTO3STATE = 6
+BS_GROUPBOX = 7
+BS_USERBUTTON = 8
+BS_AUTORADIOBUTTON = 9
+BS_OWNERDRAW = 11
+BS_LEFTTEXT = 32
+BS_TEXT = 0
+BS_ICON = 64
+BS_BITMAP = 128
+BS_LEFT = 256
+BS_RIGHT = 512
+BS_CENTER = 768
+BS_TOP = 1024
+BS_BOTTOM = 2048
+BS_VCENTER = 3072
+BS_PUSHLIKE = 4096
+BS_MULTILINE = 8192
+BS_NOTIFY = 16384
+BS_FLAT = 32768
+BS_RIGHTBUTTON = BS_LEFTTEXT
+BN_CLICKED = 0
+BN_PAINT = 1
+BN_HILITE = 2
+BN_UNHILITE = 3
+BN_DISABLE = 4
+BN_DOUBLECLICKED = 5
+BN_PUSHED = BN_HILITE
+BN_UNPUSHED = BN_UNHILITE
+BN_DBLCLK = BN_DOUBLECLICKED
+BN_SETFOCUS = 6
+BN_KILLFOCUS = 7
+BM_GETCHECK = 240
+BM_SETCHECK = 241
+BM_GETSTATE = 242
+BM_SETSTATE = 243
+BM_SETSTYLE = 244
+BM_CLICK = 245
+BM_GETIMAGE = 246
+BM_SETIMAGE = 247
+BST_UNCHECKED = 0
+BST_CHECKED = 1
+BST_INDETERMINATE = 2
+BST_PUSHED = 4
+BST_FOCUS = 8
+SS_LEFT = 0
+SS_CENTER = 1
+SS_RIGHT = 2
+SS_ICON = 3
+SS_BLACKRECT = 4
+SS_GRAYRECT = 5
+SS_WHITERECT = 6
+SS_BLACKFRAME = 7
+SS_GRAYFRAME = 8
+SS_WHITEFRAME = 9
+SS_USERITEM = 10
+SS_SIMPLE = 11
+SS_LEFTNOWORDWRAP = 12
+SS_BITMAP = 14
+SS_OWNERDRAW = 13
+SS_ENHMETAFILE = 15
+SS_ETCHEDHORZ = 16
+SS_ETCHEDVERT = 17
+SS_ETCHEDFRAME = 18
+SS_TYPEMASK = 31
+SS_NOPREFIX = 128
+SS_NOTIFY = 256
+SS_CENTERIMAGE = 512
+SS_RIGHTJUST = 1024
+SS_REALSIZEIMAGE = 2048
+SS_SUNKEN = 4096
+SS_ENDELLIPSIS = 16384
+SS_PATHELLIPSIS = 32768
+SS_WORDELLIPSIS = 49152
+SS_ELLIPSISMASK = 49152
+STM_SETICON = 368
+STM_GETICON = 369
+STM_SETIMAGE = 370
+STM_GETIMAGE = 371
+STN_CLICKED = 0
+STN_DBLCLK = 1
+STN_ENABLE = 2
+STN_DISABLE = 3
+STM_MSGMAX = 372
+DWL_MSGRESULT = 0
+DWL_DLGPROC = 4
+DWL_USER = 8
+DDL_READWRITE = 0
+DDL_READONLY = 1
+DDL_HIDDEN = 2
+DDL_SYSTEM = 4
+DDL_DIRECTORY = 16
+DDL_ARCHIVE = 32
+DDL_POSTMSGS = 8192
+DDL_DRIVES = 16384
+DDL_EXCLUSIVE = 32768
+
+#from winuser.h line 153
+RT_CURSOR = 1
+RT_BITMAP = 2
+RT_ICON = 3
+RT_MENU = 4
+RT_DIALOG = 5
+RT_STRING = 6
+RT_FONTDIR = 7
+RT_FONT = 8
+RT_ACCELERATOR = 9
+RT_RCDATA = 10
+RT_MESSAGETABLE = 11
+DIFFERENCE = 11
+RT_GROUP_CURSOR = (RT_CURSOR + DIFFERENCE)
+RT_GROUP_ICON = (RT_ICON + DIFFERENCE)
+RT_VERSION = 16
+RT_DLGINCLUDE = 17
+RT_PLUGPLAY = 19
+RT_VXD = 20
+RT_ANICURSOR = 21
+RT_ANIICON = 22
+RT_HTML = 23
+# from winuser.h line 218
+SB_HORZ = 0
+SB_VERT = 1
+SB_CTL = 2
+SB_BOTH = 3
+SB_LINEUP = 0
+SB_LINELEFT = 0
+SB_LINEDOWN = 1
+SB_LINERIGHT = 1
+SB_PAGEUP = 2
+SB_PAGELEFT = 2
+SB_PAGEDOWN = 3
+SB_PAGERIGHT = 3
+SB_THUMBPOSITION = 4
+SB_THUMBTRACK = 5
+SB_TOP = 6
+SB_LEFT = 6
+SB_BOTTOM = 7
+SB_RIGHT = 7
+SB_ENDSCROLL = 8
+SW_HIDE = 0
+SW_SHOWNORMAL = 1
+SW_NORMAL = 1
+SW_SHOWMINIMIZED = 2
+SW_SHOWMAXIMIZED = 3
+SW_MAXIMIZE = 3
+SW_SHOWNOACTIVATE = 4
+SW_SHOW = 5
+SW_MINIMIZE = 6
+SW_SHOWMINNOACTIVE = 7
+SW_SHOWNA = 8
+SW_RESTORE = 9
+SW_SHOWDEFAULT = 10
+SW_FORCEMINIMIZE = 11
+SW_MAX = 11
+HIDE_WINDOW = 0
+SHOW_OPENWINDOW = 1
+SHOW_ICONWINDOW = 2
+SHOW_FULLSCREEN = 3
+SHOW_OPENNOACTIVATE = 4
+SW_PARENTCLOSING = 1
+SW_OTHERZOOM = 2
+SW_PARENTOPENING = 3
+SW_OTHERUNZOOM = 4
+AW_HOR_POSITIVE = 1
+AW_HOR_NEGATIVE = 2
+AW_VER_POSITIVE = 4
+AW_VER_NEGATIVE = 8
+AW_CENTER = 16
+AW_HIDE = 65536
+AW_ACTIVATE = 131072
+AW_SLIDE = 262144
+AW_BLEND = 524288
+KF_EXTENDED = 256
+KF_DLGMODE = 2048
+KF_MENUMODE = 4096
+KF_ALTDOWN = 8192
+KF_REPEAT = 16384
+KF_UP = 32768
+VK_LBUTTON = 1
+VK_RBUTTON = 2
+VK_CANCEL = 3
+VK_MBUTTON = 4
+VK_BACK = 8
+VK_TAB = 9
+VK_CLEAR = 12
+VK_RETURN = 13
+VK_SHIFT = 16
+VK_CONTROL = 17
+VK_MENU = 18
+VK_PAUSE = 19
+VK_CAPITAL = 20
+VK_KANA = 21
+VK_HANGEUL = 21 # old name - should be here for compatibility
+VK_HANGUL = 21
+VK_JUNJA = 23
+VK_FINAL = 24
+VK_HANJA = 25
+VK_KANJI = 25
+VK_ESCAPE = 27
+VK_CONVERT = 28
+VK_NONCONVERT = 29
+VK_ACCEPT = 30
+VK_MODECHANGE = 31
+VK_SPACE = 32
+VK_PRIOR = 33
+VK_NEXT = 34
+VK_END = 35
+VK_HOME = 36
+VK_LEFT = 37
+VK_UP = 38
+VK_RIGHT = 39
+VK_DOWN = 40
+VK_SELECT = 41
+VK_PRINT = 42
+VK_EXECUTE = 43
+VK_SNAPSHOT = 44
+VK_INSERT = 45
+VK_DELETE = 46
+VK_HELP = 47
+VK_LWIN = 91
+VK_RWIN = 92
+VK_APPS = 93
+VK_NUMPAD0 = 96
+VK_NUMPAD1 = 97
+VK_NUMPAD2 = 98
+VK_NUMPAD3 = 99
+VK_NUMPAD4 = 100
+VK_NUMPAD5 = 101
+VK_NUMPAD6 = 102
+VK_NUMPAD7 = 103
+VK_NUMPAD8 = 104
+VK_NUMPAD9 = 105
+VK_MULTIPLY = 106
+VK_ADD = 107
+VK_SEPARATOR = 108
+VK_SUBTRACT = 109
+VK_DECIMAL = 110
+VK_DIVIDE = 111
+VK_F1 = 112
+VK_F2 = 113
+VK_F3 = 114
+VK_F4 = 115
+VK_F5 = 116
+VK_F6 = 117
+VK_F7 = 118
+VK_F8 = 119
+VK_F9 = 120
+VK_F10 = 121
+VK_F11 = 122
+VK_F12 = 123
+VK_F13 = 124
+VK_F14 = 125
+VK_F15 = 126
+VK_F16 = 127
+VK_F17 = 128
+VK_F18 = 129
+VK_F19 = 130
+VK_F20 = 131
+VK_F21 = 132
+VK_F22 = 133
+VK_F23 = 134
+VK_F24 = 135
+VK_NUMLOCK = 144
+VK_SCROLL = 145
+VK_LSHIFT = 160
+VK_RSHIFT = 161
+VK_LCONTROL = 162
+VK_RCONTROL = 163
+VK_LMENU = 164
+VK_RMENU = 165
+VK_PROCESSKEY = 229
+VK_ATTN = 246
+VK_CRSEL = 247
+VK_EXSEL = 248
+VK_EREOF = 249
+VK_PLAY = 250
+VK_ZOOM = 251
+VK_NONAME = 252
+VK_PA1 = 253
+VK_OEM_CLEAR = 254
+# multi-media related "keys"
+MOUSEEVENTF_XDOWN = 0x0080
+MOUSEEVENTF_XUP = 0x0100
+MOUSEEVENTF_WHEEL = 0x0800
+VK_XBUTTON1 = 0x05
+VK_XBUTTON2 = 0x06
+VK_VOLUME_MUTE = 0xAD
+VK_VOLUME_DOWN = 0xAE
+VK_VOLUME_UP = 0xAF
+VK_MEDIA_NEXT_TRACK = 0xB0
+VK_MEDIA_PREV_TRACK = 0xB1
+VK_MEDIA_PLAY_PAUSE = 0xB3
+VK_LAUNCH_MAIL = 0xB4
+VK_LAUNCH_MEDIA_SELECT = 0xB5
+VK_LAUNCH_APP1 = 0xB6
+VK_LAUNCH_APP2 = 0xB
+VK_BROWSER_BACK = 0xA6
+VK_BROWSER_FORWARD = 0xA7
+VK_BROWSER_REFRESH = 0xA8
+VK_BROWSER_STOP = 0xA9
+VK_BROWSER_SEARCH = 0xAA
+VK_BROWSER_FAVORITES = 0xAB
+VK_BROWSER_HOME = 0xAC
+WH_MIN = (-1)
+WH_MSGFILTER = (-1)
+WH_JOURNALRECORD = 0
+WH_JOURNALPLAYBACK = 1
+WH_KEYBOARD = 2
+WH_GETMESSAGE = 3
+WH_CALLWNDPROC = 4
+WH_CBT = 5
+WH_SYSMSGFILTER = 6
+WH_MOUSE = 7
+WH_HARDWARE = 8
+WH_DEBUG = 9
+WH_SHELL = 10
+WH_FOREGROUNDIDLE = 11
+WH_CALLWNDPROCRET = 12
+WH_KEYBOARD_LL = 13
+WH_MOUSE_LL = 14
+WH_MAX = 14
+WH_MINHOOK = WH_MIN
+WH_MAXHOOK = WH_MAX
+HC_ACTION = 0
+HC_GETNEXT = 1
+HC_SKIP = 2
+HC_NOREMOVE = 3
+HC_NOREM = HC_NOREMOVE
+HC_SYSMODALON = 4
+HC_SYSMODALOFF = 5
+HCBT_MOVESIZE = 0
+HCBT_MINMAX = 1
+HCBT_QS = 2
+HCBT_CREATEWND = 3
+HCBT_DESTROYWND = 4
+HCBT_ACTIVATE = 5
+HCBT_CLICKSKIPPED = 6
+HCBT_KEYSKIPPED = 7
+HCBT_SYSCOMMAND = 8
+HCBT_SETFOCUS = 9
+MSGF_DIALOGBOX = 0
+MSGF_MESSAGEBOX = 1
+MSGF_MENU = 2
+#MSGF_MOVE = 3
+#MSGF_SIZE = 4
+MSGF_SCROLLBAR = 5
+MSGF_NEXTWINDOW = 6
+#MSGF_MAINLOOP = 8
+MSGF_MAX = 8
+MSGF_USER = 4096
+HSHELL_WINDOWCREATED = 1
+HSHELL_WINDOWDESTROYED = 2
+HSHELL_ACTIVATESHELLWINDOW = 3
+HSHELL_WINDOWACTIVATED = 4
+HSHELL_GETMINRECT = 5
+HSHELL_REDRAW = 6
+HSHELL_TASKMAN = 7
+HSHELL_LANGUAGE = 8
+HSHELL_ACCESSIBILITYSTATE = 11
+ACCESS_STICKYKEYS = 1
+ACCESS_FILTERKEYS = 2
+ACCESS_MOUSEKEYS = 3
+# winuser.h line 624
+LLKHF_EXTENDED = 1
+LLKHF_INJECTED = 16
+LLKHF_ALTDOWN = 32
+LLKHF_UP = 128
+LLMHF_INJECTED = 1
+# line 692
+HKL_PREV = 0
+HKL_NEXT = 1
+KLF_ACTIVATE = 1
+KLF_SUBSTITUTE_OK = 2
+KLF_UNLOADPREVIOUS = 4
+KLF_REORDER = 8
+KLF_REPLACELANG = 16
+KLF_NOTELLSHELL = 128
+KLF_SETFORPROCESS = 256
+KL_NAMELENGTH = 9
+DESKTOP_READOBJECTS = 1
+DESKTOP_CREATEWINDOW = 2
+DESKTOP_CREATEMENU = 4
+DESKTOP_HOOKCONTROL = 8
+DESKTOP_JOURNALRECORD = 16
+DESKTOP_JOURNALPLAYBACK = 32
+DESKTOP_ENUMERATE = 64
+DESKTOP_WRITEOBJECTS = 128
+DESKTOP_SWITCHDESKTOP = 256
+DF_ALLOWOTHERACCOUNTHOOK = 1
+WINSTA_ENUMDESKTOPS = 1
+WINSTA_READATTRIBUTES = 2
+WINSTA_ACCESSCLIPBOARD = 4
+WINSTA_CREATEDESKTOP = 8
+WINSTA_WRITEATTRIBUTES = 16
+WINSTA_ACCESSGLOBALATOMS = 32
+WINSTA_EXITWINDOWS = 64
+WINSTA_ENUMERATE = 256
+WINSTA_READSCREEN = 512
+WSF_VISIBLE = 1
+UOI_FLAGS = 1
+UOI_NAME = 2
+UOI_TYPE = 3
+UOI_USER_SID = 4
+GWL_WNDPROC = (-4)
+GWL_HINSTANCE = (-6)
+GWL_HWNDPARENT = (-8)
+GWL_STYLE = (-16)
+GWL_EXSTYLE = (-20)
+GWL_USERDATA = (-21)
+GWL_ID = (-12)
+GCL_MENUNAME = (-8)
+GCL_HBRBACKGROUND = (-10)
+GCL_HCURSOR = (-12)
+GCL_HICON = (-14)
+GCL_HMODULE = (-16)
+GCL_CBWNDEXTRA = (-18)
+GCL_CBCLSEXTRA = (-20)
+GCL_WNDPROC = (-24)
+GCL_STYLE = (-26)
+GCW_ATOM = (-32)
+GCL_HICONSM = (-34)
+# line 1291
+WM_NULL = 0
+WM_CREATE = 1
+WM_DESTROY = 2
+WM_MOVE = 3
+WM_SIZE = 5
+WM_ACTIVATE = 6
+WA_INACTIVE = 0
+WA_ACTIVE = 1
+WA_CLICKACTIVE = 2
+WM_SETFOCUS = 7
+WM_KILLFOCUS = 8
+WM_ENABLE = 10
+WM_SETREDRAW = 11
+WM_SETTEXT = 12
+WM_GETTEXT = 13
+WM_GETTEXTLENGTH = 14
+WM_PAINT = 15
+WM_CLOSE = 16
+WM_QUERYENDSESSION = 17
+WM_QUIT = 18
+WM_QUERYOPEN = 19
+WM_ERASEBKGND = 20
+WM_SYSCOLORCHANGE = 21
+WM_ENDSESSION = 22
+WM_SHOWWINDOW = 24
+WM_WININICHANGE = 26
+WM_SETTINGCHANGE = WM_WININICHANGE
+WM_DEVMODECHANGE = 27
+WM_ACTIVATEAPP = 28
+WM_FONTCHANGE = 29
+WM_TIMECHANGE = 30
+WM_CANCELMODE = 31
+WM_SETCURSOR = 32
+WM_MOUSEACTIVATE = 33
+WM_CHILDACTIVATE = 34
+WM_QUEUESYNC = 35
+WM_GETMINMAXINFO = 36
+WM_PAINTICON = 38
+WM_ICONERASEBKGND = 39
+WM_NEXTDLGCTL = 40
+WM_SPOOLERSTATUS = 42
+WM_DRAWITEM = 43
+WM_MEASUREITEM = 44
+WM_DELETEITEM = 45
+WM_VKEYTOITEM = 46
+WM_CHARTOITEM = 47
+WM_SETFONT = 48
+WM_GETFONT = 49
+WM_SETHOTKEY = 50
+WM_GETHOTKEY = 51
+WM_QUERYDRAGICON = 55
+WM_COMPAREITEM = 57
+WM_GETOBJECT = 61
+WM_COMPACTING = 65
+WM_COMMNOTIFY = 68
+WM_WINDOWPOSCHANGING = 70
+WM_WINDOWPOSCHANGED = 71
+WM_POWER = 72
+WM_COPYGLOBALDATA = 73
+PWR_OK = 1
+PWR_FAIL = (-1)
+PWR_SUSPENDREQUEST = 1
+PWR_SUSPENDRESUME = 2
+PWR_CRITICALRESUME = 3
+WM_COPYDATA = 74
+WM_CANCELJOURNAL = 75
+WM_NOTIFY = 78
+WM_INPUTLANGCHANGEREQUEST = 80
+WM_INPUTLANGCHANGE = 81
+WM_TCARD = 82
+WM_HELP = 83
+WM_USERCHANGED = 84
+WM_NOTIFYFORMAT = 85
+NFR_ANSI = 1
+NFR_UNICODE = 2
+NF_QUERY = 3
+NF_REQUERY = 4
+WM_CONTEXTMENU = 123
+WM_STYLECHANGING = 124
+WM_STYLECHANGED = 125
+WM_DISPLAYCHANGE = 126
+WM_GETICON = 127
+WM_SETICON = 128
+WM_NCCREATE = 129
+WM_NCDESTROY = 130
+WM_NCCALCSIZE = 131
+WM_NCHITTEST = 132
+WM_NCPAINT = 133
+WM_NCACTIVATE = 134
+WM_GETDLGCODE = 135
+WM_SYNCPAINT = 136
+WM_NCMOUSEMOVE = 160
+WM_NCLBUTTONDOWN = 161
+WM_NCLBUTTONUP = 162
+WM_NCLBUTTONDBLCLK = 163
+WM_NCRBUTTONDOWN = 164
+WM_NCRBUTTONUP = 165
+WM_NCRBUTTONDBLCLK = 166
+WM_NCMBUTTONDOWN = 167
+WM_NCMBUTTONUP = 168
+WM_NCMBUTTONDBLCLK = 169
+WM_KEYFIRST = 256
+WM_KEYDOWN = 256
+WM_KEYUP = 257
+WM_CHAR = 258
+WM_DEADCHAR = 259
+WM_SYSKEYDOWN = 260
+WM_SYSKEYUP = 261
+WM_SYSCHAR = 262
+WM_SYSDEADCHAR = 263
+WM_KEYLAST = 264
+WM_IME_STARTCOMPOSITION = 269
+WM_IME_ENDCOMPOSITION = 270
+WM_IME_COMPOSITION = 271
+WM_IME_KEYLAST = 271
+WM_INITDIALOG = 272
+WM_COMMAND = 273
+WM_SYSCOMMAND = 274
+WM_TIMER = 275
+WM_HSCROLL = 276
+WM_VSCROLL = 277
+WM_INITMENU = 278
+WM_INITMENUPOPUP = 279
+WM_MENUSELECT = 287
+WM_MENUCHAR = 288
+WM_ENTERIDLE = 289
+WM_MENURBUTTONUP = 290
+WM_MENUDRAG = 291
+WM_MENUGETOBJECT = 292
+WM_UNINITMENUPOPUP = 293
+WM_MENUCOMMAND = 294
+WM_CTLCOLORMSGBOX = 306
+WM_CTLCOLOREDIT = 307
+WM_CTLCOLORLISTBOX = 308
+WM_CTLCOLORBTN = 309
+WM_CTLCOLORDLG = 310
+WM_CTLCOLORSCROLLBAR = 311
+WM_CTLCOLORSTATIC = 312
+WM_MOUSEFIRST = 512
+WM_MOUSEMOVE = 512
+WM_LBUTTONDOWN = 513
+WM_LBUTTONUP = 514
+WM_LBUTTONDBLCLK = 515
+WM_RBUTTONDOWN = 516
+WM_RBUTTONUP = 517
+WM_RBUTTONDBLCLK = 518
+WM_MBUTTONDOWN = 519
+WM_MBUTTONUP = 520
+WM_MBUTTONDBLCLK = 521
+WM_XBUTTONDOWN = 523
+WM_XBUTTONUP = 524
+WM_XBUTTONBDLCLK = 525
+WM_MOUSEWHEEL = 522
+WM_MOUSELAST = 522
+WHEEL_DELTA = 120 # Value for rolling one detent
+WHEEL_PAGESCROLL = -1 # Scroll one page
+WM_PARENTNOTIFY = 528
+MENULOOP_WINDOW = 0
+MENULOOP_POPUP = 1
+WM_ENTERMENULOOP = 529
+WM_EXITMENULOOP = 530
+WM_NEXTMENU = 531
+WM_SIZING = 532
+WM_CAPTURECHANGED = 533
+WM_MOVING = 534
+WM_POWERBROADCAST = 536
+PBT_APMQUERYSUSPEND = 0
+PBT_APMQUERYSTANDBY = 1
+PBT_APMQUERYSUSPENDFAILED = 2
+PBT_APMQUERYSTANDBYFAILED = 3
+PBT_APMSUSPEND = 4
+PBT_APMSTANDBY = 5
+PBT_APMRESUMECRITICAL = 6
+PBT_APMRESUMESUSPEND = 7
+PBT_APMRESUMESTANDBY = 8
+PBTF_APMRESUMEFROMFAILURE = 1
+PBT_APMBATTERYLOW = 9
+PBT_APMPOWERSTATUSCHANGE = 10
+PBT_APMOEMEVENT = 11
+PBT_APMRESUMEAUTOMATIC = 18
+WM_DEVICECHANGE = 537
+WM_MDICREATE = 544
+WM_MDIDESTROY = 545
+WM_MDIACTIVATE = 546
+WM_MDIRESTORE = 547
+WM_MDINEXT = 548
+WM_MDIMAXIMIZE = 549
+WM_MDITILE = 550
+WM_MDICASCADE = 551
+WM_MDIICONARRANGE = 552
+WM_MDIGETACTIVE = 553
+WM_MDISETMENU = 560
+WM_ENTERSIZEMOVE = 561
+WM_EXITSIZEMOVE = 562
+WM_DROPFILES = 563
+WM_MDIREFRESHMENU = 564
+WM_IME_SETCONTEXT = 641
+WM_IME_NOTIFY = 642
+WM_IME_CONTROL = 643
+WM_IME_COMPOSITIONFULL = 644
+WM_IME_SELECT = 645
+WM_IME_CHAR = 646
+WM_IME_REQUEST = 648
+WM_IME_KEYDOWN = 656
+WM_IME_KEYUP = 657
+WM_MOUSEHOVER = 673
+WM_MOUSELEAVE = 675
+WM_CUT = 768
+WM_COPY = 769
+WM_PASTE = 770
+WM_CLEAR = 771
+WM_UNDO = 772
+WM_RENDERFORMAT = 773
+WM_RENDERALLFORMATS = 774
+WM_DESTROYCLIPBOARD = 775
+WM_DRAWCLIPBOARD = 776
+WM_PAINTCLIPBOARD = 777
+WM_VSCROLLCLIPBOARD = 778
+WM_SIZECLIPBOARD = 779
+WM_ASKCBFORMATNAME = 780
+WM_CHANGECBCHAIN = 781
+WM_HSCROLLCLIPBOARD = 782
+WM_QUERYNEWPALETTE = 783
+WM_PALETTEISCHANGING = 784
+WM_PALETTECHANGED = 785
+WM_HOTKEY = 786
+WM_PRINT = 791
+WM_PRINTCLIENT = 792
+WM_HANDHELDFIRST = 856
+WM_HANDHELDLAST = 863
+WM_AFXFIRST = 864
+WM_AFXLAST = 895
+WM_PENWINFIRST = 896
+WM_PENWINLAST = 911
+WM_APP = 32768
+WM_INPUT = 0x00FF
+WMSZ_LEFT = 1
+WMSZ_RIGHT = 2
+WMSZ_TOP = 3
+WMSZ_TOPLEFT = 4
+WMSZ_TOPRIGHT = 5
+WMSZ_BOTTOM = 6
+WMSZ_BOTTOMLEFT = 7
+WMSZ_BOTTOMRIGHT = 8
+#ST_BEGINSWP = 0
+#ST_ENDSWP = 1
+HTERROR = (-2)
+HTTRANSPARENT = (-1)
+HTNOWHERE = 0
+HTCLIENT = 1
+HTCAPTION = 2
+HTSYSMENU = 3
+HTGROWBOX = 4
+HTSIZE = HTGROWBOX
+HTMENU = 5
+HTHSCROLL = 6
+HTVSCROLL = 7
+HTMINBUTTON = 8
+HTMAXBUTTON = 9
+HTLEFT = 10
+HTRIGHT = 11
+HTTOP = 12
+HTTOPLEFT = 13
+HTTOPRIGHT = 14
+HTBOTTOM = 15
+HTBOTTOMLEFT = 16
+HTBOTTOMRIGHT = 17
+HTBORDER = 18
+HTREDUCE = HTMINBUTTON
+HTZOOM = HTMAXBUTTON
+HTSIZEFIRST = HTLEFT
+HTSIZELAST = HTBOTTOMRIGHT
+HTOBJECT = 19
+HTCLOSE = 20
+HTHELP = 21
+SMTO_NORMAL = 0
+SMTO_BLOCK = 1
+SMTO_ABORTIFHUNG = 2
+SMTO_NOTIMEOUTIFNOTHUNG = 8
+MA_ACTIVATE = 1
+MA_ACTIVATEANDEAT = 2
+MA_NOACTIVATE = 3
+MA_NOACTIVATEANDEAT = 4
+ICON_SMALL = 0
+ICON_BIG = 1
+SIZE_RESTORED = 0
+SIZE_MINIMIZED = 1
+SIZE_MAXIMIZED = 2
+SIZE_MAXSHOW = 3
+SIZE_MAXHIDE = 4
+SIZENORMAL = SIZE_RESTORED
+SIZEICONIC = SIZE_MINIMIZED
+SIZEFULLSCREEN = SIZE_MAXIMIZED
+SIZEZOOMSHOW = SIZE_MAXSHOW
+SIZEZOOMHIDE = SIZE_MAXHIDE
+WVR_ALIGNTOP = 16
+WVR_ALIGNLEFT = 32
+WVR_ALIGNBOTTOM = 64
+WVR_ALIGNRIGHT = 128
+WVR_HREDRAW = 256
+WVR_VREDRAW = 512
+WVR_REDRAW = (WVR_HREDRAW | WVR_VREDRAW)
+WVR_VALIDRECTS = 1024
+MK_LBUTTON = 1
+MK_RBUTTON = 2
+MK_SHIFT = 4
+MK_CONTROL = 8
+MK_MBUTTON = 16
+MK_XBUTTON1 = 32
+MK_XBUTTON2 = 64
+TME_HOVER = 1
+TME_LEAVE = 2
+TME_QUERY = 1073741824
+TME_CANCEL = -2147483648
+HOVER_DEFAULT = -1
+WS_OVERLAPPED = 0
+WS_POPUP = -2147483648
+WS_CHILD = 1073741824
+WS_MINIMIZE = 536870912
+WS_VISIBLE = 268435456
+WS_DISABLED = 134217728
+WS_CLIPSIBLINGS = 67108864
+WS_CLIPCHILDREN = 33554432
+WS_MAXIMIZE = 16777216
+WS_CAPTION = 12582912
+WS_BORDER = 8388608
+WS_DLGFRAME = 4194304
+WS_VSCROLL = 2097152
+WS_HSCROLL = 1048576
+WS_SYSMENU = 524288
+WS_THICKFRAME = 262144
+WS_GROUP = 131072
+WS_TABSTOP = 65536
+WS_MINIMIZEBOX = 131072
+WS_MAXIMIZEBOX = 65536
+WS_TILED = WS_OVERLAPPED
+WS_ICONIC = WS_MINIMIZE
+WS_SIZEBOX = WS_THICKFRAME
+WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | \
+ WS_CAPTION | \
+ WS_SYSMENU | \
+ WS_THICKFRAME | \
+ WS_MINIMIZEBOX | \
+ WS_MAXIMIZEBOX)
+WS_POPUPWINDOW = (WS_POPUP | \
+ WS_BORDER | \
+ WS_SYSMENU)
+WS_CHILDWINDOW = (WS_CHILD)
+WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW
+WS_EX_DLGMODALFRAME = 1
+WS_EX_NOPARENTNOTIFY = 4
+WS_EX_TOPMOST = 8
+WS_EX_ACCEPTFILES = 16
+WS_EX_TRANSPARENT = 32
+WS_EX_MDICHILD = 64
+WS_EX_TOOLWINDOW = 128
+WS_EX_WINDOWEDGE = 256
+WS_EX_CLIENTEDGE = 512
+WS_EX_CONTEXTHELP = 1024
+WS_EX_RIGHT = 4096
+WS_EX_LEFT = 0
+WS_EX_RTLREADING = 8192
+WS_EX_LTRREADING = 0
+WS_EX_LEFTSCROLLBAR = 16384
+WS_EX_RIGHTSCROLLBAR = 0
+WS_EX_CONTROLPARENT = 65536
+WS_EX_STATICEDGE = 131072
+WS_EX_APPWINDOW = 262144
+WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE)
+WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST)
+WS_EX_LAYERED = 0x00080000
+WS_EX_NOINHERITLAYOUT = 0x00100000
+WS_EX_LAYOUTRTL = 0x00400000
+WS_EX_COMPOSITED = 0x02000000
+WS_EX_NOACTIVATE = 0x08000000
+
+CS_VREDRAW = 1
+CS_HREDRAW = 2
+#CS_KEYCVTWINDOW = 0x0004
+CS_DBLCLKS = 8
+CS_OWNDC = 32
+CS_CLASSDC = 64
+CS_PARENTDC = 128
+#CS_NOKEYCVT = 0x0100
+CS_NOCLOSE = 512
+CS_SAVEBITS = 2048
+CS_BYTEALIGNCLIENT = 4096
+CS_BYTEALIGNWINDOW = 8192
+CS_GLOBALCLASS = 16384
+CS_IME = 65536
+PRF_CHECKVISIBLE = 1
+PRF_NONCLIENT = 2
+PRF_CLIENT = 4
+PRF_ERASEBKGND = 8
+PRF_CHILDREN = 16
+PRF_OWNED = 32
+BDR_RAISEDOUTER = 1
+BDR_SUNKENOUTER = 2
+BDR_RAISEDINNER = 4
+BDR_SUNKENINNER = 8
+BDR_OUTER = 3
+BDR_INNER = 12
+#BDR_RAISED = 0x0005
+#BDR_SUNKEN = 0x000a
+EDGE_RAISED = (BDR_RAISEDOUTER | BDR_RAISEDINNER)
+EDGE_SUNKEN = (BDR_SUNKENOUTER | BDR_SUNKENINNER)
+EDGE_ETCHED = (BDR_SUNKENOUTER | BDR_RAISEDINNER)
+EDGE_BUMP = (BDR_RAISEDOUTER | BDR_SUNKENINNER)
+
+# winuser.h line 2879
+ISMEX_NOSEND = 0
+ISMEX_SEND = 1
+ISMEX_NOTIFY = 2
+ISMEX_CALLBACK = 4
+ISMEX_REPLIED = 8
+CW_USEDEFAULT = -2147483648
+FLASHW_STOP = 0
+FLASHW_CAPTION = 1
+FLASHW_TRAY = 2
+FLASHW_ALL = (FLASHW_CAPTION | FLASHW_TRAY)
+FLASHW_TIMER = 4
+FLASHW_TIMERNOFG = 12
+
+# winuser.h line 7963
+DS_ABSALIGN = 1
+DS_SYSMODAL = 2
+DS_LOCALEDIT = 32
+DS_SETFONT = 64
+DS_MODALFRAME = 128
+DS_NOIDLEMSG = 256
+DS_SETFOREGROUND = 512
+DS_3DLOOK = 4
+DS_FIXEDSYS = 8
+DS_NOFAILCREATE = 16
+DS_CONTROL = 1024
+DS_CENTER = 2048
+DS_CENTERMOUSE = 4096
+DS_CONTEXTHELP = 8192
+DM_GETDEFID = (WM_USER+0)
+DM_SETDEFID = (WM_USER+1)
+DM_REPOSITION = (WM_USER+2)
+#PSM_PAGEINFO = (WM_USER+100)
+#PSM_SHEETINFO = (WM_USER+101)
+#PSI_SETACTIVE = 0x0001
+#PSI_KILLACTIVE = 0x0002
+#PSI_APPLY = 0x0003
+#PSI_RESET = 0x0004
+#PSI_HASHELP = 0x0005
+#PSI_HELP = 0x0006
+#PSI_CHANGED = 0x0001
+#PSI_GUISTART = 0x0002
+#PSI_REBOOT = 0x0003
+#PSI_GETSIBLINGS = 0x0004
+DC_HASDEFID = 21323
+DLGC_WANTARROWS = 1
+DLGC_WANTTAB = 2
+DLGC_WANTALLKEYS = 4
+DLGC_WANTMESSAGE = 4
+DLGC_HASSETSEL = 8
+DLGC_DEFPUSHBUTTON = 16
+DLGC_UNDEFPUSHBUTTON = 32
+DLGC_RADIOBUTTON = 64
+DLGC_WANTCHARS = 128
+DLGC_STATIC = 256
+DLGC_BUTTON = 8192
+LB_CTLCODE = 0
+LB_OKAY = 0
+LB_ERR = (-1)
+LB_ERRSPACE = (-2)
+LBN_ERRSPACE = (-2)
+LBN_SELCHANGE = 1
+LBN_DBLCLK = 2
+LBN_SELCANCEL = 3
+LBN_SETFOCUS = 4
+LBN_KILLFOCUS = 5
+LB_ADDSTRING = 384
+LB_INSERTSTRING = 385
+LB_DELETESTRING = 386
+LB_SELITEMRANGEEX = 387
+LB_RESETCONTENT = 388
+LB_SETSEL = 389
+LB_SETCURSEL = 390
+LB_GETSEL = 391
+LB_GETCURSEL = 392
+LB_GETTEXT = 393
+LB_GETTEXTLEN = 394
+LB_GETCOUNT = 395
+LB_SELECTSTRING = 396
+LB_DIR = 397
+LB_GETTOPINDEX = 398
+LB_FINDSTRING = 399
+LB_GETSELCOUNT = 400
+LB_GETSELITEMS = 401
+LB_SETTABSTOPS = 402
+LB_GETHORIZONTALEXTENT = 403
+LB_SETHORIZONTALEXTENT = 404
+LB_SETCOLUMNWIDTH = 405
+LB_ADDFILE = 406
+LB_SETTOPINDEX = 407
+LB_GETITEMRECT = 408
+LB_GETITEMDATA = 409
+LB_SETITEMDATA = 410
+LB_SELITEMRANGE = 411
+LB_SETANCHORINDEX = 412
+LB_GETANCHORINDEX = 413
+LB_SETCARETINDEX = 414
+LB_GETCARETINDEX = 415
+LB_SETITEMHEIGHT = 416
+LB_GETITEMHEIGHT = 417
+LB_FINDSTRINGEXACT = 418
+LB_SETLOCALE = 421
+LB_GETLOCALE = 422
+LB_SETCOUNT = 423
+LB_INITSTORAGE = 424
+LB_ITEMFROMPOINT = 425
+LB_MSGMAX = 432
+LBS_NOTIFY = 1
+LBS_SORT = 2
+LBS_NOREDRAW = 4
+LBS_MULTIPLESEL = 8
+LBS_OWNERDRAWFIXED = 16
+LBS_OWNERDRAWVARIABLE = 32
+LBS_HASSTRINGS = 64
+LBS_USETABSTOPS = 128
+LBS_NOINTEGRALHEIGHT = 256
+LBS_MULTICOLUMN = 512
+LBS_WANTKEYBOARDINPUT = 1024
+LBS_EXTENDEDSEL = 2048
+LBS_DISABLENOSCROLL = 4096
+LBS_NODATA = 8192
+LBS_NOSEL = 16384
+LBS_STANDARD = (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)
+CB_OKAY = 0
+CB_ERR = (-1)
+CB_ERRSPACE = (-2)
+CBN_ERRSPACE = (-1)
+CBN_SELCHANGE = 1
+CBN_DBLCLK = 2
+CBN_SETFOCUS = 3
+CBN_KILLFOCUS = 4
+CBN_EDITCHANGE = 5
+CBN_EDITUPDATE = 6
+CBN_DROPDOWN = 7
+CBN_CLOSEUP = 8
+CBN_SELENDOK = 9
+CBN_SELENDCANCEL = 10
+CBS_SIMPLE = 1
+CBS_DROPDOWN = 2
+CBS_DROPDOWNLIST = 3
+CBS_OWNERDRAWFIXED = 16
+CBS_OWNERDRAWVARIABLE = 32
+CBS_AUTOHSCROLL = 64
+CBS_OEMCONVERT = 128
+CBS_SORT = 256
+CBS_HASSTRINGS = 512
+CBS_NOINTEGRALHEIGHT = 1024
+CBS_DISABLENOSCROLL = 2048
+CBS_UPPERCASE = 8192
+CBS_LOWERCASE = 16384
+CB_GETEDITSEL = 320
+CB_LIMITTEXT = 321
+CB_SETEDITSEL = 322
+CB_ADDSTRING = 323
+CB_DELETESTRING = 324
+CB_DIR = 325
+CB_GETCOUNT = 326
+CB_GETCURSEL = 327
+CB_GETLBTEXT = 328
+CB_GETLBTEXTLEN = 329
+CB_INSERTSTRING = 330
+CB_RESETCONTENT = 331
+CB_FINDSTRING = 332
+CB_SELECTSTRING = 333
+CB_SETCURSEL = 334
+CB_SHOWDROPDOWN = 335
+CB_GETITEMDATA = 336
+CB_SETITEMDATA = 337
+CB_GETDROPPEDCONTROLRECT = 338
+CB_SETITEMHEIGHT = 339
+CB_GETITEMHEIGHT = 340
+CB_SETEXTENDEDUI = 341
+CB_GETEXTENDEDUI = 342
+CB_GETDROPPEDSTATE = 343
+CB_FINDSTRINGEXACT = 344
+CB_SETLOCALE = 345
+CB_GETLOCALE = 346
+CB_GETTOPINDEX = 347
+CB_SETTOPINDEX = 348
+CB_GETHORIZONTALEXTENT = 349
+CB_SETHORIZONTALEXTENT = 350
+CB_GETDROPPEDWIDTH = 351
+CB_SETDROPPEDWIDTH = 352
+CB_INITSTORAGE = 353
+CB_MSGMAX = 354
+SBS_HORZ = 0
+SBS_VERT = 1
+SBS_TOPALIGN = 2
+SBS_LEFTALIGN = 2
+SBS_BOTTOMALIGN = 4
+SBS_RIGHTALIGN = 4
+SBS_SIZEBOXTOPLEFTALIGN = 2
+SBS_SIZEBOXBOTTOMRIGHTALIGN = 4
+SBS_SIZEBOX = 8
+SBS_SIZEGRIP = 16
+SBM_SETPOS = 224
+SBM_GETPOS = 225
+SBM_SETRANGE = 226
+SBM_SETRANGEREDRAW = 230
+SBM_GETRANGE = 227
+SBM_ENABLE_ARROWS = 228
+SBM_SETSCROLLINFO = 233
+SBM_GETSCROLLINFO = 234
+SIF_RANGE = 1
+SIF_PAGE = 2
+SIF_POS = 4
+SIF_DISABLENOSCROLL = 8
+SIF_TRACKPOS = 16
+SIF_ALL = (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)
+MDIS_ALLCHILDSTYLES = 1
+MDITILE_VERTICAL = 0
+MDITILE_HORIZONTAL = 1
+MDITILE_SKIPDISABLED = 2
+
+IMC_GETCANDIDATEPOS = 7
+IMC_SETCANDIDATEPOS = 8
+IMC_GETCOMPOSITIONFONT = 9
+IMC_SETCOMPOSITIONFONT = 10
+IMC_GETCOMPOSITIONWINDOW = 11
+IMC_SETCOMPOSITIONWINDOW = 12
+IMC_GETSTATUSWINDOWPOS = 15
+IMC_SETSTATUSWINDOWPOS = 16
+IMC_CLOSESTATUSWINDOW = 33
+IMC_OPENSTATUSWINDOW = 34
+# Generated by h2py from \msvc20\include\winnt.h
+# hacked and split by mhammond.
+DELETE = (65536)
+READ_CONTROL = (131072)
+WRITE_DAC = (262144)
+WRITE_OWNER = (524288)
+SYNCHRONIZE = (1048576)
+STANDARD_RIGHTS_REQUIRED = (983040)
+STANDARD_RIGHTS_READ = (READ_CONTROL)
+STANDARD_RIGHTS_WRITE = (READ_CONTROL)
+STANDARD_RIGHTS_EXECUTE = (READ_CONTROL)
+STANDARD_RIGHTS_ALL = (2031616)
+SPECIFIC_RIGHTS_ALL = (65535)
+ACCESS_SYSTEM_SECURITY = (16777216)
+MAXIMUM_ALLOWED = (33554432)
+GENERIC_READ = (-2147483648)
+GENERIC_WRITE = (1073741824)
+GENERIC_EXECUTE = (536870912)
+GENERIC_ALL = (268435456)
+
+SERVICE_KERNEL_DRIVER = 1
+SERVICE_FILE_SYSTEM_DRIVER = 2
+SERVICE_ADAPTER = 4
+SERVICE_RECOGNIZER_DRIVER = 8
+SERVICE_DRIVER = (SERVICE_KERNEL_DRIVER | \
+ SERVICE_FILE_SYSTEM_DRIVER | \
+ SERVICE_RECOGNIZER_DRIVER)
+SERVICE_WIN32_OWN_PROCESS = 16
+SERVICE_WIN32_SHARE_PROCESS = 32
+SERVICE_WIN32 = (SERVICE_WIN32_OWN_PROCESS | \
+ SERVICE_WIN32_SHARE_PROCESS)
+SERVICE_INTERACTIVE_PROCESS = 256
+SERVICE_TYPE_ALL = (SERVICE_WIN32 | \
+ SERVICE_ADAPTER | \
+ SERVICE_DRIVER | \
+ SERVICE_INTERACTIVE_PROCESS)
+SERVICE_BOOT_START = 0
+SERVICE_SYSTEM_START = 1
+SERVICE_AUTO_START = 2
+SERVICE_DEMAND_START = 3
+SERVICE_DISABLED = 4
+SERVICE_ERROR_IGNORE = 0
+SERVICE_ERROR_NORMAL = 1
+SERVICE_ERROR_SEVERE = 2
+SERVICE_ERROR_CRITICAL = 3
+TAPE_ERASE_SHORT = 0
+TAPE_ERASE_LONG = 1
+TAPE_LOAD = 0
+TAPE_UNLOAD = 1
+TAPE_TENSION = 2
+TAPE_LOCK = 3
+TAPE_UNLOCK = 4
+TAPE_FORMAT = 5
+TAPE_SETMARKS = 0
+TAPE_FILEMARKS = 1
+TAPE_SHORT_FILEMARKS = 2
+TAPE_LONG_FILEMARKS = 3
+TAPE_ABSOLUTE_POSITION = 0
+TAPE_LOGICAL_POSITION = 1
+TAPE_PSEUDO_LOGICAL_POSITION = 2
+TAPE_REWIND = 0
+TAPE_ABSOLUTE_BLOCK = 1
+TAPE_LOGICAL_BLOCK = 2
+TAPE_PSEUDO_LOGICAL_BLOCK = 3
+TAPE_SPACE_END_OF_DATA = 4
+TAPE_SPACE_RELATIVE_BLOCKS = 5
+TAPE_SPACE_FILEMARKS = 6
+TAPE_SPACE_SEQUENTIAL_FMKS = 7
+TAPE_SPACE_SETMARKS = 8
+TAPE_SPACE_SEQUENTIAL_SMKS = 9
+TAPE_DRIVE_FIXED = 1
+TAPE_DRIVE_SELECT = 2
+TAPE_DRIVE_INITIATOR = 4
+TAPE_DRIVE_ERASE_SHORT = 16
+TAPE_DRIVE_ERASE_LONG = 32
+TAPE_DRIVE_ERASE_BOP_ONLY = 64
+TAPE_DRIVE_ERASE_IMMEDIATE = 128
+TAPE_DRIVE_TAPE_CAPACITY = 256
+TAPE_DRIVE_TAPE_REMAINING = 512
+TAPE_DRIVE_FIXED_BLOCK = 1024
+TAPE_DRIVE_VARIABLE_BLOCK = 2048
+TAPE_DRIVE_WRITE_PROTECT = 4096
+TAPE_DRIVE_EOT_WZ_SIZE = 8192
+TAPE_DRIVE_ECC = 65536
+TAPE_DRIVE_COMPRESSION = 131072
+TAPE_DRIVE_PADDING = 262144
+TAPE_DRIVE_REPORT_SMKS = 524288
+TAPE_DRIVE_GET_ABSOLUTE_BLK = 1048576
+TAPE_DRIVE_GET_LOGICAL_BLK = 2097152
+TAPE_DRIVE_SET_EOT_WZ_SIZE = 4194304
+TAPE_DRIVE_LOAD_UNLOAD = -2147483647
+TAPE_DRIVE_TENSION = -2147483646
+TAPE_DRIVE_LOCK_UNLOCK = -2147483644
+TAPE_DRIVE_REWIND_IMMEDIATE = -2147483640
+TAPE_DRIVE_SET_BLOCK_SIZE = -2147483632
+TAPE_DRIVE_LOAD_UNLD_IMMED = -2147483616
+TAPE_DRIVE_TENSION_IMMED = -2147483584
+TAPE_DRIVE_LOCK_UNLK_IMMED = -2147483520
+TAPE_DRIVE_SET_ECC = -2147483392
+TAPE_DRIVE_SET_COMPRESSION = -2147483136
+TAPE_DRIVE_SET_PADDING = -2147482624
+TAPE_DRIVE_SET_REPORT_SMKS = -2147481600
+TAPE_DRIVE_ABSOLUTE_BLK = -2147479552
+TAPE_DRIVE_ABS_BLK_IMMED = -2147475456
+TAPE_DRIVE_LOGICAL_BLK = -2147467264
+TAPE_DRIVE_LOG_BLK_IMMED = -2147450880
+TAPE_DRIVE_END_OF_DATA = -2147418112
+TAPE_DRIVE_RELATIVE_BLKS = -2147352576
+TAPE_DRIVE_FILEMARKS = -2147221504
+TAPE_DRIVE_SEQUENTIAL_FMKS = -2146959360
+TAPE_DRIVE_SETMARKS = -2146435072
+TAPE_DRIVE_SEQUENTIAL_SMKS = -2145386496
+TAPE_DRIVE_REVERSE_POSITION = -2143289344
+TAPE_DRIVE_SPACE_IMMEDIATE = -2139095040
+TAPE_DRIVE_WRITE_SETMARKS = -2130706432
+TAPE_DRIVE_WRITE_FILEMARKS = -2113929216
+TAPE_DRIVE_WRITE_SHORT_FMKS = -2080374784
+TAPE_DRIVE_WRITE_LONG_FMKS = -2013265920
+TAPE_DRIVE_WRITE_MARK_IMMED = -1879048192
+TAPE_DRIVE_FORMAT = -1610612736
+TAPE_DRIVE_FORMAT_IMMEDIATE = -1073741824
+TAPE_FIXED_PARTITIONS = 0
+TAPE_SELECT_PARTITIONS = 1
+TAPE_INITIATOR_PARTITIONS = 2
+# Generated by h2py from \msvc20\include\winnt.h
+# hacked and split by mhammond.
+
+APPLICATION_ERROR_MASK = 536870912
+ERROR_SEVERITY_SUCCESS = 0
+ERROR_SEVERITY_INFORMATIONAL = 1073741824
+ERROR_SEVERITY_WARNING = -2147483648
+ERROR_SEVERITY_ERROR = -1073741824
+MINCHAR = 128
+MAXCHAR = 127
+MINSHORT = 32768
+MAXSHORT = 32767
+MINLONG = -2147483648
+MAXLONG = 2147483647
+MAXBYTE = 255
+MAXWORD = 65535
+MAXDWORD = -1
+LANG_NEUTRAL = 0
+LANG_BULGARIAN = 2
+LANG_CHINESE = 4
+LANG_CROATIAN = 26
+LANG_CZECH = 5
+LANG_DANISH = 6
+LANG_DUTCH = 19
+LANG_ENGLISH = 9
+LANG_FINNISH = 11
+LANG_FRENCH = 12
+LANG_GERMAN = 7
+LANG_GREEK = 8
+LANG_HUNGARIAN = 14
+LANG_ICELANDIC = 15
+LANG_ITALIAN = 16
+LANG_JAPANESE = 17
+LANG_KOREAN = 18
+LANG_NORWEGIAN = 20
+LANG_POLISH = 21
+LANG_PORTUGUESE = 22
+LANG_ROMANIAN = 24
+LANG_RUSSIAN = 25
+LANG_SLOVAK = 27
+LANG_SLOVENIAN = 36
+LANG_SPANISH = 10
+LANG_SWEDISH = 29
+LANG_TURKISH = 31
+SUBLANG_NEUTRAL = 0
+SUBLANG_DEFAULT = 1
+SUBLANG_SYS_DEFAULT = 2
+SUBLANG_CHINESE_TRADITIONAL = 1
+SUBLANG_CHINESE_SIMPLIFIED = 2
+SUBLANG_CHINESE_HONGKONG = 3
+SUBLANG_CHINESE_SINGAPORE = 4
+SUBLANG_DUTCH = 1
+SUBLANG_DUTCH_BELGIAN = 2
+SUBLANG_ENGLISH_US = 1
+SUBLANG_ENGLISH_UK = 2
+SUBLANG_ENGLISH_AUS = 3
+SUBLANG_ENGLISH_CAN = 4
+SUBLANG_ENGLISH_NZ = 5
+SUBLANG_ENGLISH_EIRE = 6
+SUBLANG_FRENCH = 1
+SUBLANG_FRENCH_BELGIAN = 2
+SUBLANG_FRENCH_CANADIAN = 3
+SUBLANG_FRENCH_SWISS = 4
+SUBLANG_GERMAN = 1
+SUBLANG_GERMAN_SWISS = 2
+SUBLANG_GERMAN_AUSTRIAN = 3
+SUBLANG_ITALIAN = 1
+SUBLANG_ITALIAN_SWISS = 2
+SUBLANG_NORWEGIAN_BOKMAL = 1
+SUBLANG_NORWEGIAN_NYNORSK = 2
+SUBLANG_PORTUGUESE = 2
+SUBLANG_PORTUGUESE_BRAZILIAN = 1
+SUBLANG_SPANISH = 1
+SUBLANG_SPANISH_MEXICAN = 2
+SUBLANG_SPANISH_MODERN = 3
+SORT_DEFAULT = 0
+SORT_JAPANESE_XJIS = 0
+SORT_JAPANESE_UNICODE = 1
+SORT_CHINESE_BIG5 = 0
+SORT_CHINESE_UNICODE = 1
+SORT_KOREAN_KSC = 0
+SORT_KOREAN_UNICODE = 1
+def PRIMARYLANGID(lgid): return ((lgid) & 1023)
+
+def SUBLANGID(lgid): return ((lgid) >> 10)
+
+NLS_VALID_LOCALE_MASK = 1048575
+CONTEXT_PORTABLE_32BIT = 1048576
+CONTEXT_ALPHA = 131072
+CONTEXT_CONTROL = (CONTEXT_ALPHA | 1)
+CONTEXT_FLOATING_POINT = (CONTEXT_ALPHA | 2)
+CONTEXT_INTEGER = (CONTEXT_ALPHA | 4)
+CONTEXT_FULL = (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+SIZE_OF_80387_REGISTERS = 80
+CONTEXT_FULL = (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+CONTEXT_CONTROL = 1
+CONTEXT_FLOATING_POINT = 2
+CONTEXT_INTEGER = 4
+CONTEXT_FULL = (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+PROCESS_TERMINATE = (1)
+PROCESS_CREATE_THREAD = (2)
+PROCESS_VM_OPERATION = (8)
+PROCESS_VM_READ = (16)
+PROCESS_VM_WRITE = (32)
+PROCESS_DUP_HANDLE = (64)
+PROCESS_CREATE_PROCESS = (128)
+PROCESS_SET_QUOTA = (256)
+PROCESS_SET_INFORMATION = (512)
+PROCESS_QUERY_INFORMATION = (1024)
+PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 4095)
+THREAD_TERMINATE = (1)
+THREAD_SUSPEND_RESUME = (2)
+THREAD_GET_CONTEXT = (8)
+THREAD_SET_CONTEXT = (16)
+THREAD_SET_INFORMATION = (32)
+THREAD_QUERY_INFORMATION = (64)
+THREAD_SET_THREAD_TOKEN = (128)
+THREAD_IMPERSONATE = (256)
+THREAD_DIRECT_IMPERSONATION = (512)
+TLS_MINIMUM_AVAILABLE = 64
+EVENT_MODIFY_STATE = 2
+MUTANT_QUERY_STATE = 1
+SEMAPHORE_MODIFY_STATE = 2
+TIME_ZONE_ID_UNKNOWN = 0
+TIME_ZONE_ID_STANDARD = 1
+TIME_ZONE_ID_DAYLIGHT = 2
+PROCESSOR_INTEL_386 = 386
+PROCESSOR_INTEL_486 = 486
+PROCESSOR_INTEL_PENTIUM = 586
+PROCESSOR_INTEL_860 = 860
+PROCESSOR_MIPS_R2000 = 2000
+PROCESSOR_MIPS_R3000 = 3000
+PROCESSOR_MIPS_R4000 = 4000
+PROCESSOR_ALPHA_21064 = 21064
+PROCESSOR_PPC_601 = 601
+PROCESSOR_PPC_603 = 603
+PROCESSOR_PPC_604 = 604
+PROCESSOR_PPC_620 = 620
+SECTION_QUERY = 1
+SECTION_MAP_WRITE = 2
+SECTION_MAP_READ = 4
+SECTION_MAP_EXECUTE = 8
+SECTION_EXTEND_SIZE = 16
+PAGE_NOACCESS = 1
+PAGE_READONLY = 2
+PAGE_READWRITE = 4
+PAGE_WRITECOPY = 8
+PAGE_EXECUTE = 16
+PAGE_EXECUTE_READ = 32
+PAGE_EXECUTE_READWRITE = 64
+PAGE_EXECUTE_WRITECOPY = 128
+PAGE_GUARD = 256
+PAGE_NOCACHE = 512
+MEM_COMMIT = 4096
+MEM_RESERVE = 8192
+MEM_DECOMMIT = 16384
+MEM_RELEASE = 32768
+MEM_FREE = 65536
+MEM_PRIVATE = 131072
+MEM_MAPPED = 262144
+MEM_TOP_DOWN = 1048576
+
+# Generated by h2py from \msvc20\include\winnt.h
+# hacked and split by mhammond.
+SEC_FILE = 8388608
+SEC_IMAGE = 16777216
+SEC_RESERVE = 67108864
+SEC_COMMIT = 134217728
+SEC_NOCACHE = 268435456
+MEM_IMAGE = SEC_IMAGE
+FILE_SHARE_READ = 1
+FILE_SHARE_WRITE = 2
+FILE_SHARE_DELETE = 4
+FILE_ATTRIBUTE_READONLY = 1
+FILE_ATTRIBUTE_HIDDEN = 2
+FILE_ATTRIBUTE_SYSTEM = 4
+FILE_ATTRIBUTE_DIRECTORY = 16
+FILE_ATTRIBUTE_ARCHIVE = 32
+FILE_ATTRIBUTE_NORMAL = 128
+FILE_ATTRIBUTE_TEMPORARY = 256
+FILE_ATTRIBUTE_ATOMIC_WRITE = 512
+FILE_ATTRIBUTE_XACTION_WRITE = 1024
+FILE_ATTRIBUTE_COMPRESSED = 2048
+FILE_NOTIFY_CHANGE_FILE_NAME = 1
+FILE_NOTIFY_CHANGE_DIR_NAME = 2
+FILE_NOTIFY_CHANGE_ATTRIBUTES = 4
+FILE_NOTIFY_CHANGE_SIZE = 8
+FILE_NOTIFY_CHANGE_LAST_WRITE = 16
+FILE_NOTIFY_CHANGE_SECURITY = 256
+FILE_CASE_SENSITIVE_SEARCH = 1
+FILE_CASE_PRESERVED_NAMES = 2
+FILE_UNICODE_ON_DISK = 4
+FILE_PERSISTENT_ACLS = 8
+FILE_FILE_COMPRESSION = 16
+FILE_VOLUME_IS_COMPRESSED = 32768
+IO_COMPLETION_MODIFY_STATE = 2
+DUPLICATE_CLOSE_SOURCE = 1
+DUPLICATE_SAME_ACCESS = 2
+SID_MAX_SUB_AUTHORITIES = (15)
+SECURITY_NULL_RID = (0)
+SECURITY_WORLD_RID = (0)
+SECURITY_LOCAL_RID = (0X00000000)
+SECURITY_CREATOR_OWNER_RID = (0)
+SECURITY_CREATOR_GROUP_RID = (1)
+SECURITY_DIALUP_RID = (1)
+SECURITY_NETWORK_RID = (2)
+SECURITY_BATCH_RID = (3)
+SECURITY_INTERACTIVE_RID = (4)
+SECURITY_SERVICE_RID = (6)
+SECURITY_ANONYMOUS_LOGON_RID = (7)
+SECURITY_LOGON_IDS_RID = (5)
+SECURITY_LOGON_IDS_RID_COUNT = (3)
+SECURITY_LOCAL_SYSTEM_RID = (18)
+SECURITY_NT_NON_UNIQUE = (21)
+SECURITY_BUILTIN_DOMAIN_RID = (32)
+DOMAIN_USER_RID_ADMIN = (500)
+DOMAIN_USER_RID_GUEST = (501)
+DOMAIN_GROUP_RID_ADMINS = (512)
+DOMAIN_GROUP_RID_USERS = (513)
+DOMAIN_GROUP_RID_GUESTS = (514)
+DOMAIN_ALIAS_RID_ADMINS = (544)
+DOMAIN_ALIAS_RID_USERS = (545)
+DOMAIN_ALIAS_RID_GUESTS = (546)
+DOMAIN_ALIAS_RID_POWER_USERS = (547)
+DOMAIN_ALIAS_RID_ACCOUNT_OPS = (548)
+DOMAIN_ALIAS_RID_SYSTEM_OPS = (549)
+DOMAIN_ALIAS_RID_PRINT_OPS = (550)
+DOMAIN_ALIAS_RID_BACKUP_OPS = (551)
+DOMAIN_ALIAS_RID_REPLICATOR = (552)
+SE_GROUP_MANDATORY = (1)
+SE_GROUP_ENABLED_BY_DEFAULT = (2)
+SE_GROUP_ENABLED = (4)
+SE_GROUP_OWNER = (8)
+SE_GROUP_LOGON_ID = (-1073741824)
+ACL_REVISION = (2)
+ACL_REVISION1 = (1)
+ACL_REVISION2 = (2)
+ACCESS_ALLOWED_ACE_TYPE = (0)
+ACCESS_DENIED_ACE_TYPE = (1)
+SYSTEM_AUDIT_ACE_TYPE = (2)
+SYSTEM_ALARM_ACE_TYPE = (3)
+OBJECT_INHERIT_ACE = (1)
+CONTAINER_INHERIT_ACE = (2)
+NO_PROPAGATE_INHERIT_ACE = (4)
+INHERIT_ONLY_ACE = (8)
+VALID_INHERIT_FLAGS = (15)
+SUCCESSFUL_ACCESS_ACE_FLAG = (64)
+FAILED_ACCESS_ACE_FLAG = (128)
+SECURITY_DESCRIPTOR_REVISION = (1)
+SECURITY_DESCRIPTOR_REVISION1 = (1)
+SECURITY_DESCRIPTOR_MIN_LENGTH = (20)
+SE_OWNER_DEFAULTED = (1)
+SE_GROUP_DEFAULTED = (2)
+SE_DACL_PRESENT = (4)
+SE_DACL_DEFAULTED = (8)
+SE_SACL_PRESENT = (16)
+SE_SACL_DEFAULTED = (32)
+SE_SELF_RELATIVE = (32768)
+SE_PRIVILEGE_ENABLED_BY_DEFAULT = (1)
+SE_PRIVILEGE_ENABLED = (2)
+SE_PRIVILEGE_USED_FOR_ACCESS = (-2147483648)
+PRIVILEGE_SET_ALL_NECESSARY = (1)
+SE_CREATE_TOKEN_NAME = "SeCreateTokenPrivilege"
+SE_ASSIGNPRIMARYTOKEN_NAME = "SeAssignPrimaryTokenPrivilege"
+SE_LOCK_MEMORY_NAME = "SeLockMemoryPrivilege"
+SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege"
+SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege"
+SE_MACHINE_ACCOUNT_NAME = "SeMachineAccountPrivilege"
+SE_TCB_NAME = "SeTcbPrivilege"
+SE_SECURITY_NAME = "SeSecurityPrivilege"
+SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege"
+SE_LOAD_DRIVER_NAME = "SeLoadDriverPrivilege"
+SE_SYSTEM_PROFILE_NAME = "SeSystemProfilePrivilege"
+SE_SYSTEMTIME_NAME = "SeSystemtimePrivilege"
+SE_PROF_SINGLE_PROCESS_NAME = "SeProfileSingleProcessPrivilege"
+SE_INC_BASE_PRIORITY_NAME = "SeIncreaseBasePriorityPrivilege"
+SE_CREATE_PAGEFILE_NAME = "SeCreatePagefilePrivilege"
+SE_CREATE_PERMANENT_NAME = "SeCreatePermanentPrivilege"
+SE_BACKUP_NAME = "SeBackupPrivilege"
+SE_RESTORE_NAME = "SeRestorePrivilege"
+SE_SHUTDOWN_NAME = "SeShutdownPrivilege"
+SE_DEBUG_NAME = "SeDebugPrivilege"
+SE_AUDIT_NAME = "SeAuditPrivilege"
+SE_SYSTEM_ENVIRONMENT_NAME = "SeSystemEnvironmentPrivilege"
+SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege"
+SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege"
+
+TOKEN_ASSIGN_PRIMARY = (1)
+TOKEN_DUPLICATE = (2)
+TOKEN_IMPERSONATE = (4)
+TOKEN_QUERY = (8)
+TOKEN_QUERY_SOURCE = (16)
+TOKEN_ADJUST_PRIVILEGES = (32)
+TOKEN_ADJUST_GROUPS = (64)
+TOKEN_ADJUST_DEFAULT = (128)
+TOKEN_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED |\
+ TOKEN_ASSIGN_PRIMARY |\
+ TOKEN_DUPLICATE |\
+ TOKEN_IMPERSONATE |\
+ TOKEN_QUERY |\
+ TOKEN_QUERY_SOURCE |\
+ TOKEN_ADJUST_PRIVILEGES |\
+ TOKEN_ADJUST_GROUPS |\
+ TOKEN_ADJUST_DEFAULT)
+TOKEN_READ = (STANDARD_RIGHTS_READ |\
+ TOKEN_QUERY)
+TOKEN_WRITE = (STANDARD_RIGHTS_WRITE |\
+ TOKEN_ADJUST_PRIVILEGES |\
+ TOKEN_ADJUST_GROUPS |\
+ TOKEN_ADJUST_DEFAULT)
+TOKEN_EXECUTE = (STANDARD_RIGHTS_EXECUTE)
+TOKEN_SOURCE_LENGTH = 8
+
+KEY_QUERY_VALUE = (1)
+KEY_SET_VALUE = (2)
+KEY_CREATE_SUB_KEY = (4)
+KEY_ENUMERATE_SUB_KEYS = (8)
+KEY_NOTIFY = (16)
+KEY_CREATE_LINK = (32)
+KEY_READ = ((STANDARD_RIGHTS_READ |\
+ KEY_QUERY_VALUE |\
+ KEY_ENUMERATE_SUB_KEYS |\
+ KEY_NOTIFY) \
+ & \
+ (~SYNCHRONIZE))
+KEY_WRITE = ((STANDARD_RIGHTS_WRITE |\
+ KEY_SET_VALUE |\
+ KEY_CREATE_SUB_KEY) \
+ & \
+ (~SYNCHRONIZE))
+KEY_EXECUTE = ((KEY_READ) \
+ & \
+ (~SYNCHRONIZE))
+KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL |\
+ KEY_QUERY_VALUE |\
+ KEY_SET_VALUE |\
+ KEY_CREATE_SUB_KEY |\
+ KEY_ENUMERATE_SUB_KEYS |\
+ KEY_NOTIFY |\
+ KEY_CREATE_LINK) \
+ & \
+ (~SYNCHRONIZE))
+REG_NOTIFY_CHANGE_ATTRIBUTES = (2)
+REG_NOTIFY_CHANGE_SECURITY = (8)
+REG_RESOURCE_REQUIREMENTS_LIST = ( 10 )
+REG_NONE = ( 0 ) # No value type
+REG_SZ = ( 1 ) # Unicode nul terminated string
+REG_EXPAND_SZ = ( 2 ) # Unicode nul terminated string
+ # (with environment variable references)
+REG_BINARY = ( 3 ) # Free form binary
+REG_DWORD = ( 4 ) # 32-bit number
+REG_DWORD_LITTLE_ENDIAN = ( 4 ) # 32-bit number (same as REG_DWORD)
+REG_DWORD_BIG_ENDIAN = ( 5 ) # 32-bit number
+REG_LINK = ( 6 ) # Symbolic Link (unicode)
+REG_MULTI_SZ = ( 7 ) # Multiple Unicode strings
+REG_RESOURCE_LIST = ( 8 ) # Resource list in the resource map
+REG_FULL_RESOURCE_DESCRIPTOR =( 9 ) # Resource list in the hardware description
+REG_RESOURCE_REQUIREMENTS_LIST = ( 10 )
+REG_QWORD = ( 11 ) # 64-bit number
+REG_QWORD_LITTLE_ENDIAN = ( 11 ) # 64-bit number (same as REG_QWORD)
+
+
+# Generated by h2py from \msvc20\include\winnt.h
+# hacked and split by mhammond.
+# Included from string.h
+_NLSCMPERROR = 2147483647
+NULL = 0
+HEAP_NO_SERIALIZE = 1
+HEAP_GROWABLE = 2
+HEAP_GENERATE_EXCEPTIONS = 4
+HEAP_ZERO_MEMORY = 8
+HEAP_REALLOC_IN_PLACE_ONLY = 16
+HEAP_TAIL_CHECKING_ENABLED = 32
+HEAP_FREE_CHECKING_ENABLED = 64
+HEAP_DISABLE_COALESCE_ON_FREE = 128
+IS_TEXT_UNICODE_ASCII16 = 1
+IS_TEXT_UNICODE_REVERSE_ASCII16 = 16
+IS_TEXT_UNICODE_STATISTICS = 2
+IS_TEXT_UNICODE_REVERSE_STATISTICS = 32
+IS_TEXT_UNICODE_CONTROLS = 4
+IS_TEXT_UNICODE_REVERSE_CONTROLS = 64
+IS_TEXT_UNICODE_SIGNATURE = 8
+IS_TEXT_UNICODE_REVERSE_SIGNATURE = 128
+IS_TEXT_UNICODE_ILLEGAL_CHARS = 256
+IS_TEXT_UNICODE_ODD_LENGTH = 512
+IS_TEXT_UNICODE_DBCS_LEADBYTE = 1024
+IS_TEXT_UNICODE_NULL_BYTES = 4096
+IS_TEXT_UNICODE_UNICODE_MASK = 15
+IS_TEXT_UNICODE_REVERSE_MASK = 240
+IS_TEXT_UNICODE_NOT_UNICODE_MASK = 3840
+IS_TEXT_UNICODE_NOT_ASCII_MASK = 61440
+COMPRESSION_FORMAT_NONE = (0)
+COMPRESSION_FORMAT_DEFAULT = (1)
+COMPRESSION_FORMAT_LZNT1 = (2)
+COMPRESSION_ENGINE_STANDARD = (0)
+COMPRESSION_ENGINE_MAXIMUM = (256)
+MESSAGE_RESOURCE_UNICODE = 1
+RTL_CRITSECT_TYPE = 0
+RTL_RESOURCE_TYPE = 1
+DLL_PROCESS_ATTACH = 1
+DLL_THREAD_ATTACH = 2
+DLL_THREAD_DETACH = 3
+DLL_PROCESS_DETACH = 0
+EVENTLOG_SEQUENTIAL_READ = 0X0001
+EVENTLOG_SEEK_READ = 0X0002
+EVENTLOG_FORWARDS_READ = 0X0004
+EVENTLOG_BACKWARDS_READ = 0X0008
+EVENTLOG_SUCCESS = 0X0000
+EVENTLOG_ERROR_TYPE = 1
+EVENTLOG_WARNING_TYPE = 2
+EVENTLOG_INFORMATION_TYPE = 4
+EVENTLOG_AUDIT_SUCCESS = 8
+EVENTLOG_AUDIT_FAILURE = 16
+EVENTLOG_START_PAIRED_EVENT = 1
+EVENTLOG_END_PAIRED_EVENT = 2
+EVENTLOG_END_ALL_PAIRED_EVENTS = 4
+EVENTLOG_PAIRED_EVENT_ACTIVE = 8
+EVENTLOG_PAIRED_EVENT_INACTIVE = 16
+# Generated by h2py from \msvc20\include\winnt.h
+# hacked and split by mhammond.
+OWNER_SECURITY_INFORMATION = (0X00000001)
+GROUP_SECURITY_INFORMATION = (0X00000002)
+DACL_SECURITY_INFORMATION = (0X00000004)
+SACL_SECURITY_INFORMATION = (0X00000008)
+IMAGE_SIZEOF_FILE_HEADER = 20
+IMAGE_FILE_MACHINE_UNKNOWN = 0
+IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16
+IMAGE_SIZEOF_ROM_OPTIONAL_HEADER = 56
+IMAGE_SIZEOF_STD_OPTIONAL_HEADER = 28
+IMAGE_SIZEOF_NT_OPTIONAL_HEADER = 224
+IMAGE_NT_OPTIONAL_HDR_MAGIC = 267
+IMAGE_ROM_OPTIONAL_HDR_MAGIC = 263
+IMAGE_SIZEOF_SHORT_NAME = 8
+IMAGE_SIZEOF_SECTION_HEADER = 40
+IMAGE_SIZEOF_SYMBOL = 18
+IMAGE_SYM_CLASS_NULL = 0
+IMAGE_SYM_CLASS_AUTOMATIC = 1
+IMAGE_SYM_CLASS_EXTERNAL = 2
+IMAGE_SYM_CLASS_STATIC = 3
+IMAGE_SYM_CLASS_REGISTER = 4
+IMAGE_SYM_CLASS_EXTERNAL_DEF = 5
+IMAGE_SYM_CLASS_LABEL = 6
+IMAGE_SYM_CLASS_UNDEFINED_LABEL = 7
+IMAGE_SYM_CLASS_MEMBER_OF_STRUCT = 8
+IMAGE_SYM_CLASS_ARGUMENT = 9
+IMAGE_SYM_CLASS_STRUCT_TAG = 10
+IMAGE_SYM_CLASS_MEMBER_OF_UNION = 11
+IMAGE_SYM_CLASS_UNION_TAG = 12
+IMAGE_SYM_CLASS_TYPE_DEFINITION = 13
+IMAGE_SYM_CLASS_UNDEFINED_STATIC = 14
+IMAGE_SYM_CLASS_ENUM_TAG = 15
+IMAGE_SYM_CLASS_MEMBER_OF_ENUM = 16
+IMAGE_SYM_CLASS_REGISTER_PARAM = 17
+IMAGE_SYM_CLASS_BIT_FIELD = 18
+IMAGE_SYM_CLASS_BLOCK = 100
+IMAGE_SYM_CLASS_FUNCTION = 101
+IMAGE_SYM_CLASS_END_OF_STRUCT = 102
+IMAGE_SYM_CLASS_FILE = 103
+IMAGE_SYM_CLASS_SECTION = 104
+IMAGE_SYM_CLASS_WEAK_EXTERNAL = 105
+N_BTMASK = 0o17
+N_TMASK = 0o60
+N_TMASK1 = 0o300
+N_TMASK2 = 0o360
+N_BTSHFT = 4
+N_TSHIFT = 2
+IMAGE_SIZEOF_AUX_SYMBOL = 18
+IMAGE_COMDAT_SELECT_NODUPLICATES = 1
+IMAGE_COMDAT_SELECT_ANY = 2
+IMAGE_COMDAT_SELECT_SAME_SIZE = 3
+IMAGE_COMDAT_SELECT_EXACT_MATCH = 4
+IMAGE_COMDAT_SELECT_ASSOCIATIVE = 5
+IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY = 1
+IMAGE_WEAK_EXTERN_SEARCH_LIBRARY = 2
+IMAGE_WEAK_EXTERN_SEARCH_ALIAS = 3
+IMAGE_SIZEOF_RELOCATION = 10
+IMAGE_REL_I386_SECTION = 0o12
+IMAGE_REL_I386_SECREL = 0o13
+IMAGE_REL_MIPS_REFHALF = 0o1
+IMAGE_REL_MIPS_REFWORD = 0o2
+IMAGE_REL_MIPS_JMPADDR = 0o3
+IMAGE_REL_MIPS_REFHI = 0o4
+IMAGE_REL_MIPS_REFLO = 0o5
+IMAGE_REL_MIPS_GPREL = 0o6
+IMAGE_REL_MIPS_LITERAL = 0o7
+IMAGE_REL_MIPS_SECTION = 0o12
+IMAGE_REL_MIPS_SECREL = 0o13
+IMAGE_REL_MIPS_REFWORDNB = 0o42
+IMAGE_REL_MIPS_PAIR = 0o45
+IMAGE_REL_ALPHA_ABSOLUTE = 0
+IMAGE_REL_ALPHA_REFLONG = 1
+IMAGE_REL_ALPHA_REFQUAD = 2
+IMAGE_REL_ALPHA_GPREL32 = 3
+IMAGE_REL_ALPHA_LITERAL = 4
+IMAGE_REL_ALPHA_LITUSE = 5
+IMAGE_REL_ALPHA_GPDISP = 6
+IMAGE_REL_ALPHA_BRADDR = 7
+IMAGE_REL_ALPHA_HINT = 8
+IMAGE_REL_ALPHA_INLINE_REFLONG = 9
+IMAGE_REL_ALPHA_REFHI = 10
+IMAGE_REL_ALPHA_REFLO = 11
+IMAGE_REL_ALPHA_PAIR = 12
+IMAGE_REL_ALPHA_MATCH = 13
+IMAGE_REL_ALPHA_SECTION = 14
+IMAGE_REL_ALPHA_SECREL = 15
+IMAGE_REL_ALPHA_REFLONGNB = 16
+IMAGE_SIZEOF_BASE_RELOCATION = 8
+IMAGE_REL_BASED_ABSOLUTE = 0
+IMAGE_REL_BASED_HIGH = 1
+IMAGE_REL_BASED_LOW = 2
+IMAGE_REL_BASED_HIGHLOW = 3
+IMAGE_REL_BASED_HIGHADJ = 4
+IMAGE_REL_BASED_MIPS_JMPADDR = 5
+IMAGE_SIZEOF_LINENUMBER = 6
+IMAGE_ARCHIVE_START_SIZE = 8
+IMAGE_ARCHIVE_START = "!\n"
+IMAGE_ARCHIVE_END = "`\n"
+IMAGE_ARCHIVE_PAD = "\n"
+IMAGE_ARCHIVE_LINKER_MEMBER = "/ "
+IMAGE_ARCHIVE_LONGNAMES_MEMBER = "// "
+IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR = 60
+IMAGE_ORDINAL_FLAG = -2147483648
+def IMAGE_SNAP_BY_ORDINAL(Ordinal): return ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
+
+def IMAGE_ORDINAL(Ordinal): return (Ordinal & 65535)
+
+IMAGE_RESOURCE_NAME_IS_STRING = -2147483648
+IMAGE_RESOURCE_DATA_IS_DIRECTORY = -2147483648
+IMAGE_DEBUG_TYPE_UNKNOWN = 0
+IMAGE_DEBUG_TYPE_COFF = 1
+IMAGE_DEBUG_TYPE_CODEVIEW = 2
+IMAGE_DEBUG_TYPE_FPO = 3
+IMAGE_DEBUG_TYPE_MISC = 4
+IMAGE_DEBUG_TYPE_EXCEPTION = 5
+IMAGE_DEBUG_TYPE_FIXUP = 6
+IMAGE_DEBUG_TYPE_OMAP_TO_SRC = 7
+IMAGE_DEBUG_TYPE_OMAP_FROM_SRC = 8
+FRAME_FPO = 0
+FRAME_TRAP = 1
+FRAME_TSS = 2
+SIZEOF_RFPO_DATA = 16
+IMAGE_DEBUG_MISC_EXENAME = 1
+IMAGE_SEPARATE_DEBUG_SIGNATURE = 18756
+# Generated by h2py from \msvcnt\include\wingdi.h
+# hacked and split manually by mhammond.
+NEWFRAME = 1
+ABORTDOC = 2
+NEXTBAND = 3
+SETCOLORTABLE = 4
+GETCOLORTABLE = 5
+FLUSHOUTPUT = 6
+DRAFTMODE = 7
+QUERYESCSUPPORT = 8
+SETABORTPROC = 9
+STARTDOC = 10
+ENDDOC = 11
+GETPHYSPAGESIZE = 12
+GETPRINTINGOFFSET = 13
+GETSCALINGFACTOR = 14
+MFCOMMENT = 15
+GETPENWIDTH = 16
+SETCOPYCOUNT = 17
+SELECTPAPERSOURCE = 18
+DEVICEDATA = 19
+PASSTHROUGH = 19
+GETTECHNOLGY = 20
+GETTECHNOLOGY = 20
+SETLINECAP = 21
+SETLINEJOIN = 22
+SETMITERLIMIT = 23
+BANDINFO = 24
+DRAWPATTERNRECT = 25
+GETVECTORPENSIZE = 26
+GETVECTORBRUSHSIZE = 27
+ENABLEDUPLEX = 28
+GETSETPAPERBINS = 29
+GETSETPRINTORIENT = 30
+ENUMPAPERBINS = 31
+SETDIBSCALING = 32
+EPSPRINTING = 33
+ENUMPAPERMETRICS = 34
+GETSETPAPERMETRICS = 35
+POSTSCRIPT_DATA = 37
+POSTSCRIPT_IGNORE = 38
+MOUSETRAILS = 39
+GETDEVICEUNITS = 42
+GETEXTENDEDTEXTMETRICS = 256
+GETEXTENTTABLE = 257
+GETPAIRKERNTABLE = 258
+GETTRACKKERNTABLE = 259
+EXTTEXTOUT = 512
+GETFACENAME = 513
+DOWNLOADFACE = 514
+ENABLERELATIVEWIDTHS = 768
+ENABLEPAIRKERNING = 769
+SETKERNTRACK = 770
+SETALLJUSTVALUES = 771
+SETCHARSET = 772
+STRETCHBLT = 2048
+GETSETSCREENPARAMS = 3072
+BEGIN_PATH = 4096
+CLIP_TO_PATH = 4097
+END_PATH = 4098
+EXT_DEVICE_CAPS = 4099
+RESTORE_CTM = 4100
+SAVE_CTM = 4101
+SET_ARC_DIRECTION = 4102
+SET_BACKGROUND_COLOR = 4103
+SET_POLY_MODE = 4104
+SET_SCREEN_ANGLE = 4105
+SET_SPREAD = 4106
+TRANSFORM_CTM = 4107
+SET_CLIP_BOX = 4108
+SET_BOUNDS = 4109
+SET_MIRROR_MODE = 4110
+OPENCHANNEL = 4110
+DOWNLOADHEADER = 4111
+CLOSECHANNEL = 4112
+POSTSCRIPT_PASSTHROUGH = 4115
+ENCAPSULATED_POSTSCRIPT = 4116
+SP_NOTREPORTED = 16384
+SP_ERROR = (-1)
+SP_APPABORT = (-2)
+SP_USERABORT = (-3)
+SP_OUTOFDISK = (-4)
+SP_OUTOFMEMORY = (-5)
+PR_JOBSTATUS = 0
+OBJ_PEN = 1
+OBJ_BRUSH = 2
+OBJ_DC = 3
+OBJ_METADC = 4
+OBJ_PAL = 5
+OBJ_FONT = 6
+OBJ_BITMAP = 7
+OBJ_REGION = 8
+OBJ_METAFILE = 9
+OBJ_MEMDC = 10
+OBJ_EXTPEN = 11
+OBJ_ENHMETADC = 12
+OBJ_ENHMETAFILE = 13
+MWT_IDENTITY = 1
+MWT_LEFTMULTIPLY = 2
+MWT_RIGHTMULTIPLY = 3
+MWT_MIN = MWT_IDENTITY
+MWT_MAX = MWT_RIGHTMULTIPLY
+BI_RGB = 0
+BI_RLE8 = 1
+BI_RLE4 = 2
+BI_BITFIELDS = 3
+TMPF_FIXED_PITCH = 1
+TMPF_VECTOR = 2
+TMPF_DEVICE = 8
+TMPF_TRUETYPE = 4
+NTM_REGULAR = 64
+NTM_BOLD = 32
+NTM_ITALIC = 1
+LF_FACESIZE = 32
+LF_FULLFACESIZE = 64
+OUT_DEFAULT_PRECIS = 0
+OUT_STRING_PRECIS = 1
+OUT_CHARACTER_PRECIS = 2
+OUT_STROKE_PRECIS = 3
+OUT_TT_PRECIS = 4
+OUT_DEVICE_PRECIS = 5
+OUT_RASTER_PRECIS = 6
+OUT_TT_ONLY_PRECIS = 7
+OUT_OUTLINE_PRECIS = 8
+CLIP_DEFAULT_PRECIS = 0
+CLIP_CHARACTER_PRECIS = 1
+CLIP_STROKE_PRECIS = 2
+CLIP_MASK = 15
+CLIP_LH_ANGLES = (1<<4)
+CLIP_TT_ALWAYS = (2<<4)
+CLIP_EMBEDDED = (8<<4)
+DEFAULT_QUALITY = 0
+DRAFT_QUALITY = 1
+PROOF_QUALITY = 2
+NONANTIALIASED_QUALITY = 3
+ANTIALIASED_QUALITY = 4
+CLEARTYPE_QUALITY = 5
+CLEARTYPE_NATURAL_QUALITY = 6
+DEFAULT_PITCH = 0
+FIXED_PITCH = 1
+VARIABLE_PITCH = 2
+ANSI_CHARSET = 0
+DEFAULT_CHARSET = 1
+SYMBOL_CHARSET = 2
+SHIFTJIS_CHARSET = 128
+HANGEUL_CHARSET = 129
+CHINESEBIG5_CHARSET = 136
+OEM_CHARSET = 255
+JOHAB_CHARSET = 130
+HEBREW_CHARSET = 177
+ARABIC_CHARSET = 178
+GREEK_CHARSET = 161
+TURKISH_CHARSET = 162
+VIETNAMESE_CHARSET = 163
+THAI_CHARSET = 222
+EASTEUROPE_CHARSET = 238
+RUSSIAN_CHARSET = 204
+MAC_CHARSET = 77
+BALTIC_CHARSET = 186
+FF_DONTCARE = (0<<4)
+FF_ROMAN = (1<<4)
+FF_SWISS = (2<<4)
+FF_MODERN = (3<<4)
+FF_SCRIPT = (4<<4)
+FF_DECORATIVE = (5<<4)
+FW_DONTCARE = 0
+FW_THIN = 100
+FW_EXTRALIGHT = 200
+FW_LIGHT = 300
+FW_NORMAL = 400
+FW_MEDIUM = 500
+FW_SEMIBOLD = 600
+FW_BOLD = 700
+FW_EXTRABOLD = 800
+FW_HEAVY = 900
+FW_ULTRALIGHT = FW_EXTRALIGHT
+FW_REGULAR = FW_NORMAL
+FW_DEMIBOLD = FW_SEMIBOLD
+FW_ULTRABOLD = FW_EXTRABOLD
+FW_BLACK = FW_HEAVY
+# Generated by h2py from \msvcnt\include\wingdi.h
+# hacked and split manually by mhammond.
+BS_SOLID = 0
+BS_NULL = 1
+BS_HOLLOW = BS_NULL
+BS_HATCHED = 2
+BS_PATTERN = 3
+BS_INDEXED = 4
+BS_DIBPATTERN = 5
+BS_DIBPATTERNPT = 6
+BS_PATTERN8X8 = 7
+BS_DIBPATTERN8X8 = 8
+HS_HORIZONTAL = 0
+HS_VERTICAL = 1
+HS_FDIAGONAL = 2
+HS_BDIAGONAL = 3
+HS_CROSS = 4
+HS_DIAGCROSS = 5
+HS_FDIAGONAL1 = 6
+HS_BDIAGONAL1 = 7
+HS_SOLID = 8
+HS_DENSE1 = 9
+HS_DENSE2 = 10
+HS_DENSE3 = 11
+HS_DENSE4 = 12
+HS_DENSE5 = 13
+HS_DENSE6 = 14
+HS_DENSE7 = 15
+HS_DENSE8 = 16
+HS_NOSHADE = 17
+HS_HALFTONE = 18
+HS_SOLIDCLR = 19
+HS_DITHEREDCLR = 20
+HS_SOLIDTEXTCLR = 21
+HS_DITHEREDTEXTCLR = 22
+HS_SOLIDBKCLR = 23
+HS_DITHEREDBKCLR = 24
+HS_API_MAX = 25
+PS_SOLID = 0
+PS_DASH = 1
+PS_DOT = 2
+PS_DASHDOT = 3
+PS_DASHDOTDOT = 4
+PS_NULL = 5
+PS_INSIDEFRAME = 6
+PS_USERSTYLE = 7
+PS_ALTERNATE = 8
+PS_STYLE_MASK = 15
+PS_ENDCAP_ROUND = 0
+PS_ENDCAP_SQUARE = 256
+PS_ENDCAP_FLAT = 512
+PS_ENDCAP_MASK = 3840
+PS_JOIN_ROUND = 0
+PS_JOIN_BEVEL = 4096
+PS_JOIN_MITER = 8192
+PS_JOIN_MASK = 61440
+PS_COSMETIC = 0
+PS_GEOMETRIC = 65536
+PS_TYPE_MASK = 983040
+AD_COUNTERCLOCKWISE = 1
+AD_CLOCKWISE = 2
+DRIVERVERSION = 0
+TECHNOLOGY = 2
+HORZSIZE = 4
+VERTSIZE = 6
+HORZRES = 8
+VERTRES = 10
+BITSPIXEL = 12
+PLANES = 14
+NUMBRUSHES = 16
+NUMPENS = 18
+NUMMARKERS = 20
+NUMFONTS = 22
+NUMCOLORS = 24
+PDEVICESIZE = 26
+CURVECAPS = 28
+LINECAPS = 30
+POLYGONALCAPS = 32
+TEXTCAPS = 34
+CLIPCAPS = 36
+RASTERCAPS = 38
+ASPECTX = 40
+ASPECTY = 42
+ASPECTXY = 44
+LOGPIXELSX = 88
+LOGPIXELSY = 90
+SIZEPALETTE = 104
+NUMRESERVED = 106
+COLORRES = 108
+DT_PLOTTER = 0
+DT_RASDISPLAY = 1
+DT_RASPRINTER = 2
+DT_RASCAMERA = 3
+DT_CHARSTREAM = 4
+DT_METAFILE = 5
+DT_DISPFILE = 6
+CC_NONE = 0
+CC_CIRCLES = 1
+CC_PIE = 2
+CC_CHORD = 4
+CC_ELLIPSES = 8
+CC_WIDE = 16
+CC_STYLED = 32
+CC_WIDESTYLED = 64
+CC_INTERIORS = 128
+CC_ROUNDRECT = 256
+LC_NONE = 0
+LC_POLYLINE = 2
+LC_MARKER = 4
+LC_POLYMARKER = 8
+LC_WIDE = 16
+LC_STYLED = 32
+LC_WIDESTYLED = 64
+LC_INTERIORS = 128
+PC_NONE = 0
+PC_POLYGON = 1
+PC_RECTANGLE = 2
+PC_WINDPOLYGON = 4
+PC_TRAPEZOID = 4
+PC_SCANLINE = 8
+PC_WIDE = 16
+PC_STYLED = 32
+PC_WIDESTYLED = 64
+PC_INTERIORS = 128
+CP_NONE = 0
+CP_RECTANGLE = 1
+CP_REGION = 2
+TC_OP_CHARACTER = 1
+TC_OP_STROKE = 2
+TC_CP_STROKE = 4
+TC_CR_90 = 8
+TC_CR_ANY = 16
+TC_SF_X_YINDEP = 32
+TC_SA_DOUBLE = 64
+TC_SA_INTEGER = 128
+TC_SA_CONTIN = 256
+TC_EA_DOUBLE = 512
+TC_IA_ABLE = 1024
+TC_UA_ABLE = 2048
+TC_SO_ABLE = 4096
+TC_RA_ABLE = 8192
+TC_VA_ABLE = 16384
+TC_RESERVED = 32768
+TC_SCROLLBLT = 65536
+RC_BITBLT = 1
+RC_BANDING = 2
+RC_SCALING = 4
+RC_BITMAP64 = 8
+RC_GDI20_OUTPUT = 16
+RC_GDI20_STATE = 32
+RC_SAVEBITMAP = 64
+RC_DI_BITMAP = 128
+RC_PALETTE = 256
+RC_DIBTODEV = 512
+RC_BIGFONT = 1024
+RC_STRETCHBLT = 2048
+RC_FLOODFILL = 4096
+RC_STRETCHDIB = 8192
+RC_OP_DX_OUTPUT = 16384
+RC_DEVBITS = 32768
+DIB_RGB_COLORS = 0
+DIB_PAL_COLORS = 1
+DIB_PAL_INDICES = 2
+DIB_PAL_PHYSINDICES = 2
+DIB_PAL_LOGINDICES = 4
+SYSPAL_ERROR = 0
+SYSPAL_STATIC = 1
+SYSPAL_NOSTATIC = 2
+CBM_CREATEDIB = 2
+CBM_INIT = 4
+FLOODFILLBORDER = 0
+FLOODFILLSURFACE = 1
+CCHDEVICENAME = 32
+CCHFORMNAME = 32
+# Generated by h2py from \msvcnt\include\wingdi.h
+# hacked and split manually by mhammond.
+
+# DEVMODE.dmFields
+DM_SPECVERSION = 800
+DM_ORIENTATION = 1
+DM_PAPERSIZE = 2
+DM_PAPERLENGTH = 4
+DM_PAPERWIDTH = 8
+DM_SCALE = 16
+DM_POSITION = 32
+DM_NUP = 64
+DM_DISPLAYORIENTATION = 128
+DM_COPIES = 256
+DM_DEFAULTSOURCE = 512
+DM_PRINTQUALITY = 1024
+DM_COLOR = 2048
+DM_DUPLEX = 4096
+DM_YRESOLUTION = 8192
+DM_TTOPTION = 16384
+DM_COLLATE = 32768
+DM_FORMNAME = 65536
+DM_LOGPIXELS = 131072
+DM_BITSPERPEL = 262144
+DM_PELSWIDTH = 524288
+DM_PELSHEIGHT = 1048576
+DM_DISPLAYFLAGS = 2097152
+DM_DISPLAYFREQUENCY = 4194304
+DM_ICMMETHOD = 8388608
+DM_ICMINTENT = 16777216
+DM_MEDIATYPE = 33554432
+DM_DITHERTYPE = 67108864
+DM_PANNINGWIDTH = 134217728
+DM_PANNINGHEIGHT = 268435456
+DM_DISPLAYFIXEDOUTPUT = 536870912
+
+# DEVMODE.dmOrientation
+DMORIENT_PORTRAIT = 1
+DMORIENT_LANDSCAPE = 2
+
+# DEVMODE.dmDisplayOrientation
+DMDO_DEFAULT = 0
+DMDO_90 = 1
+DMDO_180 = 2
+DMDO_270 = 3
+
+# DEVMODE.dmDisplayFixedOutput
+DMDFO_DEFAULT = 0
+DMDFO_STRETCH = 1
+DMDFO_CENTER = 2
+
+# DEVMODE.dmPaperSize
+DMPAPER_LETTER = 1
+DMPAPER_LETTERSMALL = 2
+DMPAPER_TABLOID = 3
+DMPAPER_LEDGER = 4
+DMPAPER_LEGAL = 5
+DMPAPER_STATEMENT = 6
+DMPAPER_EXECUTIVE = 7
+DMPAPER_A3 = 8
+DMPAPER_A4 = 9
+DMPAPER_A4SMALL = 10
+DMPAPER_A5 = 11
+DMPAPER_B4 = 12
+DMPAPER_B5 = 13
+DMPAPER_FOLIO = 14
+DMPAPER_QUARTO = 15
+DMPAPER_10X14 = 16
+DMPAPER_11X17 = 17
+DMPAPER_NOTE = 18
+DMPAPER_ENV_9 = 19
+DMPAPER_ENV_10 = 20
+DMPAPER_ENV_11 = 21
+DMPAPER_ENV_12 = 22
+DMPAPER_ENV_14 = 23
+DMPAPER_CSHEET = 24
+DMPAPER_DSHEET = 25
+DMPAPER_ESHEET = 26
+DMPAPER_ENV_DL = 27
+DMPAPER_ENV_C5 = 28
+DMPAPER_ENV_C3 = 29
+DMPAPER_ENV_C4 = 30
+DMPAPER_ENV_C6 = 31
+DMPAPER_ENV_C65 = 32
+DMPAPER_ENV_B4 = 33
+DMPAPER_ENV_B5 = 34
+DMPAPER_ENV_B6 = 35
+DMPAPER_ENV_ITALY = 36
+DMPAPER_ENV_MONARCH = 37
+DMPAPER_ENV_PERSONAL = 38
+DMPAPER_FANFOLD_US = 39
+DMPAPER_FANFOLD_STD_GERMAN = 40
+DMPAPER_FANFOLD_LGL_GERMAN = 41
+DMPAPER_ISO_B4 = 42
+DMPAPER_JAPANESE_POSTCARD = 43
+DMPAPER_9X11 = 44
+DMPAPER_10X11 = 45
+DMPAPER_15X11 = 46
+DMPAPER_ENV_INVITE = 47
+DMPAPER_RESERVED_48 = 48
+DMPAPER_RESERVED_49 = 49
+DMPAPER_LETTER_EXTRA = 50
+DMPAPER_LEGAL_EXTRA = 51
+DMPAPER_TABLOID_EXTRA = 52
+DMPAPER_A4_EXTRA = 53
+DMPAPER_LETTER_TRANSVERSE = 54
+DMPAPER_A4_TRANSVERSE = 55
+DMPAPER_LETTER_EXTRA_TRANSVERSE = 56
+DMPAPER_A_PLUS = 57
+DMPAPER_B_PLUS = 58
+DMPAPER_LETTER_PLUS = 59
+DMPAPER_A4_PLUS = 60
+DMPAPER_A5_TRANSVERSE = 61
+DMPAPER_B5_TRANSVERSE = 62
+DMPAPER_A3_EXTRA = 63
+DMPAPER_A5_EXTRA = 64
+DMPAPER_B5_EXTRA = 65
+DMPAPER_A2 = 66
+DMPAPER_A3_TRANSVERSE = 67
+DMPAPER_A3_EXTRA_TRANSVERSE = 68
+DMPAPER_DBL_JAPANESE_POSTCARD = 69
+DMPAPER_A6 = 70
+DMPAPER_JENV_KAKU2 = 71
+DMPAPER_JENV_KAKU3 = 72
+DMPAPER_JENV_CHOU3 = 73
+DMPAPER_JENV_CHOU4 = 74
+DMPAPER_LETTER_ROTATED = 75
+DMPAPER_A3_ROTATED = 76
+DMPAPER_A4_ROTATED = 77
+DMPAPER_A5_ROTATED = 78
+DMPAPER_B4_JIS_ROTATED = 79
+DMPAPER_B5_JIS_ROTATED = 80
+DMPAPER_JAPANESE_POSTCARD_ROTATED = 81
+DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82
+DMPAPER_A6_ROTATED = 83
+DMPAPER_JENV_KAKU2_ROTATED = 84
+DMPAPER_JENV_KAKU3_ROTATED = 85
+DMPAPER_JENV_CHOU3_ROTATED = 86
+DMPAPER_JENV_CHOU4_ROTATED = 87
+DMPAPER_B6_JIS = 88
+DMPAPER_B6_JIS_ROTATED = 89
+DMPAPER_12X11 = 90
+DMPAPER_JENV_YOU4 = 91
+DMPAPER_JENV_YOU4_ROTATED = 92
+DMPAPER_P16K = 93
+DMPAPER_P32K = 94
+DMPAPER_P32KBIG = 95
+DMPAPER_PENV_1 = 96
+DMPAPER_PENV_2 = 97
+DMPAPER_PENV_3 = 98
+DMPAPER_PENV_4 = 99
+DMPAPER_PENV_5 = 100
+DMPAPER_PENV_6 = 101
+DMPAPER_PENV_7 = 102
+DMPAPER_PENV_8 = 103
+DMPAPER_PENV_9 = 104
+DMPAPER_PENV_10 = 105
+DMPAPER_P16K_ROTATED = 106
+DMPAPER_P32K_ROTATED = 107
+DMPAPER_P32KBIG_ROTATED = 108
+DMPAPER_PENV_1_ROTATED = 109
+DMPAPER_PENV_2_ROTATED = 110
+DMPAPER_PENV_3_ROTATED = 111
+DMPAPER_PENV_4_ROTATED = 112
+DMPAPER_PENV_5_ROTATED = 113
+DMPAPER_PENV_6_ROTATED = 114
+DMPAPER_PENV_7_ROTATED = 115
+DMPAPER_PENV_8_ROTATED = 116
+DMPAPER_PENV_9_ROTATED = 117
+DMPAPER_PENV_10_ROTATED = 118
+DMPAPER_LAST = DMPAPER_PENV_10_ROTATED
+DMPAPER_USER = 256
+
+# DEVMODE.dmDefaultSource
+DMBIN_UPPER = 1
+DMBIN_ONLYONE = 1
+DMBIN_LOWER = 2
+DMBIN_MIDDLE = 3
+DMBIN_MANUAL = 4
+DMBIN_ENVELOPE = 5
+DMBIN_ENVMANUAL = 6
+DMBIN_AUTO = 7
+DMBIN_TRACTOR = 8
+DMBIN_SMALLFMT = 9
+DMBIN_LARGEFMT = 10
+DMBIN_LARGECAPACITY = 11
+DMBIN_CASSETTE = 14
+DMBIN_LAST = DMBIN_CASSETTE
+DMBIN_USER = 256
+
+# DEVMODE.dmPrintQuality
+DMRES_DRAFT = (-1)
+DMRES_LOW = (-2)
+DMRES_MEDIUM = (-3)
+DMRES_HIGH = (-4)
+
+# DEVMODE.dmColor
+DMCOLOR_MONOCHROME = 1
+DMCOLOR_COLOR = 2
+
+# DEVMODE.dmDuplex
+DMDUP_SIMPLEX = 1
+DMDUP_VERTICAL = 2
+DMDUP_HORIZONTAL = 3
+
+# DEVMODE.dmTTOption
+DMTT_BITMAP = 1
+DMTT_DOWNLOAD = 2
+DMTT_SUBDEV = 3
+DMTT_DOWNLOAD_OUTLINE = 4
+
+# DEVMODE.dmCollate
+DMCOLLATE_FALSE = 0
+DMCOLLATE_TRUE = 1
+
+# DEVMODE.dmDisplayFlags
+DM_GRAYSCALE = 1
+DM_INTERLACED = 2
+
+# DEVMODE.dmICMMethod
+DMICMMETHOD_NONE = 1
+DMICMMETHOD_SYSTEM = 2
+DMICMMETHOD_DRIVER = 3
+DMICMMETHOD_DEVICE = 4
+DMICMMETHOD_USER = 256
+
+# DEVMODE.dmICMIntent
+DMICM_SATURATE = 1
+DMICM_CONTRAST = 2
+DMICM_COLORIMETRIC = 3
+DMICM_ABS_COLORIMETRIC = 4
+DMICM_USER = 256
+
+# DEVMODE.dmMediaType
+DMMEDIA_STANDARD = 1
+DMMEDIA_TRANSPARENCY = 2
+DMMEDIA_GLOSSY = 3
+DMMEDIA_USER = 256
+
+# DEVMODE.dmDitherType
+DMDITHER_NONE = 1
+DMDITHER_COARSE = 2
+DMDITHER_FINE = 3
+DMDITHER_LINEART = 4
+DMDITHER_ERRORDIFFUSION = 5
+DMDITHER_RESERVED6 = 6
+DMDITHER_RESERVED7 = 7
+DMDITHER_RESERVED8 = 8
+DMDITHER_RESERVED9 = 9
+DMDITHER_GRAYSCALE = 10
+DMDITHER_USER = 256
+
+# DEVMODE.dmNup
+DMNUP_SYSTEM = 1
+DMNUP_ONEUP = 2
+
+RDH_RECTANGLES = 1
+GGO_METRICS = 0
+GGO_BITMAP = 1
+GGO_NATIVE = 2
+TT_POLYGON_TYPE = 24
+TT_PRIM_LINE = 1
+TT_PRIM_QSPLINE = 2
+TT_AVAILABLE = 1
+TT_ENABLED = 2
+DM_UPDATE = 1
+DM_COPY = 2
+DM_PROMPT = 4
+DM_MODIFY = 8
+DM_IN_BUFFER = DM_MODIFY
+DM_IN_PROMPT = DM_PROMPT
+DM_OUT_BUFFER = DM_COPY
+DM_OUT_DEFAULT = DM_UPDATE
+
+# DISPLAY_DEVICE.StateFlags
+DISPLAY_DEVICE_ATTACHED_TO_DESKTOP = 1
+DISPLAY_DEVICE_MULTI_DRIVER = 2
+DISPLAY_DEVICE_PRIMARY_DEVICE = 4
+DISPLAY_DEVICE_MIRRORING_DRIVER = 8
+DISPLAY_DEVICE_VGA_COMPATIBLE = 16
+DISPLAY_DEVICE_REMOVABLE = 32
+DISPLAY_DEVICE_MODESPRUNED = 134217728
+DISPLAY_DEVICE_REMOTE = 67108864
+DISPLAY_DEVICE_DISCONNECT = 33554432
+
+# DeviceCapabilities types
+DC_FIELDS = 1
+DC_PAPERS = 2
+DC_PAPERSIZE = 3
+DC_MINEXTENT = 4
+DC_MAXEXTENT = 5
+DC_BINS = 6
+DC_DUPLEX = 7
+DC_SIZE = 8
+DC_EXTRA = 9
+DC_VERSION = 10
+DC_DRIVER = 11
+DC_BINNAMES = 12
+DC_ENUMRESOLUTIONS = 13
+DC_FILEDEPENDENCIES = 14
+DC_TRUETYPE = 15
+DC_PAPERNAMES = 16
+DC_ORIENTATION = 17
+DC_COPIES = 18
+DC_BINADJUST = 19
+DC_EMF_COMPLIANT = 20
+DC_DATATYPE_PRODUCED = 21
+DC_COLLATE = 22
+DC_MANUFACTURER = 23
+DC_MODEL = 24
+DC_PERSONALITY = 25
+DC_PRINTRATE = 26
+DC_PRINTRATEUNIT = 27
+DC_PRINTERMEM = 28
+DC_MEDIAREADY = 29
+DC_STAPLE = 30
+DC_PRINTRATEPPM = 31
+DC_COLORDEVICE = 32
+DC_NUP = 33
+DC_MEDIATYPENAMES = 34
+DC_MEDIATYPES = 35
+
+PRINTRATEUNIT_PPM = 1
+PRINTRATEUNIT_CPS = 2
+PRINTRATEUNIT_LPM = 3
+PRINTRATEUNIT_IPM = 4
+
+# TrueType constants
+DCTT_BITMAP = 1
+DCTT_DOWNLOAD = 2
+DCTT_SUBDEV = 4
+DCTT_DOWNLOAD_OUTLINE = 8
+
+CA_NEGATIVE = 1
+CA_LOG_FILTER = 2
+ILLUMINANT_DEVICE_DEFAULT = 0
+ILLUMINANT_A = 1
+ILLUMINANT_B = 2
+ILLUMINANT_C = 3
+ILLUMINANT_D50 = 4
+ILLUMINANT_D55 = 5
+ILLUMINANT_D65 = 6
+ILLUMINANT_D75 = 7
+ILLUMINANT_F2 = 8
+ILLUMINANT_MAX_INDEX = ILLUMINANT_F2
+ILLUMINANT_TUNGSTEN = ILLUMINANT_A
+ILLUMINANT_DAYLIGHT = ILLUMINANT_C
+ILLUMINANT_FLUORESCENT = ILLUMINANT_F2
+ILLUMINANT_NTSC = ILLUMINANT_C
+
+# Generated by h2py from \msvcnt\include\wingdi.h
+# hacked and split manually by mhammond.
+FONTMAPPER_MAX = 10
+ENHMETA_SIGNATURE = 1179469088
+ENHMETA_STOCK_OBJECT = -2147483648
+EMR_HEADER = 1
+EMR_POLYBEZIER = 2
+EMR_POLYGON = 3
+EMR_POLYLINE = 4
+EMR_POLYBEZIERTO = 5
+EMR_POLYLINETO = 6
+EMR_POLYPOLYLINE = 7
+EMR_POLYPOLYGON = 8
+EMR_SETWINDOWEXTEX = 9
+EMR_SETWINDOWORGEX = 10
+EMR_SETVIEWPORTEXTEX = 11
+EMR_SETVIEWPORTORGEX = 12
+EMR_SETBRUSHORGEX = 13
+EMR_EOF = 14
+EMR_SETPIXELV = 15
+EMR_SETMAPPERFLAGS = 16
+EMR_SETMAPMODE = 17
+EMR_SETBKMODE = 18
+EMR_SETPOLYFILLMODE = 19
+EMR_SETROP2 = 20
+EMR_SETSTRETCHBLTMODE = 21
+EMR_SETTEXTALIGN = 22
+EMR_SETCOLORADJUSTMENT = 23
+EMR_SETTEXTCOLOR = 24
+EMR_SETBKCOLOR = 25
+EMR_OFFSETCLIPRGN = 26
+EMR_MOVETOEX = 27
+EMR_SETMETARGN = 28
+EMR_EXCLUDECLIPRECT = 29
+EMR_INTERSECTCLIPRECT = 30
+EMR_SCALEVIEWPORTEXTEX = 31
+EMR_SCALEWINDOWEXTEX = 32
+EMR_SAVEDC = 33
+EMR_RESTOREDC = 34
+EMR_SETWORLDTRANSFORM = 35
+EMR_MODIFYWORLDTRANSFORM = 36
+EMR_SELECTOBJECT = 37
+EMR_CREATEPEN = 38
+EMR_CREATEBRUSHINDIRECT = 39
+EMR_DELETEOBJECT = 40
+EMR_ANGLEARC = 41
+EMR_ELLIPSE = 42
+EMR_RECTANGLE = 43
+EMR_ROUNDRECT = 44
+EMR_ARC = 45
+EMR_CHORD = 46
+EMR_PIE = 47
+EMR_SELECTPALETTE = 48
+EMR_CREATEPALETTE = 49
+EMR_SETPALETTEENTRIES = 50
+EMR_RESIZEPALETTE = 51
+EMR_REALIZEPALETTE = 52
+EMR_EXTFLOODFILL = 53
+EMR_LINETO = 54
+EMR_ARCTO = 55
+EMR_POLYDRAW = 56
+EMR_SETARCDIRECTION = 57
+EMR_SETMITERLIMIT = 58
+EMR_BEGINPATH = 59
+EMR_ENDPATH = 60
+EMR_CLOSEFIGURE = 61
+EMR_FILLPATH = 62
+EMR_STROKEANDFILLPATH = 63
+EMR_STROKEPATH = 64
+EMR_FLATTENPATH = 65
+EMR_WIDENPATH = 66
+EMR_SELECTCLIPPATH = 67
+EMR_ABORTPATH = 68
+EMR_GDICOMMENT = 70
+EMR_FILLRGN = 71
+EMR_FRAMERGN = 72
+EMR_INVERTRGN = 73
+EMR_PAINTRGN = 74
+EMR_EXTSELECTCLIPRGN = 75
+EMR_BITBLT = 76
+EMR_STRETCHBLT = 77
+EMR_MASKBLT = 78
+EMR_PLGBLT = 79
+EMR_SETDIBITSTODEVICE = 80
+EMR_STRETCHDIBITS = 81
+EMR_EXTCREATEFONTINDIRECTW = 82
+EMR_EXTTEXTOUTA = 83
+EMR_EXTTEXTOUTW = 84
+EMR_POLYBEZIER16 = 85
+EMR_POLYGON16 = 86
+EMR_POLYLINE16 = 87
+EMR_POLYBEZIERTO16 = 88
+EMR_POLYLINETO16 = 89
+EMR_POLYPOLYLINE16 = 90
+EMR_POLYPOLYGON16 = 91
+EMR_POLYDRAW16 = 92
+EMR_CREATEMONOBRUSH = 93
+EMR_CREATEDIBPATTERNBRUSHPT = 94
+EMR_EXTCREATEPEN = 95
+EMR_POLYTEXTOUTA = 96
+EMR_POLYTEXTOUTW = 97
+EMR_MIN = 1
+EMR_MAX = 97
+# Generated by h2py from \msvcnt\include\wingdi.h
+# hacked and split manually by mhammond.
+PANOSE_COUNT = 10
+PAN_FAMILYTYPE_INDEX = 0
+PAN_SERIFSTYLE_INDEX = 1
+PAN_WEIGHT_INDEX = 2
+PAN_PROPORTION_INDEX = 3
+PAN_CONTRAST_INDEX = 4
+PAN_STROKEVARIATION_INDEX = 5
+PAN_ARMSTYLE_INDEX = 6
+PAN_LETTERFORM_INDEX = 7
+PAN_MIDLINE_INDEX = 8
+PAN_XHEIGHT_INDEX = 9
+PAN_CULTURE_LATIN = 0
+PAN_ANY = 0
+PAN_NO_FIT = 1
+PAN_FAMILY_TEXT_DISPLAY = 2
+PAN_FAMILY_SCRIPT = 3
+PAN_FAMILY_DECORATIVE = 4
+PAN_FAMILY_PICTORIAL = 5
+PAN_SERIF_COVE = 2
+PAN_SERIF_OBTUSE_COVE = 3
+PAN_SERIF_SQUARE_COVE = 4
+PAN_SERIF_OBTUSE_SQUARE_COVE = 5
+PAN_SERIF_SQUARE = 6
+PAN_SERIF_THIN = 7
+PAN_SERIF_BONE = 8
+PAN_SERIF_EXAGGERATED = 9
+PAN_SERIF_TRIANGLE = 10
+PAN_SERIF_NORMAL_SANS = 11
+PAN_SERIF_OBTUSE_SANS = 12
+PAN_SERIF_PERP_SANS = 13
+PAN_SERIF_FLARED = 14
+PAN_SERIF_ROUNDED = 15
+PAN_WEIGHT_VERY_LIGHT = 2
+PAN_WEIGHT_LIGHT = 3
+PAN_WEIGHT_THIN = 4
+PAN_WEIGHT_BOOK = 5
+PAN_WEIGHT_MEDIUM = 6
+PAN_WEIGHT_DEMI = 7
+PAN_WEIGHT_BOLD = 8
+PAN_WEIGHT_HEAVY = 9
+PAN_WEIGHT_BLACK = 10
+PAN_WEIGHT_NORD = 11
+PAN_PROP_OLD_STYLE = 2
+PAN_PROP_MODERN = 3
+PAN_PROP_EVEN_WIDTH = 4
+PAN_PROP_EXPANDED = 5
+PAN_PROP_CONDENSED = 6
+PAN_PROP_VERY_EXPANDED = 7
+PAN_PROP_VERY_CONDENSED = 8
+PAN_PROP_MONOSPACED = 9
+PAN_CONTRAST_NONE = 2
+PAN_CONTRAST_VERY_LOW = 3
+PAN_CONTRAST_LOW = 4
+PAN_CONTRAST_MEDIUM_LOW = 5
+PAN_CONTRAST_MEDIUM = 6
+PAN_CONTRAST_MEDIUM_HIGH = 7
+PAN_CONTRAST_HIGH = 8
+PAN_CONTRAST_VERY_HIGH = 9
+PAN_STROKE_GRADUAL_DIAG = 2
+PAN_STROKE_GRADUAL_TRAN = 3
+PAN_STROKE_GRADUAL_VERT = 4
+PAN_STROKE_GRADUAL_HORZ = 5
+PAN_STROKE_RAPID_VERT = 6
+PAN_STROKE_RAPID_HORZ = 7
+PAN_STROKE_INSTANT_VERT = 8
+PAN_STRAIGHT_ARMS_HORZ = 2
+PAN_STRAIGHT_ARMS_WEDGE = 3
+PAN_STRAIGHT_ARMS_VERT = 4
+PAN_STRAIGHT_ARMS_SINGLE_SERIF = 5
+PAN_STRAIGHT_ARMS_DOUBLE_SERIF = 6
+PAN_BENT_ARMS_HORZ = 7
+PAN_BENT_ARMS_WEDGE = 8
+PAN_BENT_ARMS_VERT = 9
+PAN_BENT_ARMS_SINGLE_SERIF = 10
+PAN_BENT_ARMS_DOUBLE_SERIF = 11
+PAN_LETT_NORMAL_CONTACT = 2
+PAN_LETT_NORMAL_WEIGHTED = 3
+PAN_LETT_NORMAL_BOXED = 4
+PAN_LETT_NORMAL_FLATTENED = 5
+PAN_LETT_NORMAL_ROUNDED = 6
+PAN_LETT_NORMAL_OFF_CENTER = 7
+PAN_LETT_NORMAL_SQUARE = 8
+PAN_LETT_OBLIQUE_CONTACT = 9
+PAN_LETT_OBLIQUE_WEIGHTED = 10
+PAN_LETT_OBLIQUE_BOXED = 11
+PAN_LETT_OBLIQUE_FLATTENED = 12
+PAN_LETT_OBLIQUE_ROUNDED = 13
+PAN_LETT_OBLIQUE_OFF_CENTER = 14
+PAN_LETT_OBLIQUE_SQUARE = 15
+PAN_MIDLINE_STANDARD_TRIMMED = 2
+PAN_MIDLINE_STANDARD_POINTED = 3
+PAN_MIDLINE_STANDARD_SERIFED = 4
+PAN_MIDLINE_HIGH_TRIMMED = 5
+PAN_MIDLINE_HIGH_POINTED = 6
+PAN_MIDLINE_HIGH_SERIFED = 7
+PAN_MIDLINE_CONSTANT_TRIMMED = 8
+PAN_MIDLINE_CONSTANT_POINTED = 9
+PAN_MIDLINE_CONSTANT_SERIFED = 10
+PAN_MIDLINE_LOW_TRIMMED = 11
+PAN_MIDLINE_LOW_POINTED = 12
+PAN_MIDLINE_LOW_SERIFED = 13
+PAN_XHEIGHT_CONSTANT_SMALL = 2
+PAN_XHEIGHT_CONSTANT_STD = 3
+PAN_XHEIGHT_CONSTANT_LARGE = 4
+PAN_XHEIGHT_DUCKING_SMALL = 5
+PAN_XHEIGHT_DUCKING_STD = 6
+PAN_XHEIGHT_DUCKING_LARGE = 7
+ELF_VENDOR_SIZE = 4
+ELF_VERSION = 0
+ELF_CULTURE_LATIN = 0
+RASTER_FONTTYPE = 1
+DEVICE_FONTTYPE = 2
+TRUETYPE_FONTTYPE = 4
+def PALETTEINDEX(i): return ((16777216 | (i)))
+
+PC_RESERVED = 1
+PC_EXPLICIT = 2
+PC_NOCOLLAPSE = 4
+def GetRValue(rgb): return rgb & 0xff
+
+def GetGValue(rgb): return (rgb >> 8) & 0xff
+
+def GetBValue(rgb): return (rgb >> 16) & 0xff
+
+TRANSPARENT = 1
+OPAQUE = 2
+BKMODE_LAST = 2
+GM_COMPATIBLE = 1
+GM_ADVANCED = 2
+GM_LAST = 2
+PT_CLOSEFIGURE = 1
+PT_LINETO = 2
+PT_BEZIERTO = 4
+PT_MOVETO = 6
+MM_TEXT = 1
+MM_LOMETRIC = 2
+MM_HIMETRIC = 3
+MM_LOENGLISH = 4
+MM_HIENGLISH = 5
+MM_TWIPS = 6
+MM_ISOTROPIC = 7
+MM_ANISOTROPIC = 8
+MM_MIN = MM_TEXT
+MM_MAX = MM_ANISOTROPIC
+MM_MAX_FIXEDSCALE = MM_TWIPS
+ABSOLUTE = 1
+RELATIVE = 2
+WHITE_BRUSH = 0
+LTGRAY_BRUSH = 1
+GRAY_BRUSH = 2
+DKGRAY_BRUSH = 3
+BLACK_BRUSH = 4
+NULL_BRUSH = 5
+HOLLOW_BRUSH = NULL_BRUSH
+WHITE_PEN = 6
+BLACK_PEN = 7
+NULL_PEN = 8
+OEM_FIXED_FONT = 10
+ANSI_FIXED_FONT = 11
+ANSI_VAR_FONT = 12
+SYSTEM_FONT = 13
+DEVICE_DEFAULT_FONT = 14
+DEFAULT_PALETTE = 15
+SYSTEM_FIXED_FONT = 16
+STOCK_LAST = 16
+CLR_INVALID = -1
+
+# Exception/Status codes from winuser.h and winnt.h
+STATUS_WAIT_0 = 0
+STATUS_ABANDONED_WAIT_0 = 128
+STATUS_USER_APC = 192
+STATUS_TIMEOUT = 258
+STATUS_PENDING = 259
+STATUS_SEGMENT_NOTIFICATION = 1073741829
+STATUS_GUARD_PAGE_VIOLATION = -2147483647
+STATUS_DATATYPE_MISALIGNMENT = -2147483646
+STATUS_BREAKPOINT = -2147483645
+STATUS_SINGLE_STEP = -2147483644
+STATUS_ACCESS_VIOLATION = -1073741819
+STATUS_IN_PAGE_ERROR = -1073741818
+STATUS_INVALID_HANDLE = -1073741816
+STATUS_NO_MEMORY = -1073741801
+STATUS_ILLEGAL_INSTRUCTION = -1073741795
+STATUS_NONCONTINUABLE_EXCEPTION = -1073741787
+STATUS_INVALID_DISPOSITION = -1073741786
+STATUS_ARRAY_BOUNDS_EXCEEDED = -1073741684
+STATUS_FLOAT_DENORMAL_OPERAND = -1073741683
+STATUS_FLOAT_DIVIDE_BY_ZERO = -1073741682
+STATUS_FLOAT_INEXACT_RESULT = -1073741681
+STATUS_FLOAT_INVALID_OPERATION = -1073741680
+STATUS_FLOAT_OVERFLOW = -1073741679
+STATUS_FLOAT_STACK_CHECK = -1073741678
+STATUS_FLOAT_UNDERFLOW = -1073741677
+STATUS_INTEGER_DIVIDE_BY_ZERO = -1073741676
+STATUS_INTEGER_OVERFLOW = -1073741675
+STATUS_PRIVILEGED_INSTRUCTION = -1073741674
+STATUS_STACK_OVERFLOW = -1073741571
+STATUS_CONTROL_C_EXIT = -1073741510
+
+
+WAIT_FAILED = -1
+WAIT_OBJECT_0 = STATUS_WAIT_0 + 0
+
+WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0 + 0
+WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0 + 0
+
+WAIT_TIMEOUT = STATUS_TIMEOUT
+WAIT_IO_COMPLETION = STATUS_USER_APC
+STILL_ACTIVE = STATUS_PENDING
+EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION
+EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT
+EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT
+EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP
+EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED
+EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND
+EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO
+EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT
+EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION
+EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW
+EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK
+EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW
+EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO
+EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW
+EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION
+EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR
+EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION
+EXCEPTION_NONCONTINUABLE_EXCEPTION = STATUS_NONCONTINUABLE_EXCEPTION
+EXCEPTION_STACK_OVERFLOW = STATUS_STACK_OVERFLOW
+EXCEPTION_INVALID_DISPOSITION = STATUS_INVALID_DISPOSITION
+EXCEPTION_GUARD_PAGE = STATUS_GUARD_PAGE_VIOLATION
+EXCEPTION_INVALID_HANDLE = STATUS_INVALID_HANDLE
+CONTROL_C_EXIT = STATUS_CONTROL_C_EXIT
+
+# winuser.h line 8594
+# constants used with SystemParametersInfo
+SPI_GETBEEP = 1
+SPI_SETBEEP = 2
+SPI_GETMOUSE = 3
+SPI_SETMOUSE = 4
+SPI_GETBORDER = 5
+SPI_SETBORDER = 6
+SPI_GETKEYBOARDSPEED = 10
+SPI_SETKEYBOARDSPEED = 11
+SPI_LANGDRIVER = 12
+SPI_ICONHORIZONTALSPACING = 13
+SPI_GETSCREENSAVETIMEOUT = 14
+SPI_SETSCREENSAVETIMEOUT = 15
+SPI_GETSCREENSAVEACTIVE = 16
+SPI_SETSCREENSAVEACTIVE = 17
+SPI_GETGRIDGRANULARITY = 18
+SPI_SETGRIDGRANULARITY = 19
+SPI_SETDESKWALLPAPER = 20
+SPI_SETDESKPATTERN = 21
+SPI_GETKEYBOARDDELAY = 22
+SPI_SETKEYBOARDDELAY = 23
+SPI_ICONVERTICALSPACING = 24
+SPI_GETICONTITLEWRAP = 25
+SPI_SETICONTITLEWRAP = 26
+SPI_GETMENUDROPALIGNMENT = 27
+SPI_SETMENUDROPALIGNMENT = 28
+SPI_SETDOUBLECLKWIDTH = 29
+SPI_SETDOUBLECLKHEIGHT = 30
+SPI_GETICONTITLELOGFONT = 31
+SPI_SETDOUBLECLICKTIME = 32
+SPI_SETMOUSEBUTTONSWAP = 33
+SPI_SETICONTITLELOGFONT = 34
+SPI_GETFASTTASKSWITCH = 35
+SPI_SETFASTTASKSWITCH = 36
+SPI_SETDRAGFULLWINDOWS = 37
+SPI_GETDRAGFULLWINDOWS = 38
+SPI_GETNONCLIENTMETRICS = 41
+SPI_SETNONCLIENTMETRICS = 42
+SPI_GETMINIMIZEDMETRICS = 43
+SPI_SETMINIMIZEDMETRICS = 44
+SPI_GETICONMETRICS = 45
+SPI_SETICONMETRICS = 46
+SPI_SETWORKAREA = 47
+SPI_GETWORKAREA = 48
+SPI_SETPENWINDOWS = 49
+SPI_GETFILTERKEYS = 50
+SPI_SETFILTERKEYS = 51
+SPI_GETTOGGLEKEYS = 52
+SPI_SETTOGGLEKEYS = 53
+SPI_GETMOUSEKEYS = 54
+SPI_SETMOUSEKEYS = 55
+SPI_GETSHOWSOUNDS = 56
+SPI_SETSHOWSOUNDS = 57
+SPI_GETSTICKYKEYS = 58
+SPI_SETSTICKYKEYS = 59
+SPI_GETACCESSTIMEOUT = 60
+SPI_SETACCESSTIMEOUT = 61
+SPI_GETSERIALKEYS = 62
+SPI_SETSERIALKEYS = 63
+SPI_GETSOUNDSENTRY = 64
+SPI_SETSOUNDSENTRY = 65
+SPI_GETHIGHCONTRAST = 66
+SPI_SETHIGHCONTRAST = 67
+SPI_GETKEYBOARDPREF = 68
+SPI_SETKEYBOARDPREF = 69
+SPI_GETSCREENREADER = 70
+SPI_SETSCREENREADER = 71
+SPI_GETANIMATION = 72
+SPI_SETANIMATION = 73
+SPI_GETFONTSMOOTHING = 74
+SPI_SETFONTSMOOTHING = 75
+SPI_SETDRAGWIDTH = 76
+SPI_SETDRAGHEIGHT = 77
+SPI_SETHANDHELD = 78
+SPI_GETLOWPOWERTIMEOUT = 79
+SPI_GETPOWEROFFTIMEOUT = 80
+SPI_SETLOWPOWERTIMEOUT = 81
+SPI_SETPOWEROFFTIMEOUT = 82
+SPI_GETLOWPOWERACTIVE = 83
+SPI_GETPOWEROFFACTIVE = 84
+SPI_SETLOWPOWERACTIVE = 85
+SPI_SETPOWEROFFACTIVE = 86
+SPI_SETCURSORS = 87
+SPI_SETICONS = 88
+SPI_GETDEFAULTINPUTLANG = 89
+SPI_SETDEFAULTINPUTLANG = 90
+SPI_SETLANGTOGGLE = 91
+SPI_GETWINDOWSEXTENSION = 92
+SPI_SETMOUSETRAILS = 93
+SPI_GETMOUSETRAILS = 94
+SPI_GETSNAPTODEFBUTTON = 95
+SPI_SETSNAPTODEFBUTTON = 96
+SPI_SETSCREENSAVERRUNNING = 97
+SPI_SCREENSAVERRUNNING = SPI_SETSCREENSAVERRUNNING
+SPI_GETMOUSEHOVERWIDTH = 98
+SPI_SETMOUSEHOVERWIDTH = 99
+SPI_GETMOUSEHOVERHEIGHT = 100
+SPI_SETMOUSEHOVERHEIGHT = 101
+SPI_GETMOUSEHOVERTIME = 102
+SPI_SETMOUSEHOVERTIME = 103
+SPI_GETWHEELSCROLLLINES = 104
+SPI_SETWHEELSCROLLLINES = 105
+SPI_GETMENUSHOWDELAY = 106
+SPI_SETMENUSHOWDELAY = 107
+
+SPI_GETSHOWIMEUI = 110
+SPI_SETSHOWIMEUI = 111
+SPI_GETMOUSESPEED = 112
+SPI_SETMOUSESPEED = 113
+SPI_GETSCREENSAVERRUNNING = 114
+SPI_GETDESKWALLPAPER = 115
+
+SPI_GETACTIVEWINDOWTRACKING = 4096
+SPI_SETACTIVEWINDOWTRACKING = 4097
+SPI_GETMENUANIMATION = 4098
+SPI_SETMENUANIMATION = 4099
+SPI_GETCOMBOBOXANIMATION = 4100
+SPI_SETCOMBOBOXANIMATION = 4101
+SPI_GETLISTBOXSMOOTHSCROLLING = 4102
+SPI_SETLISTBOXSMOOTHSCROLLING = 4103
+SPI_GETGRADIENTCAPTIONS = 4104
+SPI_SETGRADIENTCAPTIONS = 4105
+SPI_GETKEYBOARDCUES = 4106
+SPI_SETKEYBOARDCUES = 4107
+SPI_GETMENUUNDERLINES = 4106
+SPI_SETMENUUNDERLINES = 4107
+SPI_GETACTIVEWNDTRKZORDER = 4108
+SPI_SETACTIVEWNDTRKZORDER = 4109
+SPI_GETHOTTRACKING = 4110
+SPI_SETHOTTRACKING = 4111
+
+SPI_GETMENUFADE = 4114
+SPI_SETMENUFADE = 4115
+SPI_GETSELECTIONFADE = 4116
+SPI_SETSELECTIONFADE = 4117
+SPI_GETTOOLTIPANIMATION = 4118
+SPI_SETTOOLTIPANIMATION = 4119
+SPI_GETTOOLTIPFADE = 4120
+SPI_SETTOOLTIPFADE = 4121
+SPI_GETCURSORSHADOW = 4122
+SPI_SETCURSORSHADOW = 4123
+SPI_GETMOUSESONAR = 4124
+SPI_SETMOUSESONAR = 4125
+SPI_GETMOUSECLICKLOCK = 4126
+SPI_SETMOUSECLICKLOCK = 4127
+SPI_GETMOUSEVANISH = 4128
+SPI_SETMOUSEVANISH = 4129
+SPI_GETFLATMENU = 4130
+SPI_SETFLATMENU = 4131
+SPI_GETDROPSHADOW = 4132
+SPI_SETDROPSHADOW = 4133
+SPI_GETBLOCKSENDINPUTRESETS = 4134
+SPI_SETBLOCKSENDINPUTRESETS = 4135
+SPI_GETUIEFFECTS = 4158
+SPI_SETUIEFFECTS = 4159
+
+SPI_GETFOREGROUNDLOCKTIMEOUT = 8192
+SPI_SETFOREGROUNDLOCKTIMEOUT = 8193
+SPI_GETACTIVEWNDTRKTIMEOUT = 8194
+SPI_SETACTIVEWNDTRKTIMEOUT = 8195
+SPI_GETFOREGROUNDFLASHCOUNT = 8196
+SPI_SETFOREGROUNDFLASHCOUNT = 8197
+SPI_GETCARETWIDTH = 8198
+SPI_SETCARETWIDTH = 8199
+SPI_GETMOUSECLICKLOCKTIME = 8200
+SPI_SETMOUSECLICKLOCKTIME = 8201
+SPI_GETFONTSMOOTHINGTYPE = 8202
+SPI_SETFONTSMOOTHINGTYPE = 8203
+SPI_GETFONTSMOOTHINGCONTRAST = 8204
+SPI_SETFONTSMOOTHINGCONTRAST = 8205
+SPI_GETFOCUSBORDERWIDTH = 8206
+SPI_SETFOCUSBORDERWIDTH = 8207
+SPI_GETFOCUSBORDERHEIGHT = 8208
+SPI_SETFOCUSBORDERHEIGHT = 8209
+SPI_GETFONTSMOOTHINGORIENTATION = 8210
+SPI_SETFONTSMOOTHINGORIENTATION = 8211
+
+# fWinIni flags for SystemParametersInfo
+SPIF_UPDATEINIFILE = 1
+SPIF_SENDWININICHANGE = 2
+SPIF_SENDCHANGE = SPIF_SENDWININICHANGE
+
+# used with SystemParametersInfo and SPI_GETFONTSMOOTHINGTYPE/SPI_SETFONTSMOOTHINGTYPE
+FE_FONTSMOOTHINGSTANDARD = 1
+FE_FONTSMOOTHINGCLEARTYPE = 2
+FE_FONTSMOOTHINGDOCKING = 32768
+
+METRICS_USEDEFAULT = -1
+ARW_BOTTOMLEFT = 0
+ARW_BOTTOMRIGHT = 1
+ARW_TOPLEFT = 2
+ARW_TOPRIGHT = 3
+ARW_STARTMASK = 3
+ARW_STARTRIGHT = 1
+ARW_STARTTOP = 2
+ARW_LEFT = 0
+ARW_RIGHT = 0
+ARW_UP = 4
+ARW_DOWN = 4
+ARW_HIDE = 8
+#ARW_VALID = 0x000F
+SERKF_SERIALKEYSON = 1
+SERKF_AVAILABLE = 2
+SERKF_INDICATOR = 4
+HCF_HIGHCONTRASTON = 1
+HCF_AVAILABLE = 2
+HCF_HOTKEYACTIVE = 4
+HCF_CONFIRMHOTKEY = 8
+HCF_HOTKEYSOUND = 16
+HCF_INDICATOR = 32
+HCF_HOTKEYAVAILABLE = 64
+CDS_UPDATEREGISTRY = 1
+CDS_TEST = 2
+CDS_FULLSCREEN = 4
+CDS_GLOBAL = 8
+CDS_SET_PRIMARY = 16
+CDS_RESET = 1073741824
+CDS_SETRECT = 536870912
+CDS_NORESET = 268435456
+
+# return values from ChangeDisplaySettings and ChangeDisplaySettingsEx
+DISP_CHANGE_SUCCESSFUL = 0
+DISP_CHANGE_RESTART = 1
+DISP_CHANGE_FAILED = -1
+DISP_CHANGE_BADMODE = -2
+DISP_CHANGE_NOTUPDATED = -3
+DISP_CHANGE_BADFLAGS = -4
+DISP_CHANGE_BADPARAM = -5
+DISP_CHANGE_BADDUALVIEW = -6
+
+ENUM_CURRENT_SETTINGS = -1
+ENUM_REGISTRY_SETTINGS = -2
+FKF_FILTERKEYSON = 1
+FKF_AVAILABLE = 2
+FKF_HOTKEYACTIVE = 4
+FKF_CONFIRMHOTKEY = 8
+FKF_HOTKEYSOUND = 16
+FKF_INDICATOR = 32
+FKF_CLICKON = 64
+SKF_STICKYKEYSON = 1
+SKF_AVAILABLE = 2
+SKF_HOTKEYACTIVE = 4
+SKF_CONFIRMHOTKEY = 8
+SKF_HOTKEYSOUND = 16
+SKF_INDICATOR = 32
+SKF_AUDIBLEFEEDBACK = 64
+SKF_TRISTATE = 128
+SKF_TWOKEYSOFF = 256
+SKF_LALTLATCHED = 268435456
+SKF_LCTLLATCHED = 67108864
+SKF_LSHIFTLATCHED = 16777216
+SKF_RALTLATCHED = 536870912
+SKF_RCTLLATCHED = 134217728
+SKF_RSHIFTLATCHED = 33554432
+SKF_LWINLATCHED = 1073741824
+SKF_RWINLATCHED = -2147483648
+SKF_LALTLOCKED = 1048576
+SKF_LCTLLOCKED = 262144
+SKF_LSHIFTLOCKED = 65536
+SKF_RALTLOCKED = 2097152
+SKF_RCTLLOCKED = 524288
+SKF_RSHIFTLOCKED = 131072
+SKF_LWINLOCKED = 4194304
+SKF_RWINLOCKED = 8388608
+MKF_MOUSEKEYSON = 1
+MKF_AVAILABLE = 2
+MKF_HOTKEYACTIVE = 4
+MKF_CONFIRMHOTKEY = 8
+MKF_HOTKEYSOUND = 16
+MKF_INDICATOR = 32
+MKF_MODIFIERS = 64
+MKF_REPLACENUMBERS = 128
+MKF_LEFTBUTTONSEL = 268435456
+MKF_RIGHTBUTTONSEL = 536870912
+MKF_LEFTBUTTONDOWN = 16777216
+MKF_RIGHTBUTTONDOWN = 33554432
+MKF_MOUSEMODE = -2147483648
+ATF_TIMEOUTON = 1
+ATF_ONOFFFEEDBACK = 2
+SSGF_NONE = 0
+SSGF_DISPLAY = 3
+SSTF_NONE = 0
+SSTF_CHARS = 1
+SSTF_BORDER = 2
+SSTF_DISPLAY = 3
+SSWF_NONE = 0
+SSWF_TITLE = 1
+SSWF_WINDOW = 2
+SSWF_DISPLAY = 3
+SSWF_CUSTOM = 4
+SSF_SOUNDSENTRYON = 1
+SSF_AVAILABLE = 2
+SSF_INDICATOR = 4
+TKF_TOGGLEKEYSON = 1
+TKF_AVAILABLE = 2
+TKF_HOTKEYACTIVE = 4
+TKF_CONFIRMHOTKEY = 8
+TKF_HOTKEYSOUND = 16
+TKF_INDICATOR = 32
+SLE_ERROR = 1
+SLE_MINORERROR = 2
+SLE_WARNING = 3
+MONITOR_DEFAULTTONULL = 0
+MONITOR_DEFAULTTOPRIMARY = 1
+MONITOR_DEFAULTTONEAREST = 2
+MONITORINFOF_PRIMARY = 1
+CCHDEVICENAME = 32
+CHILDID_SELF = 0
+INDEXID_OBJECT = 0
+INDEXID_CONTAINER = 0
+OBJID_WINDOW = 0
+OBJID_SYSMENU = -1
+OBJID_TITLEBAR = -2
+OBJID_MENU = -3
+OBJID_CLIENT = -4
+OBJID_VSCROLL = -5
+OBJID_HSCROLL = -6
+OBJID_SIZEGRIP = -7
+OBJID_CARET = -8
+OBJID_CURSOR = -9
+OBJID_ALERT = -10
+OBJID_SOUND = -11
+EVENT_MIN = 1
+EVENT_MAX = 2147483647
+EVENT_SYSTEM_SOUND = 1
+EVENT_SYSTEM_ALERT = 2
+EVENT_SYSTEM_FOREGROUND = 3
+EVENT_SYSTEM_MENUSTART = 4
+EVENT_SYSTEM_MENUEND = 5
+EVENT_SYSTEM_MENUPOPUPSTART = 6
+EVENT_SYSTEM_MENUPOPUPEND = 7
+EVENT_SYSTEM_CAPTURESTART = 8
+EVENT_SYSTEM_CAPTUREEND = 9
+EVENT_SYSTEM_MOVESIZESTART = 10
+EVENT_SYSTEM_MOVESIZEEND = 11
+EVENT_SYSTEM_CONTEXTHELPSTART = 12
+EVENT_SYSTEM_CONTEXTHELPEND = 13
+EVENT_SYSTEM_DRAGDROPSTART = 14
+EVENT_SYSTEM_DRAGDROPEND = 15
+EVENT_SYSTEM_DIALOGSTART = 16
+EVENT_SYSTEM_DIALOGEND = 17
+EVENT_SYSTEM_SCROLLINGSTART = 18
+EVENT_SYSTEM_SCROLLINGEND = 19
+EVENT_SYSTEM_SWITCHSTART = 20
+EVENT_SYSTEM_SWITCHEND = 21
+EVENT_SYSTEM_MINIMIZESTART = 22
+EVENT_SYSTEM_MINIMIZEEND = 23
+EVENT_OBJECT_CREATE = 32768
+EVENT_OBJECT_DESTROY = 32769
+EVENT_OBJECT_SHOW = 32770
+EVENT_OBJECT_HIDE = 32771
+EVENT_OBJECT_REORDER = 32772
+EVENT_OBJECT_FOCUS = 32773
+EVENT_OBJECT_SELECTION = 32774
+EVENT_OBJECT_SELECTIONADD = 32775
+EVENT_OBJECT_SELECTIONREMOVE = 32776
+EVENT_OBJECT_SELECTIONWITHIN = 32777
+EVENT_OBJECT_STATECHANGE = 32778
+EVENT_OBJECT_LOCATIONCHANGE = 32779
+EVENT_OBJECT_NAMECHANGE = 32780
+EVENT_OBJECT_DESCRIPTIONCHANGE = 32781
+EVENT_OBJECT_VALUECHANGE = 32782
+EVENT_OBJECT_PARENTCHANGE = 32783
+EVENT_OBJECT_HELPCHANGE = 32784
+EVENT_OBJECT_DEFACTIONCHANGE = 32785
+EVENT_OBJECT_ACCELERATORCHANGE = 32786
+SOUND_SYSTEM_STARTUP = 1
+SOUND_SYSTEM_SHUTDOWN = 2
+SOUND_SYSTEM_BEEP = 3
+SOUND_SYSTEM_ERROR = 4
+SOUND_SYSTEM_QUESTION = 5
+SOUND_SYSTEM_WARNING = 6
+SOUND_SYSTEM_INFORMATION = 7
+SOUND_SYSTEM_MAXIMIZE = 8
+SOUND_SYSTEM_MINIMIZE = 9
+SOUND_SYSTEM_RESTOREUP = 10
+SOUND_SYSTEM_RESTOREDOWN = 11
+SOUND_SYSTEM_APPSTART = 12
+SOUND_SYSTEM_FAULT = 13
+SOUND_SYSTEM_APPEND = 14
+SOUND_SYSTEM_MENUCOMMAND = 15
+SOUND_SYSTEM_MENUPOPUP = 16
+CSOUND_SYSTEM = 16
+ALERT_SYSTEM_INFORMATIONAL = 1
+ALERT_SYSTEM_WARNING = 2
+ALERT_SYSTEM_ERROR = 3
+ALERT_SYSTEM_QUERY = 4
+ALERT_SYSTEM_CRITICAL = 5
+CALERT_SYSTEM = 6
+WINEVENT_OUTOFCONTEXT = 0
+WINEVENT_SKIPOWNTHREAD = 1
+WINEVENT_SKIPOWNPROCESS = 2
+WINEVENT_INCONTEXT = 4
+GUI_CARETBLINKING = 1
+GUI_INMOVESIZE = 2
+GUI_INMENUMODE = 4
+GUI_SYSTEMMENUMODE = 8
+GUI_POPUPMENUMODE = 16
+STATE_SYSTEM_UNAVAILABLE = 1
+STATE_SYSTEM_SELECTED = 2
+STATE_SYSTEM_FOCUSED = 4
+STATE_SYSTEM_PRESSED = 8
+STATE_SYSTEM_CHECKED = 16
+STATE_SYSTEM_MIXED = 32
+STATE_SYSTEM_READONLY = 64
+STATE_SYSTEM_HOTTRACKED = 128
+STATE_SYSTEM_DEFAULT = 256
+STATE_SYSTEM_EXPANDED = 512
+STATE_SYSTEM_COLLAPSED = 1024
+STATE_SYSTEM_BUSY = 2048
+STATE_SYSTEM_FLOATING = 4096
+STATE_SYSTEM_MARQUEED = 8192
+STATE_SYSTEM_ANIMATED = 16384
+STATE_SYSTEM_INVISIBLE = 32768
+STATE_SYSTEM_OFFSCREEN = 65536
+STATE_SYSTEM_SIZEABLE = 131072
+STATE_SYSTEM_MOVEABLE = 262144
+STATE_SYSTEM_SELFVOICING = 524288
+STATE_SYSTEM_FOCUSABLE = 1048576
+STATE_SYSTEM_SELECTABLE = 2097152
+STATE_SYSTEM_LINKED = 4194304
+STATE_SYSTEM_TRAVERSED = 8388608
+STATE_SYSTEM_MULTISELECTABLE = 16777216
+STATE_SYSTEM_EXTSELECTABLE = 33554432
+STATE_SYSTEM_ALERT_LOW = 67108864
+STATE_SYSTEM_ALERT_MEDIUM = 134217728
+STATE_SYSTEM_ALERT_HIGH = 268435456
+STATE_SYSTEM_VALID = 536870911
+CCHILDREN_TITLEBAR = 5
+CCHILDREN_SCROLLBAR = 5
+CURSOR_SHOWING = 1
+WS_ACTIVECAPTION = 1
+GA_MIC = 1
+GA_PARENT = 1
+GA_ROOT = 2
+GA_ROOTOWNER = 3
+GA_MAC = 4
+
+# winuser.h line 1979
+BF_LEFT = 1
+BF_TOP = 2
+BF_RIGHT = 4
+BF_BOTTOM = 8
+BF_TOPLEFT = (BF_TOP | BF_LEFT)
+BF_TOPRIGHT = (BF_TOP | BF_RIGHT)
+BF_BOTTOMLEFT = (BF_BOTTOM | BF_LEFT)
+BF_BOTTOMRIGHT = (BF_BOTTOM | BF_RIGHT)
+BF_RECT = (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM)
+BF_DIAGONAL = 16
+BF_DIAGONAL_ENDTOPRIGHT = (BF_DIAGONAL | BF_TOP | BF_RIGHT)
+BF_DIAGONAL_ENDTOPLEFT = (BF_DIAGONAL | BF_TOP | BF_LEFT)
+BF_DIAGONAL_ENDBOTTOMLEFT = (BF_DIAGONAL | BF_BOTTOM | BF_LEFT)
+BF_DIAGONAL_ENDBOTTOMRIGHT = (BF_DIAGONAL | BF_BOTTOM | BF_RIGHT)
+BF_MIDDLE = 2048
+BF_SOFT = 4096
+BF_ADJUST = 8192
+BF_FLAT = 16384
+BF_MONO = 32768
+DFC_CAPTION = 1
+DFC_MENU = 2
+DFC_SCROLL = 3
+DFC_BUTTON = 4
+DFC_POPUPMENU = 5
+DFCS_CAPTIONCLOSE = 0
+DFCS_CAPTIONMIN = 1
+DFCS_CAPTIONMAX = 2
+DFCS_CAPTIONRESTORE = 3
+DFCS_CAPTIONHELP = 4
+DFCS_MENUARROW = 0
+DFCS_MENUCHECK = 1
+DFCS_MENUBULLET = 2
+DFCS_MENUARROWRIGHT = 4
+DFCS_SCROLLUP = 0
+DFCS_SCROLLDOWN = 1
+DFCS_SCROLLLEFT = 2
+DFCS_SCROLLRIGHT = 3
+DFCS_SCROLLCOMBOBOX = 5
+DFCS_SCROLLSIZEGRIP = 8
+DFCS_SCROLLSIZEGRIPRIGHT = 16
+DFCS_BUTTONCHECK = 0
+DFCS_BUTTONRADIOIMAGE = 1
+DFCS_BUTTONRADIOMASK = 2
+DFCS_BUTTONRADIO = 4
+DFCS_BUTTON3STATE = 8
+DFCS_BUTTONPUSH = 16
+DFCS_INACTIVE = 256
+DFCS_PUSHED = 512
+DFCS_CHECKED = 1024
+DFCS_TRANSPARENT = 2048
+DFCS_HOT = 4096
+DFCS_ADJUSTRECT = 8192
+DFCS_FLAT = 16384
+DFCS_MONO = 32768
+DC_ACTIVE = 1
+DC_SMALLCAP = 2
+DC_ICON = 4
+DC_TEXT = 8
+DC_INBUTTON = 16
+DC_GRADIENT = 32
+IDANI_OPEN = 1
+IDANI_CLOSE = 2
+IDANI_CAPTION = 3
+CF_TEXT = 1
+CF_BITMAP = 2
+CF_METAFILEPICT = 3
+CF_SYLK = 4
+CF_DIF = 5
+CF_TIFF = 6
+CF_OEMTEXT = 7
+CF_DIB = 8
+CF_PALETTE = 9
+CF_PENDATA = 10
+CF_RIFF = 11
+CF_WAVE = 12
+CF_UNICODETEXT = 13
+CF_ENHMETAFILE = 14
+CF_HDROP = 15
+CF_LOCALE = 16
+CF_MAX = 17
+CF_OWNERDISPLAY = 128
+CF_DSPTEXT = 129
+CF_DSPBITMAP = 130
+CF_DSPMETAFILEPICT = 131
+CF_DSPENHMETAFILE = 142
+CF_PRIVATEFIRST = 512
+CF_PRIVATELAST = 767
+CF_GDIOBJFIRST = 768
+CF_GDIOBJLAST = 1023
+FVIRTKEY =1
+FNOINVERT = 2
+FSHIFT = 4
+FCONTROL = 8
+FALT = 16
+WPF_SETMINPOSITION = 1
+WPF_RESTORETOMAXIMIZED = 2
+ODT_MENU = 1
+ODT_LISTBOX = 2
+ODT_COMBOBOX = 3
+ODT_BUTTON = 4
+ODT_STATIC = 5
+ODA_DRAWENTIRE = 1
+ODA_SELECT = 2
+ODA_FOCUS = 4
+ODS_SELECTED = 1
+ODS_GRAYED = 2
+ODS_DISABLED = 4
+ODS_CHECKED = 8
+ODS_FOCUS = 16
+ODS_DEFAULT = 32
+ODS_COMBOBOXEDIT = 4096
+ODS_HOTLIGHT = 64
+ODS_INACTIVE = 128
+PM_NOREMOVE = 0
+PM_REMOVE = 1
+PM_NOYIELD = 2
+# Name clashes with key.MOD_ALT, key.MOD_CONTROL and key.MOD_SHIFT
+WIN32_MOD_ALT = 1
+WIN32_MOD_CONTROL = 2
+WIN32_MOD_SHIFT = 4
+WIN32_MOD_WIN = 8
+IDHOT_SNAPWINDOW = (-1)
+IDHOT_SNAPDESKTOP = (-2)
+#EW_RESTARTWINDOWS = 0x0042
+#EW_REBOOTSYSTEM = 0x0043
+#EW_EXITANDEXECAPP = 0x0044
+ENDSESSION_LOGOFF = -2147483648
+EWX_LOGOFF = 0
+EWX_SHUTDOWN = 1
+EWX_REBOOT = 2
+EWX_FORCE = 4
+EWX_POWEROFF = 8
+EWX_FORCEIFHUNG = 16
+BSM_ALLCOMPONENTS = 0
+BSM_VXDS = 1
+BSM_NETDRIVER = 2
+BSM_INSTALLABLEDRIVERS = 4
+BSM_APPLICATIONS = 8
+BSM_ALLDESKTOPS = 16
+BSF_QUERY = 1
+BSF_IGNORECURRENTTASK = 2
+BSF_FLUSHDISK = 4
+BSF_NOHANG = 8
+BSF_POSTMESSAGE = 16
+BSF_FORCEIFHUNG = 32
+BSF_NOTIMEOUTIFNOTHUNG = 64
+BROADCAST_QUERY_DENY = 1112363332 # Return this value to deny a query.
+
+DBWF_LPARAMPOINTER = 32768
+
+# winuser.h line 3232
+SWP_NOSIZE = 1
+SWP_NOMOVE = 2
+SWP_NOZORDER = 4
+SWP_NOREDRAW = 8
+SWP_NOACTIVATE = 16
+SWP_FRAMECHANGED = 32
+SWP_SHOWWINDOW = 64
+SWP_HIDEWINDOW = 128
+SWP_NOCOPYBITS = 256
+SWP_NOOWNERZORDER = 512
+SWP_NOSENDCHANGING = 1024
+SWP_DRAWFRAME = SWP_FRAMECHANGED
+SWP_NOREPOSITION = SWP_NOOWNERZORDER
+SWP_DEFERERASE = 8192
+SWP_ASYNCWINDOWPOS = 16384
+
+DLGWINDOWEXTRA = 30
+# winuser.h line 4249
+KEYEVENTF_EXTENDEDKEY = 1
+KEYEVENTF_KEYUP = 2
+MOUSEEVENTF_MOVE = 1
+MOUSEEVENTF_LEFTDOWN = 2
+MOUSEEVENTF_LEFTUP = 4
+MOUSEEVENTF_RIGHTDOWN = 8
+MOUSEEVENTF_RIGHTUP = 16
+MOUSEEVENTF_MIDDLEDOWN = 32
+MOUSEEVENTF_MIDDLEUP = 64
+MOUSEEVENTF_ABSOLUTE = 32768
+INPUT_MOUSE = 0
+INPUT_KEYBOARD = 1
+INPUT_HARDWARE = 2
+MWMO_WAITALL = 1
+MWMO_ALERTABLE = 2
+MWMO_INPUTAVAILABLE = 4
+QS_KEY = 1
+QS_MOUSEMOVE = 2
+QS_MOUSEBUTTON = 4
+QS_POSTMESSAGE = 8
+QS_TIMER = 16
+QS_PAINT = 32
+QS_SENDMESSAGE = 64
+QS_HOTKEY = 128
+QS_RAWINPUT = 0x400
+QS_MOUSE = (QS_MOUSEMOVE |
+ QS_MOUSEBUTTON)
+QS_INPUT = (QS_MOUSE |
+ QS_KEY |
+ QS_RAWINPUT)
+QS_ALLEVENTS = (QS_INPUT |
+ QS_POSTMESSAGE |
+ QS_TIMER |
+ QS_PAINT |
+ QS_HOTKEY)
+QS_ALLINPUT = (QS_INPUT |
+ QS_POSTMESSAGE |
+ QS_TIMER |
+ QS_PAINT |
+ QS_HOTKEY |
+ QS_SENDMESSAGE)
+
+
+IMN_CLOSESTATUSWINDOW = 1
+IMN_OPENSTATUSWINDOW = 2
+IMN_CHANGECANDIDATE = 3
+IMN_CLOSECANDIDATE = 4
+IMN_OPENCANDIDATE = 5
+IMN_SETCONVERSIONMODE = 6
+IMN_SETSENTENCEMODE = 7
+IMN_SETOPENSTATUS = 8
+IMN_SETCANDIDATEPOS = 9
+IMN_SETCOMPOSITIONFONT = 10
+IMN_SETCOMPOSITIONWINDOW = 11
+IMN_SETSTATUSWINDOWPOS = 12
+IMN_GUIDELINE = 13
+IMN_PRIVATE = 14
+
+# winuser.h line 8518
+HELP_CONTEXT = 1
+HELP_QUIT = 2
+HELP_INDEX = 3
+HELP_CONTENTS = 3
+HELP_HELPONHELP = 4
+HELP_SETINDEX = 5
+HELP_SETCONTENTS = 5
+HELP_CONTEXTPOPUP = 8
+HELP_FORCEFILE = 9
+HELP_KEY = 257
+HELP_COMMAND = 258
+HELP_PARTIALKEY = 261
+HELP_MULTIKEY = 513
+HELP_SETWINPOS = 515
+HELP_CONTEXTMENU = 10
+HELP_FINDER = 11
+HELP_WM_HELP = 12
+HELP_SETPOPUP_POS = 13
+HELP_TCARD = 32768
+HELP_TCARD_DATA = 16
+HELP_TCARD_OTHER_CALLER = 17
+IDH_NO_HELP = 28440
+IDH_MISSING_CONTEXT = 28441 # Control doesn't have matching help context
+IDH_GENERIC_HELP_BUTTON = 28442 # Property sheet help button
+IDH_OK = 28443
+IDH_CANCEL = 28444
+IDH_HELP = 28445
+GR_GDIOBJECTS = 0 # Count of GDI objects
+GR_USEROBJECTS = 1 # Count of USER objects
+# Generated by h2py from \msvcnt\include\wingdi.h
+# manually added (missed by generation some how!
+SRCCOPY = 13369376 # dest = source
+SRCPAINT = 15597702 # dest = source OR dest
+SRCAND = 8913094 # dest = source AND dest
+SRCINVERT = 6684742 # dest = source XOR dest
+SRCERASE = 4457256 # dest = source AND (NOT dest )
+NOTSRCCOPY = 3342344 # dest = (NOT source)
+NOTSRCERASE = 1114278 # dest = (NOT src) AND (NOT dest)
+MERGECOPY = 12583114 # dest = (source AND pattern)
+MERGEPAINT = 12255782 # dest = (NOT source) OR dest
+PATCOPY = 15728673 # dest = pattern
+PATPAINT = 16452105 # dest = DPSnoo
+PATINVERT = 5898313 # dest = pattern XOR dest
+DSTINVERT = 5570569 # dest = (NOT dest)
+BLACKNESS = 66 # dest = BLACK
+WHITENESS = 16711778 # dest = WHITE
+
+# hacked and split manually by mhammond.
+R2_BLACK = 1
+R2_NOTMERGEPEN = 2
+R2_MASKNOTPEN = 3
+R2_NOTCOPYPEN = 4
+R2_MASKPENNOT = 5
+R2_NOT = 6
+R2_XORPEN = 7
+R2_NOTMASKPEN = 8
+R2_MASKPEN = 9
+R2_NOTXORPEN = 10
+R2_NOP = 11
+R2_MERGENOTPEN = 12
+R2_COPYPEN = 13
+R2_MERGEPENNOT = 14
+R2_MERGEPEN = 15
+R2_WHITE = 16
+R2_LAST = 16
+GDI_ERROR = (-1)
+ERROR = 0
+NULLREGION = 1
+SIMPLEREGION = 2
+COMPLEXREGION = 3
+RGN_ERROR = ERROR
+RGN_AND = 1
+RGN_OR = 2
+RGN_XOR = 3
+RGN_DIFF = 4
+RGN_COPY = 5
+RGN_MIN = RGN_AND
+RGN_MAX = RGN_COPY
+BLACKONWHITE = 1
+WHITEONBLACK = 2
+COLORONCOLOR = 3
+HALFTONE = 4
+MAXSTRETCHBLTMODE = 4
+ALTERNATE = 1
+WINDING = 2
+POLYFILL_LAST = 2
+TA_NOUPDATECP = 0
+TA_UPDATECP = 1
+TA_LEFT = 0
+TA_RIGHT = 2
+TA_CENTER = 6
+TA_TOP = 0
+TA_BOTTOM = 8
+TA_BASELINE = 24
+TA_MASK = (TA_BASELINE+TA_CENTER+TA_UPDATECP)
+VTA_BASELINE = TA_BASELINE
+VTA_LEFT = TA_BOTTOM
+VTA_RIGHT = TA_TOP
+VTA_CENTER = TA_CENTER
+VTA_BOTTOM = TA_RIGHT
+VTA_TOP = TA_LEFT
+ETO_GRAYED = 1
+ETO_OPAQUE = 2
+ETO_CLIPPED = 4
+ASPECT_FILTERING = 1
+DCB_RESET = 1
+DCB_ACCUMULATE = 2
+DCB_DIRTY = DCB_ACCUMULATE
+DCB_SET = (DCB_RESET | DCB_ACCUMULATE)
+DCB_ENABLE = 4
+DCB_DISABLE = 8
+META_SETBKCOLOR = 513
+META_SETBKMODE = 258
+META_SETMAPMODE = 259
+META_SETROP2 = 260
+META_SETRELABS = 261
+META_SETPOLYFILLMODE = 262
+META_SETSTRETCHBLTMODE = 263
+META_SETTEXTCHAREXTRA = 264
+META_SETTEXTCOLOR = 521
+META_SETTEXTJUSTIFICATION = 522
+META_SETWINDOWORG = 523
+META_SETWINDOWEXT = 524
+META_SETVIEWPORTORG = 525
+META_SETVIEWPORTEXT = 526
+META_OFFSETWINDOWORG = 527
+META_SCALEWINDOWEXT = 1040
+META_OFFSETVIEWPORTORG = 529
+META_SCALEVIEWPORTEXT = 1042
+META_LINETO = 531
+META_MOVETO = 532
+META_EXCLUDECLIPRECT = 1045
+META_INTERSECTCLIPRECT = 1046
+META_ARC = 2071
+META_ELLIPSE = 1048
+META_FLOODFILL = 1049
+META_PIE = 2074
+META_RECTANGLE = 1051
+META_ROUNDRECT = 1564
+META_PATBLT = 1565
+META_SAVEDC = 30
+META_SETPIXEL = 1055
+META_OFFSETCLIPRGN = 544
+META_TEXTOUT = 1313
+META_BITBLT = 2338
+META_STRETCHBLT = 2851
+META_POLYGON = 804
+META_POLYLINE = 805
+META_ESCAPE = 1574
+META_RESTOREDC = 295
+META_FILLREGION = 552
+META_FRAMEREGION = 1065
+META_INVERTREGION = 298
+META_PAINTREGION = 299
+META_SELECTCLIPREGION = 300
+META_SELECTOBJECT = 301
+META_SETTEXTALIGN = 302
+META_CHORD = 2096
+META_SETMAPPERFLAGS = 561
+META_EXTTEXTOUT = 2610
+META_SETDIBTODEV = 3379
+META_SELECTPALETTE = 564
+META_REALIZEPALETTE = 53
+META_ANIMATEPALETTE = 1078
+META_SETPALENTRIES = 55
+META_POLYPOLYGON = 1336
+META_RESIZEPALETTE = 313
+META_DIBBITBLT = 2368
+META_DIBSTRETCHBLT = 2881
+META_DIBCREATEPATTERNBRUSH = 322
+META_STRETCHDIB = 3907
+META_EXTFLOODFILL = 1352
+META_DELETEOBJECT = 496
+META_CREATEPALETTE = 247
+META_CREATEPATTERNBRUSH = 505
+META_CREATEPENINDIRECT = 762
+META_CREATEFONTINDIRECT = 763
+META_CREATEBRUSHINDIRECT = 764
+META_CREATEREGION = 1791
+FILE_BEGIN = 0
+FILE_CURRENT = 1
+FILE_END = 2
+FILE_FLAG_WRITE_THROUGH = -2147483648
+FILE_FLAG_OVERLAPPED = 1073741824
+FILE_FLAG_NO_BUFFERING = 536870912
+FILE_FLAG_RANDOM_ACCESS = 268435456
+FILE_FLAG_SEQUENTIAL_SCAN = 134217728
+FILE_FLAG_DELETE_ON_CLOSE = 67108864
+FILE_FLAG_BACKUP_SEMANTICS = 33554432
+FILE_FLAG_POSIX_SEMANTICS = 16777216
+CREATE_NEW = 1
+CREATE_ALWAYS = 2
+OPEN_EXISTING = 3
+OPEN_ALWAYS = 4
+TRUNCATE_EXISTING = 5
+PIPE_ACCESS_INBOUND = 1
+PIPE_ACCESS_OUTBOUND = 2
+PIPE_ACCESS_DUPLEX = 3
+PIPE_CLIENT_END = 0
+PIPE_SERVER_END = 1
+PIPE_WAIT = 0
+PIPE_NOWAIT = 1
+PIPE_READMODE_BYTE = 0
+PIPE_READMODE_MESSAGE = 2
+PIPE_TYPE_BYTE = 0
+PIPE_TYPE_MESSAGE = 4
+PIPE_UNLIMITED_INSTANCES = 255
+SECURITY_CONTEXT_TRACKING = 262144
+SECURITY_EFFECTIVE_ONLY = 524288
+SECURITY_SQOS_PRESENT = 1048576
+SECURITY_VALID_SQOS_FLAGS = 2031616
+DTR_CONTROL_DISABLE = 0
+DTR_CONTROL_ENABLE = 1
+DTR_CONTROL_HANDSHAKE = 2
+RTS_CONTROL_DISABLE = 0
+RTS_CONTROL_ENABLE = 1
+RTS_CONTROL_HANDSHAKE = 2
+RTS_CONTROL_TOGGLE = 3
+GMEM_FIXED = 0
+GMEM_MOVEABLE = 2
+GMEM_NOCOMPACT = 16
+GMEM_NODISCARD = 32
+GMEM_ZEROINIT = 64
+GMEM_MODIFY = 128
+GMEM_DISCARDABLE = 256
+GMEM_NOT_BANKED = 4096
+GMEM_SHARE = 8192
+GMEM_DDESHARE = 8192
+GMEM_NOTIFY = 16384
+GMEM_LOWER = GMEM_NOT_BANKED
+GMEM_VALID_FLAGS = 32626
+GMEM_INVALID_HANDLE = 32768
+GHND = (GMEM_MOVEABLE | GMEM_ZEROINIT)
+GPTR = (GMEM_FIXED | GMEM_ZEROINIT)
+GMEM_DISCARDED = 16384
+GMEM_LOCKCOUNT = 255
+LMEM_FIXED = 0
+LMEM_MOVEABLE = 2
+LMEM_NOCOMPACT = 16
+LMEM_NODISCARD = 32
+LMEM_ZEROINIT = 64
+LMEM_MODIFY = 128
+LMEM_DISCARDABLE = 3840
+LMEM_VALID_FLAGS = 3954
+LMEM_INVALID_HANDLE = 32768
+LHND = (LMEM_MOVEABLE | LMEM_ZEROINIT)
+LPTR = (LMEM_FIXED | LMEM_ZEROINIT)
+NONZEROLHND = (LMEM_MOVEABLE)
+NONZEROLPTR = (LMEM_FIXED)
+LMEM_DISCARDED = 16384
+LMEM_LOCKCOUNT = 255
+DEBUG_PROCESS = 1
+DEBUG_ONLY_THIS_PROCESS = 2
+CREATE_SUSPENDED = 4
+DETACHED_PROCESS = 8
+CREATE_NEW_CONSOLE = 16
+NORMAL_PRIORITY_CLASS = 32
+IDLE_PRIORITY_CLASS = 64
+HIGH_PRIORITY_CLASS = 128
+REALTIME_PRIORITY_CLASS = 256
+CREATE_NEW_PROCESS_GROUP = 512
+CREATE_UNICODE_ENVIRONMENT = 1024
+CREATE_SEPARATE_WOW_VDM = 2048
+CREATE_SHARED_WOW_VDM = 4096
+CREATE_DEFAULT_ERROR_MODE = 67108864
+CREATE_NO_WINDOW = 134217728
+PROFILE_USER = 268435456
+PROFILE_KERNEL = 536870912
+PROFILE_SERVER = 1073741824
+THREAD_BASE_PRIORITY_LOWRT = 15
+THREAD_BASE_PRIORITY_MAX = 2
+THREAD_BASE_PRIORITY_MIN = -2
+THREAD_BASE_PRIORITY_IDLE = -15
+THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN
+THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST+1
+THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX
+THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST-1
+THREAD_PRIORITY_ERROR_RETURN = MAXLONG
+THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
+THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE
+THREAD_PRIORITY_NORMAL = 0
+EXCEPTION_DEBUG_EVENT = 1
+CREATE_THREAD_DEBUG_EVENT = 2
+CREATE_PROCESS_DEBUG_EVENT = 3
+EXIT_THREAD_DEBUG_EVENT = 4
+EXIT_PROCESS_DEBUG_EVENT = 5
+LOAD_DLL_DEBUG_EVENT = 6
+UNLOAD_DLL_DEBUG_EVENT = 7
+OUTPUT_DEBUG_STRING_EVENT = 8
+RIP_EVENT = 9
+DRIVE_UNKNOWN = 0
+DRIVE_NO_ROOT_DIR = 1
+DRIVE_REMOVABLE = 2
+DRIVE_FIXED = 3
+DRIVE_REMOTE = 4
+DRIVE_CDROM = 5
+DRIVE_RAMDISK = 6
+FILE_TYPE_UNKNOWN = 0
+FILE_TYPE_DISK = 1
+FILE_TYPE_CHAR = 2
+FILE_TYPE_PIPE = 3
+FILE_TYPE_REMOTE = 32768
+NOPARITY = 0
+ODDPARITY = 1
+EVENPARITY = 2
+MARKPARITY = 3
+SPACEPARITY = 4
+ONESTOPBIT = 0
+ONE5STOPBITS = 1
+TWOSTOPBITS = 2
+CBR_110 = 110
+CBR_300 = 300
+CBR_600 = 600
+CBR_1200 = 1200
+CBR_2400 = 2400
+CBR_4800 = 4800
+CBR_9600 = 9600
+CBR_14400 = 14400
+CBR_19200 = 19200
+CBR_38400 = 38400
+CBR_56000 = 56000
+CBR_57600 = 57600
+CBR_115200 = 115200
+CBR_128000 = 128000
+CBR_256000 = 256000
+S_QUEUEEMPTY = 0
+S_THRESHOLD = 1
+S_ALLTHRESHOLD = 2
+S_NORMAL = 0
+S_LEGATO = 1
+S_STACCATO = 2
+NMPWAIT_WAIT_FOREVER = -1
+NMPWAIT_NOWAIT = 1
+NMPWAIT_USE_DEFAULT_WAIT = 0
+OF_READ = 0
+OF_WRITE = 1
+OF_READWRITE = 2
+OF_SHARE_COMPAT = 0
+OF_SHARE_EXCLUSIVE = 16
+OF_SHARE_DENY_WRITE = 32
+OF_SHARE_DENY_READ = 48
+OF_SHARE_DENY_NONE = 64
+OF_PARSE = 256
+OF_DELETE = 512
+OF_VERIFY = 1024
+OF_CANCEL = 2048
+OF_CREATE = 4096
+OF_PROMPT = 8192
+OF_EXIST = 16384
+OF_REOPEN = 32768
+OFS_MAXPATHNAME = 128
+MAXINTATOM = 49152
+
+# winbase.h
+PROCESS_HEAP_REGION = 1
+PROCESS_HEAP_UNCOMMITTED_RANGE = 2
+PROCESS_HEAP_ENTRY_BUSY = 4
+PROCESS_HEAP_ENTRY_MOVEABLE = 16
+PROCESS_HEAP_ENTRY_DDESHARE = 32
+SCS_32BIT_BINARY = 0
+SCS_DOS_BINARY = 1
+SCS_WOW_BINARY = 2
+SCS_PIF_BINARY = 3
+SCS_POSIX_BINARY = 4
+SCS_OS216_BINARY = 5
+SEM_FAILCRITICALERRORS = 1
+SEM_NOGPFAULTERRORBOX = 2
+SEM_NOALIGNMENTFAULTEXCEPT = 4
+SEM_NOOPENFILEERRORBOX = 32768
+LOCKFILE_FAIL_IMMEDIATELY = 1
+LOCKFILE_EXCLUSIVE_LOCK = 2
+HANDLE_FLAG_INHERIT = 1
+HANDLE_FLAG_PROTECT_FROM_CLOSE = 2
+HINSTANCE_ERROR = 32
+GET_TAPE_MEDIA_INFORMATION = 0
+GET_TAPE_DRIVE_INFORMATION = 1
+SET_TAPE_MEDIA_INFORMATION = 0
+SET_TAPE_DRIVE_INFORMATION = 1
+FORMAT_MESSAGE_ALLOCATE_BUFFER = 256
+FORMAT_MESSAGE_IGNORE_INSERTS = 512
+FORMAT_MESSAGE_FROM_STRING = 1024
+FORMAT_MESSAGE_FROM_HMODULE = 2048
+FORMAT_MESSAGE_FROM_SYSTEM = 4096
+FORMAT_MESSAGE_ARGUMENT_ARRAY = 8192
+FORMAT_MESSAGE_MAX_WIDTH_MASK = 255
+BACKUP_INVALID = 0
+BACKUP_DATA = 1
+BACKUP_EA_DATA = 2
+BACKUP_SECURITY_DATA = 3
+BACKUP_ALTERNATE_DATA = 4
+BACKUP_LINK = 5
+BACKUP_PROPERTY_DATA = 6
+BACKUP_OBJECT_ID = 7
+BACKUP_REPARSE_DATA = 8
+BACKUP_SPARSE_BLOCK = 9
+
+STREAM_NORMAL_ATTRIBUTE = 0
+STREAM_MODIFIED_WHEN_READ = 1
+STREAM_CONTAINS_SECURITY = 2
+STREAM_CONTAINS_PROPERTIES = 4
+STARTF_USESHOWWINDOW = 1
+STARTF_USESIZE = 2
+STARTF_USEPOSITION = 4
+STARTF_USECOUNTCHARS = 8
+STARTF_USEFILLATTRIBUTE = 16
+STARTF_FORCEONFEEDBACK = 64
+STARTF_FORCEOFFFEEDBACK = 128
+STARTF_USESTDHANDLES = 256
+STARTF_USEHOTKEY = 512
+SHUTDOWN_NORETRY = 1
+DONT_RESOLVE_DLL_REFERENCES = 1
+LOAD_LIBRARY_AS_DATAFILE = 2
+LOAD_WITH_ALTERED_SEARCH_PATH = 8
+DDD_RAW_TARGET_PATH = 1
+DDD_REMOVE_DEFINITION = 2
+DDD_EXACT_MATCH_ON_REMOVE = 4
+MOVEFILE_REPLACE_EXISTING = 1
+MOVEFILE_COPY_ALLOWED = 2
+MOVEFILE_DELAY_UNTIL_REBOOT = 4
+MAX_COMPUTERNAME_LENGTH = 15
+LOGON32_LOGON_INTERACTIVE = 2
+LOGON32_LOGON_BATCH = 4
+LOGON32_LOGON_SERVICE = 5
+LOGON32_PROVIDER_DEFAULT = 0
+LOGON32_PROVIDER_WINNT35 = 1
+VER_PLATFORM_WIN32s = 0
+VER_PLATFORM_WIN32_WINDOWS = 1
+VER_PLATFORM_WIN32_NT = 2
+TC_NORMAL = 0
+TC_HARDERR = 1
+TC_GP_TRAP = 2
+TC_SIGNAL = 3
+AC_LINE_OFFLINE = 0
+AC_LINE_ONLINE = 1
+AC_LINE_BACKUP_POWER = 2
+AC_LINE_UNKNOWN = 255
+BATTERY_FLAG_HIGH = 1
+BATTERY_FLAG_LOW = 2
+BATTERY_FLAG_CRITICAL = 4
+BATTERY_FLAG_CHARGING = 8
+BATTERY_FLAG_NO_BATTERY = 128
+BATTERY_FLAG_UNKNOWN = 255
+BATTERY_PERCENTAGE_UNKNOWN = 255
+BATTERY_LIFE_UNKNOWN = -1
+
+# Generated by h2py from d:\msdev\include\richedit.h
+cchTextLimitDefault = 32767
+WM_CONTEXTMENU = 123
+WM_PRINTCLIENT = 792
+EN_MSGFILTER = 1792
+EN_REQUESTRESIZE = 1793
+EN_SELCHANGE = 1794
+EN_DROPFILES = 1795
+EN_PROTECTED = 1796
+EN_CORRECTTEXT = 1797
+EN_STOPNOUNDO = 1798
+EN_IMECHANGE = 1799
+EN_SAVECLIPBOARD = 1800
+EN_OLEOPFAILED = 1801
+ENM_NONE = 0
+ENM_CHANGE = 1
+ENM_UPDATE = 2
+ENM_SCROLL = 4
+ENM_KEYEVENTS = 65536
+ENM_MOUSEEVENTS = 131072
+ENM_REQUESTRESIZE = 262144
+ENM_SELCHANGE = 524288
+ENM_DROPFILES = 1048576
+ENM_PROTECTED = 2097152
+ENM_CORRECTTEXT = 4194304
+ENM_IMECHANGE = 8388608
+ES_SAVESEL = 32768
+ES_SUNKEN = 16384
+ES_DISABLENOSCROLL = 8192
+ES_SELECTIONBAR = 16777216
+ES_EX_NOCALLOLEINIT = 16777216
+ES_VERTICAL = 4194304
+ES_NOIME = 524288
+ES_SELFIME = 262144
+ECO_AUTOWORDSELECTION = 1
+ECO_AUTOVSCROLL = 64
+ECO_AUTOHSCROLL = 128
+ECO_NOHIDESEL = 256
+ECO_READONLY = 2048
+ECO_WANTRETURN = 4096
+ECO_SAVESEL = 32768
+ECO_SELECTIONBAR = 16777216
+ECO_VERTICAL = 4194304
+ECOOP_SET = 1
+ECOOP_OR = 2
+ECOOP_AND = 3
+ECOOP_XOR = 4
+WB_CLASSIFY = 3
+WB_MOVEWORDLEFT = 4
+WB_MOVEWORDRIGHT = 5
+WB_LEFTBREAK = 6
+WB_RIGHTBREAK = 7
+WB_MOVEWORDPREV = 4
+WB_MOVEWORDNEXT = 5
+WB_PREVBREAK = 6
+WB_NEXTBREAK = 7
+PC_FOLLOWING = 1
+PC_LEADING = 2
+PC_OVERFLOW = 3
+PC_DELIMITER = 4
+WBF_WORDWRAP = 16
+WBF_WORDBREAK = 32
+WBF_OVERFLOW = 64
+WBF_LEVEL1 = 128
+WBF_LEVEL2 = 256
+WBF_CUSTOM = 512
+CFM_BOLD = 1
+CFM_ITALIC = 2
+CFM_UNDERLINE = 4
+CFM_STRIKEOUT = 8
+CFM_PROTECTED = 16
+CFM_SIZE = -2147483648
+CFM_COLOR = 1073741824
+CFM_FACE = 536870912
+CFM_OFFSET = 268435456
+CFM_CHARSET = 134217728
+CFE_BOLD = 1
+CFE_ITALIC = 2
+CFE_UNDERLINE = 4
+CFE_STRIKEOUT = 8
+CFE_PROTECTED = 16
+CFE_AUTOCOLOR = 1073741824
+yHeightCharPtsMost = 1638
+SCF_SELECTION = 1
+SCF_WORD = 2
+SF_TEXT = 1
+SF_RTF = 2
+SF_RTFNOOBJS = 3
+SF_TEXTIZED = 4
+SFF_SELECTION = 32768
+SFF_PLAINRTF = 16384
+MAX_TAB_STOPS = 32
+lDefaultTab = 720
+PFM_STARTINDENT = 1
+PFM_RIGHTINDENT = 2
+PFM_OFFSET = 4
+PFM_ALIGNMENT = 8
+PFM_TABSTOPS = 16
+PFM_NUMBERING = 32
+PFM_OFFSETINDENT = -2147483648
+PFN_BULLET = 1
+PFA_LEFT = 1
+PFA_RIGHT = 2
+PFA_CENTER = 3
+WM_NOTIFY = 78
+SEL_EMPTY = 0
+SEL_TEXT = 1
+SEL_OBJECT = 2
+SEL_MULTICHAR = 4
+SEL_MULTIOBJECT = 8
+OLEOP_DOVERB = 1
+CF_RTF = "Rich Text Format"
+CF_RTFNOOBJS = "Rich Text Format Without Objects"
+CF_RETEXTOBJ = "RichEdit Text and Objects"
+
+# From wincon.h
+RIGHT_ALT_PRESSED = 1 # the right alt key is pressed.
+LEFT_ALT_PRESSED = 2 # the left alt key is pressed.
+RIGHT_CTRL_PRESSED = 4 # the right ctrl key is pressed.
+LEFT_CTRL_PRESSED = 8 # the left ctrl key is pressed.
+SHIFT_PRESSED = 16 # the shift key is pressed.
+NUMLOCK_ON = 32 # the numlock light is on.
+SCROLLLOCK_ON = 64 # the scrolllock light is on.
+CAPSLOCK_ON = 128 # the capslock light is on.
+ENHANCED_KEY = 256 # the key is enhanced.
+NLS_DBCSCHAR = 65536 # DBCS for JPN: SBCS/DBCS mode.
+NLS_ALPHANUMERIC = 0 # DBCS for JPN: Alphanumeric mode.
+NLS_KATAKANA = 131072 # DBCS for JPN: Katakana mode.
+NLS_HIRAGANA = 262144 # DBCS for JPN: Hiragana mode.
+NLS_ROMAN = 4194304 # DBCS for JPN: Roman/Noroman mode.
+NLS_IME_CONVERSION = 8388608 # DBCS for JPN: IME conversion.
+NLS_IME_DISABLE = 536870912 # DBCS for JPN: IME enable/disable.
+
+FROM_LEFT_1ST_BUTTON_PRESSED = 1
+RIGHTMOST_BUTTON_PRESSED = 2
+FROM_LEFT_2ND_BUTTON_PRESSED = 4
+FROM_LEFT_3RD_BUTTON_PRESSED = 8
+FROM_LEFT_4TH_BUTTON_PRESSED = 16
+
+CTRL_C_EVENT = 0
+CTRL_BREAK_EVENT = 1
+CTRL_CLOSE_EVENT = 2
+CTRL_LOGOFF_EVENT = 5
+CTRL_SHUTDOWN_EVENT = 6
+
+MOUSE_MOVED = 1
+DOUBLE_CLICK = 2
+MOUSE_WHEELED = 4
+
+#property sheet window messages from prsht.h
+PSM_SETCURSEL = (WM_USER + 101)
+PSM_REMOVEPAGE = (WM_USER + 102)
+PSM_ADDPAGE = (WM_USER + 103)
+PSM_CHANGED = (WM_USER + 104)
+PSM_RESTARTWINDOWS = (WM_USER + 105)
+PSM_REBOOTSYSTEM = (WM_USER + 106)
+PSM_CANCELTOCLOSE = (WM_USER + 107)
+PSM_QUERYSIBLINGS = (WM_USER + 108)
+PSM_UNCHANGED = (WM_USER + 109)
+PSM_APPLY = (WM_USER + 110)
+PSM_SETTITLEA = (WM_USER + 111)
+PSM_SETTITLEW = (WM_USER + 120)
+PSM_SETWIZBUTTONS = (WM_USER + 112)
+PSM_PRESSBUTTON = (WM_USER + 113)
+PSM_SETCURSELID = (WM_USER + 114)
+PSM_SETFINISHTEXTA = (WM_USER + 115)
+PSM_SETFINISHTEXTW = (WM_USER + 121)
+PSM_GETTABCONTROL = (WM_USER + 116)
+PSM_ISDIALOGMESSAGE = (WM_USER + 117)
+PSM_GETCURRENTPAGEHWND = (WM_USER + 118)
+PSM_INSERTPAGE = (WM_USER + 119)
+PSM_SETHEADERTITLEA = (WM_USER + 125)
+PSM_SETHEADERTITLEW = (WM_USER + 126)
+PSM_SETHEADERSUBTITLEA = (WM_USER + 127)
+PSM_SETHEADERSUBTITLEW = (WM_USER + 128)
+PSM_HWNDTOINDEX = (WM_USER + 129)
+PSM_INDEXTOHWND = (WM_USER + 130)
+PSM_PAGETOINDEX = (WM_USER + 131)
+PSM_INDEXTOPAGE = (WM_USER + 132)
+PSM_IDTOINDEX = (WM_USER + 133)
+PSM_INDEXTOID = (WM_USER + 134)
+PSM_GETRESULT = (WM_USER + 135)
+PSM_RECALCPAGESIZES = (WM_USER + 136)
+
+# GetUserNameEx/GetComputerNameEx
+NameUnknown = 0
+NameFullyQualifiedDN = 1
+NameSamCompatible = 2
+NameDisplay = 3
+NameUniqueId = 6
+NameCanonical = 7
+NameUserPrincipal = 8
+NameCanonicalEx = 9
+NameServicePrincipal = 10
+NameDnsDomain = 12
+
+ComputerNameNetBIOS = 0
+ComputerNameDnsHostname = 1
+ComputerNameDnsDomain = 2
+ComputerNameDnsFullyQualified = 3
+ComputerNamePhysicalNetBIOS = 4
+ComputerNamePhysicalDnsHostname = 5
+ComputerNamePhysicalDnsDomain = 6
+ComputerNamePhysicalDnsFullyQualified = 7
+
+LWA_COLORKEY = 0x00000001
+LWA_ALPHA = 0x00000002
+ULW_COLORKEY = 0x00000001
+ULW_ALPHA = 0x00000002
+ULW_OPAQUE = 0x00000004
+
+# WinDef.h
+TRUE = 1
+FALSE = 0
+MAX_PATH = 260
+# WinGDI.h
+AC_SRC_OVER = 0
+AC_SRC_ALPHA = 1
+GRADIENT_FILL_RECT_H = 0
+GRADIENT_FILL_RECT_V = 1
+GRADIENT_FILL_TRIANGLE = 2
+GRADIENT_FILL_OP_FLAG = 255
+
+# Bizarrely missing from any platform header. Ref:
+# http://www.codeguru.com/forum/archive/index.php/t-426785.html
+MAPVK_VK_TO_VSC = 0
+MAPVK_VSC_TO_VK = 1
+MAPVK_VK_TO_CHAR = 2
+MAPVK_VSC_TO_VK_EX = 3
+
+USER_TIMER_MAXIMUM = 0x7fffffff
+
+# From WinBase.h
+INFINITE = 0xffffffff
+
+# From Winuser.h
+RIDEV_REMOVE = 0x00000001
+RIDEV_EXCLUDE = 0x00000010
+RIDEV_PAGEONLY = 0x00000020
+RIDEV_NOLEGACY = 0x00000030
+RIDEV_INPUTSINK = 0x00000100
+RIDEV_CAPTUREMOUSE = 0x00000200
+RIDEV_NOHOTKEYS = 0x00000200
+RIDEV_APPKEYS = 0x00000400
+RIDEV_EXMODEMASK = 0x000000F0
+RIDEV_EXINPUTSINK = 0x00001000 # Vista+
+RIDEV_DEVNOTIFY = 0x00002000 # Vista+
+
+RI_KEY_MAKE = 0
+RI_KEY_BREAK = 1
+RI_KEY_E0 = 2
+RI_KEY_E1 = 4
+RI_KEY_TERMSRV_SET_LED = 8
+RI_KEY_TERMSRV_SHADOW = 0x10
+
+RIM_TYPEMOUSE = 0
+RIM_TYPEKEYBOARD = 1
+RIM_TYPEHID = 2
+
+RID_INPUT = 0x10000003
+RID_HEADER = 0x10000005
+
+MOUSE_MOVE_RELATIVE = 0
+MOUSE_MOVE_ABSOLUTE = 1
+MOUSE_VIRTUAL_DESKTOP = 0x02
+MOUSE_ATTRIBUTES_CHANGED = 0x04
+
+RI_MOUSE_LEFT_BUTTON_DOWN = 0x0001
+RI_MOUSE_LEFT_BUTTON_UP = 0x0002
+RI_MOUSE_RIGHT_BUTTON_DOWN = 0x0004
+RI_MOUSE_RIGHT_BUTTON_UP = 0x0008
+RI_MOUSE_MIDDLE_BUTTON_DOWN = 0x0010
+RI_MOUSE_MIDDLE_BUTTON_UP = 0x0020
+
+RI_MOUSE_BUTTON_1_DOWN = RI_MOUSE_LEFT_BUTTON_DOWN
+RI_MOUSE_BUTTON_1_UP = RI_MOUSE_LEFT_BUTTON_UP
+RI_MOUSE_BUTTON_2_DOWN = RI_MOUSE_RIGHT_BUTTON_DOWN
+RI_MOUSE_BUTTON_2_UP = RI_MOUSE_RIGHT_BUTTON_UP
+RI_MOUSE_BUTTON_3_DOWN = RI_MOUSE_MIDDLE_BUTTON_DOWN
+RI_MOUSE_BUTTON_3_UP = RI_MOUSE_MIDDLE_BUTTON_UP
+
+RI_MOUSE_BUTTON_4_DOWN = 0x0040
+RI_MOUSE_BUTTON_4_UP = 0x0080
+RI_MOUSE_BUTTON_5_DOWN = 0x0100
+RI_MOUSE_BUTTON_5_UP = 0x0200
+
+RI_MOUSE_WHEEL = 0x0400
+
+WINDOWS_VISTA_OR_GREATER = sys.getwindowsversion() >= (6, 0)
+WINDOWS_7_OR_GREATER = sys.getwindowsversion() >= (6, 1)
+WINDOWS_8_OR_GREATER = sys.getwindowsversion() >= (6, 2)
+WINDOWS_8_1_OR_GREATER = sys.getwindowsversion() >= (6, 3)
+WINDOWS_10_ANNIVERSARY_UPDATE_OR_GREATER = sys.getwindowsversion() >= (10, 0, 14393) # 1607
+WINDOWS_10_CREATORS_UPDATE_OR_GREATER = sys.getwindowsversion() >= (10, 0, 15063) # 1703
+
+MSGFLT_ALLOW = 1
+MSGFLT_DISALLOW = 2
+MSGFLT_RESET = 0
+
+COINIT_APARTMENTTHREADED = 0x2
+COINIT_MULTITHREADED = 0x0
+COINIT_DISABLE_OLE1DDE = 0x4
+COINIT_SPEED_OVER_MEMORY = 0x8
+RPC_E_CHANGED_MODE = -2147417850
+
+MF_ACCESSMODE_READ = 1
+MF_ACCESSMODE_WRITE = 2
+MF_ACCESSMODE_READWRITE = 3
+
+MF_OPENMODE_FAIL_IF_NOT_EXIST = 0
+MF_OPENMODE_FAIL_IF_EXIST = 1
+MF_OPENMODE_RESET_IF_EXIST = 2
+MF_OPENMODE_APPEND_IF_EXIST = 3
+MF_OPENMODE_DELETE_IF_EXIST = 4
+
+MF_FILEFLAGS_NONE = 0
+MF_FILEFLAGS_NOBUFFERING = 1
+
+CLSCTX_INPROC_SERVER = 0x1
+
+# From Dwmapi.h
+DWM_BB_ENABLE = 0x00000001
+DWM_BB_BLURREGION = 0x00000002
+DWM_BB_TRANSITIONONMAXIMIZED = 0x00000004
+
+STREAM_SEEK_SET = 0
+STREAM_SEEK_CUR = 1
+STREAM_SEEK_END = 2
+
+LOCALE_NAME_MAX_LENGTH = 85
+
+DBT_DEVICEARRIVAL = 0x8000
+DBT_DEVICEREMOVECOMPLETE = 0x8004
+
+DBT_DEVTYP_DEVICEINTERFACE = 5
+
+DEVICE_NOTIFY_WINDOW_HANDLE = 0
+DEVICE_NOTIFY_SERVICE_HANDLE = 1
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/dinput.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/dinput.py
new file mode 100644
index 0000000000000000000000000000000000000000..36bbf82b00cab4918885d3907e09af5782f150c0
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/dinput.py
@@ -0,0 +1,398 @@
+import ctypes
+
+from pyglet.libs.win32 import com
+
+lib = ctypes.oledll.dinput8
+
+LPVOID = ctypes.c_void_p
+WORD = ctypes.c_uint16
+DWORD = ctypes.c_uint32
+LPDWORD = ctypes.POINTER(DWORD)
+BOOL = ctypes.c_int
+WCHAR = ctypes.c_wchar
+UINT = ctypes.c_uint
+HWND = ctypes.c_uint32
+HANDLE = LPVOID
+MAX_PATH = 260
+
+DIENUM_STOP = 0
+DIENUM_CONTINUE = 1
+
+DIEDFL_ALLDEVICES = 0x00000000
+DIEDFL_ATTACHEDONLY = 0x00000001
+DIEDFL_FORCEFEEDBACK = 0x00000100
+DIEDFL_INCLUDEALIASES = 0x00010000
+DIEDFL_INCLUDEPHANTOMS = 0x00020000
+DIEDFL_INCLUDEHIDDEN = 0x00040000
+
+DI8DEVCLASS_ALL = 0
+DI8DEVCLASS_DEVICE = 1
+DI8DEVCLASS_POINTER = 2
+DI8DEVCLASS_KEYBOARD = 3
+DI8DEVCLASS_GAMECTRL = 4
+
+DI8DEVTYPE_DEVICE = 0x11
+DI8DEVTYPE_MOUSE = 0x12
+DI8DEVTYPE_KEYBOARD = 0x13
+DI8DEVTYPE_JOYSTICK = 0x14
+DI8DEVTYPE_GAMEPAD = 0x15
+DI8DEVTYPE_DRIVING = 0x16
+DI8DEVTYPE_FLIGHT = 0x17
+DI8DEVTYPE_1STPERSON = 0x18
+DI8DEVTYPE_DEVICECTRL = 0x19
+DI8DEVTYPE_SCREENPOINTER = 0x1A
+DI8DEVTYPE_REMOTE = 0x1B
+DI8DEVTYPE_SUPPLEMENTAL = 0x1C
+DI8DEVTYPEMOUSE_UNKNOWN = 1
+DI8DEVTYPEMOUSE_TRADITIONAL = 2
+DI8DEVTYPEMOUSE_FINGERSTICK = 3
+DI8DEVTYPEMOUSE_TOUCHPAD = 4
+DI8DEVTYPEMOUSE_TRACKBALL = 5
+DI8DEVTYPEMOUSE_ABSOLUTE = 6
+
+DI8DEVTYPEKEYBOARD_UNKNOWN = 0
+DI8DEVTYPEKEYBOARD_PCXT = 1
+DI8DEVTYPEKEYBOARD_OLIVETTI = 2
+DI8DEVTYPEKEYBOARD_PCAT = 3
+DI8DEVTYPEKEYBOARD_PCENH = 4
+DI8DEVTYPEKEYBOARD_NOKIA1050 = 5
+DI8DEVTYPEKEYBOARD_NOKIA9140 = 6
+DI8DEVTYPEKEYBOARD_NEC98 = 7
+DI8DEVTYPEKEYBOARD_NEC98LAPTOP = 8
+DI8DEVTYPEKEYBOARD_NEC98106 = 9
+DI8DEVTYPEKEYBOARD_JAPAN106 = 10
+DI8DEVTYPEKEYBOARD_JAPANAX = 11
+DI8DEVTYPEKEYBOARD_J3100 = 12
+
+DI8DEVTYPE_LIMITEDGAMESUBTYPE = 1
+
+DI8DEVTYPEJOYSTICK_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE
+DI8DEVTYPEJOYSTICK_STANDARD = 2
+
+DI8DEVTYPEGAMEPAD_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE
+DI8DEVTYPEGAMEPAD_STANDARD = 2
+DI8DEVTYPEGAMEPAD_TILT = 3
+
+DI8DEVTYPEDRIVING_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE
+DI8DEVTYPEDRIVING_COMBINEDPEDALS = 2
+DI8DEVTYPEDRIVING_DUALPEDALS = 3
+DI8DEVTYPEDRIVING_THREEPEDALS = 4
+DI8DEVTYPEDRIVING_HANDHELD = 5
+
+DI8DEVTYPEFLIGHT_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE
+DI8DEVTYPEFLIGHT_STICK = 2
+DI8DEVTYPEFLIGHT_YOKE = 3
+DI8DEVTYPEFLIGHT_RC = 4
+
+DI8DEVTYPE1STPERSON_LIMITED = DI8DEVTYPE_LIMITEDGAMESUBTYPE
+DI8DEVTYPE1STPERSON_UNKNOWN = 2
+DI8DEVTYPE1STPERSON_SIXDOF = 3
+DI8DEVTYPE1STPERSON_SHOOTER = 4
+
+DI8DEVTYPESCREENPTR_UNKNOWN = 2
+DI8DEVTYPESCREENPTR_LIGHTGUN = 3
+DI8DEVTYPESCREENPTR_LIGHTPEN = 4
+DI8DEVTYPESCREENPTR_TOUCH = 5
+
+DI8DEVTYPEREMOTE_UNKNOWN = 2
+
+DI8DEVTYPEDEVICECTRL_UNKNOWN = 2
+DI8DEVTYPEDEVICECTRL_COMMSSELECTION = 3
+DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED = 4
+
+DI8DEVTYPESUPPLEMENTAL_UNKNOWN = 2
+DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER = 3
+DI8DEVTYPESUPPLEMENTAL_HEADTRACKER = 4
+DI8DEVTYPESUPPLEMENTAL_HANDTRACKER = 5
+DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE = 6
+DI8DEVTYPESUPPLEMENTAL_SHIFTER = 7
+DI8DEVTYPESUPPLEMENTAL_THROTTLE = 8
+DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE = 9
+DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS = 10
+DI8DEVTYPESUPPLEMENTAL_DUALPEDALS = 11
+DI8DEVTYPESUPPLEMENTAL_THREEPEDALS = 12
+DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS = 13
+DIDC_ATTACHED = 0x00000001
+DIDC_POLLEDDEVICE = 0x00000002
+DIDC_EMULATED = 0x00000004
+DIDC_POLLEDDATAFORMAT = 0x00000008
+DIDC_FORCEFEEDBACK = 0x00000100
+DIDC_FFATTACK = 0x00000200
+DIDC_FFFADE = 0x00000400
+DIDC_SATURATION = 0x00000800
+DIDC_POSNEGCOEFFICIENTS = 0x00001000
+DIDC_POSNEGSATURATION = 0x00002000
+DIDC_DEADBAND = 0x00004000
+DIDC_STARTDELAY = 0x00008000
+DIDC_ALIAS = 0x00010000
+DIDC_PHANTOM = 0x00020000
+DIDC_HIDDEN = 0x00040000
+
+def DIDFT_GETINSTANCE(n):
+ return (n >> 8) & 0xffff
+
+DIDFT_ALL = 0x00000000
+
+DIDFT_RELAXIS = 0x00000001
+DIDFT_ABSAXIS = 0x00000002
+DIDFT_AXIS = 0x00000003
+
+DIDFT_PSHBUTTON = 0x00000004
+DIDFT_TGLBUTTON = 0x00000008
+DIDFT_BUTTON = 0x0000000C
+
+DIDFT_POV = 0x00000010
+DIDFT_COLLECTION = 0x00000040
+DIDFT_NODATA = 0x00000080
+
+DIDFT_ANYINSTANCE = 0x00FFFF00
+DIDFT_INSTANCEMASK = DIDFT_ANYINSTANCE
+DIDFT_FFACTUATOR = 0x01000000
+DIDFT_FFEFFECTTRIGGER = 0x02000000
+DIDFT_OUTPUT = 0x10000000
+DIDFT_VENDORDEFINED = 0x04000000
+DIDFT_ALIAS = 0x08000000
+DIDFT_OPTIONAL = 0x80000000
+
+DIDFT_NOCOLLECTION = 0x00FFFF00
+
+DIA_FORCEFEEDBACK = 0x00000001
+DIA_APPMAPPED = 0x00000002
+DIA_APPNOMAP = 0x00000004
+DIA_NORANGE = 0x00000008
+DIA_APPFIXED = 0x00000010
+
+DIAH_UNMAPPED = 0x00000000
+DIAH_USERCONFIG = 0x00000001
+DIAH_APPREQUESTED = 0x00000002
+DIAH_HWAPP = 0x00000004
+DIAH_HWDEFAULT = 0x00000008
+DIAH_DEFAULT = 0x00000020
+DIAH_ERROR = 0x80000000
+DIAFTS_NEWDEVICELOW = 0xFFFFFFFF
+DIAFTS_NEWDEVICEHIGH = 0xFFFFFFFF
+DIAFTS_UNUSEDDEVICELOW = 0x00000000
+DIAFTS_UNUSEDDEVICEHIGH = 0x00000000
+
+DIDBAM_DEFAULT = 0x00000000
+DIDBAM_PRESERVE = 0x00000001
+DIDBAM_INITIALIZE = 0x00000002
+DIDBAM_HWDEFAULTS = 0x00000004
+
+DIDSAM_DEFAULT = 0x00000000
+DIDSAM_NOUSER = 0x00000001
+DIDSAM_FORCESAVE = 0x00000002
+
+DICD_DEFAULT = 0x00000000
+DICD_EDIT = 0x00000001
+
+DIDOI_FFACTUATOR = 0x00000001
+DIDOI_FFEFFECTTRIGGER = 0x00000002
+DIDOI_POLLED = 0x00008000
+DIDOI_ASPECTPOSITION = 0x00000100
+DIDOI_ASPECTVELOCITY = 0x00000200
+DIDOI_ASPECTACCEL = 0x00000300
+DIDOI_ASPECTFORCE = 0x00000400
+DIDOI_ASPECTMASK = 0x00000F00
+DIDOI_GUIDISUSAGE = 0x00010000
+
+DIPH_DEVICE = 0
+DIPH_BYOFFSET = 1
+DIPH_BYID = 2
+DIPH_BYUSAGE = 3
+
+DISCL_EXCLUSIVE = 0x00000001
+DISCL_NONEXCLUSIVE = 0x00000002
+DISCL_FOREGROUND = 0x00000004
+DISCL_BACKGROUND = 0x00000008
+DISCL_NOWINKEY = 0x00000010
+
+DIPROP_BUFFERSIZE = 1
+DIPROP_GUIDANDPATH = com.GUID(12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+
+GUID_XAxis = \
+ com.GUID(0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00)
+
+
+class DIDEVICEINSTANCE(ctypes.Structure):
+ _fields_ = (
+ ('dwSize', DWORD),
+ ('guidInstance', com.GUID),
+ ('guidProduct', com.GUID),
+ ('dwDevType', DWORD),
+ ('tszInstanceName', WCHAR * MAX_PATH),
+ ('tszProductName', WCHAR * MAX_PATH),
+ ('guidFFDriver', com.GUID),
+ ('wUsagePage', WORD),
+ ('wUsage', WORD)
+ )
+LPDIDEVICEINSTANCE = ctypes.POINTER(DIDEVICEINSTANCE)
+LPDIENUMDEVICESCALLBACK = ctypes.WINFUNCTYPE(BOOL, LPDIDEVICEINSTANCE, LPVOID)
+
+class DIDEVICEOBJECTINSTANCE(ctypes.Structure):
+ _fields_ = (
+ ('dwSize', DWORD),
+ ('guidType', com.GUID),
+ ('dwOfs', DWORD),
+ ('dwType', DWORD),
+ ('dwFlags', DWORD),
+ ('tszName', WCHAR * MAX_PATH),
+ ('dwFFMaxForce', DWORD),
+ ('dwFFForceResolution', DWORD),
+ ('wCollectionNumber', WORD),
+ ('wDesignatorIndex', WORD),
+ ('wUsagePage', WORD),
+ ('wUsage', WORD),
+ ('dwDimension', DWORD),
+ ('wExponent', WORD),
+ ('wReportId', WORD)
+ )
+LPDIDEVICEOBJECTINSTANCE = ctypes.POINTER(DIDEVICEOBJECTINSTANCE)
+LPDIENUMDEVICEOBJECTSCALLBACK = \
+ ctypes.WINFUNCTYPE( BOOL, LPDIDEVICEOBJECTINSTANCE, LPVOID)
+
+class DIOBJECTDATAFORMAT(ctypes.Structure):
+ _fields_ = (
+ ('pguid', ctypes.POINTER(com.GUID)),
+ ('dwOfs', DWORD),
+ ('dwType', DWORD),
+ ('dwFlags', DWORD)
+ )
+ __slots__ = [n for n, t in _fields_]
+LPDIOBJECTDATAFORMAT = ctypes.POINTER(DIOBJECTDATAFORMAT)
+
+class DIDATAFORMAT(ctypes.Structure):
+ _fields_ = (
+ ('dwSize', DWORD),
+ ('dwObjSize', DWORD),
+ ('dwFlags', DWORD),
+ ('dwDataSize', DWORD),
+ ('dwNumObjs', DWORD),
+ ('rgodf', LPDIOBJECTDATAFORMAT)
+ )
+ __slots__ = [n for n, t in _fields_]
+LPDIDATAFORMAT = ctypes.POINTER(DIDATAFORMAT)
+
+class DIDEVICEOBJECTDATA(ctypes.Structure):
+ _fields_ = (
+ ('dwOfs', DWORD),
+ ('dwData', DWORD),
+ ('dwTimeStamp', DWORD),
+ ('dwSequence', DWORD),
+ ('uAppData', ctypes.POINTER(UINT))
+ )
+LPDIDEVICEOBJECTDATA = ctypes.POINTER(DIDEVICEOBJECTDATA)
+
+class DIPROPHEADER(ctypes.Structure):
+ _fields_ = (
+ ('dwSize', DWORD),
+ ('dwHeaderSize', DWORD),
+ ('dwObj', DWORD),
+ ('dwHow', DWORD)
+ )
+LPDIPROPHEADER = ctypes.POINTER(DIPROPHEADER)
+
+class DIPROPDWORD(ctypes.Structure):
+ _fields_ = (
+ ('diph', DIPROPHEADER),
+ ('dwData', DWORD)
+ )
+
+# All method names in the interfaces are filled in, but unused (so far)
+# methods have no parameters.. they'll crash when we try and use them, at
+# which point we can go in and fill them in.
+
+# IDirect* interfaces are all Unicode (e.g. IDirectInputDevice8W).
+
+class IDirectInputDevice8(com.pIUnknown):
+ _methods_ = [
+ ('GetCapabilities',
+ com.STDMETHOD()),
+ ('EnumObjects',
+ com.STDMETHOD(LPDIENUMDEVICEOBJECTSCALLBACK, LPVOID, DWORD)),
+ ('GetProperty',
+ com.STDMETHOD(LPVOID, LPDIPROPHEADER)),
+ ('SetProperty',
+ com.STDMETHOD(LPVOID, LPDIPROPHEADER)),
+ ('Acquire',
+ com.STDMETHOD()),
+ ('Unacquire',
+ com.STDMETHOD()),
+ ('GetDeviceState',
+ com.STDMETHOD()),
+ ('GetDeviceData',
+ com.STDMETHOD(DWORD, LPDIDEVICEOBJECTDATA, LPDWORD, DWORD)),
+ ('SetDataFormat',
+ com.STDMETHOD(LPDIDATAFORMAT)),
+ ('SetEventNotification',
+ com.STDMETHOD(HANDLE)),
+ ('SetCooperativeLevel',
+ com.STDMETHOD(HWND, DWORD)),
+ ('GetObjectInfo',
+ com.STDMETHOD()),
+ ('GetDeviceInfo',
+ com.STDMETHOD()),
+ ('RunControlPanel',
+ com.STDMETHOD()),
+ ('Initialize',
+ com.STDMETHOD()),
+ ('CreateEffect',
+ com.STDMETHOD()),
+ ('EnumEffects',
+ com.STDMETHOD()),
+ ('GetEffectInfo',
+ com.STDMETHOD()),
+ ('GetForceFeedbackState',
+ com.STDMETHOD()),
+ ('SendForceFeedbackCommand',
+ com.STDMETHOD()),
+ ('EnumCreatedEffectObjects',
+ com.STDMETHOD()),
+ ('Escape',
+ com.STDMETHOD()),
+ ('Poll',
+ com.STDMETHOD()),
+ ('SendDeviceData',
+ com.STDMETHOD()),
+ ('EnumEffectsInFile',
+ com.STDMETHOD()),
+ ('WriteEffectToFile',
+ com.STDMETHOD()),
+ ('BuildActionMap',
+ com.STDMETHOD()),
+ ('SetActionMap',
+ com.STDMETHOD()),
+ ('GetImageInfo',
+ com.STDMETHOD()),
+ ]
+
+class IDirectInput8(com.pIUnknown):
+ _methods_ = [
+ ('CreateDevice',
+ com.STDMETHOD(ctypes.POINTER(com.GUID),
+ ctypes.POINTER(IDirectInputDevice8),
+ ctypes.c_void_p)),
+ ('EnumDevices',
+ com.STDMETHOD(DWORD, LPDIENUMDEVICESCALLBACK, LPVOID, DWORD)),
+ ('GetDeviceStatus',
+ com.STDMETHOD()),
+ ('RunControlPanel',
+ com.STDMETHOD()),
+ ('Initialize',
+ com.STDMETHOD()),
+ ('FindDevice',
+ com.STDMETHOD()),
+ ('EnumDevicesBySemantics',
+ com.STDMETHOD()),
+ ('ConfigureDevices',
+ com.STDMETHOD()),
+ ]
+
+IID_IDirectInput8W = \
+ com.GUID(0xBF798031,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00)
+
+DIRECTINPUT_VERSION = 0x0800
+DirectInput8Create = lib.DirectInput8Create
+DirectInput8Create.argtypes = \
+ (ctypes.c_void_p, DWORD, com.LPGUID, ctypes.c_void_p, ctypes.c_void_p)
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/libwintab.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/libwintab.py
new file mode 100644
index 0000000000000000000000000000000000000000..368b33ea47fec6fd9b40667e4ddcbf4974b8582b
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/libwintab.py
@@ -0,0 +1,437 @@
+import ctypes
+from ctypes.wintypes import HANDLE, BYTE, HWND, BOOL, UINT, LONG, WORD, DWORD, WCHAR, LPVOID
+
+lib = ctypes.windll.wintab32
+
+FIX32 = DWORD
+WTPKT = DWORD
+HCTX = HANDLE # CONTEXT HANDLE
+
+LCNAMELEN = 40
+
+
+class AXIS(ctypes.Structure):
+ _fields_ = (
+ ('axMin', LONG),
+ ('axMax', LONG),
+ ('axUnits', UINT),
+ ('axResolution', FIX32)
+ )
+
+ def get_scale(self):
+ return 1 / float(self.axMax - self.axMin)
+
+ def get_bias(self):
+ return -self.axMin
+
+
+class ORIENTATION(ctypes.Structure):
+ _fields_ = (
+ ('orAzimuth', ctypes.c_int),
+ ('orAltitude', ctypes.c_int),
+ ('orTwist', ctypes.c_int)
+ )
+
+
+class ROTATION(ctypes.Structure):
+ _fields_ = (
+ ('roPitch', ctypes.c_int),
+ ('roRoll', ctypes.c_int),
+ ('roYaw', ctypes.c_int),
+ )
+
+
+class LOGCONTEXT(ctypes.Structure):
+ _fields_ = (
+ ('lcName', WCHAR * LCNAMELEN),
+ ('lcOptions', UINT),
+ ('lcStatus', UINT),
+ ('lcLocks', UINT),
+ ('lcMsgBase', UINT),
+ ('lcDevice', UINT),
+ ('lcPktRate', UINT),
+ ('lcPktData', WTPKT),
+ ('lcPktMode', WTPKT),
+ ('lcMoveMask', WTPKT),
+ ('lcBtnDnMask', DWORD),
+ ('lcBtnUpMask', DWORD),
+ ('lcInOrgX', LONG),
+ ('lcInOrgY', LONG),
+ ('lcInOrgZ', LONG),
+ ('lcInExtX', LONG),
+ ('lcInExtY', LONG),
+ ('lcInExtZ', LONG),
+ ('lcOutOrgX', LONG),
+ ('lcOutOrgY', LONG),
+ ('lcOutOrgZ', LONG),
+ ('lcOutExtX', LONG),
+ ('lcOutExtY', LONG),
+ ('lcOutExtZ', LONG),
+ ('lcSensX', FIX32),
+ ('lcSensY', FIX32),
+ ('lcSensZ', FIX32),
+ ('lcSysMode', BOOL),
+ ('lcSysOrgX', ctypes.c_int),
+ ('lcSysOrgY', ctypes.c_int),
+ ('lcSysExtX', ctypes.c_int),
+ ('lcSysExtY', ctypes.c_int),
+ ('lcSysSensX', FIX32),
+ ('lcSysSensY', FIX32),
+ )
+
+
+class TILT(ctypes.Structure): # 1.1
+ _fields_ = (
+ ('tiltX', ctypes.c_int),
+ ('tiltY', ctypes.c_int),
+ )
+
+
+class EXTENSIONBASE(ctypes.Structure): # 1.4
+ _fields_ = (
+ ('nContext', HCTX), # Specifies the Wintab context to which these properties apply.
+ ('nStatus', UINT), # Status of setting/getting properties.
+ ('nTime', DWORD), # Timestamp applied to property transaction.
+ ('nSerialNumber', UINT), # Reserved - not use
+ )
+
+
+class EXPKEYSDATA(ctypes.Structure): # 1.4
+ _fields_ = (
+ ('nTablet', BYTE), # Tablet index where control is found.
+ ('nControl', BYTE), # Zero-based control index.
+ ('nLocation', BYTE), # Zero-based index indicating side of tablet where control found (0 = left, 1 = right).
+ ('nReserved', BYTE), # Reserved - not used
+ ('nState', DWORD) # Indicates Express Key button press (1 = pressed, 0 = released)
+ )
+
+
+class SLIDERDATA(ctypes.Structure): # 1.4
+ _fields_ = (
+ ('nTablet', BYTE), # Tablet index where control is found.
+ ('nControl', BYTE), # Zero-based control index.
+ ('nMode', BYTE), # Zero-based current active mode of control. Mode selected by control's toggle button.
+ ('nReserved', BYTE), # Reserved - not used
+ ('nPosition', DWORD) # An integer representing the position of the user's finger on the control.
+ # When there is no finger on the control, this value is negative.
+ )
+
+
+class EXTPROPERTY(ctypes.Structure): # 1.4
+ _fields_ = (
+ ('version', BYTE), # Structure version, 0 for now
+ ('tabletIndex', BYTE), # 0-based index for tablet
+ ('controlIndex', BYTE), # 0-based index for control
+ ('functionIndex', BYTE), # 0-based index for control's sub-function
+ ('propertyID', WORD), # property ID
+ ('reserved', WORD), # DWORD-alignment filler
+ ('dataSize', DWORD), # number of bytes in data[] buffer
+ ('data', BYTE * 1), # raw data
+ )
+
+
+# Custom packet format with fields
+# PK_CHANGED
+# PK_CURSOR
+# PK_BUTTONS
+# PK_X
+# PK_Y
+# PK_Z
+# PK_NORMAL_PRESSURE
+# PK_TANGENT_PRESSURE
+# PK_ORIENTATION (check for tilt extension instead)?
+class PACKET(ctypes.Structure):
+ _fields_ = (
+ ('pkChanged', WTPKT),
+ ('pkCursor', UINT),
+ ('pkButtons', DWORD),
+ ('pkX', LONG),
+ ('pkY', LONG),
+ ('pkZ', LONG),
+ ('pkNormalPressure', UINT),
+ ('pkTangentPressure', UINT),
+ ('pkOrientation', ORIENTATION),
+ )
+
+
+class PACKETEXT(ctypes.Structure):
+ _fields_ = (
+ ('pkBase', EXTENSIONBASE), # Extension control properties common to all control types.
+ ('pkExpKeys', EXPKEYSDATA), # Extension data for one Express Key.
+ ('pkTouchStrip', SLIDERDATA), # Extension data for one Touch Strip.
+ ('pkTouchRing', SLIDERDATA) # Extension data for one Touch Ring.
+ )
+
+
+PK_CONTEXT = 0x0001 # reporting context
+PK_STATUS = 0x0002 # status bits
+PK_TIME = 0x0004 # time stamp
+PK_CHANGED = 0x0008 # change bit vector
+PK_SERIAL_NUMBER = 0x0010 # packet serial number
+PK_CURSOR = 0x0020 # reporting cursor
+PK_BUTTONS = 0x0040 # button information
+PK_X = 0x0080 # x axis
+PK_Y = 0x0100 # y axis
+PK_Z = 0x0200 # z axis
+PK_NORMAL_PRESSURE = 0x0400 # normal or tip pressure
+PK_TANGENT_PRESSURE = 0x0800 # tangential or barrel pressure
+PK_ORIENTATION = 0x1000 # orientation info: tilts
+PK_ROTATION = 0x2000 # rotation info; 1.1
+
+TU_NONE = 0
+TU_INCHES = 1
+TU_CENTIMETERS = 2
+TU_CIRCLE = 3
+
+# messages
+WT_DEFBASE = 0x7ff0
+WT_MAXOFFSET = 0xf
+WT_PACKET = 0 # remember to add base
+WT_CTXOPEN = 1
+WT_CTXCLOSE = 2
+WT_CTXUPDATE = 3
+WT_CTXOVERLAP = 4
+WT_PROXIMITY = 5
+WT_INFOCHANGE = 6
+WT_CSRCHANGE = 7
+WT_PACKETEXT = 8
+
+# system button assignment values
+SBN_NONE = 0x00
+SBN_LCLICK = 0x01
+SBN_LDBLCLICK = 0x02
+SBN_LDRAG = 0x03
+SBN_RCLICK = 0x04
+SBN_RDBLCLICK = 0x05
+SBN_RDRAG = 0x06
+SBN_MCLICK = 0x07
+SBN_MDBLCLICK = 0x08
+SBN_MDRAG = 0x09
+
+# for Pen Windows
+SBN_PTCLICK = 0x10
+SBN_PTDBLCLICK = 0x20
+SBN_PTDRAG = 0x30
+SBN_PNCLICK = 0x40
+SBN_PNDBLCLICK = 0x50
+SBN_PNDRAG = 0x60
+SBN_P1CLICK = 0x70
+SBN_P1DBLCLICK = 0x80
+SBN_P1DRAG = 0x90
+SBN_P2CLICK = 0xA0
+SBN_P2DBLCLICK = 0xB0
+SBN_P2DRAG = 0xC0
+SBN_P3CLICK = 0xD0
+SBN_P3DBLCLICK = 0xE0
+SBN_P3DRAG = 0xF0
+
+HWC_INTEGRATED = 0x0001
+HWC_TOUCH = 0x0002
+HWC_HARDPROX = 0x0004
+HWC_PHYSID_CURSORS = 0x0008 # 1.1
+
+CRC_MULTIMODE = 0x0001 # 1.1
+CRC_AGGREGATE = 0x0002 # 1.1
+CRC_INVERT = 0x0004 # 1.1
+
+WTI_INTERFACE = 1
+IFC_WINTABID = 1
+IFC_SPECVERSION = 2
+IFC_IMPLVERSION = 3
+IFC_NDEVICES = 4
+IFC_NCURSORS = 5
+IFC_NCONTEXTS = 6
+IFC_CTXOPTIONS = 7
+IFC_CTXSAVESIZE = 8
+IFC_NEXTENSIONS = 9
+IFC_NMANAGERS = 10
+IFC_MAX = 10
+
+WTI_STATUS = 2
+STA_CONTEXTS = 1
+STA_SYSCTXS = 2
+STA_PKTRATE = 3
+STA_PKTDATA = 4
+STA_MANAGERS = 5
+STA_SYSTEM = 6
+STA_BUTTONUSE = 7
+STA_SYSBTNUSE = 8
+STA_MAX = 8
+
+WTI_DEFCONTEXT = 3
+WTI_DEFSYSCTX = 4
+WTI_DDCTXS = 400 # 1.1
+WTI_DSCTXS = 500 # 1.1
+CTX_NAME = 1
+CTX_OPTIONS = 2
+CTX_STATUS = 3
+CTX_LOCKS = 4
+CTX_MSGBASE = 5
+CTX_DEVICE = 6
+CTX_PKTRATE = 7
+CTX_PKTDATA = 8
+CTX_PKTMODE = 9
+CTX_MOVEMASK = 10
+CTX_BTNDNMASK = 11
+CTX_BTNUPMASK = 12
+CTX_INORGX = 13
+CTX_INORGY = 14
+CTX_INORGZ = 15
+CTX_INEXTX = 16
+CTX_INEXTY = 17
+CTX_INEXTZ = 18
+CTX_OUTORGX = 19
+CTX_OUTORGY = 20
+CTX_OUTORGZ = 21
+CTX_OUTEXTX = 22
+CTX_OUTEXTY = 23
+CTX_OUTEXTZ = 24
+CTX_SENSX = 25
+CTX_SENSY = 26
+CTX_SENSZ = 27
+CTX_SYSMODE = 28
+CTX_SYSORGX = 29
+CTX_SYSORGY = 30
+CTX_SYSEXTX = 31
+CTX_SYSEXTY = 32
+CTX_SYSSENSX = 33
+CTX_SYSSENSY = 34
+CTX_MAX = 34
+
+WTI_DEVICES = 100
+DVC_NAME = 1
+DVC_HARDWARE = 2
+DVC_NCSRTYPES = 3
+DVC_FIRSTCSR = 4
+DVC_PKTRATE = 5
+DVC_PKTDATA = 6
+DVC_PKTMODE = 7
+DVC_CSRDATA = 8
+DVC_XMARGIN = 9
+DVC_YMARGIN = 10
+DVC_ZMARGIN = 11
+DVC_X = 12
+DVC_Y = 13
+DVC_Z = 14
+DVC_NPRESSURE = 15
+DVC_TPRESSURE = 16
+DVC_ORIENTATION = 17
+DVC_ROTATION = 18 # 1.1
+DVC_PNPID = 19 # 1.1
+DVC_MAX = 19
+
+WTI_CURSORS = 200
+CSR_NAME = 1
+CSR_ACTIVE = 2
+CSR_PKTDATA = 3
+CSR_BUTTONS = 4
+CSR_BUTTONBITS = 5
+CSR_BTNNAMES = 6
+CSR_BUTTONMAP = 7
+CSR_SYSBTNMAP = 8
+CSR_NPBUTTON = 9
+CSR_NPBTNMARKS = 10
+CSR_NPRESPONSE = 11
+CSR_TPBUTTON = 12
+CSR_TPBTNMARKS = 13
+CSR_TPRESPONSE = 14
+CSR_PHYSID = 15 # 1.1
+CSR_MODE = 16 # 1.1
+CSR_MINPKTDATA = 17 # 1.1
+CSR_MINBUTTONS = 18 # 1.1
+CSR_CAPABILITIES = 19 # 1.1
+CSR_TYPE = 20 # 1.2
+CSR_MAX = 20
+
+WTI_EXTENSIONS = 300
+EXT_NAME = 1
+EXT_TAG = 2
+EXT_MASK = 3
+EXT_SIZE = 4
+EXT_AXES = 5
+EXT_DEFAULT = 6
+EXT_DEFCONTEXT = 7
+EXT_DEFSYSCTX = 8
+EXT_CURSORS = 9
+EXT_MAX = 109 # Allow 100 cursors
+CXO_SYSTEM = 0x0001
+CXO_PEN = 0x0002
+CXO_MESSAGES = 0x0004
+CXO_MARGIN = 0x8000
+CXO_MGNINSIDE = 0x4000
+CXO_CSRMESSAGES = 0x0008 # 1.1
+
+# context status values
+CXS_DISABLED = 0x0001
+CXS_OBSCURED = 0x0002
+CXS_ONTOP = 0x0004
+
+# context lock values
+CXL_INSIZE = 0x0001
+CXL_INASPECT = 0x0002
+CXL_SENSITIVITY = 0x0004
+CXL_MARGIN = 0x0008
+CXL_SYSOUT = 0x0010
+# packet status values
+TPS_PROXIMITY = 0x0001
+TPS_QUEUE_ERR = 0x0002
+TPS_MARGIN = 0x0004
+TPS_GRAB = 0x0008
+TPS_INVERT = 0x0010 # 1.1
+
+TBN_NONE = 0
+TBN_UP = 1
+TBN_DOWN = 2
+PKEXT_ABSOLUTE = 1
+PKEXT_RELATIVE = 2
+
+# Extension tags.
+WTX_OBT = 0 # Out of bounds tracking
+WTX_FKEYS = 1 # Function keys
+WTX_TILT = 2 # Raw Cartesian tilt; 1.1
+WTX_CSRMASK = 3 # select input by cursor type; 1.1
+WTX_XBTNMASK = 4 # Extended button mask; 1.1
+WTX_EXPKEYS = 5 # ExpressKeys; 1.3 - DEPRECATED USE 2
+WTX_TOUCHSTRIP = 6 # TouchStrips; 1.4
+WTX_TOUCHRING = 7 # TouchRings; 1.4
+WTX_EXPKEYS2 = 8 # ExpressKeys; 1.4
+
+TABLET_PROPERTY_CONTROLCOUNT = 0 # UINT32: number of physical controls on tablet
+TABLET_PROPERTY_FUNCCOUNT = 1 # UINT32: number of functions of control
+TABLET_PROPERTY_AVAILABLE = 2 # BOOL: control/mode is available for override
+TABLET_PROPERTY_MIN = 3 # UINT32: minimum value
+TABLET_PROPERTY_MAX = 4 # UINT32: maximum value
+TABLET_PROPERTY_OVERRIDE = 5 # BOOL: control is overridden
+TABLET_PROPERTY_OVERRIDE_NAME = 6 # UTF-8: Displayable name when control is overridden
+TABLET_PROPERTY_OVERRIDE_ICON = 7 # Image: Icon to show when control is overridden
+TABLET_PROPERTY_ICON_WIDTH = 8 # UINT32: Pixel width of icon display
+TABLET_PROPERTY_ICON_HEIGHT = 9 # UINT32: Pixel height of icon display
+TABLET_PROPERTY_ICON_FORMAT = 10 # UINT32: UINT32: Pixel format of icon display (see TABLET_ICON_FMT_*)
+TABLET_PROPERTY_LOCATION = 11 # UINT32: Physical location of control (see TABLET_LOC_*)
+
+TABLET_LOC_LEFT = 0
+TABLET_LOC_RIGHT = 1
+TABLET_LOC_TOP = 2
+TABLET_LOC_BOTTOM = 3
+TABLET_LOC_TRANSDUCER = 4
+
+lib.WTOpenW.restype = HCTX
+lib.WTOpenW.argtypes = [HWND, ctypes.POINTER(LOGCONTEXT), BOOL]
+
+lib.WTClose.restype = BOOL
+lib.WTClose.argtypes = [HCTX]
+
+lib.WTInfoW.restype = UINT
+lib.WTInfoW.argtypes = [UINT, UINT, LPVOID]
+
+lib.WTPacket.restype = BOOL
+lib.WTPacket.argtypes = [HCTX, UINT, LPVOID]
+
+lib.WTGetW.restype = BOOL
+lib.WTGetW.argtypes = [HCTX, BOOL]
+
+lib.WTExtGet.restype = BOOL
+lib.WTExtGet.argtypes = [HCTX, UINT, LPVOID]
+
+lib.WTExtSet.restype = BOOL
+lib.WTExtSet.argtypes = [HCTX, UINT, LPVOID]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/types.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/types.py
new file mode 100644
index 0000000000000000000000000000000000000000..f0b6fccea90c8adb979b3a48270d98edbcf8dbc2
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/types.py
@@ -0,0 +1,588 @@
+import ctypes
+
+from ctypes import *
+from ctypes.wintypes import *
+
+from . import com
+
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+del t
+del _int_types
+
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+def POINTER_(obj):
+ p = ctypes.POINTER(obj)
+
+ # Convert None to a real NULL pointer to work around bugs
+ # in how ctypes handles None on 64-bit platforms
+ if not isinstance(p.from_param, classmethod):
+ def from_param(cls, x):
+ if x is None:
+ return cls()
+ else:
+ return x
+
+ p.from_param = classmethod(from_param)
+
+ return p
+
+
+c_void_p = POINTER_(c_void)
+INT = c_int
+UBYTE = c_ubyte
+LPVOID = c_void_p
+HCURSOR = HANDLE
+LRESULT = LPARAM
+COLORREF = DWORD
+PVOID = c_void_p
+WCHAR = c_wchar
+BCHAR = c_wchar
+LPRECT = POINTER(RECT)
+LPPOINT = POINTER(POINT)
+LPMSG = POINTER(MSG)
+UINT_PTR = HANDLE
+LONG_PTR = HANDLE
+HDROP = HANDLE
+LPTSTR = LPWSTR
+LPSTREAM = c_void_p
+
+LF_FACESIZE = 32
+CCHDEVICENAME = 32
+CCHFORMNAME = 32
+
+WNDPROC = WINFUNCTYPE(LRESULT, HWND, UINT, WPARAM, LPARAM)
+TIMERPROC = WINFUNCTYPE(None, HWND, UINT, POINTER(UINT), DWORD)
+TIMERAPCPROC = WINFUNCTYPE(None, PVOID, DWORD, DWORD)
+MONITORENUMPROC = WINFUNCTYPE(BOOL, HMONITOR, HDC, LPRECT, LPARAM)
+
+
+def MAKEINTRESOURCE(i):
+ return cast(ctypes.c_void_p(i & 0xFFFF), c_wchar_p)
+
+
+class WNDCLASS(Structure):
+ _fields_ = [
+ ('style', UINT),
+ ('lpfnWndProc', WNDPROC),
+ ('cbClsExtra', c_int),
+ ('cbWndExtra', c_int),
+ ('hInstance', HINSTANCE),
+ ('hIcon', HICON),
+ ('hCursor', HCURSOR),
+ ('hbrBackground', HBRUSH),
+ ('lpszMenuName', c_char_p),
+ ('lpszClassName', c_wchar_p)
+ ]
+
+
+class SECURITY_ATTRIBUTES(Structure):
+ _fields_ = [
+ ("nLength", DWORD),
+ ("lpSecurityDescriptor", c_void_p),
+ ("bInheritHandle", BOOL)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+
+class PIXELFORMATDESCRIPTOR(Structure):
+ _fields_ = [
+ ('nSize', WORD),
+ ('nVersion', WORD),
+ ('dwFlags', DWORD),
+ ('iPixelType', BYTE),
+ ('cColorBits', BYTE),
+ ('cRedBits', BYTE),
+ ('cRedShift', BYTE),
+ ('cGreenBits', BYTE),
+ ('cGreenShift', BYTE),
+ ('cBlueBits', BYTE),
+ ('cBlueShift', BYTE),
+ ('cAlphaBits', BYTE),
+ ('cAlphaShift', BYTE),
+ ('cAccumBits', BYTE),
+ ('cAccumRedBits', BYTE),
+ ('cAccumGreenBits', BYTE),
+ ('cAccumBlueBits', BYTE),
+ ('cAccumAlphaBits', BYTE),
+ ('cDepthBits', BYTE),
+ ('cStencilBits', BYTE),
+ ('cAuxBuffers', BYTE),
+ ('iLayerType', BYTE),
+ ('bReserved', BYTE),
+ ('dwLayerMask', DWORD),
+ ('dwVisibleMask', DWORD),
+ ('dwDamageMask', DWORD)
+ ]
+
+
+class RGBQUAD(Structure):
+ _fields_ = [
+ ('rgbBlue', BYTE),
+ ('rgbGreen', BYTE),
+ ('rgbRed', BYTE),
+ ('rgbReserved', BYTE),
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+
+class CIEXYZ(Structure):
+ _fields_ = [
+ ('ciexyzX', DWORD),
+ ('ciexyzY', DWORD),
+ ('ciexyzZ', DWORD),
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+
+class CIEXYZTRIPLE(Structure):
+ _fields_ = [
+ ('ciexyzRed', CIEXYZ),
+ ('ciexyzBlue', CIEXYZ),
+ ('ciexyzGreen', CIEXYZ),
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+
+class BITMAPINFOHEADER(Structure):
+ _fields_ = [
+ ('biSize', DWORD),
+ ('biWidth', LONG),
+ ('biHeight', LONG),
+ ('biPlanes', WORD),
+ ('biBitCount', WORD),
+ ('biCompression', DWORD),
+ ('biSizeImage', DWORD),
+ ('biXPelsPerMeter', LONG),
+ ('biYPelsPerMeter', LONG),
+ ('biClrUsed', DWORD),
+ ('biClrImportant', DWORD),
+ ]
+
+
+class BITMAPV5HEADER(Structure):
+ _fields_ = [
+ ('bV5Size', DWORD),
+ ('bV5Width', LONG),
+ ('bV5Height', LONG),
+ ('bV5Planes', WORD),
+ ('bV5BitCount', WORD),
+ ('bV5Compression', DWORD),
+ ('bV5SizeImage', DWORD),
+ ('bV5XPelsPerMeter', LONG),
+ ('bV5YPelsPerMeter', LONG),
+ ('bV5ClrUsed', DWORD),
+ ('bV5ClrImportant', DWORD),
+ ('bV5RedMask', DWORD),
+ ('bV5GreenMask', DWORD),
+ ('bV5BlueMask', DWORD),
+ ('bV5AlphaMask', DWORD),
+ ('bV5CSType', DWORD),
+ ('bV5Endpoints', CIEXYZTRIPLE),
+ ('bV5GammaRed', DWORD),
+ ('bV5GammaGreen', DWORD),
+ ('bV5GammaBlue', DWORD),
+ ('bV5Intent', DWORD),
+ ('bV5ProfileData', DWORD),
+ ('bV5ProfileSize', DWORD),
+ ('bV5Reserved', DWORD),
+ ]
+
+
+class BITMAPINFO(Structure):
+ _fields_ = [
+ ('bmiHeader', BITMAPINFOHEADER),
+ ('bmiColors', RGBQUAD * 1)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+
+class LOGFONT(Structure):
+ _fields_ = [
+ ('lfHeight', LONG),
+ ('lfWidth', LONG),
+ ('lfEscapement', LONG),
+ ('lfOrientation', LONG),
+ ('lfWeight', LONG),
+ ('lfItalic', BYTE),
+ ('lfUnderline', BYTE),
+ ('lfStrikeOut', BYTE),
+ ('lfCharSet', BYTE),
+ ('lfOutPrecision', BYTE),
+ ('lfClipPrecision', BYTE),
+ ('lfQuality', BYTE),
+ ('lfPitchAndFamily', BYTE),
+ ('lfFaceName', (c_char * LF_FACESIZE)) # Use ASCII
+ ]
+
+
+class LOGFONTW(Structure):
+ _fields_ = [
+ ('lfHeight', LONG),
+ ('lfWidth', LONG),
+ ('lfEscapement', LONG),
+ ('lfOrientation', LONG),
+ ('lfWeight', LONG),
+ ('lfItalic', BYTE),
+ ('lfUnderline', BYTE),
+ ('lfStrikeOut', BYTE),
+ ('lfCharSet', BYTE),
+ ('lfOutPrecision', BYTE),
+ ('lfClipPrecision', BYTE),
+ ('lfQuality', BYTE),
+ ('lfPitchAndFamily', BYTE),
+ ('lfFaceName', (WCHAR * LF_FACESIZE))
+ ]
+
+
+class TRACKMOUSEEVENT(Structure):
+ _fields_ = [
+ ('cbSize', DWORD),
+ ('dwFlags', DWORD),
+ ('hwndTrack', HWND),
+ ('dwHoverTime', DWORD)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+
+class MINMAXINFO(Structure):
+ _fields_ = [
+ ('ptReserved', POINT),
+ ('ptMaxSize', POINT),
+ ('ptMaxPosition', POINT),
+ ('ptMinTrackSize', POINT),
+ ('ptMaxTrackSize', POINT)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+
+class ABC(Structure):
+ _fields_ = [
+ ('abcA', c_int),
+ ('abcB', c_uint),
+ ('abcC', c_int)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+
+class TEXTMETRIC(Structure):
+ _fields_ = [
+ ('tmHeight', c_long),
+ ('tmAscent', c_long),
+ ('tmDescent', c_long),
+ ('tmInternalLeading', c_long),
+ ('tmExternalLeading', c_long),
+ ('tmAveCharWidth', c_long),
+ ('tmMaxCharWidth', c_long),
+ ('tmWeight', c_long),
+ ('tmOverhang', c_long),
+ ('tmDigitizedAspectX', c_long),
+ ('tmDigitizedAspectY', c_long),
+ ('tmFirstChar', c_char), # Use ASCII
+ ('tmLastChar', c_char),
+ ('tmDefaultChar', c_char),
+ ('tmBreakChar', c_char),
+ ('tmItalic', c_byte),
+ ('tmUnderlined', c_byte),
+ ('tmStruckOut', c_byte),
+ ('tmPitchAndFamily', c_byte),
+ ('tmCharSet', c_byte)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+
+class MONITORINFOEX(Structure):
+ _fields_ = [
+ ('cbSize', DWORD),
+ ('rcMonitor', RECT),
+ ('rcWork', RECT),
+ ('dwFlags', DWORD),
+ ('szDevice', WCHAR * CCHDEVICENAME)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+
+class _DUMMYSTRUCTNAME(Structure):
+ _fields_ = [
+ ('dmOrientation', c_short),
+ ('dmPaperSize', c_short),
+ ('dmPaperLength', c_short),
+ ('dmPaperWidth', c_short),
+ ('dmScale', c_short),
+ ('dmCopies', c_short),
+ ('dmDefaultSource', c_short),
+ ('dmPrintQuality', c_short),
+ ]
+
+
+class _DUMMYSTRUCTNAME2(Structure):
+ _fields_ = [
+ ('dmPosition', POINTL),
+ ('dmDisplayOrientation', DWORD),
+ ('dmDisplayFixedOutput', DWORD)
+ ]
+
+
+class _DUMMYDEVUNION(Union):
+ _anonymous_ = ('_dummystruct1', '_dummystruct2')
+ _fields_ = [
+ ('_dummystruct1', _DUMMYSTRUCTNAME),
+ ('dmPosition', POINTL),
+ ('_dummystruct2', _DUMMYSTRUCTNAME2),
+ ]
+
+
+class DEVMODE(Structure):
+ _anonymous_ = ('_dummyUnion',)
+ _fields_ = [
+ ('dmDeviceName', BCHAR * CCHDEVICENAME),
+ ('dmSpecVersion', WORD),
+ ('dmDriverVersion', WORD),
+ ('dmSize', WORD),
+ ('dmDriverExtra', WORD),
+ ('dmFields', DWORD),
+ # Just using the largest union member here
+ ('_dummyUnion', _DUMMYDEVUNION),
+ # End union
+ ('dmColor', c_short),
+ ('dmDuplex', c_short),
+ ('dmYResolution', c_short),
+ ('dmTTOption', c_short),
+ ('dmCollate', c_short),
+ ('dmFormName', BCHAR * CCHFORMNAME),
+ ('dmLogPixels', WORD),
+ ('dmBitsPerPel', DWORD),
+ ('dmPelsWidth', DWORD),
+ ('dmPelsHeight', DWORD),
+ ('dmDisplayFlags', DWORD), # union with dmNup
+ ('dmDisplayFrequency', DWORD),
+ ('dmICMMethod', DWORD),
+ ('dmICMIntent', DWORD),
+ ('dmDitherType', DWORD),
+ ('dmReserved1', DWORD),
+ ('dmReserved2', DWORD),
+ ('dmPanningWidth', DWORD),
+ ('dmPanningHeight', DWORD),
+ ]
+
+
+class ICONINFO(Structure):
+ _fields_ = [
+ ('fIcon', BOOL),
+ ('xHotspot', DWORD),
+ ('yHotspot', DWORD),
+ ('hbmMask', HBITMAP),
+ ('hbmColor', HBITMAP)
+ ]
+ __slots__ = [f[0] for f in _fields_]
+
+
+class RAWINPUTDEVICE(Structure):
+ _fields_ = [
+ ('usUsagePage', USHORT),
+ ('usUsage', USHORT),
+ ('dwFlags', DWORD),
+ ('hwndTarget', HWND)
+ ]
+
+
+PCRAWINPUTDEVICE = POINTER(RAWINPUTDEVICE)
+HRAWINPUT = HANDLE
+
+
+class RAWINPUTHEADER(Structure):
+ _fields_ = [
+ ('dwType', DWORD),
+ ('dwSize', DWORD),
+ ('hDevice', HANDLE),
+ ('wParam', WPARAM),
+ ]
+
+
+class _Buttons(Structure):
+ _fields_ = [
+ ('usButtonFlags', USHORT),
+ ('usButtonData', USHORT),
+ ]
+
+
+class _U(Union):
+ _anonymous_ = ('_buttons',)
+ _fields_ = [
+ ('ulButtons', ULONG),
+ ('_buttons', _Buttons),
+ ]
+
+
+class RAWMOUSE(Structure):
+ _anonymous_ = ('u',)
+ _fields_ = [
+ ('usFlags', USHORT),
+ ('u', _U),
+ ('ulRawButtons', ULONG),
+ ('lLastX', LONG),
+ ('lLastY', LONG),
+ ('ulExtraInformation', ULONG),
+ ]
+
+
+class RAWKEYBOARD(Structure):
+ _fields_ = [
+ ('MakeCode', USHORT),
+ ('Flags', USHORT),
+ ('Reserved', USHORT),
+ ('VKey', USHORT),
+ ('Message', UINT),
+ ('ExtraInformation', ULONG),
+ ]
+
+
+class RAWHID(Structure):
+ _fields_ = [
+ ('dwSizeHid', DWORD),
+ ('dwCount', DWORD),
+ ('bRawData', POINTER(BYTE)),
+ ]
+
+
+class _RAWINPUTDEVICEUNION(Union):
+ _fields_ = [
+ ('mouse', RAWMOUSE),
+ ('keyboard', RAWKEYBOARD),
+ ('hid', RAWHID),
+ ]
+
+
+class RAWINPUT(Structure):
+ _fields_ = [
+ ('header', RAWINPUTHEADER),
+ ('data', _RAWINPUTDEVICEUNION),
+ ]
+
+
+# PROPVARIANT wrapper, doesn't require InitPropVariantFromInt64 this way.
+class _VarTable(Union):
+ """Must be in an anonymous union or values will not work across various VT's."""
+ _fields_ = [
+ ('llVal', ctypes.c_longlong),
+ ('pwszVal', LPWSTR)
+ ]
+
+
+class PROPVARIANT(Structure):
+ _anonymous_ = ['union']
+
+ _fields_ = [
+ ('vt', ctypes.c_ushort),
+ ('wReserved1', ctypes.c_ubyte),
+ ('wReserved2', ctypes.c_ubyte),
+ ('wReserved3', ctypes.c_ulong),
+ ('union', _VarTable)
+ ]
+
+
+class _VarTableVariant(Union):
+ """Must be in an anonymous union or values will not work across various VT's."""
+ _fields_ = [
+ ('bstrVal', LPCWSTR)
+ ]
+
+
+class VARIANT(Structure):
+ _anonymous_ = ['union']
+
+ _fields_ = [
+ ('vt', ctypes.c_ushort),
+ ('wReserved1', WORD),
+ ('wReserved2', WORD),
+ ('wReserved3', WORD),
+ ('union', _VarTableVariant)
+ ]
+
+
+class DWM_BLURBEHIND(Structure):
+ _fields_ = [
+ ("dwFlags", DWORD),
+ ("fEnable", BOOL),
+ ("hRgnBlur", HRGN),
+ ("fTransitionOnMaximized", DWORD),
+ ]
+
+
+class STATSTG(Structure):
+ _fields_ = [
+ ('pwcsName', LPOLESTR),
+ ('type', DWORD),
+ ('cbSize', ULARGE_INTEGER),
+ ('mtime', FILETIME),
+ ('ctime', FILETIME),
+ ('atime', FILETIME),
+ ('grfMode', DWORD),
+ ('grfLocksSupported', DWORD),
+ ('clsid', DWORD),
+ ('grfStateBits', DWORD),
+ ('reserved', DWORD),
+ ]
+
+
+class TIMECAPS(Structure):
+ _fields_ = (('wPeriodMin', UINT),
+ ('wPeriodMax', UINT))
+
+
+class IStream(com.pIUnknown):
+ _methods_ = [
+ ('Read',
+ com.STDMETHOD(c_void_p, ULONG, POINTER(ULONG))),
+ ('Write',
+ com.STDMETHOD()),
+ ('Seek',
+ com.STDMETHOD(LARGE_INTEGER, DWORD, POINTER(ULARGE_INTEGER))),
+ ('SetSize',
+ com.STDMETHOD()),
+ ('CopyTo',
+ com.STDMETHOD()),
+ ('Commit',
+ com.STDMETHOD()),
+ ('Revert',
+ com.STDMETHOD()),
+ ('LockRegion',
+ com.STDMETHOD()),
+ ('UnlockRegion',
+ com.STDMETHOD()),
+ ('Stat',
+ com.STDMETHOD(POINTER(STATSTG), UINT)),
+ ('Clone',
+ com.STDMETHOD()),
+ ]
+
+class DEV_BROADCAST_HDR(Structure):
+ _fields_ = (
+ ('dbch_size', DWORD),
+ ('dbch_devicetype', DWORD),
+ ('dbch_reserved', DWORD),
+ )
+
+class DEV_BROADCAST_DEVICEINTERFACE(Structure):
+ _fields_ = (
+ ('dbcc_size', DWORD),
+ ('dbcc_devicetype', DWORD),
+ ('dbcc_reserved', DWORD),
+ ('dbcc_classguid', com.GUID),
+ ('dbcc_name', ctypes.c_wchar * 256)
+ )
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/winkey.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/winkey.py
new file mode 100644
index 0000000000000000000000000000000000000000..9205b25345a4cabcc2701f69728f33d3a91b8935
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/win32/winkey.py
@@ -0,0 +1,197 @@
+from pyglet.window import key
+from .constants import *
+
+keymap = {
+ ord('A'): key.A,
+ ord('B'): key.B,
+ ord('C'): key.C,
+ ord('D'): key.D,
+ ord('E'): key.E,
+ ord('F'): key.F,
+ ord('G'): key.G,
+ ord('H'): key.H,
+ ord('I'): key.I,
+ ord('J'): key.J,
+ ord('K'): key.K,
+ ord('L'): key.L,
+ ord('M'): key.M,
+ ord('N'): key.N,
+ ord('O'): key.O,
+ ord('P'): key.P,
+ ord('Q'): key.Q,
+ ord('R'): key.R,
+ ord('S'): key.S,
+ ord('T'): key.T,
+ ord('U'): key.U,
+ ord('V'): key.V,
+ ord('W'): key.W,
+ ord('X'): key.X,
+ ord('Y'): key.Y,
+ ord('Z'): key.Z,
+ ord('0'): key._0,
+ ord('1'): key._1,
+ ord('2'): key._2,
+ ord('3'): key._3,
+ ord('4'): key._4,
+ ord('5'): key._5,
+ ord('6'): key._6,
+ ord('7'): key._7,
+ ord('8'): key._8,
+ ord('9'): key._9,
+ ord('\b'): key.BACKSPACE,
+
+ # By experiment:
+ 0x14: key.CAPSLOCK,
+ 0x5d: key.MENU,
+
+ # VK_LBUTTON: ,
+ # VK_RBUTTON: ,
+ VK_CANCEL: key.CANCEL,
+ # VK_MBUTTON: ,
+ # VK_BACK: ,
+ VK_TAB: key.TAB,
+ # VK_CLEAR: ,
+ VK_RETURN: key.RETURN,
+ VK_SHIFT: key.LSHIFT,
+ VK_CONTROL: key.LCTRL,
+ VK_MENU: key.LALT,
+ VK_PAUSE: key.PAUSE,
+ # VK_CAPITAL: ,
+ # VK_KANA: ,
+ # VK_HANGEUL: ,
+ # VK_HANGUL: ,
+ # VK_JUNJA: ,
+ # VK_FINAL: ,
+ # VK_HANJA: ,
+ # VK_KANJI: ,
+ VK_ESCAPE: key.ESCAPE,
+ # VK_CONVERT: ,
+ # VK_NONCONVERT: ,
+ # VK_ACCEPT: ,
+ # VK_MODECHANGE: ,
+ VK_SPACE: key.SPACE,
+ VK_PRIOR: key.PAGEUP,
+ VK_NEXT: key.PAGEDOWN,
+ VK_END: key.END,
+ VK_HOME: key.HOME,
+ VK_LEFT: key.LEFT,
+ VK_UP: key.UP,
+ VK_RIGHT: key.RIGHT,
+ VK_DOWN: key.DOWN,
+ # VK_SELECT: ,
+ VK_PRINT: key.PRINT,
+ # VK_EXECUTE: ,
+ # VK_SNAPSHOT: ,
+ VK_INSERT: key.INSERT,
+ VK_DELETE: key.DELETE,
+ VK_HELP: key.HELP,
+ VK_LWIN: key.LWINDOWS,
+ VK_RWIN: key.RWINDOWS,
+ # VK_APPS: ,
+ VK_NUMPAD0: key.NUM_0,
+ VK_NUMPAD1: key.NUM_1,
+ VK_NUMPAD2: key.NUM_2,
+ VK_NUMPAD3: key.NUM_3,
+ VK_NUMPAD4: key.NUM_4,
+ VK_NUMPAD5: key.NUM_5,
+ VK_NUMPAD6: key.NUM_6,
+ VK_NUMPAD7: key.NUM_7,
+ VK_NUMPAD8: key.NUM_8,
+ VK_NUMPAD9: key.NUM_9,
+ VK_MULTIPLY: key.NUM_MULTIPLY,
+ VK_ADD: key.NUM_ADD,
+ # VK_SEPARATOR: ,
+ VK_SUBTRACT: key.NUM_SUBTRACT,
+ VK_DECIMAL: key.NUM_DECIMAL,
+ VK_DIVIDE: key.NUM_DIVIDE,
+ VK_F1: key.F1,
+ VK_F2: key.F2,
+ VK_F3: key.F3,
+ VK_F4: key.F4,
+ VK_F5: key.F5,
+ VK_F6: key.F6,
+ VK_F7: key.F7,
+ VK_F8: key.F8,
+ VK_F9: key.F9,
+ VK_F10: key.F10,
+ VK_F11: key.F11,
+ VK_F12: key.F12,
+ VK_F13: key.F13,
+ VK_F14: key.F14,
+ VK_F15: key.F15,
+ VK_F16: key.F16,
+ VK_F17: key.F17,
+ VK_F18: key.F18,
+ VK_F19: key.F19,
+ VK_F20: key.F20,
+ VK_F21: key.F21,
+ VK_F22: key.F22,
+ VK_F23: key.F23,
+ VK_F24: key.F24,
+ VK_NUMLOCK: key.NUMLOCK,
+ VK_SCROLL: key.SCROLLLOCK,
+ VK_LSHIFT: key.LSHIFT,
+ VK_RSHIFT: key.RSHIFT,
+ VK_LCONTROL: key.LCTRL,
+ VK_RCONTROL: key.RCTRL,
+ VK_LMENU: key.LALT,
+ VK_RMENU: key.RALT,
+ # VK_PROCESSKEY: ,
+ # VK_ATTN: ,
+ # VK_CRSEL: ,
+ # VK_EXSEL: ,
+ # VK_EREOF: ,
+ # VK_PLAY: ,
+ # VK_ZOOM: ,
+ # VK_NONAME: ,
+ # VK_PA1: ,
+ # VK_OEM_CLEAR: ,
+ # VK_XBUTTON1: ,
+ # VK_XBUTTON2: ,
+ # VK_VOLUME_MUTE: ,
+ # VK_VOLUME_DOWN: ,
+ # VK_VOLUME_UP: ,
+ # VK_MEDIA_NEXT_TRACK: ,
+ # VK_MEDIA_PREV_TRACK: ,
+ # VK_MEDIA_PLAY_PAUSE: ,
+ # VK_BROWSER_BACK: ,
+ # VK_BROWSER_FORWARD: ,
+}
+
+# Keys that must be translated via MapVirtualKey, as the virtual key code
+# is language and keyboard dependent.
+chmap = {
+ ord('!'): key.EXCLAMATION,
+ ord('"'): key.DOUBLEQUOTE,
+ ord('#'): key.HASH,
+ ord('$'): key.DOLLAR,
+ ord('%'): key.PERCENT,
+ ord('&'): key.AMPERSAND,
+ ord("'"): key.APOSTROPHE,
+ ord('('): key.PARENLEFT,
+ ord(')'): key.PARENRIGHT,
+ ord('*'): key.ASTERISK,
+ ord('+'): key.PLUS,
+ ord(','): key.COMMA,
+ ord('-'): key.MINUS,
+ ord('.'): key.PERIOD,
+ ord('/'): key.SLASH,
+ ord(':'): key.COLON,
+ ord(';'): key.SEMICOLON,
+ ord('<'): key.LESS,
+ ord('='): key.EQUAL,
+ ord('>'): key.GREATER,
+ ord('?'): key.QUESTION,
+ ord('@'): key.AT,
+ ord('['): key.BRACKETLEFT,
+ ord('\\'): key.BACKSLASH,
+ ord(']'): key.BRACKETRIGHT,
+ ord('\x5e'): key.ASCIICIRCUM,
+ ord('_'): key.UNDERSCORE,
+ ord('\x60'): key.GRAVE,
+ ord('`'): key.QUOTELEFT,
+ ord('{'): key.BRACELEFT,
+ ord('|'): key.BAR,
+ ord('}'): key.BRACERIGHT,
+ ord('~'): key.ASCIITILDE,
+}
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/__init__.py
@@ -0,0 +1 @@
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/cursorfont.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/cursorfont.py
new file mode 100644
index 0000000000000000000000000000000000000000..4a3a3267a84fe281122dfbb92b9a3862db39f0ca
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/cursorfont.py
@@ -0,0 +1,80 @@
+# /usr/include/X11/cursorfont.h
+
+XC_num_glyphs = 154
+XC_X_cursor = 0
+XC_arrow = 2
+XC_based_arrow_down = 4
+XC_based_arrow_up = 6
+XC_boat = 8
+XC_bogosity = 10
+XC_bottom_left_corner = 12
+XC_bottom_right_corner = 14
+XC_bottom_side = 16
+XC_bottom_tee = 18
+XC_box_spiral = 20
+XC_center_ptr = 22
+XC_circle = 24
+XC_clock = 26
+XC_coffee_mug = 28
+XC_cross = 30
+XC_cross_reverse = 32
+XC_crosshair = 34
+XC_diamond_cross = 36
+XC_dot = 38
+XC_dotbox = 40
+XC_double_arrow = 42
+XC_draft_large = 44
+XC_draft_small = 46
+XC_draped_box = 48
+XC_exchange = 50
+XC_fleur = 52
+XC_gobbler = 54
+XC_gumby = 56
+XC_hand1 = 58
+XC_hand2 = 60
+XC_heart = 62
+XC_icon = 64
+XC_iron_cross = 66
+XC_left_ptr = 68
+XC_left_side = 70
+XC_left_tee = 72
+XC_leftbutton = 74
+XC_ll_angle = 76
+XC_lr_angle = 78
+XC_man = 80
+XC_middlebutton = 82
+XC_mouse = 84
+XC_pencil = 86
+XC_pirate = 88
+XC_plus = 90
+XC_question_arrow = 92
+XC_right_ptr = 94
+XC_right_side = 96
+XC_right_tee = 98
+XC_rightbutton = 100
+XC_rtl_logo = 102
+XC_sailboat = 104
+XC_sb_down_arrow = 106
+XC_sb_h_double_arrow = 108
+XC_sb_left_arrow = 110
+XC_sb_right_arrow = 112
+XC_sb_up_arrow = 114
+XC_sb_v_double_arrow = 116
+XC_shuttle = 118
+XC_sizing = 120
+XC_spider = 122
+XC_spraycan = 124
+XC_star = 126
+XC_target = 128
+XC_tcross = 130
+XC_top_left_arrow = 132
+XC_top_left_corner = 134
+XC_top_right_corner = 136
+XC_top_side = 138
+XC_top_tee = 140
+XC_trek = 142
+XC_ul_angle = 144
+XC_umbrella = 146
+XC_ur_angle = 148
+XC_watch = 150
+XC_xterm = 152
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xf86vmode.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xf86vmode.py
new file mode 100644
index 0000000000000000000000000000000000000000..85fb0802d5f02f430c1f2430397c9e3cc0a9b359
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xf86vmode.py
@@ -0,0 +1,344 @@
+"""Wrapper for Xxf86vm
+
+Generated with:
+tools/genwrappers.py xf86vmode
+
+Do not modify this file.
+"""
+
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('Xxf86vm')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+import pyglet.libs.x11.xlib
+
+X_XF86VidModeQueryVersion = 0 # /usr/include/X11/extensions/xf86vmode.h:4885
+X_XF86VidModeGetModeLine = 1 # /usr/include/X11/extensions/xf86vmode.h:4886
+X_XF86VidModeModModeLine = 2 # /usr/include/X11/extensions/xf86vmode.h:4887
+X_XF86VidModeSwitchMode = 3 # /usr/include/X11/extensions/xf86vmode.h:4888
+X_XF86VidModeGetMonitor = 4 # /usr/include/X11/extensions/xf86vmode.h:4889
+X_XF86VidModeLockModeSwitch = 5 # /usr/include/X11/extensions/xf86vmode.h:4890
+X_XF86VidModeGetAllModeLines = 6 # /usr/include/X11/extensions/xf86vmode.h:4891
+X_XF86VidModeAddModeLine = 7 # /usr/include/X11/extensions/xf86vmode.h:4892
+X_XF86VidModeDeleteModeLine = 8 # /usr/include/X11/extensions/xf86vmode.h:4893
+X_XF86VidModeValidateModeLine = 9 # /usr/include/X11/extensions/xf86vmode.h:4894
+X_XF86VidModeSwitchToMode = 10 # /usr/include/X11/extensions/xf86vmode.h:4895
+X_XF86VidModeGetViewPort = 11 # /usr/include/X11/extensions/xf86vmode.h:4896
+X_XF86VidModeSetViewPort = 12 # /usr/include/X11/extensions/xf86vmode.h:4897
+X_XF86VidModeGetDotClocks = 13 # /usr/include/X11/extensions/xf86vmode.h:4899
+X_XF86VidModeSetClientVersion = 14 # /usr/include/X11/extensions/xf86vmode.h:4900
+X_XF86VidModeSetGamma = 15 # /usr/include/X11/extensions/xf86vmode.h:4901
+X_XF86VidModeGetGamma = 16 # /usr/include/X11/extensions/xf86vmode.h:4902
+X_XF86VidModeGetGammaRamp = 17 # /usr/include/X11/extensions/xf86vmode.h:4903
+X_XF86VidModeSetGammaRamp = 18 # /usr/include/X11/extensions/xf86vmode.h:4904
+X_XF86VidModeGetGammaRampSize = 19 # /usr/include/X11/extensions/xf86vmode.h:4905
+X_XF86VidModeGetPermissions = 20 # /usr/include/X11/extensions/xf86vmode.h:4906
+CLKFLAG_PROGRAMABLE = 1 # /usr/include/X11/extensions/xf86vmode.h:4908
+XF86VidModeNumberEvents = 0 # /usr/include/X11/extensions/xf86vmode.h:4919
+XF86VidModeBadClock = 0 # /usr/include/X11/extensions/xf86vmode.h:4922
+XF86VidModeBadHTimings = 1 # /usr/include/X11/extensions/xf86vmode.h:4923
+XF86VidModeBadVTimings = 2 # /usr/include/X11/extensions/xf86vmode.h:4924
+XF86VidModeModeUnsuitable = 3 # /usr/include/X11/extensions/xf86vmode.h:4925
+XF86VidModeExtensionDisabled = 4 # /usr/include/X11/extensions/xf86vmode.h:4926
+XF86VidModeClientNotLocal = 5 # /usr/include/X11/extensions/xf86vmode.h:4927
+XF86VidModeZoomLocked = 6 # /usr/include/X11/extensions/xf86vmode.h:4928
+XF86VidModeNumberErrors = 7 # /usr/include/X11/extensions/xf86vmode.h:4929
+XF86VM_READ_PERMISSION = 1 # /usr/include/X11/extensions/xf86vmode.h:4931
+XF86VM_WRITE_PERMISSION = 2 # /usr/include/X11/extensions/xf86vmode.h:4932
+class struct_anon_93(Structure):
+ __slots__ = [
+ 'hdisplay',
+ 'hsyncstart',
+ 'hsyncend',
+ 'htotal',
+ 'hskew',
+ 'vdisplay',
+ 'vsyncstart',
+ 'vsyncend',
+ 'vtotal',
+ 'flags',
+ 'privsize',
+ 'private',
+ ]
+INT32 = c_int # /usr/include/X11/Xmd.h:135
+struct_anon_93._fields_ = [
+ ('hdisplay', c_ushort),
+ ('hsyncstart', c_ushort),
+ ('hsyncend', c_ushort),
+ ('htotal', c_ushort),
+ ('hskew', c_ushort),
+ ('vdisplay', c_ushort),
+ ('vsyncstart', c_ushort),
+ ('vsyncend', c_ushort),
+ ('vtotal', c_ushort),
+ ('flags', c_uint),
+ ('privsize', c_int),
+ ('private', POINTER(INT32)),
+]
+
+XF86VidModeModeLine = struct_anon_93 # /usr/include/X11/extensions/xf86vmode.h:4954
+class struct_anon_94(Structure):
+ __slots__ = [
+ 'dotclock',
+ 'hdisplay',
+ 'hsyncstart',
+ 'hsyncend',
+ 'htotal',
+ 'hskew',
+ 'vdisplay',
+ 'vsyncstart',
+ 'vsyncend',
+ 'vtotal',
+ 'flags',
+ 'privsize',
+ 'private',
+ ]
+struct_anon_94._fields_ = [
+ ('dotclock', c_uint),
+ ('hdisplay', c_ushort),
+ ('hsyncstart', c_ushort),
+ ('hsyncend', c_ushort),
+ ('htotal', c_ushort),
+ ('hskew', c_ushort),
+ ('vdisplay', c_ushort),
+ ('vsyncstart', c_ushort),
+ ('vsyncend', c_ushort),
+ ('vtotal', c_ushort),
+ ('flags', c_uint),
+ ('privsize', c_int),
+ ('private', POINTER(INT32)),
+]
+
+XF86VidModeModeInfo = struct_anon_94 # /usr/include/X11/extensions/xf86vmode.h:4975
+class struct_anon_95(Structure):
+ __slots__ = [
+ 'hi',
+ 'lo',
+ ]
+struct_anon_95._fields_ = [
+ ('hi', c_float),
+ ('lo', c_float),
+]
+
+XF86VidModeSyncRange = struct_anon_95 # /usr/include/X11/extensions/xf86vmode.h:4980
+class struct_anon_96(Structure):
+ __slots__ = [
+ 'vendor',
+ 'model',
+ 'EMPTY',
+ 'nhsync',
+ 'hsync',
+ 'nvsync',
+ 'vsync',
+ ]
+struct_anon_96._fields_ = [
+ ('vendor', c_char_p),
+ ('model', c_char_p),
+ ('EMPTY', c_float),
+ ('nhsync', c_ubyte),
+ ('hsync', POINTER(XF86VidModeSyncRange)),
+ ('nvsync', c_ubyte),
+ ('vsync', POINTER(XF86VidModeSyncRange)),
+]
+
+XF86VidModeMonitor = struct_anon_96 # /usr/include/X11/extensions/xf86vmode.h:4990
+class struct_anon_97(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'root',
+ 'state',
+ 'kind',
+ 'forced',
+ 'time',
+ ]
+Display = pyglet.libs.x11.xlib.Display
+Window = pyglet.libs.x11.xlib.Window
+Time = pyglet.libs.x11.xlib.Time
+struct_anon_97._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('root', Window),
+ ('state', c_int),
+ ('kind', c_int),
+ ('forced', c_int),
+ ('time', Time),
+]
+
+XF86VidModeNotifyEvent = struct_anon_97 # /usr/include/X11/extensions/xf86vmode.h:5002
+class struct_anon_98(Structure):
+ __slots__ = [
+ 'red',
+ 'green',
+ 'blue',
+ ]
+struct_anon_98._fields_ = [
+ ('red', c_float),
+ ('green', c_float),
+ ('blue', c_float),
+]
+
+XF86VidModeGamma = struct_anon_98 # /usr/include/X11/extensions/xf86vmode.h:5008
+# /usr/include/X11/extensions/xf86vmode.h:5018
+XF86VidModeQueryVersion = _lib.XF86VidModeQueryVersion
+XF86VidModeQueryVersion.restype = c_int
+XF86VidModeQueryVersion.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5024
+XF86VidModeQueryExtension = _lib.XF86VidModeQueryExtension
+XF86VidModeQueryExtension.restype = c_int
+XF86VidModeQueryExtension.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5030
+XF86VidModeSetClientVersion = _lib.XF86VidModeSetClientVersion
+XF86VidModeSetClientVersion.restype = c_int
+XF86VidModeSetClientVersion.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5034
+XF86VidModeGetModeLine = _lib.XF86VidModeGetModeLine
+XF86VidModeGetModeLine.restype = c_int
+XF86VidModeGetModeLine.argtypes = [POINTER(Display), c_int, POINTER(c_int), POINTER(XF86VidModeModeLine)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5041
+XF86VidModeGetAllModeLines = _lib.XF86VidModeGetAllModeLines
+XF86VidModeGetAllModeLines.restype = c_int
+XF86VidModeGetAllModeLines.argtypes = [POINTER(Display), c_int, POINTER(c_int), POINTER(POINTER(POINTER(XF86VidModeModeInfo)))]
+
+# /usr/include/X11/extensions/xf86vmode.h:5048
+XF86VidModeAddModeLine = _lib.XF86VidModeAddModeLine
+XF86VidModeAddModeLine.restype = c_int
+XF86VidModeAddModeLine.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeModeInfo), POINTER(XF86VidModeModeInfo)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5055
+XF86VidModeDeleteModeLine = _lib.XF86VidModeDeleteModeLine
+XF86VidModeDeleteModeLine.restype = c_int
+XF86VidModeDeleteModeLine.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeModeInfo)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5061
+XF86VidModeModModeLine = _lib.XF86VidModeModModeLine
+XF86VidModeModModeLine.restype = c_int
+XF86VidModeModModeLine.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeModeLine)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5067
+XF86VidModeValidateModeLine = _lib.XF86VidModeValidateModeLine
+XF86VidModeValidateModeLine.restype = c_int
+XF86VidModeValidateModeLine.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeModeInfo)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5073
+XF86VidModeSwitchMode = _lib.XF86VidModeSwitchMode
+XF86VidModeSwitchMode.restype = c_int
+XF86VidModeSwitchMode.argtypes = [POINTER(Display), c_int, c_int]
+
+# /usr/include/X11/extensions/xf86vmode.h:5079
+XF86VidModeSwitchToMode = _lib.XF86VidModeSwitchToMode
+XF86VidModeSwitchToMode.restype = c_int
+XF86VidModeSwitchToMode.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeModeInfo)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5085
+XF86VidModeLockModeSwitch = _lib.XF86VidModeLockModeSwitch
+XF86VidModeLockModeSwitch.restype = c_int
+XF86VidModeLockModeSwitch.argtypes = [POINTER(Display), c_int, c_int]
+
+# /usr/include/X11/extensions/xf86vmode.h:5091
+XF86VidModeGetMonitor = _lib.XF86VidModeGetMonitor
+XF86VidModeGetMonitor.restype = c_int
+XF86VidModeGetMonitor.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeMonitor)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5097
+XF86VidModeGetViewPort = _lib.XF86VidModeGetViewPort
+XF86VidModeGetViewPort.restype = c_int
+XF86VidModeGetViewPort.argtypes = [POINTER(Display), c_int, POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5104
+XF86VidModeSetViewPort = _lib.XF86VidModeSetViewPort
+XF86VidModeSetViewPort.restype = c_int
+XF86VidModeSetViewPort.argtypes = [POINTER(Display), c_int, c_int, c_int]
+
+# /usr/include/X11/extensions/xf86vmode.h:5111
+XF86VidModeGetDotClocks = _lib.XF86VidModeGetDotClocks
+XF86VidModeGetDotClocks.restype = c_int
+XF86VidModeGetDotClocks.argtypes = [POINTER(Display), c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(POINTER(c_int))]
+
+# /usr/include/X11/extensions/xf86vmode.h:5120
+XF86VidModeGetGamma = _lib.XF86VidModeGetGamma
+XF86VidModeGetGamma.restype = c_int
+XF86VidModeGetGamma.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeGamma)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5126
+XF86VidModeSetGamma = _lib.XF86VidModeSetGamma
+XF86VidModeSetGamma.restype = c_int
+XF86VidModeSetGamma.argtypes = [POINTER(Display), c_int, POINTER(XF86VidModeGamma)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5132
+XF86VidModeSetGammaRamp = _lib.XF86VidModeSetGammaRamp
+XF86VidModeSetGammaRamp.restype = c_int
+XF86VidModeSetGammaRamp.argtypes = [POINTER(Display), c_int, c_int, POINTER(c_ushort), POINTER(c_ushort), POINTER(c_ushort)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5141
+XF86VidModeGetGammaRamp = _lib.XF86VidModeGetGammaRamp
+XF86VidModeGetGammaRamp.restype = c_int
+XF86VidModeGetGammaRamp.argtypes = [POINTER(Display), c_int, c_int, POINTER(c_ushort), POINTER(c_ushort), POINTER(c_ushort)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5150
+XF86VidModeGetGammaRampSize = _lib.XF86VidModeGetGammaRampSize
+XF86VidModeGetGammaRampSize.restype = c_int
+XF86VidModeGetGammaRampSize.argtypes = [POINTER(Display), c_int, POINTER(c_int)]
+
+# /usr/include/X11/extensions/xf86vmode.h:5156
+XF86VidModeGetPermissions = _lib.XF86VidModeGetPermissions
+XF86VidModeGetPermissions.restype = c_int
+XF86VidModeGetPermissions.argtypes = [POINTER(Display), c_int, POINTER(c_int)]
+
+
+__all__ = ['X_XF86VidModeQueryVersion', 'X_XF86VidModeGetModeLine',
+'X_XF86VidModeModModeLine', 'X_XF86VidModeSwitchMode',
+'X_XF86VidModeGetMonitor', 'X_XF86VidModeLockModeSwitch',
+'X_XF86VidModeGetAllModeLines', 'X_XF86VidModeAddModeLine',
+'X_XF86VidModeDeleteModeLine', 'X_XF86VidModeValidateModeLine',
+'X_XF86VidModeSwitchToMode', 'X_XF86VidModeGetViewPort',
+'X_XF86VidModeSetViewPort', 'X_XF86VidModeGetDotClocks',
+'X_XF86VidModeSetClientVersion', 'X_XF86VidModeSetGamma',
+'X_XF86VidModeGetGamma', 'X_XF86VidModeGetGammaRamp',
+'X_XF86VidModeSetGammaRamp', 'X_XF86VidModeGetGammaRampSize',
+'X_XF86VidModeGetPermissions', 'CLKFLAG_PROGRAMABLE',
+'XF86VidModeNumberEvents', 'XF86VidModeBadClock', 'XF86VidModeBadHTimings',
+'XF86VidModeBadVTimings', 'XF86VidModeModeUnsuitable',
+'XF86VidModeExtensionDisabled', 'XF86VidModeClientNotLocal',
+'XF86VidModeZoomLocked', 'XF86VidModeNumberErrors', 'XF86VM_READ_PERMISSION',
+'XF86VM_WRITE_PERMISSION', 'XF86VidModeModeLine', 'XF86VidModeModeInfo',
+'XF86VidModeSyncRange', 'XF86VidModeMonitor', 'XF86VidModeNotifyEvent',
+'XF86VidModeGamma', 'XF86VidModeQueryVersion', 'XF86VidModeQueryExtension',
+'XF86VidModeSetClientVersion', 'XF86VidModeGetModeLine',
+'XF86VidModeGetAllModeLines', 'XF86VidModeAddModeLine',
+'XF86VidModeDeleteModeLine', 'XF86VidModeModModeLine',
+'XF86VidModeValidateModeLine', 'XF86VidModeSwitchMode',
+'XF86VidModeSwitchToMode', 'XF86VidModeLockModeSwitch',
+'XF86VidModeGetMonitor', 'XF86VidModeGetViewPort', 'XF86VidModeSetViewPort',
+'XF86VidModeGetDotClocks', 'XF86VidModeGetGamma', 'XF86VidModeSetGamma',
+'XF86VidModeSetGammaRamp', 'XF86VidModeGetGammaRamp',
+'XF86VidModeGetGammaRampSize', 'XF86VidModeGetPermissions']
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xinerama.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xinerama.py
new file mode 100644
index 0000000000000000000000000000000000000000..6386941222f8588539b60b61d2d576998b7c5ece
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xinerama.py
@@ -0,0 +1,75 @@
+"""Wrapper for Xinerama
+
+Generated with:
+tools/genwrappers.py xinerama
+
+Do not modify this file.
+"""
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('Xinerama')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+import pyglet.libs.x11.xlib
+
+class struct_anon_93(Structure):
+ __slots__ = [
+ 'screen_number',
+ 'x_org',
+ 'y_org',
+ 'width',
+ 'height',
+ ]
+struct_anon_93._fields_ = [
+ ('screen_number', c_int),
+ ('x_org', c_short),
+ ('y_org', c_short),
+ ('width', c_short),
+ ('height', c_short),
+]
+
+XineramaScreenInfo = struct_anon_93 # /usr/include/X11/extensions/Xinerama.h:40
+Display = pyglet.libs.x11.xlib.Display
+# /usr/include/X11/extensions/Xinerama.h:44
+XineramaQueryExtension = _lib.XineramaQueryExtension
+XineramaQueryExtension.restype = c_int
+XineramaQueryExtension.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/Xinerama.h:50
+XineramaQueryVersion = _lib.XineramaQueryVersion
+XineramaQueryVersion.restype = c_int
+XineramaQueryVersion.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/Xinerama.h:56
+XineramaIsActive = _lib.XineramaIsActive
+XineramaIsActive.restype = c_int
+XineramaIsActive.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/extensions/Xinerama.h:67
+XineramaQueryScreens = _lib.XineramaQueryScreens
+XineramaQueryScreens.restype = POINTER(XineramaScreenInfo)
+XineramaQueryScreens.argtypes = [POINTER(Display), POINTER(c_int)]
+
+
+__all__ = ['XineramaScreenInfo', 'XineramaQueryExtension',
+'XineramaQueryVersion', 'XineramaIsActive', 'XineramaQueryScreens']
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xinput.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xinput.py
new file mode 100644
index 0000000000000000000000000000000000000000..936bafe37347dc863fe4489b9bca42654127e28e
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xinput.py
@@ -0,0 +1,1662 @@
+"""Wrapper for Xi
+
+Generated with:
+tools/genwrappers.py xinput
+
+Do not modify this file.
+"""
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('Xi')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+import pyglet.libs.x11.xlib
+
+sz_xGetExtensionVersionReq = 8 # /usr/include/X11/extensions/XI.h:56
+sz_xGetExtensionVersionReply = 32 # /usr/include/X11/extensions/XI.h:57
+sz_xListInputDevicesReq = 4 # /usr/include/X11/extensions/XI.h:58
+sz_xListInputDevicesReply = 32 # /usr/include/X11/extensions/XI.h:59
+sz_xListDevicePropertiesReq = 8 # /usr/include/X11/extensions/XI.h
+sz_xListDevicePropertiesReply = 32 # /usr/include/X11/extensions/XI.h
+sz_xGetDevicePropertyReq = 24 # /usr/include/X11/extensions/XI.h
+sz_xGetDevicePropertyReply = 32 # /usr/include/X11/extensions/XI.h
+sz_xOpenDeviceReq = 8 # /usr/include/X11/extensions/XI.h:60
+sz_xOpenDeviceReply = 32 # /usr/include/X11/extensions/XI.h:61
+sz_xCloseDeviceReq = 8 # /usr/include/X11/extensions/XI.h:62
+sz_xSetDeviceModeReq = 8 # /usr/include/X11/extensions/XI.h:63
+sz_xSetDeviceModeReply = 32 # /usr/include/X11/extensions/XI.h:64
+sz_xSelectExtensionEventReq = 12 # /usr/include/X11/extensions/XI.h:65
+sz_xGetSelectedExtensionEventsReq = 8 # /usr/include/X11/extensions/XI.h:66
+sz_xGetSelectedExtensionEventsReply = 32 # /usr/include/X11/extensions/XI.h:67
+sz_xChangeDeviceDontPropagateListReq = 12 # /usr/include/X11/extensions/XI.h:68
+sz_xGetDeviceDontPropagateListReq = 8 # /usr/include/X11/extensions/XI.h:69
+sz_xGetDeviceDontPropagateListReply = 32 # /usr/include/X11/extensions/XI.h:70
+sz_xGetDeviceMotionEventsReq = 16 # /usr/include/X11/extensions/XI.h:71
+sz_xGetDeviceMotionEventsReply = 32 # /usr/include/X11/extensions/XI.h:72
+sz_xChangeKeyboardDeviceReq = 8 # /usr/include/X11/extensions/XI.h:73
+sz_xChangeKeyboardDeviceReply = 32 # /usr/include/X11/extensions/XI.h:74
+sz_xChangePointerDeviceReq = 8 # /usr/include/X11/extensions/XI.h:75
+sz_xChangePointerDeviceReply = 32 # /usr/include/X11/extensions/XI.h:76
+sz_xGrabDeviceReq = 20 # /usr/include/X11/extensions/XI.h:77
+sz_xGrabDeviceReply = 32 # /usr/include/X11/extensions/XI.h:78
+sz_xUngrabDeviceReq = 12 # /usr/include/X11/extensions/XI.h:79
+sz_xGrabDeviceKeyReq = 20 # /usr/include/X11/extensions/XI.h:80
+sz_xGrabDeviceKeyReply = 32 # /usr/include/X11/extensions/XI.h:81
+sz_xUngrabDeviceKeyReq = 16 # /usr/include/X11/extensions/XI.h:82
+sz_xGrabDeviceButtonReq = 20 # /usr/include/X11/extensions/XI.h:83
+sz_xGrabDeviceButtonReply = 32 # /usr/include/X11/extensions/XI.h:84
+sz_xUngrabDeviceButtonReq = 16 # /usr/include/X11/extensions/XI.h:85
+sz_xAllowDeviceEventsReq = 12 # /usr/include/X11/extensions/XI.h:86
+sz_xGetDeviceFocusReq = 8 # /usr/include/X11/extensions/XI.h:87
+sz_xGetDeviceFocusReply = 32 # /usr/include/X11/extensions/XI.h:88
+sz_xSetDeviceFocusReq = 16 # /usr/include/X11/extensions/XI.h:89
+sz_xGetFeedbackControlReq = 8 # /usr/include/X11/extensions/XI.h:90
+sz_xGetFeedbackControlReply = 32 # /usr/include/X11/extensions/XI.h:91
+sz_xChangeFeedbackControlReq = 12 # /usr/include/X11/extensions/XI.h:92
+sz_xGetDeviceKeyMappingReq = 8 # /usr/include/X11/extensions/XI.h:93
+sz_xGetDeviceKeyMappingReply = 32 # /usr/include/X11/extensions/XI.h:94
+sz_xChangeDeviceKeyMappingReq = 8 # /usr/include/X11/extensions/XI.h:95
+sz_xGetDeviceModifierMappingReq = 8 # /usr/include/X11/extensions/XI.h:96
+sz_xSetDeviceModifierMappingReq = 8 # /usr/include/X11/extensions/XI.h:97
+sz_xSetDeviceModifierMappingReply = 32 # /usr/include/X11/extensions/XI.h:98
+sz_xGetDeviceButtonMappingReq = 8 # /usr/include/X11/extensions/XI.h:99
+sz_xGetDeviceButtonMappingReply = 32 # /usr/include/X11/extensions/XI.h:100
+sz_xSetDeviceButtonMappingReq = 8 # /usr/include/X11/extensions/XI.h:101
+sz_xSetDeviceButtonMappingReply = 32 # /usr/include/X11/extensions/XI.h:102
+sz_xQueryDeviceStateReq = 8 # /usr/include/X11/extensions/XI.h:103
+sz_xQueryDeviceStateReply = 32 # /usr/include/X11/extensions/XI.h:104
+sz_xSendExtensionEventReq = 16 # /usr/include/X11/extensions/XI.h:105
+sz_xDeviceBellReq = 8 # /usr/include/X11/extensions/XI.h:106
+sz_xSetDeviceValuatorsReq = 8 # /usr/include/X11/extensions/XI.h:107
+sz_xSetDeviceValuatorsReply = 32 # /usr/include/X11/extensions/XI.h:108
+sz_xGetDeviceControlReq = 8 # /usr/include/X11/extensions/XI.h:109
+sz_xGetDeviceControlReply = 32 # /usr/include/X11/extensions/XI.h:110
+sz_xChangeDeviceControlReq = 8 # /usr/include/X11/extensions/XI.h:111
+sz_xChangeDeviceControlReply = 32 # /usr/include/X11/extensions/XI.h:112
+Dont_Check = 0 # /usr/include/X11/extensions/XI.h:135
+XInput_Initial_Release = 1 # /usr/include/X11/extensions/XI.h:136
+XInput_Add_XDeviceBell = 2 # /usr/include/X11/extensions/XI.h:137
+XInput_Add_XSetDeviceValuators = 3 # /usr/include/X11/extensions/XI.h:138
+XInput_Add_XChangeDeviceControl = 4 # /usr/include/X11/extensions/XI.h:139
+XInput_Add_DevicePresenceNotify = 5 # /usr/include/X11/extensions/XI.h:140
+XI_Absent = 0 # /usr/include/X11/extensions/XI.h:142
+XI_Present = 1 # /usr/include/X11/extensions/XI.h:143
+XI_Initial_Release_Major = 1 # /usr/include/X11/extensions/XI.h:145
+XI_Initial_Release_Minor = 0 # /usr/include/X11/extensions/XI.h:146
+XI_Add_XDeviceBell_Major = 1 # /usr/include/X11/extensions/XI.h:148
+XI_Add_XDeviceBell_Minor = 1 # /usr/include/X11/extensions/XI.h:149
+XI_Add_XSetDeviceValuators_Major = 1 # /usr/include/X11/extensions/XI.h:151
+XI_Add_XSetDeviceValuators_Minor = 2 # /usr/include/X11/extensions/XI.h:152
+XI_Add_XChangeDeviceControl_Major = 1 # /usr/include/X11/extensions/XI.h:154
+XI_Add_XChangeDeviceControl_Minor = 3 # /usr/include/X11/extensions/XI.h:155
+XI_Add_DevicePresenceNotify_Major = 1 # /usr/include/X11/extensions/XI.h:157
+XI_Add_DevicePresenceNotify_Minor = 4 # /usr/include/X11/extensions/XI.h:158
+DEVICE_RESOLUTION = 1 # /usr/include/X11/extensions/XI.h:160
+DEVICE_ABS_CALIB = 2 # /usr/include/X11/extensions/XI.h:161
+DEVICE_CORE = 3 # /usr/include/X11/extensions/XI.h:162
+DEVICE_ENABLE = 4 # /usr/include/X11/extensions/XI.h:163
+DEVICE_ABS_AREA = 5 # /usr/include/X11/extensions/XI.h:164
+NoSuchExtension = 1 # /usr/include/X11/extensions/XI.h:166
+COUNT = 0 # /usr/include/X11/extensions/XI.h:168
+CREATE = 1 # /usr/include/X11/extensions/XI.h:169
+NewPointer = 0 # /usr/include/X11/extensions/XI.h:171
+NewKeyboard = 1 # /usr/include/X11/extensions/XI.h:172
+XPOINTER = 0 # /usr/include/X11/extensions/XI.h:174
+XKEYBOARD = 1 # /usr/include/X11/extensions/XI.h:175
+UseXKeyboard = 255 # /usr/include/X11/extensions/XI.h:177
+IsXPointer = 0 # /usr/include/X11/extensions/XI.h:179
+IsXKeyboard = 1 # /usr/include/X11/extensions/XI.h:180
+IsXExtensionDevice = 2 # /usr/include/X11/extensions/XI.h:181
+IsXExtensionKeyboard = 3 # /usr/include/X11/extensions/XI.h:182
+IsXExtensionPointer = 4 # /usr/include/X11/extensions/XI.h:183
+AsyncThisDevice = 0 # /usr/include/X11/extensions/XI.h:185
+SyncThisDevice = 1 # /usr/include/X11/extensions/XI.h:186
+ReplayThisDevice = 2 # /usr/include/X11/extensions/XI.h:187
+AsyncOtherDevices = 3 # /usr/include/X11/extensions/XI.h:188
+AsyncAll = 4 # /usr/include/X11/extensions/XI.h:189
+SyncAll = 5 # /usr/include/X11/extensions/XI.h:190
+FollowKeyboard = 3 # /usr/include/X11/extensions/XI.h:192
+RevertToFollowKeyboard = 3 # /usr/include/X11/extensions/XI.h:194
+DvAccelNum = 1 # /usr/include/X11/extensions/XI.h:197
+DvAccelDenom = 2 # /usr/include/X11/extensions/XI.h:198
+DvThreshold = 4 # /usr/include/X11/extensions/XI.h:199
+DvKeyClickPercent = 1 # /usr/include/X11/extensions/XI.h:201
+DvPercent = 2 # /usr/include/X11/extensions/XI.h:202
+DvPitch = 4 # /usr/include/X11/extensions/XI.h:203
+DvDuration = 8 # /usr/include/X11/extensions/XI.h:204
+DvLed = 16 # /usr/include/X11/extensions/XI.h:205
+DvLedMode = 32 # /usr/include/X11/extensions/XI.h:206
+DvKey = 64 # /usr/include/X11/extensions/XI.h:207
+DvAutoRepeatMode = 128 # /usr/include/X11/extensions/XI.h:208
+DvString = 1 # /usr/include/X11/extensions/XI.h:210
+DvInteger = 1 # /usr/include/X11/extensions/XI.h:212
+DeviceMode = 1 # /usr/include/X11/extensions/XI.h:214
+Relative = 0 # /usr/include/X11/extensions/XI.h:215
+Absolute = 1 # /usr/include/X11/extensions/XI.h:216
+ProximityState = 2 # /usr/include/X11/extensions/XI.h:218
+InProximity = 0 # /usr/include/X11/extensions/XI.h:219
+OutOfProximity = 2 # /usr/include/X11/extensions/XI.h:220
+AddToList = 0 # /usr/include/X11/extensions/XI.h:222
+DeleteFromList = 1 # /usr/include/X11/extensions/XI.h:223
+KeyClass = 0 # /usr/include/X11/extensions/XI.h:225
+ButtonClass = 1 # /usr/include/X11/extensions/XI.h:226
+ValuatorClass = 2 # /usr/include/X11/extensions/XI.h:227
+FeedbackClass = 3 # /usr/include/X11/extensions/XI.h:228
+ProximityClass = 4 # /usr/include/X11/extensions/XI.h:229
+FocusClass = 5 # /usr/include/X11/extensions/XI.h:230
+OtherClass = 6 # /usr/include/X11/extensions/XI.h:231
+KbdFeedbackClass = 0 # /usr/include/X11/extensions/XI.h:233
+PtrFeedbackClass = 1 # /usr/include/X11/extensions/XI.h:234
+StringFeedbackClass = 2 # /usr/include/X11/extensions/XI.h:235
+IntegerFeedbackClass = 3 # /usr/include/X11/extensions/XI.h:236
+LedFeedbackClass = 4 # /usr/include/X11/extensions/XI.h:237
+BellFeedbackClass = 5 # /usr/include/X11/extensions/XI.h:238
+_devicePointerMotionHint = 0 # /usr/include/X11/extensions/XI.h:240
+_deviceButton1Motion = 1 # /usr/include/X11/extensions/XI.h:241
+_deviceButton2Motion = 2 # /usr/include/X11/extensions/XI.h:242
+_deviceButton3Motion = 3 # /usr/include/X11/extensions/XI.h:243
+_deviceButton4Motion = 4 # /usr/include/X11/extensions/XI.h:244
+_deviceButton5Motion = 5 # /usr/include/X11/extensions/XI.h:245
+_deviceButtonMotion = 6 # /usr/include/X11/extensions/XI.h:246
+_deviceButtonGrab = 7 # /usr/include/X11/extensions/XI.h:247
+_deviceOwnerGrabButton = 8 # /usr/include/X11/extensions/XI.h:248
+_noExtensionEvent = 9 # /usr/include/X11/extensions/XI.h:249
+_devicePresence = 0 # /usr/include/X11/extensions/XI.h:251
+DeviceAdded = 0 # /usr/include/X11/extensions/XI.h:253
+DeviceRemoved = 1 # /usr/include/X11/extensions/XI.h:254
+DeviceEnabled = 2 # /usr/include/X11/extensions/XI.h:255
+DeviceDisabled = 3 # /usr/include/X11/extensions/XI.h:256
+DeviceUnrecoverable = 4 # /usr/include/X11/extensions/XI.h:257
+XI_BadDevice = 0 # /usr/include/X11/extensions/XI.h:259
+XI_BadEvent = 1 # /usr/include/X11/extensions/XI.h:260
+XI_BadMode = 2 # /usr/include/X11/extensions/XI.h:261
+XI_DeviceBusy = 3 # /usr/include/X11/extensions/XI.h:262
+XI_BadClass = 4 # /usr/include/X11/extensions/XI.h:263
+XEventClass = c_ulong # /usr/include/X11/extensions/XI.h:272
+class struct_anon_93(Structure):
+ __slots__ = [
+ 'present',
+ 'major_version',
+ 'minor_version',
+ ]
+struct_anon_93._fields_ = [
+ ('present', c_int),
+ ('major_version', c_short),
+ ('minor_version', c_short),
+]
+
+XExtensionVersion = struct_anon_93 # /usr/include/X11/extensions/XI.h:285
+_deviceKeyPress = 0 # /usr/include/X11/extensions/XInput.h:4902
+_deviceKeyRelease = 1 # /usr/include/X11/extensions/XInput.h:4903
+_deviceButtonPress = 0 # /usr/include/X11/extensions/XInput.h:4905
+_deviceButtonRelease = 1 # /usr/include/X11/extensions/XInput.h:4906
+_deviceMotionNotify = 0 # /usr/include/X11/extensions/XInput.h:4908
+_deviceFocusIn = 0 # /usr/include/X11/extensions/XInput.h:4910
+_deviceFocusOut = 1 # /usr/include/X11/extensions/XInput.h:4911
+_proximityIn = 0 # /usr/include/X11/extensions/XInput.h:4913
+_proximityOut = 1 # /usr/include/X11/extensions/XInput.h:4914
+_deviceStateNotify = 0 # /usr/include/X11/extensions/XInput.h:4916
+_deviceMappingNotify = 1 # /usr/include/X11/extensions/XInput.h:4917
+_changeDeviceNotify = 2 # /usr/include/X11/extensions/XInput.h:4918
+class struct_anon_94(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'keycode',
+ 'same_screen',
+ 'device_state',
+ 'axes_count',
+ 'first_axis',
+ 'axis_data',
+ ]
+Display = pyglet.libs.x11.xlib.Display
+Window = pyglet.libs.x11.xlib.Window
+XID = pyglet.libs.x11.xlib.XID
+Time = pyglet.libs.x11.xlib.Time
+struct_anon_94._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('keycode', c_uint),
+ ('same_screen', c_int),
+ ('device_state', c_uint),
+ ('axes_count', c_ubyte),
+ ('first_axis', c_ubyte),
+ ('axis_data', c_int * 6),
+]
+
+XDeviceKeyEvent = struct_anon_94 # /usr/include/X11/extensions/XInput.h:5043
+XDeviceKeyPressedEvent = XDeviceKeyEvent # /usr/include/X11/extensions/XInput.h:5045
+XDeviceKeyReleasedEvent = XDeviceKeyEvent # /usr/include/X11/extensions/XInput.h:5046
+class struct_anon_95(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'button',
+ 'same_screen',
+ 'device_state',
+ 'axes_count',
+ 'first_axis',
+ 'axis_data',
+ ]
+struct_anon_95._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('button', c_uint),
+ ('same_screen', c_int),
+ ('device_state', c_uint),
+ ('axes_count', c_ubyte),
+ ('first_axis', c_ubyte),
+ ('axis_data', c_int * 6),
+]
+
+XDeviceButtonEvent = struct_anon_95 # /usr/include/X11/extensions/XInput.h:5075
+XDeviceButtonPressedEvent = XDeviceButtonEvent # /usr/include/X11/extensions/XInput.h:5077
+XDeviceButtonReleasedEvent = XDeviceButtonEvent # /usr/include/X11/extensions/XInput.h:5078
+class struct_anon_96(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'is_hint',
+ 'same_screen',
+ 'device_state',
+ 'axes_count',
+ 'first_axis',
+ 'axis_data',
+ ]
+struct_anon_96._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('is_hint', c_char),
+ ('same_screen', c_int),
+ ('device_state', c_uint),
+ ('axes_count', c_ubyte),
+ ('first_axis', c_ubyte),
+ ('axis_data', c_int * 6),
+]
+
+XDeviceMotionEvent = struct_anon_96 # /usr/include/X11/extensions/XInput.h:5108
+class struct_anon_97(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'mode',
+ 'detail',
+ 'time',
+ ]
+struct_anon_97._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('mode', c_int),
+ ('detail', c_int),
+ ('time', Time),
+]
+
+XDeviceFocusChangeEvent = struct_anon_97 # /usr/include/X11/extensions/XInput.h:5133
+XDeviceFocusInEvent = XDeviceFocusChangeEvent # /usr/include/X11/extensions/XInput.h:5135
+XDeviceFocusOutEvent = XDeviceFocusChangeEvent # /usr/include/X11/extensions/XInput.h:5136
+class struct_anon_98(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'same_screen',
+ 'device_state',
+ 'axes_count',
+ 'first_axis',
+ 'axis_data',
+ ]
+struct_anon_98._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('same_screen', c_int),
+ ('device_state', c_uint),
+ ('axes_count', c_ubyte),
+ ('first_axis', c_ubyte),
+ ('axis_data', c_int * 6),
+]
+
+XProximityNotifyEvent = struct_anon_98 # /usr/include/X11/extensions/XInput.h:5164
+XProximityInEvent = XProximityNotifyEvent # /usr/include/X11/extensions/XInput.h:5165
+XProximityOutEvent = XProximityNotifyEvent # /usr/include/X11/extensions/XInput.h:5166
+class struct_anon_99(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ ]
+struct_anon_99._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+]
+
+XInputClass = struct_anon_99 # /usr/include/X11/extensions/XInput.h:5183
+class struct_anon_100(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'time',
+ 'num_classes',
+ 'data',
+ ]
+struct_anon_100._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('time', Time),
+ ('num_classes', c_int),
+ ('data', c_char * 64),
+]
+
+XDeviceStateNotifyEvent = struct_anon_100 # /usr/include/X11/extensions/XInput.h:5195
+class struct_anon_101(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_valuators',
+ 'mode',
+ 'valuators',
+ ]
+struct_anon_101._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+ ('num_valuators', c_ubyte),
+ ('mode', c_ubyte),
+ ('valuators', c_int * 6),
+]
+
+XValuatorStatus = struct_anon_101 # /usr/include/X11/extensions/XInput.h:5207
+class struct_anon_102(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_keys',
+ 'keys',
+ ]
+struct_anon_102._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+ ('num_keys', c_short),
+ ('keys', c_char * 32),
+]
+
+XKeyStatus = struct_anon_102 # /usr/include/X11/extensions/XInput.h:5218
+class struct_anon_103(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_buttons',
+ 'buttons',
+ ]
+struct_anon_103._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+ ('num_buttons', c_short),
+ ('buttons', c_char * 32),
+]
+
+XButtonStatus = struct_anon_103 # /usr/include/X11/extensions/XInput.h:5229
+class struct_anon_104(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'time',
+ 'request',
+ 'first_keycode',
+ 'count',
+ ]
+struct_anon_104._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('time', Time),
+ ('request', c_int),
+ ('first_keycode', c_int),
+ ('count', c_int),
+]
+
+XDeviceMappingEvent = struct_anon_104 # /usr/include/X11/extensions/XInput.h:5250
+class struct_anon_105(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'deviceid',
+ 'time',
+ 'request',
+ ]
+struct_anon_105._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('deviceid', XID),
+ ('time', Time),
+ ('request', c_int),
+]
+
+XChangeDeviceNotifyEvent = struct_anon_105 # /usr/include/X11/extensions/XInput.h:5268
+class struct_anon_106(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'time',
+ 'devchange',
+ 'deviceid',
+ 'control',
+ ]
+struct_anon_106._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('time', Time),
+ ('devchange', c_int),
+ ('deviceid', XID),
+ ('control', XID),
+]
+
+XDevicePresenceNotifyEvent = struct_anon_106 # /usr/include/X11/extensions/XInput.h:5293
+class struct_anon_107(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ ]
+struct_anon_107._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+]
+
+XFeedbackState = struct_anon_107 # /usr/include/X11/extensions/XInput.h:5311
+class struct_anon_108(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'click',
+ 'percent',
+ 'pitch',
+ 'duration',
+ 'led_mask',
+ 'global_auto_repeat',
+ 'auto_repeats',
+ ]
+struct_anon_108._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('click', c_int),
+ ('percent', c_int),
+ ('pitch', c_int),
+ ('duration', c_int),
+ ('led_mask', c_int),
+ ('global_auto_repeat', c_int),
+ ('auto_repeats', c_char * 32),
+]
+
+XKbdFeedbackState = struct_anon_108 # /usr/include/X11/extensions/XInput.h:5328
+class struct_anon_109(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'accelNum',
+ 'accelDenom',
+ 'threshold',
+ ]
+struct_anon_109._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('accelNum', c_int),
+ ('accelDenom', c_int),
+ ('threshold', c_int),
+]
+
+XPtrFeedbackState = struct_anon_109 # /usr/include/X11/extensions/XInput.h:5341
+class struct_anon_110(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'resolution',
+ 'minVal',
+ 'maxVal',
+ ]
+struct_anon_110._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('resolution', c_int),
+ ('minVal', c_int),
+ ('maxVal', c_int),
+]
+
+XIntegerFeedbackState = struct_anon_110 # /usr/include/X11/extensions/XInput.h:5354
+class struct_anon_111(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'max_symbols',
+ 'num_syms_supported',
+ 'syms_supported',
+ ]
+KeySym = pyglet.libs.x11.xlib.KeySym
+struct_anon_111._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('max_symbols', c_int),
+ ('num_syms_supported', c_int),
+ ('syms_supported', POINTER(KeySym)),
+]
+
+XStringFeedbackState = struct_anon_111 # /usr/include/X11/extensions/XInput.h:5367
+class struct_anon_112(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'percent',
+ 'pitch',
+ 'duration',
+ ]
+struct_anon_112._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('percent', c_int),
+ ('pitch', c_int),
+ ('duration', c_int),
+]
+
+XBellFeedbackState = struct_anon_112 # /usr/include/X11/extensions/XInput.h:5380
+class struct_anon_113(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'led_values',
+ 'led_mask',
+ ]
+struct_anon_113._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('led_values', c_int),
+ ('led_mask', c_int),
+]
+
+XLedFeedbackState = struct_anon_113 # /usr/include/X11/extensions/XInput.h:5392
+class struct_anon_114(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ ]
+struct_anon_114._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+]
+
+XFeedbackControl = struct_anon_114 # /usr/include/X11/extensions/XInput.h:5402
+class struct_anon_115(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'accelNum',
+ 'accelDenom',
+ 'threshold',
+ ]
+struct_anon_115._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('accelNum', c_int),
+ ('accelDenom', c_int),
+ ('threshold', c_int),
+]
+
+XPtrFeedbackControl = struct_anon_115 # /usr/include/X11/extensions/XInput.h:5415
+class struct_anon_116(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'click',
+ 'percent',
+ 'pitch',
+ 'duration',
+ 'led_mask',
+ 'led_value',
+ 'key',
+ 'auto_repeat_mode',
+ ]
+struct_anon_116._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('click', c_int),
+ ('percent', c_int),
+ ('pitch', c_int),
+ ('duration', c_int),
+ ('led_mask', c_int),
+ ('led_value', c_int),
+ ('key', c_int),
+ ('auto_repeat_mode', c_int),
+]
+
+XKbdFeedbackControl = struct_anon_116 # /usr/include/X11/extensions/XInput.h:5433
+class struct_anon_117(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'num_keysyms',
+ 'syms_to_display',
+ ]
+struct_anon_117._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('num_keysyms', c_int),
+ ('syms_to_display', POINTER(KeySym)),
+]
+
+XStringFeedbackControl = struct_anon_117 # /usr/include/X11/extensions/XInput.h:5445
+class struct_anon_118(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'int_to_display',
+ ]
+struct_anon_118._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('int_to_display', c_int),
+]
+
+XIntegerFeedbackControl = struct_anon_118 # /usr/include/X11/extensions/XInput.h:5456
+class struct_anon_119(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'percent',
+ 'pitch',
+ 'duration',
+ ]
+struct_anon_119._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('percent', c_int),
+ ('pitch', c_int),
+ ('duration', c_int),
+]
+
+XBellFeedbackControl = struct_anon_119 # /usr/include/X11/extensions/XInput.h:5469
+class struct_anon_120(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'id',
+ 'led_mask',
+ 'led_values',
+ ]
+struct_anon_120._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('id', XID),
+ ('led_mask', c_int),
+ ('led_values', c_int),
+]
+
+XLedFeedbackControl = struct_anon_120 # /usr/include/X11/extensions/XInput.h:5481
+class struct_anon_121(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ ]
+struct_anon_121._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+]
+
+XDeviceControl = struct_anon_121 # /usr/include/X11/extensions/XInput.h:5492
+class struct_anon_122(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'first_valuator',
+ 'num_valuators',
+ 'resolutions',
+ ]
+struct_anon_122._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('first_valuator', c_int),
+ ('num_valuators', c_int),
+ ('resolutions', POINTER(c_int)),
+]
+
+XDeviceResolutionControl = struct_anon_122 # /usr/include/X11/extensions/XInput.h:5500
+class struct_anon_123(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'num_valuators',
+ 'resolutions',
+ 'min_resolutions',
+ 'max_resolutions',
+ ]
+struct_anon_123._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('num_valuators', c_int),
+ ('resolutions', POINTER(c_int)),
+ ('min_resolutions', POINTER(c_int)),
+ ('max_resolutions', POINTER(c_int)),
+]
+
+XDeviceResolutionState = struct_anon_123 # /usr/include/X11/extensions/XInput.h:5509
+class struct_anon_124(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'min_x',
+ 'max_x',
+ 'min_y',
+ 'max_y',
+ 'flip_x',
+ 'flip_y',
+ 'rotation',
+ 'button_threshold',
+ ]
+struct_anon_124._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('min_x', c_int),
+ ('max_x', c_int),
+ ('min_y', c_int),
+ ('max_y', c_int),
+ ('flip_x', c_int),
+ ('flip_y', c_int),
+ ('rotation', c_int),
+ ('button_threshold', c_int),
+]
+
+XDeviceAbsCalibControl = struct_anon_124 # /usr/include/X11/extensions/XInput.h:5522
+class struct_anon_125(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'min_x',
+ 'max_x',
+ 'min_y',
+ 'max_y',
+ 'flip_x',
+ 'flip_y',
+ 'rotation',
+ 'button_threshold',
+ ]
+struct_anon_125._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('min_x', c_int),
+ ('max_x', c_int),
+ ('min_y', c_int),
+ ('max_y', c_int),
+ ('flip_x', c_int),
+ ('flip_y', c_int),
+ ('rotation', c_int),
+ ('button_threshold', c_int),
+]
+
+XDeviceAbsCalibState = struct_anon_125 # /usr/include/X11/extensions/XInput.h:5522
+class struct_anon_126(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'offset_x',
+ 'offset_y',
+ 'width',
+ 'height',
+ 'screen',
+ 'following',
+ ]
+struct_anon_126._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('offset_x', c_int),
+ ('offset_y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('screen', c_int),
+ ('following', XID),
+]
+
+XDeviceAbsAreaControl = struct_anon_126 # /usr/include/X11/extensions/XInput.h:5533
+class struct_anon_127(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'offset_x',
+ 'offset_y',
+ 'width',
+ 'height',
+ 'screen',
+ 'following',
+ ]
+struct_anon_127._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('offset_x', c_int),
+ ('offset_y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('screen', c_int),
+ ('following', XID),
+]
+
+XDeviceAbsAreaState = struct_anon_127 # /usr/include/X11/extensions/XInput.h:5533
+class struct_anon_128(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'status',
+ ]
+struct_anon_128._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('status', c_int),
+]
+
+XDeviceCoreControl = struct_anon_128 # /usr/include/X11/extensions/XInput.h:5539
+class struct_anon_129(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'status',
+ 'iscore',
+ ]
+struct_anon_129._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('status', c_int),
+ ('iscore', c_int),
+]
+
+XDeviceCoreState = struct_anon_129 # /usr/include/X11/extensions/XInput.h:5546
+class struct_anon_130(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'enable',
+ ]
+struct_anon_130._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('enable', c_int),
+]
+
+XDeviceEnableControl = struct_anon_130 # /usr/include/X11/extensions/XInput.h:5552
+class struct_anon_131(Structure):
+ __slots__ = [
+ 'control',
+ 'length',
+ 'enable',
+ ]
+struct_anon_131._fields_ = [
+ ('control', XID),
+ ('length', c_int),
+ ('enable', c_int),
+]
+
+XDeviceEnableState = struct_anon_131 # /usr/include/X11/extensions/XInput.h:5552
+class struct__XAnyClassinfo(Structure):
+ __slots__ = [
+ ]
+struct__XAnyClassinfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XAnyClassinfo(Structure):
+ __slots__ = [
+ ]
+struct__XAnyClassinfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XAnyClassPtr = POINTER(struct__XAnyClassinfo) # /usr/include/X11/extensions/XInput.h:5564
+class struct__XAnyClassinfo(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ ]
+struct__XAnyClassinfo._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+]
+
+XAnyClassInfo = struct__XAnyClassinfo # /usr/include/X11/extensions/XInput.h:5573
+class struct__XDeviceInfo(Structure):
+ __slots__ = [
+ ]
+struct__XDeviceInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XDeviceInfo(Structure):
+ __slots__ = [
+ ]
+struct__XDeviceInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XDeviceInfoPtr = POINTER(struct__XDeviceInfo) # /usr/include/X11/extensions/XInput.h:5575
+class struct__XDeviceInfo(Structure):
+ __slots__ = [
+ 'id',
+ 'type',
+ 'name',
+ 'num_classes',
+ 'use',
+ 'inputclassinfo',
+ ]
+Atom = pyglet.libs.x11.xlib.Atom
+struct__XDeviceInfo._fields_ = [
+ ('id', XID),
+ ('type', Atom),
+ ('name', c_char_p),
+ ('num_classes', c_int),
+ ('use', c_int),
+ ('inputclassinfo', XAnyClassPtr),
+]
+
+XDeviceInfo = struct__XDeviceInfo # /usr/include/X11/extensions/XInput.h:5585
+class struct__XKeyInfo(Structure):
+ __slots__ = [
+ ]
+struct__XKeyInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XKeyInfo(Structure):
+ __slots__ = [
+ ]
+struct__XKeyInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XKeyInfoPtr = POINTER(struct__XKeyInfo) # /usr/include/X11/extensions/XInput.h:5587
+class struct__XKeyInfo(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'min_keycode',
+ 'max_keycode',
+ 'num_keys',
+ ]
+struct__XKeyInfo._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('min_keycode', c_ushort),
+ ('max_keycode', c_ushort),
+ ('num_keys', c_ushort),
+]
+
+XKeyInfo = struct__XKeyInfo # /usr/include/X11/extensions/XInput.h:5600
+class struct__XButtonInfo(Structure):
+ __slots__ = [
+ ]
+struct__XButtonInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XButtonInfo(Structure):
+ __slots__ = [
+ ]
+struct__XButtonInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XButtonInfoPtr = POINTER(struct__XButtonInfo) # /usr/include/X11/extensions/XInput.h:5602
+class struct__XButtonInfo(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_buttons',
+ ]
+struct__XButtonInfo._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('num_buttons', c_short),
+]
+
+XButtonInfo = struct__XButtonInfo # /usr/include/X11/extensions/XInput.h:5612
+class struct__XAxisInfo(Structure):
+ __slots__ = [
+ ]
+struct__XAxisInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XAxisInfo(Structure):
+ __slots__ = [
+ ]
+struct__XAxisInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XAxisInfoPtr = POINTER(struct__XAxisInfo) # /usr/include/X11/extensions/XInput.h:5614
+class struct__XAxisInfo(Structure):
+ __slots__ = [
+ 'resolution',
+ 'min_value',
+ 'max_value',
+ ]
+struct__XAxisInfo._fields_ = [
+ ('resolution', c_int),
+ ('min_value', c_int),
+ ('max_value', c_int),
+]
+
+XAxisInfo = struct__XAxisInfo # /usr/include/X11/extensions/XInput.h:5620
+class struct__XValuatorInfo(Structure):
+ __slots__ = [
+ ]
+struct__XValuatorInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XValuatorInfo(Structure):
+ __slots__ = [
+ ]
+struct__XValuatorInfo._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XValuatorInfoPtr = POINTER(struct__XValuatorInfo) # /usr/include/X11/extensions/XInput.h:5622
+class struct__XValuatorInfo(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_axes',
+ 'mode',
+ 'motion_buffer',
+ 'axes',
+ ]
+struct__XValuatorInfo._fields_ = [
+ ('class', XID),
+ ('length', c_int),
+ ('num_axes', c_ubyte),
+ ('mode', c_ubyte),
+ ('motion_buffer', c_ulong),
+ ('axes', XAxisInfoPtr),
+]
+
+XValuatorInfo = struct__XValuatorInfo # /usr/include/X11/extensions/XInput.h:5636
+class struct_anon_132(Structure):
+ __slots__ = [
+ 'input_class',
+ 'event_type_base',
+ ]
+struct_anon_132._fields_ = [
+ ('input_class', c_ubyte),
+ ('event_type_base', c_ubyte),
+]
+
+XInputClassInfo = struct_anon_132 # /usr/include/X11/extensions/XInput.h:5653
+class struct_anon_133(Structure):
+ __slots__ = [
+ 'device_id',
+ 'num_classes',
+ 'classes',
+ ]
+struct_anon_133._fields_ = [
+ ('device_id', XID),
+ ('num_classes', c_int),
+ ('classes', POINTER(XInputClassInfo)),
+]
+
+XDevice = struct_anon_133 # /usr/include/X11/extensions/XInput.h:5659
+class struct_anon_134(Structure):
+ __slots__ = [
+ 'event_type',
+ 'device',
+ ]
+struct_anon_134._fields_ = [
+ ('event_type', XEventClass),
+ ('device', XID),
+]
+
+XEventList = struct_anon_134 # /usr/include/X11/extensions/XInput.h:5672
+class struct_anon_135(Structure):
+ __slots__ = [
+ 'time',
+ 'data',
+ ]
+struct_anon_135._fields_ = [
+ ('time', Time),
+ ('data', POINTER(c_int)),
+]
+
+XDeviceTimeCoord = struct_anon_135 # /usr/include/X11/extensions/XInput.h:5685
+class struct_anon_136(Structure):
+ __slots__ = [
+ 'device_id',
+ 'num_classes',
+ 'data',
+ ]
+struct_anon_136._fields_ = [
+ ('device_id', XID),
+ ('num_classes', c_int),
+ ('data', POINTER(XInputClass)),
+]
+
+XDeviceState = struct_anon_136 # /usr/include/X11/extensions/XInput.h:5699
+class struct_anon_137(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_valuators',
+ 'mode',
+ 'valuators',
+ ]
+struct_anon_137._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+ ('num_valuators', c_ubyte),
+ ('mode', c_ubyte),
+ ('valuators', POINTER(c_int)),
+]
+
+XValuatorState = struct_anon_137 # /usr/include/X11/extensions/XInput.h:5722
+class struct_anon_138(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_keys',
+ 'keys',
+ ]
+struct_anon_138._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+ ('num_keys', c_short),
+ ('keys', c_char * 32),
+]
+
+XKeyState = struct_anon_138 # /usr/include/X11/extensions/XInput.h:5733
+class struct_anon_139(Structure):
+ __slots__ = [
+ 'class',
+ 'length',
+ 'num_buttons',
+ 'buttons',
+ ]
+struct_anon_139._fields_ = [
+ ('class', c_ubyte),
+ ('length', c_ubyte),
+ ('num_buttons', c_short),
+ ('buttons', c_char * 32),
+]
+
+XButtonState = struct_anon_139 # /usr/include/X11/extensions/XInput.h:5744
+# /usr/include/X11/extensions/XInput.h:5754
+XChangeKeyboardDevice = _lib.XChangeKeyboardDevice
+XChangeKeyboardDevice.restype = c_int
+XChangeKeyboardDevice.argtypes = [POINTER(Display), POINTER(XDevice)]
+
+# /usr/include/X11/extensions/XInput.h:5759
+XChangePointerDevice = _lib.XChangePointerDevice
+XChangePointerDevice.restype = c_int
+XChangePointerDevice.argtypes = [POINTER(Display), POINTER(XDevice), c_int, c_int]
+
+# /usr/include/X11/extensions/XInput.h:5766
+XGrabDevice = _lib.XGrabDevice
+XGrabDevice.restype = c_int
+XGrabDevice.argtypes = [POINTER(Display), POINTER(XDevice), Window, c_int, c_int, POINTER(XEventClass), c_int, c_int, Time]
+
+# /usr/include/X11/extensions/XInput.h:5778
+XUngrabDevice = _lib.XUngrabDevice
+XUngrabDevice.restype = c_int
+XUngrabDevice.argtypes = [POINTER(Display), POINTER(XDevice), Time]
+
+# /usr/include/X11/extensions/XInput.h:5784
+XGrabDeviceKey = _lib.XGrabDeviceKey
+XGrabDeviceKey.restype = c_int
+XGrabDeviceKey.argtypes = [POINTER(Display), POINTER(XDevice), c_uint, c_uint, POINTER(XDevice), Window, c_int, c_uint, POINTER(XEventClass), c_int, c_int]
+
+# /usr/include/X11/extensions/XInput.h:5798
+XUngrabDeviceKey = _lib.XUngrabDeviceKey
+XUngrabDeviceKey.restype = c_int
+XUngrabDeviceKey.argtypes = [POINTER(Display), POINTER(XDevice), c_uint, c_uint, POINTER(XDevice), Window]
+
+# /usr/include/X11/extensions/XInput.h:5807
+XGrabDeviceButton = _lib.XGrabDeviceButton
+XGrabDeviceButton.restype = c_int
+XGrabDeviceButton.argtypes = [POINTER(Display), POINTER(XDevice), c_uint, c_uint, POINTER(XDevice), Window, c_int, c_uint, POINTER(XEventClass), c_int, c_int]
+
+# /usr/include/X11/extensions/XInput.h:5821
+XUngrabDeviceButton = _lib.XUngrabDeviceButton
+XUngrabDeviceButton.restype = c_int
+XUngrabDeviceButton.argtypes = [POINTER(Display), POINTER(XDevice), c_uint, c_uint, POINTER(XDevice), Window]
+
+# /usr/include/X11/extensions/XInput.h:5830
+XAllowDeviceEvents = _lib.XAllowDeviceEvents
+XAllowDeviceEvents.restype = c_int
+XAllowDeviceEvents.argtypes = [POINTER(Display), POINTER(XDevice), c_int, Time]
+
+# /usr/include/X11/extensions/XInput.h:5837
+XGetDeviceFocus = _lib.XGetDeviceFocus
+XGetDeviceFocus.restype = c_int
+XGetDeviceFocus.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(Window), POINTER(c_int), POINTER(Time)]
+
+# /usr/include/X11/extensions/XInput.h:5845
+XSetDeviceFocus = _lib.XSetDeviceFocus
+XSetDeviceFocus.restype = c_int
+XSetDeviceFocus.argtypes = [POINTER(Display), POINTER(XDevice), Window, c_int, Time]
+
+# /usr/include/X11/extensions/XInput.h:5853
+XGetFeedbackControl = _lib.XGetFeedbackControl
+XGetFeedbackControl.restype = POINTER(XFeedbackState)
+XGetFeedbackControl.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(c_int)]
+
+# /usr/include/X11/extensions/XInput.h:5859
+XFreeFeedbackList = _lib.XFreeFeedbackList
+XFreeFeedbackList.restype = None
+XFreeFeedbackList.argtypes = [POINTER(XFeedbackState)]
+
+# /usr/include/X11/extensions/XInput.h:5863
+XChangeFeedbackControl = _lib.XChangeFeedbackControl
+XChangeFeedbackControl.restype = c_int
+XChangeFeedbackControl.argtypes = [POINTER(Display), POINTER(XDevice), c_ulong, POINTER(XFeedbackControl)]
+
+# /usr/include/X11/extensions/XInput.h:5870
+XDeviceBell = _lib.XDeviceBell
+XDeviceBell.restype = c_int
+XDeviceBell.argtypes = [POINTER(Display), POINTER(XDevice), XID, XID, c_int]
+
+KeyCode = pyglet.libs.x11.xlib.KeyCode
+# /usr/include/X11/extensions/XInput.h:5878
+XGetDeviceKeyMapping = _lib.XGetDeviceKeyMapping
+XGetDeviceKeyMapping.restype = POINTER(KeySym)
+XGetDeviceKeyMapping.argtypes = [POINTER(Display), POINTER(XDevice), KeyCode, c_int, POINTER(c_int)]
+
+# /usr/include/X11/extensions/XInput.h:5890
+XChangeDeviceKeyMapping = _lib.XChangeDeviceKeyMapping
+XChangeDeviceKeyMapping.restype = c_int
+XChangeDeviceKeyMapping.argtypes = [POINTER(Display), POINTER(XDevice), c_int, c_int, POINTER(KeySym), c_int]
+
+XModifierKeymap = pyglet.libs.x11.xlib.XModifierKeymap
+# /usr/include/X11/extensions/XInput.h:5899
+XGetDeviceModifierMapping = _lib.XGetDeviceModifierMapping
+XGetDeviceModifierMapping.restype = POINTER(XModifierKeymap)
+XGetDeviceModifierMapping.argtypes = [POINTER(Display), POINTER(XDevice)]
+
+# /usr/include/X11/extensions/XInput.h:5904
+XSetDeviceModifierMapping = _lib.XSetDeviceModifierMapping
+XSetDeviceModifierMapping.restype = c_int
+XSetDeviceModifierMapping.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(XModifierKeymap)]
+
+# /usr/include/X11/extensions/XInput.h:5910
+XSetDeviceButtonMapping = _lib.XSetDeviceButtonMapping
+XSetDeviceButtonMapping.restype = c_int
+XSetDeviceButtonMapping.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(c_ubyte), c_int]
+
+# /usr/include/X11/extensions/XInput.h:5917
+XGetDeviceButtonMapping = _lib.XGetDeviceButtonMapping
+XGetDeviceButtonMapping.restype = c_int
+XGetDeviceButtonMapping.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(c_ubyte), c_uint]
+
+# /usr/include/X11/extensions/XInput.h:5924
+XQueryDeviceState = _lib.XQueryDeviceState
+XQueryDeviceState.restype = POINTER(XDeviceState)
+XQueryDeviceState.argtypes = [POINTER(Display), POINTER(XDevice)]
+
+# /usr/include/X11/extensions/XInput.h:5929
+XFreeDeviceState = _lib.XFreeDeviceState
+XFreeDeviceState.restype = None
+XFreeDeviceState.argtypes = [POINTER(XDeviceState)]
+
+# /usr/include/X11/extensions/XInput.h:5933
+XGetExtensionVersion = _lib.XGetExtensionVersion
+XGetExtensionVersion.restype = POINTER(XExtensionVersion)
+XGetExtensionVersion.argtypes = [POINTER(Display), c_char_p]
+
+# /usr/include/X11/extensions/XInput.h:5938
+XListInputDevices = _lib.XListInputDevices
+XListInputDevices.restype = POINTER(XDeviceInfo)
+XListInputDevices.argtypes = [POINTER(Display), POINTER(c_int)]
+
+# /usr/include/X11/extensions/XInput.h
+XListDeviceProperties = _lib.XListDeviceProperties
+XListDeviceProperties.restype = POINTER(Atom)
+XListDeviceProperties.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(c_int)]
+
+# /usr/include/X11/extensions/XInput.h
+XGetDeviceProperty = _lib.XGetDeviceProperty
+XGetDeviceProperty.restype = c_int
+XGetDeviceProperty.argtypes = [POINTER(Display), POINTER(XDevice), Atom, c_long, c_long, c_bool, Atom, POINTER(Atom), POINTER(c_int), POINTER(c_ulong), POINTER(c_ulong), POINTER(c_char_p)]
+
+# /usr/include/X11/extensions/XInput.h:5943
+XFreeDeviceList = _lib.XFreeDeviceList
+XFreeDeviceList.restype = None
+XFreeDeviceList.argtypes = [POINTER(XDeviceInfo)]
+
+# /usr/include/X11/extensions/XInput.h:5947
+XOpenDevice = _lib.XOpenDevice
+XOpenDevice.restype = POINTER(XDevice)
+XOpenDevice.argtypes = [POINTER(Display), XID]
+
+# /usr/include/X11/extensions/XInput.h:5952
+XCloseDevice = _lib.XCloseDevice
+XCloseDevice.restype = c_int
+XCloseDevice.argtypes = [POINTER(Display), POINTER(XDevice)]
+
+# /usr/include/X11/extensions/XInput.h:5957
+XSetDeviceMode = _lib.XSetDeviceMode
+XSetDeviceMode.restype = c_int
+XSetDeviceMode.argtypes = [POINTER(Display), POINTER(XDevice), c_int]
+
+# /usr/include/X11/extensions/XInput.h:5963
+XSetDeviceValuators = _lib.XSetDeviceValuators
+XSetDeviceValuators.restype = c_int
+XSetDeviceValuators.argtypes = [POINTER(Display), POINTER(XDevice), POINTER(c_int), c_int, c_int]
+
+# /usr/include/X11/extensions/XInput.h:5971
+XGetDeviceControl = _lib.XGetDeviceControl
+XGetDeviceControl.restype = POINTER(XDeviceControl)
+XGetDeviceControl.argtypes = [POINTER(Display), POINTER(XDevice), c_int]
+
+# /usr/include/X11/extensions/XInput.h:5977
+XChangeDeviceControl = _lib.XChangeDeviceControl
+XChangeDeviceControl.restype = c_int
+XChangeDeviceControl.argtypes = [POINTER(Display), POINTER(XDevice), c_int, POINTER(XDeviceControl)]
+
+# /usr/include/X11/extensions/XInput.h:5984
+XSelectExtensionEvent = _lib.XSelectExtensionEvent
+XSelectExtensionEvent.restype = c_int
+XSelectExtensionEvent.argtypes = [POINTER(Display), Window, POINTER(XEventClass), c_int]
+
+# /usr/include/X11/extensions/XInput.h:5991
+XGetSelectedExtensionEvents = _lib.XGetSelectedExtensionEvents
+XGetSelectedExtensionEvents.restype = c_int
+XGetSelectedExtensionEvents.argtypes = [POINTER(Display), Window, POINTER(c_int), POINTER(POINTER(XEventClass)), POINTER(c_int), POINTER(POINTER(XEventClass))]
+
+# /usr/include/X11/extensions/XInput.h:6000
+XChangeDeviceDontPropagateList = _lib.XChangeDeviceDontPropagateList
+XChangeDeviceDontPropagateList.restype = c_int
+XChangeDeviceDontPropagateList.argtypes = [POINTER(Display), Window, c_int, POINTER(XEventClass), c_int]
+
+# /usr/include/X11/extensions/XInput.h:6008
+XGetDeviceDontPropagateList = _lib.XGetDeviceDontPropagateList
+XGetDeviceDontPropagateList.restype = POINTER(XEventClass)
+XGetDeviceDontPropagateList.argtypes = [POINTER(Display), Window, POINTER(c_int)]
+
+XEvent = pyglet.libs.x11.xlib.XEvent
+# /usr/include/X11/extensions/XInput.h:6014
+XSendExtensionEvent = _lib.XSendExtensionEvent
+XSendExtensionEvent.restype = c_int
+XSendExtensionEvent.argtypes = [POINTER(Display), POINTER(XDevice), Window, c_int, c_int, POINTER(XEventClass), POINTER(XEvent)]
+
+# /usr/include/X11/extensions/XInput.h:6024
+XGetDeviceMotionEvents = _lib.XGetDeviceMotionEvents
+XGetDeviceMotionEvents.restype = POINTER(XDeviceTimeCoord)
+XGetDeviceMotionEvents.argtypes = [POINTER(Display), POINTER(XDevice), Time, Time, POINTER(c_int), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/XInput.h:6034
+XFreeDeviceMotionEvents = _lib.XFreeDeviceMotionEvents
+XFreeDeviceMotionEvents.restype = None
+XFreeDeviceMotionEvents.argtypes = [POINTER(XDeviceTimeCoord)]
+
+# /usr/include/X11/extensions/XInput.h:6038
+XFreeDeviceControl = _lib.XFreeDeviceControl
+XFreeDeviceControl.restype = None
+XFreeDeviceControl.argtypes = [POINTER(XDeviceControl)]
+
+
+__all__ = ['sz_xGetExtensionVersionReq', 'sz_xGetExtensionVersionReply',
+'sz_xListInputDevicesReq', 'sz_xListInputDevicesReply', 'sz_xOpenDeviceReq',
+'sz_xOpenDeviceReply', 'sz_xCloseDeviceReq', 'sz_xSetDeviceModeReq',
+'sz_xSetDeviceModeReply', 'sz_xSelectExtensionEventReq',
+'sz_xGetSelectedExtensionEventsReq', 'sz_xGetSelectedExtensionEventsReply',
+'sz_xChangeDeviceDontPropagateListReq', 'sz_xGetDeviceDontPropagateListReq',
+'sz_xGetDeviceDontPropagateListReply', 'sz_xGetDeviceMotionEventsReq',
+'sz_xGetDeviceMotionEventsReply', 'sz_xChangeKeyboardDeviceReq',
+'sz_xChangeKeyboardDeviceReply', 'sz_xChangePointerDeviceReq',
+'sz_xChangePointerDeviceReply', 'sz_xGrabDeviceReq', 'sz_xGrabDeviceReply',
+'sz_xUngrabDeviceReq', 'sz_xGrabDeviceKeyReq', 'sz_xGrabDeviceKeyReply',
+'sz_xUngrabDeviceKeyReq', 'sz_xGrabDeviceButtonReq',
+'sz_xGrabDeviceButtonReply', 'sz_xUngrabDeviceButtonReq',
+'sz_xAllowDeviceEventsReq', 'sz_xGetDeviceFocusReq',
+'sz_xGetDeviceFocusReply', 'sz_xSetDeviceFocusReq',
+'sz_xGetFeedbackControlReq', 'sz_xGetFeedbackControlReply',
+'sz_xChangeFeedbackControlReq', 'sz_xGetDeviceKeyMappingReq',
+'sz_xGetDeviceKeyMappingReply', 'sz_xChangeDeviceKeyMappingReq',
+'sz_xGetDeviceModifierMappingReq', 'sz_xSetDeviceModifierMappingReq',
+'sz_xSetDeviceModifierMappingReply', 'sz_xGetDeviceButtonMappingReq',
+'sz_xGetDeviceButtonMappingReply', 'sz_xSetDeviceButtonMappingReq',
+'sz_xSetDeviceButtonMappingReply', 'sz_xQueryDeviceStateReq',
+'sz_xQueryDeviceStateReply', 'sz_xSendExtensionEventReq', 'sz_xDeviceBellReq',
+'sz_xSetDeviceValuatorsReq', 'sz_xSetDeviceValuatorsReply',
+'sz_xGetDeviceControlReq', 'sz_xGetDeviceControlReply',
+'sz_xChangeDeviceControlReq', 'sz_xChangeDeviceControlReply', 'Dont_Check',
+'XInput_Initial_Release', 'XInput_Add_XDeviceBell',
+'XInput_Add_XSetDeviceValuators', 'XInput_Add_XChangeDeviceControl',
+'XInput_Add_DevicePresenceNotify', 'XI_Absent', 'XI_Present',
+'XI_Initial_Release_Major', 'XI_Initial_Release_Minor',
+'XI_Add_XDeviceBell_Major', 'XI_Add_XDeviceBell_Minor',
+'XI_Add_XSetDeviceValuators_Major', 'XI_Add_XSetDeviceValuators_Minor',
+'XI_Add_XChangeDeviceControl_Major', 'XI_Add_XChangeDeviceControl_Minor',
+'XI_Add_DevicePresenceNotify_Major', 'XI_Add_DevicePresenceNotify_Minor',
+'DEVICE_RESOLUTION', 'DEVICE_ABS_CALIB', 'DEVICE_CORE', 'DEVICE_ENABLE',
+'DEVICE_ABS_AREA', 'NoSuchExtension', 'COUNT', 'CREATE', 'NewPointer',
+'NewKeyboard', 'XPOINTER', 'XKEYBOARD', 'UseXKeyboard', 'IsXPointer',
+'IsXKeyboard', 'IsXExtensionDevice', 'IsXExtensionKeyboard',
+'IsXExtensionPointer', 'AsyncThisDevice', 'SyncThisDevice',
+'ReplayThisDevice', 'AsyncOtherDevices', 'AsyncAll', 'SyncAll',
+'FollowKeyboard', 'RevertToFollowKeyboard', 'DvAccelNum', 'DvAccelDenom',
+'DvThreshold', 'DvKeyClickPercent', 'DvPercent', 'DvPitch', 'DvDuration',
+'DvLed', 'DvLedMode', 'DvKey', 'DvAutoRepeatMode', 'DvString', 'DvInteger',
+'DeviceMode', 'Relative', 'Absolute', 'ProximityState', 'InProximity',
+'OutOfProximity', 'AddToList', 'DeleteFromList', 'KeyClass', 'ButtonClass',
+'ValuatorClass', 'FeedbackClass', 'ProximityClass', 'FocusClass',
+'OtherClass', 'KbdFeedbackClass', 'PtrFeedbackClass', 'StringFeedbackClass',
+'IntegerFeedbackClass', 'LedFeedbackClass', 'BellFeedbackClass',
+'_devicePointerMotionHint', '_deviceButton1Motion', '_deviceButton2Motion',
+'_deviceButton3Motion', '_deviceButton4Motion', '_deviceButton5Motion',
+'_deviceButtonMotion', '_deviceButtonGrab', '_deviceOwnerGrabButton',
+'_noExtensionEvent', '_devicePresence', 'DeviceAdded', 'DeviceRemoved',
+'DeviceEnabled', 'DeviceDisabled', 'DeviceUnrecoverable', 'XI_BadDevice',
+'XI_BadEvent', 'XI_BadMode', 'XI_DeviceBusy', 'XI_BadClass', 'XEventClass',
+'XExtensionVersion', '_deviceKeyPress', '_deviceKeyRelease',
+'_deviceButtonPress', '_deviceButtonRelease', '_deviceMotionNotify',
+'_deviceFocusIn', '_deviceFocusOut', '_proximityIn', '_proximityOut',
+'_deviceStateNotify', '_deviceMappingNotify', '_changeDeviceNotify',
+'XDeviceKeyEvent', 'XDeviceKeyPressedEvent', 'XDeviceKeyReleasedEvent',
+'XDeviceButtonEvent', 'XDeviceButtonPressedEvent',
+'XDeviceButtonReleasedEvent', 'XDeviceMotionEvent', 'XDeviceFocusChangeEvent',
+'XDeviceFocusInEvent', 'XDeviceFocusOutEvent', 'XProximityNotifyEvent',
+'XProximityInEvent', 'XProximityOutEvent', 'XInputClass',
+'XDeviceStateNotifyEvent', 'XValuatorStatus', 'XKeyStatus', 'XButtonStatus',
+'XDeviceMappingEvent', 'XChangeDeviceNotifyEvent',
+'XDevicePresenceNotifyEvent', 'XFeedbackState', 'XKbdFeedbackState',
+'XPtrFeedbackState', 'XIntegerFeedbackState', 'XStringFeedbackState',
+'XBellFeedbackState', 'XLedFeedbackState', 'XFeedbackControl',
+'XPtrFeedbackControl', 'XKbdFeedbackControl', 'XStringFeedbackControl',
+'XIntegerFeedbackControl', 'XBellFeedbackControl', 'XLedFeedbackControl',
+'XDeviceControl', 'XDeviceResolutionControl', 'XDeviceResolutionState',
+'XDeviceAbsCalibControl', 'XDeviceAbsCalibState', 'XDeviceAbsAreaControl',
+'XDeviceAbsAreaState', 'XDeviceCoreControl', 'XDeviceCoreState',
+'XDeviceEnableControl', 'XDeviceEnableState', 'XAnyClassPtr', 'XAnyClassInfo',
+'XDeviceInfoPtr', 'XDeviceInfo', 'XKeyInfoPtr', 'XKeyInfo', 'XButtonInfoPtr',
+'XButtonInfo', 'XAxisInfoPtr', 'XAxisInfo', 'XValuatorInfoPtr',
+'XValuatorInfo', 'XInputClassInfo', 'XDevice', 'XEventList',
+'XDeviceTimeCoord', 'XDeviceState', 'XValuatorState', 'XKeyState',
+'XButtonState', 'XChangeKeyboardDevice', 'XChangePointerDevice',
+'XGrabDevice', 'XUngrabDevice', 'XGrabDeviceKey', 'XUngrabDeviceKey',
+'XGrabDeviceButton', 'XUngrabDeviceButton', 'XAllowDeviceEvents',
+'XGetDeviceFocus', 'XSetDeviceFocus', 'XGetFeedbackControl',
+'XFreeFeedbackList', 'XChangeFeedbackControl', 'XDeviceBell',
+'XGetDeviceKeyMapping', 'XChangeDeviceKeyMapping',
+'XGetDeviceModifierMapping', 'XSetDeviceModifierMapping',
+'XSetDeviceButtonMapping', 'XGetDeviceButtonMapping', 'XQueryDeviceState',
+'XFreeDeviceState', 'XGetExtensionVersion', 'XListInputDevices',
+'XListDeviceProperties', 'XGetDeviceProperty', 'XFreeDeviceList',
+'XOpenDevice', 'XCloseDevice', 'XSetDeviceMode',
+'XSetDeviceValuators', 'XGetDeviceControl', 'XChangeDeviceControl',
+'XSelectExtensionEvent', 'XGetSelectedExtensionEvents',
+'XChangeDeviceDontPropagateList', 'XGetDeviceDontPropagateList',
+'XSendExtensionEvent', 'XGetDeviceMotionEvents', 'XFreeDeviceMotionEvents',
+'XFreeDeviceControl']
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xlib.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xlib.py
new file mode 100644
index 0000000000000000000000000000000000000000..2f4f8a755947a8826f8c8c07e238d522bf7a7250
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xlib.py
@@ -0,0 +1,5613 @@
+"""Wrapper for X11
+
+Generated with:
+tools/genwrappers.py xlib
+
+Do not modify this file.
+
+####### NOTICE! ########
+This file has been manually modified to fix
+a limitation of the current wrapping tools.
+
+"""
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('X11')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+
+XlibSpecificationRelease = 6 # /usr/include/X11/Xlib.h:39
+X_PROTOCOL = 11 # /usr/include/X11/X.h:53
+X_PROTOCOL_REVISION = 0 # /usr/include/X11/X.h:54
+XID = c_ulong # /usr/include/X11/X.h:66
+Mask = c_ulong # /usr/include/X11/X.h:70
+Atom = c_ulong # /usr/include/X11/X.h:74
+VisualID = c_ulong # /usr/include/X11/X.h:76
+Time = c_ulong # /usr/include/X11/X.h:77
+Window = XID # /usr/include/X11/X.h:96
+Drawable = XID # /usr/include/X11/X.h:97
+Font = XID # /usr/include/X11/X.h:100
+Pixmap = XID # /usr/include/X11/X.h:102
+Cursor = XID # /usr/include/X11/X.h:103
+Colormap = XID # /usr/include/X11/X.h:104
+GContext = XID # /usr/include/X11/X.h:105
+KeySym = XID # /usr/include/X11/X.h:106
+KeyCode = c_ubyte # /usr/include/X11/X.h:108
+None_ = 0 # /usr/include/X11/X.h:115
+ParentRelative = 1 # /usr/include/X11/X.h:118
+CopyFromParent = 0 # /usr/include/X11/X.h:121
+PointerWindow = 0 # /usr/include/X11/X.h:126
+InputFocus = 1 # /usr/include/X11/X.h:127
+PointerRoot = 1 # /usr/include/X11/X.h:129
+AnyPropertyType = 0 # /usr/include/X11/X.h:131
+AnyKey = 0 # /usr/include/X11/X.h:133
+AnyButton = 0 # /usr/include/X11/X.h:135
+AllTemporary = 0 # /usr/include/X11/X.h:137
+CurrentTime = 0 # /usr/include/X11/X.h:139
+NoSymbol = 0 # /usr/include/X11/X.h:141
+NoEventMask = 0 # /usr/include/X11/X.h:150
+KeyPressMask = 1 # /usr/include/X11/X.h:151
+KeyReleaseMask = 2 # /usr/include/X11/X.h:152
+ButtonPressMask = 4 # /usr/include/X11/X.h:153
+ButtonReleaseMask = 8 # /usr/include/X11/X.h:154
+EnterWindowMask = 16 # /usr/include/X11/X.h:155
+LeaveWindowMask = 32 # /usr/include/X11/X.h:156
+PointerMotionMask = 64 # /usr/include/X11/X.h:157
+PointerMotionHintMask = 128 # /usr/include/X11/X.h:158
+Button1MotionMask = 256 # /usr/include/X11/X.h:159
+Button2MotionMask = 512 # /usr/include/X11/X.h:160
+Button3MotionMask = 1024 # /usr/include/X11/X.h:161
+Button4MotionMask = 2048 # /usr/include/X11/X.h:162
+Button5MotionMask = 4096 # /usr/include/X11/X.h:163
+ButtonMotionMask = 8192 # /usr/include/X11/X.h:164
+KeymapStateMask = 16384 # /usr/include/X11/X.h:165
+ExposureMask = 32768 # /usr/include/X11/X.h:166
+VisibilityChangeMask = 65536 # /usr/include/X11/X.h:167
+StructureNotifyMask = 131072 # /usr/include/X11/X.h:168
+ResizeRedirectMask = 262144 # /usr/include/X11/X.h:169
+SubstructureNotifyMask = 524288 # /usr/include/X11/X.h:170
+SubstructureRedirectMask = 1048576 # /usr/include/X11/X.h:171
+FocusChangeMask = 2097152 # /usr/include/X11/X.h:172
+PropertyChangeMask = 4194304 # /usr/include/X11/X.h:173
+ColormapChangeMask = 8388608 # /usr/include/X11/X.h:174
+OwnerGrabButtonMask = 16777216 # /usr/include/X11/X.h:175
+KeyPress = 2 # /usr/include/X11/X.h:181
+KeyRelease = 3 # /usr/include/X11/X.h:182
+ButtonPress = 4 # /usr/include/X11/X.h:183
+ButtonRelease = 5 # /usr/include/X11/X.h:184
+MotionNotify = 6 # /usr/include/X11/X.h:185
+EnterNotify = 7 # /usr/include/X11/X.h:186
+LeaveNotify = 8 # /usr/include/X11/X.h:187
+FocusIn = 9 # /usr/include/X11/X.h:188
+FocusOut = 10 # /usr/include/X11/X.h:189
+KeymapNotify = 11 # /usr/include/X11/X.h:190
+Expose = 12 # /usr/include/X11/X.h:191
+GraphicsExpose = 13 # /usr/include/X11/X.h:192
+NoExpose = 14 # /usr/include/X11/X.h:193
+VisibilityNotify = 15 # /usr/include/X11/X.h:194
+CreateNotify = 16 # /usr/include/X11/X.h:195
+DestroyNotify = 17 # /usr/include/X11/X.h:196
+UnmapNotify = 18 # /usr/include/X11/X.h:197
+MapNotify = 19 # /usr/include/X11/X.h:198
+MapRequest = 20 # /usr/include/X11/X.h:199
+ReparentNotify = 21 # /usr/include/X11/X.h:200
+ConfigureNotify = 22 # /usr/include/X11/X.h:201
+ConfigureRequest = 23 # /usr/include/X11/X.h:202
+GravityNotify = 24 # /usr/include/X11/X.h:203
+ResizeRequest = 25 # /usr/include/X11/X.h:204
+CirculateNotify = 26 # /usr/include/X11/X.h:205
+CirculateRequest = 27 # /usr/include/X11/X.h:206
+PropertyNotify = 28 # /usr/include/X11/X.h:207
+SelectionClear = 29 # /usr/include/X11/X.h:208
+SelectionRequest = 30 # /usr/include/X11/X.h:209
+SelectionNotify = 31 # /usr/include/X11/X.h:210
+ColormapNotify = 32 # /usr/include/X11/X.h:211
+ClientMessage = 33 # /usr/include/X11/X.h:212
+MappingNotify = 34 # /usr/include/X11/X.h:213
+GenericEvent = 35 # /usr/include/X11/X.h:214
+LASTEvent = 36 # /usr/include/X11/X.h:215
+ShiftMask = 1 # /usr/include/X11/X.h:221
+LockMask = 2 # /usr/include/X11/X.h:222
+ControlMask = 4 # /usr/include/X11/X.h:223
+Mod1Mask = 8 # /usr/include/X11/X.h:224
+Mod2Mask = 16 # /usr/include/X11/X.h:225
+Mod3Mask = 32 # /usr/include/X11/X.h:226
+Mod4Mask = 64 # /usr/include/X11/X.h:227
+Mod5Mask = 128 # /usr/include/X11/X.h:228
+ShiftMapIndex = 0 # /usr/include/X11/X.h:233
+LockMapIndex = 1 # /usr/include/X11/X.h:234
+ControlMapIndex = 2 # /usr/include/X11/X.h:235
+Mod1MapIndex = 3 # /usr/include/X11/X.h:236
+Mod2MapIndex = 4 # /usr/include/X11/X.h:237
+Mod3MapIndex = 5 # /usr/include/X11/X.h:238
+Mod4MapIndex = 6 # /usr/include/X11/X.h:239
+Mod5MapIndex = 7 # /usr/include/X11/X.h:240
+Button1Mask = 256 # /usr/include/X11/X.h:246
+Button2Mask = 512 # /usr/include/X11/X.h:247
+Button3Mask = 1024 # /usr/include/X11/X.h:248
+Button4Mask = 2048 # /usr/include/X11/X.h:249
+Button5Mask = 4096 # /usr/include/X11/X.h:250
+AnyModifier = 32768 # /usr/include/X11/X.h:252
+Button1 = 1 # /usr/include/X11/X.h:259
+Button2 = 2 # /usr/include/X11/X.h:260
+Button3 = 3 # /usr/include/X11/X.h:261
+Button4 = 4 # /usr/include/X11/X.h:262
+Button5 = 5 # /usr/include/X11/X.h:263
+NotifyNormal = 0 # /usr/include/X11/X.h:267
+NotifyGrab = 1 # /usr/include/X11/X.h:268
+NotifyUngrab = 2 # /usr/include/X11/X.h:269
+NotifyWhileGrabbed = 3 # /usr/include/X11/X.h:270
+NotifyHint = 1 # /usr/include/X11/X.h:272
+NotifyAncestor = 0 # /usr/include/X11/X.h:276
+NotifyVirtual = 1 # /usr/include/X11/X.h:277
+NotifyInferior = 2 # /usr/include/X11/X.h:278
+NotifyNonlinear = 3 # /usr/include/X11/X.h:279
+NotifyNonlinearVirtual = 4 # /usr/include/X11/X.h:280
+NotifyPointer = 5 # /usr/include/X11/X.h:281
+NotifyPointerRoot = 6 # /usr/include/X11/X.h:282
+NotifyDetailNone = 7 # /usr/include/X11/X.h:283
+VisibilityUnobscured = 0 # /usr/include/X11/X.h:287
+VisibilityPartiallyObscured = 1 # /usr/include/X11/X.h:288
+VisibilityFullyObscured = 2 # /usr/include/X11/X.h:289
+PlaceOnTop = 0 # /usr/include/X11/X.h:293
+PlaceOnBottom = 1 # /usr/include/X11/X.h:294
+FamilyInternet = 0 # /usr/include/X11/X.h:298
+FamilyDECnet = 1 # /usr/include/X11/X.h:299
+FamilyChaos = 2 # /usr/include/X11/X.h:300
+FamilyInternet6 = 6 # /usr/include/X11/X.h:301
+FamilyServerInterpreted = 5 # /usr/include/X11/X.h:304
+PropertyNewValue = 0 # /usr/include/X11/X.h:308
+PropertyDelete = 1 # /usr/include/X11/X.h:309
+ColormapUninstalled = 0 # /usr/include/X11/X.h:313
+ColormapInstalled = 1 # /usr/include/X11/X.h:314
+GrabModeSync = 0 # /usr/include/X11/X.h:318
+GrabModeAsync = 1 # /usr/include/X11/X.h:319
+GrabSuccess = 0 # /usr/include/X11/X.h:323
+AlreadyGrabbed = 1 # /usr/include/X11/X.h:324
+GrabInvalidTime = 2 # /usr/include/X11/X.h:325
+GrabNotViewable = 3 # /usr/include/X11/X.h:326
+GrabFrozen = 4 # /usr/include/X11/X.h:327
+AsyncPointer = 0 # /usr/include/X11/X.h:331
+SyncPointer = 1 # /usr/include/X11/X.h:332
+ReplayPointer = 2 # /usr/include/X11/X.h:333
+AsyncKeyboard = 3 # /usr/include/X11/X.h:334
+SyncKeyboard = 4 # /usr/include/X11/X.h:335
+ReplayKeyboard = 5 # /usr/include/X11/X.h:336
+AsyncBoth = 6 # /usr/include/X11/X.h:337
+SyncBoth = 7 # /usr/include/X11/X.h:338
+RevertToParent = 2 # /usr/include/X11/X.h:344
+Success = 0 # /usr/include/X11/X.h:350
+BadRequest = 1 # /usr/include/X11/X.h:351
+BadValue = 2 # /usr/include/X11/X.h:352
+BadWindow = 3 # /usr/include/X11/X.h:353
+BadPixmap = 4 # /usr/include/X11/X.h:354
+BadAtom = 5 # /usr/include/X11/X.h:355
+BadCursor = 6 # /usr/include/X11/X.h:356
+BadFont = 7 # /usr/include/X11/X.h:357
+BadMatch = 8 # /usr/include/X11/X.h:358
+BadDrawable = 9 # /usr/include/X11/X.h:359
+BadAccess = 10 # /usr/include/X11/X.h:360
+BadAlloc = 11 # /usr/include/X11/X.h:369
+BadColor = 12 # /usr/include/X11/X.h:370
+BadGC = 13 # /usr/include/X11/X.h:371
+BadIDChoice = 14 # /usr/include/X11/X.h:372
+BadName = 15 # /usr/include/X11/X.h:373
+BadLength = 16 # /usr/include/X11/X.h:374
+BadImplementation = 17 # /usr/include/X11/X.h:375
+FirstExtensionError = 128 # /usr/include/X11/X.h:377
+LastExtensionError = 255 # /usr/include/X11/X.h:378
+InputOutput = 1 # /usr/include/X11/X.h:387
+InputOnly = 2 # /usr/include/X11/X.h:388
+CWBackPixmap = 1 # /usr/include/X11/X.h:392
+CWBackPixel = 2 # /usr/include/X11/X.h:393
+CWBorderPixmap = 4 # /usr/include/X11/X.h:394
+CWBorderPixel = 8 # /usr/include/X11/X.h:395
+CWBitGravity = 16 # /usr/include/X11/X.h:396
+CWWinGravity = 32 # /usr/include/X11/X.h:397
+CWBackingStore = 64 # /usr/include/X11/X.h:398
+CWBackingPlanes = 128 # /usr/include/X11/X.h:399
+CWBackingPixel = 256 # /usr/include/X11/X.h:400
+CWOverrideRedirect = 512 # /usr/include/X11/X.h:401
+CWSaveUnder = 1024 # /usr/include/X11/X.h:402
+CWEventMask = 2048 # /usr/include/X11/X.h:403
+CWDontPropagate = 4096 # /usr/include/X11/X.h:404
+CWColormap = 8192 # /usr/include/X11/X.h:405
+CWCursor = 16384 # /usr/include/X11/X.h:406
+CWX = 1 # /usr/include/X11/X.h:410
+CWY = 2 # /usr/include/X11/X.h:411
+CWWidth = 4 # /usr/include/X11/X.h:412
+CWHeight = 8 # /usr/include/X11/X.h:413
+CWBorderWidth = 16 # /usr/include/X11/X.h:414
+CWSibling = 32 # /usr/include/X11/X.h:415
+CWStackMode = 64 # /usr/include/X11/X.h:416
+ForgetGravity = 0 # /usr/include/X11/X.h:421
+NorthWestGravity = 1 # /usr/include/X11/X.h:422
+NorthGravity = 2 # /usr/include/X11/X.h:423
+NorthEastGravity = 3 # /usr/include/X11/X.h:424
+WestGravity = 4 # /usr/include/X11/X.h:425
+CenterGravity = 5 # /usr/include/X11/X.h:426
+EastGravity = 6 # /usr/include/X11/X.h:427
+SouthWestGravity = 7 # /usr/include/X11/X.h:428
+SouthGravity = 8 # /usr/include/X11/X.h:429
+SouthEastGravity = 9 # /usr/include/X11/X.h:430
+StaticGravity = 10 # /usr/include/X11/X.h:431
+UnmapGravity = 0 # /usr/include/X11/X.h:435
+NotUseful = 0 # /usr/include/X11/X.h:439
+WhenMapped = 1 # /usr/include/X11/X.h:440
+Always = 2 # /usr/include/X11/X.h:441
+IsUnmapped = 0 # /usr/include/X11/X.h:445
+IsUnviewable = 1 # /usr/include/X11/X.h:446
+IsViewable = 2 # /usr/include/X11/X.h:447
+SetModeInsert = 0 # /usr/include/X11/X.h:451
+SetModeDelete = 1 # /usr/include/X11/X.h:452
+DestroyAll = 0 # /usr/include/X11/X.h:456
+RetainPermanent = 1 # /usr/include/X11/X.h:457
+RetainTemporary = 2 # /usr/include/X11/X.h:458
+Above = 0 # /usr/include/X11/X.h:462
+Below = 1 # /usr/include/X11/X.h:463
+TopIf = 2 # /usr/include/X11/X.h:464
+BottomIf = 3 # /usr/include/X11/X.h:465
+Opposite = 4 # /usr/include/X11/X.h:466
+RaiseLowest = 0 # /usr/include/X11/X.h:470
+LowerHighest = 1 # /usr/include/X11/X.h:471
+PropModeReplace = 0 # /usr/include/X11/X.h:475
+PropModePrepend = 1 # /usr/include/X11/X.h:476
+PropModeAppend = 2 # /usr/include/X11/X.h:477
+GXclear = 0 # /usr/include/X11/X.h:485
+GXand = 1 # /usr/include/X11/X.h:486
+GXandReverse = 2 # /usr/include/X11/X.h:487
+GXcopy = 3 # /usr/include/X11/X.h:488
+GXandInverted = 4 # /usr/include/X11/X.h:489
+GXnoop = 5 # /usr/include/X11/X.h:490
+GXxor = 6 # /usr/include/X11/X.h:491
+GXor = 7 # /usr/include/X11/X.h:492
+GXnor = 8 # /usr/include/X11/X.h:493
+GXequiv = 9 # /usr/include/X11/X.h:494
+GXinvert = 10 # /usr/include/X11/X.h:495
+GXorReverse = 11 # /usr/include/X11/X.h:496
+GXcopyInverted = 12 # /usr/include/X11/X.h:497
+GXorInverted = 13 # /usr/include/X11/X.h:498
+GXnand = 14 # /usr/include/X11/X.h:499
+GXset = 15 # /usr/include/X11/X.h:500
+LineSolid = 0 # /usr/include/X11/X.h:504
+LineOnOffDash = 1 # /usr/include/X11/X.h:505
+LineDoubleDash = 2 # /usr/include/X11/X.h:506
+CapNotLast = 0 # /usr/include/X11/X.h:510
+CapButt = 1 # /usr/include/X11/X.h:511
+CapRound = 2 # /usr/include/X11/X.h:512
+CapProjecting = 3 # /usr/include/X11/X.h:513
+JoinMiter = 0 # /usr/include/X11/X.h:517
+JoinRound = 1 # /usr/include/X11/X.h:518
+JoinBevel = 2 # /usr/include/X11/X.h:519
+FillSolid = 0 # /usr/include/X11/X.h:523
+FillTiled = 1 # /usr/include/X11/X.h:524
+FillStippled = 2 # /usr/include/X11/X.h:525
+FillOpaqueStippled = 3 # /usr/include/X11/X.h:526
+EvenOddRule = 0 # /usr/include/X11/X.h:530
+WindingRule = 1 # /usr/include/X11/X.h:531
+ClipByChildren = 0 # /usr/include/X11/X.h:535
+IncludeInferiors = 1 # /usr/include/X11/X.h:536
+Unsorted = 0 # /usr/include/X11/X.h:540
+YSorted = 1 # /usr/include/X11/X.h:541
+YXSorted = 2 # /usr/include/X11/X.h:542
+YXBanded = 3 # /usr/include/X11/X.h:543
+CoordModeOrigin = 0 # /usr/include/X11/X.h:547
+CoordModePrevious = 1 # /usr/include/X11/X.h:548
+Complex = 0 # /usr/include/X11/X.h:552
+Nonconvex = 1 # /usr/include/X11/X.h:553
+Convex = 2 # /usr/include/X11/X.h:554
+ArcChord = 0 # /usr/include/X11/X.h:558
+ArcPieSlice = 1 # /usr/include/X11/X.h:559
+GCFunction = 1 # /usr/include/X11/X.h:564
+GCPlaneMask = 2 # /usr/include/X11/X.h:565
+GCForeground = 4 # /usr/include/X11/X.h:566
+GCBackground = 8 # /usr/include/X11/X.h:567
+GCLineWidth = 16 # /usr/include/X11/X.h:568
+GCLineStyle = 32 # /usr/include/X11/X.h:569
+GCCapStyle = 64 # /usr/include/X11/X.h:570
+GCJoinStyle = 128 # /usr/include/X11/X.h:571
+GCFillStyle = 256 # /usr/include/X11/X.h:572
+GCFillRule = 512 # /usr/include/X11/X.h:573
+GCTile = 1024 # /usr/include/X11/X.h:574
+GCStipple = 2048 # /usr/include/X11/X.h:575
+GCTileStipXOrigin = 4096 # /usr/include/X11/X.h:576
+GCTileStipYOrigin = 8192 # /usr/include/X11/X.h:577
+GCFont = 16384 # /usr/include/X11/X.h:578
+GCSubwindowMode = 32768 # /usr/include/X11/X.h:579
+GCGraphicsExposures = 65536 # /usr/include/X11/X.h:580
+GCClipXOrigin = 131072 # /usr/include/X11/X.h:581
+GCClipYOrigin = 262144 # /usr/include/X11/X.h:582
+GCClipMask = 524288 # /usr/include/X11/X.h:583
+GCDashOffset = 1048576 # /usr/include/X11/X.h:584
+GCDashList = 2097152 # /usr/include/X11/X.h:585
+GCArcMode = 4194304 # /usr/include/X11/X.h:586
+GCLastBit = 22 # /usr/include/X11/X.h:588
+FontLeftToRight = 0 # /usr/include/X11/X.h:595
+FontRightToLeft = 1 # /usr/include/X11/X.h:596
+FontChange = 255 # /usr/include/X11/X.h:598
+XYBitmap = 0 # /usr/include/X11/X.h:606
+XYPixmap = 1 # /usr/include/X11/X.h:607
+ZPixmap = 2 # /usr/include/X11/X.h:608
+AllocNone = 0 # /usr/include/X11/X.h:616
+AllocAll = 1 # /usr/include/X11/X.h:617
+DoRed = 1 # /usr/include/X11/X.h:622
+DoGreen = 2 # /usr/include/X11/X.h:623
+DoBlue = 4 # /usr/include/X11/X.h:624
+CursorShape = 0 # /usr/include/X11/X.h:632
+TileShape = 1 # /usr/include/X11/X.h:633
+StippleShape = 2 # /usr/include/X11/X.h:634
+AutoRepeatModeOff = 0 # /usr/include/X11/X.h:640
+AutoRepeatModeOn = 1 # /usr/include/X11/X.h:641
+AutoRepeatModeDefault = 2 # /usr/include/X11/X.h:642
+LedModeOff = 0 # /usr/include/X11/X.h:644
+LedModeOn = 1 # /usr/include/X11/X.h:645
+KBKeyClickPercent = 1 # /usr/include/X11/X.h:649
+KBBellPercent = 2 # /usr/include/X11/X.h:650
+KBBellPitch = 4 # /usr/include/X11/X.h:651
+KBBellDuration = 8 # /usr/include/X11/X.h:652
+KBLed = 16 # /usr/include/X11/X.h:653
+KBLedMode = 32 # /usr/include/X11/X.h:654
+KBKey = 64 # /usr/include/X11/X.h:655
+KBAutoRepeatMode = 128 # /usr/include/X11/X.h:656
+MappingSuccess = 0 # /usr/include/X11/X.h:658
+MappingBusy = 1 # /usr/include/X11/X.h:659
+MappingFailed = 2 # /usr/include/X11/X.h:660
+MappingModifier = 0 # /usr/include/X11/X.h:662
+MappingKeyboard = 1 # /usr/include/X11/X.h:663
+MappingPointer = 2 # /usr/include/X11/X.h:664
+DontPreferBlanking = 0 # /usr/include/X11/X.h:670
+PreferBlanking = 1 # /usr/include/X11/X.h:671
+DefaultBlanking = 2 # /usr/include/X11/X.h:672
+DisableScreenSaver = 0 # /usr/include/X11/X.h:674
+DisableScreenInterval = 0 # /usr/include/X11/X.h:675
+DontAllowExposures = 0 # /usr/include/X11/X.h:677
+AllowExposures = 1 # /usr/include/X11/X.h:678
+DefaultExposures = 2 # /usr/include/X11/X.h:679
+ScreenSaverReset = 0 # /usr/include/X11/X.h:683
+ScreenSaverActive = 1 # /usr/include/X11/X.h:684
+HostInsert = 0 # /usr/include/X11/X.h:692
+HostDelete = 1 # /usr/include/X11/X.h:693
+EnableAccess = 1 # /usr/include/X11/X.h:697
+DisableAccess = 0 # /usr/include/X11/X.h:698
+StaticGray = 0 # /usr/include/X11/X.h:704
+GrayScale = 1 # /usr/include/X11/X.h:705
+StaticColor = 2 # /usr/include/X11/X.h:706
+PseudoColor = 3 # /usr/include/X11/X.h:707
+TrueColor = 4 # /usr/include/X11/X.h:708
+DirectColor = 5 # /usr/include/X11/X.h:709
+LSBFirst = 0 # /usr/include/X11/X.h:714
+MSBFirst = 1 # /usr/include/X11/X.h:715
+# /usr/include/X11/Xlib.h:73
+_Xmblen = _lib._Xmblen
+_Xmblen.restype = c_int
+_Xmblen.argtypes = [c_char_p, c_int]
+
+X_HAVE_UTF8_STRING = 1 # /usr/include/X11/Xlib.h:85
+XPointer = c_char_p # /usr/include/X11/Xlib.h:87
+Bool = c_int # /usr/include/X11/Xlib.h:89
+Status = c_int # /usr/include/X11/Xlib.h:90
+True_ = 1 # /usr/include/X11/Xlib.h:91
+False_ = 0 # /usr/include/X11/Xlib.h:92
+QueuedAlready = 0 # /usr/include/X11/Xlib.h:94
+QueuedAfterReading = 1 # /usr/include/X11/Xlib.h:95
+QueuedAfterFlush = 2 # /usr/include/X11/Xlib.h:96
+class struct__XExtData(Structure):
+ __slots__ = [
+ 'number',
+ 'next',
+ 'free_private',
+ 'private_data',
+ ]
+struct__XExtData._fields_ = [
+ ('number', c_int),
+ ('next', POINTER(struct__XExtData)),
+ ('free_private', POINTER(CFUNCTYPE(c_int, POINTER(struct__XExtData)))),
+ ('private_data', XPointer),
+]
+
+XExtData = struct__XExtData # /usr/include/X11/Xlib.h:166
+class struct_anon_15(Structure):
+ __slots__ = [
+ 'extension',
+ 'major_opcode',
+ 'first_event',
+ 'first_error',
+ ]
+struct_anon_15._fields_ = [
+ ('extension', c_int),
+ ('major_opcode', c_int),
+ ('first_event', c_int),
+ ('first_error', c_int),
+]
+
+XExtCodes = struct_anon_15 # /usr/include/X11/Xlib.h:176
+class struct_anon_16(Structure):
+ __slots__ = [
+ 'depth',
+ 'bits_per_pixel',
+ 'scanline_pad',
+ ]
+struct_anon_16._fields_ = [
+ ('depth', c_int),
+ ('bits_per_pixel', c_int),
+ ('scanline_pad', c_int),
+]
+
+XPixmapFormatValues = struct_anon_16 # /usr/include/X11/Xlib.h:186
+class struct_anon_17(Structure):
+ __slots__ = [
+ 'function',
+ 'plane_mask',
+ 'foreground',
+ 'background',
+ 'line_width',
+ 'line_style',
+ 'cap_style',
+ 'join_style',
+ 'fill_style',
+ 'fill_rule',
+ 'arc_mode',
+ 'tile',
+ 'stipple',
+ 'ts_x_origin',
+ 'ts_y_origin',
+ 'font',
+ 'subwindow_mode',
+ 'graphics_exposures',
+ 'clip_x_origin',
+ 'clip_y_origin',
+ 'clip_mask',
+ 'dash_offset',
+ 'dashes',
+ ]
+struct_anon_17._fields_ = [
+ ('function', c_int),
+ ('plane_mask', c_ulong),
+ ('foreground', c_ulong),
+ ('background', c_ulong),
+ ('line_width', c_int),
+ ('line_style', c_int),
+ ('cap_style', c_int),
+ ('join_style', c_int),
+ ('fill_style', c_int),
+ ('fill_rule', c_int),
+ ('arc_mode', c_int),
+ ('tile', Pixmap),
+ ('stipple', Pixmap),
+ ('ts_x_origin', c_int),
+ ('ts_y_origin', c_int),
+ ('font', Font),
+ ('subwindow_mode', c_int),
+ ('graphics_exposures', c_int),
+ ('clip_x_origin', c_int),
+ ('clip_y_origin', c_int),
+ ('clip_mask', Pixmap),
+ ('dash_offset', c_int),
+ ('dashes', c_char),
+]
+
+XGCValues = struct_anon_17 # /usr/include/X11/Xlib.h:218
+class struct__XGC(Structure):
+ __slots__ = [
+ ]
+struct__XGC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XGC(Structure):
+ __slots__ = [
+ ]
+struct__XGC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+GC = POINTER(struct__XGC) # /usr/include/X11/Xlib.h:233
+class struct_anon_18(Structure):
+ __slots__ = [
+ 'ext_data',
+ 'visualid',
+ 'class',
+ 'red_mask',
+ 'green_mask',
+ 'blue_mask',
+ 'bits_per_rgb',
+ 'map_entries',
+ ]
+struct_anon_18._fields_ = [
+ ('ext_data', POINTER(XExtData)),
+ ('visualid', VisualID),
+ ('class', c_int),
+ ('red_mask', c_ulong),
+ ('green_mask', c_ulong),
+ ('blue_mask', c_ulong),
+ ('bits_per_rgb', c_int),
+ ('map_entries', c_int),
+]
+
+Visual = struct_anon_18 # /usr/include/X11/Xlib.h:249
+class struct_anon_19(Structure):
+ __slots__ = [
+ 'depth',
+ 'nvisuals',
+ 'visuals',
+ ]
+struct_anon_19._fields_ = [
+ ('depth', c_int),
+ ('nvisuals', c_int),
+ ('visuals', POINTER(Visual)),
+]
+
+Depth = struct_anon_19 # /usr/include/X11/Xlib.h:258
+class struct_anon_20(Structure):
+ __slots__ = [
+ 'ext_data',
+ 'display',
+ 'root',
+ 'width',
+ 'height',
+ 'mwidth',
+ 'mheight',
+ 'ndepths',
+ 'depths',
+ 'root_depth',
+ 'root_visual',
+ 'default_gc',
+ 'cmap',
+ 'white_pixel',
+ 'black_pixel',
+ 'max_maps',
+ 'min_maps',
+ 'backing_store',
+ 'save_unders',
+ 'root_input_mask',
+ ]
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+struct_anon_20._fields_ = [
+ ('ext_data', POINTER(XExtData)),
+ ('display', POINTER(struct__XDisplay)),
+ ('root', Window),
+ ('width', c_int),
+ ('height', c_int),
+ ('mwidth', c_int),
+ ('mheight', c_int),
+ ('ndepths', c_int),
+ ('depths', POINTER(Depth)),
+ ('root_depth', c_int),
+ ('root_visual', POINTER(Visual)),
+ ('default_gc', GC),
+ ('cmap', Colormap),
+ ('white_pixel', c_ulong),
+ ('black_pixel', c_ulong),
+ ('max_maps', c_int),
+ ('min_maps', c_int),
+ ('backing_store', c_int),
+ ('save_unders', c_int),
+ ('root_input_mask', c_long),
+]
+
+Screen = struct_anon_20 # /usr/include/X11/Xlib.h:286
+class struct_anon_21(Structure):
+ __slots__ = [
+ 'ext_data',
+ 'depth',
+ 'bits_per_pixel',
+ 'scanline_pad',
+ ]
+struct_anon_21._fields_ = [
+ ('ext_data', POINTER(XExtData)),
+ ('depth', c_int),
+ ('bits_per_pixel', c_int),
+ ('scanline_pad', c_int),
+]
+
+ScreenFormat = struct_anon_21 # /usr/include/X11/Xlib.h:296
+class struct_anon_22(Structure):
+ __slots__ = [
+ 'background_pixmap',
+ 'background_pixel',
+ 'border_pixmap',
+ 'border_pixel',
+ 'bit_gravity',
+ 'win_gravity',
+ 'backing_store',
+ 'backing_planes',
+ 'backing_pixel',
+ 'save_under',
+ 'event_mask',
+ 'do_not_propagate_mask',
+ 'override_redirect',
+ 'colormap',
+ 'cursor',
+ ]
+struct_anon_22._fields_ = [
+ ('background_pixmap', Pixmap),
+ ('background_pixel', c_ulong),
+ ('border_pixmap', Pixmap),
+ ('border_pixel', c_ulong),
+ ('bit_gravity', c_int),
+ ('win_gravity', c_int),
+ ('backing_store', c_int),
+ ('backing_planes', c_ulong),
+ ('backing_pixel', c_ulong),
+ ('save_under', c_int),
+ ('event_mask', c_long),
+ ('do_not_propagate_mask', c_long),
+ ('override_redirect', c_int),
+ ('colormap', Colormap),
+ ('cursor', Cursor),
+]
+
+XSetWindowAttributes = struct_anon_22 # /usr/include/X11/Xlib.h:317
+class struct_anon_23(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'border_width',
+ 'depth',
+ 'visual',
+ 'root',
+ 'class',
+ 'bit_gravity',
+ 'win_gravity',
+ 'backing_store',
+ 'backing_planes',
+ 'backing_pixel',
+ 'save_under',
+ 'colormap',
+ 'map_installed',
+ 'map_state',
+ 'all_event_masks',
+ 'your_event_mask',
+ 'do_not_propagate_mask',
+ 'override_redirect',
+ 'screen',
+ ]
+struct_anon_23._fields_ = [
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('border_width', c_int),
+ ('depth', c_int),
+ ('visual', POINTER(Visual)),
+ ('root', Window),
+ ('class', c_int),
+ ('bit_gravity', c_int),
+ ('win_gravity', c_int),
+ ('backing_store', c_int),
+ ('backing_planes', c_ulong),
+ ('backing_pixel', c_ulong),
+ ('save_under', c_int),
+ ('colormap', Colormap),
+ ('map_installed', c_int),
+ ('map_state', c_int),
+ ('all_event_masks', c_long),
+ ('your_event_mask', c_long),
+ ('do_not_propagate_mask', c_long),
+ ('override_redirect', c_int),
+ ('screen', POINTER(Screen)),
+]
+
+XWindowAttributes = struct_anon_23 # /usr/include/X11/Xlib.h:345
+class struct_anon_24(Structure):
+ __slots__ = [
+ 'family',
+ 'length',
+ 'address',
+ ]
+struct_anon_24._fields_ = [
+ ('family', c_int),
+ ('length', c_int),
+ ('address', c_char_p),
+]
+
+XHostAddress = struct_anon_24 # /usr/include/X11/Xlib.h:356
+class struct_anon_25(Structure):
+ __slots__ = [
+ 'typelength',
+ 'valuelength',
+ 'type',
+ 'value',
+ ]
+struct_anon_25._fields_ = [
+ ('typelength', c_int),
+ ('valuelength', c_int),
+ ('type', c_char_p),
+ ('value', c_char_p),
+]
+
+XServerInterpretedAddress = struct_anon_25 # /usr/include/X11/Xlib.h:366
+class struct__XImage(Structure):
+ __slots__ = [
+ 'width',
+ 'height',
+ 'xoffset',
+ 'format',
+ 'data',
+ 'byte_order',
+ 'bitmap_unit',
+ 'bitmap_bit_order',
+ 'bitmap_pad',
+ 'depth',
+ 'bytes_per_line',
+ 'bits_per_pixel',
+ 'red_mask',
+ 'green_mask',
+ 'blue_mask',
+ 'obdata',
+ 'f',
+ ]
+class struct_funcs(Structure):
+ __slots__ = [
+ 'create_image',
+ 'destroy_image',
+ 'get_pixel',
+ 'put_pixel',
+ 'sub_image',
+ 'add_pixel',
+ ]
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+struct_funcs._fields_ = [
+ ('create_image', POINTER(CFUNCTYPE(POINTER(struct__XImage), POINTER(struct__XDisplay), POINTER(Visual), c_uint, c_int, c_int, c_char_p, c_uint, c_uint, c_int, c_int))),
+ ('destroy_image', POINTER(CFUNCTYPE(c_int, POINTER(struct__XImage)))),
+ ('get_pixel', POINTER(CFUNCTYPE(c_ulong, POINTER(struct__XImage), c_int, c_int))),
+ ('put_pixel', POINTER(CFUNCTYPE(c_int, POINTER(struct__XImage), c_int, c_int, c_ulong))),
+ ('sub_image', POINTER(CFUNCTYPE(POINTER(struct__XImage), POINTER(struct__XImage), c_int, c_int, c_uint, c_uint))),
+ ('add_pixel', POINTER(CFUNCTYPE(c_int, POINTER(struct__XImage), c_long))),
+]
+
+struct__XImage._fields_ = [
+ ('width', c_int),
+ ('height', c_int),
+ ('xoffset', c_int),
+ ('format', c_int),
+ ('data', c_char_p),
+ ('byte_order', c_int),
+ ('bitmap_unit', c_int),
+ ('bitmap_bit_order', c_int),
+ ('bitmap_pad', c_int),
+ ('depth', c_int),
+ ('bytes_per_line', c_int),
+ ('bits_per_pixel', c_int),
+ ('red_mask', c_ulong),
+ ('green_mask', c_ulong),
+ ('blue_mask', c_ulong),
+ ('obdata', XPointer),
+ ('f', struct_funcs),
+]
+
+XImage = struct__XImage # /usr/include/X11/Xlib.h:405
+class struct_anon_26(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'border_width',
+ 'sibling',
+ 'stack_mode',
+ ]
+struct_anon_26._fields_ = [
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('border_width', c_int),
+ ('sibling', Window),
+ ('stack_mode', c_int),
+]
+
+XWindowChanges = struct_anon_26 # /usr/include/X11/Xlib.h:416
+class struct_anon_27(Structure):
+ __slots__ = [
+ 'pixel',
+ 'red',
+ 'green',
+ 'blue',
+ 'flags',
+ 'pad',
+ ]
+struct_anon_27._fields_ = [
+ ('pixel', c_ulong),
+ ('red', c_ushort),
+ ('green', c_ushort),
+ ('blue', c_ushort),
+ ('flags', c_char),
+ ('pad', c_char),
+]
+
+XColor = struct_anon_27 # /usr/include/X11/Xlib.h:426
+class struct_anon_28(Structure):
+ __slots__ = [
+ 'x1',
+ 'y1',
+ 'x2',
+ 'y2',
+ ]
+struct_anon_28._fields_ = [
+ ('x1', c_short),
+ ('y1', c_short),
+ ('x2', c_short),
+ ('y2', c_short),
+]
+
+XSegment = struct_anon_28 # /usr/include/X11/Xlib.h:435
+class struct_anon_29(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ ]
+struct_anon_29._fields_ = [
+ ('x', c_short),
+ ('y', c_short),
+]
+
+XPoint = struct_anon_29 # /usr/include/X11/Xlib.h:439
+class struct_anon_30(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ ]
+struct_anon_30._fields_ = [
+ ('x', c_short),
+ ('y', c_short),
+ ('width', c_ushort),
+ ('height', c_ushort),
+]
+
+XRectangle = struct_anon_30 # /usr/include/X11/Xlib.h:444
+class struct_anon_31(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'angle1',
+ 'angle2',
+ ]
+struct_anon_31._fields_ = [
+ ('x', c_short),
+ ('y', c_short),
+ ('width', c_ushort),
+ ('height', c_ushort),
+ ('angle1', c_short),
+ ('angle2', c_short),
+]
+
+XArc = struct_anon_31 # /usr/include/X11/Xlib.h:450
+class struct_anon_32(Structure):
+ __slots__ = [
+ 'key_click_percent',
+ 'bell_percent',
+ 'bell_pitch',
+ 'bell_duration',
+ 'led',
+ 'led_mode',
+ 'key',
+ 'auto_repeat_mode',
+ ]
+struct_anon_32._fields_ = [
+ ('key_click_percent', c_int),
+ ('bell_percent', c_int),
+ ('bell_pitch', c_int),
+ ('bell_duration', c_int),
+ ('led', c_int),
+ ('led_mode', c_int),
+ ('key', c_int),
+ ('auto_repeat_mode', c_int),
+]
+
+XKeyboardControl = struct_anon_32 # /usr/include/X11/Xlib.h:464
+class struct_anon_33(Structure):
+ __slots__ = [
+ 'key_click_percent',
+ 'bell_percent',
+ 'bell_pitch',
+ 'bell_duration',
+ 'led_mask',
+ 'global_auto_repeat',
+ 'auto_repeats',
+ ]
+struct_anon_33._fields_ = [
+ ('key_click_percent', c_int),
+ ('bell_percent', c_int),
+ ('bell_pitch', c_uint),
+ ('bell_duration', c_uint),
+ ('led_mask', c_ulong),
+ ('global_auto_repeat', c_int),
+ ('auto_repeats', c_char * 32),
+]
+
+XKeyboardState = struct_anon_33 # /usr/include/X11/Xlib.h:475
+class struct_anon_34(Structure):
+ __slots__ = [
+ 'time',
+ 'x',
+ 'y',
+ ]
+struct_anon_34._fields_ = [
+ ('time', Time),
+ ('x', c_short),
+ ('y', c_short),
+]
+
+XTimeCoord = struct_anon_34 # /usr/include/X11/Xlib.h:482
+class struct_anon_35(Structure):
+ __slots__ = [
+ 'max_keypermod',
+ 'modifiermap',
+ ]
+struct_anon_35._fields_ = [
+ ('max_keypermod', c_int),
+ ('modifiermap', POINTER(KeyCode)),
+]
+
+XModifierKeymap = struct_anon_35 # /usr/include/X11/Xlib.h:489
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+Display = struct__XDisplay # /usr/include/X11/Xlib.h:498
+class struct_anon_36(Structure):
+ __slots__ = [
+ 'ext_data',
+ 'private1',
+ 'fd',
+ 'private2',
+ 'proto_major_version',
+ 'proto_minor_version',
+ 'vendor',
+ 'private3',
+ 'private4',
+ 'private5',
+ 'private6',
+ 'resource_alloc',
+ 'byte_order',
+ 'bitmap_unit',
+ 'bitmap_pad',
+ 'bitmap_bit_order',
+ 'nformats',
+ 'pixmap_format',
+ 'private8',
+ 'release',
+ 'private9',
+ 'private10',
+ 'qlen',
+ 'last_request_read',
+ 'request',
+ 'private11',
+ 'private12',
+ 'private13',
+ 'private14',
+ 'max_request_size',
+ 'db',
+ 'private15',
+ 'display_name',
+ 'default_screen',
+ 'nscreens',
+ 'screens',
+ 'motion_buffer',
+ 'private16',
+ 'min_keycode',
+ 'max_keycode',
+ 'private17',
+ 'private18',
+ 'private19',
+ 'xdefaults',
+ ]
+class struct__XPrivate(Structure):
+ __slots__ = [
+ ]
+struct__XPrivate._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XPrivate(Structure):
+ __slots__ = [
+ ]
+struct__XPrivate._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XPrivate(Structure):
+ __slots__ = [
+ ]
+struct__XPrivate._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XrmHashBucketRec(Structure):
+ __slots__ = [
+ ]
+struct__XrmHashBucketRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XDisplay(Structure):
+ __slots__ = [
+ ]
+struct__XDisplay._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+struct_anon_36._fields_ = [
+ ('ext_data', POINTER(XExtData)),
+ ('private1', POINTER(struct__XPrivate)),
+ ('fd', c_int),
+ ('private2', c_int),
+ ('proto_major_version', c_int),
+ ('proto_minor_version', c_int),
+ ('vendor', c_char_p),
+ ('private3', XID),
+ ('private4', XID),
+ ('private5', XID),
+ ('private6', c_int),
+ ('resource_alloc', POINTER(CFUNCTYPE(XID, POINTER(struct__XDisplay)))),
+ ('byte_order', c_int),
+ ('bitmap_unit', c_int),
+ ('bitmap_pad', c_int),
+ ('bitmap_bit_order', c_int),
+ ('nformats', c_int),
+ ('pixmap_format', POINTER(ScreenFormat)),
+ ('private8', c_int),
+ ('release', c_int),
+ ('private9', POINTER(struct__XPrivate)),
+ ('private10', POINTER(struct__XPrivate)),
+ ('qlen', c_int),
+ ('last_request_read', c_ulong),
+ ('request', c_ulong),
+ ('private11', XPointer),
+ ('private12', XPointer),
+ ('private13', XPointer),
+ ('private14', XPointer),
+ ('max_request_size', c_uint),
+ ('db', POINTER(struct__XrmHashBucketRec)),
+ ('private15', POINTER(CFUNCTYPE(c_int, POINTER(struct__XDisplay)))),
+ ('display_name', c_char_p),
+ ('default_screen', c_int),
+ ('nscreens', c_int),
+ ('screens', POINTER(Screen)),
+ ('motion_buffer', c_ulong),
+ ('private16', c_ulong),
+ ('min_keycode', c_int),
+ ('max_keycode', c_int),
+ ('private17', XPointer),
+ ('private18', XPointer),
+ ('private19', c_int),
+ ('xdefaults', c_char_p),
+]
+
+_XPrivDisplay = POINTER(struct_anon_36) # /usr/include/X11/Xlib.h:561
+class struct_anon_37(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'keycode',
+ 'same_screen',
+ ]
+struct_anon_37._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('keycode', c_uint),
+ ('same_screen', c_int),
+]
+
+XKeyEvent = struct_anon_37 # /usr/include/X11/Xlib.h:582
+XKeyPressedEvent = XKeyEvent # /usr/include/X11/Xlib.h:583
+XKeyReleasedEvent = XKeyEvent # /usr/include/X11/Xlib.h:584
+class struct_anon_38(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'button',
+ 'same_screen',
+ ]
+struct_anon_38._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('button', c_uint),
+ ('same_screen', c_int),
+]
+
+XButtonEvent = struct_anon_38 # /usr/include/X11/Xlib.h:600
+XButtonPressedEvent = XButtonEvent # /usr/include/X11/Xlib.h:601
+XButtonReleasedEvent = XButtonEvent # /usr/include/X11/Xlib.h:602
+class struct_anon_39(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'state',
+ 'is_hint',
+ 'same_screen',
+ ]
+struct_anon_39._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('state', c_uint),
+ ('is_hint', c_char),
+ ('same_screen', c_int),
+]
+
+XMotionEvent = struct_anon_39 # /usr/include/X11/Xlib.h:618
+XPointerMovedEvent = XMotionEvent # /usr/include/X11/Xlib.h:619
+class struct_anon_40(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'root',
+ 'subwindow',
+ 'time',
+ 'x',
+ 'y',
+ 'x_root',
+ 'y_root',
+ 'mode',
+ 'detail',
+ 'same_screen',
+ 'focus',
+ 'state',
+ ]
+struct_anon_40._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('root', Window),
+ ('subwindow', Window),
+ ('time', Time),
+ ('x', c_int),
+ ('y', c_int),
+ ('x_root', c_int),
+ ('y_root', c_int),
+ ('mode', c_int),
+ ('detail', c_int),
+ ('same_screen', c_int),
+ ('focus', c_int),
+ ('state', c_uint),
+]
+
+XCrossingEvent = struct_anon_40 # /usr/include/X11/Xlib.h:641
+XEnterWindowEvent = XCrossingEvent # /usr/include/X11/Xlib.h:642
+XLeaveWindowEvent = XCrossingEvent # /usr/include/X11/Xlib.h:643
+class struct_anon_41(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'mode',
+ 'detail',
+ ]
+struct_anon_41._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('mode', c_int),
+ ('detail', c_int),
+]
+
+XFocusChangeEvent = struct_anon_41 # /usr/include/X11/Xlib.h:659
+XFocusInEvent = XFocusChangeEvent # /usr/include/X11/Xlib.h:660
+XFocusOutEvent = XFocusChangeEvent # /usr/include/X11/Xlib.h:661
+class struct_anon_42(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'key_vector',
+ ]
+struct_anon_42._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('key_vector', c_char * 32),
+]
+
+XKeymapEvent = struct_anon_42 # /usr/include/X11/Xlib.h:671
+class struct_anon_43(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'count',
+ ]
+struct_anon_43._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('count', c_int),
+]
+
+XExposeEvent = struct_anon_43 # /usr/include/X11/Xlib.h:682
+class struct_anon_44(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'drawable',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'count',
+ 'major_code',
+ 'minor_code',
+ ]
+struct_anon_44._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('drawable', Drawable),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('count', c_int),
+ ('major_code', c_int),
+ ('minor_code', c_int),
+]
+
+XGraphicsExposeEvent = struct_anon_44 # /usr/include/X11/Xlib.h:695
+class struct_anon_45(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'drawable',
+ 'major_code',
+ 'minor_code',
+ ]
+struct_anon_45._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('drawable', Drawable),
+ ('major_code', c_int),
+ ('minor_code', c_int),
+]
+
+XNoExposeEvent = struct_anon_45 # /usr/include/X11/Xlib.h:705
+class struct_anon_46(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'state',
+ ]
+struct_anon_46._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('state', c_int),
+]
+
+XVisibilityEvent = struct_anon_46 # /usr/include/X11/Xlib.h:714
+class struct_anon_47(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'parent',
+ 'window',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'border_width',
+ 'override_redirect',
+ ]
+struct_anon_47._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('parent', Window),
+ ('window', Window),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('border_width', c_int),
+ ('override_redirect', c_int),
+]
+
+XCreateWindowEvent = struct_anon_47 # /usr/include/X11/Xlib.h:727
+class struct_anon_48(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ ]
+struct_anon_48._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+]
+
+XDestroyWindowEvent = struct_anon_48 # /usr/include/X11/Xlib.h:736
+class struct_anon_49(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ 'from_configure',
+ ]
+struct_anon_49._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+ ('from_configure', c_int),
+]
+
+XUnmapEvent = struct_anon_49 # /usr/include/X11/Xlib.h:746
+class struct_anon_50(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ 'override_redirect',
+ ]
+struct_anon_50._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+ ('override_redirect', c_int),
+]
+
+XMapEvent = struct_anon_50 # /usr/include/X11/Xlib.h:756
+class struct_anon_51(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'parent',
+ 'window',
+ ]
+struct_anon_51._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('parent', Window),
+ ('window', Window),
+]
+
+XMapRequestEvent = struct_anon_51 # /usr/include/X11/Xlib.h:765
+class struct_anon_52(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ 'parent',
+ 'x',
+ 'y',
+ 'override_redirect',
+ ]
+struct_anon_52._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+ ('parent', Window),
+ ('x', c_int),
+ ('y', c_int),
+ ('override_redirect', c_int),
+]
+
+XReparentEvent = struct_anon_52 # /usr/include/X11/Xlib.h:777
+class struct_anon_53(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'border_width',
+ 'above',
+ 'override_redirect',
+ ]
+struct_anon_53._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('border_width', c_int),
+ ('above', Window),
+ ('override_redirect', c_int),
+]
+
+XConfigureEvent = struct_anon_53 # /usr/include/X11/Xlib.h:791
+class struct_anon_54(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ 'x',
+ 'y',
+ ]
+struct_anon_54._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+ ('x', c_int),
+ ('y', c_int),
+]
+
+XGravityEvent = struct_anon_54 # /usr/include/X11/Xlib.h:801
+class struct_anon_55(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'width',
+ 'height',
+ ]
+struct_anon_55._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('width', c_int),
+ ('height', c_int),
+]
+
+XResizeRequestEvent = struct_anon_55 # /usr/include/X11/Xlib.h:810
+class struct_anon_56(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'parent',
+ 'window',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'border_width',
+ 'above',
+ 'detail',
+ 'value_mask',
+ ]
+struct_anon_56._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('parent', Window),
+ ('window', Window),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('border_width', c_int),
+ ('above', Window),
+ ('detail', c_int),
+ ('value_mask', c_ulong),
+]
+
+XConfigureRequestEvent = struct_anon_56 # /usr/include/X11/Xlib.h:825
+class struct_anon_57(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'event',
+ 'window',
+ 'place',
+ ]
+struct_anon_57._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('event', Window),
+ ('window', Window),
+ ('place', c_int),
+]
+
+XCirculateEvent = struct_anon_57 # /usr/include/X11/Xlib.h:835
+class struct_anon_58(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'parent',
+ 'window',
+ 'place',
+ ]
+struct_anon_58._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('parent', Window),
+ ('window', Window),
+ ('place', c_int),
+]
+
+XCirculateRequestEvent = struct_anon_58 # /usr/include/X11/Xlib.h:845
+class struct_anon_59(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'atom',
+ 'time',
+ 'state',
+ ]
+struct_anon_59._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('atom', Atom),
+ ('time', Time),
+ ('state', c_int),
+]
+
+XPropertyEvent = struct_anon_59 # /usr/include/X11/Xlib.h:856
+class struct_anon_60(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'selection',
+ 'time',
+ ]
+struct_anon_60._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('selection', Atom),
+ ('time', Time),
+]
+
+XSelectionClearEvent = struct_anon_60 # /usr/include/X11/Xlib.h:866
+class struct_anon_61(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'owner',
+ 'requestor',
+ 'selection',
+ 'target',
+ 'property',
+ 'time',
+ ]
+struct_anon_61._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('owner', Window),
+ ('requestor', Window),
+ ('selection', Atom),
+ ('target', Atom),
+ ('property', Atom),
+ ('time', Time),
+]
+
+XSelectionRequestEvent = struct_anon_61 # /usr/include/X11/Xlib.h:879
+class struct_anon_62(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'requestor',
+ 'selection',
+ 'target',
+ 'property',
+ 'time',
+ ]
+struct_anon_62._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('requestor', Window),
+ ('selection', Atom),
+ ('target', Atom),
+ ('property', Atom),
+ ('time', Time),
+]
+
+XSelectionEvent = struct_anon_62 # /usr/include/X11/Xlib.h:891
+class struct_anon_63(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'colormap',
+ 'new',
+ 'state',
+ ]
+struct_anon_63._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('colormap', Colormap),
+ ('new', c_int),
+ ('state', c_int),
+]
+
+XColormapEvent = struct_anon_63 # /usr/include/X11/Xlib.h:906
+class struct_anon_64(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'message_type',
+ 'format',
+ 'data',
+ ]
+class struct_anon_65(Union):
+ __slots__ = [
+ 'b',
+ 's',
+ 'l',
+ ]
+struct_anon_65._fields_ = [
+ ('b', c_char * 20),
+ ('s', c_short * 10),
+ ('l', c_long * 5),
+]
+
+struct_anon_64._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('message_type', Atom),
+ ('format', c_int),
+ ('data', struct_anon_65),
+]
+
+XClientMessageEvent = struct_anon_64 # /usr/include/X11/Xlib.h:921
+class struct_anon_66(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ 'request',
+ 'first_keycode',
+ 'count',
+ ]
+struct_anon_66._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+ ('request', c_int),
+ ('first_keycode', c_int),
+ ('count', c_int),
+]
+
+XMappingEvent = struct_anon_66 # /usr/include/X11/Xlib.h:933
+class struct_anon_67(Structure):
+ __slots__ = [
+ 'type',
+ 'display',
+ 'resourceid',
+ 'serial',
+ 'error_code',
+ 'request_code',
+ 'minor_code',
+ ]
+struct_anon_67._fields_ = [
+ ('type', c_int),
+ ('display', POINTER(Display)),
+ ('resourceid', XID),
+ ('serial', c_ulong),
+ ('error_code', c_ubyte),
+ ('request_code', c_ubyte),
+ ('minor_code', c_ubyte),
+]
+
+XErrorEvent = struct_anon_67 # /usr/include/X11/Xlib.h:943
+class struct_anon_68(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'window',
+ ]
+struct_anon_68._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('window', Window),
+]
+
+XAnyEvent = struct_anon_68 # /usr/include/X11/Xlib.h:951
+class struct_anon_69(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'extension',
+ 'evtype',
+ ]
+struct_anon_69._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('extension', c_int),
+ ('evtype', c_int),
+]
+
+XGenericEvent = struct_anon_69 # /usr/include/X11/Xlib.h:967
+class struct_anon_70(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'extension',
+ 'evtype',
+ 'cookie',
+ 'data',
+ ]
+struct_anon_70._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', c_int),
+ ('display', POINTER(Display)),
+ ('extension', c_int),
+ ('evtype', c_int),
+ ('cookie', c_uint),
+ ('data', POINTER(None)),
+]
+
+XGenericEventCookie = struct_anon_70 # /usr/include/X11/Xlib.h:978
+class struct__XEvent(Union):
+ __slots__ = [
+ 'type',
+ 'xany',
+ 'xkey',
+ 'xbutton',
+ 'xmotion',
+ 'xcrossing',
+ 'xfocus',
+ 'xexpose',
+ 'xgraphicsexpose',
+ 'xnoexpose',
+ 'xvisibility',
+ 'xcreatewindow',
+ 'xdestroywindow',
+ 'xunmap',
+ 'xmap',
+ 'xmaprequest',
+ 'xreparent',
+ 'xconfigure',
+ 'xgravity',
+ 'xresizerequest',
+ 'xconfigurerequest',
+ 'xcirculate',
+ 'xcirculaterequest',
+ 'xproperty',
+ 'xselectionclear',
+ 'xselectionrequest',
+ 'xselection',
+ 'xcolormap',
+ 'xclient',
+ 'xmapping',
+ 'xerror',
+ 'xkeymap',
+ 'xgeneric',
+ 'xcookie',
+ 'pad',
+ ]
+struct__XEvent._fields_ = [
+ ('type', c_int),
+ ('xany', XAnyEvent),
+ ('xkey', XKeyEvent),
+ ('xbutton', XButtonEvent),
+ ('xmotion', XMotionEvent),
+ ('xcrossing', XCrossingEvent),
+ ('xfocus', XFocusChangeEvent),
+ ('xexpose', XExposeEvent),
+ ('xgraphicsexpose', XGraphicsExposeEvent),
+ ('xnoexpose', XNoExposeEvent),
+ ('xvisibility', XVisibilityEvent),
+ ('xcreatewindow', XCreateWindowEvent),
+ ('xdestroywindow', XDestroyWindowEvent),
+ ('xunmap', XUnmapEvent),
+ ('xmap', XMapEvent),
+ ('xmaprequest', XMapRequestEvent),
+ ('xreparent', XReparentEvent),
+ ('xconfigure', XConfigureEvent),
+ ('xgravity', XGravityEvent),
+ ('xresizerequest', XResizeRequestEvent),
+ ('xconfigurerequest', XConfigureRequestEvent),
+ ('xcirculate', XCirculateEvent),
+ ('xcirculaterequest', XCirculateRequestEvent),
+ ('xproperty', XPropertyEvent),
+ ('xselectionclear', XSelectionClearEvent),
+ ('xselectionrequest', XSelectionRequestEvent),
+ ('xselection', XSelectionEvent),
+ ('xcolormap', XColormapEvent),
+ ('xclient', XClientMessageEvent),
+ ('xmapping', XMappingEvent),
+ ('xerror', XErrorEvent),
+ ('xkeymap', XKeymapEvent),
+ ('xgeneric', XGenericEvent),
+ ('xcookie', XGenericEventCookie),
+ ('pad', c_long * 24),
+]
+
+XEvent = struct__XEvent # /usr/include/X11/Xlib.h:1020
+class struct_anon_71(Structure):
+ __slots__ = [
+ 'lbearing',
+ 'rbearing',
+ 'width',
+ 'ascent',
+ 'descent',
+ 'attributes',
+ ]
+struct_anon_71._fields_ = [
+ ('lbearing', c_short),
+ ('rbearing', c_short),
+ ('width', c_short),
+ ('ascent', c_short),
+ ('descent', c_short),
+ ('attributes', c_ushort),
+]
+
+XCharStruct = struct_anon_71 # /usr/include/X11/Xlib.h:1035
+class struct_anon_72(Structure):
+ __slots__ = [
+ 'name',
+ 'card32',
+ ]
+struct_anon_72._fields_ = [
+ ('name', Atom),
+ ('card32', c_ulong),
+]
+
+XFontProp = struct_anon_72 # /usr/include/X11/Xlib.h:1044
+class struct_anon_73(Structure):
+ __slots__ = [
+ 'ext_data',
+ 'fid',
+ 'direction',
+ 'min_char_or_byte2',
+ 'max_char_or_byte2',
+ 'min_byte1',
+ 'max_byte1',
+ 'all_chars_exist',
+ 'default_char',
+ 'n_properties',
+ 'properties',
+ 'min_bounds',
+ 'max_bounds',
+ 'per_char',
+ 'ascent',
+ 'descent',
+ ]
+struct_anon_73._fields_ = [
+ ('ext_data', POINTER(XExtData)),
+ ('fid', Font),
+ ('direction', c_uint),
+ ('min_char_or_byte2', c_uint),
+ ('max_char_or_byte2', c_uint),
+ ('min_byte1', c_uint),
+ ('max_byte1', c_uint),
+ ('all_chars_exist', c_int),
+ ('default_char', c_uint),
+ ('n_properties', c_int),
+ ('properties', POINTER(XFontProp)),
+ ('min_bounds', XCharStruct),
+ ('max_bounds', XCharStruct),
+ ('per_char', POINTER(XCharStruct)),
+ ('ascent', c_int),
+ ('descent', c_int),
+]
+
+XFontStruct = struct_anon_73 # /usr/include/X11/Xlib.h:1063
+class struct_anon_74(Structure):
+ __slots__ = [
+ 'chars',
+ 'nchars',
+ 'delta',
+ 'font',
+ ]
+struct_anon_74._fields_ = [
+ ('chars', c_char_p),
+ ('nchars', c_int),
+ ('delta', c_int),
+ ('font', Font),
+]
+
+XTextItem = struct_anon_74 # /usr/include/X11/Xlib.h:1073
+class struct_anon_75(Structure):
+ __slots__ = [
+ 'byte1',
+ 'byte2',
+ ]
+struct_anon_75._fields_ = [
+ ('byte1', c_ubyte),
+ ('byte2', c_ubyte),
+]
+
+XChar2b = struct_anon_75 # /usr/include/X11/Xlib.h:1078
+class struct_anon_76(Structure):
+ __slots__ = [
+ 'chars',
+ 'nchars',
+ 'delta',
+ 'font',
+ ]
+struct_anon_76._fields_ = [
+ ('chars', POINTER(XChar2b)),
+ ('nchars', c_int),
+ ('delta', c_int),
+ ('font', Font),
+]
+
+XTextItem16 = struct_anon_76 # /usr/include/X11/Xlib.h:1085
+class struct_anon_77(Union):
+ __slots__ = [
+ 'display',
+ 'gc',
+ 'visual',
+ 'screen',
+ 'pixmap_format',
+ 'font',
+ ]
+struct_anon_77._fields_ = [
+ ('display', POINTER(Display)),
+ ('gc', GC),
+ ('visual', POINTER(Visual)),
+ ('screen', POINTER(Screen)),
+ ('pixmap_format', POINTER(ScreenFormat)),
+ ('font', POINTER(XFontStruct)),
+]
+
+XEDataObject = struct_anon_77 # /usr/include/X11/Xlib.h:1093
+class struct_anon_78(Structure):
+ __slots__ = [
+ 'max_ink_extent',
+ 'max_logical_extent',
+ ]
+struct_anon_78._fields_ = [
+ ('max_ink_extent', XRectangle),
+ ('max_logical_extent', XRectangle),
+]
+
+XFontSetExtents = struct_anon_78 # /usr/include/X11/Xlib.h:1098
+class struct__XOM(Structure):
+ __slots__ = [
+ ]
+struct__XOM._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XOM(Structure):
+ __slots__ = [
+ ]
+struct__XOM._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XOM = POINTER(struct__XOM) # /usr/include/X11/Xlib.h:1104
+class struct__XOC(Structure):
+ __slots__ = [
+ ]
+struct__XOC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XOC(Structure):
+ __slots__ = [
+ ]
+struct__XOC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XOC = POINTER(struct__XOC) # /usr/include/X11/Xlib.h:1105
+class struct__XOC(Structure):
+ __slots__ = [
+ ]
+struct__XOC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XOC(Structure):
+ __slots__ = [
+ ]
+struct__XOC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XFontSet = POINTER(struct__XOC) # /usr/include/X11/Xlib.h:1105
+class struct_anon_79(Structure):
+ __slots__ = [
+ 'chars',
+ 'nchars',
+ 'delta',
+ 'font_set',
+ ]
+struct_anon_79._fields_ = [
+ ('chars', c_char_p),
+ ('nchars', c_int),
+ ('delta', c_int),
+ ('font_set', XFontSet),
+]
+
+XmbTextItem = struct_anon_79 # /usr/include/X11/Xlib.h:1112
+class struct_anon_80(Structure):
+ __slots__ = [
+ 'chars',
+ 'nchars',
+ 'delta',
+ 'font_set',
+ ]
+struct_anon_80._fields_ = [
+ ('chars', c_wchar_p),
+ ('nchars', c_int),
+ ('delta', c_int),
+ ('font_set', XFontSet),
+]
+
+XwcTextItem = struct_anon_80 # /usr/include/X11/Xlib.h:1119
+class struct_anon_81(Structure):
+ __slots__ = [
+ 'charset_count',
+ 'charset_list',
+ ]
+struct_anon_81._fields_ = [
+ ('charset_count', c_int),
+ ('charset_list', POINTER(c_char_p)),
+]
+
+XOMCharSetList = struct_anon_81 # /usr/include/X11/Xlib.h:1135
+enum_anon_82 = c_int
+XOMOrientation_LTR_TTB = 0
+XOMOrientation_RTL_TTB = 1
+XOMOrientation_TTB_LTR = 2
+XOMOrientation_TTB_RTL = 3
+XOMOrientation_Context = 4
+XOrientation = enum_anon_82 # /usr/include/X11/Xlib.h:1143
+class struct_anon_83(Structure):
+ __slots__ = [
+ 'num_orientation',
+ 'orientation',
+ ]
+struct_anon_83._fields_ = [
+ ('num_orientation', c_int),
+ ('orientation', POINTER(XOrientation)),
+]
+
+XOMOrientation = struct_anon_83 # /usr/include/X11/Xlib.h:1148
+class struct_anon_84(Structure):
+ __slots__ = [
+ 'num_font',
+ 'font_struct_list',
+ 'font_name_list',
+ ]
+struct_anon_84._fields_ = [
+ ('num_font', c_int),
+ ('font_struct_list', POINTER(POINTER(XFontStruct))),
+ ('font_name_list', POINTER(c_char_p)),
+]
+
+XOMFontInfo = struct_anon_84 # /usr/include/X11/Xlib.h:1154
+class struct__XIM(Structure):
+ __slots__ = [
+ ]
+struct__XIM._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XIM(Structure):
+ __slots__ = [
+ ]
+struct__XIM._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XIM = POINTER(struct__XIM) # /usr/include/X11/Xlib.h:1156
+class struct__XIC(Structure):
+ __slots__ = [
+ ]
+struct__XIC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XIC(Structure):
+ __slots__ = [
+ ]
+struct__XIC._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+XIC = POINTER(struct__XIC) # /usr/include/X11/Xlib.h:1157
+XIMProc = CFUNCTYPE(None, XIM, XPointer, XPointer) # /usr/include/X11/Xlib.h:1159
+XICProc = CFUNCTYPE(c_int, XIC, XPointer, XPointer) # /usr/include/X11/Xlib.h:1165
+XIDProc = CFUNCTYPE(None, POINTER(Display), XPointer, XPointer) # /usr/include/X11/Xlib.h:1171
+XIMStyle = c_ulong # /usr/include/X11/Xlib.h:1177
+class struct_anon_85(Structure):
+ __slots__ = [
+ 'count_styles',
+ 'supported_styles',
+ ]
+struct_anon_85._fields_ = [
+ ('count_styles', c_ushort),
+ ('supported_styles', POINTER(XIMStyle)),
+]
+
+XIMStyles = struct_anon_85 # /usr/include/X11/Xlib.h:1182
+XIMPreeditArea = 1 # /usr/include/X11/Xlib.h:1184
+XIMPreeditCallbacks = 2 # /usr/include/X11/Xlib.h:1185
+XIMPreeditPosition = 4 # /usr/include/X11/Xlib.h:1186
+XIMPreeditNothing = 8 # /usr/include/X11/Xlib.h:1187
+XIMPreeditNone = 16 # /usr/include/X11/Xlib.h:1188
+XIMStatusArea = 256 # /usr/include/X11/Xlib.h:1189
+XIMStatusCallbacks = 512 # /usr/include/X11/Xlib.h:1190
+XIMStatusNothing = 1024 # /usr/include/X11/Xlib.h:1191
+XIMStatusNone = 2048 # /usr/include/X11/Xlib.h:1192
+XBufferOverflow = -1 # /usr/include/X11/Xlib.h:1238
+XLookupNone = 1 # /usr/include/X11/Xlib.h:1239
+XLookupChars = 2 # /usr/include/X11/Xlib.h:1240
+XLookupKeySym = 3 # /usr/include/X11/Xlib.h:1241
+XLookupBoth = 4 # /usr/include/X11/Xlib.h:1242
+XVaNestedList = POINTER(None) # /usr/include/X11/Xlib.h:1244
+class struct_anon_86(Structure):
+ __slots__ = [
+ 'client_data',
+ 'callback',
+ ]
+struct_anon_86._fields_ = [
+ ('client_data', XPointer),
+ ('callback', XIMProc),
+]
+
+XIMCallback = struct_anon_86 # /usr/include/X11/Xlib.h:1249
+class struct_anon_87(Structure):
+ __slots__ = [
+ 'client_data',
+ 'callback',
+ ]
+struct_anon_87._fields_ = [
+ ('client_data', XPointer),
+ ('callback', XICProc),
+]
+
+XICCallback = struct_anon_87 # /usr/include/X11/Xlib.h:1254
+XIMFeedback = c_ulong # /usr/include/X11/Xlib.h:1256
+XIMReverse = 1 # /usr/include/X11/Xlib.h:1258
+XIMUnderline = 2 # /usr/include/X11/Xlib.h:1259
+XIMHighlight = 4 # /usr/include/X11/Xlib.h:1260
+XIMPrimary = 32 # /usr/include/X11/Xlib.h:1261
+XIMSecondary = 64 # /usr/include/X11/Xlib.h:1262
+XIMTertiary = 128 # /usr/include/X11/Xlib.h:1263
+XIMVisibleToForward = 256 # /usr/include/X11/Xlib.h:1264
+XIMVisibleToBackword = 512 # /usr/include/X11/Xlib.h:1265
+XIMVisibleToCenter = 1024 # /usr/include/X11/Xlib.h:1266
+class struct__XIMText(Structure):
+ __slots__ = [
+ 'length',
+ 'feedback',
+ 'encoding_is_wchar',
+ 'string',
+ ]
+class struct_anon_88(Union):
+ __slots__ = [
+ 'multi_byte',
+ 'wide_char',
+ ]
+struct_anon_88._fields_ = [
+ ('multi_byte', c_char_p),
+ ('wide_char', c_wchar_p),
+]
+
+struct__XIMText._fields_ = [
+ ('length', c_ushort),
+ ('feedback', POINTER(XIMFeedback)),
+ ('encoding_is_wchar', c_int),
+ ('string', struct_anon_88),
+]
+
+XIMText = struct__XIMText # /usr/include/X11/Xlib.h:1276
+XIMPreeditState = c_ulong # /usr/include/X11/Xlib.h:1278
+XIMPreeditUnKnown = 0 # /usr/include/X11/Xlib.h:1280
+XIMPreeditEnable = 1 # /usr/include/X11/Xlib.h:1281
+XIMPreeditDisable = 2 # /usr/include/X11/Xlib.h:1282
+class struct__XIMPreeditStateNotifyCallbackStruct(Structure):
+ __slots__ = [
+ 'state',
+ ]
+struct__XIMPreeditStateNotifyCallbackStruct._fields_ = [
+ ('state', XIMPreeditState),
+]
+
+XIMPreeditStateNotifyCallbackStruct = struct__XIMPreeditStateNotifyCallbackStruct # /usr/include/X11/Xlib.h:1286
+XIMResetState = c_ulong # /usr/include/X11/Xlib.h:1288
+XIMInitialState = 1 # /usr/include/X11/Xlib.h:1290
+XIMPreserveState = 2 # /usr/include/X11/Xlib.h:1291
+XIMStringConversionFeedback = c_ulong # /usr/include/X11/Xlib.h:1293
+XIMStringConversionLeftEdge = 1 # /usr/include/X11/Xlib.h:1295
+XIMStringConversionRightEdge = 2 # /usr/include/X11/Xlib.h:1296
+XIMStringConversionTopEdge = 4 # /usr/include/X11/Xlib.h:1297
+XIMStringConversionBottomEdge = 8 # /usr/include/X11/Xlib.h:1298
+XIMStringConversionConcealed = 16 # /usr/include/X11/Xlib.h:1299
+XIMStringConversionWrapped = 32 # /usr/include/X11/Xlib.h:1300
+class struct__XIMStringConversionText(Structure):
+ __slots__ = [
+ 'length',
+ 'feedback',
+ 'encoding_is_wchar',
+ 'string',
+ ]
+class struct_anon_89(Union):
+ __slots__ = [
+ 'mbs',
+ 'wcs',
+ ]
+struct_anon_89._fields_ = [
+ ('mbs', c_char_p),
+ ('wcs', c_wchar_p),
+]
+
+struct__XIMStringConversionText._fields_ = [
+ ('length', c_ushort),
+ ('feedback', POINTER(XIMStringConversionFeedback)),
+ ('encoding_is_wchar', c_int),
+ ('string', struct_anon_89),
+]
+
+XIMStringConversionText = struct__XIMStringConversionText # /usr/include/X11/Xlib.h:1310
+XIMStringConversionPosition = c_ushort # /usr/include/X11/Xlib.h:1312
+XIMStringConversionType = c_ushort # /usr/include/X11/Xlib.h:1314
+XIMStringConversionBuffer = 1 # /usr/include/X11/Xlib.h:1316
+XIMStringConversionLine = 2 # /usr/include/X11/Xlib.h:1317
+XIMStringConversionWord = 3 # /usr/include/X11/Xlib.h:1318
+XIMStringConversionChar = 4 # /usr/include/X11/Xlib.h:1319
+XIMStringConversionOperation = c_ushort # /usr/include/X11/Xlib.h:1321
+XIMStringConversionSubstitution = 1 # /usr/include/X11/Xlib.h:1323
+XIMStringConversionRetrieval = 2 # /usr/include/X11/Xlib.h:1324
+enum_anon_90 = c_int
+XIMForwardChar = 0
+XIMBackwardChar = 1
+XIMForwardWord = 2
+XIMBackwardWord = 3
+XIMCaretUp = 4
+XIMCaretDown = 5
+XIMNextLine = 6
+XIMPreviousLine = 7
+XIMLineStart = 8
+XIMLineEnd = 9
+XIMAbsolutePosition = 10
+XIMDontChange = 11
+XIMCaretDirection = enum_anon_90 # /usr/include/X11/Xlib.h:1334
+class struct__XIMStringConversionCallbackStruct(Structure):
+ __slots__ = [
+ 'position',
+ 'direction',
+ 'operation',
+ 'factor',
+ 'text',
+ ]
+struct__XIMStringConversionCallbackStruct._fields_ = [
+ ('position', XIMStringConversionPosition),
+ ('direction', XIMCaretDirection),
+ ('operation', XIMStringConversionOperation),
+ ('factor', c_ushort),
+ ('text', POINTER(XIMStringConversionText)),
+]
+
+XIMStringConversionCallbackStruct = struct__XIMStringConversionCallbackStruct # /usr/include/X11/Xlib.h:1342
+class struct__XIMPreeditDrawCallbackStruct(Structure):
+ __slots__ = [
+ 'caret',
+ 'chg_first',
+ 'chg_length',
+ 'text',
+ ]
+struct__XIMPreeditDrawCallbackStruct._fields_ = [
+ ('caret', c_int),
+ ('chg_first', c_int),
+ ('chg_length', c_int),
+ ('text', POINTER(XIMText)),
+]
+
+XIMPreeditDrawCallbackStruct = struct__XIMPreeditDrawCallbackStruct # /usr/include/X11/Xlib.h:1349
+enum_anon_91 = c_int
+XIMIsInvisible = 0
+XIMIsPrimary = 1
+XIMIsSecondary = 2
+XIMCaretStyle = enum_anon_91 # /usr/include/X11/Xlib.h:1355
+class struct__XIMPreeditCaretCallbackStruct(Structure):
+ __slots__ = [
+ 'position',
+ 'direction',
+ 'style',
+ ]
+struct__XIMPreeditCaretCallbackStruct._fields_ = [
+ ('position', c_int),
+ ('direction', XIMCaretDirection),
+ ('style', XIMCaretStyle),
+]
+
+XIMPreeditCaretCallbackStruct = struct__XIMPreeditCaretCallbackStruct # /usr/include/X11/Xlib.h:1361
+enum_anon_92 = c_int
+XIMTextType = 0
+XIMBitmapType = 1
+XIMStatusDataType = enum_anon_92 # /usr/include/X11/Xlib.h:1366
+class struct__XIMStatusDrawCallbackStruct(Structure):
+ __slots__ = [
+ 'type',
+ 'data',
+ ]
+class struct_anon_93(Union):
+ __slots__ = [
+ 'text',
+ 'bitmap',
+ ]
+struct_anon_93._fields_ = [
+ ('text', POINTER(XIMText)),
+ ('bitmap', Pixmap),
+]
+
+struct__XIMStatusDrawCallbackStruct._fields_ = [
+ ('type', XIMStatusDataType),
+ ('data', struct_anon_93),
+]
+
+XIMStatusDrawCallbackStruct = struct__XIMStatusDrawCallbackStruct # /usr/include/X11/Xlib.h:1374
+class struct__XIMHotKeyTrigger(Structure):
+ __slots__ = [
+ 'keysym',
+ 'modifier',
+ 'modifier_mask',
+ ]
+struct__XIMHotKeyTrigger._fields_ = [
+ ('keysym', KeySym),
+ ('modifier', c_int),
+ ('modifier_mask', c_int),
+]
+
+XIMHotKeyTrigger = struct__XIMHotKeyTrigger # /usr/include/X11/Xlib.h:1380
+class struct__XIMHotKeyTriggers(Structure):
+ __slots__ = [
+ 'num_hot_key',
+ 'key',
+ ]
+struct__XIMHotKeyTriggers._fields_ = [
+ ('num_hot_key', c_int),
+ ('key', POINTER(XIMHotKeyTrigger)),
+]
+
+XIMHotKeyTriggers = struct__XIMHotKeyTriggers # /usr/include/X11/Xlib.h:1385
+XIMHotKeyState = c_ulong # /usr/include/X11/Xlib.h:1387
+XIMHotKeyStateON = 1 # /usr/include/X11/Xlib.h:1389
+XIMHotKeyStateOFF = 2 # /usr/include/X11/Xlib.h:1390
+class struct_anon_94(Structure):
+ __slots__ = [
+ 'count_values',
+ 'supported_values',
+ ]
+struct_anon_94._fields_ = [
+ ('count_values', c_ushort),
+ ('supported_values', POINTER(c_char_p)),
+]
+
+XIMValuesList = struct_anon_94 # /usr/include/X11/Xlib.h:1395
+# /usr/include/X11/Xlib.h:1405
+XLoadQueryFont = _lib.XLoadQueryFont
+XLoadQueryFont.restype = POINTER(XFontStruct)
+XLoadQueryFont.argtypes = [POINTER(Display), c_char_p]
+
+# /usr/include/X11/Xlib.h:1410
+XQueryFont = _lib.XQueryFont
+XQueryFont.restype = POINTER(XFontStruct)
+XQueryFont.argtypes = [POINTER(Display), XID]
+
+# /usr/include/X11/Xlib.h:1416
+XGetMotionEvents = _lib.XGetMotionEvents
+XGetMotionEvents.restype = POINTER(XTimeCoord)
+XGetMotionEvents.argtypes = [POINTER(Display), Window, Time, Time, POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1424
+XDeleteModifiermapEntry = _lib.XDeleteModifiermapEntry
+XDeleteModifiermapEntry.restype = POINTER(XModifierKeymap)
+XDeleteModifiermapEntry.argtypes = [POINTER(XModifierKeymap), KeyCode, c_int]
+
+# /usr/include/X11/Xlib.h:1434
+XGetModifierMapping = _lib.XGetModifierMapping
+XGetModifierMapping.restype = POINTER(XModifierKeymap)
+XGetModifierMapping.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1438
+XInsertModifiermapEntry = _lib.XInsertModifiermapEntry
+XInsertModifiermapEntry.restype = POINTER(XModifierKeymap)
+XInsertModifiermapEntry.argtypes = [POINTER(XModifierKeymap), KeyCode, c_int]
+
+# /usr/include/X11/Xlib.h:1448
+XNewModifiermap = _lib.XNewModifiermap
+XNewModifiermap.restype = POINTER(XModifierKeymap)
+XNewModifiermap.argtypes = [c_int]
+
+# /usr/include/X11/Xlib.h:1452
+XCreateImage = _lib.XCreateImage
+XCreateImage.restype = POINTER(XImage)
+XCreateImage.argtypes = [POINTER(Display), POINTER(Visual), c_uint, c_int, c_int, c_char_p, c_uint, c_uint, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:1464
+XInitImage = _lib.XInitImage
+XInitImage.restype = c_int
+XInitImage.argtypes = [POINTER(XImage)]
+
+# /usr/include/X11/Xlib.h:1467
+XGetImage = _lib.XGetImage
+XGetImage.restype = POINTER(XImage)
+XGetImage.argtypes = [POINTER(Display), Drawable, c_int, c_int, c_uint, c_uint, c_ulong, c_int]
+
+# /usr/include/X11/Xlib.h:1477
+XGetSubImage = _lib.XGetSubImage
+XGetSubImage.restype = POINTER(XImage)
+XGetSubImage.argtypes = [POINTER(Display), Drawable, c_int, c_int, c_uint, c_uint, c_ulong, c_int, POINTER(XImage), c_int, c_int]
+
+# /usr/include/X11/Xlib.h:1494
+XOpenDisplay = _lib.XOpenDisplay
+XOpenDisplay.restype = POINTER(Display)
+XOpenDisplay.argtypes = [c_char_p]
+
+# /usr/include/X11/Xlib.h:1498
+XrmInitialize = _lib.XrmInitialize
+XrmInitialize.restype = None
+XrmInitialize.argtypes = []
+
+# /usr/include/X11/Xlib.h:1502
+XFetchBytes = _lib.XFetchBytes
+XFetchBytes.restype = c_char_p
+XFetchBytes.argtypes = [POINTER(Display), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1506
+XFetchBuffer = _lib.XFetchBuffer
+XFetchBuffer.restype = c_char_p
+XFetchBuffer.argtypes = [POINTER(Display), POINTER(c_int), c_int]
+
+# /usr/include/X11/Xlib.h:1511
+XGetAtomName = _lib.XGetAtomName
+XGetAtomName.restype = c_char_p
+XGetAtomName.argtypes = [POINTER(Display), Atom]
+
+# /usr/include/X11/Xlib.h:1515
+XGetAtomNames = _lib.XGetAtomNames
+XGetAtomNames.restype = c_int
+XGetAtomNames.argtypes = [POINTER(Display), POINTER(Atom), c_int, POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:1521
+XGetDefault = _lib.XGetDefault
+XGetDefault.restype = c_char_p
+XGetDefault.argtypes = [POINTER(Display), c_char_p, c_char_p]
+
+# /usr/include/X11/Xlib.h:1526
+XDisplayName = _lib.XDisplayName
+XDisplayName.restype = c_char_p
+XDisplayName.argtypes = [c_char_p]
+
+# /usr/include/X11/Xlib.h:1529
+XKeysymToString = _lib.XKeysymToString
+XKeysymToString.restype = c_char_p
+XKeysymToString.argtypes = [KeySym]
+
+# /usr/include/X11/Xlib.h:1533
+XSynchronize = _lib.XSynchronize
+XSynchronize.restype = POINTER(CFUNCTYPE(c_int, POINTER(Display)))
+XSynchronize.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1539
+XSetAfterFunction = _lib.XSetAfterFunction
+XSetAfterFunction.restype = POINTER(CFUNCTYPE(c_int, POINTER(Display)))
+XSetAfterFunction.argtypes = [POINTER(Display), CFUNCTYPE(c_int, POINTER(Display))]
+
+# /usr/include/X11/Xlib.h:1547
+XInternAtom = _lib.XInternAtom
+XInternAtom.restype = Atom
+XInternAtom.argtypes = [POINTER(Display), c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:1552
+XInternAtoms = _lib.XInternAtoms
+XInternAtoms.restype = c_int
+XInternAtoms.argtypes = [POINTER(Display), POINTER(c_char_p), c_int, c_int, POINTER(Atom)]
+
+# /usr/include/X11/Xlib.h:1559
+XCopyColormapAndFree = _lib.XCopyColormapAndFree
+XCopyColormapAndFree.restype = Colormap
+XCopyColormapAndFree.argtypes = [POINTER(Display), Colormap]
+
+# /usr/include/X11/Xlib.h:1563
+XCreateColormap = _lib.XCreateColormap
+XCreateColormap.restype = Colormap
+XCreateColormap.argtypes = [POINTER(Display), Window, POINTER(Visual), c_int]
+
+# /usr/include/X11/Xlib.h:1569
+XCreatePixmapCursor = _lib.XCreatePixmapCursor
+XCreatePixmapCursor.restype = Cursor
+XCreatePixmapCursor.argtypes = [POINTER(Display), Pixmap, Pixmap, POINTER(XColor), POINTER(XColor), c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:1578
+XCreateGlyphCursor = _lib.XCreateGlyphCursor
+XCreateGlyphCursor.restype = Cursor
+XCreateGlyphCursor.argtypes = [POINTER(Display), Font, Font, c_uint, c_uint, POINTER(XColor), POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:1587
+XCreateFontCursor = _lib.XCreateFontCursor
+XCreateFontCursor.restype = Cursor
+XCreateFontCursor.argtypes = [POINTER(Display), c_uint]
+
+# /usr/include/X11/Xlib.h:1591
+XLoadFont = _lib.XLoadFont
+XLoadFont.restype = Font
+XLoadFont.argtypes = [POINTER(Display), c_char_p]
+
+# /usr/include/X11/Xlib.h:1595
+XCreateGC = _lib.XCreateGC
+XCreateGC.restype = GC
+XCreateGC.argtypes = [POINTER(Display), Drawable, c_ulong, POINTER(XGCValues)]
+
+# /usr/include/X11/Xlib.h:1601
+XGContextFromGC = _lib.XGContextFromGC
+XGContextFromGC.restype = GContext
+XGContextFromGC.argtypes = [GC]
+
+# /usr/include/X11/Xlib.h:1604
+XFlushGC = _lib.XFlushGC
+XFlushGC.restype = None
+XFlushGC.argtypes = [POINTER(Display), GC]
+
+# /usr/include/X11/Xlib.h:1608
+XCreatePixmap = _lib.XCreatePixmap
+XCreatePixmap.restype = Pixmap
+XCreatePixmap.argtypes = [POINTER(Display), Drawable, c_uint, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:1615
+XCreateBitmapFromData = _lib.XCreateBitmapFromData
+XCreateBitmapFromData.restype = Pixmap
+XCreateBitmapFromData.argtypes = [POINTER(Display), Drawable, c_char_p, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:1622
+XCreatePixmapFromBitmapData = _lib.XCreatePixmapFromBitmapData
+XCreatePixmapFromBitmapData.restype = Pixmap
+XCreatePixmapFromBitmapData.argtypes = [POINTER(Display), Drawable, c_char_p, c_uint, c_uint, c_ulong, c_ulong, c_uint]
+
+# /usr/include/X11/Xlib.h:1632
+XCreateSimpleWindow = _lib.XCreateSimpleWindow
+XCreateSimpleWindow.restype = Window
+XCreateSimpleWindow.argtypes = [POINTER(Display), Window, c_int, c_int, c_uint, c_uint, c_uint, c_ulong, c_ulong]
+
+# /usr/include/X11/Xlib.h:1643
+XGetSelectionOwner = _lib.XGetSelectionOwner
+XGetSelectionOwner.restype = Window
+XGetSelectionOwner.argtypes = [POINTER(Display), Atom]
+
+# /usr/include/X11/Xlib.h:1647
+XCreateWindow = _lib.XCreateWindow
+XCreateWindow.restype = Window
+XCreateWindow.argtypes = [POINTER(Display), Window, c_int, c_int, c_uint, c_uint, c_uint, c_int, c_uint, POINTER(Visual), c_ulong, POINTER(XSetWindowAttributes)]
+
+# /usr/include/X11/Xlib.h:1661
+XListInstalledColormaps = _lib.XListInstalledColormaps
+XListInstalledColormaps.restype = POINTER(Colormap)
+XListInstalledColormaps.argtypes = [POINTER(Display), Window, POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1666
+XListFonts = _lib.XListFonts
+XListFonts.restype = POINTER(c_char_p)
+XListFonts.argtypes = [POINTER(Display), c_char_p, c_int, POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1672
+XListFontsWithInfo = _lib.XListFontsWithInfo
+XListFontsWithInfo.restype = POINTER(c_char_p)
+XListFontsWithInfo.argtypes = [POINTER(Display), c_char_p, c_int, POINTER(c_int), POINTER(POINTER(XFontStruct))]
+
+# /usr/include/X11/Xlib.h:1679
+XGetFontPath = _lib.XGetFontPath
+XGetFontPath.restype = POINTER(c_char_p)
+XGetFontPath.argtypes = [POINTER(Display), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1683
+XListExtensions = _lib.XListExtensions
+XListExtensions.restype = POINTER(c_char_p)
+XListExtensions.argtypes = [POINTER(Display), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1687
+XListProperties = _lib.XListProperties
+XListProperties.restype = POINTER(Atom)
+XListProperties.argtypes = [POINTER(Display), Window, POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1692
+XListHosts = _lib.XListHosts
+XListHosts.restype = POINTER(XHostAddress)
+XListHosts.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1697
+XKeycodeToKeysym = _lib.XKeycodeToKeysym
+XKeycodeToKeysym.restype = KeySym
+XKeycodeToKeysym.argtypes = [POINTER(Display), KeyCode, c_int]
+
+# /usr/include/X11/Xlib.h:1706
+XLookupKeysym = _lib.XLookupKeysym
+XLookupKeysym.restype = KeySym
+XLookupKeysym.argtypes = [POINTER(XKeyEvent), c_int]
+
+# /usr/include/X11/Xlib.h:1710
+XGetKeyboardMapping = _lib.XGetKeyboardMapping
+XGetKeyboardMapping.restype = POINTER(KeySym)
+XGetKeyboardMapping.argtypes = [POINTER(Display), KeyCode, c_int, POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1720
+XStringToKeysym = _lib.XStringToKeysym
+XStringToKeysym.restype = KeySym
+XStringToKeysym.argtypes = [c_char_p]
+
+# /usr/include/X11/Xlib.h:1723
+XMaxRequestSize = _lib.XMaxRequestSize
+XMaxRequestSize.restype = c_long
+XMaxRequestSize.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1726
+XExtendedMaxRequestSize = _lib.XExtendedMaxRequestSize
+XExtendedMaxRequestSize.restype = c_long
+XExtendedMaxRequestSize.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1729
+XResourceManagerString = _lib.XResourceManagerString
+XResourceManagerString.restype = c_char_p
+XResourceManagerString.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1732
+XScreenResourceString = _lib.XScreenResourceString
+XScreenResourceString.restype = c_char_p
+XScreenResourceString.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1735
+XDisplayMotionBufferSize = _lib.XDisplayMotionBufferSize
+XDisplayMotionBufferSize.restype = c_ulong
+XDisplayMotionBufferSize.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1738
+XVisualIDFromVisual = _lib.XVisualIDFromVisual
+XVisualIDFromVisual.restype = VisualID
+XVisualIDFromVisual.argtypes = [POINTER(Visual)]
+
+# /usr/include/X11/Xlib.h:1744
+XInitThreads = _lib.XInitThreads
+XInitThreads.restype = c_int
+XInitThreads.argtypes = []
+
+# /usr/include/X11/Xlib.h:1748
+XLockDisplay = _lib.XLockDisplay
+XLockDisplay.restype = None
+XLockDisplay.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1752
+XUnlockDisplay = _lib.XUnlockDisplay
+XUnlockDisplay.restype = None
+XUnlockDisplay.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1758
+XInitExtension = _lib.XInitExtension
+XInitExtension.restype = POINTER(XExtCodes)
+XInitExtension.argtypes = [POINTER(Display), c_char_p]
+
+# /usr/include/X11/Xlib.h:1763
+XAddExtension = _lib.XAddExtension
+XAddExtension.restype = POINTER(XExtCodes)
+XAddExtension.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1766
+XFindOnExtensionList = _lib.XFindOnExtensionList
+XFindOnExtensionList.restype = POINTER(XExtData)
+XFindOnExtensionList.argtypes = [POINTER(POINTER(XExtData)), c_int]
+
+# /usr/include/X11/Xlib.h:1770
+XEHeadOfExtensionList = _lib.XEHeadOfExtensionList
+XEHeadOfExtensionList.restype = POINTER(POINTER(XExtData))
+XEHeadOfExtensionList.argtypes = [POINTER(XEDataObject)]
+
+# /usr/include/X11/Xlib.h:1775
+XRootWindow = _lib.XRootWindow
+XRootWindow.restype = Window
+XRootWindow.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1779
+XDefaultRootWindow = _lib.XDefaultRootWindow
+XDefaultRootWindow.restype = Window
+XDefaultRootWindow.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1782
+XRootWindowOfScreen = _lib.XRootWindowOfScreen
+XRootWindowOfScreen.restype = Window
+XRootWindowOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1785
+XDefaultVisual = _lib.XDefaultVisual
+XDefaultVisual.restype = POINTER(Visual)
+XDefaultVisual.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1789
+XDefaultVisualOfScreen = _lib.XDefaultVisualOfScreen
+XDefaultVisualOfScreen.restype = POINTER(Visual)
+XDefaultVisualOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1792
+XDefaultGC = _lib.XDefaultGC
+XDefaultGC.restype = GC
+XDefaultGC.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1796
+XDefaultGCOfScreen = _lib.XDefaultGCOfScreen
+XDefaultGCOfScreen.restype = GC
+XDefaultGCOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1799
+XBlackPixel = _lib.XBlackPixel
+XBlackPixel.restype = c_ulong
+XBlackPixel.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1803
+XWhitePixel = _lib.XWhitePixel
+XWhitePixel.restype = c_ulong
+XWhitePixel.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1807
+XAllPlanes = _lib.XAllPlanes
+XAllPlanes.restype = c_ulong
+XAllPlanes.argtypes = []
+
+# /usr/include/X11/Xlib.h:1810
+XBlackPixelOfScreen = _lib.XBlackPixelOfScreen
+XBlackPixelOfScreen.restype = c_ulong
+XBlackPixelOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1813
+XWhitePixelOfScreen = _lib.XWhitePixelOfScreen
+XWhitePixelOfScreen.restype = c_ulong
+XWhitePixelOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1816
+XNextRequest = _lib.XNextRequest
+XNextRequest.restype = c_ulong
+XNextRequest.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1819
+XLastKnownRequestProcessed = _lib.XLastKnownRequestProcessed
+XLastKnownRequestProcessed.restype = c_ulong
+XLastKnownRequestProcessed.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1822
+XServerVendor = _lib.XServerVendor
+XServerVendor.restype = c_char_p
+XServerVendor.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1825
+XDisplayString = _lib.XDisplayString
+XDisplayString.restype = c_char_p
+XDisplayString.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1828
+XDefaultColormap = _lib.XDefaultColormap
+XDefaultColormap.restype = Colormap
+XDefaultColormap.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1832
+XDefaultColormapOfScreen = _lib.XDefaultColormapOfScreen
+XDefaultColormapOfScreen.restype = Colormap
+XDefaultColormapOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1835
+XDisplayOfScreen = _lib.XDisplayOfScreen
+XDisplayOfScreen.restype = POINTER(Display)
+XDisplayOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1838
+XScreenOfDisplay = _lib.XScreenOfDisplay
+XScreenOfDisplay.restype = POINTER(Screen)
+XScreenOfDisplay.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:1842
+XDefaultScreenOfDisplay = _lib.XDefaultScreenOfDisplay
+XDefaultScreenOfDisplay.restype = POINTER(Screen)
+XDefaultScreenOfDisplay.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1845
+XEventMaskOfScreen = _lib.XEventMaskOfScreen
+XEventMaskOfScreen.restype = c_long
+XEventMaskOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:1849
+XScreenNumberOfScreen = _lib.XScreenNumberOfScreen
+XScreenNumberOfScreen.restype = c_int
+XScreenNumberOfScreen.argtypes = [POINTER(Screen)]
+
+XErrorHandler = CFUNCTYPE(c_int, POINTER(Display), POINTER(XErrorEvent)) # /usr/include/X11/Xlib.h:1853
+# /usr/include/X11/Xlib.h:1858
+XSetErrorHandler = _lib.XSetErrorHandler
+XSetErrorHandler.restype = XErrorHandler
+XSetErrorHandler.argtypes = [XErrorHandler]
+
+XIOErrorHandler = CFUNCTYPE(c_int, POINTER(Display)) # /usr/include/X11/Xlib.h:1863
+# /usr/include/X11/Xlib.h:1867
+XSetIOErrorHandler = _lib.XSetIOErrorHandler
+XSetIOErrorHandler.restype = XIOErrorHandler
+XSetIOErrorHandler.argtypes = [XIOErrorHandler]
+
+# /usr/include/X11/Xlib.h:1872
+XListPixmapFormats = _lib.XListPixmapFormats
+XListPixmapFormats.restype = POINTER(XPixmapFormatValues)
+XListPixmapFormats.argtypes = [POINTER(Display), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1876
+XListDepths = _lib.XListDepths
+XListDepths.restype = POINTER(c_int)
+XListDepths.argtypes = [POINTER(Display), c_int, POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1884
+XReconfigureWMWindow = _lib.XReconfigureWMWindow
+XReconfigureWMWindow.restype = c_int
+XReconfigureWMWindow.argtypes = [POINTER(Display), Window, c_int, c_uint, POINTER(XWindowChanges)]
+
+# /usr/include/X11/Xlib.h:1892
+XGetWMProtocols = _lib.XGetWMProtocols
+XGetWMProtocols.restype = c_int
+XGetWMProtocols.argtypes = [POINTER(Display), Window, POINTER(POINTER(Atom)), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1898
+XSetWMProtocols = _lib.XSetWMProtocols
+XSetWMProtocols.restype = c_int
+XSetWMProtocols.argtypes = [POINTER(Display), Window, POINTER(Atom), c_int]
+
+# /usr/include/X11/Xlib.h:1904
+XIconifyWindow = _lib.XIconifyWindow
+XIconifyWindow.restype = c_int
+XIconifyWindow.argtypes = [POINTER(Display), Window, c_int]
+
+# /usr/include/X11/Xlib.h:1909
+XWithdrawWindow = _lib.XWithdrawWindow
+XWithdrawWindow.restype = c_int
+XWithdrawWindow.argtypes = [POINTER(Display), Window, c_int]
+
+# /usr/include/X11/Xlib.h:1914
+XGetCommand = _lib.XGetCommand
+XGetCommand.restype = c_int
+XGetCommand.argtypes = [POINTER(Display), Window, POINTER(POINTER(c_char_p)), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1920
+XGetWMColormapWindows = _lib.XGetWMColormapWindows
+XGetWMColormapWindows.restype = c_int
+XGetWMColormapWindows.argtypes = [POINTER(Display), Window, POINTER(POINTER(Window)), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:1926
+XSetWMColormapWindows = _lib.XSetWMColormapWindows
+XSetWMColormapWindows.restype = c_int
+XSetWMColormapWindows.argtypes = [POINTER(Display), Window, POINTER(Window), c_int]
+
+# /usr/include/X11/Xlib.h:1932
+XFreeStringList = _lib.XFreeStringList
+XFreeStringList.restype = None
+XFreeStringList.argtypes = [POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:1935
+XSetTransientForHint = _lib.XSetTransientForHint
+XSetTransientForHint.restype = c_int
+XSetTransientForHint.argtypes = [POINTER(Display), Window, Window]
+
+# /usr/include/X11/Xlib.h:1943
+XActivateScreenSaver = _lib.XActivateScreenSaver
+XActivateScreenSaver.restype = c_int
+XActivateScreenSaver.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:1947
+XAddHost = _lib.XAddHost
+XAddHost.restype = c_int
+XAddHost.argtypes = [POINTER(Display), POINTER(XHostAddress)]
+
+# /usr/include/X11/Xlib.h:1952
+XAddHosts = _lib.XAddHosts
+XAddHosts.restype = c_int
+XAddHosts.argtypes = [POINTER(Display), POINTER(XHostAddress), c_int]
+
+# /usr/include/X11/Xlib.h:1958
+XAddToExtensionList = _lib.XAddToExtensionList
+XAddToExtensionList.restype = c_int
+XAddToExtensionList.argtypes = [POINTER(POINTER(struct__XExtData)), POINTER(XExtData)]
+
+# /usr/include/X11/Xlib.h:1963
+XAddToSaveSet = _lib.XAddToSaveSet
+XAddToSaveSet.restype = c_int
+XAddToSaveSet.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:1968
+XAllocColor = _lib.XAllocColor
+XAllocColor.restype = c_int
+XAllocColor.argtypes = [POINTER(Display), Colormap, POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:1974
+XAllocColorCells = _lib.XAllocColorCells
+XAllocColorCells.restype = c_int
+XAllocColorCells.argtypes = [POINTER(Display), Colormap, c_int, POINTER(c_ulong), c_uint, POINTER(c_ulong), c_uint]
+
+# /usr/include/X11/Xlib.h:1984
+XAllocColorPlanes = _lib.XAllocColorPlanes
+XAllocColorPlanes.restype = c_int
+XAllocColorPlanes.argtypes = [POINTER(Display), Colormap, c_int, POINTER(c_ulong), c_int, c_int, c_int, c_int, POINTER(c_ulong), POINTER(c_ulong), POINTER(c_ulong)]
+
+# /usr/include/X11/Xlib.h:1998
+XAllocNamedColor = _lib.XAllocNamedColor
+XAllocNamedColor.restype = c_int
+XAllocNamedColor.argtypes = [POINTER(Display), Colormap, c_char_p, POINTER(XColor), POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:2006
+XAllowEvents = _lib.XAllowEvents
+XAllowEvents.restype = c_int
+XAllowEvents.argtypes = [POINTER(Display), c_int, Time]
+
+# /usr/include/X11/Xlib.h:2012
+XAutoRepeatOff = _lib.XAutoRepeatOff
+XAutoRepeatOff.restype = c_int
+XAutoRepeatOff.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2016
+XAutoRepeatOn = _lib.XAutoRepeatOn
+XAutoRepeatOn.restype = c_int
+XAutoRepeatOn.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2020
+XBell = _lib.XBell
+XBell.restype = c_int
+XBell.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2025
+XBitmapBitOrder = _lib.XBitmapBitOrder
+XBitmapBitOrder.restype = c_int
+XBitmapBitOrder.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2029
+XBitmapPad = _lib.XBitmapPad
+XBitmapPad.restype = c_int
+XBitmapPad.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2033
+XBitmapUnit = _lib.XBitmapUnit
+XBitmapUnit.restype = c_int
+XBitmapUnit.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2037
+XCellsOfScreen = _lib.XCellsOfScreen
+XCellsOfScreen.restype = c_int
+XCellsOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2041
+XChangeActivePointerGrab = _lib.XChangeActivePointerGrab
+XChangeActivePointerGrab.restype = c_int
+XChangeActivePointerGrab.argtypes = [POINTER(Display), c_uint, Cursor, Time]
+
+# /usr/include/X11/Xlib.h:2048
+XChangeGC = _lib.XChangeGC
+XChangeGC.restype = c_int
+XChangeGC.argtypes = [POINTER(Display), GC, c_ulong, POINTER(XGCValues)]
+
+# /usr/include/X11/Xlib.h:2055
+XChangeKeyboardControl = _lib.XChangeKeyboardControl
+XChangeKeyboardControl.restype = c_int
+XChangeKeyboardControl.argtypes = [POINTER(Display), c_ulong, POINTER(XKeyboardControl)]
+
+# /usr/include/X11/Xlib.h:2061
+XChangeKeyboardMapping = _lib.XChangeKeyboardMapping
+XChangeKeyboardMapping.restype = c_int
+XChangeKeyboardMapping.argtypes = [POINTER(Display), c_int, c_int, POINTER(KeySym), c_int]
+
+# /usr/include/X11/Xlib.h:2069
+XChangePointerControl = _lib.XChangePointerControl
+XChangePointerControl.restype = c_int
+XChangePointerControl.argtypes = [POINTER(Display), c_int, c_int, c_int, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2078
+XChangeProperty = _lib.XChangeProperty
+XChangeProperty.restype = c_int
+XChangeProperty.argtypes = [POINTER(Display), Window, Atom, Atom, c_int, c_int, POINTER(c_ubyte), c_int]
+
+# /usr/include/X11/Xlib.h:2089
+XChangeSaveSet = _lib.XChangeSaveSet
+XChangeSaveSet.restype = c_int
+XChangeSaveSet.argtypes = [POINTER(Display), Window, c_int]
+
+# /usr/include/X11/Xlib.h:2095
+XChangeWindowAttributes = _lib.XChangeWindowAttributes
+XChangeWindowAttributes.restype = c_int
+XChangeWindowAttributes.argtypes = [POINTER(Display), Window, c_ulong, POINTER(XSetWindowAttributes)]
+
+# /usr/include/X11/Xlib.h:2102
+XCheckIfEvent = _lib.XCheckIfEvent
+XCheckIfEvent.restype = c_int
+XCheckIfEvent.argtypes = [POINTER(Display), POINTER(XEvent), CFUNCTYPE(c_int, POINTER(Display), POINTER(XEvent), XPointer), XPointer]
+
+# /usr/include/X11/Xlib.h:2113
+XCheckMaskEvent = _lib.XCheckMaskEvent
+XCheckMaskEvent.restype = c_int
+XCheckMaskEvent.argtypes = [POINTER(Display), c_long, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2119
+XCheckTypedEvent = _lib.XCheckTypedEvent
+XCheckTypedEvent.restype = c_int
+XCheckTypedEvent.argtypes = [POINTER(Display), c_int, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2125
+XCheckTypedWindowEvent = _lib.XCheckTypedWindowEvent
+XCheckTypedWindowEvent.restype = c_int
+XCheckTypedWindowEvent.argtypes = [POINTER(Display), Window, c_int, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2132
+XCheckWindowEvent = _lib.XCheckWindowEvent
+XCheckWindowEvent.restype = c_int
+XCheckWindowEvent.argtypes = [POINTER(Display), Window, c_long, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2139
+XCirculateSubwindows = _lib.XCirculateSubwindows
+XCirculateSubwindows.restype = c_int
+XCirculateSubwindows.argtypes = [POINTER(Display), Window, c_int]
+
+# /usr/include/X11/Xlib.h:2145
+XCirculateSubwindowsDown = _lib.XCirculateSubwindowsDown
+XCirculateSubwindowsDown.restype = c_int
+XCirculateSubwindowsDown.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2150
+XCirculateSubwindowsUp = _lib.XCirculateSubwindowsUp
+XCirculateSubwindowsUp.restype = c_int
+XCirculateSubwindowsUp.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2155
+XClearArea = _lib.XClearArea
+XClearArea.restype = c_int
+XClearArea.argtypes = [POINTER(Display), Window, c_int, c_int, c_uint, c_uint, c_int]
+
+# /usr/include/X11/Xlib.h:2165
+XClearWindow = _lib.XClearWindow
+XClearWindow.restype = c_int
+XClearWindow.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2170
+XCloseDisplay = _lib.XCloseDisplay
+XCloseDisplay.restype = c_int
+XCloseDisplay.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2174
+XConfigureWindow = _lib.XConfigureWindow
+XConfigureWindow.restype = c_int
+XConfigureWindow.argtypes = [POINTER(Display), Window, c_uint, POINTER(XWindowChanges)]
+
+# /usr/include/X11/Xlib.h:2181
+XConnectionNumber = _lib.XConnectionNumber
+XConnectionNumber.restype = c_int
+XConnectionNumber.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2185
+XConvertSelection = _lib.XConvertSelection
+XConvertSelection.restype = c_int
+XConvertSelection.argtypes = [POINTER(Display), Atom, Atom, Atom, Window, Time]
+
+# /usr/include/X11/Xlib.h:2194
+XCopyArea = _lib.XCopyArea
+XCopyArea.restype = c_int
+XCopyArea.argtypes = [POINTER(Display), Drawable, Drawable, GC, c_int, c_int, c_uint, c_uint, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2207
+XCopyGC = _lib.XCopyGC
+XCopyGC.restype = c_int
+XCopyGC.argtypes = [POINTER(Display), GC, c_ulong, GC]
+
+# /usr/include/X11/Xlib.h:2214
+XCopyPlane = _lib.XCopyPlane
+XCopyPlane.restype = c_int
+XCopyPlane.argtypes = [POINTER(Display), Drawable, Drawable, GC, c_int, c_int, c_uint, c_uint, c_int, c_int, c_ulong]
+
+# /usr/include/X11/Xlib.h:2228
+XDefaultDepth = _lib.XDefaultDepth
+XDefaultDepth.restype = c_int
+XDefaultDepth.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2233
+XDefaultDepthOfScreen = _lib.XDefaultDepthOfScreen
+XDefaultDepthOfScreen.restype = c_int
+XDefaultDepthOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2237
+XDefaultScreen = _lib.XDefaultScreen
+XDefaultScreen.restype = c_int
+XDefaultScreen.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2241
+XDefineCursor = _lib.XDefineCursor
+XDefineCursor.restype = c_int
+XDefineCursor.argtypes = [POINTER(Display), Window, Cursor]
+
+# /usr/include/X11/Xlib.h:2247
+XDeleteProperty = _lib.XDeleteProperty
+XDeleteProperty.restype = c_int
+XDeleteProperty.argtypes = [POINTER(Display), Window, Atom]
+
+# /usr/include/X11/Xlib.h:2253
+XDestroyWindow = _lib.XDestroyWindow
+XDestroyWindow.restype = c_int
+XDestroyWindow.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2258
+XDestroySubwindows = _lib.XDestroySubwindows
+XDestroySubwindows.restype = c_int
+XDestroySubwindows.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2263
+XDoesBackingStore = _lib.XDoesBackingStore
+XDoesBackingStore.restype = c_int
+XDoesBackingStore.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2267
+XDoesSaveUnders = _lib.XDoesSaveUnders
+XDoesSaveUnders.restype = c_int
+XDoesSaveUnders.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2271
+XDisableAccessControl = _lib.XDisableAccessControl
+XDisableAccessControl.restype = c_int
+XDisableAccessControl.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2276
+XDisplayCells = _lib.XDisplayCells
+XDisplayCells.restype = c_int
+XDisplayCells.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2281
+XDisplayHeight = _lib.XDisplayHeight
+XDisplayHeight.restype = c_int
+XDisplayHeight.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2286
+XDisplayHeightMM = _lib.XDisplayHeightMM
+XDisplayHeightMM.restype = c_int
+XDisplayHeightMM.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2291
+XDisplayKeycodes = _lib.XDisplayKeycodes
+XDisplayKeycodes.restype = c_int
+XDisplayKeycodes.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:2297
+XDisplayPlanes = _lib.XDisplayPlanes
+XDisplayPlanes.restype = c_int
+XDisplayPlanes.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2302
+XDisplayWidth = _lib.XDisplayWidth
+XDisplayWidth.restype = c_int
+XDisplayWidth.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2307
+XDisplayWidthMM = _lib.XDisplayWidthMM
+XDisplayWidthMM.restype = c_int
+XDisplayWidthMM.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2312
+XDrawArc = _lib.XDrawArc
+XDrawArc.restype = c_int
+XDrawArc.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_uint, c_uint, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2324
+XDrawArcs = _lib.XDrawArcs
+XDrawArcs.restype = c_int
+XDrawArcs.argtypes = [POINTER(Display), Drawable, GC, POINTER(XArc), c_int]
+
+# /usr/include/X11/Xlib.h:2332
+XDrawImageString = _lib.XDrawImageString
+XDrawImageString.restype = c_int
+XDrawImageString.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:2342
+XDrawImageString16 = _lib.XDrawImageString16
+XDrawImageString16.restype = c_int
+XDrawImageString16.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XChar2b), c_int]
+
+# /usr/include/X11/Xlib.h:2352
+XDrawLine = _lib.XDrawLine
+XDrawLine.restype = c_int
+XDrawLine.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2362
+XDrawLines = _lib.XDrawLines
+XDrawLines.restype = c_int
+XDrawLines.argtypes = [POINTER(Display), Drawable, GC, POINTER(XPoint), c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2371
+XDrawPoint = _lib.XDrawPoint
+XDrawPoint.restype = c_int
+XDrawPoint.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2379
+XDrawPoints = _lib.XDrawPoints
+XDrawPoints.restype = c_int
+XDrawPoints.argtypes = [POINTER(Display), Drawable, GC, POINTER(XPoint), c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2388
+XDrawRectangle = _lib.XDrawRectangle
+XDrawRectangle.restype = c_int
+XDrawRectangle.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:2398
+XDrawRectangles = _lib.XDrawRectangles
+XDrawRectangles.restype = c_int
+XDrawRectangles.argtypes = [POINTER(Display), Drawable, GC, POINTER(XRectangle), c_int]
+
+# /usr/include/X11/Xlib.h:2406
+XDrawSegments = _lib.XDrawSegments
+XDrawSegments.restype = c_int
+XDrawSegments.argtypes = [POINTER(Display), Drawable, GC, POINTER(XSegment), c_int]
+
+# /usr/include/X11/Xlib.h:2414
+XDrawString = _lib.XDrawString
+XDrawString.restype = c_int
+XDrawString.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:2424
+XDrawString16 = _lib.XDrawString16
+XDrawString16.restype = c_int
+XDrawString16.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XChar2b), c_int]
+
+# /usr/include/X11/Xlib.h:2434
+XDrawText = _lib.XDrawText
+XDrawText.restype = c_int
+XDrawText.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XTextItem), c_int]
+
+# /usr/include/X11/Xlib.h:2444
+XDrawText16 = _lib.XDrawText16
+XDrawText16.restype = c_int
+XDrawText16.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XTextItem16), c_int]
+
+# /usr/include/X11/Xlib.h:2454
+XEnableAccessControl = _lib.XEnableAccessControl
+XEnableAccessControl.restype = c_int
+XEnableAccessControl.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2458
+XEventsQueued = _lib.XEventsQueued
+XEventsQueued.restype = c_int
+XEventsQueued.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2463
+XFetchName = _lib.XFetchName
+XFetchName.restype = c_int
+XFetchName.argtypes = [POINTER(Display), Window, POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:2469
+XFillArc = _lib.XFillArc
+XFillArc.restype = c_int
+XFillArc.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_uint, c_uint, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2481
+XFillArcs = _lib.XFillArcs
+XFillArcs.restype = c_int
+XFillArcs.argtypes = [POINTER(Display), Drawable, GC, POINTER(XArc), c_int]
+
+# /usr/include/X11/Xlib.h:2489
+XFillPolygon = _lib.XFillPolygon
+XFillPolygon.restype = c_int
+XFillPolygon.argtypes = [POINTER(Display), Drawable, GC, POINTER(XPoint), c_int, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2499
+XFillRectangle = _lib.XFillRectangle
+XFillRectangle.restype = c_int
+XFillRectangle.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:2509
+XFillRectangles = _lib.XFillRectangles
+XFillRectangles.restype = c_int
+XFillRectangles.argtypes = [POINTER(Display), Drawable, GC, POINTER(XRectangle), c_int]
+
+# /usr/include/X11/Xlib.h:2517
+XFlush = _lib.XFlush
+XFlush.restype = c_int
+XFlush.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2521
+XForceScreenSaver = _lib.XForceScreenSaver
+XForceScreenSaver.restype = c_int
+XForceScreenSaver.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:2526
+XFree = _lib.XFree
+XFree.restype = c_int
+XFree.argtypes = [POINTER(None)]
+
+# /usr/include/X11/Xlib.h:2530
+XFreeColormap = _lib.XFreeColormap
+XFreeColormap.restype = c_int
+XFreeColormap.argtypes = [POINTER(Display), Colormap]
+
+# /usr/include/X11/Xlib.h:2535
+XFreeColors = _lib.XFreeColors
+XFreeColors.restype = c_int
+XFreeColors.argtypes = [POINTER(Display), Colormap, POINTER(c_ulong), c_int, c_ulong]
+
+# /usr/include/X11/Xlib.h:2543
+XFreeCursor = _lib.XFreeCursor
+XFreeCursor.restype = c_int
+XFreeCursor.argtypes = [POINTER(Display), Cursor]
+
+# /usr/include/X11/Xlib.h:2548
+XFreeExtensionList = _lib.XFreeExtensionList
+XFreeExtensionList.restype = c_int
+XFreeExtensionList.argtypes = [POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:2552
+XFreeFont = _lib.XFreeFont
+XFreeFont.restype = c_int
+XFreeFont.argtypes = [POINTER(Display), POINTER(XFontStruct)]
+
+# /usr/include/X11/Xlib.h:2557
+XFreeFontInfo = _lib.XFreeFontInfo
+XFreeFontInfo.restype = c_int
+XFreeFontInfo.argtypes = [POINTER(c_char_p), POINTER(XFontStruct), c_int]
+
+# /usr/include/X11/Xlib.h:2563
+XFreeFontNames = _lib.XFreeFontNames
+XFreeFontNames.restype = c_int
+XFreeFontNames.argtypes = [POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:2567
+XFreeFontPath = _lib.XFreeFontPath
+XFreeFontPath.restype = c_int
+XFreeFontPath.argtypes = [POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:2571
+XFreeGC = _lib.XFreeGC
+XFreeGC.restype = c_int
+XFreeGC.argtypes = [POINTER(Display), GC]
+
+# /usr/include/X11/Xlib.h:2576
+XFreeModifiermap = _lib.XFreeModifiermap
+XFreeModifiermap.restype = c_int
+XFreeModifiermap.argtypes = [POINTER(XModifierKeymap)]
+
+# /usr/include/X11/Xlib.h:2580
+XFreePixmap = _lib.XFreePixmap
+XFreePixmap.restype = c_int
+XFreePixmap.argtypes = [POINTER(Display), Pixmap]
+
+# /usr/include/X11/Xlib.h:2585
+XGeometry = _lib.XGeometry
+XGeometry.restype = c_int
+XGeometry.argtypes = [POINTER(Display), c_int, c_char_p, c_char_p, c_uint, c_uint, c_uint, c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:2601
+XGetErrorDatabaseText = _lib.XGetErrorDatabaseText
+XGetErrorDatabaseText.restype = c_int
+XGetErrorDatabaseText.argtypes = [POINTER(Display), c_char_p, c_char_p, c_char_p, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:2610
+XGetErrorText = _lib.XGetErrorText
+XGetErrorText.restype = c_int
+XGetErrorText.argtypes = [POINTER(Display), c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:2617
+XGetFontProperty = _lib.XGetFontProperty
+XGetFontProperty.restype = c_int
+XGetFontProperty.argtypes = [POINTER(XFontStruct), Atom, POINTER(c_ulong)]
+
+# /usr/include/X11/Xlib.h:2623
+XGetGCValues = _lib.XGetGCValues
+XGetGCValues.restype = c_int
+XGetGCValues.argtypes = [POINTER(Display), GC, c_ulong, POINTER(XGCValues)]
+
+# /usr/include/X11/Xlib.h:2630
+XGetGeometry = _lib.XGetGeometry
+XGetGeometry.restype = c_int
+XGetGeometry.argtypes = [POINTER(Display), Drawable, POINTER(Window), POINTER(c_int), POINTER(c_int), POINTER(c_uint), POINTER(c_uint), POINTER(c_uint), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:2642
+XGetIconName = _lib.XGetIconName
+XGetIconName.restype = c_int
+XGetIconName.argtypes = [POINTER(Display), Window, POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:2648
+XGetInputFocus = _lib.XGetInputFocus
+XGetInputFocus.restype = c_int
+XGetInputFocus.argtypes = [POINTER(Display), POINTER(Window), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:2654
+XGetKeyboardControl = _lib.XGetKeyboardControl
+XGetKeyboardControl.restype = c_int
+XGetKeyboardControl.argtypes = [POINTER(Display), POINTER(XKeyboardState)]
+
+# /usr/include/X11/Xlib.h:2659
+XGetPointerControl = _lib.XGetPointerControl
+XGetPointerControl.restype = c_int
+XGetPointerControl.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:2666
+XGetPointerMapping = _lib.XGetPointerMapping
+XGetPointerMapping.restype = c_int
+XGetPointerMapping.argtypes = [POINTER(Display), POINTER(c_ubyte), c_int]
+
+# /usr/include/X11/Xlib.h:2672
+XGetScreenSaver = _lib.XGetScreenSaver
+XGetScreenSaver.restype = c_int
+XGetScreenSaver.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:2680
+XGetTransientForHint = _lib.XGetTransientForHint
+XGetTransientForHint.restype = c_int
+XGetTransientForHint.argtypes = [POINTER(Display), Window, POINTER(Window)]
+
+# /usr/include/X11/Xlib.h:2686
+XGetWindowProperty = _lib.XGetWindowProperty
+XGetWindowProperty.restype = c_int
+XGetWindowProperty.argtypes = [POINTER(Display), Window, Atom, c_long, c_long, c_int, Atom, POINTER(Atom), POINTER(c_int), POINTER(c_ulong), POINTER(c_ulong), POINTER(POINTER(c_ubyte))]
+
+# /usr/include/X11/Xlib.h:2701
+XGetWindowAttributes = _lib.XGetWindowAttributes
+XGetWindowAttributes.restype = c_int
+XGetWindowAttributes.argtypes = [POINTER(Display), Window, POINTER(XWindowAttributes)]
+
+# /usr/include/X11/Xlib.h:2707
+XGrabButton = _lib.XGrabButton
+XGrabButton.restype = c_int
+XGrabButton.argtypes = [POINTER(Display), c_uint, c_uint, Window, c_int, c_uint, c_int, c_int, Window, Cursor]
+
+# /usr/include/X11/Xlib.h:2720
+XGrabKey = _lib.XGrabKey
+XGrabKey.restype = c_int
+XGrabKey.argtypes = [POINTER(Display), c_int, c_uint, Window, c_int, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2730
+XGrabKeyboard = _lib.XGrabKeyboard
+XGrabKeyboard.restype = c_int
+XGrabKeyboard.argtypes = [POINTER(Display), Window, c_int, c_int, c_int, Time]
+
+# /usr/include/X11/Xlib.h:2739
+XGrabPointer = _lib.XGrabPointer
+XGrabPointer.restype = c_int
+XGrabPointer.argtypes = [POINTER(Display), Window, c_int, c_uint, c_int, c_int, Window, Cursor, Time]
+
+# /usr/include/X11/Xlib.h:2751
+XGrabServer = _lib.XGrabServer
+XGrabServer.restype = c_int
+XGrabServer.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2755
+XHeightMMOfScreen = _lib.XHeightMMOfScreen
+XHeightMMOfScreen.restype = c_int
+XHeightMMOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2759
+XHeightOfScreen = _lib.XHeightOfScreen
+XHeightOfScreen.restype = c_int
+XHeightOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2763
+XIfEvent = _lib.XIfEvent
+XIfEvent.restype = c_int
+XIfEvent.argtypes = [POINTER(Display), POINTER(XEvent), CFUNCTYPE(c_int, POINTER(Display), POINTER(XEvent), XPointer), XPointer]
+
+# /usr/include/X11/Xlib.h:2774
+XImageByteOrder = _lib.XImageByteOrder
+XImageByteOrder.restype = c_int
+XImageByteOrder.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2778
+XInstallColormap = _lib.XInstallColormap
+XInstallColormap.restype = c_int
+XInstallColormap.argtypes = [POINTER(Display), Colormap]
+
+# /usr/include/X11/Xlib.h:2783
+XKeysymToKeycode = _lib.XKeysymToKeycode
+XKeysymToKeycode.restype = KeyCode
+XKeysymToKeycode.argtypes = [POINTER(Display), KeySym]
+
+# /usr/include/X11/Xlib.h:2788
+XKillClient = _lib.XKillClient
+XKillClient.restype = c_int
+XKillClient.argtypes = [POINTER(Display), XID]
+
+# /usr/include/X11/Xlib.h:2793
+XLookupColor = _lib.XLookupColor
+XLookupColor.restype = c_int
+XLookupColor.argtypes = [POINTER(Display), Colormap, c_char_p, POINTER(XColor), POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:2801
+XLowerWindow = _lib.XLowerWindow
+XLowerWindow.restype = c_int
+XLowerWindow.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2806
+XMapRaised = _lib.XMapRaised
+XMapRaised.restype = c_int
+XMapRaised.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2811
+XMapSubwindows = _lib.XMapSubwindows
+XMapSubwindows.restype = c_int
+XMapSubwindows.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2816
+XMapWindow = _lib.XMapWindow
+XMapWindow.restype = c_int
+XMapWindow.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:2821
+XMaskEvent = _lib.XMaskEvent
+XMaskEvent.restype = c_int
+XMaskEvent.argtypes = [POINTER(Display), c_long, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2827
+XMaxCmapsOfScreen = _lib.XMaxCmapsOfScreen
+XMaxCmapsOfScreen.restype = c_int
+XMaxCmapsOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2831
+XMinCmapsOfScreen = _lib.XMinCmapsOfScreen
+XMinCmapsOfScreen.restype = c_int
+XMinCmapsOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2835
+XMoveResizeWindow = _lib.XMoveResizeWindow
+XMoveResizeWindow.restype = c_int
+XMoveResizeWindow.argtypes = [POINTER(Display), Window, c_int, c_int, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:2844
+XMoveWindow = _lib.XMoveWindow
+XMoveWindow.restype = c_int
+XMoveWindow.argtypes = [POINTER(Display), Window, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:2851
+XNextEvent = _lib.XNextEvent
+XNextEvent.restype = c_int
+XNextEvent.argtypes = [POINTER(Display), POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2856
+XNoOp = _lib.XNoOp
+XNoOp.restype = c_int
+XNoOp.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2860
+XParseColor = _lib.XParseColor
+XParseColor.restype = c_int
+XParseColor.argtypes = [POINTER(Display), Colormap, c_char_p, POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:2867
+XParseGeometry = _lib.XParseGeometry
+XParseGeometry.restype = c_int
+XParseGeometry.argtypes = [c_char_p, POINTER(c_int), POINTER(c_int), POINTER(c_uint), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:2875
+XPeekEvent = _lib.XPeekEvent
+XPeekEvent.restype = c_int
+XPeekEvent.argtypes = [POINTER(Display), POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2880
+XPeekIfEvent = _lib.XPeekIfEvent
+XPeekIfEvent.restype = c_int
+XPeekIfEvent.argtypes = [POINTER(Display), POINTER(XEvent), CFUNCTYPE(c_int, POINTER(Display), POINTER(XEvent), XPointer), XPointer]
+
+# /usr/include/X11/Xlib.h:2891
+XPending = _lib.XPending
+XPending.restype = c_int
+XPending.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2895
+XPlanesOfScreen = _lib.XPlanesOfScreen
+XPlanesOfScreen.restype = c_int
+XPlanesOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:2899
+XProtocolRevision = _lib.XProtocolRevision
+XProtocolRevision.restype = c_int
+XProtocolRevision.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2903
+XProtocolVersion = _lib.XProtocolVersion
+XProtocolVersion.restype = c_int
+XProtocolVersion.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2908
+XPutBackEvent = _lib.XPutBackEvent
+XPutBackEvent.restype = c_int
+XPutBackEvent.argtypes = [POINTER(Display), POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:2913
+XPutImage = _lib.XPutImage
+XPutImage.restype = c_int
+XPutImage.argtypes = [POINTER(Display), Drawable, GC, POINTER(XImage), c_int, c_int, c_int, c_int, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:2926
+XQLength = _lib.XQLength
+XQLength.restype = c_int
+XQLength.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:2930
+XQueryBestCursor = _lib.XQueryBestCursor
+XQueryBestCursor.restype = c_int
+XQueryBestCursor.argtypes = [POINTER(Display), Drawable, c_uint, c_uint, POINTER(c_uint), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:2939
+XQueryBestSize = _lib.XQueryBestSize
+XQueryBestSize.restype = c_int
+XQueryBestSize.argtypes = [POINTER(Display), c_int, Drawable, c_uint, c_uint, POINTER(c_uint), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:2949
+XQueryBestStipple = _lib.XQueryBestStipple
+XQueryBestStipple.restype = c_int
+XQueryBestStipple.argtypes = [POINTER(Display), Drawable, c_uint, c_uint, POINTER(c_uint), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:2958
+XQueryBestTile = _lib.XQueryBestTile
+XQueryBestTile.restype = c_int
+XQueryBestTile.argtypes = [POINTER(Display), Drawable, c_uint, c_uint, POINTER(c_uint), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:2967
+XQueryColor = _lib.XQueryColor
+XQueryColor.restype = c_int
+XQueryColor.argtypes = [POINTER(Display), Colormap, POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:2973
+XQueryColors = _lib.XQueryColors
+XQueryColors.restype = c_int
+XQueryColors.argtypes = [POINTER(Display), Colormap, POINTER(XColor), c_int]
+
+# /usr/include/X11/Xlib.h:2980
+XQueryExtension = _lib.XQueryExtension
+XQueryExtension.restype = c_int
+XQueryExtension.argtypes = [POINTER(Display), c_char_p, POINTER(c_int), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:2988
+XQueryKeymap = _lib.XQueryKeymap
+XQueryKeymap.restype = c_int
+XQueryKeymap.argtypes = [POINTER(Display), c_char * 32]
+
+# /usr/include/X11/Xlib.h:2993
+XQueryPointer = _lib.XQueryPointer
+XQueryPointer.restype = c_int
+XQueryPointer.argtypes = [POINTER(Display), Window, POINTER(Window), POINTER(Window), POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:3005
+XQueryTextExtents = _lib.XQueryTextExtents
+XQueryTextExtents.restype = c_int
+XQueryTextExtents.argtypes = [POINTER(Display), XID, c_char_p, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(XCharStruct)]
+
+# /usr/include/X11/Xlib.h:3016
+XQueryTextExtents16 = _lib.XQueryTextExtents16
+XQueryTextExtents16.restype = c_int
+XQueryTextExtents16.argtypes = [POINTER(Display), XID, POINTER(XChar2b), c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(XCharStruct)]
+
+# /usr/include/X11/Xlib.h:3027
+XQueryTree = _lib.XQueryTree
+XQueryTree.restype = c_int
+XQueryTree.argtypes = [POINTER(Display), Window, POINTER(Window), POINTER(Window), POINTER(POINTER(Window)), POINTER(c_uint)]
+
+# /usr/include/X11/Xlib.h:3036
+XRaiseWindow = _lib.XRaiseWindow
+XRaiseWindow.restype = c_int
+XRaiseWindow.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:3041
+XReadBitmapFile = _lib.XReadBitmapFile
+XReadBitmapFile.restype = c_int
+XReadBitmapFile.argtypes = [POINTER(Display), Drawable, c_char_p, POINTER(c_uint), POINTER(c_uint), POINTER(Pixmap), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:3052
+XReadBitmapFileData = _lib.XReadBitmapFileData
+XReadBitmapFileData.restype = c_int
+XReadBitmapFileData.argtypes = [c_char_p, POINTER(c_uint), POINTER(c_uint), POINTER(POINTER(c_ubyte)), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:3061
+XRebindKeysym = _lib.XRebindKeysym
+XRebindKeysym.restype = c_int
+XRebindKeysym.argtypes = [POINTER(Display), KeySym, POINTER(KeySym), c_int, POINTER(c_ubyte), c_int]
+
+# /usr/include/X11/Xlib.h:3070
+XRecolorCursor = _lib.XRecolorCursor
+XRecolorCursor.restype = c_int
+XRecolorCursor.argtypes = [POINTER(Display), Cursor, POINTER(XColor), POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:3077
+XRefreshKeyboardMapping = _lib.XRefreshKeyboardMapping
+XRefreshKeyboardMapping.restype = c_int
+XRefreshKeyboardMapping.argtypes = [POINTER(XMappingEvent)]
+
+# /usr/include/X11/Xlib.h:3081
+XRemoveFromSaveSet = _lib.XRemoveFromSaveSet
+XRemoveFromSaveSet.restype = c_int
+XRemoveFromSaveSet.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:3086
+XRemoveHost = _lib.XRemoveHost
+XRemoveHost.restype = c_int
+XRemoveHost.argtypes = [POINTER(Display), POINTER(XHostAddress)]
+
+# /usr/include/X11/Xlib.h:3091
+XRemoveHosts = _lib.XRemoveHosts
+XRemoveHosts.restype = c_int
+XRemoveHosts.argtypes = [POINTER(Display), POINTER(XHostAddress), c_int]
+
+# /usr/include/X11/Xlib.h:3097
+XReparentWindow = _lib.XReparentWindow
+XReparentWindow.restype = c_int
+XReparentWindow.argtypes = [POINTER(Display), Window, Window, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3105
+XResetScreenSaver = _lib.XResetScreenSaver
+XResetScreenSaver.restype = c_int
+XResetScreenSaver.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:3109
+XResizeWindow = _lib.XResizeWindow
+XResizeWindow.restype = c_int
+XResizeWindow.argtypes = [POINTER(Display), Window, c_uint, c_uint]
+
+# /usr/include/X11/Xlib.h:3116
+XRestackWindows = _lib.XRestackWindows
+XRestackWindows.restype = c_int
+XRestackWindows.argtypes = [POINTER(Display), POINTER(Window), c_int]
+
+# /usr/include/X11/Xlib.h:3122
+XRotateBuffers = _lib.XRotateBuffers
+XRotateBuffers.restype = c_int
+XRotateBuffers.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:3127
+XRotateWindowProperties = _lib.XRotateWindowProperties
+XRotateWindowProperties.restype = c_int
+XRotateWindowProperties.argtypes = [POINTER(Display), Window, POINTER(Atom), c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3135
+XScreenCount = _lib.XScreenCount
+XScreenCount.restype = c_int
+XScreenCount.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:3139
+XSelectInput = _lib.XSelectInput
+XSelectInput.restype = c_int
+XSelectInput.argtypes = [POINTER(Display), Window, c_long]
+
+# /usr/include/X11/Xlib.h:3145
+XSendEvent = _lib.XSendEvent
+XSendEvent.restype = c_int
+XSendEvent.argtypes = [POINTER(Display), Window, c_int, c_long, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:3153
+XSetAccessControl = _lib.XSetAccessControl
+XSetAccessControl.restype = c_int
+XSetAccessControl.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:3158
+XSetArcMode = _lib.XSetArcMode
+XSetArcMode.restype = c_int
+XSetArcMode.argtypes = [POINTER(Display), GC, c_int]
+
+# /usr/include/X11/Xlib.h:3164
+XSetBackground = _lib.XSetBackground
+XSetBackground.restype = c_int
+XSetBackground.argtypes = [POINTER(Display), GC, c_ulong]
+
+# /usr/include/X11/Xlib.h:3170
+XSetClipMask = _lib.XSetClipMask
+XSetClipMask.restype = c_int
+XSetClipMask.argtypes = [POINTER(Display), GC, Pixmap]
+
+# /usr/include/X11/Xlib.h:3176
+XSetClipOrigin = _lib.XSetClipOrigin
+XSetClipOrigin.restype = c_int
+XSetClipOrigin.argtypes = [POINTER(Display), GC, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3183
+XSetClipRectangles = _lib.XSetClipRectangles
+XSetClipRectangles.restype = c_int
+XSetClipRectangles.argtypes = [POINTER(Display), GC, c_int, c_int, POINTER(XRectangle), c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3193
+XSetCloseDownMode = _lib.XSetCloseDownMode
+XSetCloseDownMode.restype = c_int
+XSetCloseDownMode.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:3198
+XSetCommand = _lib.XSetCommand
+XSetCommand.restype = c_int
+XSetCommand.argtypes = [POINTER(Display), Window, POINTER(c_char_p), c_int]
+
+# /usr/include/X11/Xlib.h:3205
+XSetDashes = _lib.XSetDashes
+XSetDashes.restype = c_int
+XSetDashes.argtypes = [POINTER(Display), GC, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3213
+XSetFillRule = _lib.XSetFillRule
+XSetFillRule.restype = c_int
+XSetFillRule.argtypes = [POINTER(Display), GC, c_int]
+
+# /usr/include/X11/Xlib.h:3219
+XSetFillStyle = _lib.XSetFillStyle
+XSetFillStyle.restype = c_int
+XSetFillStyle.argtypes = [POINTER(Display), GC, c_int]
+
+# /usr/include/X11/Xlib.h:3225
+XSetFont = _lib.XSetFont
+XSetFont.restype = c_int
+XSetFont.argtypes = [POINTER(Display), GC, Font]
+
+# /usr/include/X11/Xlib.h:3231
+XSetFontPath = _lib.XSetFontPath
+XSetFontPath.restype = c_int
+XSetFontPath.argtypes = [POINTER(Display), POINTER(c_char_p), c_int]
+
+# /usr/include/X11/Xlib.h:3237
+XSetForeground = _lib.XSetForeground
+XSetForeground.restype = c_int
+XSetForeground.argtypes = [POINTER(Display), GC, c_ulong]
+
+# /usr/include/X11/Xlib.h:3243
+XSetFunction = _lib.XSetFunction
+XSetFunction.restype = c_int
+XSetFunction.argtypes = [POINTER(Display), GC, c_int]
+
+# /usr/include/X11/Xlib.h:3249
+XSetGraphicsExposures = _lib.XSetGraphicsExposures
+XSetGraphicsExposures.restype = c_int
+XSetGraphicsExposures.argtypes = [POINTER(Display), GC, c_int]
+
+# /usr/include/X11/Xlib.h:3255
+XSetIconName = _lib.XSetIconName
+XSetIconName.restype = c_int
+XSetIconName.argtypes = [POINTER(Display), Window, c_char_p]
+
+# /usr/include/X11/Xlib.h:3261
+XSetInputFocus = _lib.XSetInputFocus
+XSetInputFocus.restype = c_int
+XSetInputFocus.argtypes = [POINTER(Display), Window, c_int, Time]
+
+# /usr/include/X11/Xlib.h:3268
+XSetLineAttributes = _lib.XSetLineAttributes
+XSetLineAttributes.restype = c_int
+XSetLineAttributes.argtypes = [POINTER(Display), GC, c_uint, c_int, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3277
+XSetModifierMapping = _lib.XSetModifierMapping
+XSetModifierMapping.restype = c_int
+XSetModifierMapping.argtypes = [POINTER(Display), POINTER(XModifierKeymap)]
+
+# /usr/include/X11/Xlib.h:3282
+XSetPlaneMask = _lib.XSetPlaneMask
+XSetPlaneMask.restype = c_int
+XSetPlaneMask.argtypes = [POINTER(Display), GC, c_ulong]
+
+# /usr/include/X11/Xlib.h:3288
+XSetPointerMapping = _lib.XSetPointerMapping
+XSetPointerMapping.restype = c_int
+XSetPointerMapping.argtypes = [POINTER(Display), POINTER(c_ubyte), c_int]
+
+# /usr/include/X11/Xlib.h:3294
+XSetScreenSaver = _lib.XSetScreenSaver
+XSetScreenSaver.restype = c_int
+XSetScreenSaver.argtypes = [POINTER(Display), c_int, c_int, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3302
+XSetSelectionOwner = _lib.XSetSelectionOwner
+XSetSelectionOwner.restype = c_int
+XSetSelectionOwner.argtypes = [POINTER(Display), Atom, Window, Time]
+
+# /usr/include/X11/Xlib.h:3309
+XSetState = _lib.XSetState
+XSetState.restype = c_int
+XSetState.argtypes = [POINTER(Display), GC, c_ulong, c_ulong, c_int, c_ulong]
+
+# /usr/include/X11/Xlib.h:3318
+XSetStipple = _lib.XSetStipple
+XSetStipple.restype = c_int
+XSetStipple.argtypes = [POINTER(Display), GC, Pixmap]
+
+# /usr/include/X11/Xlib.h:3324
+XSetSubwindowMode = _lib.XSetSubwindowMode
+XSetSubwindowMode.restype = c_int
+XSetSubwindowMode.argtypes = [POINTER(Display), GC, c_int]
+
+# /usr/include/X11/Xlib.h:3330
+XSetTSOrigin = _lib.XSetTSOrigin
+XSetTSOrigin.restype = c_int
+XSetTSOrigin.argtypes = [POINTER(Display), GC, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3337
+XSetTile = _lib.XSetTile
+XSetTile.restype = c_int
+XSetTile.argtypes = [POINTER(Display), GC, Pixmap]
+
+# /usr/include/X11/Xlib.h:3343
+XSetWindowBackground = _lib.XSetWindowBackground
+XSetWindowBackground.restype = c_int
+XSetWindowBackground.argtypes = [POINTER(Display), Window, c_ulong]
+
+# /usr/include/X11/Xlib.h:3349
+XSetWindowBackgroundPixmap = _lib.XSetWindowBackgroundPixmap
+XSetWindowBackgroundPixmap.restype = c_int
+XSetWindowBackgroundPixmap.argtypes = [POINTER(Display), Window, Pixmap]
+
+# /usr/include/X11/Xlib.h:3355
+XSetWindowBorder = _lib.XSetWindowBorder
+XSetWindowBorder.restype = c_int
+XSetWindowBorder.argtypes = [POINTER(Display), Window, c_ulong]
+
+# /usr/include/X11/Xlib.h:3361
+XSetWindowBorderPixmap = _lib.XSetWindowBorderPixmap
+XSetWindowBorderPixmap.restype = c_int
+XSetWindowBorderPixmap.argtypes = [POINTER(Display), Window, Pixmap]
+
+# /usr/include/X11/Xlib.h:3367
+XSetWindowBorderWidth = _lib.XSetWindowBorderWidth
+XSetWindowBorderWidth.restype = c_int
+XSetWindowBorderWidth.argtypes = [POINTER(Display), Window, c_uint]
+
+# /usr/include/X11/Xlib.h:3373
+XSetWindowColormap = _lib.XSetWindowColormap
+XSetWindowColormap.restype = c_int
+XSetWindowColormap.argtypes = [POINTER(Display), Window, Colormap]
+
+# /usr/include/X11/Xlib.h:3379
+XStoreBuffer = _lib.XStoreBuffer
+XStoreBuffer.restype = c_int
+XStoreBuffer.argtypes = [POINTER(Display), c_char_p, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3386
+XStoreBytes = _lib.XStoreBytes
+XStoreBytes.restype = c_int
+XStoreBytes.argtypes = [POINTER(Display), c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3392
+XStoreColor = _lib.XStoreColor
+XStoreColor.restype = c_int
+XStoreColor.argtypes = [POINTER(Display), Colormap, POINTER(XColor)]
+
+# /usr/include/X11/Xlib.h:3398
+XStoreColors = _lib.XStoreColors
+XStoreColors.restype = c_int
+XStoreColors.argtypes = [POINTER(Display), Colormap, POINTER(XColor), c_int]
+
+# /usr/include/X11/Xlib.h:3405
+XStoreName = _lib.XStoreName
+XStoreName.restype = c_int
+XStoreName.argtypes = [POINTER(Display), Window, c_char_p]
+
+# /usr/include/X11/Xlib.h:3411
+XStoreNamedColor = _lib.XStoreNamedColor
+XStoreNamedColor.restype = c_int
+XStoreNamedColor.argtypes = [POINTER(Display), Colormap, c_char_p, c_ulong, c_int]
+
+# /usr/include/X11/Xlib.h:3419
+XSync = _lib.XSync
+XSync.restype = c_int
+XSync.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:3424
+XTextExtents = _lib.XTextExtents
+XTextExtents.restype = c_int
+XTextExtents.argtypes = [POINTER(XFontStruct), c_char_p, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(XCharStruct)]
+
+# /usr/include/X11/Xlib.h:3434
+XTextExtents16 = _lib.XTextExtents16
+XTextExtents16.restype = c_int
+XTextExtents16.argtypes = [POINTER(XFontStruct), POINTER(XChar2b), c_int, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(XCharStruct)]
+
+# /usr/include/X11/Xlib.h:3444
+XTextWidth = _lib.XTextWidth
+XTextWidth.restype = c_int
+XTextWidth.argtypes = [POINTER(XFontStruct), c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3450
+XTextWidth16 = _lib.XTextWidth16
+XTextWidth16.restype = c_int
+XTextWidth16.argtypes = [POINTER(XFontStruct), POINTER(XChar2b), c_int]
+
+# /usr/include/X11/Xlib.h:3456
+XTranslateCoordinates = _lib.XTranslateCoordinates
+XTranslateCoordinates.restype = c_int
+XTranslateCoordinates.argtypes = [POINTER(Display), Window, Window, c_int, c_int, POINTER(c_int), POINTER(c_int), POINTER(Window)]
+
+# /usr/include/X11/Xlib.h:3467
+XUndefineCursor = _lib.XUndefineCursor
+XUndefineCursor.restype = c_int
+XUndefineCursor.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:3472
+XUngrabButton = _lib.XUngrabButton
+XUngrabButton.restype = c_int
+XUngrabButton.argtypes = [POINTER(Display), c_uint, c_uint, Window]
+
+# /usr/include/X11/Xlib.h:3479
+XUngrabKey = _lib.XUngrabKey
+XUngrabKey.restype = c_int
+XUngrabKey.argtypes = [POINTER(Display), c_int, c_uint, Window]
+
+# /usr/include/X11/Xlib.h:3486
+XUngrabKeyboard = _lib.XUngrabKeyboard
+XUngrabKeyboard.restype = c_int
+XUngrabKeyboard.argtypes = [POINTER(Display), Time]
+
+# /usr/include/X11/Xlib.h:3491
+XUngrabPointer = _lib.XUngrabPointer
+XUngrabPointer.restype = c_int
+XUngrabPointer.argtypes = [POINTER(Display), Time]
+
+# /usr/include/X11/Xlib.h:3496
+XUngrabServer = _lib.XUngrabServer
+XUngrabServer.restype = c_int
+XUngrabServer.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:3500
+XUninstallColormap = _lib.XUninstallColormap
+XUninstallColormap.restype = c_int
+XUninstallColormap.argtypes = [POINTER(Display), Colormap]
+
+# /usr/include/X11/Xlib.h:3505
+XUnloadFont = _lib.XUnloadFont
+XUnloadFont.restype = c_int
+XUnloadFont.argtypes = [POINTER(Display), Font]
+
+# /usr/include/X11/Xlib.h:3510
+XUnmapSubwindows = _lib.XUnmapSubwindows
+XUnmapSubwindows.restype = c_int
+XUnmapSubwindows.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:3515
+XUnmapWindow = _lib.XUnmapWindow
+XUnmapWindow.restype = c_int
+XUnmapWindow.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xlib.h:3520
+XVendorRelease = _lib.XVendorRelease
+XVendorRelease.restype = c_int
+XVendorRelease.argtypes = [POINTER(Display)]
+
+# /usr/include/X11/Xlib.h:3524
+XWarpPointer = _lib.XWarpPointer
+XWarpPointer.restype = c_int
+XWarpPointer.argtypes = [POINTER(Display), Window, Window, c_int, c_int, c_uint, c_uint, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3536
+XWidthMMOfScreen = _lib.XWidthMMOfScreen
+XWidthMMOfScreen.restype = c_int
+XWidthMMOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:3540
+XWidthOfScreen = _lib.XWidthOfScreen
+XWidthOfScreen.restype = c_int
+XWidthOfScreen.argtypes = [POINTER(Screen)]
+
+# /usr/include/X11/Xlib.h:3544
+XWindowEvent = _lib.XWindowEvent
+XWindowEvent.restype = c_int
+XWindowEvent.argtypes = [POINTER(Display), Window, c_long, POINTER(XEvent)]
+
+# /usr/include/X11/Xlib.h:3551
+XWriteBitmapFile = _lib.XWriteBitmapFile
+XWriteBitmapFile.restype = c_int
+XWriteBitmapFile.argtypes = [POINTER(Display), c_char_p, Pixmap, c_uint, c_uint, c_int, c_int]
+
+# /usr/include/X11/Xlib.h:3561
+XSupportsLocale = _lib.XSupportsLocale
+XSupportsLocale.restype = c_int
+XSupportsLocale.argtypes = []
+
+# /usr/include/X11/Xlib.h:3563
+XSetLocaleModifiers = _lib.XSetLocaleModifiers
+XSetLocaleModifiers.restype = c_char_p
+XSetLocaleModifiers.argtypes = [c_char_p]
+
+class struct__XrmHashBucketRec(Structure):
+ __slots__ = [
+ ]
+struct__XrmHashBucketRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/X11/Xlib.h:3567
+XOpenOM = _lib.XOpenOM
+XOpenOM.restype = XOM
+XOpenOM.argtypes = [POINTER(Display), POINTER(struct__XrmHashBucketRec), c_char_p, c_char_p]
+
+# /usr/include/X11/Xlib.h:3574
+XCloseOM = _lib.XCloseOM
+XCloseOM.restype = c_int
+XCloseOM.argtypes = [XOM]
+
+# /usr/include/X11/Xlib.h:3578
+XSetOMValues = _lib.XSetOMValues
+XSetOMValues.restype = c_char_p
+XSetOMValues.argtypes = [XOM]
+
+# /usr/include/X11/Xlib.h:3583
+XGetOMValues = _lib.XGetOMValues
+XGetOMValues.restype = c_char_p
+XGetOMValues.argtypes = [XOM]
+
+# /usr/include/X11/Xlib.h:3588
+XDisplayOfOM = _lib.XDisplayOfOM
+XDisplayOfOM.restype = POINTER(Display)
+XDisplayOfOM.argtypes = [XOM]
+
+# /usr/include/X11/Xlib.h:3592
+XLocaleOfOM = _lib.XLocaleOfOM
+XLocaleOfOM.restype = c_char_p
+XLocaleOfOM.argtypes = [XOM]
+
+# /usr/include/X11/Xlib.h:3596
+XCreateOC = _lib.XCreateOC
+XCreateOC.restype = XOC
+XCreateOC.argtypes = [XOM]
+
+# /usr/include/X11/Xlib.h:3601
+XDestroyOC = _lib.XDestroyOC
+XDestroyOC.restype = None
+XDestroyOC.argtypes = [XOC]
+
+# /usr/include/X11/Xlib.h:3605
+XOMOfOC = _lib.XOMOfOC
+XOMOfOC.restype = XOM
+XOMOfOC.argtypes = [XOC]
+
+# /usr/include/X11/Xlib.h:3609
+XSetOCValues = _lib.XSetOCValues
+XSetOCValues.restype = c_char_p
+XSetOCValues.argtypes = [XOC]
+
+# /usr/include/X11/Xlib.h:3614
+XGetOCValues = _lib.XGetOCValues
+XGetOCValues.restype = c_char_p
+XGetOCValues.argtypes = [XOC]
+
+# /usr/include/X11/Xlib.h:3619
+XCreateFontSet = _lib.XCreateFontSet
+XCreateFontSet.restype = XFontSet
+XCreateFontSet.argtypes = [POINTER(Display), c_char_p, POINTER(POINTER(c_char_p)), POINTER(c_int), POINTER(c_char_p)]
+
+# /usr/include/X11/Xlib.h:3627
+XFreeFontSet = _lib.XFreeFontSet
+XFreeFontSet.restype = None
+XFreeFontSet.argtypes = [POINTER(Display), XFontSet]
+
+# /usr/include/X11/Xlib.h:3632
+XFontsOfFontSet = _lib.XFontsOfFontSet
+XFontsOfFontSet.restype = c_int
+XFontsOfFontSet.argtypes = [XFontSet, POINTER(POINTER(POINTER(XFontStruct))), POINTER(POINTER(c_char_p))]
+
+# /usr/include/X11/Xlib.h:3638
+XBaseFontNameListOfFontSet = _lib.XBaseFontNameListOfFontSet
+XBaseFontNameListOfFontSet.restype = c_char_p
+XBaseFontNameListOfFontSet.argtypes = [XFontSet]
+
+# /usr/include/X11/Xlib.h:3642
+XLocaleOfFontSet = _lib.XLocaleOfFontSet
+XLocaleOfFontSet.restype = c_char_p
+XLocaleOfFontSet.argtypes = [XFontSet]
+
+# /usr/include/X11/Xlib.h:3646
+XContextDependentDrawing = _lib.XContextDependentDrawing
+XContextDependentDrawing.restype = c_int
+XContextDependentDrawing.argtypes = [XFontSet]
+
+# /usr/include/X11/Xlib.h:3650
+XDirectionalDependentDrawing = _lib.XDirectionalDependentDrawing
+XDirectionalDependentDrawing.restype = c_int
+XDirectionalDependentDrawing.argtypes = [XFontSet]
+
+# /usr/include/X11/Xlib.h:3654
+XContextualDrawing = _lib.XContextualDrawing
+XContextualDrawing.restype = c_int
+XContextualDrawing.argtypes = [XFontSet]
+
+# /usr/include/X11/Xlib.h:3658
+XExtentsOfFontSet = _lib.XExtentsOfFontSet
+XExtentsOfFontSet.restype = POINTER(XFontSetExtents)
+XExtentsOfFontSet.argtypes = [XFontSet]
+
+# /usr/include/X11/Xlib.h:3662
+XmbTextEscapement = _lib.XmbTextEscapement
+XmbTextEscapement.restype = c_int
+XmbTextEscapement.argtypes = [XFontSet, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3668
+XwcTextEscapement = _lib.XwcTextEscapement
+XwcTextEscapement.restype = c_int
+XwcTextEscapement.argtypes = [XFontSet, c_wchar_p, c_int]
+
+# /usr/include/X11/Xlib.h:3674
+Xutf8TextEscapement = _lib.Xutf8TextEscapement
+Xutf8TextEscapement.restype = c_int
+Xutf8TextEscapement.argtypes = [XFontSet, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3680
+XmbTextExtents = _lib.XmbTextExtents
+XmbTextExtents.restype = c_int
+XmbTextExtents.argtypes = [XFontSet, c_char_p, c_int, POINTER(XRectangle), POINTER(XRectangle)]
+
+# /usr/include/X11/Xlib.h:3688
+XwcTextExtents = _lib.XwcTextExtents
+XwcTextExtents.restype = c_int
+XwcTextExtents.argtypes = [XFontSet, c_wchar_p, c_int, POINTER(XRectangle), POINTER(XRectangle)]
+
+# /usr/include/X11/Xlib.h:3696
+Xutf8TextExtents = _lib.Xutf8TextExtents
+Xutf8TextExtents.restype = c_int
+Xutf8TextExtents.argtypes = [XFontSet, c_char_p, c_int, POINTER(XRectangle), POINTER(XRectangle)]
+
+# /usr/include/X11/Xlib.h:3704
+XmbTextPerCharExtents = _lib.XmbTextPerCharExtents
+XmbTextPerCharExtents.restype = c_int
+XmbTextPerCharExtents.argtypes = [XFontSet, c_char_p, c_int, POINTER(XRectangle), POINTER(XRectangle), c_int, POINTER(c_int), POINTER(XRectangle), POINTER(XRectangle)]
+
+# /usr/include/X11/Xlib.h:3716
+XwcTextPerCharExtents = _lib.XwcTextPerCharExtents
+XwcTextPerCharExtents.restype = c_int
+XwcTextPerCharExtents.argtypes = [XFontSet, c_wchar_p, c_int, POINTER(XRectangle), POINTER(XRectangle), c_int, POINTER(c_int), POINTER(XRectangle), POINTER(XRectangle)]
+
+# /usr/include/X11/Xlib.h:3728
+Xutf8TextPerCharExtents = _lib.Xutf8TextPerCharExtents
+Xutf8TextPerCharExtents.restype = c_int
+Xutf8TextPerCharExtents.argtypes = [XFontSet, c_char_p, c_int, POINTER(XRectangle), POINTER(XRectangle), c_int, POINTER(c_int), POINTER(XRectangle), POINTER(XRectangle)]
+
+# /usr/include/X11/Xlib.h:3740
+XmbDrawText = _lib.XmbDrawText
+XmbDrawText.restype = None
+XmbDrawText.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XmbTextItem), c_int]
+
+# /usr/include/X11/Xlib.h:3750
+XwcDrawText = _lib.XwcDrawText
+XwcDrawText.restype = None
+XwcDrawText.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XwcTextItem), c_int]
+
+# /usr/include/X11/Xlib.h:3760
+Xutf8DrawText = _lib.Xutf8DrawText
+Xutf8DrawText.restype = None
+Xutf8DrawText.argtypes = [POINTER(Display), Drawable, GC, c_int, c_int, POINTER(XmbTextItem), c_int]
+
+# /usr/include/X11/Xlib.h:3770
+XmbDrawString = _lib.XmbDrawString
+XmbDrawString.restype = None
+XmbDrawString.argtypes = [POINTER(Display), Drawable, XFontSet, GC, c_int, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3781
+XwcDrawString = _lib.XwcDrawString
+XwcDrawString.restype = None
+XwcDrawString.argtypes = [POINTER(Display), Drawable, XFontSet, GC, c_int, c_int, c_wchar_p, c_int]
+
+# /usr/include/X11/Xlib.h:3792
+Xutf8DrawString = _lib.Xutf8DrawString
+Xutf8DrawString.restype = None
+Xutf8DrawString.argtypes = [POINTER(Display), Drawable, XFontSet, GC, c_int, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3803
+XmbDrawImageString = _lib.XmbDrawImageString
+XmbDrawImageString.restype = None
+XmbDrawImageString.argtypes = [POINTER(Display), Drawable, XFontSet, GC, c_int, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3814
+XwcDrawImageString = _lib.XwcDrawImageString
+XwcDrawImageString.restype = None
+XwcDrawImageString.argtypes = [POINTER(Display), Drawable, XFontSet, GC, c_int, c_int, c_wchar_p, c_int]
+
+# /usr/include/X11/Xlib.h:3825
+Xutf8DrawImageString = _lib.Xutf8DrawImageString
+Xutf8DrawImageString.restype = None
+Xutf8DrawImageString.argtypes = [POINTER(Display), Drawable, XFontSet, GC, c_int, c_int, c_char_p, c_int]
+
+class struct__XrmHashBucketRec(Structure):
+ __slots__ = [
+ ]
+struct__XrmHashBucketRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/X11/Xlib.h:3836
+XOpenIM = _lib.XOpenIM
+XOpenIM.restype = XIM
+XOpenIM.argtypes = [POINTER(Display), POINTER(struct__XrmHashBucketRec), c_char_p, c_char_p]
+
+# /usr/include/X11/Xlib.h:3843
+XCloseIM = _lib.XCloseIM
+XCloseIM.restype = c_int
+XCloseIM.argtypes = [XIM]
+
+# /usr/include/X11/Xlib.h:3847
+XGetIMValues = _lib.XGetIMValues
+XGetIMValues.restype = c_char_p
+XGetIMValues.argtypes = [XIM]
+
+# /usr/include/X11/Xlib.h:3851
+XSetIMValues = _lib.XSetIMValues
+XSetIMValues.restype = c_char_p
+XSetIMValues.argtypes = [XIM]
+
+# /usr/include/X11/Xlib.h:3855
+XDisplayOfIM = _lib.XDisplayOfIM
+XDisplayOfIM.restype = POINTER(Display)
+XDisplayOfIM.argtypes = [XIM]
+
+# /usr/include/X11/Xlib.h:3859
+XLocaleOfIM = _lib.XLocaleOfIM
+XLocaleOfIM.restype = c_char_p
+XLocaleOfIM.argtypes = [XIM]
+
+# /usr/include/X11/Xlib.h:3863
+XCreateIC = _lib.XCreateIC
+XCreateIC.restype = XIC
+XCreateIC.argtypes = [XIM]
+
+# /usr/include/X11/Xlib.h:3867
+XDestroyIC = _lib.XDestroyIC
+XDestroyIC.restype = None
+XDestroyIC.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3871
+XSetICFocus = _lib.XSetICFocus
+XSetICFocus.restype = None
+XSetICFocus.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3875
+XUnsetICFocus = _lib.XUnsetICFocus
+XUnsetICFocus.restype = None
+XUnsetICFocus.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3879
+XwcResetIC = _lib.XwcResetIC
+XwcResetIC.restype = c_wchar_p
+XwcResetIC.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3883
+XmbResetIC = _lib.XmbResetIC
+XmbResetIC.restype = c_char_p
+XmbResetIC.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3887
+Xutf8ResetIC = _lib.Xutf8ResetIC
+Xutf8ResetIC.restype = c_char_p
+Xutf8ResetIC.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3891
+XSetICValues = _lib.XSetICValues
+XSetICValues.restype = c_char_p
+XSetICValues.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3895
+XGetICValues = _lib.XGetICValues
+XGetICValues.restype = c_char_p
+XGetICValues.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3899
+XIMOfIC = _lib.XIMOfIC
+XIMOfIC.restype = XIM
+XIMOfIC.argtypes = [XIC]
+
+# /usr/include/X11/Xlib.h:3903
+XFilterEvent = _lib.XFilterEvent
+XFilterEvent.restype = c_int
+XFilterEvent.argtypes = [POINTER(XEvent), Window]
+
+# /usr/include/X11/Xlib.h:3908
+XmbLookupString = _lib.XmbLookupString
+XmbLookupString.restype = c_int
+XmbLookupString.argtypes = [XIC, POINTER(XKeyPressedEvent), c_char_p, c_int, POINTER(KeySym), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:3917
+XwcLookupString = _lib.XwcLookupString
+XwcLookupString.restype = c_int
+XwcLookupString.argtypes = [XIC, POINTER(XKeyPressedEvent), c_wchar_p, c_int, POINTER(KeySym), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:3926
+Xutf8LookupString = _lib.Xutf8LookupString
+Xutf8LookupString.restype = c_int
+Xutf8LookupString.argtypes = [XIC, POINTER(XKeyPressedEvent), c_char_p, c_int, POINTER(KeySym), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:3935
+XVaCreateNestedList = _lib.XVaCreateNestedList
+XVaCreateNestedList.restype = XVaNestedList
+XVaCreateNestedList.argtypes = [c_int]
+
+class struct__XrmHashBucketRec(Structure):
+ __slots__ = [
+ ]
+struct__XrmHashBucketRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/X11/Xlib.h:3941
+XRegisterIMInstantiateCallback = _lib.XRegisterIMInstantiateCallback
+XRegisterIMInstantiateCallback.restype = c_int
+XRegisterIMInstantiateCallback.argtypes = [POINTER(Display), POINTER(struct__XrmHashBucketRec), c_char_p, c_char_p, XIDProc, XPointer]
+
+class struct__XrmHashBucketRec(Structure):
+ __slots__ = [
+ ]
+struct__XrmHashBucketRec._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+# /usr/include/X11/Xlib.h:3950
+XUnregisterIMInstantiateCallback = _lib.XUnregisterIMInstantiateCallback
+XUnregisterIMInstantiateCallback.restype = c_int
+XUnregisterIMInstantiateCallback.argtypes = [POINTER(Display), POINTER(struct__XrmHashBucketRec), c_char_p, c_char_p, XIDProc, XPointer]
+
+XConnectionWatchProc = CFUNCTYPE(None, POINTER(Display), XPointer, c_int, c_int, POINTER(XPointer)) # /usr/include/X11/Xlib.h:3959
+# /usr/include/X11/Xlib.h:3968
+XInternalConnectionNumbers = _lib.XInternalConnectionNumbers
+XInternalConnectionNumbers.restype = c_int
+XInternalConnectionNumbers.argtypes = [POINTER(Display), POINTER(POINTER(c_int)), POINTER(c_int)]
+
+# /usr/include/X11/Xlib.h:3974
+XProcessInternalConnection = _lib.XProcessInternalConnection
+XProcessInternalConnection.restype = None
+XProcessInternalConnection.argtypes = [POINTER(Display), c_int]
+
+# /usr/include/X11/Xlib.h:3979
+XAddConnectionWatch = _lib.XAddConnectionWatch
+XAddConnectionWatch.restype = c_int
+XAddConnectionWatch.argtypes = [POINTER(Display), XConnectionWatchProc, XPointer]
+
+# /usr/include/X11/Xlib.h:3985
+XRemoveConnectionWatch = _lib.XRemoveConnectionWatch
+XRemoveConnectionWatch.restype = None
+XRemoveConnectionWatch.argtypes = [POINTER(Display), XConnectionWatchProc, XPointer]
+
+# /usr/include/X11/Xlib.h:3991
+XSetAuthorization = _lib.XSetAuthorization
+XSetAuthorization.restype = None
+XSetAuthorization.argtypes = [c_char_p, c_int, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:3998
+_Xmbtowc = _lib._Xmbtowc
+_Xmbtowc.restype = c_int
+_Xmbtowc.argtypes = [c_wchar_p, c_char_p, c_int]
+
+# /usr/include/X11/Xlib.h:4009
+_Xwctomb = _lib._Xwctomb
+_Xwctomb.restype = c_int
+_Xwctomb.argtypes = [c_char_p, c_wchar]
+
+# /usr/include/X11/Xlib.h:4014
+XGetEventData = _lib.XGetEventData
+XGetEventData.restype = c_int
+XGetEventData.argtypes = [POINTER(Display), POINTER(XGenericEventCookie)]
+
+# /usr/include/X11/Xlib.h:4019
+XFreeEventData = _lib.XFreeEventData
+XFreeEventData.restype = None
+XFreeEventData.argtypes = [POINTER(Display), POINTER(XGenericEventCookie)]
+
+NoValue = 0 # /usr/include/X11/Xutil.h:4805
+XValue = 1 # /usr/include/X11/Xutil.h:4806
+YValue = 2 # /usr/include/X11/Xutil.h:4807
+WidthValue = 4 # /usr/include/X11/Xutil.h:4808
+HeightValue = 8 # /usr/include/X11/Xutil.h:4809
+AllValues = 15 # /usr/include/X11/Xutil.h:4810
+XNegative = 16 # /usr/include/X11/Xutil.h:4811
+YNegative = 32 # /usr/include/X11/Xutil.h:4812
+class struct_anon_95(Structure):
+ __slots__ = [
+ 'flags',
+ 'x',
+ 'y',
+ 'width',
+ 'height',
+ 'min_width',
+ 'min_height',
+ 'max_width',
+ 'max_height',
+ 'width_inc',
+ 'height_inc',
+ 'min_aspect',
+ 'max_aspect',
+ 'base_width',
+ 'base_height',
+ 'win_gravity',
+ ]
+class struct_anon_96(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ ]
+struct_anon_96._fields_ = [
+ ('x', c_int),
+ ('y', c_int),
+]
+
+class struct_anon_97(Structure):
+ __slots__ = [
+ 'x',
+ 'y',
+ ]
+struct_anon_97._fields_ = [
+ ('x', c_int),
+ ('y', c_int),
+]
+
+struct_anon_95._fields_ = [
+ ('flags', c_long),
+ ('x', c_int),
+ ('y', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('min_width', c_int),
+ ('min_height', c_int),
+ ('max_width', c_int),
+ ('max_height', c_int),
+ ('width_inc', c_int),
+ ('height_inc', c_int),
+ ('min_aspect', struct_anon_96),
+ ('max_aspect', struct_anon_97),
+ ('base_width', c_int),
+ ('base_height', c_int),
+ ('win_gravity', c_int),
+]
+
+XSizeHints = struct_anon_95 # /usr/include/X11/Xutil.h:4831
+USPosition = 1 # /usr/include/X11/Xutil.h:4839
+USSize = 2 # /usr/include/X11/Xutil.h:4840
+PPosition = 4 # /usr/include/X11/Xutil.h:4842
+PSize = 8 # /usr/include/X11/Xutil.h:4843
+PMinSize = 16 # /usr/include/X11/Xutil.h:4844
+PMaxSize = 32 # /usr/include/X11/Xutil.h:4845
+PResizeInc = 64 # /usr/include/X11/Xutil.h:4846
+PAspect = 128 # /usr/include/X11/Xutil.h:4847
+PBaseSize = 256 # /usr/include/X11/Xutil.h:4848
+PWinGravity = 512 # /usr/include/X11/Xutil.h:4849
+PAllHints = 252 # /usr/include/X11/Xutil.h:4852
+class struct_anon_98(Structure):
+ __slots__ = [
+ 'flags',
+ 'input',
+ 'initial_state',
+ 'icon_pixmap',
+ 'icon_window',
+ 'icon_x',
+ 'icon_y',
+ 'icon_mask',
+ 'window_group',
+ ]
+struct_anon_98._fields_ = [
+ ('flags', c_long),
+ ('input', c_int),
+ ('initial_state', c_int),
+ ('icon_pixmap', Pixmap),
+ ('icon_window', Window),
+ ('icon_x', c_int),
+ ('icon_y', c_int),
+ ('icon_mask', Pixmap),
+ ('window_group', XID),
+]
+
+XWMHints = struct_anon_98 # /usr/include/X11/Xutil.h:4867
+InputHint = 1 # /usr/include/X11/Xutil.h:4871
+StateHint = 2 # /usr/include/X11/Xutil.h:4872
+IconPixmapHint = 4 # /usr/include/X11/Xutil.h:4873
+IconWindowHint = 8 # /usr/include/X11/Xutil.h:4874
+IconPositionHint = 16 # /usr/include/X11/Xutil.h:4875
+IconMaskHint = 32 # /usr/include/X11/Xutil.h:4876
+WindowGroupHint = 64 # /usr/include/X11/Xutil.h:4877
+AllHints = 127 # /usr/include/X11/Xutil.h:4878
+XUrgencyHint = 256 # /usr/include/X11/Xutil.h:4880
+WithdrawnState = 0 # /usr/include/X11/Xutil.h:4883
+NormalState = 1 # /usr/include/X11/Xutil.h:4884
+IconicState = 3 # /usr/include/X11/Xutil.h:4885
+DontCareState = 0 # /usr/include/X11/Xutil.h:4890
+ZoomState = 2 # /usr/include/X11/Xutil.h:4891
+InactiveState = 4 # /usr/include/X11/Xutil.h:4892
+class struct_anon_99(Structure):
+ __slots__ = [
+ 'value',
+ 'encoding',
+ 'format',
+ 'nitems',
+ ]
+struct_anon_99._fields_ = [
+ ('value', POINTER(c_ubyte)),
+ ('encoding', Atom),
+ ('format', c_int),
+ ('nitems', c_ulong),
+]
+
+XTextProperty = struct_anon_99 # /usr/include/X11/Xutil.h:4905
+XNoMemory = -1 # /usr/include/X11/Xutil.h:4907
+XLocaleNotSupported = -2 # /usr/include/X11/Xutil.h:4908
+XConverterNotFound = -3 # /usr/include/X11/Xutil.h:4909
+enum_anon_100 = c_int
+XStringStyle = 0
+XCompoundTextStyle = 1
+XTextStyle = 2
+XStdICCTextStyle = 3
+XUTF8StringStyle = 4
+XICCEncodingStyle = enum_anon_100 # /usr/include/X11/Xutil.h:4918
+class struct_anon_101(Structure):
+ __slots__ = [
+ 'min_width',
+ 'min_height',
+ 'max_width',
+ 'max_height',
+ 'width_inc',
+ 'height_inc',
+ ]
+struct_anon_101._fields_ = [
+ ('min_width', c_int),
+ ('min_height', c_int),
+ ('max_width', c_int),
+ ('max_height', c_int),
+ ('width_inc', c_int),
+ ('height_inc', c_int),
+]
+
+XIconSize = struct_anon_101 # /usr/include/X11/Xutil.h:4924
+class struct_anon_102(Structure):
+ __slots__ = [
+ 'res_name',
+ 'res_class',
+ ]
+struct_anon_102._fields_ = [
+ ('res_name', c_char_p),
+ ('res_class', c_char_p),
+]
+
+XClassHint = struct_anon_102 # /usr/include/X11/Xutil.h:4929
+class struct__XComposeStatus(Structure):
+ __slots__ = [
+ 'compose_ptr',
+ 'chars_matched',
+ ]
+struct__XComposeStatus._fields_ = [
+ ('compose_ptr', XPointer),
+ ('chars_matched', c_int),
+]
+
+XComposeStatus = struct__XComposeStatus # /usr/include/X11/Xutil.h:4971
+class struct__XRegion(Structure):
+ __slots__ = [
+ ]
+struct__XRegion._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+class struct__XRegion(Structure):
+ __slots__ = [
+ ]
+struct__XRegion._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+Region = POINTER(struct__XRegion) # /usr/include/X11/Xutil.h:5010
+RectangleOut = 0 # /usr/include/X11/Xutil.h:5014
+RectangleIn = 1 # /usr/include/X11/Xutil.h:5015
+RectanglePart = 2 # /usr/include/X11/Xutil.h:5016
+class struct_anon_103(Structure):
+ __slots__ = [
+ 'visual',
+ 'visualid',
+ 'screen',
+ 'depth',
+ 'class',
+ 'red_mask',
+ 'green_mask',
+ 'blue_mask',
+ 'colormap_size',
+ 'bits_per_rgb',
+ ]
+struct_anon_103._fields_ = [
+ ('visual', POINTER(Visual)),
+ ('visualid', VisualID),
+ ('screen', c_int),
+ ('depth', c_int),
+ ('class', c_int),
+ ('red_mask', c_ulong),
+ ('green_mask', c_ulong),
+ ('blue_mask', c_ulong),
+ ('colormap_size', c_int),
+ ('bits_per_rgb', c_int),
+]
+
+XVisualInfo = struct_anon_103 # /usr/include/X11/Xutil.h:5039
+VisualNoMask = 0 # /usr/include/X11/Xutil.h:5041
+VisualIDMask = 1 # /usr/include/X11/Xutil.h:5042
+VisualScreenMask = 2 # /usr/include/X11/Xutil.h:5043
+VisualDepthMask = 4 # /usr/include/X11/Xutil.h:5044
+VisualClassMask = 8 # /usr/include/X11/Xutil.h:5045
+VisualRedMaskMask = 16 # /usr/include/X11/Xutil.h:5046
+VisualGreenMaskMask = 32 # /usr/include/X11/Xutil.h:5047
+VisualBlueMaskMask = 64 # /usr/include/X11/Xutil.h:5048
+VisualColormapSizeMask = 128 # /usr/include/X11/Xutil.h:5049
+VisualBitsPerRGBMask = 256 # /usr/include/X11/Xutil.h:5050
+VisualAllMask = 511 # /usr/include/X11/Xutil.h:5051
+class struct_anon_104(Structure):
+ __slots__ = [
+ 'colormap',
+ 'red_max',
+ 'red_mult',
+ 'green_max',
+ 'green_mult',
+ 'blue_max',
+ 'blue_mult',
+ 'base_pixel',
+ 'visualid',
+ 'killid',
+ ]
+struct_anon_104._fields_ = [
+ ('colormap', Colormap),
+ ('red_max', c_ulong),
+ ('red_mult', c_ulong),
+ ('green_max', c_ulong),
+ ('green_mult', c_ulong),
+ ('blue_max', c_ulong),
+ ('blue_mult', c_ulong),
+ ('base_pixel', c_ulong),
+ ('visualid', VisualID),
+ ('killid', XID),
+]
+
+XStandardColormap = struct_anon_104 # /usr/include/X11/Xutil.h:5068
+BitmapSuccess = 0 # /usr/include/X11/Xutil.h:5076
+BitmapOpenFailed = 1 # /usr/include/X11/Xutil.h:5077
+BitmapFileInvalid = 2 # /usr/include/X11/Xutil.h:5078
+BitmapNoMemory = 3 # /usr/include/X11/Xutil.h:5079
+XCSUCCESS = 0 # /usr/include/X11/Xutil.h:5090
+XCNOMEM = 1 # /usr/include/X11/Xutil.h:5091
+XCNOENT = 2 # /usr/include/X11/Xutil.h:5092
+XContext = c_int # /usr/include/X11/Xutil.h:5094
+# /usr/include/X11/Xutil.h:5103
+XAllocClassHint = _lib.XAllocClassHint
+XAllocClassHint.restype = POINTER(XClassHint)
+XAllocClassHint.argtypes = []
+
+# /usr/include/X11/Xutil.h:5107
+XAllocIconSize = _lib.XAllocIconSize
+XAllocIconSize.restype = POINTER(XIconSize)
+XAllocIconSize.argtypes = []
+
+# /usr/include/X11/Xutil.h:5111
+XAllocSizeHints = _lib.XAllocSizeHints
+XAllocSizeHints.restype = POINTER(XSizeHints)
+XAllocSizeHints.argtypes = []
+
+# /usr/include/X11/Xutil.h:5115
+XAllocStandardColormap = _lib.XAllocStandardColormap
+XAllocStandardColormap.restype = POINTER(XStandardColormap)
+XAllocStandardColormap.argtypes = []
+
+# /usr/include/X11/Xutil.h:5119
+XAllocWMHints = _lib.XAllocWMHints
+XAllocWMHints.restype = POINTER(XWMHints)
+XAllocWMHints.argtypes = []
+
+# /usr/include/X11/Xutil.h:5123
+XClipBox = _lib.XClipBox
+XClipBox.restype = c_int
+XClipBox.argtypes = [Region, POINTER(XRectangle)]
+
+# /usr/include/X11/Xutil.h:5128
+XCreateRegion = _lib.XCreateRegion
+XCreateRegion.restype = Region
+XCreateRegion.argtypes = []
+
+# /usr/include/X11/Xutil.h:5132
+XDefaultString = _lib.XDefaultString
+XDefaultString.restype = c_char_p
+XDefaultString.argtypes = []
+
+# /usr/include/X11/Xutil.h:5134
+XDeleteContext = _lib.XDeleteContext
+XDeleteContext.restype = c_int
+XDeleteContext.argtypes = [POINTER(Display), XID, XContext]
+
+# /usr/include/X11/Xutil.h:5140
+XDestroyRegion = _lib.XDestroyRegion
+XDestroyRegion.restype = c_int
+XDestroyRegion.argtypes = [Region]
+
+# /usr/include/X11/Xutil.h:5144
+XEmptyRegion = _lib.XEmptyRegion
+XEmptyRegion.restype = c_int
+XEmptyRegion.argtypes = [Region]
+
+# /usr/include/X11/Xutil.h:5148
+XEqualRegion = _lib.XEqualRegion
+XEqualRegion.restype = c_int
+XEqualRegion.argtypes = [Region, Region]
+
+# /usr/include/X11/Xutil.h:5153
+XFindContext = _lib.XFindContext
+XFindContext.restype = c_int
+XFindContext.argtypes = [POINTER(Display), XID, XContext, POINTER(XPointer)]
+
+# /usr/include/X11/Xutil.h:5160
+XGetClassHint = _lib.XGetClassHint
+XGetClassHint.restype = c_int
+XGetClassHint.argtypes = [POINTER(Display), Window, POINTER(XClassHint)]
+
+# /usr/include/X11/Xutil.h:5166
+XGetIconSizes = _lib.XGetIconSizes
+XGetIconSizes.restype = c_int
+XGetIconSizes.argtypes = [POINTER(Display), Window, POINTER(POINTER(XIconSize)), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5173
+XGetNormalHints = _lib.XGetNormalHints
+XGetNormalHints.restype = c_int
+XGetNormalHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints)]
+
+# /usr/include/X11/Xutil.h:5179
+XGetRGBColormaps = _lib.XGetRGBColormaps
+XGetRGBColormaps.restype = c_int
+XGetRGBColormaps.argtypes = [POINTER(Display), Window, POINTER(POINTER(XStandardColormap)), POINTER(c_int), Atom]
+
+# /usr/include/X11/Xutil.h:5187
+XGetSizeHints = _lib.XGetSizeHints
+XGetSizeHints.restype = c_int
+XGetSizeHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints), Atom]
+
+# /usr/include/X11/Xutil.h:5194
+XGetStandardColormap = _lib.XGetStandardColormap
+XGetStandardColormap.restype = c_int
+XGetStandardColormap.argtypes = [POINTER(Display), Window, POINTER(XStandardColormap), Atom]
+
+# /usr/include/X11/Xutil.h:5201
+XGetTextProperty = _lib.XGetTextProperty
+XGetTextProperty.restype = c_int
+XGetTextProperty.argtypes = [POINTER(Display), Window, POINTER(XTextProperty), Atom]
+
+# /usr/include/X11/Xutil.h:5208
+XGetVisualInfo = _lib.XGetVisualInfo
+XGetVisualInfo.restype = POINTER(XVisualInfo)
+XGetVisualInfo.argtypes = [POINTER(Display), c_long, POINTER(XVisualInfo), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5215
+XGetWMClientMachine = _lib.XGetWMClientMachine
+XGetWMClientMachine.restype = c_int
+XGetWMClientMachine.argtypes = [POINTER(Display), Window, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5221
+XGetWMHints = _lib.XGetWMHints
+XGetWMHints.restype = POINTER(XWMHints)
+XGetWMHints.argtypes = [POINTER(Display), Window]
+
+# /usr/include/X11/Xutil.h:5226
+XGetWMIconName = _lib.XGetWMIconName
+XGetWMIconName.restype = c_int
+XGetWMIconName.argtypes = [POINTER(Display), Window, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5232
+XGetWMName = _lib.XGetWMName
+XGetWMName.restype = c_int
+XGetWMName.argtypes = [POINTER(Display), Window, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5238
+XGetWMNormalHints = _lib.XGetWMNormalHints
+XGetWMNormalHints.restype = c_int
+XGetWMNormalHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints), POINTER(c_long)]
+
+# /usr/include/X11/Xutil.h:5245
+XGetWMSizeHints = _lib.XGetWMSizeHints
+XGetWMSizeHints.restype = c_int
+XGetWMSizeHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints), POINTER(c_long), Atom]
+
+# /usr/include/X11/Xutil.h:5253
+XGetZoomHints = _lib.XGetZoomHints
+XGetZoomHints.restype = c_int
+XGetZoomHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints)]
+
+# /usr/include/X11/Xutil.h:5259
+XIntersectRegion = _lib.XIntersectRegion
+XIntersectRegion.restype = c_int
+XIntersectRegion.argtypes = [Region, Region, Region]
+
+# /usr/include/X11/Xutil.h:5265
+XConvertCase = _lib.XConvertCase
+XConvertCase.restype = None
+XConvertCase.argtypes = [KeySym, POINTER(KeySym), POINTER(KeySym)]
+
+# /usr/include/X11/Xutil.h:5271
+XLookupString = _lib.XLookupString
+XLookupString.restype = c_int
+XLookupString.argtypes = [POINTER(XKeyEvent), c_char_p, c_int, POINTER(KeySym), POINTER(XComposeStatus)]
+
+# /usr/include/X11/Xutil.h:5279
+XMatchVisualInfo = _lib.XMatchVisualInfo
+XMatchVisualInfo.restype = c_int
+XMatchVisualInfo.argtypes = [POINTER(Display), c_int, c_int, c_int, POINTER(XVisualInfo)]
+
+# /usr/include/X11/Xutil.h:5287
+XOffsetRegion = _lib.XOffsetRegion
+XOffsetRegion.restype = c_int
+XOffsetRegion.argtypes = [Region, c_int, c_int]
+
+# /usr/include/X11/Xutil.h:5293
+XPointInRegion = _lib.XPointInRegion
+XPointInRegion.restype = c_int
+XPointInRegion.argtypes = [Region, c_int, c_int]
+
+# /usr/include/X11/Xutil.h:5299
+XPolygonRegion = _lib.XPolygonRegion
+XPolygonRegion.restype = Region
+XPolygonRegion.argtypes = [POINTER(XPoint), c_int, c_int]
+
+# /usr/include/X11/Xutil.h:5305
+XRectInRegion = _lib.XRectInRegion
+XRectInRegion.restype = c_int
+XRectInRegion.argtypes = [Region, c_int, c_int, c_uint, c_uint]
+
+# /usr/include/X11/Xutil.h:5313
+XSaveContext = _lib.XSaveContext
+XSaveContext.restype = c_int
+XSaveContext.argtypes = [POINTER(Display), XID, XContext, c_char_p]
+
+# /usr/include/X11/Xutil.h:5320
+XSetClassHint = _lib.XSetClassHint
+XSetClassHint.restype = c_int
+XSetClassHint.argtypes = [POINTER(Display), Window, POINTER(XClassHint)]
+
+# /usr/include/X11/Xutil.h:5326
+XSetIconSizes = _lib.XSetIconSizes
+XSetIconSizes.restype = c_int
+XSetIconSizes.argtypes = [POINTER(Display), Window, POINTER(XIconSize), c_int]
+
+# /usr/include/X11/Xutil.h:5333
+XSetNormalHints = _lib.XSetNormalHints
+XSetNormalHints.restype = c_int
+XSetNormalHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints)]
+
+# /usr/include/X11/Xutil.h:5339
+XSetRGBColormaps = _lib.XSetRGBColormaps
+XSetRGBColormaps.restype = None
+XSetRGBColormaps.argtypes = [POINTER(Display), Window, POINTER(XStandardColormap), c_int, Atom]
+
+# /usr/include/X11/Xutil.h:5347
+XSetSizeHints = _lib.XSetSizeHints
+XSetSizeHints.restype = c_int
+XSetSizeHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints), Atom]
+
+# /usr/include/X11/Xutil.h:5354
+XSetStandardProperties = _lib.XSetStandardProperties
+XSetStandardProperties.restype = c_int
+XSetStandardProperties.argtypes = [POINTER(Display), Window, c_char_p, c_char_p, Pixmap, POINTER(c_char_p), c_int, POINTER(XSizeHints)]
+
+# /usr/include/X11/Xutil.h:5365
+XSetTextProperty = _lib.XSetTextProperty
+XSetTextProperty.restype = None
+XSetTextProperty.argtypes = [POINTER(Display), Window, POINTER(XTextProperty), Atom]
+
+# /usr/include/X11/Xutil.h:5372
+XSetWMClientMachine = _lib.XSetWMClientMachine
+XSetWMClientMachine.restype = None
+XSetWMClientMachine.argtypes = [POINTER(Display), Window, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5378
+XSetWMHints = _lib.XSetWMHints
+XSetWMHints.restype = c_int
+XSetWMHints.argtypes = [POINTER(Display), Window, POINTER(XWMHints)]
+
+# /usr/include/X11/Xutil.h:5384
+XSetWMIconName = _lib.XSetWMIconName
+XSetWMIconName.restype = None
+XSetWMIconName.argtypes = [POINTER(Display), Window, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5390
+XSetWMName = _lib.XSetWMName
+XSetWMName.restype = None
+XSetWMName.argtypes = [POINTER(Display), Window, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5396
+XSetWMNormalHints = _lib.XSetWMNormalHints
+XSetWMNormalHints.restype = None
+XSetWMNormalHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints)]
+
+# /usr/include/X11/Xutil.h:5402
+XSetWMProperties = _lib.XSetWMProperties
+XSetWMProperties.restype = None
+XSetWMProperties.argtypes = [POINTER(Display), Window, POINTER(XTextProperty), POINTER(XTextProperty), POINTER(c_char_p), c_int, POINTER(XSizeHints), POINTER(XWMHints), POINTER(XClassHint)]
+
+# /usr/include/X11/Xutil.h:5414
+XmbSetWMProperties = _lib.XmbSetWMProperties
+XmbSetWMProperties.restype = None
+XmbSetWMProperties.argtypes = [POINTER(Display), Window, c_char_p, c_char_p, POINTER(c_char_p), c_int, POINTER(XSizeHints), POINTER(XWMHints), POINTER(XClassHint)]
+
+# /usr/include/X11/Xutil.h:5426
+Xutf8SetWMProperties = _lib.Xutf8SetWMProperties
+Xutf8SetWMProperties.restype = None
+Xutf8SetWMProperties.argtypes = [POINTER(Display), Window, c_char_p, c_char_p, POINTER(c_char_p), c_int, POINTER(XSizeHints), POINTER(XWMHints), POINTER(XClassHint)]
+
+# /usr/include/X11/Xutil.h:5438
+XSetWMSizeHints = _lib.XSetWMSizeHints
+XSetWMSizeHints.restype = None
+XSetWMSizeHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints), Atom]
+
+# /usr/include/X11/Xutil.h:5445
+XSetRegion = _lib.XSetRegion
+XSetRegion.restype = c_int
+XSetRegion.argtypes = [POINTER(Display), GC, Region]
+
+# /usr/include/X11/Xutil.h:5451
+XSetStandardColormap = _lib.XSetStandardColormap
+XSetStandardColormap.restype = None
+XSetStandardColormap.argtypes = [POINTER(Display), Window, POINTER(XStandardColormap), Atom]
+
+# /usr/include/X11/Xutil.h:5458
+XSetZoomHints = _lib.XSetZoomHints
+XSetZoomHints.restype = c_int
+XSetZoomHints.argtypes = [POINTER(Display), Window, POINTER(XSizeHints)]
+
+# /usr/include/X11/Xutil.h:5464
+XShrinkRegion = _lib.XShrinkRegion
+XShrinkRegion.restype = c_int
+XShrinkRegion.argtypes = [Region, c_int, c_int]
+
+# /usr/include/X11/Xutil.h:5470
+XStringListToTextProperty = _lib.XStringListToTextProperty
+XStringListToTextProperty.restype = c_int
+XStringListToTextProperty.argtypes = [POINTER(c_char_p), c_int, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5476
+XSubtractRegion = _lib.XSubtractRegion
+XSubtractRegion.restype = c_int
+XSubtractRegion.argtypes = [Region, Region, Region]
+
+# /usr/include/X11/Xutil.h:5482
+XmbTextListToTextProperty = _lib.XmbTextListToTextProperty
+XmbTextListToTextProperty.restype = c_int
+XmbTextListToTextProperty.argtypes = [POINTER(Display), POINTER(c_char_p), c_int, XICCEncodingStyle, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5490
+XwcTextListToTextProperty = _lib.XwcTextListToTextProperty
+XwcTextListToTextProperty.restype = c_int
+XwcTextListToTextProperty.argtypes = [POINTER(Display), POINTER(c_wchar_p), c_int, XICCEncodingStyle, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5498
+Xutf8TextListToTextProperty = _lib.Xutf8TextListToTextProperty
+Xutf8TextListToTextProperty.restype = c_int
+Xutf8TextListToTextProperty.argtypes = [POINTER(Display), POINTER(c_char_p), c_int, XICCEncodingStyle, POINTER(XTextProperty)]
+
+# /usr/include/X11/Xutil.h:5506
+XwcFreeStringList = _lib.XwcFreeStringList
+XwcFreeStringList.restype = None
+XwcFreeStringList.argtypes = [POINTER(c_wchar_p)]
+
+# /usr/include/X11/Xutil.h:5510
+XTextPropertyToStringList = _lib.XTextPropertyToStringList
+XTextPropertyToStringList.restype = c_int
+XTextPropertyToStringList.argtypes = [POINTER(XTextProperty), POINTER(POINTER(c_char_p)), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5516
+XmbTextPropertyToTextList = _lib.XmbTextPropertyToTextList
+XmbTextPropertyToTextList.restype = c_int
+XmbTextPropertyToTextList.argtypes = [POINTER(Display), POINTER(XTextProperty), POINTER(POINTER(c_char_p)), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5523
+XwcTextPropertyToTextList = _lib.XwcTextPropertyToTextList
+XwcTextPropertyToTextList.restype = c_int
+XwcTextPropertyToTextList.argtypes = [POINTER(Display), POINTER(XTextProperty), POINTER(POINTER(c_wchar_p)), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5530
+Xutf8TextPropertyToTextList = _lib.Xutf8TextPropertyToTextList
+Xutf8TextPropertyToTextList.restype = c_int
+Xutf8TextPropertyToTextList.argtypes = [POINTER(Display), POINTER(XTextProperty), POINTER(POINTER(c_char_p)), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5537
+XUnionRectWithRegion = _lib.XUnionRectWithRegion
+XUnionRectWithRegion.restype = c_int
+XUnionRectWithRegion.argtypes = [POINTER(XRectangle), Region, Region]
+
+# /usr/include/X11/Xutil.h:5543
+XUnionRegion = _lib.XUnionRegion
+XUnionRegion.restype = c_int
+XUnionRegion.argtypes = [Region, Region, Region]
+
+# /usr/include/X11/Xutil.h:5549
+XWMGeometry = _lib.XWMGeometry
+XWMGeometry.restype = c_int
+XWMGeometry.argtypes = [POINTER(Display), c_int, c_char_p, c_char_p, c_uint, POINTER(XSizeHints), POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/Xutil.h:5563
+XXorRegion = _lib.XXorRegion
+XXorRegion.restype = c_int
+XXorRegion.argtypes = [Region, Region, Region]
+
+
+__all__ = ['XlibSpecificationRelease', 'X_PROTOCOL', 'X_PROTOCOL_REVISION',
+'XID', 'Mask', 'Atom', 'VisualID', 'Time', 'Window', 'Drawable', 'Font',
+'Pixmap', 'Cursor', 'Colormap', 'GContext', 'KeySym', 'KeyCode', 'None_',
+'ParentRelative', 'CopyFromParent', 'PointerWindow', 'InputFocus',
+'PointerRoot', 'AnyPropertyType', 'AnyKey', 'AnyButton', 'AllTemporary',
+'CurrentTime', 'NoSymbol', 'NoEventMask', 'KeyPressMask', 'KeyReleaseMask',
+'ButtonPressMask', 'ButtonReleaseMask', 'EnterWindowMask', 'LeaveWindowMask',
+'PointerMotionMask', 'PointerMotionHintMask', 'Button1MotionMask',
+'Button2MotionMask', 'Button3MotionMask', 'Button4MotionMask',
+'Button5MotionMask', 'ButtonMotionMask', 'KeymapStateMask', 'ExposureMask',
+'VisibilityChangeMask', 'StructureNotifyMask', 'ResizeRedirectMask',
+'SubstructureNotifyMask', 'SubstructureRedirectMask', 'FocusChangeMask',
+'PropertyChangeMask', 'ColormapChangeMask', 'OwnerGrabButtonMask', 'KeyPress',
+'KeyRelease', 'ButtonPress', 'ButtonRelease', 'MotionNotify', 'EnterNotify',
+'LeaveNotify', 'FocusIn', 'FocusOut', 'KeymapNotify', 'Expose',
+'GraphicsExpose', 'NoExpose', 'VisibilityNotify', 'CreateNotify',
+'DestroyNotify', 'UnmapNotify', 'MapNotify', 'MapRequest', 'ReparentNotify',
+'ConfigureNotify', 'ConfigureRequest', 'GravityNotify', 'ResizeRequest',
+'CirculateNotify', 'CirculateRequest', 'PropertyNotify', 'SelectionClear',
+'SelectionRequest', 'SelectionNotify', 'ColormapNotify', 'ClientMessage',
+'MappingNotify', 'GenericEvent', 'LASTEvent', 'ShiftMask', 'LockMask',
+'ControlMask', 'Mod1Mask', 'Mod2Mask', 'Mod3Mask', 'Mod4Mask', 'Mod5Mask',
+'ShiftMapIndex', 'LockMapIndex', 'ControlMapIndex', 'Mod1MapIndex',
+'Mod2MapIndex', 'Mod3MapIndex', 'Mod4MapIndex', 'Mod5MapIndex', 'Button1Mask',
+'Button2Mask', 'Button3Mask', 'Button4Mask', 'Button5Mask', 'AnyModifier',
+'Button1', 'Button2', 'Button3', 'Button4', 'Button5', 'NotifyNormal',
+'NotifyGrab', 'NotifyUngrab', 'NotifyWhileGrabbed', 'NotifyHint',
+'NotifyAncestor', 'NotifyVirtual', 'NotifyInferior', 'NotifyNonlinear',
+'NotifyNonlinearVirtual', 'NotifyPointer', 'NotifyPointerRoot',
+'NotifyDetailNone', 'VisibilityUnobscured', 'VisibilityPartiallyObscured',
+'VisibilityFullyObscured', 'PlaceOnTop', 'PlaceOnBottom', 'FamilyInternet',
+'FamilyDECnet', 'FamilyChaos', 'FamilyInternet6', 'FamilyServerInterpreted',
+'PropertyNewValue', 'PropertyDelete', 'ColormapUninstalled',
+'ColormapInstalled', 'GrabModeSync', 'GrabModeAsync', 'GrabSuccess',
+'AlreadyGrabbed', 'GrabInvalidTime', 'GrabNotViewable', 'GrabFrozen',
+'AsyncPointer', 'SyncPointer', 'ReplayPointer', 'AsyncKeyboard',
+'SyncKeyboard', 'ReplayKeyboard', 'AsyncBoth', 'SyncBoth', 'RevertToParent',
+'Success', 'BadRequest', 'BadValue', 'BadWindow', 'BadPixmap', 'BadAtom',
+'BadCursor', 'BadFont', 'BadMatch', 'BadDrawable', 'BadAccess', 'BadAlloc',
+'BadColor', 'BadGC', 'BadIDChoice', 'BadName', 'BadLength',
+'BadImplementation', 'FirstExtensionError', 'LastExtensionError',
+'InputOutput', 'InputOnly', 'CWBackPixmap', 'CWBackPixel', 'CWBorderPixmap',
+'CWBorderPixel', 'CWBitGravity', 'CWWinGravity', 'CWBackingStore',
+'CWBackingPlanes', 'CWBackingPixel', 'CWOverrideRedirect', 'CWSaveUnder',
+'CWEventMask', 'CWDontPropagate', 'CWColormap', 'CWCursor', 'CWX', 'CWY',
+'CWWidth', 'CWHeight', 'CWBorderWidth', 'CWSibling', 'CWStackMode',
+'ForgetGravity', 'NorthWestGravity', 'NorthGravity', 'NorthEastGravity',
+'WestGravity', 'CenterGravity', 'EastGravity', 'SouthWestGravity',
+'SouthGravity', 'SouthEastGravity', 'StaticGravity', 'UnmapGravity',
+'NotUseful', 'WhenMapped', 'Always', 'IsUnmapped', 'IsUnviewable',
+'IsViewable', 'SetModeInsert', 'SetModeDelete', 'DestroyAll',
+'RetainPermanent', 'RetainTemporary', 'Above', 'Below', 'TopIf', 'BottomIf',
+'Opposite', 'RaiseLowest', 'LowerHighest', 'PropModeReplace',
+'PropModePrepend', 'PropModeAppend', 'GXclear', 'GXand', 'GXandReverse',
+'GXcopy', 'GXandInverted', 'GXnoop', 'GXxor', 'GXor', 'GXnor', 'GXequiv',
+'GXinvert', 'GXorReverse', 'GXcopyInverted', 'GXorInverted', 'GXnand',
+'GXset', 'LineSolid', 'LineOnOffDash', 'LineDoubleDash', 'CapNotLast',
+'CapButt', 'CapRound', 'CapProjecting', 'JoinMiter', 'JoinRound', 'JoinBevel',
+'FillSolid', 'FillTiled', 'FillStippled', 'FillOpaqueStippled', 'EvenOddRule',
+'WindingRule', 'ClipByChildren', 'IncludeInferiors', 'Unsorted', 'YSorted',
+'YXSorted', 'YXBanded', 'CoordModeOrigin', 'CoordModePrevious', 'Complex',
+'Nonconvex', 'Convex', 'ArcChord', 'ArcPieSlice', 'GCFunction', 'GCPlaneMask',
+'GCForeground', 'GCBackground', 'GCLineWidth', 'GCLineStyle', 'GCCapStyle',
+'GCJoinStyle', 'GCFillStyle', 'GCFillRule', 'GCTile', 'GCStipple',
+'GCTileStipXOrigin', 'GCTileStipYOrigin', 'GCFont', 'GCSubwindowMode',
+'GCGraphicsExposures', 'GCClipXOrigin', 'GCClipYOrigin', 'GCClipMask',
+'GCDashOffset', 'GCDashList', 'GCArcMode', 'GCLastBit', 'FontLeftToRight',
+'FontRightToLeft', 'FontChange', 'XYBitmap', 'XYPixmap', 'ZPixmap',
+'AllocNone', 'AllocAll', 'DoRed', 'DoGreen', 'DoBlue', 'CursorShape',
+'TileShape', 'StippleShape', 'AutoRepeatModeOff', 'AutoRepeatModeOn',
+'AutoRepeatModeDefault', 'LedModeOff', 'LedModeOn', 'KBKeyClickPercent',
+'KBBellPercent', 'KBBellPitch', 'KBBellDuration', 'KBLed', 'KBLedMode',
+'KBKey', 'KBAutoRepeatMode', 'MappingSuccess', 'MappingBusy', 'MappingFailed',
+'MappingModifier', 'MappingKeyboard', 'MappingPointer', 'DontPreferBlanking',
+'PreferBlanking', 'DefaultBlanking', 'DisableScreenSaver',
+'DisableScreenInterval', 'DontAllowExposures', 'AllowExposures',
+'DefaultExposures', 'ScreenSaverReset', 'ScreenSaverActive', 'HostInsert',
+'HostDelete', 'EnableAccess', 'DisableAccess', 'StaticGray', 'GrayScale',
+'StaticColor', 'PseudoColor', 'TrueColor', 'DirectColor', 'LSBFirst',
+'MSBFirst', '_Xmblen', 'X_HAVE_UTF8_STRING', 'XPointer', 'Bool', 'Status',
+'True_', 'False_', 'QueuedAlready', 'QueuedAfterReading', 'QueuedAfterFlush',
+'XExtData', 'XExtCodes', 'XPixmapFormatValues', 'XGCValues', 'GC', 'Visual',
+'Depth', 'Screen', 'ScreenFormat', 'XSetWindowAttributes',
+'XWindowAttributes', 'XHostAddress', 'XServerInterpretedAddress', 'XImage',
+'XWindowChanges', 'XColor', 'XSegment', 'XPoint', 'XRectangle', 'XArc',
+'XKeyboardControl', 'XKeyboardState', 'XTimeCoord', 'XModifierKeymap',
+'Display', '_XPrivDisplay', 'XKeyEvent', 'XKeyPressedEvent',
+'XKeyReleasedEvent', 'XButtonEvent', 'XButtonPressedEvent',
+'XButtonReleasedEvent', 'XMotionEvent', 'XPointerMovedEvent',
+'XCrossingEvent', 'XEnterWindowEvent', 'XLeaveWindowEvent',
+'XFocusChangeEvent', 'XFocusInEvent', 'XFocusOutEvent', 'XKeymapEvent',
+'XExposeEvent', 'XGraphicsExposeEvent', 'XNoExposeEvent', 'XVisibilityEvent',
+'XCreateWindowEvent', 'XDestroyWindowEvent', 'XUnmapEvent', 'XMapEvent',
+'XMapRequestEvent', 'XReparentEvent', 'XConfigureEvent', 'XGravityEvent',
+'XResizeRequestEvent', 'XConfigureRequestEvent', 'XCirculateEvent',
+'XCirculateRequestEvent', 'XPropertyEvent', 'XSelectionClearEvent',
+'XSelectionRequestEvent', 'XSelectionEvent', 'XColormapEvent',
+'XClientMessageEvent', 'XMappingEvent', 'XErrorEvent', 'XAnyEvent',
+'XGenericEvent', 'XGenericEventCookie', 'XEvent', 'XCharStruct', 'XFontProp',
+'XFontStruct', 'XTextItem', 'XChar2b', 'XTextItem16', 'XEDataObject',
+'XFontSetExtents', 'XOM', 'XOC', 'XFontSet', 'XmbTextItem', 'XwcTextItem',
+'XOMCharSetList', 'XOrientation', 'XOMOrientation_LTR_TTB',
+'XOMOrientation_RTL_TTB', 'XOMOrientation_TTB_LTR', 'XOMOrientation_TTB_RTL',
+'XOMOrientation_Context', 'XOMOrientation', 'XOMFontInfo', 'XIM', 'XIC',
+'XIMProc', 'XICProc', 'XIDProc', 'XIMStyle', 'XIMStyles', 'XIMPreeditArea',
+'XIMPreeditCallbacks', 'XIMPreeditPosition', 'XIMPreeditNothing',
+'XIMPreeditNone', 'XIMStatusArea', 'XIMStatusCallbacks', 'XIMStatusNothing',
+'XIMStatusNone', 'XBufferOverflow', 'XLookupNone', 'XLookupChars',
+'XLookupKeySym', 'XLookupBoth', 'XVaNestedList', 'XIMCallback', 'XICCallback',
+'XIMFeedback', 'XIMReverse', 'XIMUnderline', 'XIMHighlight', 'XIMPrimary',
+'XIMSecondary', 'XIMTertiary', 'XIMVisibleToForward', 'XIMVisibleToBackword',
+'XIMVisibleToCenter', 'XIMText', 'XIMPreeditState', 'XIMPreeditUnKnown',
+'XIMPreeditEnable', 'XIMPreeditDisable',
+'XIMPreeditStateNotifyCallbackStruct', 'XIMResetState', 'XIMInitialState',
+'XIMPreserveState', 'XIMStringConversionFeedback',
+'XIMStringConversionLeftEdge', 'XIMStringConversionRightEdge',
+'XIMStringConversionTopEdge', 'XIMStringConversionBottomEdge',
+'XIMStringConversionConcealed', 'XIMStringConversionWrapped',
+'XIMStringConversionText', 'XIMStringConversionPosition',
+'XIMStringConversionType', 'XIMStringConversionBuffer',
+'XIMStringConversionLine', 'XIMStringConversionWord',
+'XIMStringConversionChar', 'XIMStringConversionOperation',
+'XIMStringConversionSubstitution', 'XIMStringConversionRetrieval',
+'XIMCaretDirection', 'XIMForwardChar', 'XIMBackwardChar', 'XIMForwardWord',
+'XIMBackwardWord', 'XIMCaretUp', 'XIMCaretDown', 'XIMNextLine',
+'XIMPreviousLine', 'XIMLineStart', 'XIMLineEnd', 'XIMAbsolutePosition',
+'XIMDontChange', 'XIMStringConversionCallbackStruct',
+'XIMPreeditDrawCallbackStruct', 'XIMCaretStyle', 'XIMIsInvisible',
+'XIMIsPrimary', 'XIMIsSecondary', 'XIMPreeditCaretCallbackStruct',
+'XIMStatusDataType', 'XIMTextType', 'XIMBitmapType',
+'XIMStatusDrawCallbackStruct', 'XIMHotKeyTrigger', 'XIMHotKeyTriggers',
+'XIMHotKeyState', 'XIMHotKeyStateON', 'XIMHotKeyStateOFF', 'XIMValuesList',
+'XLoadQueryFont', 'XQueryFont', 'XGetMotionEvents', 'XDeleteModifiermapEntry',
+'XGetModifierMapping', 'XInsertModifiermapEntry', 'XNewModifiermap',
+'XCreateImage', 'XInitImage', 'XGetImage', 'XGetSubImage', 'XOpenDisplay',
+'XrmInitialize', 'XFetchBytes', 'XFetchBuffer', 'XGetAtomName',
+'XGetAtomNames', 'XGetDefault', 'XDisplayName', 'XKeysymToString',
+'XSynchronize', 'XSetAfterFunction', 'XInternAtom', 'XInternAtoms',
+'XCopyColormapAndFree', 'XCreateColormap', 'XCreatePixmapCursor',
+'XCreateGlyphCursor', 'XCreateFontCursor', 'XLoadFont', 'XCreateGC',
+'XGContextFromGC', 'XFlushGC', 'XCreatePixmap', 'XCreateBitmapFromData',
+'XCreatePixmapFromBitmapData', 'XCreateSimpleWindow', 'XGetSelectionOwner',
+'XCreateWindow', 'XListInstalledColormaps', 'XListFonts',
+'XListFontsWithInfo', 'XGetFontPath', 'XListExtensions', 'XListProperties',
+'XListHosts', 'XKeycodeToKeysym', 'XLookupKeysym', 'XGetKeyboardMapping',
+'XStringToKeysym', 'XMaxRequestSize', 'XExtendedMaxRequestSize',
+'XResourceManagerString', 'XScreenResourceString', 'XDisplayMotionBufferSize',
+'XVisualIDFromVisual', 'XInitThreads', 'XLockDisplay', 'XUnlockDisplay',
+'XInitExtension', 'XAddExtension', 'XFindOnExtensionList',
+'XEHeadOfExtensionList', 'XRootWindow', 'XDefaultRootWindow',
+'XRootWindowOfScreen', 'XDefaultVisual', 'XDefaultVisualOfScreen',
+'XDefaultGC', 'XDefaultGCOfScreen', 'XBlackPixel', 'XWhitePixel',
+'XAllPlanes', 'XBlackPixelOfScreen', 'XWhitePixelOfScreen', 'XNextRequest',
+'XLastKnownRequestProcessed', 'XServerVendor', 'XDisplayString',
+'XDefaultColormap', 'XDefaultColormapOfScreen', 'XDisplayOfScreen',
+'XScreenOfDisplay', 'XDefaultScreenOfDisplay', 'XEventMaskOfScreen',
+'XScreenNumberOfScreen', 'XErrorHandler', 'XSetErrorHandler',
+'XIOErrorHandler', 'XSetIOErrorHandler', 'XListPixmapFormats', 'XListDepths',
+'XReconfigureWMWindow', 'XGetWMProtocols', 'XSetWMProtocols',
+'XIconifyWindow', 'XWithdrawWindow', 'XGetCommand', 'XGetWMColormapWindows',
+'XSetWMColormapWindows', 'XFreeStringList', 'XSetTransientForHint',
+'XActivateScreenSaver', 'XAddHost', 'XAddHosts', 'XAddToExtensionList',
+'XAddToSaveSet', 'XAllocColor', 'XAllocColorCells', 'XAllocColorPlanes',
+'XAllocNamedColor', 'XAllowEvents', 'XAutoRepeatOff', 'XAutoRepeatOn',
+'XBell', 'XBitmapBitOrder', 'XBitmapPad', 'XBitmapUnit', 'XCellsOfScreen',
+'XChangeActivePointerGrab', 'XChangeGC', 'XChangeKeyboardControl',
+'XChangeKeyboardMapping', 'XChangePointerControl', 'XChangeProperty',
+'XChangeSaveSet', 'XChangeWindowAttributes', 'XCheckIfEvent',
+'XCheckMaskEvent', 'XCheckTypedEvent', 'XCheckTypedWindowEvent',
+'XCheckWindowEvent', 'XCirculateSubwindows', 'XCirculateSubwindowsDown',
+'XCirculateSubwindowsUp', 'XClearArea', 'XClearWindow', 'XCloseDisplay',
+'XConfigureWindow', 'XConnectionNumber', 'XConvertSelection', 'XCopyArea',
+'XCopyGC', 'XCopyPlane', 'XDefaultDepth', 'XDefaultDepthOfScreen',
+'XDefaultScreen', 'XDefineCursor', 'XDeleteProperty', 'XDestroyWindow',
+'XDestroySubwindows', 'XDoesBackingStore', 'XDoesSaveUnders',
+'XDisableAccessControl', 'XDisplayCells', 'XDisplayHeight',
+'XDisplayHeightMM', 'XDisplayKeycodes', 'XDisplayPlanes', 'XDisplayWidth',
+'XDisplayWidthMM', 'XDrawArc', 'XDrawArcs', 'XDrawImageString',
+'XDrawImageString16', 'XDrawLine', 'XDrawLines', 'XDrawPoint', 'XDrawPoints',
+'XDrawRectangle', 'XDrawRectangles', 'XDrawSegments', 'XDrawString',
+'XDrawString16', 'XDrawText', 'XDrawText16', 'XEnableAccessControl',
+'XEventsQueued', 'XFetchName', 'XFillArc', 'XFillArcs', 'XFillPolygon',
+'XFillRectangle', 'XFillRectangles', 'XFlush', 'XForceScreenSaver', 'XFree',
+'XFreeColormap', 'XFreeColors', 'XFreeCursor', 'XFreeExtensionList',
+'XFreeFont', 'XFreeFontInfo', 'XFreeFontNames', 'XFreeFontPath', 'XFreeGC',
+'XFreeModifiermap', 'XFreePixmap', 'XGeometry', 'XGetErrorDatabaseText',
+'XGetErrorText', 'XGetFontProperty', 'XGetGCValues', 'XGetGeometry',
+'XGetIconName', 'XGetInputFocus', 'XGetKeyboardControl', 'XGetPointerControl',
+'XGetPointerMapping', 'XGetScreenSaver', 'XGetTransientForHint',
+'XGetWindowProperty', 'XGetWindowAttributes', 'XGrabButton', 'XGrabKey',
+'XGrabKeyboard', 'XGrabPointer', 'XGrabServer', 'XHeightMMOfScreen',
+'XHeightOfScreen', 'XIfEvent', 'XImageByteOrder', 'XInstallColormap',
+'XKeysymToKeycode', 'XKillClient', 'XLookupColor', 'XLowerWindow',
+'XMapRaised', 'XMapSubwindows', 'XMapWindow', 'XMaskEvent',
+'XMaxCmapsOfScreen', 'XMinCmapsOfScreen', 'XMoveResizeWindow', 'XMoveWindow',
+'XNextEvent', 'XNoOp', 'XParseColor', 'XParseGeometry', 'XPeekEvent',
+'XPeekIfEvent', 'XPending', 'XPlanesOfScreen', 'XProtocolRevision',
+'XProtocolVersion', 'XPutBackEvent', 'XPutImage', 'XQLength',
+'XQueryBestCursor', 'XQueryBestSize', 'XQueryBestStipple', 'XQueryBestTile',
+'XQueryColor', 'XQueryColors', 'XQueryExtension', 'XQueryKeymap',
+'XQueryPointer', 'XQueryTextExtents', 'XQueryTextExtents16', 'XQueryTree',
+'XRaiseWindow', 'XReadBitmapFile', 'XReadBitmapFileData', 'XRebindKeysym',
+'XRecolorCursor', 'XRefreshKeyboardMapping', 'XRemoveFromSaveSet',
+'XRemoveHost', 'XRemoveHosts', 'XReparentWindow', 'XResetScreenSaver',
+'XResizeWindow', 'XRestackWindows', 'XRotateBuffers',
+'XRotateWindowProperties', 'XScreenCount', 'XSelectInput', 'XSendEvent',
+'XSetAccessControl', 'XSetArcMode', 'XSetBackground', 'XSetClipMask',
+'XSetClipOrigin', 'XSetClipRectangles', 'XSetCloseDownMode', 'XSetCommand',
+'XSetDashes', 'XSetFillRule', 'XSetFillStyle', 'XSetFont', 'XSetFontPath',
+'XSetForeground', 'XSetFunction', 'XSetGraphicsExposures', 'XSetIconName',
+'XSetInputFocus', 'XSetLineAttributes', 'XSetModifierMapping',
+'XSetPlaneMask', 'XSetPointerMapping', 'XSetScreenSaver',
+'XSetSelectionOwner', 'XSetState', 'XSetStipple', 'XSetSubwindowMode',
+'XSetTSOrigin', 'XSetTile', 'XSetWindowBackground',
+'XSetWindowBackgroundPixmap', 'XSetWindowBorder', 'XSetWindowBorderPixmap',
+'XSetWindowBorderWidth', 'XSetWindowColormap', 'XStoreBuffer', 'XStoreBytes',
+'XStoreColor', 'XStoreColors', 'XStoreName', 'XStoreNamedColor', 'XSync',
+'XTextExtents', 'XTextExtents16', 'XTextWidth', 'XTextWidth16',
+'XTranslateCoordinates', 'XUndefineCursor', 'XUngrabButton', 'XUngrabKey',
+'XUngrabKeyboard', 'XUngrabPointer', 'XUngrabServer', 'XUninstallColormap',
+'XUnloadFont', 'XUnmapSubwindows', 'XUnmapWindow', 'XVendorRelease',
+'XWarpPointer', 'XWidthMMOfScreen', 'XWidthOfScreen', 'XWindowEvent',
+'XWriteBitmapFile', 'XSupportsLocale', 'XSetLocaleModifiers', 'XOpenOM',
+'XCloseOM', 'XSetOMValues', 'XGetOMValues', 'XDisplayOfOM', 'XLocaleOfOM',
+'XCreateOC', 'XDestroyOC', 'XOMOfOC', 'XSetOCValues', 'XGetOCValues',
+'XCreateFontSet', 'XFreeFontSet', 'XFontsOfFontSet',
+'XBaseFontNameListOfFontSet', 'XLocaleOfFontSet', 'XContextDependentDrawing',
+'XDirectionalDependentDrawing', 'XContextualDrawing', 'XExtentsOfFontSet',
+'XmbTextEscapement', 'XwcTextEscapement', 'Xutf8TextEscapement',
+'XmbTextExtents', 'XwcTextExtents', 'Xutf8TextExtents',
+'XmbTextPerCharExtents', 'XwcTextPerCharExtents', 'Xutf8TextPerCharExtents',
+'XmbDrawText', 'XwcDrawText', 'Xutf8DrawText', 'XmbDrawString',
+'XwcDrawString', 'Xutf8DrawString', 'XmbDrawImageString',
+'XwcDrawImageString', 'Xutf8DrawImageString', 'XOpenIM', 'XCloseIM',
+'XGetIMValues', 'XSetIMValues', 'XDisplayOfIM', 'XLocaleOfIM', 'XCreateIC',
+'XDestroyIC', 'XSetICFocus', 'XUnsetICFocus', 'XwcResetIC', 'XmbResetIC',
+'Xutf8ResetIC', 'XSetICValues', 'XGetICValues', 'XIMOfIC', 'XFilterEvent',
+'XmbLookupString', 'XwcLookupString', 'Xutf8LookupString',
+'XVaCreateNestedList', 'XRegisterIMInstantiateCallback',
+'XUnregisterIMInstantiateCallback', 'XConnectionWatchProc',
+'XInternalConnectionNumbers', 'XProcessInternalConnection',
+'XAddConnectionWatch', 'XRemoveConnectionWatch', 'XSetAuthorization',
+'_Xmbtowc', '_Xwctomb', 'XGetEventData', 'XFreeEventData', 'NoValue',
+'XValue', 'YValue', 'WidthValue', 'HeightValue', 'AllValues', 'XNegative',
+'YNegative', 'XSizeHints', 'USPosition', 'USSize', 'PPosition', 'PSize',
+'PMinSize', 'PMaxSize', 'PResizeInc', 'PAspect', 'PBaseSize', 'PWinGravity',
+'PAllHints', 'XWMHints', 'InputHint', 'StateHint', 'IconPixmapHint',
+'IconWindowHint', 'IconPositionHint', 'IconMaskHint', 'WindowGroupHint',
+'AllHints', 'XUrgencyHint', 'WithdrawnState', 'NormalState', 'IconicState',
+'DontCareState', 'ZoomState', 'InactiveState', 'XTextProperty', 'XNoMemory',
+'XLocaleNotSupported', 'XConverterNotFound', 'XICCEncodingStyle',
+'XStringStyle', 'XCompoundTextStyle', 'XTextStyle', 'XStdICCTextStyle',
+'XUTF8StringStyle', 'XIconSize', 'XClassHint', 'XComposeStatus', 'Region',
+'RectangleOut', 'RectangleIn', 'RectanglePart', 'XVisualInfo', 'VisualNoMask',
+'VisualIDMask', 'VisualScreenMask', 'VisualDepthMask', 'VisualClassMask',
+'VisualRedMaskMask', 'VisualGreenMaskMask', 'VisualBlueMaskMask',
+'VisualColormapSizeMask', 'VisualBitsPerRGBMask', 'VisualAllMask',
+'XStandardColormap', 'BitmapSuccess', 'BitmapOpenFailed', 'BitmapFileInvalid',
+'BitmapNoMemory', 'XCSUCCESS', 'XCNOMEM', 'XCNOENT', 'XContext',
+'XAllocClassHint', 'XAllocIconSize', 'XAllocSizeHints',
+'XAllocStandardColormap', 'XAllocWMHints', 'XClipBox', 'XCreateRegion',
+'XDefaultString', 'XDeleteContext', 'XDestroyRegion', 'XEmptyRegion',
+'XEqualRegion', 'XFindContext', 'XGetClassHint', 'XGetIconSizes',
+'XGetNormalHints', 'XGetRGBColormaps', 'XGetSizeHints',
+'XGetStandardColormap', 'XGetTextProperty', 'XGetVisualInfo',
+'XGetWMClientMachine', 'XGetWMHints', 'XGetWMIconName', 'XGetWMName',
+'XGetWMNormalHints', 'XGetWMSizeHints', 'XGetZoomHints', 'XIntersectRegion',
+'XConvertCase', 'XLookupString', 'XMatchVisualInfo', 'XOffsetRegion',
+'XPointInRegion', 'XPolygonRegion', 'XRectInRegion', 'XSaveContext',
+'XSetClassHint', 'XSetIconSizes', 'XSetNormalHints', 'XSetRGBColormaps',
+'XSetSizeHints', 'XSetStandardProperties', 'XSetTextProperty',
+'XSetWMClientMachine', 'XSetWMHints', 'XSetWMIconName', 'XSetWMName',
+'XSetWMNormalHints', 'XSetWMProperties', 'XmbSetWMProperties',
+'Xutf8SetWMProperties', 'XSetWMSizeHints', 'XSetRegion',
+'XSetStandardColormap', 'XSetZoomHints', 'XShrinkRegion',
+'XStringListToTextProperty', 'XSubtractRegion', 'XmbTextListToTextProperty',
+'XwcTextListToTextProperty', 'Xutf8TextListToTextProperty',
+'XwcFreeStringList', 'XTextPropertyToStringList', 'XmbTextPropertyToTextList',
+'XwcTextPropertyToTextList', 'Xutf8TextPropertyToTextList',
+'XUnionRectWithRegion', 'XUnionRegion', 'XWMGeometry', 'XXorRegion']
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xsync.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xsync.py
new file mode 100644
index 0000000000000000000000000000000000000000..a265dbf8fb0ced5eaa147eeafa10ee1ca64d1997
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/libs/x11/xsync.py
@@ -0,0 +1,435 @@
+"""Wrapper for Xext
+
+Generated with:
+tools/genwrappers.py xsync
+
+Do not modify this file.
+"""
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('Xext')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+# XXX DODGY relative import of xlib.py, which contains XID etc definitions.
+# can't use wrapped import which gave
+# import pyglet.window.xlib.xlib
+# because Python has the lamest import semantics and can't handle that kind of
+# recursive import, even though it's the same as
+from . import xlib
+
+SYNC_MAJOR_VERSION = 3 # /usr/include/X11/extensions/sync.h:4901
+SYNC_MINOR_VERSION = 0 # /usr/include/X11/extensions/sync.h:4902
+X_SyncInitialize = 0 # /usr/include/X11/extensions/sync.h:4904
+X_SyncListSystemCounters = 1 # /usr/include/X11/extensions/sync.h:4905
+X_SyncCreateCounter = 2 # /usr/include/X11/extensions/sync.h:4906
+X_SyncSetCounter = 3 # /usr/include/X11/extensions/sync.h:4907
+X_SyncChangeCounter = 4 # /usr/include/X11/extensions/sync.h:4908
+X_SyncQueryCounter = 5 # /usr/include/X11/extensions/sync.h:4909
+X_SyncDestroyCounter = 6 # /usr/include/X11/extensions/sync.h:4910
+X_SyncAwait = 7 # /usr/include/X11/extensions/sync.h:4911
+X_SyncCreateAlarm = 8 # /usr/include/X11/extensions/sync.h:4912
+X_SyncChangeAlarm = 9 # /usr/include/X11/extensions/sync.h:4913
+X_SyncQueryAlarm = 10 # /usr/include/X11/extensions/sync.h:4914
+X_SyncDestroyAlarm = 11 # /usr/include/X11/extensions/sync.h:4915
+X_SyncSetPriority = 12 # /usr/include/X11/extensions/sync.h:4916
+X_SyncGetPriority = 13 # /usr/include/X11/extensions/sync.h:4917
+XSyncCounterNotify = 0 # /usr/include/X11/extensions/sync.h:4919
+XSyncAlarmNotify = 1 # /usr/include/X11/extensions/sync.h:4920
+XSyncAlarmNotifyMask = 2 # /usr/include/X11/extensions/sync.h:4921
+XSyncNumberEvents = 2 # /usr/include/X11/extensions/sync.h:4923
+XSyncBadCounter = 0 # /usr/include/X11/extensions/sync.h:4925
+XSyncBadAlarm = 1 # /usr/include/X11/extensions/sync.h:4926
+XSyncNumberErrors = 2 # /usr/include/X11/extensions/sync.h:4927
+XSyncCACounter = 1 # /usr/include/X11/extensions/sync.h:4932
+XSyncCAValueType = 2 # /usr/include/X11/extensions/sync.h:4933
+XSyncCAValue = 4 # /usr/include/X11/extensions/sync.h:4934
+XSyncCATestType = 8 # /usr/include/X11/extensions/sync.h:4935
+XSyncCADelta = 16 # /usr/include/X11/extensions/sync.h:4936
+XSyncCAEvents = 32 # /usr/include/X11/extensions/sync.h:4937
+enum_anon_93 = c_int
+XSyncAbsolute = 0
+XSyncRelative = 1
+XSyncValueType = enum_anon_93 # /usr/include/X11/extensions/sync.h:4945
+enum_anon_94 = c_int
+XSyncPositiveTransition = 0
+XSyncNegativeTransition = 1
+XSyncPositiveComparison = 2
+XSyncNegativeComparison = 3
+XSyncTestType = enum_anon_94 # /usr/include/X11/extensions/sync.h:4955
+enum_anon_95 = c_int
+XSyncAlarmActive = 0
+XSyncAlarmInactive = 1
+XSyncAlarmDestroyed = 2
+XSyncAlarmState = enum_anon_95 # /usr/include/X11/extensions/sync.h:4964
+XID = xlib.XID
+XSyncCounter = XID # /usr/include/X11/extensions/sync.h:4967
+XSyncAlarm = XID # /usr/include/X11/extensions/sync.h:4968
+class struct__XSyncValue(Structure):
+ __slots__ = [
+ 'hi',
+ 'lo',
+ ]
+struct__XSyncValue._fields_ = [
+ ('hi', c_int),
+ ('lo', c_uint),
+]
+
+XSyncValue = struct__XSyncValue # /usr/include/X11/extensions/sync.h:4972
+# /usr/include/X11/extensions/sync.h:4980
+XSyncIntToValue = _lib.XSyncIntToValue
+XSyncIntToValue.restype = None
+XSyncIntToValue.argtypes = [POINTER(XSyncValue), c_int]
+
+# /usr/include/X11/extensions/sync.h:4985
+XSyncIntsToValue = _lib.XSyncIntsToValue
+XSyncIntsToValue.restype = None
+XSyncIntsToValue.argtypes = [POINTER(XSyncValue), c_uint, c_int]
+
+Bool = xlib.Bool
+# /usr/include/X11/extensions/sync.h:4991
+XSyncValueGreaterThan = _lib.XSyncValueGreaterThan
+XSyncValueGreaterThan.restype = Bool
+XSyncValueGreaterThan.argtypes = [XSyncValue, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:4996
+XSyncValueLessThan = _lib.XSyncValueLessThan
+XSyncValueLessThan.restype = Bool
+XSyncValueLessThan.argtypes = [XSyncValue, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5001
+XSyncValueGreaterOrEqual = _lib.XSyncValueGreaterOrEqual
+XSyncValueGreaterOrEqual.restype = Bool
+XSyncValueGreaterOrEqual.argtypes = [XSyncValue, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5006
+XSyncValueLessOrEqual = _lib.XSyncValueLessOrEqual
+XSyncValueLessOrEqual.restype = Bool
+XSyncValueLessOrEqual.argtypes = [XSyncValue, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5011
+XSyncValueEqual = _lib.XSyncValueEqual
+XSyncValueEqual.restype = Bool
+XSyncValueEqual.argtypes = [XSyncValue, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5016
+XSyncValueIsNegative = _lib.XSyncValueIsNegative
+XSyncValueIsNegative.restype = Bool
+XSyncValueIsNegative.argtypes = [XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5020
+XSyncValueIsZero = _lib.XSyncValueIsZero
+XSyncValueIsZero.restype = Bool
+XSyncValueIsZero.argtypes = [XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5024
+XSyncValueIsPositive = _lib.XSyncValueIsPositive
+XSyncValueIsPositive.restype = Bool
+XSyncValueIsPositive.argtypes = [XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5028
+XSyncValueLow32 = _lib.XSyncValueLow32
+XSyncValueLow32.restype = c_uint
+XSyncValueLow32.argtypes = [XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5032
+XSyncValueHigh32 = _lib.XSyncValueHigh32
+XSyncValueHigh32.restype = c_int
+XSyncValueHigh32.argtypes = [XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5036
+XSyncValueAdd = _lib.XSyncValueAdd
+XSyncValueAdd.restype = None
+XSyncValueAdd.argtypes = [POINTER(XSyncValue), XSyncValue, XSyncValue, POINTER(c_int)]
+
+# /usr/include/X11/extensions/sync.h:5043
+XSyncValueSubtract = _lib.XSyncValueSubtract
+XSyncValueSubtract.restype = None
+XSyncValueSubtract.argtypes = [POINTER(XSyncValue), XSyncValue, XSyncValue, POINTER(c_int)]
+
+# /usr/include/X11/extensions/sync.h:5050
+XSyncMaxValue = _lib.XSyncMaxValue
+XSyncMaxValue.restype = None
+XSyncMaxValue.argtypes = [POINTER(XSyncValue)]
+
+# /usr/include/X11/extensions/sync.h:5054
+XSyncMinValue = _lib.XSyncMinValue
+XSyncMinValue.restype = None
+XSyncMinValue.argtypes = [POINTER(XSyncValue)]
+
+class struct__XSyncSystemCounter(Structure):
+ __slots__ = [
+ 'name',
+ 'counter',
+ 'resolution',
+ ]
+struct__XSyncSystemCounter._fields_ = [
+ ('name', c_char_p),
+ ('counter', XSyncCounter),
+ ('resolution', XSyncValue),
+]
+
+XSyncSystemCounter = struct__XSyncSystemCounter # /usr/include/X11/extensions/sync.h:5131
+class struct_anon_96(Structure):
+ __slots__ = [
+ 'counter',
+ 'value_type',
+ 'wait_value',
+ 'test_type',
+ ]
+struct_anon_96._fields_ = [
+ ('counter', XSyncCounter),
+ ('value_type', XSyncValueType),
+ ('wait_value', XSyncValue),
+ ('test_type', XSyncTestType),
+]
+
+XSyncTrigger = struct_anon_96 # /usr/include/X11/extensions/sync.h:5139
+class struct_anon_97(Structure):
+ __slots__ = [
+ 'trigger',
+ 'event_threshold',
+ ]
+struct_anon_97._fields_ = [
+ ('trigger', XSyncTrigger),
+ ('event_threshold', XSyncValue),
+]
+
+XSyncWaitCondition = struct_anon_97 # /usr/include/X11/extensions/sync.h:5144
+class struct_anon_98(Structure):
+ __slots__ = [
+ 'trigger',
+ 'delta',
+ 'events',
+ 'state',
+ ]
+struct_anon_98._fields_ = [
+ ('trigger', XSyncTrigger),
+ ('delta', XSyncValue),
+ ('events', Bool),
+ ('state', XSyncAlarmState),
+]
+
+XSyncAlarmAttributes = struct_anon_98 # /usr/include/X11/extensions/sync.h:5152
+class struct_anon_99(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'counter',
+ 'wait_value',
+ 'counter_value',
+ 'time',
+ 'count',
+ 'destroyed',
+ ]
+Display = xlib.Display
+Time = xlib.Time
+struct_anon_99._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', Bool),
+ ('display', POINTER(Display)),
+ ('counter', XSyncCounter),
+ ('wait_value', XSyncValue),
+ ('counter_value', XSyncValue),
+ ('time', Time),
+ ('count', c_int),
+ ('destroyed', Bool),
+]
+
+XSyncCounterNotifyEvent = struct_anon_99 # /usr/include/X11/extensions/sync.h:5169
+class struct_anon_100(Structure):
+ __slots__ = [
+ 'type',
+ 'serial',
+ 'send_event',
+ 'display',
+ 'alarm',
+ 'counter_value',
+ 'alarm_value',
+ 'time',
+ 'state',
+ ]
+struct_anon_100._fields_ = [
+ ('type', c_int),
+ ('serial', c_ulong),
+ ('send_event', Bool),
+ ('display', POINTER(Display)),
+ ('alarm', XSyncAlarm),
+ ('counter_value', XSyncValue),
+ ('alarm_value', XSyncValue),
+ ('time', Time),
+ ('state', XSyncAlarmState),
+]
+
+XSyncAlarmNotifyEvent = struct_anon_100 # /usr/include/X11/extensions/sync.h:5181
+class struct_anon_101(Structure):
+ __slots__ = [
+ 'type',
+ 'display',
+ 'alarm',
+ 'serial',
+ 'error_code',
+ 'request_code',
+ 'minor_code',
+ ]
+struct_anon_101._fields_ = [
+ ('type', c_int),
+ ('display', POINTER(Display)),
+ ('alarm', XSyncAlarm),
+ ('serial', c_ulong),
+ ('error_code', c_ubyte),
+ ('request_code', c_ubyte),
+ ('minor_code', c_ubyte),
+]
+
+XSyncAlarmError = struct_anon_101 # /usr/include/X11/extensions/sync.h:5195
+class struct_anon_102(Structure):
+ __slots__ = [
+ 'type',
+ 'display',
+ 'counter',
+ 'serial',
+ 'error_code',
+ 'request_code',
+ 'minor_code',
+ ]
+struct_anon_102._fields_ = [
+ ('type', c_int),
+ ('display', POINTER(Display)),
+ ('counter', XSyncCounter),
+ ('serial', c_ulong),
+ ('error_code', c_ubyte),
+ ('request_code', c_ubyte),
+ ('minor_code', c_ubyte),
+]
+
+XSyncCounterError = struct_anon_102 # /usr/include/X11/extensions/sync.h:5205
+# /usr/include/X11/extensions/sync.h:5213
+XSyncQueryExtension = _lib.XSyncQueryExtension
+XSyncQueryExtension.restype = c_int
+XSyncQueryExtension.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/sync.h:5219
+XSyncInitialize = _lib.XSyncInitialize
+XSyncInitialize.restype = c_int
+XSyncInitialize.argtypes = [POINTER(Display), POINTER(c_int), POINTER(c_int)]
+
+# /usr/include/X11/extensions/sync.h:5225
+XSyncListSystemCounters = _lib.XSyncListSystemCounters
+XSyncListSystemCounters.restype = POINTER(XSyncSystemCounter)
+XSyncListSystemCounters.argtypes = [POINTER(Display), POINTER(c_int)]
+
+# /usr/include/X11/extensions/sync.h:5230
+XSyncFreeSystemCounterList = _lib.XSyncFreeSystemCounterList
+XSyncFreeSystemCounterList.restype = None
+XSyncFreeSystemCounterList.argtypes = [POINTER(XSyncSystemCounter)]
+
+# /usr/include/X11/extensions/sync.h:5234
+XSyncCreateCounter = _lib.XSyncCreateCounter
+XSyncCreateCounter.restype = XSyncCounter
+XSyncCreateCounter.argtypes = [POINTER(Display), XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5239
+XSyncSetCounter = _lib.XSyncSetCounter
+XSyncSetCounter.restype = c_int
+XSyncSetCounter.argtypes = [POINTER(Display), XSyncCounter, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5245
+XSyncChangeCounter = _lib.XSyncChangeCounter
+XSyncChangeCounter.restype = c_int
+XSyncChangeCounter.argtypes = [POINTER(Display), XSyncCounter, XSyncValue]
+
+# /usr/include/X11/extensions/sync.h:5251
+XSyncDestroyCounter = _lib.XSyncDestroyCounter
+XSyncDestroyCounter.restype = c_int
+XSyncDestroyCounter.argtypes = [POINTER(Display), XSyncCounter]
+
+# /usr/include/X11/extensions/sync.h:5256
+XSyncQueryCounter = _lib.XSyncQueryCounter
+XSyncQueryCounter.restype = c_int
+XSyncQueryCounter.argtypes = [POINTER(Display), XSyncCounter, POINTER(XSyncValue)]
+
+# /usr/include/X11/extensions/sync.h:5262
+XSyncAwait = _lib.XSyncAwait
+XSyncAwait.restype = c_int
+XSyncAwait.argtypes = [POINTER(Display), POINTER(XSyncWaitCondition), c_int]
+
+# /usr/include/X11/extensions/sync.h:5268
+XSyncCreateAlarm = _lib.XSyncCreateAlarm
+XSyncCreateAlarm.restype = XSyncAlarm
+XSyncCreateAlarm.argtypes = [POINTER(Display), c_ulong, POINTER(XSyncAlarmAttributes)]
+
+# /usr/include/X11/extensions/sync.h:5274
+XSyncDestroyAlarm = _lib.XSyncDestroyAlarm
+XSyncDestroyAlarm.restype = c_int
+XSyncDestroyAlarm.argtypes = [POINTER(Display), XSyncAlarm]
+
+# /usr/include/X11/extensions/sync.h:5279
+XSyncQueryAlarm = _lib.XSyncQueryAlarm
+XSyncQueryAlarm.restype = c_int
+XSyncQueryAlarm.argtypes = [POINTER(Display), XSyncAlarm, POINTER(XSyncAlarmAttributes)]
+
+# /usr/include/X11/extensions/sync.h:5285
+XSyncChangeAlarm = _lib.XSyncChangeAlarm
+XSyncChangeAlarm.restype = c_int
+XSyncChangeAlarm.argtypes = [POINTER(Display), XSyncAlarm, c_ulong, POINTER(XSyncAlarmAttributes)]
+
+# /usr/include/X11/extensions/sync.h:5292
+XSyncSetPriority = _lib.XSyncSetPriority
+XSyncSetPriority.restype = c_int
+XSyncSetPriority.argtypes = [POINTER(Display), XID, c_int]
+
+# /usr/include/X11/extensions/sync.h:5298
+XSyncGetPriority = _lib.XSyncGetPriority
+XSyncGetPriority.restype = c_int
+XSyncGetPriority.argtypes = [POINTER(Display), XID, POINTER(c_int)]
+
+
+__all__ = ['SYNC_MAJOR_VERSION', 'SYNC_MINOR_VERSION', 'X_SyncInitialize',
+'X_SyncListSystemCounters', 'X_SyncCreateCounter', 'X_SyncSetCounter',
+'X_SyncChangeCounter', 'X_SyncQueryCounter', 'X_SyncDestroyCounter',
+'X_SyncAwait', 'X_SyncCreateAlarm', 'X_SyncChangeAlarm', 'X_SyncQueryAlarm',
+'X_SyncDestroyAlarm', 'X_SyncSetPriority', 'X_SyncGetPriority',
+'XSyncCounterNotify', 'XSyncAlarmNotify', 'XSyncAlarmNotifyMask',
+'XSyncNumberEvents', 'XSyncBadCounter', 'XSyncBadAlarm', 'XSyncNumberErrors',
+'XSyncCACounter', 'XSyncCAValueType', 'XSyncCAValue', 'XSyncCATestType',
+'XSyncCADelta', 'XSyncCAEvents', 'XSyncValueType', 'XSyncAbsolute',
+'XSyncRelative', 'XSyncTestType', 'XSyncPositiveTransition',
+'XSyncNegativeTransition', 'XSyncPositiveComparison',
+'XSyncNegativeComparison', 'XSyncAlarmState', 'XSyncAlarmActive',
+'XSyncAlarmInactive', 'XSyncAlarmDestroyed', 'XSyncCounter', 'XSyncAlarm',
+'XSyncValue', 'XSyncIntToValue', 'XSyncIntsToValue', 'XSyncValueGreaterThan',
+'XSyncValueLessThan', 'XSyncValueGreaterOrEqual', 'XSyncValueLessOrEqual',
+'XSyncValueEqual', 'XSyncValueIsNegative', 'XSyncValueIsZero',
+'XSyncValueIsPositive', 'XSyncValueLow32', 'XSyncValueHigh32',
+'XSyncValueAdd', 'XSyncValueSubtract', 'XSyncMaxValue', 'XSyncMinValue',
+'XSyncSystemCounter', 'XSyncTrigger', 'XSyncWaitCondition',
+'XSyncAlarmAttributes', 'XSyncCounterNotifyEvent', 'XSyncAlarmNotifyEvent',
+'XSyncAlarmError', 'XSyncCounterError', 'XSyncQueryExtension',
+'XSyncInitialize', 'XSyncListSystemCounters', 'XSyncFreeSystemCounterList',
+'XSyncCreateCounter', 'XSyncSetCounter', 'XSyncChangeCounter',
+'XSyncDestroyCounter', 'XSyncQueryCounter', 'XSyncAwait', 'XSyncCreateAlarm',
+'XSyncDestroyAlarm', 'XSyncQueryAlarm', 'XSyncChangeAlarm',
+'XSyncSetPriority', 'XSyncGetPriority']
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/math.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/math.py
new file mode 100644
index 0000000000000000000000000000000000000000..664780899740cd5e2ebb47a699b98dfd127e80bf
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/math.py
@@ -0,0 +1,1038 @@
+"""Matrix and Vector math.
+
+This module provides Vector and Matrix objects, including Vec2, Vec3,
+Vec4, Mat3, and Mat4. Most common matrix and vector operations are
+supported. Helper methods are included for rotating, scaling, and
+transforming. The :py:class:`~pyglet.matrix.Mat4` includes class methods
+for creating orthographic and perspective projection matrixes.
+
+Matrices behave just like they do in GLSL: they are specified in column-major
+order and multiply on the left of vectors, which are treated as columns.
+
+:note: For performance, Matrixes subclass the `tuple` type. They
+ are therefore immutable - all operations return a new object;
+ the object is not updated in-place.
+"""
+
+from __future__ import annotations
+
+import math as _math
+import typing as _typing
+import warnings as _warnings
+
+from operator import mul as _mul
+from collections.abc import Iterable as _Iterable
+from collections.abc import Iterator as _Iterator
+
+
+number = _typing.Union[float, int]
+Mat4T = _typing.TypeVar("Mat4T", bound="Mat4")
+
+
+def clamp(num: float, min_val: float, max_val: float) -> float:
+ return max(min(num, max_val), min_val)
+
+
+class Vec2:
+ __slots__ = 'x', 'y'
+
+ """A two-dimensional vector represented as an X Y coordinate pair."""
+
+ def __init__(self, x: number = 0.0, y: number = 0.0) -> None:
+ self.x = x
+ self.y = y
+
+ def __iter__(self) -> _Iterator[float]:
+ yield self.x
+ yield self.y
+
+ @_typing.overload
+ def __getitem__(self, item: int) -> float:
+ ...
+
+ @_typing.overload
+ def __getitem__(self, item: slice) -> tuple[float, ...]:
+ ...
+
+ def __getitem__(self, item):
+ return (self.x, self.y)[item]
+
+ def __setitem__(self, key, value):
+ if type(key) is slice:
+ for i, attr in enumerate(['x', 'y'][key]):
+ setattr(self, attr, value[i])
+ else:
+ setattr(self, ['x', 'y'][key], value)
+
+ def __len__(self) -> int:
+ return 2
+
+ def __add__(self, other: Vec2) -> Vec2:
+ return Vec2(self.x + other.x, self.y + other.y)
+
+ def __sub__(self, other: Vec2) -> Vec2:
+ return Vec2(self.x - other.x, self.y - other.y)
+
+ def __mul__(self, scalar: number) -> Vec2:
+ return Vec2(self.x * scalar, self.y * scalar)
+
+ def __truediv__(self, scalar: number) -> Vec2:
+ return Vec2(self.x / scalar, self.y / scalar)
+
+ def __floordiv__(self, scalar: number) -> Vec2:
+ return Vec2(self.x // scalar, self.y // scalar)
+
+ def __abs__(self) -> float:
+ return _math.sqrt(self.x ** 2 + self.y ** 2)
+
+ def __neg__(self) -> Vec2:
+ return Vec2(-self.x, -self.y)
+
+ def __round__(self, ndigits: int | None = None) -> Vec2:
+ return Vec2(*(round(v, ndigits) for v in self))
+
+ def __radd__(self, other: Vec2 | int) -> Vec2:
+ """Reverse add. Required for functionality with sum()
+ """
+ if other == 0:
+ return self
+ else:
+ return self.__add__(_typing.cast(Vec2, other))
+
+ def __eq__(self, other: object) -> bool:
+ return isinstance(other, Vec2) and self.x == other.x and self.y == other.y
+
+ def __ne__(self, other: object) -> bool:
+ return not isinstance(other, Vec2) or self.x != other.x or self.y != other.y
+
+ @staticmethod
+ def from_polar(mag: float, angle: float) -> Vec2:
+ """Create a new vector from the given polar coordinates.
+
+ :parameters:
+ `mag` : int or float :
+ The magnitude of the vector.
+ `angle` : int or float :
+ The angle of the vector in radians.
+
+ :returns: A new vector with the given angle and magnitude.
+ :rtype: Vec2
+ """
+ return Vec2(mag * _math.cos(angle), mag * _math.sin(angle))
+
+ def from_magnitude(self, magnitude: float) -> Vec2:
+ """Create a new Vector of the given magnitude by normalizing,
+ then scaling the vector. The heading remains unchanged.
+
+ :parameters:
+ `magnitude` : int or float :
+ The magnitude of the new vector.
+
+ :returns: A new vector with the magnitude.
+ :rtype: Vec2
+ """
+ return self.normalize() * magnitude
+
+ def from_heading(self, heading: float) -> Vec2:
+ """Create a new vector of the same magnitude with the given heading. I.e. Rotate the vector to the heading.
+
+ :parameters:
+ `heading` : int or float :
+ The angle of the new vector in radians.
+
+ :returns: A new vector with the given heading.
+ :rtype: Vec2
+ """
+ mag = self.__abs__()
+ return Vec2(mag * _math.cos(heading), mag * _math.sin(heading))
+
+ @property
+ def heading(self) -> float:
+ """The angle of the vector in radians.
+
+ :type: float
+ """
+ return _math.atan2(self.y, self.x)
+
+ @property
+ def mag(self) -> float:
+ """The magnitude, or length of the vector. The distance between the coordinates and the origin.
+
+ Alias of abs(self).
+
+ :type: float
+ """
+ return self.__abs__()
+
+ def limit(self, maximum: float) -> Vec2:
+ """Limit the magnitude of the vector to the value used for the max parameter.
+
+ :parameters:
+ `maximum` : int or float :
+ The maximum magnitude for the vector.
+
+ :returns: Either self or a new vector with the maximum magnitude.
+ :rtype: Vec2
+ """
+ if self.x ** 2 + self.y ** 2 > maximum * maximum:
+ return self.from_magnitude(maximum)
+ return self
+
+ def lerp(self, other: Vec2, alpha: float) -> Vec2:
+ """Create a new Vec2 linearly interpolated between this vector and another Vec2.
+
+ :parameters:
+ `other` : Vec2 :
+ The vector to linearly interpolate with.
+ `alpha` : float or int :
+ The amount of interpolation.
+ Some value between 0.0 (this vector) and 1.0 (other vector).
+ 0.5 is halfway inbetween.
+
+ :returns: A new interpolated vector.
+ :rtype: Vec2
+ """
+ return Vec2(self.x + (alpha * (other.x - self.x)),
+ self.y + (alpha * (other.y - self.y)))
+
+ def reflect(self, normal: Vec2) -> Vec2:
+ """Create a new Vec2 reflected (ricochet) from the given normal."""
+ return self - normal * 2 * normal.dot(self)
+
+ def rotate(self, angle: float) -> Vec2:
+ """Create a new Vector rotated by the angle. The magnitude remains unchanged.
+
+ :parameters:
+ `angle` : int or float :
+ The angle to rotate by
+
+ :returns: A new rotated vector of the same magnitude.
+ :rtype: Vec2
+ """
+ s = _math.sin(angle)
+ c = _math.cos(angle)
+ return Vec2(c * self.x - s * self.y, s * self.x + c * self.y)
+
+ def distance(self, other: Vec2) -> float:
+ """Calculate the distance between this vector and another 2D vector."""
+ return _math.sqrt(((other.x - self.x) ** 2) + ((other.y - self.y) ** 2))
+
+ def normalize(self) -> Vec2:
+ """Normalize the vector to have a magnitude of 1. i.e. make it a unit vector.
+
+ :returns: A unit vector with the same heading.
+ :rtype: Vec2
+ """
+ d = self.__abs__()
+ if d:
+ return Vec2(self.x / d, self.y / d)
+ return self
+
+ def clamp(self, min_val: float, max_val: float) -> Vec2:
+ """Restrict the value of the X and Y components of the vector to be within the given values.
+
+ :parameters:
+ `min_val` : int or float :
+ The minimum value
+ `max_val` : int or float :
+ The maximum value
+
+ :returns: A new vector with clamped X and Y components.
+ :rtype: Vec2
+ """
+ return Vec2(clamp(self.x, min_val, max_val), clamp(self.y, min_val, max_val))
+
+ def dot(self, other: Vec2) -> float:
+ """Calculate the dot product of this vector and another 2D vector.
+
+ :parameters:
+ `other` : Vec2 :
+ The other vector.
+
+ :returns: The dot product of the two vectors.
+ :rtype: float
+ """
+ return self.x * other.x + self.y * other.y
+
+ def __getattr__(self, attrs: str) -> Vec2 | Vec3 | Vec4:
+ try:
+ # Allow swizzled getting of attrs
+ vec_class = {2: Vec2, 3: Vec3, 4: Vec4}[len(attrs)]
+ return vec_class(*(self['xy'.index(c)] for c in attrs))
+ except Exception:
+ raise AttributeError(
+ f"'{self.__class__.__name__}' object has no attribute '{attrs}'"
+ ) from None
+
+ def __repr__(self) -> str:
+ return f"Vec2({self.x}, {self.y})"
+
+
+class Vec3:
+ __slots__ = 'x', 'y', 'z'
+
+ """A three-dimensional vector represented as X Y Z coordinates."""
+
+ def __init__(self, x: number = 0.0, y: number = 0.0, z: number = 0.0) -> None:
+ self.x = x
+ self.y = y
+ self.z = z
+
+ def __iter__(self) -> _Iterator[float]:
+ yield self.x
+ yield self.y
+ yield self.z
+
+ @_typing.overload
+ def __getitem__(self, item: int) -> float:
+ ...
+
+ @_typing.overload
+ def __getitem__(self, item: slice) -> tuple[float, ...]:
+ ...
+
+ def __getitem__(self, item):
+ return (self.x, self.y, self.z)[item]
+
+ def __setitem__(self, key, value):
+ if type(key) is slice:
+ for i, attr in enumerate(['x', 'y', 'z'][key]):
+ setattr(self, attr, value[i])
+ else:
+ setattr(self, ['x', 'y', 'z'][key], value)
+
+ def __len__(self) -> int:
+ return 3
+
+ @property
+ def mag(self) -> float:
+ """The magnitude, or length of the vector. The distance between the coordinates and the origin.
+
+ Alias of abs(self).
+
+ :type: float
+ """
+ return self.__abs__()
+
+ def __add__(self, other: Vec3) -> Vec3:
+ return Vec3(self.x + other.x, self.y + other.y, self.z + other.z)
+
+ def __sub__(self, other: Vec3) -> Vec3:
+ return Vec3(self.x - other.x, self.y - other.y, self.z - other.z)
+
+ def __mul__(self, scalar: number) -> Vec3:
+ return Vec3(self.x * scalar, self.y * scalar, self.z * scalar)
+
+ def __truediv__(self, scalar: number) -> Vec3:
+ return Vec3(self.x / scalar, self.y / scalar, self.z / scalar)
+
+ def __floordiv__(self, scalar: number) -> Vec3:
+ return Vec3(self.x // scalar, self.y // scalar, self.z // scalar)
+
+ def __abs__(self) -> float:
+ return _math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2)
+
+ def __neg__(self) -> Vec3:
+ return Vec3(-self.x, -self.y, -self.z)
+
+ def __round__(self, ndigits: int | None = None) -> Vec3:
+ return Vec3(*(round(v, ndigits) for v in self))
+
+ def __radd__(self, other: Vec3 | int) -> Vec3:
+ """Reverse add. Required for functionality with sum()"""
+ if other == 0:
+ return self
+ else:
+ return self.__add__(_typing.cast(Vec3, other))
+
+ def __eq__(self, other: object) -> bool:
+ return isinstance(other, Vec3) and self.x == other.x and self.y == other.y and self.z == other.z
+
+ def __ne__(self, other: object) -> bool:
+ return not isinstance(other, Vec3) or self.x != other.x or self.y != other.y or self.z != other.z
+
+ def from_magnitude(self, magnitude: float) -> Vec3:
+ """Create a new Vector of the given magnitude by normalizing,
+ then scaling the vector. The rotation remains unchanged.
+
+ :parameters:
+ `magnitude` : int or float :
+ The magnitude of the new vector.
+
+ :returns: A new vector with the magnitude.
+ :rtype: Vec3
+ """
+ return self.normalize() * magnitude
+
+ def limit(self, maximum: float) -> Vec3:
+ """Limit the magnitude of the vector to the value used for the max parameter.
+
+ :parameters:
+ `maximum` : int or float :
+ The maximum magnitude for the vector.
+
+ :returns: Either self or a new vector with the maximum magnitude.
+ :rtype: Vec3
+ """
+ if self.x ** 2 + self.y ** 2 + self.z ** 2 > maximum * maximum * maximum:
+ return self.from_magnitude(maximum)
+ return self
+
+ def cross(self, other: Vec3) -> Vec3:
+ """Calculate the cross product of this vector and another 3D vector.
+
+ :parameters:
+ `other` : Vec3 :
+ The other vector.
+
+ :returns: The cross product of the two vectors.
+ :rtype: float
+ """
+ return Vec3((self.y * other.z) - (self.z * other.y),
+ (self.z * other.x) - (self.x * other.z),
+ (self.x * other.y) - (self.y * other.x))
+
+ def dot(self, other: Vec3) -> float:
+ """Calculate the dot product of this vector and another 3D vector.
+
+ :parameters:
+ `other` : Vec3 :
+ The other vector.
+
+ :returns: The dot product of the two vectors.
+ :rtype: float
+ """
+ return self.x * other.x + self.y * other.y + self.z * other.z
+
+ def lerp(self, other: Vec3, alpha: float) -> Vec3:
+ """Create a new Vec3 linearly interpolated between this vector and another Vec3.
+
+ :parameters:
+ `other` : Vec3 :
+ The vector to linearly interpolate with.
+ `alpha` : float or int :
+ The amount of interpolation.
+ Some value between 0.0 (this vector) and 1.0 (other vector).
+ 0.5 is halfway inbetween.
+
+ :returns: A new interpolated vector.
+ :rtype: Vec3
+ """
+ return Vec3(self.x + (alpha * (other.x - self.x)),
+ self.y + (alpha * (other.y - self.y)),
+ self.z + (alpha * (other.z - self.z)))
+
+ def distance(self, other: Vec3) -> float:
+ """Calculate the distance between this vector and another 3D vector.
+
+ :parameters:
+ `other` : Vec3 :
+ The other vector
+
+ :returns: The distance between the two vectors.
+ :rtype: float
+ """
+ return _math.sqrt(((other.x - self.x) ** 2) +
+ ((other.y - self.y) ** 2) +
+ ((other.z - self.z) ** 2))
+
+ def normalize(self) -> Vec3:
+ """Normalize the vector to have a magnitude of 1. i.e. make it a unit vector.
+
+ :returns: A unit vector with the same rotation.
+ :rtype: Vec3
+ """
+ try:
+ d = self.__abs__()
+ return Vec3(self.x / d, self.y / d, self.z / d)
+ except ZeroDivisionError:
+ return self
+
+ def clamp(self, min_val: float, max_val: float) -> Vec3:
+ """Restrict the value of the X, Y and Z components of the vector to be within the given values.
+
+ :parameters:
+ `min_val` : int or float :
+ The minimum value
+ `max_val` : int or float :
+ The maximum value
+
+ :returns: A new vector with clamped X, Y and Z components.
+ :rtype: Vec3
+ """
+ return Vec3(clamp(self.x, min_val, max_val),
+ clamp(self.y, min_val, max_val),
+ clamp(self.z, min_val, max_val))
+
+ def __getattr__(self, attrs: str) -> Vec2 | Vec3 | Vec4:
+ try:
+ # Allow swizzled getting of attrs
+ vec_class = {2: Vec2, 3: Vec3, 4: Vec4}[len(attrs)]
+ return vec_class(*(self['xyz'.index(c)] for c in attrs))
+ except Exception:
+ raise AttributeError(
+ f"'{self.__class__.__name__}' object has no attribute '{attrs}'"
+ ) from None
+
+ def __repr__(self) -> str:
+ return f"Vec3({self.x}, {self.y}, {self.z})"
+
+
+class Vec4:
+ __slots__ = 'x', 'y', 'z', 'w'
+
+ """A four-dimensional vector represented as X Y Z W coordinates."""
+
+ def __init__(self, x: number = 0.0, y: number = 0.0, z: number = 0.0, w: number = 0.0) -> None:
+ self.x = x
+ self.y = y
+ self.z = z
+ self.w = w
+
+ def __iter__(self) -> _Iterator[float]:
+ yield self.x
+ yield self.y
+ yield self.z
+ yield self.w
+
+ @_typing.overload
+ def __getitem__(self, item: int) -> float:
+ ...
+
+ @_typing.overload
+ def __getitem__(self, item: slice) -> tuple[float, ...]:
+ ...
+
+ def __getitem__(self, item):
+ return (self.x, self.y, self.z, self.w)[item]
+
+ def __setitem__(self, key, value):
+ if type(key) is slice:
+ for i, attr in enumerate(['x', 'y', 'z', 'w'][key]):
+ setattr(self, attr, value[i])
+ else:
+ setattr(self, ['x', 'y', 'z', 'w'][key], value)
+
+ def __len__(self) -> int:
+ return 4
+
+ def __add__(self, other: Vec4) -> Vec4:
+ return Vec4(self.x + other.x, self.y + other.y, self.z + other.z, self.w + other.w)
+
+ def __sub__(self, other: Vec4) -> Vec4:
+ return Vec4(self.x - other.x, self.y - other.y, self.z - other.z, self.w - other.w)
+
+ def __mul__(self, scalar: number) -> Vec4:
+ return Vec4(self.x * scalar, self.y * scalar, self.z * scalar, self.w * scalar)
+
+ def __truediv__(self, scalar: number) -> Vec4:
+ return Vec4(self.x / scalar, self.y / scalar, self.z / scalar, self.w / scalar)
+
+ def __floordiv__(self, scalar: number) -> Vec4:
+ return Vec4(self.x // scalar, self.y // scalar, self.z // scalar, self.w // scalar)
+
+ def __abs__(self) -> float:
+ return _math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2 + self.w ** 2)
+
+ def __neg__(self) -> Vec4:
+ return Vec4(-self.x, -self.y, -self.z, -self.w)
+
+ def __round__(self, ndigits: int | None = None) -> Vec4:
+ return Vec4(*(round(v, ndigits) for v in self))
+
+ def __radd__(self, other: Vec4 | int) -> Vec4:
+ if other == 0:
+ return self
+ else:
+ return self.__add__(_typing.cast(Vec4, other))
+
+ def __eq__(self, other: object) -> bool:
+ return (
+ isinstance(other, Vec4)
+ and self.x == other.x
+ and self.y == other.y
+ and self.z == other.z
+ and self.w == other.w
+ )
+
+ def __ne__(self, other: object) -> bool:
+ return (
+ not isinstance(other, Vec4)
+ or self.x != other.x
+ or self.y != other.y
+ or self.z != other.z
+ or self.w != other.w
+ )
+
+ def lerp(self, other: Vec4, alpha: float) -> Vec4:
+ """Create a new Vec4 linearly interpolated between this one and another Vec4.
+
+ :parameters:
+ `other` : Vec4 :
+ The vector to linearly interpolate with.
+ `alpha` : float or int :
+ The amount of interpolation.
+ Some value between 0.0 (this vector) and 1.0 (other vector).
+ 0.5 is halfway inbetween.
+
+ :returns: A new interpolated vector.
+ :rtype: Vec4
+ """
+ return Vec4(self.x + (alpha * (other.x - self.x)),
+ self.y + (alpha * (other.y - self.y)),
+ self.z + (alpha * (other.z - self.z)),
+ self.w + (alpha * (other.w - self.w)))
+
+ def distance(self, other: Vec4) -> float:
+ return _math.sqrt(((other.x - self.x) ** 2) +
+ ((other.y - self.y) ** 2) +
+ ((other.z - self.z) ** 2) +
+ ((other.w - self.w) ** 2))
+
+ def normalize(self) -> Vec4:
+ """Normalize the vector to have a magnitude of 1. i.e. make it a unit vector."""
+ d = self.__abs__()
+ if d:
+ return Vec4(self.x / d, self.y / d, self.z / d, self.w / d)
+ return self
+
+ def clamp(self, min_val: float, max_val: float) -> Vec4:
+ return Vec4(clamp(self.x, min_val, max_val),
+ clamp(self.y, min_val, max_val),
+ clamp(self.z, min_val, max_val),
+ clamp(self.w, min_val, max_val))
+
+ def dot(self, other: Vec4) -> float:
+ return self.x * other.x + self.y * other.y + self.z * other.z + self.w * other.w
+
+ def __getattr__(self, attrs: str) -> Vec2 | Vec3 | Vec4:
+ try:
+ # Allow swizzled getting of attrs
+ vec_class = {2: Vec2, 3: Vec3, 4: Vec4}[len(attrs)]
+ return vec_class(*(self['xyzw'.index(c)] for c in attrs))
+ except Exception:
+ raise AttributeError(
+ f"'{self.__class__.__name__}' object has no attribute '{attrs}'"
+ ) from None
+
+ def __repr__(self) -> str:
+ return f"Vec4({self.x}, {self.y}, {self.z}, {self.w})"
+
+
+class Mat3(tuple):
+ """A 3x3 Matrix class
+
+ `Mat3` is an immutable 3x3 Matrix, including most common
+ operators. Matrix multiplication must be performed using
+ the "@" operator.
+ """
+
+ def __new__(cls, values: _Iterable[float] = (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)) -> Mat3:
+ """Create a 3x3 Matrix
+
+ A Mat3 can be created with a list or tuple of 9 values.
+ If no values are provided, an "identity matrix" will be created
+ (1.0 on the main diagonal). Matrix objects are immutable, so
+ all operations return a new Mat3 object.
+
+ :Parameters:
+ `values` : tuple of float or int
+ A tuple or list containing 9 floats or ints.
+ """
+ new = super().__new__(Mat3, values)
+ assert len(new) == 9, "A 3x3 Matrix requires 9 values"
+ return new
+
+ def scale(self, sx: float, sy: float) -> Mat3:
+ return self @ Mat3((1.0 / sx, 0.0, 0.0, 0.0, 1.0 / sy, 0.0, 0.0, 0.0, 1.0))
+
+ def translate(self, tx: float, ty: float) -> Mat3:
+ return self @ Mat3((1.0, 0.0, 0.0, 0.0, 1.0, 0.0, -tx, ty, 1.0))
+
+ def rotate(self, phi: float) -> Mat3:
+ s = _math.sin(_math.radians(phi))
+ c = _math.cos(_math.radians(phi))
+ return self @ Mat3((c, s, 0.0, -s, c, 0.0, 0.0, 0.0, 1.0))
+
+ def shear(self, sx: float, sy: float) -> Mat3:
+ return self @ Mat3((1.0, sy, 0.0, sx, 1.0, 0.0, 0.0, 0.0, 1.0))
+
+ def __add__(self, other: Mat3) -> Mat3:
+ if not isinstance(other, Mat3):
+ raise TypeError("Can only add to other Mat3 types")
+ return Mat3(s + o for s, o in zip(self, other))
+
+ def __sub__(self, other: Mat3) -> Mat3:
+ if not isinstance(other, Mat3):
+ raise TypeError("Can only subtract from other Mat3 types")
+ return Mat3(s - o for s, o in zip(self, other))
+
+ def __pos__(self) -> Mat3:
+ return self
+
+ def __neg__(self) -> Mat3:
+ return Mat3(-v for v in self)
+
+ def __round__(self, ndigits: int | None = None) -> Mat3:
+ return Mat3(round(v, ndigits) for v in self)
+
+ def __mul__(self, other: object) -> _typing.NoReturn:
+ raise NotImplementedError("Please use the @ operator for Matrix multiplication.")
+
+ @_typing.overload
+ def __matmul__(self, other: Vec3) -> Vec3:
+ ...
+
+ @_typing.overload
+ def __matmul__(self, other: Mat3) -> Mat3:
+ ...
+
+ def __matmul__(self, other):
+ if isinstance(other, Vec3):
+ # Rows:
+ r0 = self[0::3]
+ r1 = self[1::3]
+ r2 = self[2::3]
+ return Vec3(sum(map(_mul, r0, other)),
+ sum(map(_mul, r1, other)),
+ sum(map(_mul, r2, other)))
+
+ if not isinstance(other, Mat3):
+ raise TypeError("Can only multiply with Mat3 or Vec3 types")
+
+ # Rows:
+ r0 = self[0::3]
+ r1 = self[1::3]
+ r2 = self[2::3]
+ # Columns:
+ c0 = other[0:3]
+ c1 = other[3:6]
+ c2 = other[6:9]
+
+ # Multiply and sum rows * columns:
+ return Mat3((sum(map(_mul, c0, r0)), sum(map(_mul, c0, r1)), sum(map(_mul, c0, r2)),
+ sum(map(_mul, c1, r0)), sum(map(_mul, c1, r1)), sum(map(_mul, c1, r2)),
+ sum(map(_mul, c2, r0)), sum(map(_mul, c2, r1)), sum(map(_mul, c2, r2))))
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}{self[0:3]}\n {self[3:6]}\n {self[6:9]}"
+
+
+class Mat4(tuple):
+ """A 4x4 Matrix class
+
+ `Mat4` is an immutable 4x4 Matrix, including most common
+ operators. Matrix multiplication must be performed using
+ the "@" operator.
+ Class methods are available for creating orthogonal
+ and perspective projections matrixes.
+ """
+
+ def __new__(cls, values: _Iterable[float] = (1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0,)) -> Mat4:
+ """Create a 4x4 Matrix
+
+ A Matrix can be created with a list or tuple of 16 values.
+ If no values are provided, an "identity matrix" will be created
+ (1.0 on the main diagonal). Matrix objects are immutable, so
+ all operations return a new Mat4 object.
+
+ :Parameters:
+ `values` : tuple of float or int
+ A tuple or list containing 16 floats or ints.
+ """
+
+ new = super().__new__(Mat4, values)
+ assert len(new) == 16, "A 4x4 Matrix requires 16 values"
+ return new
+
+ @classmethod
+ def orthogonal_projection(
+ cls: type[Mat4T],
+ left: float,
+ right: float,
+ bottom: float,
+ top: float,
+ z_near: float,
+ z_far: float
+ ) -> Mat4T:
+ """Create a Mat4 orthographic projection matrix for use with OpenGL.
+
+ This matrix doesn't actually perform the projection; it transforms the
+ space so that OpenGL's vertex processing performs it.
+ """
+ width = right - left
+ height = top - bottom
+ depth = z_far - z_near
+
+ sx = 2.0 / width
+ sy = 2.0 / height
+ sz = 2.0 / -depth
+
+ tx = -(right + left) / width
+ ty = -(top + bottom) / height
+ tz = -(z_far + z_near) / depth
+
+ return cls((sx, 0.0, 0.0, 0.0,
+ 0.0, sy, 0.0, 0.0,
+ 0.0, 0.0, sz, 0.0,
+ tx, ty, tz, 1.0))
+
+ @classmethod
+ def perspective_projection(
+ cls: type[Mat4T],
+ aspect: float,
+ z_near: float,
+ z_far: float,
+ fov: float = 60
+ ) -> Mat4T:
+ """
+ Create a Mat4 perspective projection matrix for use with OpenGL.
+
+ This matrix doesn't actually perform the projection; it transforms the
+ space so that OpenGL's vertex processing performs it.
+
+ :Parameters:
+ `aspect` : The aspect ratio as a `float`
+ `z_near` : The near plane as a `float`
+ `z_far` : The far plane as a `float`
+ `fov` : Field of view in degrees as a `float`
+ """
+ xy_max = z_near * _math.tan(fov * _math.pi / 360)
+ y_min = -xy_max
+ x_min = -xy_max
+
+ width = xy_max - x_min
+ height = xy_max - y_min
+ depth = z_far - z_near
+ q = -(z_far + z_near) / depth
+ qn = -2 * z_far * z_near / depth
+
+ w = 2 * z_near / width
+ w = w / aspect
+ h = 2 * z_near / height
+
+ return cls((w, 0, 0, 0,
+ 0, h, 0, 0,
+ 0, 0, q, -1,
+ 0, 0, qn, 0))
+
+ @classmethod
+ def from_rotation(cls, angle: float, vector: Vec3) -> Mat4:
+ """Create a rotation matrix from an angle and Vec3.
+
+ :Parameters:
+ `angle` : A `float` :
+ The angle as a float.
+ `vector` : A `Vec3`, or 3 component tuple of float or int :
+ Vec3 or tuple with x, y and z translation values
+ """
+ return cls().rotate(angle, vector)
+
+ @classmethod
+ def from_scale(cls: type[Mat4T], vector: Vec3) -> Mat4T:
+ """Create a scale matrix from a Vec3.
+
+ :Parameters:
+ `vector` : A `Vec3`, or 3 component tuple of float or int
+ Vec3 or tuple with x, y and z scale values
+ """
+ return cls((vector[0], 0.0, 0.0, 0.0,
+ 0.0, vector[1], 0.0, 0.0,
+ 0.0, 0.0, vector[2], 0.0,
+ 0.0, 0.0, 0.0, 1.0))
+
+ @classmethod
+ def from_translation(cls: type[Mat4T], vector: Vec3) -> Mat4T:
+ """Create a translation matrix from a Vec3.
+
+ :Parameters:
+ `vector` : A `Vec3`, or 3 component tuple of float or int
+ Vec3 or tuple with x, y and z translation values
+ """
+ return cls((1.0, 0.0, 0.0, 0.0,
+ 0.0, 1.0, 0.0, 0.0,
+ 0.0, 0.0, 1.0, 0.0,
+ vector[0], vector[1], vector[2], 1.0))
+
+ @classmethod
+ def look_at(cls: type[Mat4T], position: Vec3, target: Vec3, up: Vec3):
+ f = (target - position).normalize()
+ u = up.normalize()
+ s = f.cross(u).normalize()
+ u = s.cross(f)
+
+ return cls([s.x, u.x, -f.x, 0.0,
+ s.y, u.y, -f.y, 0.0,
+ s.z, u.z, -f.z, 0.0,
+ -s.dot(position), -u.dot(position), f.dot(position), 1.0])
+
+ def row(self, index: int) -> tuple:
+ """Get a specific row as a tuple."""
+ return self[index::4]
+
+ def column(self, index: int) -> tuple:
+ """Get a specific column as a tuple."""
+ return self[index * 4: index * 4 + 4]
+
+ def rotate(self, angle: float, vector: Vec3) -> Mat4:
+ """Get a rotation Matrix on x, y, or z axis."""
+ if not all(abs(n) <= 1 for n in vector):
+ raise ValueError("vector must be normalized (<=1)")
+ x, y, z = vector
+ c = _math.cos(angle)
+ s = _math.sin(angle)
+ t = 1 - c
+ temp_x, temp_y, temp_z = t * x, t * y, t * z
+
+ ra = c + temp_x * x
+ rb = 0 + temp_x * y + s * z
+ rc = 0 + temp_x * z - s * y
+ re = 0 + temp_y * x - s * z
+ rf = c + temp_y * y
+ rg = 0 + temp_y * z + s * x
+ ri = 0 + temp_z * x + s * y
+ rj = 0 + temp_z * y - s * x
+ rk = c + temp_z * z
+
+ # ra, rb, rc, --
+ # re, rf, rg, --
+ # ri, rj, rk, --
+ # --, --, --, --
+
+ return Mat4(self) @ Mat4((ra, rb, rc, 0, re, rf, rg, 0, ri, rj, rk, 0, 0, 0, 0, 1))
+
+ def scale(self, vector: Vec3) -> Mat4:
+ """Get a scale Matrix on x, y, or z axis."""
+ temp = list(self)
+ temp[0] *= vector[0]
+ temp[5] *= vector[1]
+ temp[10] *= vector[2]
+ return Mat4(temp)
+
+ def translate(self, vector: Vec3) -> Mat4:
+ """Get a translation Matrix along x, y, and z axis."""
+ return self @ Mat4((1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, *vector, 1))
+
+ def transpose(self) -> Mat4:
+ """Get a transpose of this Matrix."""
+ return Mat4(self[0::4] + self[1::4] + self[2::4] + self[3::4])
+
+ def __add__(self, other: Mat4) -> Mat4:
+ if not isinstance(other, Mat4):
+ raise TypeError("Can only add to other Mat4 types")
+ return Mat4(s + o for s, o in zip(self, other))
+
+ def __sub__(self, other: Mat4) -> Mat4:
+ if not isinstance(other, Mat4):
+ raise TypeError("Can only subtract from other Mat4 types")
+ return Mat4(s - o for s, o in zip(self, other))
+
+ def __pos__(self) -> Mat4:
+ return self
+
+ def __neg__(self) -> Mat4:
+ return Mat4(-v for v in self)
+
+ def __invert__(self) -> Mat4:
+ a = self[10] * self[15] - self[11] * self[14]
+ b = self[9] * self[15] - self[11] * self[13]
+ c = self[9] * self[14] - self[10] * self[13]
+ d = self[8] * self[15] - self[11] * self[12]
+ e = self[8] * self[14] - self[10] * self[12]
+ f = self[8] * self[13] - self[9] * self[12]
+ g = self[6] * self[15] - self[7] * self[14]
+ h = self[5] * self[15] - self[7] * self[13]
+ i = self[5] * self[14] - self[6] * self[13]
+ j = self[6] * self[11] - self[7] * self[10]
+ k = self[5] * self[11] - self[7] * self[9]
+ l = self[5] * self[10] - self[6] * self[9]
+ m = self[4] * self[15] - self[7] * self[12]
+ n = self[4] * self[14] - self[6] * self[12]
+ o = self[4] * self[11] - self[7] * self[8]
+ p = self[4] * self[10] - self[6] * self[8]
+ q = self[4] * self[13] - self[5] * self[12]
+ r = self[4] * self[9] - self[5] * self[8]
+
+ det = (self[0] * (self[5] * a - self[6] * b + self[7] * c)
+ - self[1] * (self[4] * a - self[6] * d + self[7] * e)
+ + self[2] * (self[4] * b - self[5] * d + self[7] * f)
+ - self[3] * (self[4] * c - self[5] * e + self[6] * f))
+
+ if det == 0:
+ _warnings.warn("Unable to calculate inverse of singular Matrix")
+ return self
+
+ pdet = 1 / det
+ ndet = -pdet
+
+ return Mat4((pdet * (self[5] * a - self[6] * b + self[7] * c),
+ ndet * (self[1] * a - self[2] * b + self[3] * c),
+ pdet * (self[1] * g - self[2] * h + self[3] * i),
+ ndet * (self[1] * j - self[2] * k + self[3] * l),
+ ndet * (self[4] * a - self[6] * d + self[7] * e),
+ pdet * (self[0] * a - self[2] * d + self[3] * e),
+ ndet * (self[0] * g - self[2] * m + self[3] * n),
+ pdet * (self[0] * j - self[2] * o + self[3] * p),
+ pdet * (self[4] * b - self[5] * d + self[7] * f),
+ ndet * (self[0] * b - self[1] * d + self[3] * f),
+ pdet * (self[0] * h - self[1] * m + self[3] * q),
+ ndet * (self[0] * k - self[1] * o + self[3] * r),
+ ndet * (self[4] * c - self[5] * e + self[6] * f),
+ pdet * (self[0] * c - self[1] * e + self[2] * f),
+ ndet * (self[0] * i - self[1] * n + self[2] * q),
+ pdet * (self[0] * l - self[1] * p + self[2] * r)))
+
+ def __round__(self, ndigits: int | None = None) -> Mat4:
+ return Mat4(round(v, ndigits) for v in self)
+
+ def __mul__(self, other: int) -> _typing.NoReturn:
+ raise NotImplementedError("Please use the @ operator for Matrix multiplication.")
+
+ @_typing.overload
+ def __matmul__(self, other: Vec4) -> Vec4:
+ ...
+
+ @_typing.overload
+ def __matmul__(self, other: Mat4) -> Mat4:
+ ...
+
+ def __matmul__(self, other):
+ if isinstance(other, Vec4):
+ # Rows:
+ r0 = self[0::4]
+ r1 = self[1::4]
+ r2 = self[2::4]
+ r3 = self[3::4]
+ return Vec4(sum(map(_mul, r0, other)),
+ sum(map(_mul, r1, other)),
+ sum(map(_mul, r2, other)),
+ sum(map(_mul, r3, other)))
+
+ if not isinstance(other, Mat4):
+ raise TypeError("Can only multiply with Mat4 or Vec4 types")
+ # Rows:
+ r0 = self[0::4]
+ r1 = self[1::4]
+ r2 = self[2::4]
+ r3 = self[3::4]
+ # Columns:
+ c0 = other[0:4]
+ c1 = other[4:8]
+ c2 = other[8:12]
+ c3 = other[12:16]
+
+ # Multiply and sum rows * columns:
+ return Mat4((sum(map(_mul, c0, r0)), sum(map(_mul, c0, r1)), sum(map(_mul, c0, r2)), sum(map(_mul, c0, r3)),
+ sum(map(_mul, c1, r0)), sum(map(_mul, c1, r1)), sum(map(_mul, c1, r2)), sum(map(_mul, c1, r3)),
+ sum(map(_mul, c2, r0)), sum(map(_mul, c2, r1)), sum(map(_mul, c2, r2)), sum(map(_mul, c2, r3)),
+ sum(map(_mul, c3, r0)), sum(map(_mul, c3, r1)), sum(map(_mul, c3, r2)), sum(map(_mul, c3, r3))))
+
+ # def __getitem__(self, item):
+ # row = [slice(0, 4), slice(4, 8), slice(8, 12), slice(12, 16)][item]
+ # return super().__getitem__(row)
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}{self[0:4]}\n {self[4:8]}\n {self[8:12]}\n {self[12:16]}"
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e45b00d1be6b3b0b63653a6b075659b6cae1a69d
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/__init__.py
@@ -0,0 +1,83 @@
+"""Audio and video playback.
+
+pyglet can play WAV files, and if FFmpeg is installed, many other audio and
+video formats.
+
+Playback is handled by the :class:`.Player` class, which reads raw data from
+:class:`Source` objects and provides methods for pausing, seeking, adjusting
+the volume, and so on. The :class:`.Player` class implements the best
+available audio device. ::
+
+ player = Player()
+
+A :class:`Source` is used to decode arbitrary audio and video files. It is
+associated with a single player by "queueing" it::
+
+ source = load('background_music.mp3')
+ player.queue(source)
+
+Use the :class:`.Player` to control playback.
+
+If the source contains video, the :py:meth:`Source.video_format` attribute
+will be non-None, and the :py:attr:`Player.texture` attribute will contain the
+current video image synchronised to the audio.
+
+Decoding sounds can be processor-intensive and may introduce latency,
+particularly for short sounds that must be played quickly, such as bullets or
+explosions. You can force such sounds to be decoded and retained in memory
+rather than streamed from disk by wrapping the source in a
+:class:`StaticSource`::
+
+ bullet_sound = StaticSource(load('bullet.wav'))
+
+The other advantage of a :class:`StaticSource` is that it can be queued on
+any number of players, and so played many times simultaneously.
+
+Pyglet relies on Python's garbage collector to release resources when a player
+has finished playing a source. In this way some operations that could affect
+the application performance can be delayed.
+
+The player provides a :py:meth:`Player.delete` method that can be used to
+release resources immediately.
+"""
+from .drivers import get_audio_driver
+from .player import Player, PlayerGroup
+from .codecs import registry as _codec_registry
+from .codecs import add_default_codecs as _add_default_codecs
+from .codecs import Source, StaticSource, StreamingSource, SourceGroup, have_ffmpeg
+
+from . import synthesis
+
+
+__all__ = 'load', 'get_audio_driver', 'Player', 'PlayerGroup', 'SourceGroup', 'StaticSource', 'StreamingSource'
+
+
+def load(filename, file=None, streaming=True, decoder=None):
+ """Load a Source from a file.
+
+ All decoders that are registered for the filename extension are tried.
+ If none succeed, the exception from the first decoder is raised.
+ You can also specifically pass a decoder to use.
+
+ :Parameters:
+ `filename` : str
+ Used to guess the media format, and to load the file if `file` is
+ unspecified.
+ `file` : file-like object or None
+ Source of media data in any supported format.
+ `streaming` : bool
+ If `False`, a :class:`StaticSource` will be returned; otherwise
+ (default) a :class:`~pyglet.media.StreamingSource` is created.
+ `decoder` : MediaDecoder or None
+ A specific decoder you wish to use, rather than relying on
+ automatic detection. If specified, no other decoders are tried.
+
+ :rtype: StreamingSource or Source
+ """
+ if decoder:
+ return decoder.decode(filename, file, streaming=streaming)
+ else:
+ return _codec_registry.decode(filename, file, streaming=streaming)
+
+
+_add_default_codecs()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/buffered_logger.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/buffered_logger.py
new file mode 100644
index 0000000000000000000000000000000000000000..60c3afb9e2ab1920f75f769230232c6ea49c140d
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/buffered_logger.py
@@ -0,0 +1,43 @@
+"""
+Responsabilities
+
+ Handles accumulation of debug events while playing media_player and saves
+ when sample's play ends.
+"""
+
+import time
+import pickle
+
+
+class BufferedLogger:
+ def __init__(self, outfile):
+ self.outfile = outfile
+ self.log_entries = []
+ self.start_wall_time = None
+ # (fn, args)
+ self.on_close_callback_info = None
+
+ def init_wall_time(self):
+ self.start_wall_time = time.perf_counter()
+
+ def log(self, *args):
+ self.log_entries.append(args)
+
+ def rebased_wall_time(self):
+ return time.perf_counter() - self.start_wall_time
+
+ def close(self):
+ self.save_log_entries_as_pickle()
+ if self.on_close_callback_info is not None:
+ fn, args = self.on_close_callback_info
+ fn(self.log_entries, *args)
+
+ def save_log_entries_as_pickle(self):
+ with open(self.outfile, "wb") as f:
+ pickle.dump(self.log_entries, f)
+
+ def clear(self):
+ self.log_entries = []
+
+
+logger = None
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..40387e3f334f93008a2ce3f0c1bf7bab6bfa26e0
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/__init__.py
@@ -0,0 +1,96 @@
+from pyglet.util import CodecRegistry, Decoder, Encoder
+from .base import *
+
+import pyglet
+
+
+_debug = pyglet.options['debug_media']
+
+registry = CodecRegistry()
+add_decoders = registry.add_decoders
+add_encoders = registry.add_encoders
+get_decoders = registry.get_decoders
+get_encoders = registry.get_encoders
+
+
+class MediaDecoder(Decoder):
+
+ def decode(self, filename, file, streaming):
+ """Read the given file object and return an instance of `Source`
+ or `StreamingSource`.
+ Throws DecodeException if there is an error. `filename`
+ can be a file type hint.
+ """
+ raise NotImplementedError()
+
+
+class MediaEncoder(Encoder):
+
+ def encode(self, source, filename, file):
+ """Encode the given source to the given file. `filename`
+ provides a hint to the file format desired. options are
+ encoder-specific, and unknown options should be ignored or
+ issue warnings.
+ """
+ raise NotImplementedError()
+
+
+def add_default_codecs():
+ # Add all bundled codecs. These should be listed in order of
+ # preference. This is called automatically by pyglet.media.
+
+ try:
+ from . import wave
+ registry.add_decoders(wave)
+ registry.add_encoders(wave)
+ except ImportError:
+ pass
+
+ if pyglet.compat_platform.startswith('linux'):
+ try:
+ from . import gstreamer
+ registry.add_decoders(gstreamer)
+ except ImportError:
+ pass
+
+ try:
+ if pyglet.compat_platform in ('win32', 'cygwin'):
+ from pyglet.libs.win32.constants import WINDOWS_VISTA_OR_GREATER
+ if WINDOWS_VISTA_OR_GREATER: # Supports Vista and above.
+ from . import wmf
+ registry.add_decoders(wmf)
+ except ImportError:
+ pass
+
+ try:
+ if have_ffmpeg():
+ from . import ffmpeg
+ registry.add_decoders(ffmpeg)
+ except ImportError:
+ pass
+
+ try:
+ from . import pyogg
+ registry.add_decoders(pyogg)
+ except ImportError:
+ pass
+
+
+def have_ffmpeg():
+ """Check if FFmpeg library is available.
+
+ Returns:
+ bool: True if FFmpeg is found.
+
+ .. versionadded:: 1.4
+ """
+ try:
+ from . import ffmpeg_lib
+ if _debug:
+ print('FFmpeg available, using to load media files. Versions: {}'.format(ffmpeg_lib.compat.versions))
+ return True
+
+ except (ImportError, FileNotFoundError, AttributeError):
+ if _debug:
+ print('FFmpeg not available.')
+ return False
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/base.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..d65b23a342c6ef9c6ba575edee0cba8c6650952b
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/base.py
@@ -0,0 +1,568 @@
+import io
+
+from pyglet.media.exceptions import MediaException, CannotSeekException
+
+
+class AudioFormat:
+ """Audio details.
+
+ An instance of this class is provided by sources with audio tracks. You
+ should not modify the fields, as they are used internally to describe the
+ format of data provided by the source.
+
+ Args:
+ channels (int): The number of channels: 1 for mono or 2 for stereo
+ (pyglet does not yet support surround-sound sources).
+ sample_size (int): Bits per sample; only 8 or 16 are supported.
+ sample_rate (int): Samples per second (in Hertz).
+ """
+
+ def __init__(self, channels, sample_size, sample_rate):
+ self.channels = channels
+ self.sample_size = sample_size
+ self.sample_rate = sample_rate
+
+ # Convenience
+ self.bytes_per_sample = (sample_size >> 3) * channels
+ self.bytes_per_second = self.bytes_per_sample * sample_rate
+
+ def __eq__(self, other):
+ if other is None:
+ return False
+ return (self.channels == other.channels and
+ self.sample_size == other.sample_size and
+ self.sample_rate == other.sample_rate)
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ def __repr__(self):
+ return '%s(channels=%d, sample_size=%d, sample_rate=%d)' % (
+ self.__class__.__name__, self.channels, self.sample_size,
+ self.sample_rate)
+
+
+class VideoFormat:
+ """Video details.
+
+ An instance of this class is provided by sources with a video stream. You
+ should not modify the fields.
+
+ Note that the sample aspect has no relation to the aspect ratio of the
+ video image. For example, a video image of 640x480 with sample aspect 2.0
+ should be displayed at 1280x480. It is the responsibility of the
+ application to perform this scaling.
+
+ Args:
+ width (int): Width of video image, in pixels.
+ height (int): Height of video image, in pixels.
+ sample_aspect (float): Aspect ratio (width over height) of a single
+ video pixel.
+ frame_rate (float): Frame rate (frames per second) of the video.
+
+ .. versionadded:: 1.2
+ """
+
+ def __init__(self, width, height, sample_aspect=1.0):
+ self.width = width
+ self.height = height
+ self.sample_aspect = sample_aspect
+ self.frame_rate = None
+
+ def __eq__(self, other):
+ if isinstance(other, VideoFormat):
+ return (self.width == other.width and
+ self.height == other.height and
+ self.sample_aspect == other.sample_aspect and
+ self.frame_rate == other.frame_rate)
+ return False
+
+
+class AudioData:
+ """A single packet of audio data.
+
+ This class is used internally by pyglet.
+
+ Args:
+ data (str or ctypes array or pointer): Sample data.
+ length (int): Size of sample data, in bytes.
+ timestamp (float): Time of the first sample, in seconds.
+ duration (float): Total data duration, in seconds.
+ events (List[:class:`pyglet.media.drivers.base.MediaEvent`]): List of events
+ contained within this packet. Events are timestamped relative to
+ this audio packet.
+ """
+
+ __slots__ = 'data', 'length', 'timestamp', 'duration', 'events'
+
+ def __init__(self, data, length, timestamp, duration, events):
+ self.data = data
+ self.length = length
+ self.timestamp = timestamp
+ self.duration = duration
+ self.events = events
+
+ def __eq__(self, other):
+ if isinstance(other, AudioData):
+ return (self.data == other.data and
+ self.length == other.length and
+ self.timestamp == other.timestamp and
+ self.duration == other.duration and
+ self.events == other.events)
+ return False
+
+ def consume(self, num_bytes, audio_format):
+ """Remove some data from the beginning of the packet.
+
+ All events are cleared.
+
+ Args:
+ num_bytes (int): The number of bytes to consume from the packet.
+ audio_format (:class:`.AudioFormat`): The packet audio format.
+ """
+ self.events = ()
+ if num_bytes >= self.length:
+ self.data = None
+ self.length = 0
+ self.timestamp += self.duration
+ self.duration = 0.
+ return
+ elif num_bytes == 0:
+ return
+
+ self.data = self.data[num_bytes:]
+ self.length -= num_bytes
+ self.duration -= num_bytes / audio_format.bytes_per_second
+ self.timestamp += num_bytes / audio_format.bytes_per_second
+
+ def get_string_data(self):
+ """Return data as a bytestring.
+
+ Returns:
+ bytes: Data as a (byte)string.
+ """
+ if self.data is None:
+ return b''
+
+ return memoryview(self.data).tobytes()[:self.length]
+
+
+class SourceInfo:
+ """Source metadata information.
+
+ Fields are the empty string or zero if the information is not available.
+
+ Args:
+ title (str): Title
+ author (str): Author
+ copyright (str): Copyright statement
+ comment (str): Comment
+ album (str): Album name
+ year (int): Year
+ track (int): Track number
+ genre (str): Genre
+
+ .. versionadded:: 1.2
+ """
+
+ title = ''
+ author = ''
+ copyright = ''
+ comment = ''
+ album = ''
+ year = 0
+ track = 0
+ genre = ''
+
+
+class Source:
+ """An audio and/or video source.
+
+ Args:
+ audio_format (:class:`.AudioFormat`): Format of the audio in this
+ source, or ``None`` if the source is silent.
+ video_format (:class:`.VideoFormat`): Format of the video in this
+ source, or ``None`` if there is no video.
+ info (:class:`.SourceInfo`): Source metadata such as title, artist,
+ etc; or ``None`` if the` information is not available.
+
+ .. versionadded:: 1.2
+
+ Attributes:
+ is_player_source (bool): Determine if this source is a player
+ current source.
+
+ Check on a :py:class:`~pyglet.media.player.Player` if this source
+ is the current source.
+ """
+
+ _duration = None
+ _players = [] # List of players when calling Source.play
+
+ audio_format = None
+ video_format = None
+ info = None
+ is_player_source = False
+
+ @property
+ def duration(self):
+ """float: The length of the source, in seconds.
+
+ Not all source durations can be determined; in this case the value
+ is ``None``.
+
+ Read-only.
+ """
+ return self._duration
+
+ def play(self):
+ """Play the source.
+
+ This is a convenience method which creates a Player for
+ this source and plays it immediately.
+
+ Returns:
+ :class:`.Player`
+ """
+ from pyglet.media.player import Player # XXX Nasty circular dependency
+ player = Player()
+ player.queue(self)
+ player.play()
+ Source._players.append(player)
+
+ def _on_player_eos():
+ Source._players.remove(player)
+ # There is a closure on player. To get the refcount to 0,
+ # we need to delete this function.
+ player.on_player_eos = None
+
+ player.on_player_eos = _on_player_eos
+ return player
+
+ def get_animation(self):
+ """
+ Import all video frames into memory.
+
+ An empty animation will be returned if the source has no video.
+ Otherwise, the animation will contain all unplayed video frames (the
+ entire source, if it has not been queued on a player). After creating
+ the animation, the source will be at EOS (end of stream).
+
+ This method is unsuitable for videos running longer than a
+ few seconds.
+
+ .. versionadded:: 1.1
+
+ Returns:
+ :class:`pyglet.image.Animation`
+ """
+ from pyglet.image import Animation, AnimationFrame
+ if not self.video_format:
+ # XXX: This causes an assertion in the constructor of Animation
+ return Animation([])
+ else:
+ frames = []
+ last_ts = 0
+ next_ts = self.get_next_video_timestamp()
+ while next_ts is not None:
+ image = self.get_next_video_frame()
+ if image is not None:
+ delay = next_ts - last_ts
+ frames.append(AnimationFrame(image, delay))
+ last_ts = next_ts
+ next_ts = self.get_next_video_timestamp()
+ return Animation(frames)
+
+ def get_next_video_timestamp(self):
+ """Get the timestamp of the next video frame.
+
+ .. versionadded:: 1.1
+
+ Returns:
+ float: The next timestamp, or ``None`` if there are no more video
+ frames.
+ """
+ pass
+
+ def get_next_video_frame(self):
+ """Get the next video frame.
+
+ .. versionadded:: 1.1
+
+ Returns:
+ :class:`pyglet.image.AbstractImage`: The next video frame image,
+ or ``None`` if the video frame could not be decoded or there are
+ no more video frames.
+ """
+ pass
+
+ def save(self, filename, file=None, encoder=None):
+ """Save this Source to a file.
+
+ :Parameters:
+ `filename` : str
+ Used to set the file format, and to open the output file
+ if `file` is unspecified.
+ `file` : file-like object or None
+ File to write audio data to.
+ `encoder` : MediaEncoder or None
+ If unspecified, all encoders matching the filename extension
+ are tried. If all fail, the exception from the first one
+ attempted is raised.
+
+ """
+ if encoder:
+ return encoder.enccode(self, filename, file)
+ else:
+ import pyglet.media.codecs
+ return pyglet.media.codecs.registry.encode(self, filename, file)
+
+ # Internal methods that Player calls on the source:
+
+ def seek(self, timestamp):
+ """Seek to given timestamp.
+
+ Args:
+ timestamp (float): Time where to seek in the source. The
+ ``timestamp`` will be clamped to the duration of the source.
+ """
+ raise CannotSeekException()
+
+ def get_queue_source(self):
+ """Return the ``Source`` to be used as the queue source for a player.
+
+ Default implementation returns self.
+ """
+ return self
+
+ def get_audio_data(self, num_bytes, compensation_time=0.0):
+ """Get next packet of audio data.
+
+ Args:
+ num_bytes (int): Maximum number of bytes of data to return.
+ compensation_time (float): Time in sec to compensate due to a
+ difference between the master clock and the audio clock.
+
+ Returns:
+ :class:`.AudioData`: Next packet of audio data, or ``None`` if
+ there is no (more) data.
+ """
+ return None
+
+
+class StreamingSource(Source):
+ """A source that is decoded as it is being played.
+
+ The source can only be played once at a time on any
+ :class:`~pyglet.media.player.Player`.
+ """
+
+ def get_queue_source(self):
+ """Return the ``Source`` to be used as the source for a player.
+
+ Default implementation returns self.
+
+ Returns:
+ :class:`.Source`
+ """
+ if self.is_player_source:
+ raise MediaException('This source is already queued on a player.')
+ self.is_player_source = True
+ return self
+
+ def delete(self):
+ """Release the resources held by this StreamingSource."""
+ pass
+
+
+class StaticSource(Source):
+ """A source that has been completely decoded in memory.
+
+ This source can be queued onto multiple players any number of times.
+
+ Construct a :py:class:`~pyglet.media.StaticSource` for the data in
+ ``source``.
+
+ Args:
+ source (Source): The source to read and decode audio and video data
+ from.
+ """
+
+ def __init__(self, source):
+ source = source.get_queue_source()
+ if source.video_format:
+ raise NotImplementedError('Static sources not supported for video.')
+
+ self.audio_format = source.audio_format
+ if not self.audio_format:
+ self._data = None
+ self._duration = 0.
+ return
+
+ # Arbitrary: number of bytes to request at a time.
+ buffer_size = 1 << 20 # 1 MB
+
+ # Naive implementation. Driver-specific implementations may override
+ # to load static audio data into device (or at least driver) memory.
+ data = io.BytesIO()
+ while True:
+ audio_data = source.get_audio_data(buffer_size)
+ if not audio_data:
+ break
+ data.write(audio_data.get_string_data())
+ self._data = data.getvalue()
+
+ self._duration = len(self._data) / self.audio_format.bytes_per_second
+
+ def get_queue_source(self):
+ if self._data is not None:
+ return StaticMemorySource(self._data, self.audio_format)
+
+ def get_audio_data(self, num_bytes, compensation_time=0.0):
+ """The StaticSource does not provide audio data.
+
+ When the StaticSource is queued on a
+ :class:`~pyglet.media.player.Player`, it creates a
+ :class:`.StaticMemorySource` containing its internal audio data and
+ audio format.
+
+ Raises:
+ RuntimeError
+ """
+ raise RuntimeError('StaticSource cannot be queued.')
+
+
+class StaticMemorySource(StaticSource):
+ """
+ Helper class for default implementation of :class:`.StaticSource`.
+
+ Do not use directly. This class is used internally by pyglet.
+
+ Args:
+ data (AudioData): The audio data.
+ audio_format (AudioFormat): The audio format.
+ """
+
+ def __init__(self, data, audio_format):
+ """Construct a memory source over the given data buffer."""
+ self._file = io.BytesIO(data)
+ self._max_offset = len(data)
+ self.audio_format = audio_format
+ self._duration = len(data) / float(audio_format.bytes_per_second)
+
+ def seek(self, timestamp):
+ """Seek to given timestamp.
+
+ Args:
+ timestamp (float): Time where to seek in the source.
+ """
+ offset = int(timestamp * self.audio_format.bytes_per_second)
+
+ # Align to sample
+ if self.audio_format.bytes_per_sample == 2:
+ offset &= 0xfffffffe
+ elif self.audio_format.bytes_per_sample == 4:
+ offset &= 0xfffffffc
+
+ self._file.seek(offset)
+
+ def get_audio_data(self, num_bytes, compensation_time=0.0):
+ """Get next packet of audio data.
+
+ Args:
+ num_bytes (int): Maximum number of bytes of data to return.
+ compensation_time (float): Not used in this class.
+
+ Returns:
+ :class:`.AudioData`: Next packet of audio data, or ``None`` if
+ there is no (more) data.
+ """
+ offset = self._file.tell()
+ timestamp = float(offset) / self.audio_format.bytes_per_second
+
+ # Align to sample size
+ if self.audio_format.bytes_per_sample == 2:
+ num_bytes &= 0xfffffffe
+ elif self.audio_format.bytes_per_sample == 4:
+ num_bytes &= 0xfffffffc
+
+ data = self._file.read(num_bytes)
+ if not len(data):
+ return None
+
+ duration = float(len(data)) / self.audio_format.bytes_per_second
+ return AudioData(data, len(data), timestamp, duration, [])
+
+
+class SourceGroup:
+ """Group of like sources to allow gapless playback.
+
+ Seamlessly read data from a group of sources to allow for
+ gapless playback. All sources must share the same audio format.
+ The first source added sets the format.
+ """
+
+ def __init__(self):
+ self.audio_format = None
+ self.video_format = None
+ self.duration = 0.0
+ self._timestamp_offset = 0.0
+ self._dequeued_durations = []
+ self._sources = []
+
+ def seek(self, time):
+ if self._sources:
+ self._sources[0].seek(time)
+
+ def add(self, source):
+ self.audio_format = self.audio_format or source.audio_format
+ source = source.get_queue_source()
+ assert (source.audio_format == self.audio_format), "Sources must share the same audio format."
+ self._sources.append(source)
+ self.duration += source.duration
+
+ def has_next(self):
+ return len(self._sources) > 1
+
+ def get_queue_source(self):
+ return self
+
+ def _advance(self):
+ if self._sources:
+ self._timestamp_offset += self._sources[0].duration
+ self._dequeued_durations.insert(0, self._sources[0].duration)
+ old_source = self._sources.pop(0)
+ self.duration -= old_source.duration
+
+ if isinstance(old_source, StreamingSource):
+ old_source.delete()
+ del old_source
+
+ def get_audio_data(self, num_bytes, compensation_time=0.0):
+ """Get next audio packet.
+
+ :Parameters:
+ `num_bytes` : int
+ Hint for preferred size of audio packet; may be ignored.
+
+ :rtype: `AudioData`
+ :return: Audio data, or None if there is no more data.
+ """
+
+ if not self._sources:
+ return None
+
+ buffer = b""
+ duration = 0.0
+ timestamp = 0.0
+
+ while len(buffer) < num_bytes and self._sources:
+ audiodata = self._sources[0].get_audio_data(num_bytes)
+ if audiodata:
+ buffer += audiodata.data
+ duration += audiodata.duration
+ timestamp += self._timestamp_offset
+ else:
+ self._advance()
+
+ return AudioData(buffer, len(buffer), timestamp, duration, [])
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg.py
new file mode 100644
index 0000000000000000000000000000000000000000..33cf9a8624c07b9423683832fb4d1b7c5b1d7a19
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg.py
@@ -0,0 +1,1135 @@
+"""Use ffmpeg to decode audio and video media.
+"""
+
+from collections import deque
+from ctypes import (c_int, c_int32, c_uint8, c_char_p,
+ addressof, byref, cast, POINTER, Structure, create_string_buffer, memmove)
+
+import pyglet
+import pyglet.lib
+from pyglet import image
+from pyglet.util import asbytes, asbytes_filename, asstr
+from . import MediaDecoder
+from .base import AudioData, SourceInfo, StaticSource
+from .base import StreamingSource, VideoFormat, AudioFormat
+from .ffmpeg_lib import *
+from ..exceptions import MediaFormatException
+
+
+class FileInfo:
+ def __init__(self):
+ self.n_streams = None
+ self.start_time = None
+ self.duration = None
+ self.title = ""
+ self.author = ""
+ self.copyright = ""
+ self.comment = ""
+ self.album = ""
+ self.year = None
+ self.track = ""
+ self.genre = ""
+
+
+class StreamVideoInfo:
+ def __init__(self, width, height, sample_aspect_num, sample_aspect_den,
+ frame_rate_num, frame_rate_den, codec_id):
+ self.width = width
+ self.height = height
+ self.sample_aspect_num = sample_aspect_num
+ self.sample_aspect_den = sample_aspect_den
+ self.frame_rate_num = frame_rate_num
+ self.frame_rate_den = frame_rate_den
+ self.codec_id = codec_id
+
+
+class StreamAudioInfo:
+ def __init__(self, sample_format, sample_rate, channels):
+ self.sample_format = sample_format
+ self.sample_rate = sample_rate
+ self.sample_bits = None
+ self.channels = channels
+
+
+class FFmpegFile(Structure):
+ _fields_ = [
+ ('context', POINTER(AVFormatContext))
+ ]
+
+
+class FFmpegStream(Structure):
+ _fields_ = [
+ ('type', c_int32),
+ ('format_context', POINTER(AVFormatContext)),
+ ('codec_context', POINTER(AVCodecContext)),
+ ('frame', POINTER(AVFrame)),
+ ('time_base', AVRational)
+ ]
+
+
+class FFmpegException(MediaFormatException):
+ pass
+
+
+def ffmpeg_get_audio_buffer_size(audio_format):
+ """Return the audio buffer size
+
+ Buffer size can accomodate 1 sec of audio data.
+ """
+ return audio_format.bytes_per_second + FF_INPUT_BUFFER_PADDING_SIZE
+
+
+def ffmpeg_init():
+ """Initialize libavformat and register all the muxers, demuxers and
+ protocols."""
+ pass
+
+
+class MemoryFileObject:
+ """A class to manage reading and seeking of a ffmpeg file object."""
+ buffer_size = 32768
+
+ def __init__(self, file):
+ self.file = file
+ self.fmt_context = None
+ self.buffer = None
+
+ if not getattr(self.file, 'seek', None) or not getattr(self.file, 'tell', None):
+ raise Exception("File object does not support seeking.")
+
+ # Seek to end of file to get the filesize.
+ self.file.seek(0, 2)
+ self.file_size = self.file.tell()
+ self.file.seek(0) # Put cursor back at the beginning.
+
+ def read_data_cb(_, buff, buf_size):
+ data = self.file.read(buf_size)
+ read_size = len(data)
+ memmove(buff, data, read_size)
+ return read_size
+
+ def seek_data_cb(_, offset, whence):
+ if whence == libavformat.AVSEEK_SIZE:
+ return self.file_size
+
+ pos = self.file.seek(offset, whence)
+ return pos
+
+ self.read_func = libavformat.ffmpeg_read_func(read_data_cb)
+ self.seek_func = libavformat.ffmpeg_seek_func(seek_data_cb)
+
+ def __del__(self):
+ """These are usually freed when the source is, but no guarantee."""
+ if self.buffer:
+ try:
+ avutil.av_freep(self.buffer)
+ except OSError:
+ pass
+
+ if self.fmt_context:
+ try:
+ avutil.av_freep(self.fmt_context)
+ except OSError:
+ pass
+
+
+def ffmpeg_open_memory_file(filename, file_object):
+ """Open a media file from a file object.
+ :rtype: FFmpegFile
+ :return: The structure containing all the information for the media.
+ """
+ file = FFmpegFile()
+
+ file.context = libavformat.avformat.avformat_alloc_context()
+ file.context.contents.seekable = 1
+
+ memory_file = MemoryFileObject(file_object)
+
+ av_buf = libavutil.avutil.av_malloc(memory_file.buffer_size)
+ memory_file.buffer = cast(av_buf, c_char_p)
+
+ ptr = create_string_buffer(memory_file.buffer_size)
+
+ memory_file.fmt_context = libavformat.avformat.avio_alloc_context(
+ memory_file.buffer,
+ memory_file.buffer_size,
+ 0,
+ ptr,
+ memory_file.read_func,
+ None,
+ memory_file.seek_func
+ )
+
+ file.context.contents.pb = memory_file.fmt_context
+ file.context.contents.flags |= libavformat.AVFMT_FLAG_CUSTOM_IO
+
+ result = avformat.avformat_open_input(byref(file.context), filename, None, None)
+
+ if result != 0:
+ raise FFmpegException('avformat_open_input in ffmpeg_open_filename returned an error opening file '
+ + filename.decode("utf8")
+ + ' Error code: ' + str(result))
+
+ result = avformat.avformat_find_stream_info(file.context, None)
+ if result < 0:
+ raise FFmpegException('Could not find stream info')
+
+ return file, memory_file
+
+
+def ffmpeg_open_filename(filename):
+ """Open the media file.
+
+ :rtype: FFmpegFile
+ :return: The structure containing all the information for the media.
+ """
+ file = FFmpegFile() # TODO: delete this structure and use directly AVFormatContext
+ result = avformat.avformat_open_input(byref(file.context),
+ filename,
+ None,
+ None)
+
+ if result != 0:
+ raise FFmpegException('avformat_open_input in ffmpeg_open_filename returned an error opening file '
+ + filename.decode("utf8")
+ + ' Error code: ' + str(result))
+
+ result = avformat.avformat_find_stream_info(file.context, None)
+ if result < 0:
+ raise FFmpegException('Could not find stream info')
+
+ return file
+
+
+def ffmpeg_close_file(file):
+ """Close the media file and free resources."""
+ avformat.avformat_close_input(byref(file.context))
+
+
+def ffmpeg_file_info(file):
+ """Get information on the file:
+
+ - number of streams
+ - duration
+ - artist
+ - album
+ - date
+ - track
+
+ :rtype: FileInfo
+ :return: The file info instance containing all the meta information.
+ """
+ info = FileInfo()
+ info.n_streams = file.context.contents.nb_streams
+ info.start_time = file.context.contents.start_time
+ info.duration = file.context.contents.duration
+
+ entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('title'), None, 0)
+ if entry:
+ info.title = asstr(entry.contents.value)
+
+ entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('artist'), None, 0) \
+ or avutil.av_dict_get(file.context.contents.metadata, asbytes('album_artist'), None, 0)
+ if entry:
+ info.author = asstr(entry.contents.value)
+
+ entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('copyright'), None, 0)
+ if entry:
+ info.copyright = asstr(entry.contents.value)
+
+ entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('comment'), None, 0)
+ if entry:
+ info.comment = asstr(entry.contents.value)
+
+ entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('album'), None, 0)
+ if entry:
+ info.album = asstr(entry.contents.value)
+
+ entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('date'), None, 0)
+ if entry:
+ info.year = asstr(entry.contents.value)
+
+ entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('track'), None, 0)
+ if entry:
+ info.track = asstr(entry.contents.value)
+
+ entry = avutil.av_dict_get(file.context.contents.metadata, asbytes('genre'), None, 0)
+ if entry:
+ info.genre = asstr(entry.contents.value)
+
+ return info
+
+
+def ffmpeg_stream_info(file, stream_index):
+ """Open the stream
+ """
+ av_stream = file.context.contents.streams[stream_index].contents
+
+ context = av_stream.codecpar.contents
+
+ if context.codec_type == AVMEDIA_TYPE_VIDEO:
+ if _debug:
+ print("codec_type=", context.codec_type)
+ print(" codec_id=", context.codec_id)
+ print(" codec name=", avcodec.avcodec_get_name(context.codec_id).decode('utf-8'))
+ print(" codec_tag=", context.codec_tag)
+ print(" extradata=", context.extradata)
+ print(" extradata_size=", context.extradata_size)
+ print(" format=", context.format)
+ print(" bit_rate=", context.bit_rate)
+ print(" bits_per_coded_sample=", context.bits_per_coded_sample)
+ print(" bits_per_raw_sample=", context.bits_per_raw_sample)
+ print(" profile=", context.profile)
+ print(" level=", context.level)
+ print(" width=", context.width)
+ print(" height=", context.height)
+ print(" sample_aspect_ratio=", context.sample_aspect_ratio.num, context.sample_aspect_ratio.den)
+ print(" field_order=", context.field_order)
+ print(" color_range=", context.color_range)
+ print(" color_primaries=", context.color_primaries)
+ print(" color_trc=", context.color_trc)
+ print(" color_space=", context.color_space)
+ print(" chroma_location=", context.chroma_location)
+ print(" video_delay=", context.video_delay)
+ print(" channel_layout=", context.channel_layout)
+ print(" channels=", context.channels)
+ print(" sample_rate=", context.sample_rate)
+ print(" block_align=", context.block_align)
+ print(" frame_size=", context.frame_size)
+ print(" initial_padding=", context.initial_padding)
+ print(" trailing_padding=", context.trailing_padding)
+ print(" seek_preroll=", context.seek_preroll)
+ #
+ frame_rate = avformat.av_guess_frame_rate(file.context, av_stream, None)
+ info = StreamVideoInfo(
+ context.width,
+ context.height,
+ context.sample_aspect_ratio.num,
+ context.sample_aspect_ratio.den,
+ frame_rate.num,
+ frame_rate.den,
+ context.codec_id
+ )
+ elif context.codec_type == AVMEDIA_TYPE_AUDIO:
+ info = StreamAudioInfo(
+ context.format,
+ context.sample_rate,
+ context.channels
+ )
+ if context.format in (AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8P):
+ info.sample_bits = 8
+ elif context.format in (AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
+ AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP):
+ info.sample_bits = 16
+ elif context.format in (AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P):
+ info.sample_bits = 32
+ else:
+ info.sample_format = None
+ info.sample_bits = None
+ else:
+ return None
+ return info
+
+
+def ffmpeg_open_stream(file, index):
+ if not 0 <= index < file.context.contents.nb_streams:
+ raise FFmpegException('index out of range. Only {} streams.'.format(file.context.contents.nb_streams))
+ codec_context = avcodec.avcodec_alloc_context3(None)
+ if not codec_context:
+ raise MemoryError('Could not allocate Codec Context.')
+ result = avcodec.avcodec_parameters_to_context(
+ codec_context,
+ file.context.contents.streams[index].contents.codecpar)
+ if result < 0:
+ avcodec.avcodec_free_context(byref(codec_context))
+ raise FFmpegException('Could not copy the AVCodecContext.')
+ codec_id = codec_context.contents.codec_id
+ codec = avcodec.avcodec_find_decoder(codec_id)
+ if _debug:
+ print("Found Codec=", codec_id, "=", codec.contents.long_name.decode())
+
+ # VP8 and VP9 default codec don't support alpha transparency.
+ # Force libvpx codec in this case.
+ if codec_id == AV_CODEC_ID_VP9:
+ newcodec = avcodec.avcodec_find_decoder_by_name("libvpx-vp9".encode('utf-8'))
+ codec = newcodec or codec
+
+ if codec_id == AV_CODEC_ID_VP8:
+ newcodec = avcodec.avcodec_find_decoder_by_name("libvpx".encode('utf-8'))
+ codec = newcodec or codec
+
+ if not codec:
+ raise FFmpegException('No codec found for this media. '
+ 'codecID={}'.format(codec_id))
+
+ codec_id = codec.contents.id
+ if _debug:
+ print("Loaded codec: ", codec.contents.long_name.decode())
+
+ result = avcodec.avcodec_open2(codec_context, codec, None)
+ if result < 0:
+ raise FFmpegException('Could not open the media with the codec.')
+
+ stream = FFmpegStream()
+ stream.format_context = file.context
+ stream.codec_context = codec_context
+ stream.type = codec_context.contents.codec_type
+ stream.frame = avutil.av_frame_alloc()
+ stream.time_base = file.context.contents.streams[index].contents.time_base
+
+ return stream
+
+
+def ffmpeg_close_stream(stream):
+ if stream.frame:
+ avutil.av_frame_free(byref(stream.frame))
+ avcodec.avcodec_free_context(byref(stream.codec_context))
+
+
+def ffmpeg_seek_file(file, timestamp, ):
+ flags = 0
+ max_ts = file.context.contents.duration * AV_TIME_BASE
+ result = avformat.avformat_seek_file(
+ file.context, -1, 0,
+ timestamp, timestamp, flags
+ )
+ if result < 0:
+ buf = create_string_buffer(128)
+ avutil.av_strerror(result, buf, 128)
+ descr = buf.value
+ raise FFmpegException('Error occured while seeking. ' +
+ descr.decode())
+
+
+def ffmpeg_read(file, packet):
+ """Read from the stream a packet.
+
+ :rtype: bool
+ :return: True if the packet was correctly read. False if the end of stream
+ was reached or an error occured.
+ """
+ avcodec.av_packet_unref(packet)
+ result = avformat.av_read_frame(file.context, packet)
+ if result < 0:
+ return False
+
+ return True
+
+
+def ffmpeg_get_packet_pts(file, packet):
+ if packet.contents.dts != AV_NOPTS_VALUE:
+ pts = packet.contents.dts
+ else:
+ pts = 0
+
+ timestamp = avutil.av_rescale_q(pts,
+ file.context.contents.streams[
+ packet.contents.stream_index].contents.time_base,
+ AV_TIME_BASE_Q)
+ return timestamp
+
+
+def ffmpeg_get_frame_ts(stream):
+ ts = stream.frame.contents.best_effort_timestamp
+ timestamp = avutil.av_rescale_q(ts,
+ stream.time_base,
+ AV_TIME_BASE_Q)
+ return timestamp
+
+
+def ffmpeg_init_packet():
+ p = avcodec.av_packet_alloc()
+ if not p:
+ raise MemoryError("Could not allocate AVPacket.")
+ return p
+
+
+def ffmpeg_free_packet(packet):
+ avcodec.av_packet_free(byref(packet))
+
+
+def ffmpeg_unref_packet(packet):
+ avcodec.av_packet_unref(byref(packet))
+
+
+def ffmpeg_transfer_packet(dst, src):
+ avcodec.av_packet_move_ref(dst, src)
+
+
+def get_version():
+ """Return an informative version string of FFmpeg"""
+ return avutil.av_version_info().decode()
+
+
+def timestamp_from_ffmpeg(timestamp):
+ return float(timestamp) / 1000000
+
+
+def timestamp_to_ffmpeg(timestamp):
+ return int(timestamp * 1000000)
+
+
+class _Packet:
+ def __init__(self, packet, timestamp):
+ self.packet = AVPacket()
+ ffmpeg_transfer_packet(byref(self.packet), packet)
+ self.timestamp = timestamp
+
+ def __del__(self):
+ if ffmpeg_unref_packet is not None:
+ ffmpeg_unref_packet(self.packet)
+
+
+class VideoPacket(_Packet):
+ _next_id = 0
+
+ def __init__(self, packet, timestamp):
+ super(VideoPacket, self).__init__(packet, timestamp)
+ # Decoded image. 0 == not decoded yet; None == Error or discarded
+ self.image = 0
+ self.id = self._next_id
+ VideoPacket._next_id += 1
+
+
+class AudioPacket(_Packet):
+ pass
+
+
+class FFmpegSource(StreamingSource):
+ # Max increase/decrease of original sample size
+ SAMPLE_CORRECTION_PERCENT_MAX = 10
+
+ # Maximum amount of packets to create for video and audio queues.
+ MAX_QUEUE_SIZE = 100
+
+ def __init__(self, filename, file=None):
+ self._packet = None
+ self._video_stream = None
+ self._audio_stream = None
+ self._stream_end = False
+ self._file = None
+ self._memory_file = None
+
+ if file:
+ self._file, self._memory_file = ffmpeg_open_memory_file(asbytes_filename(filename), file)
+ else:
+ self._file = ffmpeg_open_filename(asbytes_filename(filename))
+
+ if not self._file:
+ raise FFmpegException('Could not open "{0}"'.format(filename))
+
+ self._video_stream_index = None
+ self._audio_stream_index = None
+ self._audio_format = None
+
+ self.img_convert_ctx = POINTER(SwsContext)()
+ self.audio_convert_ctx = POINTER(SwrContext)()
+
+ file_info = ffmpeg_file_info(self._file)
+
+ self.info = SourceInfo()
+ self.info.title = file_info.title
+ self.info.author = file_info.author
+ self.info.copyright = file_info.copyright
+ self.info.comment = file_info.comment
+ self.info.album = file_info.album
+ self.info.year = file_info.year
+ self.info.track = file_info.track
+ self.info.genre = file_info.genre
+
+ # Pick the first video and audio streams found, ignore others.
+ for i in range(file_info.n_streams):
+ info = ffmpeg_stream_info(self._file, i)
+
+ if isinstance(info, StreamVideoInfo) and self._video_stream is None:
+ stream = ffmpeg_open_stream(self._file, i)
+
+ self.video_format = VideoFormat(
+ width=info.width,
+ height=info.height)
+ if info.sample_aspect_num != 0:
+ self.video_format.sample_aspect = (
+ float(info.sample_aspect_num) /
+ info.sample_aspect_den)
+ self.video_format.frame_rate = (
+ float(info.frame_rate_num) /
+ info.frame_rate_den)
+ self._video_stream = stream
+ self._video_stream_index = i
+
+ elif isinstance(info, StreamAudioInfo) and info.sample_bits in (8, 16, 24) and self._audio_stream is None:
+ stream = ffmpeg_open_stream(self._file, i)
+
+ self.audio_format = AudioFormat(
+ channels=min(2, info.channels),
+ sample_size=info.sample_bits,
+ sample_rate=info.sample_rate)
+ self._audio_stream = stream
+ self._audio_stream_index = i
+
+ channel_input = avutil.av_get_default_channel_layout(info.channels)
+ channels_out = min(2, info.channels)
+ channel_output = avutil.av_get_default_channel_layout(channels_out)
+
+ sample_rate = stream.codec_context.contents.sample_rate
+ sample_format = stream.codec_context.contents.sample_fmt
+
+ if sample_format in (AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8P):
+ self.tgt_format = AV_SAMPLE_FMT_U8
+ elif sample_format in (AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P):
+ self.tgt_format = AV_SAMPLE_FMT_S16
+ elif sample_format in (AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P):
+ self.tgt_format = AV_SAMPLE_FMT_S32
+ elif sample_format in (AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP):
+ self.tgt_format = AV_SAMPLE_FMT_S16
+ else:
+ raise FFmpegException('Audio format not supported.')
+
+ self.audio_convert_ctx = swresample.swr_alloc_set_opts(None,
+ channel_output,
+ self.tgt_format, sample_rate,
+ channel_input, sample_format,
+ sample_rate,
+ 0, None)
+ if (not self.audio_convert_ctx or
+ swresample.swr_init(self.audio_convert_ctx) < 0):
+ swresample.swr_free(self.audio_convert_ctx)
+ raise FFmpegException('Cannot create sample rate converter.')
+
+ self._packet = ffmpeg_init_packet()
+ self._events = [] # They don't seem to be used!
+
+ self.audioq = deque()
+ # Make queue big enough to accomodate 1.2 sec?
+ self._max_len_audioq = self.MAX_QUEUE_SIZE # Need to figure out a correct amount
+ if self.audio_format:
+ # Buffer 1 sec worth of audio
+ nbytes = ffmpeg_get_audio_buffer_size(self.audio_format)
+ self._audio_buffer = (c_uint8 * nbytes)()
+
+ self.videoq = deque()
+ self._max_len_videoq = self.MAX_QUEUE_SIZE # Need to figure out a correct amount
+
+ self.start_time = self._get_start_time()
+ self._duration = timestamp_from_ffmpeg(file_info.duration)
+ self._duration -= self.start_time
+
+ # Flag to determine if the _fillq method was already scheduled
+ self._fillq_scheduled = False
+ self._fillq()
+ # Don't understand why, but some files show that seeking without
+ # reading the first few packets results in a seeking where we lose
+ # many packets at the beginning.
+ # We only seek back to 0 for media which have a start_time > 0
+ if self.start_time > 0:
+ self.seek(0.0)
+
+ def __del__(self):
+ if self._packet and ffmpeg_free_packet is not None:
+ ffmpeg_free_packet(self._packet)
+ if self._video_stream and swscale is not None:
+ swscale.sws_freeContext(self.img_convert_ctx)
+ ffmpeg_close_stream(self._video_stream)
+ if self._audio_stream:
+ swresample.swr_free(self.audio_convert_ctx)
+ ffmpeg_close_stream(self._audio_stream)
+ if self._file and ffmpeg_close_file is not None:
+ ffmpeg_close_file(self._file)
+
+ def seek(self, timestamp):
+ if _debug:
+ print('FFmpeg seek', timestamp)
+
+ ffmpeg_seek_file(
+ self._file,
+ timestamp_to_ffmpeg(timestamp + self.start_time)
+ )
+ del self._events[:]
+ self._stream_end = False
+ self._clear_video_audio_queues()
+ self._fillq()
+
+ # Consume video and audio packets until we arrive at the correct
+ # timestamp location
+ if not self.audio_format:
+ while len(self.videoq) > 1:
+ # We only advance if there is at least 2 packets in the queue
+ # The queue is only left with 1 packet if we have reached the
+ # end of the stream.
+ if timestamp < self.videoq[1].timestamp:
+ break
+ else:
+ self.get_next_video_frame(skip_empty_frame=False)
+
+ elif not self.video_format:
+ while len(self.audioq) > 1:
+ # We only advance if there is at least 2 packets in the queue
+ # The queue is only left with 1 packet if we have reached the
+ # end of the stream.
+ if timestamp < self.audioq[1].timestamp:
+ break
+ else:
+ self._get_audio_packet()
+
+ else:
+ while len(self.audioq) > 1 and len(self.videoq) > 1:
+ # We only advance if there is at least 2 packets in the queue
+ # The queue is only left with 1 packet if we have reached the
+ # end of the stream.
+ audioq_is_first = self.audioq[0].timestamp < self.videoq[0].timestamp
+ correct_audio_pos = timestamp < self.audioq[1].timestamp
+ correct_video_pos = timestamp < self.videoq[1].timestamp
+ if audioq_is_first and not correct_audio_pos:
+ self._get_audio_packet()
+
+ elif not correct_video_pos:
+ self.get_next_video_frame(skip_empty_frame=False)
+
+ else:
+ break
+
+ def _get_audio_packet(self):
+ """Take an audio packet from the queue.
+
+ This function will schedule its `_fillq` function to fill up
+ the queues if space is available. Multiple calls to this method will
+ only result in one scheduled call to `_fillq`.
+ """
+
+ audio_data = self.audioq.popleft()
+ low_lvl = self._check_low_level()
+ if not low_lvl and not self._fillq_scheduled:
+ pyglet.clock.schedule_once(lambda dt: self._fillq(), 0)
+ self._fillq_scheduled = True
+
+ return audio_data
+
+ def _get_video_packet(self):
+ """Take a video packet from the queue.
+
+ This function will schedule its `_fillq` function to fill up
+ the queues if space is available. Multiple calls to this method will
+ only result in one scheduled call to `_fillq`.
+ """
+ if not self.videoq:
+ return None
+ video_packet = self.videoq.popleft()
+ low_lvl = self._check_low_level()
+ if not low_lvl and not self._fillq_scheduled:
+ pyglet.clock.schedule_once(lambda dt: self._fillq(), 0)
+ self._fillq_scheduled = True
+ return video_packet
+
+ def _clear_video_audio_queues(self):
+ """Empty both audio and video queues."""
+ self.audioq.clear()
+ self.videoq.clear()
+
+ def _fillq(self):
+ """Fill up both Audio and Video queues if space is available in both"""
+ # We clear our flag.
+ self._fillq_scheduled = False
+ while (len(self.audioq) < self._max_len_audioq and
+ len(self.videoq) < self._max_len_videoq):
+ if self._get_packet():
+ self._process_packet()
+ else:
+ self._stream_end = True
+ break
+
+ def _check_low_level(self):
+ """Check if both audio and video queues are getting very low.
+
+ If one of them has less than 2 elements, we fill the queue immediately
+ with new packets. We don't wait for a scheduled call because we need
+ them immediately.
+
+ This would normally happens only during seek operations where we
+ consume many packets to find the correct timestamp.
+ """
+ if len(self.audioq) < 2 or len(self.videoq) < 2:
+ if len(self.audioq) < self._max_len_audioq and len(self.videoq) < self._max_len_videoq:
+ self._fillq()
+ return True
+ return False
+
+ def _get_packet(self):
+ # Read a packet into self._packet. Returns True if OK, False if no
+ # more packets are in stream.
+ return ffmpeg_read(self._file, self._packet)
+
+ def _process_packet(self):
+ """Process the packet that has been just read.
+
+ Determines whether it's a video or audio packet and queue it in the
+ appropriate queue.
+ """
+ timestamp = ffmpeg_get_packet_pts(self._file, self._packet)
+ timestamp = timestamp_from_ffmpeg(timestamp)
+ timestamp -= self.start_time
+
+ if self._packet.contents.stream_index == self._video_stream_index:
+ video_packet = VideoPacket(self._packet, timestamp)
+
+ if _debug:
+ print('Created and queued packet %d (%f)' % (video_packet.id, video_packet.timestamp))
+
+ self.videoq.append(video_packet)
+ return video_packet
+
+ elif self.audio_format and self._packet.contents.stream_index == self._audio_stream_index:
+ audio_packet = AudioPacket(self._packet, timestamp)
+
+ self.audioq.append(audio_packet)
+ return audio_packet
+
+ def get_audio_data(self, num_bytes, compensation_time=0.0):
+ data = b''
+ timestamp = duration = 0
+
+ while len(data) < num_bytes:
+ if not self.audioq:
+ break
+
+ audio_packet = self._get_audio_packet()
+ buffer, timestamp, duration = self._decode_audio_packet(audio_packet, compensation_time)
+
+ if not buffer:
+ break
+ data += buffer
+
+ # No data and no audio queue left
+ if not data and not self.audioq:
+ if not self._stream_end:
+ # No more audio data in queue, but we haven't hit the stream end.
+ if _debug:
+ print("Audio queue was starved by the audio driver.")
+
+ return None
+
+ audio_data = AudioData(data, len(data), timestamp, duration, [])
+
+ while self._events and self._events[0].timestamp <= (timestamp + duration):
+ event = self._events.pop(0)
+ if event.timestamp >= timestamp:
+ event.timestamp -= timestamp
+ audio_data.events.append(event)
+
+ if _debug:
+ print('get_audio_data returning ts {0} with events {1}'.format(audio_data.timestamp, audio_data.events))
+ print('remaining events are', self._events)
+
+ return audio_data
+
+ def _decode_audio_packet(self, audio_packet, compensation_time):
+ while True:
+ try:
+ size_out = self._ffmpeg_decode_audio(
+ audio_packet.packet,
+ self._audio_buffer,
+ compensation_time)
+ except FFmpegException:
+ break
+
+ if size_out <= 0:
+ break
+
+ buffer = create_string_buffer(size_out)
+ memmove(buffer, self._audio_buffer, len(buffer))
+ buffer = buffer.raw
+
+ duration = float(len(buffer)) / self.audio_format.bytes_per_second
+ timestamp = ffmpeg_get_frame_ts(self._audio_stream)
+ timestamp = timestamp_from_ffmpeg(timestamp)
+ return buffer, timestamp, duration
+
+ return None, 0, 0
+
+ def _ffmpeg_decode_audio(self, packet, data_out, compensation_time):
+ stream = self._audio_stream
+
+ if stream.type != AVMEDIA_TYPE_AUDIO:
+ raise FFmpegException('Trying to decode audio on a non-audio stream.')
+
+ sent_result = avcodec.avcodec_send_packet(
+ stream.codec_context,
+ packet,
+ )
+
+ if sent_result < 0:
+ buf = create_string_buffer(128)
+ avutil.av_strerror(sent_result, buf, 128)
+ descr = buf.value
+ raise FFmpegException('Error occurred sending packet to decoder. {}'.format(descr.decode()))
+
+ receive_result = avcodec.avcodec_receive_frame(
+ stream.codec_context,
+ stream.frame
+ )
+
+ if receive_result < 0:
+ buf = create_string_buffer(128)
+ avutil.av_strerror(receive_result, buf, 128)
+ descr = buf.value
+ raise FFmpegException('Error occurred receiving frame. {}'.format(descr.decode()))
+
+ plane_size = c_int(0)
+
+ data_size = avutil.av_samples_get_buffer_size(
+ byref(plane_size),
+ stream.codec_context.contents.channels,
+ stream.frame.contents.nb_samples,
+ stream.codec_context.contents.sample_fmt,
+ 1)
+ if data_size < 0:
+ raise FFmpegException('Error in av_samples_get_buffer_size')
+ if len(self._audio_buffer) < data_size:
+ raise FFmpegException('Output audio buffer is too small for current audio frame!')
+
+ nb_samples = stream.frame.contents.nb_samples
+ sample_rate = stream.codec_context.contents.sample_rate
+ bytes_per_sample = avutil.av_get_bytes_per_sample(self.tgt_format)
+ channels_out = min(2, self.audio_format.channels)
+
+ wanted_nb_samples = nb_samples + compensation_time * sample_rate
+ min_nb_samples = (nb_samples * (100 - self.SAMPLE_CORRECTION_PERCENT_MAX) / 100)
+ max_nb_samples = (nb_samples * (100 + self.SAMPLE_CORRECTION_PERCENT_MAX) / 100)
+ wanted_nb_samples = min(max(wanted_nb_samples, min_nb_samples), max_nb_samples)
+ wanted_nb_samples = int(wanted_nb_samples)
+
+ if wanted_nb_samples != nb_samples:
+ res = swresample.swr_set_compensation(
+ self.audio_convert_ctx,
+ (wanted_nb_samples - nb_samples),
+ wanted_nb_samples
+ )
+
+ if res < 0:
+ raise FFmpegException('swr_set_compensation failed.')
+
+ data_in = stream.frame.contents.extended_data
+ p_data_out = cast(data_out, POINTER(c_uint8))
+
+ out_samples = swresample.swr_get_out_samples(self.audio_convert_ctx, nb_samples)
+ total_samples_out = swresample.swr_convert(self.audio_convert_ctx,
+ byref(p_data_out), out_samples,
+ data_in, nb_samples)
+ while True:
+ # We loop because there could be some more samples buffered in
+ # SwrContext. We advance the pointer where we write our samples.
+ offset = (total_samples_out * channels_out * bytes_per_sample)
+ p_data_offset = cast(
+ addressof(p_data_out.contents) + offset,
+ POINTER(c_uint8)
+ )
+ samples_out = swresample.swr_convert(self.audio_convert_ctx,
+ byref(p_data_offset),
+ out_samples - total_samples_out, None, 0)
+ if samples_out == 0:
+ # No more samples. We can continue.
+ break
+ total_samples_out += samples_out
+
+ size_out = (total_samples_out * channels_out * bytes_per_sample)
+
+ return size_out
+
+ def _decode_video_packet(self, video_packet):
+ # # Some timing and profiling
+ # pr = cProfile.Profile()
+ # pr.enable()
+ # clock = pyglet.clock.get_default()
+ # t0 = clock.time()
+
+ width = self.video_format.width
+ height = self.video_format.height
+ pitch = width * 4
+ # https://ffmpeg.org/doxygen/3.3/group__lavc__decoding.html#ga8f5b632a03ce83ac8e025894b1fc307a
+ nbytes = (pitch * height + FF_INPUT_BUFFER_PADDING_SIZE)
+ buffer = (c_uint8 * nbytes)()
+ try:
+ result = self._ffmpeg_decode_video(video_packet.packet,
+ buffer)
+ except FFmpegException:
+ image_data = None
+ else:
+ image_data = image.ImageData(width, height, 'RGBA', buffer, pitch)
+ timestamp = ffmpeg_get_frame_ts(self._video_stream)
+ timestamp = timestamp_from_ffmpeg(timestamp)
+ video_packet.timestamp = timestamp - self.start_time
+
+ video_packet.image = image_data
+
+ if _debug:
+ print('Decoding video packet at timestamp', video_packet, video_packet.timestamp)
+
+ # t2 = clock.time()
+ # pr.disable()
+ # print("Time in _decode_video_packet: {:.4f} s for timestamp {} s".format(t2-t0, packet.timestamp))
+ # if t2-t0 > 0.01:
+ # import pstats
+ # ps = pstats.Stats(pr).sort_stats("cumulative")
+ # ps.print_stats()
+
+ def _ffmpeg_decode_video(self, packet, data_out):
+ stream = self._video_stream
+ rgba_ptrs = (POINTER(c_uint8) * 4)()
+ rgba_stride = (c_int * 4)()
+ width = stream.codec_context.contents.width
+ height = stream.codec_context.contents.height
+ if stream.type != AVMEDIA_TYPE_VIDEO:
+ raise FFmpegException('Trying to decode video on a non-video stream.')
+
+ sent_result = avcodec.avcodec_send_packet(
+ stream.codec_context,
+ packet,
+ )
+
+ if sent_result < 0:
+ buf = create_string_buffer(128)
+ avutil.av_strerror(sent_result, buf, 128)
+ descr = buf.value
+ raise FFmpegException('Video: Error occurred sending packet to decoder. {}'.format(descr.decode()))
+
+ receive_result = avcodec.avcodec_receive_frame(
+ stream.codec_context,
+ stream.frame
+ )
+
+ if receive_result < 0:
+ buf = create_string_buffer(128)
+ avutil.av_strerror(receive_result, buf, 128)
+ descr = buf.value
+ raise FFmpegException('Video: Error occurred receiving frame. {}'.format(descr.decode()))
+
+ avutil.av_image_fill_arrays(rgba_ptrs, rgba_stride, data_out,
+ AV_PIX_FMT_RGBA, width, height, 1)
+
+ self.img_convert_ctx = swscale.sws_getCachedContext(
+ self.img_convert_ctx,
+ width, height, stream.codec_context.contents.pix_fmt,
+ width, height, AV_PIX_FMT_RGBA,
+ SWS_FAST_BILINEAR, None, None, None)
+
+ swscale.sws_scale(self.img_convert_ctx,
+ cast(stream.frame.contents.data,
+ POINTER(POINTER(c_uint8))),
+ stream.frame.contents.linesize,
+ 0,
+ height,
+ rgba_ptrs,
+ rgba_stride)
+ return receive_result
+
+ def get_next_video_timestamp(self):
+ if not self.video_format:
+ return
+
+ ts = None
+
+ if self.videoq:
+ while True:
+ # We skip video packets which are not video frames
+ # This happens in mkv files for the first few frames.
+ try:
+ video_packet = self.videoq.popleft()
+ except IndexError:
+ break
+ if video_packet.image == 0:
+ self._decode_video_packet(video_packet)
+ if video_packet.image is not None:
+ ts = video_packet.timestamp
+ self.videoq.appendleft(video_packet) # put it back
+ break
+ self._get_video_packet()
+ else:
+ ts = None
+
+ if _debug:
+ print('Next video timestamp is', ts)
+ return ts
+
+ def get_next_video_frame(self, skip_empty_frame=True):
+ if not self.video_format:
+ return
+
+ while True:
+ # We skip video packets which are not video frames
+ # This happens in mkv files for the first few frames.
+ video_packet = self._get_video_packet()
+ if not video_packet:
+ return None
+ if video_packet.image == 0:
+ self._decode_video_packet(video_packet)
+ if video_packet.image is not None or not skip_empty_frame:
+ break
+
+ if _debug:
+ print('Returning', video_packet)
+
+ return video_packet.image
+
+ def _get_start_time(self):
+ def streams():
+ format_context = self._file.context
+ for idx in (self._video_stream_index, self._audio_stream_index):
+ if idx is None:
+ continue
+ stream = format_context.contents.streams[idx].contents
+ yield stream
+
+ def start_times(streams):
+ yield 0
+ for stream in streams:
+ start = stream.start_time
+ if start == AV_NOPTS_VALUE:
+ yield 0
+ start_time = avutil.av_rescale_q(start,
+ stream.time_base,
+ AV_TIME_BASE_Q)
+ start_time = timestamp_from_ffmpeg(start_time)
+ yield start_time
+
+ return max(start_times(streams()))
+
+ @property
+ def audio_format(self):
+ return self._audio_format
+
+ @audio_format.setter
+ def audio_format(self, value):
+ self._audio_format = value
+ if value is None:
+ self.audioq.clear()
+
+
+ffmpeg_init()
+if pyglet.options['debug_media']:
+ _debug = True
+else:
+ _debug = False
+ avutil.av_log_set_level(8)
+
+
+#########################################
+# Decoder class:
+#########################################
+
+class FFmpegDecoder(MediaDecoder):
+
+ def get_file_extensions(self):
+ return '.mp3', '.ogg'
+
+ def decode(self, filename, file, streaming=True):
+ if streaming:
+ return FFmpegSource(filename, file)
+ else:
+ return StaticSource(FFmpegSource(filename, file))
+
+
+def get_decoders():
+ return [FFmpegDecoder()]
+
+
+def get_encoders():
+ return []
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..34b0f5fec140310a8b93918497510a8e58efc0a0
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/__init__.py
@@ -0,0 +1,8 @@
+"""FFmpeg wrapping"""
+from .libavcodec import *
+from .libavutil import *
+from .libavformat import *
+from .libswresample import *
+from .libswscale import *
+from .compat import *
+apply_version_changes()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/compat.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..7e18c963a3a952f8a9ef6a56969ea926fb5c0152
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/compat.py
@@ -0,0 +1,63 @@
+from collections import namedtuple
+
+CustomField = namedtuple("CustomField", "fields removals")
+
+# Versions of the loaded libraries
+versions = {
+ 'avcodec': 0,
+ 'avformat': 0,
+ 'avutil': 0,
+ 'swresample': 0,
+ 'swscale': 0,
+}
+
+# Group codecs by version they are usually packaged with.
+release_versions = [
+ {'avcodec': 58, 'avformat': 58, 'avutil': 56, 'swresample': 3, 'swscale': 5},
+ {'libavcodec': 59, 'avformat': 59, 'avutil': 57, 'swresample': 4, 'swscale': 6}
+]
+
+# Removals done per library and version.
+_version_changes = {
+ 'avcodec': {},
+ 'avformat': {},
+ 'avutil': {},
+ 'swresample': {},
+ 'swscale': {}
+}
+
+
+def set_version(library, version):
+ versions[library] = version
+
+
+def add_version_changes(library, version, structure, fields, removals):
+ if version not in _version_changes[library]:
+ _version_changes[library][version] = {}
+
+ if structure in _version_changes[library][version]:
+ raise Exception("Structure: {} from: {} has already been added for version {}.".format(structure,
+ library,
+ version)
+ )
+
+ _version_changes[library][version][structure] = CustomField(fields, removals)
+
+
+def apply_version_changes():
+ """Apply version changes to Structures in FFmpeg libraries.
+ Field data can vary from version to version, however assigning _fields_ automatically assigns memory.
+ _fields_ can also not be re-assigned. Use a temporary list that can be manipulated before setting the
+ _fields_ of the Structure."""
+
+ for library, data in _version_changes.items():
+ for version in data:
+ for structure, cf_data in _version_changes[library][version].items():
+ if versions[library] == version:
+ if cf_data.removals:
+ for remove_field in cf_data.removals:
+ for field in list(cf_data.fields):
+ if field[0] == remove_field:
+ cf_data.fields.remove(field)
+
+ structure._fields_ = cf_data.fields
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libavcodec.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libavcodec.py
new file mode 100644
index 0000000000000000000000000000000000000000..5d39627c947befed11b6623111aef47160dcb0fd
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libavcodec.py
@@ -0,0 +1,424 @@
+"""Wrapper for include/libavcodec/avcodec.h
+"""
+
+from ctypes import c_int, c_uint16, c_int64, c_uint32, c_uint64
+from ctypes import c_uint8, c_uint, c_float, c_char_p
+from ctypes import c_void_p, POINTER, CFUNCTYPE, Structure
+
+import pyglet.lib
+from pyglet.util import debug_print
+from . import compat
+from . import libavutil
+
+_debug = debug_print('debug_media')
+
+avcodec = pyglet.lib.load_library(
+ 'avcodec',
+ win32=('avcodec-59', 'avcodec-58'),
+ darwin=('avcodec.59', 'avcodec.58')
+)
+
+avcodec.avcodec_version.restype = c_int
+
+compat.set_version('avcodec', avcodec.avcodec_version() >> 16)
+
+
+FF_INPUT_BUFFER_PADDING_SIZE = 32
+
+
+class AVPacketSideData(Structure):
+ _fields_ = [
+ ('data', POINTER(c_uint8)),
+ ('size', c_int),
+ ('type', c_int)
+ ]
+
+
+AVBufferRef = libavutil.AVBufferRef
+
+AVRational = libavutil.AVRational
+
+
+class AVPacket(Structure):
+ pass
+
+AVPacket_Fields = [
+ ('buf', POINTER(AVBufferRef)),
+ ('pts', c_int64),
+ ('dts', c_int64),
+ ('data', POINTER(c_uint8)),
+ ('size', c_int),
+ ('stream_index', c_int),
+ ('flags', c_int),
+ ('side_data', POINTER(AVPacketSideData)),
+ ('side_data_elems', c_int),
+ ('duration', c_int64),
+ ('pos', c_int64),
+ ('opaque', c_void_p), # 5.x only
+ ('opaque_ref', c_void_p), # 5.x only
+ ('time_base', AVRational), # 5.x only
+ ('convergence_duration', c_int64) # 4.x only
+ ]
+
+
+compat.add_version_changes('avcodec', 58, AVPacket, AVPacket_Fields,
+ removals=('opaque', 'opaque_ref', 'time_base'))
+
+compat.add_version_changes('avcodec', 59, AVPacket, AVPacket_Fields,
+ removals=('convergence_duration',))
+
+
+class AVCodecParserContext(Structure):
+ pass
+
+
+class AVCodecParameters(Structure):
+ _fields_ = [
+ ('codec_type', c_int),
+ ('codec_id', c_int),
+ ('codec_tag', c_uint32),
+ ('extradata', POINTER(c_uint8)),
+ ('extradata_size', c_int),
+ ('format', c_int),
+ ('bit_rate', c_int64),
+ ('bits_per_coded_sample', c_int),
+ ('bits_per_raw_sample', c_int),
+ ('profile', c_int),
+ ('level', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('sample_aspect_ratio', AVRational),
+ ('field_order', c_int),
+ ('color_range', c_int),
+ ('color_primaries', c_int),
+ ('color_trc', c_int),
+ ('color_space', c_int),
+ ('chroma_location', c_int),
+ ('video_delay', c_int),
+ ('channel_layout', c_uint64), # deprecated as of 59
+ ('channels', c_int), # deprecated as of 59
+ ('sample_rate', c_int),
+ ('block_align', c_int),
+ ('frame_size', c_int),
+ ('initial_padding', c_int),
+ ('trailing_padding', c_int),
+ ('seek_preroll', c_int)
+ ]
+
+
+class AVProfile(Structure):
+ _fields_ = [
+ ('profile', c_int),
+ ('name', c_char_p),
+ ]
+
+
+class AVCodecDescriptor(Structure):
+ _fields_ = [
+ ('id', c_int),
+ ('type', c_int),
+ ('name', c_char_p),
+ ('long_name', c_char_p),
+ ('props', c_int),
+ ('mime_types', c_char_p),
+ ('profiles', POINTER(AVProfile))
+ ]
+
+
+class AVCodecInternal(Structure):
+ pass
+
+
+class AVCodec(Structure):
+ _fields_ = [
+ ('name', c_char_p),
+ ('long_name', c_char_p),
+ ('type', c_int),
+ ('id', c_int),
+ ('capabilities', c_int),
+ ('supported_framerates', POINTER(AVRational)),
+ ('pix_fmts', POINTER(c_int)),
+ ('supported_samplerates', POINTER(c_int)),
+ ('sample_fmts', POINTER(c_int)),
+ ('channel_layouts', POINTER(c_uint64)),
+ ('max_lowres', c_uint8),
+ # And more...
+ ]
+
+
+class AVCodecContext(Structure):
+ pass
+
+
+class RcOverride(Structure):
+ pass
+
+
+class AVHWAccel(Structure):
+ pass
+
+
+AVClass = libavutil.AVClass
+AVFrame = libavutil.AVFrame
+AV_NUM_DATA_POINTERS = libavutil.AV_NUM_DATA_POINTERS
+
+AVCodecContext_Fields = [
+ ('av_class', POINTER(AVClass)),
+ ('log_level_offset', c_int),
+ ('codec_type', c_int),
+ ('codec', POINTER(AVCodec)),
+ ('codec_id', c_int),
+ ('codec_tag', c_uint),
+ ('priv_data', c_void_p),
+ ('internal', POINTER(AVCodecInternal)),
+ ('opaque', c_void_p),
+ ('bit_rate', c_int64),
+ ('bit_rate_tolerance', c_int),
+ ('global_quality', c_int),
+ ('compression_level', c_int),
+ ('flags', c_int),
+ ('flags2', c_int),
+ ('extradata', POINTER(c_uint8)),
+ ('extradata_size', c_int),
+ ('time_base', AVRational),
+ ('ticks_per_frame', c_int),
+ ('delay', c_int),
+ ('width', c_int),
+ ('height', c_int),
+ ('coded_width', c_int),
+ ('coded_height', c_int),
+ ('gop_size', c_int),
+ ('pix_fmt', c_int),
+ ('draw_horiz_band', CFUNCTYPE(None,
+ POINTER(AVCodecContext), POINTER(AVFrame),
+ c_int * 8, c_int, c_int, c_int)),
+ ('get_format', CFUNCTYPE(c_int, POINTER(AVCodecContext), POINTER(c_int))),
+ ('max_b_frames', c_int),
+ ('b_quant_factor', c_float),
+ ('b_frame_strategy', c_int), # Deprecated. Removed in 59.
+ ('b_quant_offset', c_float),
+ ('has_b_frames', c_int),
+ ('mpeg_quant', c_int), # Deprecated. Removed in 59.
+ ('i_quant_factor', c_float),
+ ('i_quant_offset', c_float),
+ ('lumi_masking', c_float),
+ ('temporal_cplx_masking', c_float),
+ ('spatial_cplx_masking', c_float),
+ ('p_masking', c_float),
+ ('dark_masking', c_float),
+ ('slice_count', c_int),
+ ('prediction_method', c_int), # Deprecated. Removed in 59.
+ ('slice_offset', POINTER(c_int)),
+ ('sample_aspect_ratio', AVRational),
+ ('me_cmp', c_int),
+ ('me_sub_cmp', c_int),
+ ('mb_cmp', c_int),
+ ('ildct_cmp', c_int),
+ ('dia_size', c_int),
+ ('last_predictor_count', c_int),
+ ('pre_me', c_int), # Deprecated. Removed in 59.
+ ('me_pre_cmp', c_int),
+ ('pre_dia_size', c_int),
+ ('me_subpel_quality', c_int),
+ ('me_range', c_int),
+ ('slice_flags', c_int),
+ ('mb_decision', c_int),
+ ('intra_matrix', POINTER(c_uint16)),
+ ('inter_matrix', POINTER(c_uint16)),
+ ('scenechange_threshold', c_int), # Deprecated. Removed in 59.
+ ('noise_reduction', c_int), # Deprecated. Removed in 59.
+ ('intra_dc_precision', c_int),
+ ('skip_top', c_int),
+ ('skip_bottom', c_int),
+ ('mb_lmin', c_int),
+ ('mb_lmax', c_int),
+ ('me_penalty_compensation', c_int), # Deprecated. Removed in 59.
+ ('bidir_refine', c_int),
+ ('brd_scale', c_int), # Deprecated. Removed in 59.
+ ('keyint_min', c_int),
+ ('refs', c_int),
+ ('chromaoffset', c_int), # Deprecated. Removed in 59.
+ ('mv0_threshold', c_int),
+ ('b_sensitivity', c_int), # Deprecated. Removed in 59.
+ ('color_primaries', c_int),
+ ('color_trc', c_int),
+ ('colorspace', c_int),
+ ('color_range', c_int),
+ ('chroma_sample_location', c_int),
+ ('slices', c_int),
+ ('field_order', c_int),
+ ('sample_rate', c_int),
+ ('channels', c_int),
+ ('sample_fmt', c_int),
+ ('frame_size', c_int),
+ ('frame_number', c_int),
+ ('block_align', c_int),
+ ('cutoff', c_int),
+ ('channel_layout', c_uint64),
+ ('request_channel_layout', c_uint64),
+ ('audio_service_type', c_int),
+ ('request_sample_fmt', c_int),
+ ('get_buffer2', CFUNCTYPE(c_int, POINTER(AVCodecContext), POINTER(AVFrame), c_int)),
+ ('refcounted_frames', c_int), # Deprecated. Removed in 59.
+ ('qcompress', c_float),
+ ('qblur', c_float),
+ ('qmin', c_int),
+ ('qmax', c_int),
+ ('max_qdiff', c_int),
+ ('rc_buffer_size', c_int),
+ ('rc_override_count', c_int),
+ ('rc_override', POINTER(RcOverride)),
+ ('rc_max_rate', c_int64),
+ ('rc_min_rate', c_int64),
+ ('rc_max_available_vbv_use', c_float),
+ ('rc_min_vbv_overflow_use', c_float),
+ ('rc_initial_buffer_occupancy', c_int),
+ ('coder_type', c_int), # Deprecated. Removed in 59.
+ ('context_model', c_int), # Deprecated. Removed in 59.
+ ('frame_skip_threshold', c_int), # Deprecated. Removed in 59.
+ ('frame_skip_factor', c_int), # Deprecated. Removed in 59.
+ ('frame_skip_exp', c_int), # Deprecated. Removed in 59.
+ ('frame_skip_cmp', c_int), # Deprecated. Removed in 59.
+ ('trellis', c_int),
+ ('min_prediction_order', c_int), # Deprecated. Removed in 59.
+ ('max_prediction_order', c_int), # Deprecated. Removed in 59.
+ ('timecode_frame_start', c_int64), # Deprecated. Removed in 59.
+ ('rtp_callback', CFUNCTYPE(None, # Deprecated. Removed in 59.
+ POINTER(AVCodecContext), c_void_p, c_int, c_int)),
+ ('rtp_payload_size', c_int), # Deprecated. Removed in 59.
+ ('mv_bits', c_int), # Deprecated. Removed in 59.
+ ('header_bits', c_int), # Deprecated. Removed in 59.
+ ('i_tex_bits', c_int), # Deprecated. Removed in 59.
+ ('p_tex_bits', c_int), # Deprecated. Removed in 59.
+ ('i_count', c_int), # Deprecated. Removed in 59.
+ ('p_count', c_int), # Deprecated. Removed in 59.
+ ('skip_count', c_int), # Deprecated. Removed in 59.
+ ('misc_bits', c_int), # Deprecated. Removed in 59.
+ ('frame_bits', c_int), # Deprecated. Removed in 59.
+ ('stats_out', c_char_p),
+ ('stats_in', c_char_p),
+ ('workaround_bugs', c_int),
+ ('strict_std_compliance', c_int),
+ ('error_concealment', c_int),
+ ('debug', c_int),
+ ('err_recognition', c_int),
+ ('reordered_opaque', c_int64),
+ ('hwaccel', POINTER(AVHWAccel)),
+ ('hwaccel_context', c_void_p),
+ ('error', c_uint64 * AV_NUM_DATA_POINTERS),
+ ('dct_algo', c_int),
+ ('idct_algo', c_int),
+ ('bits_per_coded_sample', c_int),
+ ('bits_per_raw_sample', c_int),
+ ('lowres', c_int),
+ ('coded_frame', POINTER(AVFrame)), # Deprecated. Removed in 59.
+ ('thread_count', c_int),
+ ('thread_type', c_int),
+ ('active_thread_type', c_int),
+ ('thread_safe_callbacks', c_int),
+ ('execute', CFUNCTYPE(c_int,
+ POINTER(AVCodecContext),
+ CFUNCTYPE(c_int, POINTER(AVCodecContext), c_void_p),
+ c_void_p, c_int, c_int, c_int)),
+ ('execute2', CFUNCTYPE(c_int,
+ POINTER(AVCodecContext),
+ CFUNCTYPE(c_int, POINTER(AVCodecContext), c_void_p, c_int, c_int),
+ c_void_p, c_int, c_int)),
+ ('nsse_weight', c_int),
+ ('profile', c_int),
+ ('level', c_int),
+ ('skip_loop_filter', c_int),
+ ('skip_idct', c_int),
+ ('skip_frame', c_int),
+ ('subtitle_header', POINTER(c_uint8)),
+ ('subtitle_header_size', c_int),
+ ('vbv_delay', c_uint64), # Deprecated. Removed in 59.
+ ('side_data_only_packets', c_int), # Deprecated. Removed in 59.
+ ('initial_padding', c_int),
+ ('framerate', AVRational),
+ # !
+ ('sw_pix_fmt', c_int),
+ ('pkt_timebase', AVRational),
+ ('codec_dexcriptor', AVCodecDescriptor),
+ ('pts_correction_num_faulty_pts', c_int64),
+ ('pts_correction_num_faulty_dts', c_int64),
+ ('pts_correction_last_pts', c_int64),
+ ('pts_correction_last_dts', c_int64),
+ ('sub_charenc', c_char_p),
+ ('sub_charenc_mode', c_int),
+ ('skip_alpha', c_int),
+ ('seek_preroll', c_int),
+ ('debug_mv', c_int),
+ ('chroma_intra_matrix', POINTER(c_uint16)),
+ ('dump_separator', POINTER(c_uint8)),
+ ('codec_whitelist', c_char_p),
+ ('properties', c_uint),
+ ('coded_side_data', POINTER(AVPacketSideData)),
+ ('nb_coded_side_data', c_int),
+ ('hw_frames_ctx', POINTER(AVBufferRef)),
+ ('sub_text_format', c_int),
+ ('trailing_padding', c_int),
+ ('max_pixels', c_int64),
+ ('hw_device_ctx', POINTER(AVBufferRef)),
+ ('hwaccel_flags', c_int),
+ ('apply_cropping', c_int),
+ ('extra_hw_frames', c_int)
+]
+
+compat.add_version_changes('avcodec', 58, AVCodecContext, AVCodecContext_Fields, removals=None)
+
+compat.add_version_changes('avcodec', 59, AVCodecContext, AVCodecContext_Fields,
+ removals=('b_frame_strategy', 'mpeg_quant', 'prediction_method', 'pre_me', 'scenechange_threshold',
+ 'noise_reduction', 'me_penalty_compensation', 'brd_scale', 'chromaoffset', 'b_sensitivity',
+ 'refcounted_frames', 'coder_type', 'context_model', 'coder_type', 'context_model',
+ 'frame_skip_threshold', 'frame_skip_factor', 'frame_skip_exp', 'frame_skip_cmp',
+ 'min_prediction_order', 'max_prediction_order', 'timecode_frame_start', 'rtp_callback',
+ 'rtp_payload_size', 'mv_bits', 'header_bits', 'i_tex_bits', 'p_tex_bits', 'i_count', 'p_count',
+ 'skip_count', 'misc_bits', 'frames_bits', 'coded_frame', 'vbv_delay', 'side_data_only_packets')
+)
+
+AV_CODEC_ID_VP8 = 139
+AV_CODEC_ID_VP9 = 167
+
+avcodec.av_packet_unref.argtypes = [POINTER(AVPacket)]
+avcodec.av_packet_free.argtypes = [POINTER(POINTER(AVPacket))]
+avcodec.av_packet_clone.restype = POINTER(AVPacket)
+avcodec.av_packet_clone.argtypes = [POINTER(AVPacket)]
+avcodec.av_packet_move_ref.argtypes = [POINTER(AVPacket), POINTER(AVPacket)]
+avcodec.avcodec_find_decoder.restype = POINTER(AVCodec)
+avcodec.avcodec_find_decoder.argtypes = [c_int]
+AVDictionary = libavutil.AVDictionary
+avcodec.avcodec_open2.restype = c_int
+avcodec.avcodec_open2.argtypes = [POINTER(AVCodecContext),
+ POINTER(AVCodec),
+ POINTER(POINTER(AVDictionary))]
+avcodec.avcodec_free_context.argtypes = [POINTER(POINTER(AVCodecContext))]
+avcodec.av_packet_alloc.restype = POINTER(AVPacket)
+avcodec.av_init_packet.argtypes = [POINTER(AVPacket)]
+
+avcodec.avcodec_receive_frame.restype = c_int
+avcodec.avcodec_receive_frame.argtypes = [POINTER(AVCodecContext), POINTER(AVFrame)]
+
+avcodec.avcodec_send_packet.restype = c_int
+avcodec.avcodec_send_packet.argtypes = [POINTER(AVCodecContext), POINTER(AVPacket)]
+
+avcodec.avcodec_flush_buffers.argtypes = [POINTER(AVCodecContext)]
+avcodec.avcodec_alloc_context3.restype = POINTER(AVCodecContext)
+avcodec.avcodec_alloc_context3.argtypes = [POINTER(AVCodec)]
+avcodec.avcodec_free_context.argtypes = [POINTER(POINTER(AVCodecContext))]
+avcodec.avcodec_parameters_to_context.restype = c_int
+avcodec.avcodec_parameters_to_context.argtypes = [POINTER(AVCodecContext),
+ POINTER(AVCodecParameters)]
+avcodec.avcodec_get_name.restype = c_char_p
+avcodec.avcodec_get_name.argtypes = [c_int]
+avcodec.avcodec_find_decoder_by_name.restype = POINTER(AVCodec)
+avcodec.avcodec_find_decoder_by_name.argtypes = [c_char_p]
+
+__all__ = [
+ 'avcodec',
+ 'FF_INPUT_BUFFER_PADDING_SIZE',
+ 'AVPacket',
+ 'AVCodecContext',
+ 'AV_CODEC_ID_VP8',
+ 'AV_CODEC_ID_VP9',
+]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libavformat.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libavformat.py
new file mode 100644
index 0000000000000000000000000000000000000000..50fa1b47dcdd1f955891fa2db76d711ece07b1c6
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libavformat.py
@@ -0,0 +1,311 @@
+"""Wrapper for include/libavformat/avformat.h
+"""
+from ctypes import c_int, c_int64
+from ctypes import c_uint8, c_uint, c_double, c_ubyte, c_size_t, c_char, c_char_p
+from ctypes import c_void_p, POINTER, CFUNCTYPE, Structure
+
+import pyglet.lib
+from pyglet.util import debug_print
+from . import compat
+from . import libavcodec
+from . import libavutil
+
+_debug = debug_print('debug_media')
+
+avformat = pyglet.lib.load_library(
+ 'avformat',
+ win32=('avformat-59', 'avformat-58'),
+ darwin=('avformat.59', 'avformat.58')
+)
+
+avformat.avformat_version.restype = c_int
+
+compat.set_version('avformat', avformat.avformat_version() >> 16)
+
+AVSEEK_FLAG_BACKWARD = 1 # ///< seek backward
+AVSEEK_FLAG_BYTE = 2 # ///< seeking based on position in bytes
+AVSEEK_FLAG_ANY = 4 # ///< seek to any frame, even non-keyframes
+AVSEEK_FLAG_FRAME = 8 # ///< seeking based on frame number
+AVSEEK_SIZE = 0x10000
+AVFMT_FLAG_CUSTOM_IO = 0x0080
+
+MAX_REORDER_DELAY = 16
+
+
+class AVPacketList(Structure):
+ pass
+
+
+class AVInputFormat(Structure):
+ _fields_ = [
+ ('name', c_char_p)
+ ]
+
+
+class AVOutputFormat(Structure):
+ pass
+
+
+class AVIOContext(Structure):
+ pass
+
+
+class AVIndexEntry(Structure):
+ pass
+
+
+class AVStreamInfo(Structure):
+ _fields_ = [
+ ('last_dts', c_int64),
+ ('duration_gcd', c_int64),
+ ('duration_count', c_int),
+ ('rfps_duration_sum', c_int64),
+ ('duration_error', POINTER(c_double * 2 * (30 * 12 + 30 + 3 + 6))),
+ ('codec_info_duration', c_int64),
+ ('codec_info_duration_fields', c_int64),
+ ('frame_delay_evidence', c_int),
+ ('found_decoder', c_int),
+ ('last_duration', c_int64),
+ ('fps_first_dts', c_int64),
+ ('fps_first_dts_idx', c_int),
+ ('fps_last_dts', c_int64),
+ ('fps_last_dts_idx', c_int),
+ ]
+
+
+class AVProbeData(Structure):
+ _fields_ = [
+ ('filename', c_char_p),
+ ('buf', POINTER(c_ubyte)),
+ ('buf_size', c_int),
+ ('mime_type', c_char_p)
+ ]
+
+
+class FFFrac(Structure):
+ pass
+
+
+class AVStreamInternal(Structure):
+ pass
+
+
+class AVFrac(Structure):
+ _fields_ = [
+ ('val', c_int64),
+ ('num', c_int64),
+ ('den', c_int64),
+ ]
+
+
+AVCodecContext = libavcodec.AVCodecContext
+AVPacketSideData = libavcodec.AVPacketSideData
+AVPacket = libavcodec.AVPacket
+AVCodecParserContext = libavcodec.AVCodecParserContext
+AVCodecParameters = libavcodec.AVCodecParameters
+AVRational = libavutil.AVRational
+AVDictionary = libavutil.AVDictionary
+AVFrame = libavutil.AVFrame
+AVClass = libavutil.AVClass
+AVCodec = libavcodec.AVCodec
+
+
+
+class AVStream(Structure):
+ pass
+
+AVStream_Fields = [
+ ('index', c_int),
+ ('id', c_int),
+ ('codec', POINTER(AVCodecContext)), # Deprecated. Removed in 59.
+ ('priv_data', c_void_p),
+ ('time_base', AVRational),
+ ('start_time', c_int64),
+ ('duration', c_int64),
+ ('nb_frames', c_int64),
+ ('disposition', c_int),
+ ('discard', c_int),
+ ('sample_aspect_ratio', AVRational),
+ ('metadata', POINTER(AVDictionary)),
+ ('avg_frame_rate', AVRational),
+ ('attached_pic', AVPacket),
+ ('side_data', POINTER(AVPacketSideData)),
+ ('nb_side_data', c_int),
+ ('event_flags', c_int),
+ ('r_frame_rate', AVRational),
+ ('recommended_encoder_configuration', c_char_p), # Deprecated. Removed in 59.
+ ('codecpar', POINTER(AVCodecParameters)),
+ ('info', POINTER(AVStreamInfo)), # Deprecated. Removed in 59.
+ ('pts_wrap_bits', c_int),
+ ]
+
+compat.add_version_changes('avformat', 58, AVStream, AVStream_Fields, removals=None)
+
+compat.add_version_changes('avformat', 59, AVStream, AVStream_Fields,
+ removals=('codec', 'recommended_encoder_configuration', 'info'))
+
+
+class AVProgram(Structure):
+ pass
+
+
+class AVChapter(Structure):
+ pass
+
+
+class AVFormatInternal(Structure):
+ pass
+
+
+class AVIOInterruptCB(Structure):
+ _fields_ = [
+ ('callback', CFUNCTYPE(c_int, c_void_p)),
+ ('opaque', c_void_p)
+ ]
+
+
+class AVFormatContext(Structure):
+ pass
+
+
+AVFormatContext_Fields = [
+ ('av_class', POINTER(AVClass)),
+ ('iformat', POINTER(AVInputFormat)),
+ ('oformat', POINTER(AVOutputFormat)),
+ ('priv_data', c_void_p),
+ ('pb', POINTER(AVIOContext)),
+ ('ctx_flags', c_int),
+ ('nb_streams', c_uint),
+ ('streams', POINTER(POINTER(AVStream))),
+ ('filename', c_char * 1024), # Deprecated. Removed in 59
+ ('url', c_char_p),
+ ('start_time', c_int64),
+ ('duration', c_int64),
+ ('bit_rate', c_int64),
+ ('packet_size', c_uint),
+ ('max_delay', c_int),
+ ('flags', c_int),
+ ('probesize', c_int64),
+ ('max_analyze_duration', c_int64),
+ ('key', POINTER(c_uint8)),
+ ('keylen', c_int),
+ ('nb_programs', c_uint),
+ ('programs', POINTER(POINTER(AVProgram))),
+ ('video_codec_id', c_int),
+ ('audio_codec_id', c_int),
+ ('subtitle_codec_id', c_int),
+ ('max_index_size', c_uint),
+ ('max_picture_buffer', c_uint),
+ ('nb_chapters', c_uint),
+ ('chapters', POINTER(POINTER(AVChapter))),
+ ('metadata', POINTER(AVDictionary)),
+ ('start_time_realtime', c_int64),
+ ('fps_probe_size', c_int),
+ ('error_recognition', c_int),
+ ('interrupt_callback', AVIOInterruptCB),
+ ('debug', c_int),
+ ('max_interleave_delta', c_int64),
+ ('strict_std_compliance', c_int),
+ ('event_flags', c_int),
+ ('max_ts_probe', c_int),
+ ('avoid_negative_ts', c_int),
+ ('ts_id', c_int),
+ ('audio_preload', c_int),
+ ('max_chunk_duration', c_int),
+ ('max_chunk_size', c_int),
+ ('use_wallclock_as_timestamps', c_int),
+ ('avio_flags', c_int),
+ ('duration_estimation_method', c_uint),
+ ('skip_initial_bytes', c_int64),
+ ('correct_ts_overflow', c_uint),
+ ('seek2any', c_int),
+ ('flush_packets', c_int),
+ ('probe_score', c_int),
+ ('format_probesize', c_int),
+ ('codec_whitelist', c_char_p),
+ ('format_whitelist', c_char_p),
+ ('internal', POINTER(AVFormatInternal)), # Deprecated. Removed in 59
+ ('io_repositioned', c_int),
+ ('video_codec', POINTER(AVCodec)),
+ ('audio_codec', POINTER(AVCodec)),
+ ('subtitle_codec', POINTER(AVCodec)),
+ ('data_codec', POINTER(AVCodec)),
+ ('metadata_header_padding', c_int),
+ ('opaque', c_void_p),
+ ('control_message_cb', CFUNCTYPE(c_int,
+ POINTER(AVFormatContext), c_int, c_void_p,
+ c_size_t)),
+ ('output_ts_offset', c_int64),
+ ('dump_separator', POINTER(c_uint8)),
+ ('data_codec_id', c_int),
+ ('protocol_whitelist', c_char_p),
+ ('io_open', CFUNCTYPE(c_int,
+ POINTER(AVFormatContext),
+ POINTER(POINTER(AVIOContext)),
+ c_char_p, c_int,
+ POINTER(POINTER(AVDictionary)))),
+ ('io_close', CFUNCTYPE(None,
+ POINTER(AVFormatContext), POINTER(AVIOContext))),
+ ('protocol_blacklist', c_char_p),
+ ('max_streams', c_int),
+ ('skip_estimate_duration_from_pts', c_int), # Added in 59.
+ ('max_probe_packets', c_int), # Added in 59.
+ ('io_close2', CFUNCTYPE(c_int, POINTER(AVFormatContext), POINTER(AVIOContext))) # Added in 59.
+]
+
+compat.add_version_changes('avformat', 58, AVFormatContext, AVFormatContext_Fields,
+ removals=('skip_estimate_duration_from_pts', 'max_probe_packets', 'io_close2'))
+
+compat.add_version_changes('avformat', 59, AVFormatContext, AVFormatContext_Fields,
+ removals=('filename', 'internal'))
+
+
+avformat.av_find_input_format.restype = c_int
+avformat.av_find_input_format.argtypes = [c_int]
+avformat.avformat_open_input.restype = c_int
+avformat.avformat_open_input.argtypes = [
+ POINTER(POINTER(AVFormatContext)),
+ c_char_p,
+ POINTER(AVInputFormat),
+ POINTER(POINTER(AVDictionary))]
+avformat.avformat_find_stream_info.restype = c_int
+avformat.avformat_find_stream_info.argtypes = [
+ POINTER(AVFormatContext),
+ POINTER(POINTER(AVDictionary))]
+avformat.avformat_close_input.restype = None
+avformat.avformat_close_input.argtypes = [
+ POINTER(POINTER(AVFormatContext))]
+avformat.av_read_frame.restype = c_int
+avformat.av_read_frame.argtypes = [POINTER(AVFormatContext),
+ POINTER(AVPacket)]
+avformat.av_seek_frame.restype = c_int
+avformat.av_seek_frame.argtypes = [POINTER(AVFormatContext),
+ c_int, c_int64, c_int]
+avformat.avformat_seek_file.restype = c_int
+avformat.avformat_seek_file.argtypes = [POINTER(AVFormatContext),
+ c_int, c_int64, c_int64, c_int64, c_int]
+avformat.av_guess_frame_rate.restype = AVRational
+avformat.av_guess_frame_rate.argtypes = [POINTER(AVFormatContext),
+ POINTER(AVStream), POINTER(AVFrame)]
+
+ffmpeg_read_func = CFUNCTYPE(c_int, c_void_p, POINTER(c_char), c_int)
+ffmpeg_write_func = CFUNCTYPE(c_int, c_void_p, POINTER(c_char), c_int)
+ffmpeg_seek_func = CFUNCTYPE(c_int64, c_void_p, c_int64, c_int)
+
+avformat.avio_alloc_context.restype = POINTER(AVIOContext)
+avformat.avio_alloc_context.argtypes = [c_char_p, c_int, c_int, c_void_p, ffmpeg_read_func, c_void_p, ffmpeg_seek_func]
+
+avformat.avformat_alloc_context.restype = POINTER(AVFormatContext)
+avformat.avformat_alloc_context.argtypes = []
+
+avformat.avformat_free_context.restype = c_void_p
+avformat.avformat_free_context.argtypes = [POINTER(AVFormatContext)]
+
+__all__ = [
+ 'avformat',
+ 'AVSEEK_FLAG_BACKWARD',
+ 'AVSEEK_FLAG_BYTE',
+ 'AVSEEK_FLAG_ANY',
+ 'AVSEEK_FLAG_FRAME',
+ 'AVFormatContext'
+]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libavutil.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libavutil.py
new file mode 100644
index 0000000000000000000000000000000000000000..540bf23c5c34ce8bed08eefb944f7c022ee5d3c6
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libavutil.py
@@ -0,0 +1,240 @@
+"""Wrapper for include/libavutil/avutil.h
+"""
+from ctypes import c_char_p, c_void_p, POINTER, Structure
+from ctypes import c_int, c_int64, c_uint64
+from ctypes import c_uint8, c_int8, c_uint, c_size_t
+
+import pyglet.lib
+from pyglet.util import debug_print
+from . import compat
+
+_debug = debug_print('debug_media')
+
+avutil = pyglet.lib.load_library(
+ 'avutil',
+ win32=('avutil-57', 'avutil-56'),
+ darwin=('avutil.57', 'avutil-56')
+)
+
+avutil.avutil_version.restype = c_int
+compat.set_version('avutil', avutil.avutil_version() >> 16)
+
+AVMEDIA_TYPE_UNKNOWN = -1
+AVMEDIA_TYPE_VIDEO = 0
+AVMEDIA_TYPE_AUDIO = 1
+AVMEDIA_TYPE_DATA = 2
+AVMEDIA_TYPE_SUBTITLE = 3
+AVMEDIA_TYPE_ATTACHMENT = 4
+AVMEDIA_TYPE_NB = 5
+
+AV_SAMPLE_FMT_U8 = 0
+AV_SAMPLE_FMT_S16 = 1
+AV_SAMPLE_FMT_S32 = 2
+AV_SAMPLE_FMT_FLT = 3
+AV_SAMPLE_FORMAT_DOUBLE = 4
+AV_SAMPLE_FMT_U8P = 5
+AV_SAMPLE_FMT_S16P = 6
+AV_SAMPLE_FMT_S32P = 7
+AV_SAMPLE_FMT_FLTP = 8
+AV_SAMPLE_FMT_DBLP = 9
+AV_SAMPLE_FMT_S64 = 10
+AV_SAMPLE_FMT_S64P = 11
+
+AV_NUM_DATA_POINTERS = 8
+
+AV_PIX_FMT_RGB24 = 2
+AV_PIX_FMT_ARGB = 25
+AV_PIX_FMT_RGBA = 26
+
+AVChannelOrder = c_int
+class AVChannelLayout(Structure):
+ _fields_ = [
+ ('order', c_int),
+ ('nb_channels', c_int),
+ # .. more
+ ]
+class AVBuffer(Structure):
+ _fields_ = [
+ ('data', POINTER(c_uint8)),
+ ('size', c_int),
+ # .. more
+ ]
+
+
+class AVBufferRef(Structure):
+ _fields_ = [
+ ('buffer', POINTER(AVBuffer)),
+ ('data', POINTER(c_uint8)),
+ ('size', c_int)
+ ]
+
+
+class AVDictionaryEntry(Structure):
+ _fields_ = [
+ ('key', c_char_p),
+ ('value', c_char_p)
+ ]
+
+
+class AVDictionary(Structure):
+ _fields_ = [
+ ('count', c_int),
+ ('elems', POINTER(AVDictionaryEntry))
+ ]
+
+
+class AVClass(Structure):
+ pass
+
+
+class AVRational(Structure):
+ _fields_ = [
+ ('num', c_int),
+ ('den', c_int)
+ ]
+
+ def __repr__(self):
+ return f"AVRational({self.num}/{self.den})"
+
+
+class AVFrameSideData(Structure):
+ pass
+
+
+class AVFrame(Structure):
+ pass
+
+AVFrame_Fields = [
+ ('data', POINTER(c_uint8) * AV_NUM_DATA_POINTERS),
+ ('linesize', c_int * AV_NUM_DATA_POINTERS),
+ ('extended_data', POINTER(POINTER(c_uint8))),
+ ('width', c_int),
+ ('height', c_int),
+ ('nb_samples', c_int),
+ ('format', c_int),
+ ('key_frame', c_int),
+ ('pict_type', c_int),
+ ('sample_aspect_ratio', AVRational),
+ ('pts', c_int64),
+ ('pkt_pts', c_int64), # Deprecated. Removed in 57.
+ ('pkt_dts', c_int64),
+ ('time_base', AVRational), # (5.x)
+ ('coded_picture_number', c_int),
+ ('display_picture_number', c_int),
+ ('quality', c_int),
+ ('opaque', c_void_p),
+ ('error', c_uint64 * AV_NUM_DATA_POINTERS), # Deprecated. Removed in 57.
+ ('repeat_pict', c_int),
+ ('interlaced_frame', c_int),
+ ('top_field_first', c_int),
+ ('palette_has_changed', c_int),
+ ('reordered_opaque', c_int64),
+ ('sample_rate', c_int),
+ ('channel_layout', c_uint64),
+ ('buf', POINTER(AVBufferRef) * AV_NUM_DATA_POINTERS),
+ ('extended_buf', POINTER(POINTER(AVBufferRef))),
+ ('nb_extended_buf', c_int),
+ ('side_data', POINTER(POINTER(AVFrameSideData))),
+ ('nb_side_data', c_int),
+ ('flags', c_int),
+ ('color_range', c_int),
+ ('color_primaries', c_int),
+ ('color_trc', c_int),
+ ('colorspace', c_int),
+ ('chroma_location', c_int),
+ ('best_effort_timestamp', c_int64),
+ ('pkt_pos', c_int64),
+ ('pkt_duration', c_int64),
+ # !
+ ('metadata', POINTER(AVDictionary)),
+ ('decode_error_flags', c_int),
+ ('channels', c_int),
+ ('pkt_size', c_int),
+ ('qscale_table', POINTER(c_int8)), # Deprecated. Removed in 57.
+ ('qstride', c_int), # Deprecated. Removed in 57.
+ ('qscale_type', c_int), # Deprecated. Removed in 57.
+ ('qp_table_buf', POINTER(AVBufferRef)), # Deprecated. Removed in 57.
+ ('hw_frames_ctx', POINTER(AVBufferRef)),
+ ('opaque_ref', POINTER(AVBufferRef)),
+ ('crop_top', c_size_t), # video frames only
+ ('crop_bottom', c_size_t), # video frames only
+ ('crop_left', c_size_t), # video frames only
+ ('crop_right', c_size_t), # video frames only
+ ('private_ref', POINTER(AVBufferRef)),
+]
+
+compat.add_version_changes('avutil', 56, AVFrame, AVFrame_Fields,
+ removals=('time_base',))
+
+compat.add_version_changes('avutil', 57, AVFrame, AVFrame_Fields,
+ removals=('pkt_pts', 'error', 'qscale_table', 'qstride', 'qscale_type', 'qp_table_buf'))
+
+AV_NOPTS_VALUE = -0x8000000000000000
+AV_TIME_BASE = 1000000
+AV_TIME_BASE_Q = AVRational(1, AV_TIME_BASE)
+
+avutil.av_version_info.restype = c_char_p
+avutil.av_dict_get.restype = POINTER(AVDictionaryEntry)
+avutil.av_dict_get.argtypes = [POINTER(AVDictionary),
+ c_char_p, POINTER(AVDictionaryEntry),
+ c_int]
+avutil.av_rescale_q.restype = c_int64
+avutil.av_rescale_q.argtypes = [c_int64, AVRational, AVRational]
+avutil.av_samples_get_buffer_size.restype = c_int
+avutil.av_samples_get_buffer_size.argtypes = [POINTER(c_int),
+ c_int, c_int, c_int]
+avutil.av_frame_alloc.restype = POINTER(AVFrame)
+avutil.av_frame_free.argtypes = [POINTER(POINTER(AVFrame))]
+avutil.av_get_default_channel_layout.restype = c_int64
+avutil.av_get_default_channel_layout.argtypes = [c_int]
+avutil.av_get_bytes_per_sample.restype = c_int
+avutil.av_get_bytes_per_sample.argtypes = [c_int]
+avutil.av_strerror.restype = c_int
+avutil.av_strerror.argtypes = [c_int, c_char_p, c_size_t]
+
+avutil.av_image_fill_arrays.restype = c_int
+avutil.av_image_fill_arrays.argtypes = [POINTER(c_uint8) * 4, c_int * 4,
+ POINTER(c_uint8), c_int, c_int, c_int, c_int]
+avutil.av_dict_set.restype = c_int
+avutil.av_dict_set.argtypes = [POINTER(POINTER(AVDictionary)),
+ c_char_p, c_char_p, c_int]
+avutil.av_dict_free.argtypes = [POINTER(POINTER(AVDictionary))]
+avutil.av_log_set_level.restype = c_int
+avutil.av_log_set_level.argtypes = [c_uint]
+avutil.av_malloc.restype = c_void_p
+avutil.av_malloc.argtypes = [c_int]
+avutil.av_freep.restype = c_void_p
+avutil.av_freep.argtypes = [c_void_p]
+
+__all__ = [
+ 'avutil',
+ 'AVMEDIA_TYPE_UNKNOWN',
+ 'AVMEDIA_TYPE_VIDEO',
+ 'AVMEDIA_TYPE_AUDIO',
+ 'AVMEDIA_TYPE_DATA',
+ 'AVMEDIA_TYPE_SUBTITLE',
+ 'AVMEDIA_TYPE_ATTACHMENT',
+ 'AVMEDIA_TYPE_NB',
+ 'AV_SAMPLE_FMT_U8',
+ 'AV_SAMPLE_FMT_S16',
+ 'AV_SAMPLE_FMT_S32',
+ 'AV_SAMPLE_FMT_FLT',
+ 'AV_SAMPLE_FORMAT_DOUBLE',
+ 'AV_SAMPLE_FMT_U8P',
+ 'AV_SAMPLE_FMT_S16P',
+ 'AV_SAMPLE_FMT_S32P',
+ 'AV_SAMPLE_FMT_FLTP',
+ 'AV_SAMPLE_FMT_DBLP',
+ 'AV_SAMPLE_FMT_S64',
+ 'AV_SAMPLE_FMT_S64P',
+ 'AV_NUM_DATA_POINTERS',
+ 'AV_PIX_FMT_RGB24',
+ 'AV_PIX_FMT_ARGB',
+ 'AV_PIX_FMT_RGBA',
+ 'AV_NOPTS_VALUE',
+ 'AV_TIME_BASE',
+ 'AV_TIME_BASE_Q',
+ 'AVFrame',
+ 'AVRational',
+ 'AVDictionary',
+]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libswresample.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libswresample.py
new file mode 100644
index 0000000000000000000000000000000000000000..21b3b74d5fee8a34d502c789e7bc1b89cf9f31ea
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libswresample.py
@@ -0,0 +1,54 @@
+"""Wrapper for include/libswresample/swresample.h
+"""
+from ctypes import c_int, c_int64
+from ctypes import c_uint8
+from ctypes import c_void_p, POINTER, Structure
+
+import pyglet.lib
+from pyglet.util import debug_print
+from . import compat
+
+_debug = debug_print('debug_media')
+
+swresample = pyglet.lib.load_library(
+ 'swresample',
+ win32=('swresample-4', 'swresample-3'),
+ darwin=('swresample.4', 'swresample.3')
+)
+
+swresample.swresample_version.restype = c_int
+
+compat.set_version('swresample', swresample.swresample_version() >> 16)
+
+
+SWR_CH_MAX = 32
+
+
+class SwrContext(Structure):
+ pass
+
+
+swresample.swr_alloc_set_opts.restype = POINTER(SwrContext)
+swresample.swr_alloc_set_opts.argtypes = [POINTER(SwrContext),
+ c_int64, c_int, c_int, c_int64,
+ c_int, c_int, c_int, c_void_p]
+swresample.swr_init.restype = c_int
+swresample.swr_init.argtypes = [POINTER(SwrContext)]
+swresample.swr_free.argtypes = [POINTER(POINTER(SwrContext))]
+swresample.swr_convert.restype = c_int
+swresample.swr_convert.argtypes = [POINTER(SwrContext),
+ POINTER(c_uint8) * SWR_CH_MAX,
+ c_int,
+ POINTER(POINTER(c_uint8)),
+ c_int]
+swresample.swr_set_compensation.restype = c_int
+swresample.swr_set_compensation.argtypes = [POINTER(SwrContext),
+ c_int, c_int]
+swresample.swr_get_out_samples.restype = c_int
+swresample.swr_get_out_samples.argtypes = [POINTER(SwrContext), c_int]
+
+__all__ = [
+ 'swresample',
+ 'SWR_CH_MAX',
+ 'SwrContext'
+]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libswscale.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libswscale.py
new file mode 100644
index 0000000000000000000000000000000000000000..8c135870d776e6b7d7129edaee81488d2019a9b4
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/ffmpeg_lib/libswscale.py
@@ -0,0 +1,56 @@
+"""Wrapper for include/libswscale/swscale.h
+"""
+from ctypes import POINTER, Structure
+from ctypes import c_int
+from ctypes import c_uint8, c_double
+
+import pyglet.lib
+from pyglet.util import debug_print
+from . import compat
+
+_debug = debug_print('debug_media')
+
+
+swscale = pyglet.lib.load_library(
+ 'swscale',
+ win32=('swscale-6', 'swscale-5'),
+ darwin=('swscale.6', 'swscale.5')
+)
+
+swscale.swscale_version.restype = c_int
+
+compat.set_version('swscale', swscale.swscale_version() >> 16)
+
+
+SWS_FAST_BILINEAR = 1
+
+
+class SwsContext(Structure):
+ pass
+
+
+class SwsFilter(Structure):
+ pass
+
+
+swscale.sws_getCachedContext.restype = POINTER(SwsContext)
+swscale.sws_getCachedContext.argtypes = [POINTER(SwsContext),
+ c_int, c_int, c_int, c_int,
+ c_int, c_int, c_int,
+ POINTER(SwsFilter), POINTER(SwsFilter),
+ POINTER(c_double)]
+swscale.sws_freeContext.argtypes = [POINTER(SwsContext)]
+swscale.sws_scale.restype = c_int
+swscale.sws_scale.argtypes = [POINTER(SwsContext),
+ POINTER(POINTER(c_uint8)),
+ POINTER(c_int),
+ c_int, c_int,
+ POINTER(POINTER(c_uint8)),
+ POINTER(c_int)]
+
+__all__ = [
+ 'swscale',
+ 'SWS_FAST_BILINEAR',
+ 'SwsContext',
+ 'SwsFilter'
+]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/gstreamer.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/gstreamer.py
new file mode 100644
index 0000000000000000000000000000000000000000..9f2f27abac5b645ac161b2256fbf784e5d66fb2a
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/gstreamer.py
@@ -0,0 +1,270 @@
+"""Multi-format decoder using Gstreamer.
+"""
+import queue
+import atexit
+import weakref
+import tempfile
+
+from threading import Event, Thread
+
+from pyglet.util import DecodeException
+from .base import StreamingSource, AudioData, AudioFormat, StaticSource
+from . import MediaEncoder, MediaDecoder
+
+try:
+ import gi
+ gi.require_version('Gst', '1.0')
+ from gi.repository import Gst, GLib
+except (ValueError, ImportError) as e:
+ raise ImportError(e)
+
+
+class GStreamerDecodeException(DecodeException):
+ pass
+
+
+class _GLibMainLoopThread(Thread):
+ """A background Thread for a GLib MainLoop"""
+ def __init__(self):
+ super().__init__(daemon=True)
+ self.mainloop = GLib.MainLoop.new(None, False)
+ self.start()
+
+ def run(self):
+ self.mainloop.run()
+
+
+class _MessageHandler:
+ """Message Handler class for GStreamer Sources.
+
+ This separate class holds a weak reference to the
+ Source, preventing garbage collection issues.
+
+ """
+ def __init__(self, source):
+ self.source = weakref.proxy(source)
+
+ def message(self, bus, message):
+ """The main message callback"""
+ if message.type == Gst.MessageType.EOS:
+
+ self.source.queue.put(self.source.sentinal)
+ if not self.source.caps:
+ raise GStreamerDecodeException("Appears to be an unsupported file")
+
+ elif message.type == Gst.MessageType.ERROR:
+ raise GStreamerDecodeException(message.parse_error())
+
+ def notify_caps(self, pad, *args):
+ """notify::caps callback"""
+ self.source.caps = True
+ info = pad.get_current_caps().get_structure(0)
+
+ self.source._duration = pad.get_peer().query_duration(Gst.Format.TIME).duration / Gst.SECOND
+ channels = info.get_int('channels')[1]
+ sample_rate = info.get_int('rate')[1]
+ sample_size = int("".join(filter(str.isdigit, info.get_string('format'))))
+
+ self.source.audio_format = AudioFormat(channels=channels, sample_size=sample_size, sample_rate=sample_rate)
+
+ # Allow GStreamerSource.__init__ to complete:
+ self.source.is_ready.set()
+
+ def pad_added(self, element, pad):
+ """pad-added callback"""
+ name = pad.query_caps(None).to_string()
+ if name.startswith('audio/x-raw'):
+ nextpad = self.source.converter.get_static_pad('sink')
+ if not nextpad.is_linked():
+ self.source.pads = True
+ pad.link(nextpad)
+
+ def no_more_pads(self, element):
+ """Finished Adding pads"""
+ if not self.source.pads:
+ raise GStreamerDecodeException('No Streams Found')
+
+ def new_sample(self, sink):
+ """new-sample callback"""
+ # Pull the sample, and get its buffer:
+ buffer = sink.emit('pull-sample').get_buffer()
+ # Extract a copy of the memory in the buffer:
+ mem = buffer.extract_dup(0, buffer.get_size())
+ self.source.queue.put(mem)
+ return Gst.FlowReturn.OK
+
+ @staticmethod
+ def unknown_type(uridecodebin, decodebin, caps):
+ """unknown-type callback for unreadable files"""
+ streaminfo = caps.to_string()
+ if not streaminfo.startswith('audio/'):
+ return
+ raise GStreamerDecodeException(streaminfo)
+
+
+class GStreamerSource(StreamingSource):
+
+ source_instances = weakref.WeakSet()
+ sentinal = object()
+
+ def __init__(self, filename, file=None):
+ self._pipeline = Gst.Pipeline()
+
+ msg_handler = _MessageHandler(self)
+
+ if file:
+ file.seek(0)
+ self._file = tempfile.NamedTemporaryFile(buffering=False)
+ self._file.write(file.read())
+ filename = self._file.name
+
+ # Create the major parts of the pipeline:
+ self.filesrc = Gst.ElementFactory.make("filesrc", None)
+ self.decoder = Gst.ElementFactory.make("decodebin", None)
+ self.converter = Gst.ElementFactory.make("audioconvert", None)
+ self.appsink = Gst.ElementFactory.make("appsink", None)
+ if not all((self.filesrc, self.decoder, self.converter, self.appsink)):
+ raise GStreamerDecodeException("Could not initialize GStreamer.")
+
+ # Set callbacks for EOS and error messages:
+ self._pipeline.bus.add_signal_watch()
+ self._pipeline.bus.connect("message", msg_handler.message)
+
+ # Set the file path to load:
+ self.filesrc.set_property("location", filename)
+
+ # Set decoder callback handlers:
+ self.decoder.connect("pad-added", msg_handler.pad_added)
+ self.decoder.connect("no-more-pads", msg_handler.no_more_pads)
+ self.decoder.connect("unknown-type", msg_handler.unknown_type)
+
+ # Set the sink's capabilities and behavior:
+ self.appsink.set_property('caps', Gst.Caps.from_string('audio/x-raw,format=S16LE,layout=interleaved'))
+ self.appsink.set_property('drop', False)
+ self.appsink.set_property('sync', False)
+ self.appsink.set_property('max-buffers', 0) # unlimited
+ self.appsink.set_property('emit-signals', True)
+ # The callback to receive decoded data:
+ self.appsink.connect("new-sample", msg_handler.new_sample)
+
+ # Add all components to the pipeline:
+ self._pipeline.add(self.filesrc)
+ self._pipeline.add(self.decoder)
+ self._pipeline.add(self.converter)
+ self._pipeline.add(self.appsink)
+ # Link together necessary components:
+ self.filesrc.link(self.decoder)
+ self.decoder.link(self.converter)
+ self.converter.link(self.appsink)
+
+ # Callback to notify once the sink is ready:
+ self.caps_handler = self.appsink.get_static_pad("sink").connect("notify::caps", msg_handler.notify_caps)
+
+ # Set by callbacks:
+ self.pads = False
+ self.caps = False
+ self._pipeline.set_state(Gst.State.PLAYING)
+ self.queue = queue.Queue(5)
+ self._finished = Event()
+ # Wait until the is_ready event is set by a callback:
+ self.is_ready = Event()
+ if not self.is_ready.wait(timeout=1):
+ raise GStreamerDecodeException('Initialization Error')
+
+ GStreamerSource.source_instances.add(self)
+
+ def __del__(self):
+ self.delete()
+
+ def delete(self):
+ if hasattr(self, '_file'):
+ self._file.close()
+
+ try:
+ while not self.queue.empty():
+ self.queue.get_nowait()
+ sink = self.appsink.get_static_pad("sink")
+ if sink.handler_is_connected(self.caps_handler):
+ sink.disconnect(self.caps_handler)
+ self._pipeline.set_state(Gst.State.NULL)
+ self._pipeline.bus.remove_signal_watch()
+ self.filesrc.set_property("location", None)
+ except (ImportError, AttributeError):
+ pass
+
+ def get_audio_data(self, num_bytes, compensation_time=0.0):
+ if self._finished.is_set():
+ return None
+
+ data = bytes()
+ while len(data) < num_bytes:
+ packet = self.queue.get()
+ if packet == self.sentinal:
+ self._finished.set()
+ break
+ data += packet
+
+ if not data:
+ return None
+
+ timestamp = self._pipeline.query_position(Gst.Format.TIME).cur / Gst.SECOND
+ duration = self.audio_format.bytes_per_second / len(data)
+
+ return AudioData(data, len(data), timestamp, duration, [])
+
+ def seek(self, timestamp):
+ # First clear any data in the queue:
+ while not self.queue.empty():
+ self.queue.get_nowait()
+
+ self._pipeline.seek_simple(Gst.Format.TIME,
+ Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT,
+ timestamp * Gst.SECOND)
+ self._finished.clear()
+
+
+def _cleanup():
+ # At exist, ensure any remaining Source instances are cleaned up.
+ # If this is not done, GStreamer may hang due to dangling callbacks.
+ for src in GStreamerSource.source_instances:
+ src.delete()
+
+
+atexit.register(_cleanup)
+
+
+#########################################
+# Decoder class:
+#########################################
+
+class GStreamerDecoder(MediaDecoder):
+
+ def __init__(self):
+ Gst.init(None)
+ self._glib_loop = _GLibMainLoopThread()
+
+ def get_file_extensions(self):
+ return '.mp3', '.flac', '.ogg', '.m4a'
+
+ def decode(self, filename, file, streaming=True):
+
+ if not any(filename.endswith(ext) for ext in self.get_file_extensions()):
+ # Refuse to decode anything not specifically listed in the supported
+ # file extensions list. This decoder does not yet support video, but
+ # it would still decode it and return only the Audio track. This is
+ # not desired, since the other decoders will not get a turn. Instead
+ # we bail out and let pyglet pass it to the next codec (FFmpeg).
+ raise GStreamerDecodeException('Unsupported format.')
+
+ if streaming:
+ return GStreamerSource(filename, file)
+ else:
+ return StaticSource(GStreamerSource(filename, file))
+
+
+def get_decoders():
+ return [GStreamerDecoder()]
+
+
+def get_encoders():
+ return []
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/pyogg.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/pyogg.py
new file mode 100644
index 0000000000000000000000000000000000000000..744d2708541b3f7e65055c3dc1eb47f25213d26c
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/pyogg.py
@@ -0,0 +1,474 @@
+import pyogg
+
+import os.path
+import warnings
+
+from abc import abstractmethod
+from ctypes import c_void_p, POINTER, c_int, pointer, cast, c_char, c_char_p, CFUNCTYPE, c_ubyte
+from ctypes import memmove, create_string_buffer, byref
+
+from pyglet.media import StreamingSource
+from pyglet.media.codecs import AudioFormat, AudioData, MediaDecoder, StaticSource
+from pyglet.util import debug_print, DecodeException
+
+
+_debug = debug_print('Debug PyOgg codec')
+
+if _debug:
+ if not pyogg.PYOGG_OGG_AVAIL and not pyogg.PYOGG_VORBIS_AVAIL and not pyogg.PYOGG_VORBIS_FILE_AVAIL:
+ warnings.warn("PyOgg determined the ogg/vorbis libraries were not available.")
+
+ if not pyogg.PYOGG_FLAC_AVAIL:
+ warnings.warn("PyOgg determined the flac library was not available.")
+
+ if not pyogg.PYOGG_OPUS_AVAIL and not pyogg.PYOGG_OPUS_FILE_AVAIL:
+ warnings.warn("PyOgg determined the opus libraries were not available.")
+
+if not (
+ pyogg.PYOGG_OGG_AVAIL and not pyogg.PYOGG_VORBIS_AVAIL and not pyogg.PYOGG_VORBIS_FILE_AVAIL) and (
+ not pyogg.PYOGG_OPUS_AVAIL and not pyogg.PYOGG_OPUS_FILE_AVAIL) and not pyogg.PYOGG_FLAC_AVAIL:
+ raise ImportError("PyOgg determined no supported libraries were found")
+
+# Some monkey patching PyOgg for FLAC.
+if pyogg.PYOGG_FLAC_AVAIL:
+ # Original in PyOgg: FLAC__StreamDecoderEofCallback = CFUNCTYPE(FLAC__bool, POINTER(FLAC__StreamDecoder), c_void_p)
+ # FLAC__bool is not valid for this return type (at least for ctypes). Needs to be an int or an error occurs.
+ FLAC__StreamDecoderEofCallback = CFUNCTYPE(c_int, POINTER(pyogg.flac.FLAC__StreamDecoder), c_void_p)
+
+ # Override explicits with c_void_p, so we can support non-seeking FLAC's (CFUNCTYPE does not accept None).
+ pyogg.flac.libflac.FLAC__stream_decoder_init_stream.restype = pyogg.flac.FLAC__StreamDecoderInitStatus
+ pyogg.flac.libflac.FLAC__stream_decoder_init_stream.argtypes = [POINTER(pyogg.flac.FLAC__StreamDecoder),
+ pyogg.flac.FLAC__StreamDecoderReadCallback,
+ c_void_p, # Seek
+ c_void_p, # Tell
+ c_void_p, # Length
+ c_void_p, # EOF
+ pyogg.flac.FLAC__StreamDecoderWriteCallback,
+ pyogg.flac.FLAC__StreamDecoderMetadataCallback,
+ pyogg.flac.FLAC__StreamDecoderErrorCallback,
+ c_void_p]
+
+
+ def metadata_callback(self, decoder, metadata, client_data):
+ self.bits_per_sample = metadata.contents.data.stream_info.bits_per_sample # missing from pyogg
+ self.total_samples = metadata.contents.data.stream_info.total_samples
+ self.channels = metadata.contents.data.stream_info.channels
+ self.frequency = metadata.contents.data.stream_info.sample_rate
+
+
+ # Monkey patch metadata callback to include bits per sample as FLAC may rarely deviate from 16 bit.
+ pyogg.FlacFileStream.metadata_callback = metadata_callback
+
+
+class MemoryVorbisObject:
+ def __init__(self, file):
+ self.file = file
+
+ def read_func_cb(ptr, byte_size, size_to_read, datasource):
+ data_size = size_to_read * byte_size
+ data = self.file.read(data_size)
+ read_size = len(data)
+ memmove(ptr, data, read_size)
+ return read_size
+
+ def seek_func_cb(datasource, offset, whence):
+ pos = self.file.seek(offset, whence)
+ return pos
+
+ def close_func_cb(datasource):
+ return 0
+
+ def tell_func_cb(datasource):
+ return self.file.tell()
+
+ self.read_func = pyogg.vorbis.read_func(read_func_cb)
+ self.seek_func = pyogg.vorbis.seek_func(seek_func_cb)
+ self.close_func = pyogg.vorbis.close_func(close_func_cb)
+ self.tell_func = pyogg.vorbis.tell_func(tell_func_cb)
+
+ self.callbacks = pyogg.vorbis.ov_callbacks(self.read_func, self.seek_func, self.close_func, self.tell_func)
+
+
+class UnclosedVorbisFileStream(pyogg.VorbisFileStream):
+ def __del__(self):
+ if self.exists:
+ pyogg.vorbis.ov_clear(byref(self.vf))
+ self.exists = False
+
+ def clean_up(self):
+ """PyOgg calls clean_up on end of data. We may want to loop a sound or replay. Prevent this.
+ Rely on GC (__del__) to clean up objects instead.
+ """
+ return
+
+
+class UnclosedOpusFileStream(pyogg.OpusFileStream):
+ def __del__(self):
+ self.ptr.contents.value = self.ptr_init
+
+ del self.ptr
+
+ if self.of:
+ pyogg.opus.op_free(self.of)
+
+ def clean_up(self):
+ pass
+
+
+class MemoryOpusObject:
+ def __init__(self, filename, file):
+ self.file = file
+ self.filename = filename
+
+ def read_func_cb(stream, buffer, size):
+ data = self.file.read(size)
+ read_size = len(data)
+ memmove(buffer, data, read_size)
+ return read_size
+
+ def seek_func_cb(stream, offset, whence):
+ self.file.seek(offset, whence)
+ return 0
+
+ def tell_func_cb(stream):
+ pos = self.file.tell()
+ return pos
+
+ def close_func_cb(stream):
+ return 0
+
+ self.read_func = pyogg.opus.op_read_func(read_func_cb)
+ self.seek_func = pyogg.opus.op_seek_func(seek_func_cb)
+ self.tell_func = pyogg.opus.op_tell_func(tell_func_cb)
+ self.close_func = pyogg.opus.op_close_func(close_func_cb)
+
+ self.callbacks = pyogg.opus.OpusFileCallbacks(self.read_func, self.seek_func, self.tell_func, self.close_func)
+
+
+class MemoryOpusFileStream(UnclosedOpusFileStream):
+ def __init__(self, filename, file):
+ self.file = file
+
+ self.memory_object = MemoryOpusObject(filename, file)
+
+ self._dummy_fileobj = c_void_p()
+
+ error = c_int()
+
+ self.read_buffer = create_string_buffer(pyogg.PYOGG_STREAM_BUFFER_SIZE)
+
+ self.ptr_buffer = cast(self.read_buffer, POINTER(c_ubyte))
+
+ self.of = pyogg.opus.op_open_callbacks(
+ self._dummy_fileobj,
+ byref(self.memory_object.callbacks),
+ self.ptr_buffer,
+ 0, # Start length
+ byref(error)
+ )
+
+ if error.value != 0:
+ raise DecodeException(
+ "file-like object: {} couldn't be processed. Error code : {}".format(filename, error.value))
+
+ self.channels = pyogg.opus.op_channel_count(self.of, -1)
+
+ self.pcm_size = pyogg.opus.op_pcm_total(self.of, -1)
+
+ self.frequency = 48000
+
+ self.bfarr_t = pyogg.opus.opus_int16 * (pyogg.PYOGG_STREAM_BUFFER_SIZE * self.channels * 2)
+
+ self.buffer = cast(pointer(self.bfarr_t()), pyogg.opus.opus_int16_p)
+
+ self.ptr = cast(pointer(self.buffer), POINTER(c_void_p))
+
+ self.ptr_init = self.ptr.contents.value
+
+
+class MemoryVorbisFileStream(UnclosedVorbisFileStream):
+ def __init__(self, path, file):
+ buff = create_string_buffer(pyogg.PYOGG_STREAM_BUFFER_SIZE)
+
+ self.vf = pyogg.vorbis.OggVorbis_File()
+ self.memory_object = MemoryVorbisObject(file)
+
+ error = pyogg.vorbis.libvorbisfile.ov_open_callbacks(buff, self.vf, None, 0, self.memory_object.callbacks)
+ if error != 0:
+ raise DecodeException("file couldn't be opened or doesn't exist. Error code : {}".format(error))
+
+ info = pyogg.vorbis.ov_info(byref(self.vf), -1)
+
+ self.channels = info.contents.channels
+
+ self.frequency = info.contents.rate
+
+ array = (c_char * (pyogg.PYOGG_STREAM_BUFFER_SIZE * self.channels))()
+
+ self.buffer_ = cast(pointer(array), c_char_p)
+
+ self.bitstream = c_int()
+ self.bitstream_pointer = pointer(self.bitstream)
+
+ self.exists = True
+
+
+class UnclosedFLACFileStream(pyogg.FlacFileStream):
+ def __init__(self, *args, **kw):
+ super().__init__(*args, **kw)
+ self.seekable = True
+
+ def __del__(self):
+ if self.decoder:
+ pyogg.flac.FLAC__stream_decoder_finish(self.decoder)
+
+
+class MemoryFLACFileStream(UnclosedFLACFileStream):
+ def __init__(self, path, file):
+ self.file = file
+
+ self.file_size = 0
+
+ if getattr(self.file, 'seek', None) and getattr(self.file, 'tell', None):
+ self.seekable = True
+ self.file.seek(0, 2)
+ self.file_size = self.file.tell()
+ self.file.seek(0)
+ else:
+ warnings.warn(f"Warning: {file} file object is not seekable.")
+ self.seekable = False
+
+ self.decoder = pyogg.flac.FLAC__stream_decoder_new()
+
+ self.client_data = c_void_p()
+
+ self.channels = None
+
+ self.frequency = None
+
+ self.total_samples = None
+
+ self.buffer = None
+
+ self.bytes_written = None
+
+ self.write_callback_ = pyogg.flac.FLAC__StreamDecoderWriteCallback(self.write_callback)
+ self.metadata_callback_ = pyogg.flac.FLAC__StreamDecoderMetadataCallback(self.metadata_callback)
+ self.error_callback_ = pyogg.flac.FLAC__StreamDecoderErrorCallback(self.error_callback)
+ self.read_callback_ = pyogg.flac.FLAC__StreamDecoderReadCallback(self.read_callback)
+
+ if self.seekable:
+ self.seek_callback_ = pyogg.flac.FLAC__StreamDecoderSeekCallback(self.seek_callback)
+ self.tell_callback_ = pyogg.flac.FLAC__StreamDecoderTellCallback(self.tell_callback)
+ self.length_callback_ = pyogg.flac.FLAC__StreamDecoderLengthCallback(self.length_callback)
+ self.eof_callback_ = FLAC__StreamDecoderEofCallback(self.eof_callback)
+ else:
+ self.seek_callback_ = None
+ self.tell_callback_ = None
+ self.length_callback_ = None
+ self.eof_callback_ = None
+
+ init_status = pyogg.flac.libflac.FLAC__stream_decoder_init_stream(
+ self.decoder,
+ self.read_callback_,
+ self.seek_callback_,
+ self.tell_callback_,
+ self.length_callback_,
+ self.eof_callback_,
+ self.write_callback_,
+ self.metadata_callback_,
+ self.error_callback_,
+ self.client_data
+ )
+
+ if init_status: # error
+ raise DecodeException("An error occurred when trying to open '{}': {}".format(
+ path, pyogg.flac.FLAC__StreamDecoderInitStatusEnum[init_status]))
+
+ metadata_status = pyogg.flac.FLAC__stream_decoder_process_until_end_of_metadata(self.decoder)
+ if not metadata_status: # error
+ raise DecodeException("An error occured when trying to decode the metadata of {}".format(path))
+
+ def read_callback(self, decoder, buffer, size, data):
+ chunk = size.contents.value
+ data = self.file.read(chunk)
+ read_size = len(data)
+ memmove(buffer, data, read_size)
+
+ size.contents.value = read_size
+
+ if read_size > 0:
+ return 0 # FLAC__STREAM_DECODER_READ_STATUS_CONTINUE
+ elif read_size == 0:
+ return 1 # FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM
+ else:
+ return 2 # FLAC__STREAM_DECODER_READ_STATUS_ABORT
+
+ def seek_callback(self, decoder, offset, data):
+ pos = self.file.seek(offset, 0)
+ if pos < 0:
+ return 1 # FLAC__STREAM_DECODER_SEEK_STATUS_ERROR
+ else:
+ return 0 # FLAC__STREAM_DECODER_SEEK_STATUS_OK
+
+ def tell_callback(self, decoder, offset, data):
+ """Decoder wants to know the current position of the file stream."""
+ pos = self.file.tell()
+ if pos < 0:
+ return 1 # FLAC__STREAM_DECODER_TELL_STATUS_ERROR
+ else:
+ offset.contents.value = pos
+ return 0 # FLAC__STREAM_DECODER_TELL_STATUS_OK
+
+ def length_callback(self, decoder, length, data):
+ """Decoder wants to know the total length of the stream."""
+ if self.file_size == 0:
+ return 1 # FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR
+ else:
+ length.contents.value = self.file_size
+ return 0 # FLAC__STREAM_DECODER_LENGTH_STATUS_OK
+
+ def eof_callback(self, decoder, data):
+ return self.file.tell() >= self.file_size
+
+
+class PyOggSource(StreamingSource):
+ def __init__(self, filename, file):
+ self.filename = filename
+ self.file = file
+ self._stream = None
+ self.sample_size = 16
+
+ self._load_source()
+
+ self.audio_format = AudioFormat(channels=self._stream.channels, sample_size=self.sample_size,
+ sample_rate=self._stream.frequency)
+
+ @abstractmethod
+ def _load_source(self):
+ pass
+
+ def get_audio_data(self, num_bytes, compensation_time=0.0):
+ """Data returns as c_short_array instead of LP_c_char or c_ubyte, cast each buffer."""
+ data = self._stream.get_buffer() # Returns buffer, length or None
+ if data is not None:
+ buff, length = data
+ buff_char_p = cast(buff, POINTER(c_char))
+ return AudioData(buff_char_p[:length], length, 1000, 1000, [])
+
+ return None
+
+ def __del__(self):
+ if self._stream:
+ del self._stream
+
+
+class PyOggFLACSource(PyOggSource):
+
+ def _load_source(self):
+ if self.file:
+ self._stream = MemoryFLACFileStream(self.filename, self.file)
+ else:
+ self._stream = UnclosedFLACFileStream(self.filename)
+
+ self.sample_size = self._stream.bits_per_sample
+ self._duration = self._stream.total_samples / self._stream.frequency
+
+ # Unknown amount of samples. May occur in some sources.
+ if self._stream.total_samples == 0:
+ if _debug:
+ warnings.warn(f"Unknown amount of samples found in {self.filename}. Seeking may be limited.")
+ self._duration_per_frame = 0
+ else:
+ self._duration_per_frame = self._duration / self._stream.total_samples
+
+ def seek(self, timestamp):
+ if self._stream.seekable:
+ # Convert sample to seconds.
+ if self._duration_per_frame:
+ timestamp = max(0.0, min(timestamp, self._duration))
+ position = int(timestamp / self._duration_per_frame)
+ else: # If we have no duration, we cannot reliably seek. However, 0.0 is still required to play and loop.
+ position = 0
+ seek_succeeded = pyogg.flac.FLAC__stream_decoder_seek_absolute(self._stream.decoder, position)
+ if seek_succeeded is False:
+ warnings.warn(f"Failed to seek FLAC file: {self.filename}")
+ else:
+ warnings.warn(f"Stream is not seekable for FLAC file: {self.filename}.")
+
+
+class PyOggVorbisSource(PyOggSource):
+
+ def _load_source(self):
+ if self.file:
+ self._stream = MemoryVorbisFileStream(self.filename, self.file)
+ else:
+ self._stream = UnclosedVorbisFileStream(self.filename)
+
+ self._duration = pyogg.vorbis.libvorbisfile.ov_time_total(byref(self._stream.vf), -1)
+
+ def get_audio_data(self, num_bytes, compensation_time=0.0):
+ data = self._stream.get_buffer() # Returns buffer, length or None
+
+ if data is not None:
+ return AudioData(*data, 1000, 1000, [])
+
+ return None
+
+ def seek(self, timestamp):
+ seek_succeeded = pyogg.vorbis.ov_time_seek(self._stream.vf, timestamp)
+ if seek_succeeded != 0:
+ if _debug:
+ warnings.warn(f"Failed to seek file {self.filename} - {seek_succeeded}")
+
+
+class PyOggOpusSource(PyOggSource):
+ def _load_source(self):
+ if self.file:
+ self._stream = MemoryOpusFileStream(self.filename, self.file)
+ else:
+ self._stream = UnclosedOpusFileStream(self.filename)
+
+ self._duration = self._stream.pcm_size / self._stream.frequency
+ self._duration_per_frame = self._duration / self._stream.pcm_size
+
+ def seek(self, timestamp):
+ timestamp = max(0.0, min(timestamp, self._duration))
+ position = int(timestamp / self._duration_per_frame)
+ error = pyogg.opus.op_pcm_seek(self._stream.of, position)
+ if error:
+ warnings.warn(f"Opus stream could not seek properly {error}.")
+
+
+class PyOggDecoder(MediaDecoder):
+ vorbis_exts = ('.ogg',) if pyogg.PYOGG_OGG_AVAIL and pyogg.PYOGG_VORBIS_AVAIL and pyogg.PYOGG_VORBIS_FILE_AVAIL else ()
+ flac_exts = ('.flac',) if pyogg.PYOGG_FLAC_AVAIL else ()
+ opus_exts = ('.opus',) if pyogg.PYOGG_OPUS_AVAIL and pyogg.PYOGG_OPUS_FILE_AVAIL else ()
+ exts = vorbis_exts + flac_exts + opus_exts
+
+ def get_file_extensions(self):
+ return PyOggDecoder.exts
+
+ def decode(self, filename, file, streaming=True):
+ name, ext = os.path.splitext(filename)
+ if ext in PyOggDecoder.vorbis_exts:
+ source = PyOggVorbisSource
+ elif ext in PyOggDecoder.flac_exts:
+ source = PyOggFLACSource
+ elif ext in PyOggDecoder.opus_exts:
+ source = PyOggOpusSource
+ else:
+ raise DecodeException("Decoder could not find a suitable source to use with this filetype.")
+
+ if streaming:
+ return source(filename, file)
+ else:
+ return StaticSource(source(filename, file))
+
+
+def get_decoders():
+ return [PyOggDecoder()]
+
+
+def get_encoders():
+ return []
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/wave.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/wave.py
new file mode 100644
index 0000000000000000000000000000000000000000..e3ea81c94b636ec7c1e7fcddd5c8156f52f0bbd6
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/wave.py
@@ -0,0 +1,119 @@
+"""Decoder for RIFF Wave files, using the standard library wave module.
+"""
+
+import wave
+
+from pyglet.util import DecodeException
+from .base import StreamingSource, AudioData, AudioFormat, StaticSource
+from . import MediaEncoder, MediaDecoder
+
+
+class WAVEDecodeException(DecodeException):
+ pass
+
+
+class WaveSource(StreamingSource):
+ def __init__(self, filename, file=None):
+ if file is None:
+ file = open(filename, 'rb')
+ self._file = file
+
+ try:
+ self._wave = wave.open(file)
+ except wave.Error as e:
+ raise WAVEDecodeException(e)
+
+ nchannels, sampwidth, framerate, nframes, comptype, compname = self._wave.getparams()
+
+ self.audio_format = AudioFormat(channels=nchannels, sample_size=sampwidth * 8, sample_rate=framerate)
+
+ self._bytes_per_frame = nchannels * sampwidth
+ self._duration = nframes / framerate
+ self._duration_per_frame = self._duration / nframes
+ self._num_frames = nframes
+
+ self._wave.rewind()
+
+ def __del__(self):
+ if hasattr(self, '_file'):
+ self._file.close()
+
+ def get_audio_data(self, num_bytes, compensation_time=0.0):
+ num_frames = max(1, num_bytes // self._bytes_per_frame)
+
+ data = self._wave.readframes(num_frames)
+ if not data:
+ return None
+
+ timestamp = self._wave.tell() / self.audio_format.sample_rate
+ duration = num_frames / self.audio_format.sample_rate
+ return AudioData(data, len(data), timestamp, duration, [])
+
+ def seek(self, timestamp):
+ timestamp = max(0.0, min(timestamp, self._duration))
+ position = int(timestamp / self._duration_per_frame)
+ self._wave.setpos(position)
+
+
+#########################################
+# Decoder class:
+#########################################
+
+class WaveDecoder(MediaDecoder):
+
+ def get_file_extensions(self):
+ return '.wav', '.wave', '.riff'
+
+ def decode(self, filename, file, streaming=True):
+ if streaming:
+ return WaveSource(filename, file)
+ else:
+ return StaticSource(WaveSource(filename, file))
+
+
+class WaveEncoder(MediaEncoder):
+
+ def get_file_extensions(self):
+ return '.wav', '.wave', '.riff'
+
+ def encode(self, source, filename, file):
+ """Save the Source to disk as a standard RIFF Wave.
+
+ A standard RIFF wave header will be added to the raw PCM
+ audio data when it is saved to disk.
+
+ :Parameters:
+ `filename` : str
+ The file name to save as.
+ `file` : file-like object
+ A file-like object, opened with mode 'wb'.
+
+ """
+ opened_file = None
+ if file is None:
+ file = open(filename, 'wb')
+ opened_file = True
+
+ source.seek(0)
+ wave_writer = wave.open(file, mode='wb')
+ wave_writer.setnchannels(source.audio_format.channels)
+ wave_writer.setsampwidth(source.audio_format.bytes_per_sample)
+ wave_writer.setframerate(source.audio_format.sample_rate)
+ # Save the data in 1-second chunks:
+ chunksize = source.audio_format.bytes_per_second
+ audiodata = source.get_audio_data(chunksize)
+ while audiodata:
+ wave_writer.writeframes(audiodata.data)
+ audiodata = source.get_audio_data(chunksize)
+ else:
+ wave_writer.close()
+ if opened_file:
+ file.close()
+
+
+def get_decoders():
+ return [WaveDecoder()]
+
+
+def get_encoders():
+ return [WaveEncoder()]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/wmf.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/wmf.py
new file mode 100644
index 0000000000000000000000000000000000000000..fedbd089f693c89c1734e205553f1a7197de41c9
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/codecs/wmf.py
@@ -0,0 +1,852 @@
+import os
+import platform
+import warnings
+
+from pyglet import image
+from pyglet.libs.win32 import _kernel32 as kernel32
+from pyglet.libs.win32 import _ole32 as ole32
+from pyglet.libs.win32 import com
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+from pyglet.media import Source
+from pyglet.media.codecs import AudioFormat, AudioData, VideoFormat, MediaDecoder, StaticSource
+from pyglet.util import debug_print, DecodeException
+
+_debug = debug_print('debug_media')
+
+try:
+ mfreadwrite = 'mfreadwrite'
+ mfplat = 'mfplat'
+
+ # System32 and SysWOW64 folders are opposite perception in Windows x64.
+ # System32 = x64 dll's | SysWOW64 = x86 dlls
+ # By default ctypes only seems to look in system32 regardless of Python architecture, which has x64 dlls.
+ if platform.architecture()[0] == '32bit':
+ if platform.machine().endswith('64'): # Machine is 64 bit, Python is 32 bit.
+ mfreadwrite = os.path.join(os.environ['WINDIR'], 'SysWOW64', 'mfreadwrite.dll')
+ mfplat = os.path.join(os.environ['WINDIR'], 'SysWOW64', 'mfplat.dll')
+
+ mfreadwrite_lib = ctypes.windll.LoadLibrary(mfreadwrite)
+ mfplat_lib = ctypes.windll.LoadLibrary(mfplat)
+except OSError:
+ # Doesn't exist? Should stop import of library.
+ raise ImportError('Could not load WMF library.')
+
+MF_SOURCE_READERF_ERROR = 0x00000001
+MF_SOURCE_READERF_ENDOFSTREAM = 0x00000002
+MF_SOURCE_READERF_NEWSTREAM = 0x00000004
+MF_SOURCE_READERF_NATIVEMEDIATYPECHANGED = 0x00000010
+MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED = 0x00000020
+MF_SOURCE_READERF_STREAMTICK = 0x00000100
+
+# Audio attributes
+MF_LOW_LATENCY = com.GUID(0x9c27891a, 0xed7a, 0x40e1, 0x88, 0xe8, 0xb2, 0x27, 0x27, 0xa0, 0x24, 0xee)
+
+# Audio information
+MF_MT_ALL_SAMPLES_INDEPENDENT = com.GUID(0xc9173739, 0x5e56, 0x461c, 0xb7, 0x13, 0x46, 0xfb, 0x99, 0x5c, 0xb9, 0x5f)
+MF_MT_FIXED_SIZE_SAMPLES = com.GUID(0xb8ebefaf, 0xb718, 0x4e04, 0xb0, 0xa9, 0x11, 0x67, 0x75, 0xe3, 0x32, 0x1b)
+MF_MT_SAMPLE_SIZE = com.GUID(0xdad3ab78, 0x1990, 0x408b, 0xbc, 0xe2, 0xeb, 0xa6, 0x73, 0xda, 0xcc, 0x10)
+MF_MT_COMPRESSED = com.GUID(0x3afd0cee, 0x18f2, 0x4ba5, 0xa1, 0x10, 0x8b, 0xea, 0x50, 0x2e, 0x1f, 0x92)
+MF_MT_WRAPPED_TYPE = com.GUID(0x4d3f7b23, 0xd02f, 0x4e6c, 0x9b, 0xee, 0xe4, 0xbf, 0x2c, 0x6c, 0x69, 0x5d)
+MF_MT_AUDIO_NUM_CHANNELS = com.GUID(0x37e48bf5, 0x645e, 0x4c5b, 0x89, 0xde, 0xad, 0xa9, 0xe2, 0x9b, 0x69, 0x6a)
+MF_MT_AUDIO_SAMPLES_PER_SECOND = com.GUID(0x5faeeae7, 0x0290, 0x4c31, 0x9e, 0x8a, 0xc5, 0x34, 0xf6, 0x8d, 0x9d, 0xba)
+MF_MT_AUDIO_FLOAT_SAMPLES_PER_SECOND = com.GUID(0xfb3b724a, 0xcfb5, 0x4319, 0xae, 0xfe, 0x6e, 0x42, 0xb2, 0x40, 0x61, 0x32)
+MF_MT_AUDIO_AVG_BYTES_PER_SECOND = com.GUID(0x1aab75c8, 0xcfef, 0x451c, 0xab, 0x95, 0xac, 0x03, 0x4b, 0x8e, 0x17, 0x31)
+MF_MT_AUDIO_BLOCK_ALIGNMENT = com.GUID(0x322de230, 0x9eeb, 0x43bd, 0xab, 0x7a, 0xff, 0x41, 0x22, 0x51, 0x54, 0x1d)
+MF_MT_AUDIO_BITS_PER_SAMPLE = com.GUID(0xf2deb57f, 0x40fa, 0x4764, 0xaa, 0x33, 0xed, 0x4f, 0x2d, 0x1f, 0xf6, 0x69)
+MF_MT_AUDIO_VALID_BITS_PER_SAMPLE = com.GUID(0xd9bf8d6a, 0x9530, 0x4b7c, 0x9d, 0xdf, 0xff, 0x6f, 0xd5, 0x8b, 0xbd, 0x06)
+MF_MT_AUDIO_SAMPLES_PER_BLOCK = com.GUID(0xaab15aac, 0xe13a, 0x4995, 0x92, 0x22, 0x50, 0x1e, 0xa1, 0x5c, 0x68, 0x77)
+MF_MT_AUDIO_CHANNEL_MASK = com.GUID(0x55fb5765, 0x644a, 0x4caf, 0x84, 0x79, 0x93, 0x89, 0x83, 0xbb, 0x15, 0x88)
+MF_PD_DURATION = com.GUID(0x6c990d33, 0xbb8e, 0x477a, 0x85, 0x98, 0xd, 0x5d, 0x96, 0xfc, 0xd8, 0x8a)
+
+
+# Media types categories
+MF_MT_MAJOR_TYPE = com.GUID(0x48eba18e, 0xf8c9, 0x4687, 0xbf, 0x11, 0x0a, 0x74, 0xc9, 0xf9, 0x6a, 0x8f)
+MF_MT_SUBTYPE = com.GUID(0xf7e34c9a, 0x42e8, 0x4714, 0xb7, 0x4b, 0xcb, 0x29, 0xd7, 0x2c, 0x35, 0xe5)
+
+# Major types
+MFMediaType_Audio = com.GUID(0x73647561, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
+MFMediaType_Video = com.GUID(0x73646976, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71)
+MFMediaType_Protected = com.GUID(0x7b4b6fe6, 0x9d04, 0x4494, 0xbe, 0x14, 0x7e, 0x0b, 0xd0, 0x76, 0xc8, 0xe4)
+MFMediaType_Image = com.GUID(0x72178C23, 0xE45B, 0x11D5, 0xBC, 0x2A, 0x00, 0xB0, 0xD0, 0xF3, 0xF4, 0xAB)
+MFMediaType_HTML = com.GUID(0x72178C24, 0xE45B, 0x11D5, 0xBC, 0x2A, 0x00, 0xB0, 0xD0, 0xF3, 0xF4, 0xAB)
+MFMediaType_Subtitle = com.GUID(0xa6d13581, 0xed50, 0x4e65, 0xae, 0x08, 0x26, 0x06, 0x55, 0x76, 0xaa, 0xcc)
+
+# Video subtypes, attributes, and enums (Uncompressed)
+D3DFMT_X8R8G8B8 = 22
+D3DFMT_P8 = 41
+D3DFMT_A8R8G8B8 = 21
+MFVideoFormat_RGB32 = com.GUID(D3DFMT_X8R8G8B8, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
+MFVideoFormat_RGB8 = com.GUID(D3DFMT_P8, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
+MFVideoFormat_ARGB32 = com.GUID(D3DFMT_A8R8G8B8, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
+
+MFVideoInterlace_Progressive = 2
+MF_MT_INTERLACE_MODE = com.GUID(0xe2724bb8, 0xe676, 0x4806, 0xb4, 0xb2, 0xa8, 0xd6, 0xef, 0xb4, 0x4c, 0xcd)
+MF_MT_FRAME_SIZE = com.GUID(0x1652c33d, 0xd6b2, 0x4012, 0xb8, 0x34, 0x72, 0x03, 0x08, 0x49, 0xa3, 0x7d)
+MF_MT_FRAME_RATE = com.GUID(0xc459a2e8, 0x3d2c, 0x4e44, 0xb1, 0x32, 0xfe, 0xe5, 0x15, 0x6c, 0x7b, 0xb0)
+MF_MT_PIXEL_ASPECT_RATIO = com.GUID(0xc6376a1e, 0x8d0a, 0x4027, 0xbe, 0x45, 0x6d, 0x9a, 0x0a, 0xd3, 0x9b, 0xb6)
+MF_MT_DRM_FLAGS = com.GUID(0x8772f323, 0x355a, 0x4cc7, 0xbb, 0x78, 0x6d, 0x61, 0xa0, 0x48, 0xae, 0x82)
+MF_MT_DEFAULT_STRIDE = com.GUID(0x644b4e48, 0x1e02, 0x4516, 0xb0, 0xeb, 0xc0, 0x1c, 0xa9, 0xd4, 0x9a, 0xc6)
+
+# Audio Subtypes (Uncompressed)
+WAVE_FORMAT_PCM = 1
+WAVE_FORMAT_IEEE_FLOAT = 3
+MFAudioFormat_PCM = com.GUID(WAVE_FORMAT_PCM, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
+MFAudioFormat_Float = com.GUID(WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
+
+# Image subtypes.
+MFImageFormat_RGB32 = com.GUID(0x00000016, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
+MFImageFormat_JPEG = com.GUID(0x19e4a5aa, 0x5662, 0x4fc5, 0xa0, 0xc0, 0x17, 0x58, 0x02, 0x8e, 0x10, 0x57)
+
+# Video attributes
+# Enables hardware decoding
+MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS = com.GUID(0xa634a91c, 0x822b, 0x41b9, 0xa4, 0x94, 0x4d, 0xe4, 0x64, 0x36, 0x12,
+ 0xb0)
+# Enable video decoding
+MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING = com.GUID(0xfb394f3d, 0xccf1, 0x42ee, 0xbb, 0xb3, 0xf9, 0xb8, 0x45, 0xd5,
+ 0x68, 0x1d)
+MF_SOURCE_READER_D3D_MANAGER = com.GUID(0xec822da2, 0xe1e9, 0x4b29, 0xa0, 0xd8, 0x56, 0x3c, 0x71, 0x9f, 0x52, 0x69)
+MF_MEDIA_ENGINE_DXGI_MANAGER = com.GUID(0x065702da, 0x1094, 0x486d, 0x86, 0x17, 0xee, 0x7c, 0xc4, 0xee, 0x46, 0x48)
+MF_SOURCE_READER_ENABLE_ADVANCED_VIDEO_PROCESSING = com.GUID(0xf81da2c, 0xb537, 0x4672, 0xa8, 0xb2, 0xa6, 0x81, 0xb1,
+ 0x73, 0x7, 0xa3)
+
+# Some common errors
+MF_E_INVALIDSTREAMNUMBER = -1072875853 # 0xC00D36B3
+MF_E_UNSUPPORTED_BYTESTREAM_TYPE = -1072875836 # 0xC00D36C4
+MF_E_NO_MORE_TYPES = 0xC00D36B9
+MF_E_TOPO_CODEC_NOT_FOUND = -1072868846 # 0xC00D5212
+
+
+VT_I8 = 20 # Only enum we care about: https://docs.microsoft.com/en-us/windows/win32/api/wtypes/ne-wtypes-varenum
+
+
+def timestamp_from_wmf(timestamp): # 100-nanoseconds
+ return float(timestamp) / 10000000
+
+
+def timestamp_to_wmf(timestamp): # 100-nanoseconds
+ return int(timestamp * 10000000)
+
+
+class IMFAttributes(com.pIUnknown):
+ _methods_ = [
+ ('GetItem',
+ com.STDMETHOD()),
+ ('GetItemType',
+ com.STDMETHOD()),
+ ('CompareItem',
+ com.STDMETHOD()),
+ ('Compare',
+ com.STDMETHOD()),
+ ('GetUINT32',
+ com.STDMETHOD(com.REFIID, POINTER(c_uint32))),
+ ('GetUINT64',
+ com.STDMETHOD(com.REFIID, POINTER(c_uint64))),
+ ('GetDouble',
+ com.STDMETHOD()),
+ ('GetGUID',
+ com.STDMETHOD(com.REFIID, POINTER(com.GUID))),
+ ('GetStringLength',
+ com.STDMETHOD()),
+ ('GetString',
+ com.STDMETHOD()),
+ ('GetAllocatedString',
+ com.STDMETHOD()),
+ ('GetBlobSize',
+ com.STDMETHOD()),
+ ('GetBlob',
+ com.STDMETHOD()),
+ ('GetAllocatedBlob',
+ com.STDMETHOD()),
+ ('GetUnknown',
+ com.STDMETHOD()),
+ ('SetItem',
+ com.STDMETHOD()),
+ ('DeleteItem',
+ com.STDMETHOD()),
+ ('DeleteAllItems',
+ com.STDMETHOD()),
+ ('SetUINT32',
+ com.STDMETHOD(com.REFIID, c_uint32)),
+ ('SetUINT64',
+ com.STDMETHOD()),
+ ('SetDouble',
+ com.STDMETHOD()),
+ ('SetGUID',
+ com.STDMETHOD(com.REFIID, com.REFIID)),
+ ('SetString',
+ com.STDMETHOD()),
+ ('SetBlob',
+ com.STDMETHOD()),
+ ('SetUnknown',
+ com.STDMETHOD(com.REFIID, com.pIUnknown)),
+ ('LockStore',
+ com.STDMETHOD()),
+ ('UnlockStore',
+ com.STDMETHOD()),
+ ('GetCount',
+ com.STDMETHOD()),
+ ('GetItemByIndex',
+ com.STDMETHOD()),
+ ('CopyAllItems',
+ com.STDMETHOD(c_void_p)), # IMFAttributes
+ ]
+
+
+class IMFMediaBuffer(com.pIUnknown):
+ _methods_ = [
+ ('Lock',
+ com.STDMETHOD(POINTER(POINTER(BYTE)), POINTER(DWORD), POINTER(DWORD))),
+ ('Unlock',
+ com.STDMETHOD()),
+ ('GetCurrentLength',
+ com.STDMETHOD(POINTER(DWORD))),
+ ('SetCurrentLength',
+ com.STDMETHOD(DWORD)),
+ ('GetMaxLength',
+ com.STDMETHOD(POINTER(DWORD)))
+ ]
+
+
+class IMFSample(IMFAttributes, com.pIUnknown):
+ _methods_ = [
+ ('GetSampleFlags',
+ com.STDMETHOD()),
+ ('SetSampleFlags',
+ com.STDMETHOD()),
+ ('GetSampleTime',
+ com.STDMETHOD()),
+ ('SetSampleTime',
+ com.STDMETHOD()),
+ ('GetSampleDuration',
+ com.STDMETHOD(POINTER(c_ulonglong))),
+ ('SetSampleDuration',
+ com.STDMETHOD(DWORD, IMFMediaBuffer)),
+ ('GetBufferCount',
+ com.STDMETHOD(POINTER(DWORD))),
+ ('GetBufferByIndex',
+ com.STDMETHOD(DWORD, IMFMediaBuffer)),
+ ('ConvertToContiguousBuffer',
+ com.STDMETHOD(POINTER(IMFMediaBuffer))), # out
+ ('AddBuffer',
+ com.STDMETHOD(POINTER(DWORD))),
+ ('RemoveBufferByIndex',
+ com.STDMETHOD()),
+ ('RemoveAllBuffers',
+ com.STDMETHOD()),
+ ('GetTotalLength',
+ com.STDMETHOD(POINTER(DWORD))),
+ ('CopyToBuffer',
+ com.STDMETHOD()),
+ ]
+
+
+class IMFMediaType(IMFAttributes, com.pIUnknown):
+ _methods_ = [
+ ('GetMajorType',
+ com.STDMETHOD()),
+ ('IsCompressedFormat',
+ com.STDMETHOD()),
+ ('IsEqual',
+ com.STDMETHOD()),
+ ('GetRepresentation',
+ com.STDMETHOD()),
+ ('FreeRepresentation',
+ com.STDMETHOD()),
+ ]
+
+
+class IMFByteStream(com.pIUnknown):
+ _methods_ = [
+ ('GetCapabilities',
+ com.STDMETHOD()),
+ ('GetLength',
+ com.STDMETHOD()),
+ ('SetLength',
+ com.STDMETHOD()),
+ ('GetCurrentPosition',
+ com.STDMETHOD()),
+ ('SetCurrentPosition',
+ com.STDMETHOD(c_ulonglong)),
+ ('IsEndOfStream',
+ com.STDMETHOD()),
+ ('Read',
+ com.STDMETHOD()),
+ ('BeginRead',
+ com.STDMETHOD()),
+ ('EndRead',
+ com.STDMETHOD()),
+ ('Write',
+ com.STDMETHOD(POINTER(BYTE), ULONG, POINTER(ULONG))),
+ ('BeginWrite',
+ com.STDMETHOD()),
+ ('EndWrite',
+ com.STDMETHOD()),
+ ('Seek',
+ com.STDMETHOD()),
+ ('Flush',
+ com.STDMETHOD()),
+ ('Close',
+ com.STDMETHOD()),
+ ]
+
+
+class IMFSourceReader(com.pIUnknown):
+ _methods_ = [
+ ('GetStreamSelection',
+ com.STDMETHOD(DWORD, POINTER(BOOL))), # in, out
+ ('SetStreamSelection',
+ com.STDMETHOD(DWORD, BOOL)),
+ ('GetNativeMediaType',
+ com.STDMETHOD(DWORD, DWORD, POINTER(IMFMediaType))),
+ ('GetCurrentMediaType',
+ com.STDMETHOD(DWORD, POINTER(IMFMediaType))),
+ ('SetCurrentMediaType',
+ com.STDMETHOD(DWORD, POINTER(DWORD), IMFMediaType)),
+ ('SetCurrentPosition',
+ com.STDMETHOD(com.REFIID, POINTER(PROPVARIANT))),
+ ('ReadSample',
+ com.STDMETHOD(DWORD, DWORD, POINTER(DWORD), POINTER(DWORD), POINTER(c_longlong), POINTER(IMFSample))),
+ ('Flush',
+ com.STDMETHOD(DWORD)), # in
+ ('GetServiceForStream',
+ com.STDMETHOD()),
+ ('GetPresentationAttribute',
+ com.STDMETHOD(DWORD, com.REFIID, POINTER(PROPVARIANT))),
+ ]
+
+
+class WAVEFORMATEX(ctypes.Structure):
+ _fields_ = [
+ ('wFormatTag', WORD),
+ ('nChannels', WORD),
+ ('nSamplesPerSec', DWORD),
+ ('nAvgBytesPerSec', DWORD),
+ ('nBlockAlign', WORD),
+ ('wBitsPerSample', WORD),
+ ('cbSize', WORD),
+ ]
+
+ def __repr__(self):
+ return 'WAVEFORMATEX(wFormatTag={}, nChannels={}, nSamplesPerSec={}, nAvgBytesPersec={}' \
+ ', nBlockAlign={}, wBitsPerSample={}, cbSize={})'.format(
+ self.wFormatTag, self.nChannels, self.nSamplesPerSec,
+ self.nAvgBytesPerSec, self.nBlockAlign, self.wBitsPerSample,
+ self.cbSize)
+
+
+# Stream constants
+MF_SOURCE_READER_ALL_STREAMS = 0xfffffffe
+MF_SOURCE_READER_ANY_STREAM = 4294967294 # 0xfffffffe
+MF_SOURCE_READER_FIRST_AUDIO_STREAM = 4294967293 # 0xfffffffd
+MF_SOURCE_READER_FIRST_VIDEO_STREAM = 0xfffffffc
+MF_SOURCE_READER_MEDIASOURCE = 0xffffffff
+
+# Version calculation
+if WINDOWS_7_OR_GREATER:
+ MF_SDK_VERSION = 0x0002
+else:
+ MF_SDK_VERSION = 0x0001
+
+MF_API_VERSION = 0x0070 # Only used in Vista.
+
+MF_VERSION = (MF_SDK_VERSION << 16 | MF_API_VERSION)
+
+MFStartup = mfplat_lib.MFStartup
+MFStartup.restype = HRESULT
+MFStartup.argtypes = [LONG, DWORD]
+
+MFShutdown = mfplat_lib.MFShutdown
+MFShutdown.restype = HRESULT
+MFShutdown.argtypes = []
+
+MFCreateAttributes = mfplat_lib.MFCreateAttributes
+MFCreateAttributes.restype = HRESULT
+MFCreateAttributes.argtypes = [POINTER(IMFAttributes), c_uint32] # attributes, cInitialSize
+
+MFCreateSourceReaderFromURL = mfreadwrite_lib.MFCreateSourceReaderFromURL
+MFCreateSourceReaderFromURL.restype = HRESULT
+MFCreateSourceReaderFromURL.argtypes = [LPCWSTR, IMFAttributes, POINTER(IMFSourceReader)]
+
+MFCreateSourceReaderFromByteStream = mfreadwrite_lib.MFCreateSourceReaderFromByteStream
+MFCreateSourceReaderFromByteStream.restype = HRESULT
+MFCreateSourceReaderFromByteStream.argtypes = [IMFByteStream, IMFAttributes, POINTER(IMFSourceReader)]
+
+if WINDOWS_7_OR_GREATER:
+ MFCreateMFByteStreamOnStream = mfplat_lib.MFCreateMFByteStreamOnStream
+ MFCreateMFByteStreamOnStream.restype = HRESULT
+ MFCreateMFByteStreamOnStream.argtypes = [c_void_p, POINTER(IMFByteStream)]
+
+MFCreateTempFile = mfplat_lib.MFCreateTempFile
+MFCreateTempFile.restype = HRESULT
+MFCreateTempFile.argtypes = [UINT, UINT, UINT, POINTER(IMFByteStream)]
+
+MFCreateMediaType = mfplat_lib.MFCreateMediaType
+MFCreateMediaType.restype = HRESULT
+MFCreateMediaType.argtypes = [POINTER(IMFMediaType)]
+
+MFCreateWaveFormatExFromMFMediaType = mfplat_lib.MFCreateWaveFormatExFromMFMediaType
+MFCreateWaveFormatExFromMFMediaType.restype = HRESULT
+MFCreateWaveFormatExFromMFMediaType.argtypes = [IMFMediaType, POINTER(POINTER(WAVEFORMATEX)), POINTER(c_uint32), c_uint32]
+
+
+class WMFSource(Source):
+ low_latency = True # Quicker latency but possible quality loss.
+
+ decode_audio = True
+ decode_video = True
+
+ def __init__(self, filename, file=None):
+ assert any([self.decode_audio, self.decode_video]), "Source must decode audio, video, or both, not none."
+ self._current_audio_sample = None
+ self._current_audio_buffer = None
+ self._current_video_sample = None
+ self._current_video_buffer = None
+ self._timestamp = 0
+ self._attributes = None
+ self._stream_obj = None
+ self._imf_bytestream = None
+ self._wfx = None
+ self._stride = None
+
+ self.set_config_attributes()
+
+ # Create SourceReader
+ self._source_reader = IMFSourceReader()
+
+ # If it's a file, we need to load it as a stream.
+ if file is not None:
+ data = file.read()
+
+ self._imf_bytestream = IMFByteStream()
+
+ data_len = len(data)
+
+ if WINDOWS_7_OR_GREATER:
+ # Stole code from GDIPlus for older IStream support.
+ hglob = kernel32.GlobalAlloc(GMEM_MOVEABLE, data_len)
+ ptr = kernel32.GlobalLock(hglob)
+ ctypes.memmove(ptr, data, data_len)
+ kernel32.GlobalUnlock(hglob)
+
+ # Create IStream
+ self._stream_obj = com.pIUnknown()
+ ole32.CreateStreamOnHGlobal(hglob, True, ctypes.byref(self._stream_obj))
+
+ # MFCreateMFByteStreamOnStreamEx for future async operations exists, however Windows 8+ only. Requires new interface
+ # (Also unsure how/if new Windows async functions and callbacks work with ctypes.)
+ MFCreateMFByteStreamOnStream(self._stream_obj, ctypes.byref(self._imf_bytestream))
+ else:
+ # Vista does not support MFCreateMFByteStreamOnStream.
+ # HACK: Create file in Windows temp folder to write our byte data to.
+ # (Will be automatically deleted when IMFByteStream is Released.)
+ MFCreateTempFile(MF_ACCESSMODE_READWRITE,
+ MF_OPENMODE_DELETE_IF_EXIST,
+ MF_FILEFLAGS_NONE,
+ ctypes.byref(self._imf_bytestream))
+
+ wrote_length = ULONG()
+ data_ptr = cast(data, POINTER(BYTE))
+ self._imf_bytestream.Write(data_ptr, data_len, ctypes.byref(wrote_length))
+ self._imf_bytestream.SetCurrentPosition(0)
+
+ if wrote_length.value != data_len:
+ raise DecodeException("Could not write all of the data to the bytestream file.")
+
+ try:
+ MFCreateSourceReaderFromByteStream(self._imf_bytestream, self._attributes, ctypes.byref(self._source_reader))
+ except OSError as err:
+ raise DecodeException(err) from None
+ else:
+ # We can just load from filename if no file object specified..
+ try:
+ MFCreateSourceReaderFromURL(filename, self._attributes, ctypes.byref(self._source_reader))
+ except OSError as err:
+ raise DecodeException(err) from None
+
+ if self.decode_audio:
+ self._load_audio()
+
+ if self.decode_video:
+ self._load_video()
+
+ assert self.audio_format or self.video_format, "Source was decoded, but no video or audio streams were found."
+
+ # Get duration of the media file after everything has been ok to decode.
+ try:
+ prop = PROPVARIANT()
+ self._source_reader.GetPresentationAttribute(MF_SOURCE_READER_MEDIASOURCE,
+ ctypes.byref(MF_PD_DURATION),
+ ctypes.byref(prop))
+
+ self._duration = timestamp_from_wmf(prop.llVal)
+ ole32.PropVariantClear(ctypes.byref(prop))
+ except OSError:
+ warnings.warn("Could not determine duration of media file: '{}'.".format(filename))
+
+ def _load_audio(self, stream=MF_SOURCE_READER_FIRST_AUDIO_STREAM):
+ """ Prepares the audio stream for playback by detecting if it's compressed and attempting to decompress to PCM.
+ Default: Only get the first available audio stream.
+ """
+ # Will be an audio file.
+ self._audio_stream_index = stream
+
+ # Get what the native/real media type is (audio only)
+ imfmedia = IMFMediaType()
+
+ try:
+ self._source_reader.GetNativeMediaType(self._audio_stream_index, 0, ctypes.byref(imfmedia))
+ except OSError as err:
+ if err.winerror == MF_E_INVALIDSTREAMNUMBER:
+ assert _debug('WMFAudioDecoder: No audio stream found.')
+ return
+
+ # Get Major media type (Audio, Video, etc)
+ # TODO: Make GUID take no arguments for a null version:
+ guid_audio_type = com.GUID(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+
+ imfmedia.GetGUID(MF_MT_MAJOR_TYPE, ctypes.byref(guid_audio_type))
+
+ if guid_audio_type == MFMediaType_Audio:
+ assert _debug('WMFAudioDecoder: Found Audio Stream.')
+
+ # Deselect any other streams if we don't need them. (Small speedup)
+ if not self.decode_video:
+ self._source_reader.SetStreamSelection(MF_SOURCE_READER_ANY_STREAM, False)
+
+ # Select first audio stream.
+ self._source_reader.SetStreamSelection(MF_SOURCE_READER_FIRST_AUDIO_STREAM, True)
+
+ # Check sub media type, AKA what kind of codec
+ guid_compressed = com.GUID(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ imfmedia.GetGUID(MF_MT_SUBTYPE, ctypes.byref(guid_compressed))
+
+ if guid_compressed == MFAudioFormat_PCM or guid_compressed == MFAudioFormat_Float:
+ assert _debug('WMFAudioDecoder: Found Uncompressed Audio:', guid_compressed)
+ else:
+ assert _debug('WMFAudioDecoder: Found Compressed Audio:', guid_compressed)
+ # If audio is compressed, attempt to decompress it by forcing source reader to use PCM
+ mf_mediatype = IMFMediaType()
+
+ MFCreateMediaType(ctypes.byref(mf_mediatype))
+ mf_mediatype.SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio)
+ mf_mediatype.SetGUID(MF_MT_SUBTYPE, MFAudioFormat_PCM)
+
+ try:
+ self._source_reader.SetCurrentMediaType(self._audio_stream_index, None, mf_mediatype)
+ except OSError as err: # Can't decode codec.
+ raise DecodeException(err) from None
+
+ # Current media type should now be properly decoded at this point.
+ decoded_media_type = IMFMediaType() # Maybe reusing older IMFMediaType will work?
+ self._source_reader.GetCurrentMediaType(self._audio_stream_index, ctypes.byref(decoded_media_type))
+
+ wfx_length = ctypes.c_uint32()
+ wfx = POINTER(WAVEFORMATEX)()
+
+ MFCreateWaveFormatExFromMFMediaType(decoded_media_type,
+ ctypes.byref(wfx),
+ ctypes.byref(wfx_length),
+ 0)
+
+ self._wfx = wfx.contents
+ self.audio_format = AudioFormat(channels=self._wfx.nChannels,
+ sample_size=self._wfx.wBitsPerSample,
+ sample_rate=self._wfx.nSamplesPerSec)
+ else:
+ assert _debug('WMFAudioDecoder: Audio stream not found')
+
+ def get_format(self):
+ """Returns the WAVEFORMATEX data which has more information thah audio_format"""
+ return self._wfx
+
+ def _load_video(self, stream=MF_SOURCE_READER_FIRST_VIDEO_STREAM):
+ self._video_stream_index = stream
+
+ # Get what the native/real media type is (video only)
+ imfmedia = IMFMediaType()
+
+ try:
+ self._source_reader.GetCurrentMediaType(self._video_stream_index, ctypes.byref(imfmedia))
+ except OSError as err:
+ if err.winerror == MF_E_INVALIDSTREAMNUMBER:
+ assert _debug('WMFVideoDecoder: No video stream found.')
+ return
+
+ assert _debug('WMFVideoDecoder: Found Video Stream')
+
+ # All video is basically compressed, try to decompress.
+ uncompressed_mt = IMFMediaType()
+ MFCreateMediaType(ctypes.byref(uncompressed_mt))
+
+ imfmedia.CopyAllItems(uncompressed_mt)
+
+ imfmedia.Release()
+
+ uncompressed_mt.SetGUID(MF_MT_SUBTYPE, MFVideoFormat_ARGB32)
+ uncompressed_mt.SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive)
+ uncompressed_mt.SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1)
+
+ try:
+ self._source_reader.SetCurrentMediaType(self._video_stream_index, None, uncompressed_mt)
+ except OSError as err: # Can't decode codec.
+ raise DecodeException(err) from None
+
+ height, width = self._get_attribute_size(uncompressed_mt, MF_MT_FRAME_SIZE)
+
+ self.video_format = VideoFormat(width=width, height=height)
+ assert _debug('WMFVideoDecoder: Frame width: {} height: {}'.format(width, height))
+
+ # Frame rate
+ den, num = self._get_attribute_size(uncompressed_mt, MF_MT_FRAME_RATE)
+ self.video_format.frame_rate = num / den
+ assert _debug('WMFVideoDecoder: Frame Rate: {} / {} = {}'.format(num, den, self.video_format.frame_rate))
+
+ # Sometimes it can return negative? Variable bit rate? Needs further tests and examples.
+ if self.video_format.frame_rate < 0:
+ self.video_format.frame_rate = 30000 / 1001
+ assert _debug('WARNING: Negative frame rate, attempting to use default, but may experience issues.')
+
+ # Pixel ratio
+ den, num = self._get_attribute_size(uncompressed_mt, MF_MT_PIXEL_ASPECT_RATIO)
+ self.video_format.sample_aspect = num / den
+ assert _debug('WMFVideoDecoder: Pixel Ratio: {} / {} = {}'.format(num, den, self.video_format.sample_aspect))
+
+ def get_audio_data(self, num_bytes, compensation_time=0.0):
+ flags = DWORD()
+ timestamp = ctypes.c_longlong()
+ audio_data_length = DWORD()
+
+ # If we have an audio sample already in use and we call this again, release the memory of buffer and sample.
+ # Can only release after the data is played or else glitches and pops can be heard.
+ if self._current_audio_sample:
+ self._current_audio_buffer.Release()
+ self._current_audio_sample.Release()
+
+ self._current_audio_sample = IMFSample()
+ self._current_audio_buffer = IMFMediaBuffer()
+
+ while True:
+ self._source_reader.ReadSample(self._audio_stream_index, 0, None, ctypes.byref(flags),
+ ctypes.byref(timestamp), ctypes.byref(self._current_audio_sample))
+
+ if flags.value & MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED:
+ assert _debug('WMFAudioDecoder: Data is no longer valid.')
+ break
+
+ if flags.value & MF_SOURCE_READERF_ENDOFSTREAM:
+ assert _debug('WMFAudioDecoder: End of data from stream source.')
+ break
+
+ if not self._current_audio_sample:
+ assert _debug('WMFAudioDecoder: No sample.')
+ continue
+
+ # Convert to single buffer as a sample could potentially(rarely) have multiple buffers.
+ self._current_audio_sample.ConvertToContiguousBuffer(ctypes.byref(self._current_audio_buffer))
+
+ audio_data_ptr = POINTER(BYTE)()
+
+ self._current_audio_buffer.Lock(ctypes.byref(audio_data_ptr), None, ctypes.byref(audio_data_length))
+ self._current_audio_buffer.Unlock()
+
+ audio_data = create_string_buffer(audio_data_length.value)
+ memmove(audio_data, audio_data_ptr, audio_data_length.value)
+
+ return AudioData(audio_data,
+ audio_data_length.value,
+ timestamp_from_wmf(timestamp.value),
+ audio_data_length.value / self.audio_format.sample_rate,
+ [])
+
+ return None
+
+ def get_next_video_frame(self, skip_empty_frame=True):
+ video_data_length = DWORD()
+ flags = DWORD()
+ timestamp = ctypes.c_longlong()
+
+ if self._current_video_sample:
+ self._current_video_buffer.Release()
+ self._current_video_sample.Release()
+
+ self._current_video_sample = IMFSample()
+ self._current_video_buffer = IMFMediaBuffer()
+
+ while True:
+ self._source_reader.ReadSample(self._video_stream_index, 0, None, ctypes.byref(flags),
+ ctypes.byref(timestamp), ctypes.byref(self._current_video_sample))
+
+ if flags.value & MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED:
+ assert _debug('WMFVideoDecoder: Data is no longer valid.')
+
+ # Get Major media type (Audio, Video, etc)
+ new = IMFMediaType()
+ self._source_reader.GetCurrentMediaType(self._video_stream_index, ctypes.byref(new))
+
+ # Sometimes this happens once. I think this only
+ # changes if the stride is added/changed before playback?
+ stride = ctypes.c_uint32()
+ new.GetUINT32(MF_MT_DEFAULT_STRIDE, ctypes.byref(stride))
+
+ self._stride = stride.value
+
+ if flags.value & MF_SOURCE_READERF_ENDOFSTREAM:
+ self._timestamp = None
+ assert _debug('WMFVideoDecoder: End of data from stream source.')
+ break
+
+ if not self._current_video_sample:
+ assert _debug('WMFVideoDecoder: No sample.')
+ continue
+
+ self._current_video_buffer = IMFMediaBuffer()
+
+ # Convert to single buffer as a sample could potentially have multiple buffers.
+ self._current_video_sample.ConvertToContiguousBuffer(ctypes.byref(self._current_video_buffer))
+
+ video_data = POINTER(BYTE)()
+
+ self._current_video_buffer.Lock(ctypes.byref(video_data), None, ctypes.byref(video_data_length))
+
+ width = self.video_format.width
+ height = self.video_format.height
+
+ # buffer = ctypes.create_string_buffer(size)
+ self._timestamp = timestamp_from_wmf(timestamp.value)
+
+ self._current_video_buffer.Unlock()
+
+ # This is made with the assumption that the video frame will be blitted into the player texture immediately
+ # after, and then cleared next frame attempt.
+ return image.ImageData(width, height, 'BGRA', video_data, self._stride)
+
+ return None
+
+ def get_next_video_timestamp(self):
+ return self._timestamp
+
+ def seek(self, timestamp):
+ timestamp = min(timestamp, self._duration) if self._duration else timestamp
+
+ prop = PROPVARIANT()
+ prop.vt = VT_I8
+ prop.llVal = timestamp_to_wmf(timestamp)
+
+ pos_com = com.GUID(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ try:
+ self._source_reader.SetCurrentPosition(pos_com, prop)
+ except OSError as err:
+ warnings.warn(str(err))
+
+ ole32.PropVariantClear(ctypes.byref(prop))
+
+ @staticmethod
+ def _get_attribute_size(attributes, guidKey):
+ """ Convert int64 attributes to int32""" # HI32/LOW32
+
+ size = ctypes.c_uint64()
+ attributes.GetUINT64(guidKey, size)
+ lParam = size.value
+
+ x = ctypes.c_int32(lParam).value
+ y = ctypes.c_int32(lParam >> 32).value
+ return x, y
+
+ def set_config_attributes(self):
+ """ Here we set user specified attributes, by default we try to set low latency mode. (Win7+)"""
+ if self.low_latency or self.decode_video:
+ self._attributes = IMFAttributes()
+
+ MFCreateAttributes(ctypes.byref(self._attributes), 3)
+
+ if self.low_latency and WINDOWS_7_OR_GREATER:
+ self._attributes.SetUINT32(ctypes.byref(MF_LOW_LATENCY), 1)
+
+ assert _debug('WMFAudioDecoder: Setting configuration attributes.')
+
+ # If it's a video we need to enable the streams to be accessed.
+ if self.decode_video:
+ self._attributes.SetUINT32(ctypes.byref(MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS), 1)
+ self._attributes.SetUINT32(ctypes.byref(MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING), 1)
+
+ assert _debug('WMFVideoDecoder: Setting configuration attributes.')
+
+ def __del__(self):
+ if self._stream_obj:
+ self._stream_obj.Release()
+
+ if self._imf_bytestream:
+ self._imf_bytestream.Release()
+
+ if self._current_audio_sample:
+ self._current_audio_buffer.Release()
+ self._current_audio_sample.Release()
+
+ if self._current_video_sample:
+ self._current_video_buffer.Release()
+ self._current_video_sample.Release()
+
+
+#########################################
+# Decoder class:
+#########################################
+
+class WMFDecoder(MediaDecoder):
+ def __init__(self):
+ self.MFShutdown = None
+
+ try:
+ MFStartup(MF_VERSION, 0)
+ except OSError as err:
+ raise ImportError('WMF could not startup:', err.strerror)
+
+ self.extensions = self._build_decoder_extensions()
+
+ self.MFShutdown = MFShutdown
+
+ assert _debug('Windows Media Foundation: Initialized.')
+
+ @staticmethod
+ def _build_decoder_extensions():
+ """Extension support varies depending on OS version."""
+ extensions = []
+ if WINDOWS_VISTA_OR_GREATER:
+ extensions.extend(['.asf', '.wma', '.wmv',
+ '.mp3',
+ '.sami', '.smi',
+ ])
+
+ if WINDOWS_7_OR_GREATER:
+ extensions.extend(['.3g2', '.3gp', '.3gp2', '.3gp',
+ '.aac', '.adts',
+ '.avi',
+ '.m4a', '.m4v', '.mov', '.mp4',
+ # '.wav' # Can do wav, but we have a WAVE decoder.
+ ])
+
+ if WINDOWS_10_ANNIVERSARY_UPDATE_OR_GREATER:
+ extensions.extend(['.flac'])
+
+ return extensions
+
+ def get_file_extensions(self):
+ return self.extensions
+
+ def decode(self, filename, file, streaming=True):
+ if streaming:
+ return WMFSource(filename, file)
+ else:
+ return StaticSource(WMFSource(filename, file))
+
+ def __del__(self):
+ if self.MFShutdown is not None:
+ self.MFShutdown()
+
+
+def get_decoders():
+ return [WMFDecoder()]
+
+
+def get_encoders():
+ return []
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/devices/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/devices/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..dc871f1b873d87ae769b868fddf731e4c2aaeba6
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/devices/__init__.py
@@ -0,0 +1,31 @@
+import atexit
+
+import pyglet
+
+
+def get_audio_device_manager():
+ global _audio_device_manager
+
+ if _audio_device_manager:
+ return _audio_device_manager
+
+ _audio_device_manager = None
+
+ if pyglet.compat_platform == 'win32':
+ from pyglet.media.devices.win32 import Win32AudioDeviceManager
+ _audio_device_manager = Win32AudioDeviceManager()
+
+ return _audio_device_manager
+
+
+def _delete_manager():
+ """Deletes existing manager. If audio device manager is stored anywhere.
+ Required to remove handlers before exit, as it can cause problems with the event system's weakrefs."""
+ global _audio_device_manager
+ _audio_device_manager = None
+
+
+global _audio_device_manager
+_audio_device_manager = None
+
+atexit.register(_delete_manager)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/devices/base.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/devices/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..576eccc677cbd8007c9689c975c888f47065aa88
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/devices/base.py
@@ -0,0 +1,89 @@
+from abc import ABCMeta, abstractmethod
+
+from pyglet import event
+from pyglet.util import with_metaclass
+
+
+class DeviceState:
+ ACTIVE = "active"
+ DISABLED = "disabled"
+ MISSING = "missing"
+ UNPLUGGED = "unplugged"
+
+
+class DeviceFlow:
+ OUTPUT = "output"
+ INPUT = "input"
+ INPUT_OUTPUT = "input/output"
+
+
+class AudioDevice:
+ """Base class for a platform independent audio device.
+ _platform_state and _platform_flow is used to make device state numbers."""
+ _platform_state = {} # Must be defined by the parent.
+ _platform_flow = {} # Must be defined by the parent.
+
+ def __init__(self, dev_id, name, description, flow, state):
+ self.id = dev_id
+ self.flow = flow
+ self.state = state
+ self.name = name
+ self.description = description
+
+ def __repr__(self):
+ return "{}(name={}, state={}, flow={})".format(
+ self.__class__.__name__, self.name, self._platform_state[self.state], self._platform_flow[self.flow])
+
+
+class AbstractAudioDeviceManager(with_metaclass(ABCMeta, event.EventDispatcher, object)):
+
+ def __del__(self):
+ """Required to remove handlers before exit, as it can cause problems with the event system's weakrefs."""
+ self.remove_handlers(self)
+
+ @abstractmethod
+ def get_default_output(self):
+ """Returns a default active output device or None if none available."""
+ pass
+
+ @abstractmethod
+ def get_default_input(self):
+ """Returns a default active input device or None if none available."""
+ pass
+
+ @abstractmethod
+ def get_output_devices(self):
+ """Returns a list of all active output devices."""
+ pass
+
+ @abstractmethod
+ def get_input_devices(self):
+ """Returns a list of all active input devices."""
+ pass
+
+ @abstractmethod
+ def get_all_devices(self):
+ """Returns a list of all audio devices, no matter what state they are in."""
+ pass
+
+ def on_device_state_changed(self, device, old_state, new_state):
+ """Event, occurs when the state of a device changes, provides old state and new state."""
+ pass
+
+ def on_device_added(self, device):
+ """Event, occurs when a new device is added to the system."""
+ pass
+
+ def on_device_removed(self, device):
+ """Event, occurs when an existing device is removed from the system."""
+ pass
+
+ def on_default_changed(self, device):
+ """Event, occurs when the default audio device changes."""
+ pass
+
+
+AbstractAudioDeviceManager.register_event_type('on_device_state_changed')
+AbstractAudioDeviceManager.register_event_type('on_device_added')
+AbstractAudioDeviceManager.register_event_type('on_device_removed')
+AbstractAudioDeviceManager.register_event_type('on_default_changed')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/devices/win32.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/devices/win32.py
new file mode 100644
index 0000000000000000000000000000000000000000..dee69f2f0c206e35f344d317acc5964c0b6d2190
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/devices/win32.py
@@ -0,0 +1,305 @@
+from pyglet.libs.win32 import com
+from pyglet.libs.win32 import _ole32 as ole32
+from pyglet.libs.win32.constants import CLSCTX_INPROC_SERVER
+from pyglet.libs.win32.types import *
+from pyglet.media.devices import base
+from pyglet.util import debug_print
+
+_debug = debug_print('debug_media')
+
+EDataFlow = UINT
+# Audio rendering stream. Audio data flows from the application to the audio endpoint device, which renders the stream.
+eRender = 0
+
+# Audio capture stream. Audio data flows from the audio endpoint device that captures the stream, to the application.
+eCapture = 1
+
+# Audio rendering or capture stream. Audio data can flow either from the application to the audio endpoint device,
+# or from the audio endpoint device to the application.
+eAll = 2
+
+EDataFlow_enum_count = 3
+
+ERole = UINT
+eConsole = 0 # Games, system notification sounds, and voice commands.
+eMultimedia = 1 # Music, movies, narration, and live music recording.
+eCommunications = 2 # Voice communications (talking to another person).
+ERole_enum_count = 3
+
+DEVICE_STATE_ACTIVE = 0x00000001
+DEVICE_STATE_DISABLED = 0x00000002
+DEVICE_STATE_NOTPRESENT = 0x00000004
+DEVICE_STATE_UNPLUGGED = 0x00000008
+DEVICE_STATEMASK_ALL = 0x0000000F
+
+STGM_READ = 0
+STGM_WRITE = 1
+STGM_READWRITE = 2
+
+VT_LPWSTR = 0x001F
+
+
+class PROPERTYKEY(ctypes.Structure):
+ _fields_ = [
+ ('fmtid', com.GUID),
+ ('pid', DWORD),
+ ]
+
+ def __repr__(self):
+ return "PROPERTYKEY({}, pid={})".format(self.fmtid, self.pid)
+
+
+REFPROPERTYKEY = PROPERTYKEY
+
+PKEY_Device_FriendlyName = PROPERTYKEY(
+ com.GUID(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0), 14)
+PKEY_Device_DeviceDesc = PROPERTYKEY(
+ com.GUID(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0), 2)
+PKEY_DeviceInterface_FriendlyName = PROPERTYKEY(
+ com.GUID(0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22), 2)
+
+
+class IPropertyStore(com.pIUnknown):
+ _methods_ = [
+ ('GetCount',
+ com.STDMETHOD(POINTER(DWORD))),
+ ('GetAt',
+ com.STDMETHOD(DWORD, POINTER(PROPERTYKEY))),
+ ('GetValue',
+ com.STDMETHOD(REFPROPERTYKEY, POINTER(PROPVARIANT))),
+ ('SetValue',
+ com.STDMETHOD()),
+ ('Commit',
+ com.STDMETHOD()),
+ ]
+
+
+CLSID_MMDeviceEnumerator = com.GUID(0xbcde0395, 0xe52f, 0x467c, 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e)
+IID_IMMDeviceEnumerator = com.GUID(0xa95664d2, 0x9614, 0x4f35, 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6)
+
+
+class IMMNotificationClient(com.IUnknown):
+ _methods_ = [
+ ('OnDeviceStateChanged',
+ com.METHOD(ctypes.c_void_p, ctypes.c_void_p, LPCWSTR, DWORD)),
+ ('OnDeviceAdded',
+ com.METHOD(ctypes.c_void_p, ctypes.c_void_p, LPCWSTR)),
+ ('OnDeviceRemoved',
+ com.METHOD(ctypes.c_void_p, ctypes.c_void_p, LPCWSTR)),
+ ('OnDefaultDeviceChanged',
+ com.METHOD(ctypes.c_void_p, ctypes.c_void_p, EDataFlow, ERole, LPCWSTR)),
+ ('OnPropertyValueChanged',
+ com.METHOD(ctypes.c_void_p, ctypes.c_void_p, LPCWSTR, PROPERTYKEY)),
+ ]
+
+
+class AudioNotificationCB(com.COMObject):
+ _interfaces_ = [IMMNotificationClient]
+
+ def __init__(self, audio_devices):
+ super().__init__()
+ self.audio_devices = audio_devices
+ self._lost = False
+
+ def OnDeviceStateChanged(self, this, pwstrDeviceId, dwNewState):
+ device = self.audio_devices.get_cached_device(pwstrDeviceId)
+
+ old_state = device.state
+ assert _debug(
+ "Audio device {} changed state. From state: {} to state: {}".format(device.name, old_state, dwNewState))
+
+ device.state = dwNewState
+ self.audio_devices.dispatch_event('on_device_state_changed', device, old_state, dwNewState)
+
+ def OnDeviceAdded(self, this, pwstrDeviceId):
+ assert _debug("Audio device was added {}".format(pwstrDeviceId))
+ self.audio_devices.dispatch_event('on_device_added', pwstrDeviceId)
+
+ def OnDeviceRemoved(self, this, pwstrDeviceId):
+ assert _debug("Audio device was removed {}".format(pwstrDeviceId))
+ self.audio_devices.dispatch_event('on_device_removed', pwstrDeviceId)
+
+ def OnDefaultDeviceChanged(self, this, flow, role, pwstrDeviceId):
+ # Only support eConsole role right now
+ if role == 0:
+ if pwstrDeviceId is None:
+ device = None
+ else:
+ device = self.audio_devices.get_cached_device(pwstrDeviceId)
+
+ self.audio_devices.dispatch_event('on_default_changed', device)
+
+ def OnPropertyValueChanged(self, this, pwstrDeviceId, key):
+ pass
+
+
+class IMMDevice(com.pIUnknown):
+ _methods_ = [
+ ('Activate',
+ com.STDMETHOD(com.REFIID, DWORD, POINTER(PROPVARIANT))),
+ ('OpenPropertyStore',
+ com.STDMETHOD(UINT, POINTER(IPropertyStore))),
+ ('GetId',
+ com.STDMETHOD(POINTER(LPWSTR))),
+ ('GetState',
+ com.STDMETHOD(POINTER(DWORD))),
+ ]
+
+
+class IMMDeviceCollection(com.pIUnknown):
+ _methods_ = [
+ ('GetCount',
+ com.STDMETHOD(POINTER(UINT))),
+ ('Item',
+ com.STDMETHOD(UINT, POINTER(IMMDevice))),
+ ]
+
+
+class IMMDeviceEnumerator(com.pIUnknown):
+ _methods_ = [
+ ('EnumAudioEndpoints',
+ com.STDMETHOD(EDataFlow, DWORD, c_void_p)),
+ ('GetDefaultAudioEndpoint',
+ com.STDMETHOD(EDataFlow, ERole, ctypes.POINTER(IMMDevice))),
+ ('GetDevice',
+ com.STDMETHOD(LPCWSTR, POINTER(IMMDevice))),
+ ('RegisterEndpointNotificationCallback',
+ com.STDMETHOD(POINTER(IMMNotificationClient))),
+ ('UnregisterEndpointNotificationCallback',
+ com.STDMETHOD()),
+ ]
+
+
+class Win32AudioDevice(base.AudioDevice):
+ _platform_state = {
+ DEVICE_STATE_ACTIVE: base.DeviceState.ACTIVE,
+ DEVICE_STATE_DISABLED: base.DeviceState.DISABLED,
+ DEVICE_STATE_NOTPRESENT: base.DeviceState.MISSING,
+ DEVICE_STATE_UNPLUGGED: base.DeviceState.UNPLUGGED
+ }
+
+ _platform_flow = {
+ eRender: base.DeviceFlow.OUTPUT,
+ eCapture: base.DeviceFlow.INPUT,
+ eAll: base.DeviceFlow.INPUT_OUTPUT
+ }
+
+
+class Win32AudioDeviceManager(base.AbstractAudioDeviceManager):
+ def __init__(self):
+ self._device_enum = IMMDeviceEnumerator()
+ ole32.CoCreateInstance(CLSID_MMDeviceEnumerator, None, CLSCTX_INPROC_SERVER, IID_IMMDeviceEnumerator,
+ byref(self._device_enum))
+
+ # Keep all devices cached, and the callback can keep them updated.
+ self.devices = self._query_all_devices()
+
+ super().__init__()
+
+ self._callback = AudioNotificationCB(self)
+ self._device_enum.RegisterEndpointNotificationCallback(self._callback)
+
+ def get_default_output(self):
+ """Attempts to retrieve a default audio output for the system. Returns None if no available devices found."""
+ try:
+ device = IMMDevice()
+ self._device_enum.GetDefaultAudioEndpoint(eRender, eConsole, byref(device))
+ dev_id, name, desc, dev_state = self.get_device_info(device)
+ device.Release()
+
+ pid = self.get_cached_device(dev_id)
+ pid.state = dev_state
+ return pid
+ except OSError:
+ assert _debug("No default audio output was found.")
+ return None
+
+ def get_default_input(self):
+ """Attempts to retrieve a default audio input for the system. Returns None if no available devices found."""
+ try:
+ device = IMMDevice()
+ self._device_enum.GetDefaultAudioEndpoint(eCapture, eConsole, byref(device))
+ dev_id, name, desc, dev_state = self.get_device_info(device)
+ device.Release()
+
+ pid = self.get_cached_device(dev_id)
+ pid.state = dev_state
+ return pid
+ except OSError:
+ assert _debug("No default input output was found.")
+ return None
+
+ def get_cached_device(self, dev_id):
+ """Gets the cached devices, so we can reduce calls to COM and tell current state vs new states."""
+ for device in self.devices:
+ if device.id == dev_id:
+ return device
+
+ raise Exception("Attempted to get a device that does not exist.")
+
+ # return None
+
+ def get_output_devices(self, state=DEVICE_STATE_ACTIVE):
+ return [device for device in self.devices if device.state == state and device.flow == eRender]
+
+ def get_input_devices(self, state=DEVICE_STATE_ACTIVE):
+ return [device for device in self.devices if device.state == state and device.flow == eCapture]
+
+ def get_all_devices(self):
+ return self.devices
+
+ def _query_all_devices(self):
+ return self.get_devices(flow=eRender, state=DEVICE_STATEMASK_ALL) + self.get_devices(flow=eCapture,
+ state=DEVICE_STATEMASK_ALL)
+
+ def get_device_info(self, device):
+ """Return the ID, Name, and Description of the Audio Device."""
+ store = IPropertyStore()
+ device.OpenPropertyStore(STGM_READ, byref(store))
+
+ dev_id = LPWSTR()
+ device.GetId(byref(dev_id))
+
+ name = self.get_pkey_value(store, PKEY_Device_FriendlyName)
+ description = self.get_pkey_value(store, PKEY_Device_DeviceDesc)
+
+ state = DWORD()
+ device.GetState(byref(state))
+
+ store.Release()
+
+ return dev_id.value, name, description, state.value
+
+ def get_devices(self, flow=eRender, state=DEVICE_STATE_ACTIVE):
+ """Get's all of the specified devices (by default, all output and active)."""
+ collection = IMMDeviceCollection()
+ self._device_enum.EnumAudioEndpoints(flow, state, byref(collection))
+
+ count = UINT()
+ collection.GetCount(byref(count))
+
+ devices = []
+ for i in range(count.value):
+ dev_itf = IMMDevice()
+ collection.Item(i, byref(dev_itf))
+
+ dev_id, name, desc, dev_state = self.get_device_info(dev_itf)
+ device = Win32AudioDevice(dev_id, name, desc, flow, dev_state)
+ dev_itf.Release()
+ devices.append(device)
+
+ collection.Release()
+
+ return devices
+
+ @staticmethod
+ def get_pkey_value(store, pkey):
+ try:
+ propvar = PROPVARIANT()
+ store.GetValue(pkey, byref(propvar))
+ value = propvar.pwszVal
+ ole32.PropVariantClear(propvar)
+ except Exception as err:
+ value = "Unknown"
+
+ return value
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..0b9b812a1493180deff3c2d5ab310d29bf08961a
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/__init__.py
@@ -0,0 +1,80 @@
+"""Drivers for playing back media."""
+
+import atexit
+
+import pyglet
+
+_debug = pyglet.options['debug_media']
+
+
+def get_audio_driver():
+ """Get the preferred audio driver for the current platform.
+
+ Currently pyglet supports DirectSound, PulseAudio and OpenAL drivers. If
+ the platform supports more than one of those audio drivers, the
+ application can give its preference with :data:`pyglet.options` ``audio``
+ keyword. See the Programming guide, section
+ :doc:`/programming_guide/media`.
+
+ Returns:
+ AbstractAudioDriver : The concrete implementation of the preferred
+ audio driver for this platform.
+ """
+ global _audio_driver
+
+ if _audio_driver:
+ return _audio_driver
+
+ _audio_driver = None
+
+ for driver_name in pyglet.options['audio']:
+ try:
+ if driver_name == 'pulse':
+ from . import pulse
+ _audio_driver = pulse.create_audio_driver()
+ break
+ elif driver_name == 'xaudio2':
+ from pyglet.libs.win32.constants import WINDOWS_8_OR_GREATER
+ if WINDOWS_8_OR_GREATER:
+ from . import xaudio2
+ _audio_driver = xaudio2.create_audio_driver()
+ break
+ elif driver_name == 'directsound':
+ from . import directsound
+ _audio_driver = directsound.create_audio_driver()
+ break
+ elif driver_name == 'openal':
+ from . import openal
+ _audio_driver = openal.create_audio_driver()
+ break
+ elif driver_name == 'silent':
+ from . import silent
+ _audio_driver = silent.create_audio_driver()
+ break
+ except Exception:
+ if _debug:
+ print(f'Error importing driver {driver_name}:')
+ import traceback
+ traceback.print_exc()
+ else:
+ from . import silent
+ _audio_driver = silent.create_audio_driver()
+
+ return _audio_driver
+
+
+def _delete_audio_driver():
+ # First cleanup any remaining spontaneous Player
+ from .. import Source
+ for p in Source._players:
+ # Remove the reference to _on_player_eos which had a closure on the player
+ p.on_player_eos = None
+ del p
+
+ del Source._players
+ global _audio_driver
+ _audio_driver = None
+
+
+_audio_driver = None
+atexit.register(_delete_audio_driver)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/base.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..3c99783e1e1fceb992b4e1f5c20c7ddfc7738510
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/base.py
@@ -0,0 +1,220 @@
+import math
+import time
+import weakref
+from abc import ABCMeta, abstractmethod
+
+import pyglet
+from pyglet.util import with_metaclass
+
+
+class AbstractAudioPlayer(with_metaclass(ABCMeta)):
+ """Base class for driver audio players.
+ """
+
+ # Audio synchronization constants
+ AUDIO_DIFF_AVG_NB = 20
+ # no audio correction is done if too big error
+ AV_NOSYNC_THRESHOLD = 10.0
+
+ def __init__(self, source, player):
+ """Create a new audio player.
+
+ :Parameters:
+ `source` : `Source`
+ Source to play from.
+ `player` : `Player`
+ Player to receive EOS and video frame sync events.
+
+ """
+ # We only keep weakref to the player and its source to avoid
+ # circular references. It's the player who owns the source and
+ # the audio_player
+ self.source = source
+ self.player = weakref.proxy(player)
+
+ # Audio synchronization
+ self.audio_diff_avg_count = 0
+ self.audio_diff_cum = 0.0
+ self.audio_diff_avg_coef = math.exp(math.log10(0.01) / self.AUDIO_DIFF_AVG_NB)
+ self.audio_diff_threshold = 0.1 # Experimental. ffplay computes it differently
+
+ def on_driver_destroy(self):
+ """Called before the audio driver is going to be destroyed (a planned destroy)."""
+ pass
+
+ def on_driver_reset(self):
+ """Called after the audio driver has been re-initialized."""
+ pass
+
+ @abstractmethod
+ def play(self):
+ """Begin playback."""
+
+ @abstractmethod
+ def stop(self):
+ """Stop (pause) playback."""
+
+ @abstractmethod
+ def delete(self):
+ """Stop playing and clean up all resources used by player."""
+
+ def _play_group(self, audio_players):
+ """Begin simultaneous playback on a list of audio players."""
+ # This should be overridden by subclasses for better synchrony.
+ for player in audio_players:
+ player.play()
+
+ def _stop_group(self, audio_players):
+ """Stop simultaneous playback on a list of audio players."""
+ # This should be overridden by subclasses for better synchrony.
+ for player in audio_players:
+ player.stop()
+
+ @abstractmethod
+ def clear(self):
+ """Clear all buffered data and prepare for replacement data.
+
+ The player should be stopped before calling this method.
+ """
+ self.audio_diff_avg_count = 0
+ self.audio_diff_cum = 0.0
+
+ @abstractmethod
+ def get_time(self):
+ """Return approximation of current playback time within current source.
+
+ Returns ``None`` if the audio player does not know what the playback
+ time is (for example, before any valid audio data has been read).
+
+ :rtype: float
+ :return: current play cursor time, in seconds.
+ """
+ # TODO determine which source within group
+
+ @abstractmethod
+ def prefill_audio(self):
+ """Prefill the audio buffer with audio data.
+
+ This method is called before the audio player starts in order to
+ reduce the time it takes to fill the whole audio buffer.
+ """
+
+ def get_audio_time_diff(self):
+ """Queries the time difference between the audio time and the `Player`
+ master clock.
+
+ The time difference returned is calculated using a weighted average on
+ previous audio time differences. The algorithms will need at least 20
+ measurements before returning a weighted average.
+
+ :rtype: float
+ :return: weighted average difference between audio time and master
+ clock from `Player`
+ """
+ audio_time = self.get_time() or 0
+ p_time = self.player.time
+ diff = audio_time - p_time
+ if abs(diff) < self.AV_NOSYNC_THRESHOLD:
+ self.audio_diff_cum = diff + self.audio_diff_cum * self.audio_diff_avg_coef
+ if self.audio_diff_avg_count < self.AUDIO_DIFF_AVG_NB:
+ self.audio_diff_avg_count += 1
+ else:
+ avg_diff = self.audio_diff_cum * (1 - self.audio_diff_avg_coef)
+ if abs(avg_diff) > self.audio_diff_threshold:
+ return avg_diff
+ else:
+ self.audio_diff_avg_count = 0
+ self.audio_diff_cum = 0.0
+ return 0.0
+
+ def set_volume(self, volume):
+ """See `Player.volume`."""
+ pass
+
+ def set_position(self, position):
+ """See :py:attr:`~pyglet.media.Player.position`."""
+ pass
+
+ def set_min_distance(self, min_distance):
+ """See `Player.min_distance`."""
+ pass
+
+ def set_max_distance(self, max_distance):
+ """See `Player.max_distance`."""
+ pass
+
+ def set_pitch(self, pitch):
+ """See :py:attr:`~pyglet.media.Player.pitch`."""
+ pass
+
+ def set_cone_orientation(self, cone_orientation):
+ """See `Player.cone_orientation`."""
+ pass
+
+ def set_cone_inner_angle(self, cone_inner_angle):
+ """See `Player.cone_inner_angle`."""
+ pass
+
+ def set_cone_outer_angle(self, cone_outer_angle):
+ """See `Player.cone_outer_angle`."""
+ pass
+
+ def set_cone_outer_gain(self, cone_outer_gain):
+ """See `Player.cone_outer_gain`."""
+ pass
+
+ @property
+ def source(self):
+ """Source to play from."""
+ return self._source
+
+ @source.setter
+ def source(self, value):
+ self._source = weakref.proxy(value)
+
+
+class AbstractAudioDriver(with_metaclass(ABCMeta)):
+ @abstractmethod
+ def create_audio_player(self, source, player):
+ pass
+
+ @abstractmethod
+ def get_listener(self):
+ pass
+
+ @abstractmethod
+ def delete(self):
+ pass
+
+
+class MediaEvent:
+ """Representation of a media event.
+
+ These events are used internally by some audio driver implementation to
+ communicate events to the :class:`~pyglet.media.player.Player`.
+ One example is the ``on_eos`` event.
+
+ Args:
+ event (str): Event description.
+ timestamp (float): The time when this event happens.
+ *args: Any required positional argument to go along with this event.
+ """
+
+ __slots__ = 'event', 'timestamp', 'args'
+
+ def __init__(self, event, timestamp=0, *args):
+ # Meaning of timestamp is dependent on context; and not seen by application.
+ self.event = event
+ self.timestamp = timestamp
+ self.args = args
+
+ def sync_dispatch_to_player(self, player):
+ pyglet.app.platform_event_loop.post_event(player, self.event, *self.args)
+ time.sleep(0)
+ # TODO sync with media.dispatch_events
+
+ def __repr__(self):
+ return f"MediaEvent({self.event}, {self.timestamp}, {self.args})"
+
+ def __lt__(self, other):
+ return hash(self) < hash(other)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..9a26c0e23f7d92a37e9a73e19d5bfbf0b78eecaa
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/__init__.py
@@ -0,0 +1,9 @@
+from . import adaptation
+from .exceptions import DirectSoundException, DirectSoundNativeError
+
+
+def create_audio_driver():
+ return adaptation.DirectSoundDriver()
+
+
+__all__ = ["create_audio_driver", "DirectSoundException", "DirectSoundNativeError"]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/adaptation.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/adaptation.py
new file mode 100644
index 0000000000000000000000000000000000000000..af53dabce21066681458217ef8ddc8c6e15f7240
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/adaptation.py
@@ -0,0 +1,403 @@
+import math
+import ctypes
+
+from . import interface
+from pyglet.util import debug_print
+from pyglet.media.mediathreads import PlayerWorkerThread
+from pyglet.media.drivers.base import AbstractAudioDriver, AbstractAudioPlayer, MediaEvent
+from pyglet.media.drivers.listener import AbstractListener
+
+_debug = debug_print('debug_media')
+
+
+def _convert_coordinates(coordinates):
+ x, y, z = coordinates
+ return x, y, -z
+
+
+def _gain2db(gain):
+ """
+ Convert linear gain in range [0.0, 1.0] to 100ths of dB.
+
+ Power gain = P1/P2
+ dB = 2 log(P1/P2)
+ dB * 100 = 1000 * log(power gain)
+ """
+ if gain <= 0:
+ return -10000
+ return max(-10000, min(int(1000 * math.log2(min(gain, 1))), 0))
+
+
+def _db2gain(db):
+ """Convert 100ths of dB to linear gain."""
+ return math.pow(10.0, float(db)/1000.0)
+
+
+class DirectSoundAudioPlayer(AbstractAudioPlayer):
+ # Need to cache these because pyglet API allows update separately, but
+ # DSound requires both to be set at once.
+ _cone_inner_angle = 360
+ _cone_outer_angle = 360
+
+ min_buffer_size = 9600
+
+ def __init__(self, driver, ds_driver, source, player):
+ super(DirectSoundAudioPlayer, self).__init__(source, player)
+
+ # We keep here a strong reference because the AudioDriver is anyway
+ # a singleton object which will only be deleted when the application
+ # shuts down. The AudioDriver does not keep a ref to the AudioPlayer.
+ self.driver = driver
+ self._ds_driver = ds_driver
+
+ # Desired play state (may be actually paused due to underrun -- not
+ # implemented yet).
+ self._playing = False
+
+ # Up to one audio data may be buffered if too much data was received
+ # from the source that could not be written immediately into the
+ # buffer. See _refill().
+ self._audiodata_buffer = None
+
+ # Theoretical write and play cursors for an infinite buffer. play
+ # cursor is always <= write cursor (when equal, underrun is
+ # happening).
+ self._write_cursor = 0
+ self._play_cursor = 0
+
+ # Cursor position of end of data. Silence is written after
+ # eos for one buffer size.
+ self._eos_cursor = None
+
+ # Indexes into DSound circular buffer. Complications ensue wrt each
+ # other to avoid writing over the play cursor. See _get_write_size and
+ # write().
+ self._play_cursor_ring = 0
+ self._write_cursor_ring = 0
+
+ # List of (play_cursor, MediaEvent), in sort order
+ self._events = []
+
+ # List of (cursor, timestamp), in sort order (cursor gives expiry
+ # place of the timestamp)
+ self._timestamps = []
+
+ audio_format = source.audio_format
+
+ # DSound buffer
+ self._ds_buffer = self._ds_driver.create_buffer(audio_format)
+ self._buffer_size = self._ds_buffer.buffer_size
+
+ self._ds_buffer.current_position = 0
+
+ self._refill(self._buffer_size)
+
+ def __del__(self):
+ # We decrease the IDirectSound refcount
+ self.driver._ds_driver._native_dsound.Release()
+
+ def delete(self):
+ self.driver.worker.remove(self)
+
+ def play(self):
+ assert _debug('DirectSound play')
+ self.driver.worker.add(self)
+
+ if not self._playing:
+ self._get_audiodata() # prebuffer if needed
+ self._playing = True
+ self._ds_buffer.play()
+
+ assert _debug('return DirectSound play')
+
+ def stop(self):
+ assert _debug('DirectSound stop')
+ self.driver.worker.remove(self)
+
+ if self._playing:
+ self._playing = False
+ self._ds_buffer.stop()
+
+ assert _debug('return DirectSound stop')
+
+ def clear(self):
+ assert _debug('DirectSound clear')
+ super(DirectSoundAudioPlayer, self).clear()
+ self._ds_buffer.current_position = 0
+ self._play_cursor_ring = self._write_cursor_ring = 0
+ self._play_cursor = self._write_cursor
+ self._eos_cursor = None
+ self._audiodata_buffer = None
+ del self._events[:]
+ del self._timestamps[:]
+
+ def refill_buffer(self):
+ write_size = self._get_write_size()
+ if write_size > self.min_buffer_size:
+ self._refill(write_size)
+ return True
+ return False
+
+ def _refill(self, write_size):
+ while write_size > 0:
+ assert _debug('_refill, write_size =', write_size)
+ audio_data = self._get_audiodata()
+
+ if audio_data is not None:
+ assert _debug('write', audio_data.length)
+ length = min(write_size, audio_data.length)
+ self.write(audio_data, length)
+ write_size -= length
+ else:
+ assert _debug('write silence')
+ self.write(None, write_size)
+ write_size = 0
+
+ def _has_underrun(self):
+ return (self._eos_cursor is not None
+ and self._play_cursor > self._eos_cursor)
+
+ def _dispatch_new_event(self, event_name):
+ MediaEvent(event_name).sync_dispatch_to_player(self.player)
+
+ def _get_audiodata(self):
+ if self._audiodata_buffer is None or self._audiodata_buffer.length == 0:
+ self._get_new_audiodata()
+
+ return self._audiodata_buffer
+
+ def _get_new_audiodata(self):
+ assert _debug('Getting new audio data buffer.')
+ # Pass a reference of ourself to allow the audio decoding to get time
+ # information for synchronization.
+ compensation_time = self.get_audio_time_diff()
+ self._audiodata_buffer = self.source.get_audio_data(self._buffer_size, compensation_time)
+
+ if self._audiodata_buffer is not None:
+ assert _debug('New audio data available: {} bytes'.format(self._audiodata_buffer.length))
+
+ if self._eos_cursor is not None:
+ self._move_write_cursor_after_eos()
+
+ self._add_audiodata_events(self._audiodata_buffer)
+ self._add_audiodata_timestamp(self._audiodata_buffer)
+ self._eos_cursor = None
+ elif self._eos_cursor is None:
+ assert _debug('No more audio data.')
+ self._eos_cursor = self._write_cursor
+
+ def _move_write_cursor_after_eos(self):
+ # Set the write cursor back to eos_cursor or play_cursor to prevent gaps
+ if self._play_cursor < self._eos_cursor:
+ cursor_diff = self._write_cursor - self._eos_cursor
+ assert _debug('Moving cursor back', cursor_diff)
+ self._write_cursor = self._eos_cursor
+ self._write_cursor_ring -= cursor_diff
+ self._write_cursor_ring %= self._buffer_size
+
+ else:
+ cursor_diff = self._play_cursor - self._eos_cursor
+ assert _debug('Moving cursor back', cursor_diff)
+ self._write_cursor = self._play_cursor
+ self._write_cursor_ring -= cursor_diff
+ self._write_cursor_ring %= self._buffer_size
+
+ def _add_audiodata_events(self, audio_data):
+ for event in audio_data.events:
+ event_cursor = self._write_cursor + event.timestamp * \
+ self.source.audio_format.bytes_per_second
+ assert _debug('Adding event', event, 'at', event_cursor)
+ self._events.append((event_cursor, event))
+
+ def _add_audiodata_timestamp(self, audio_data):
+ ts_cursor = self._write_cursor + audio_data.length
+ self._timestamps.append(
+ (ts_cursor, audio_data.timestamp + audio_data.duration))
+
+ def update_play_cursor(self):
+ play_cursor_ring = self._ds_buffer.current_position.play_cursor
+ if play_cursor_ring < self._play_cursor_ring:
+ # Wrapped around
+ self._play_cursor += self._buffer_size - self._play_cursor_ring
+ self._play_cursor_ring = 0
+ self._play_cursor += play_cursor_ring - self._play_cursor_ring
+ self._play_cursor_ring = play_cursor_ring
+
+ self._dispatch_pending_events()
+ self._cleanup_timestamps()
+ self._check_underrun()
+
+ def _dispatch_pending_events(self):
+ pending_events = []
+ while self._events and self._events[0][0] <= self._play_cursor:
+ _, event = self._events.pop(0)
+ pending_events.append(event)
+ assert _debug('Dispatching pending events: {}'.format(pending_events))
+ assert _debug('Remaining events: {}'.format(self._events))
+
+ for event in pending_events:
+ event._sync_dispatch_to_player(self.player)
+
+ def _cleanup_timestamps(self):
+ while self._timestamps and self._timestamps[0][0] < self._play_cursor:
+ del self._timestamps[0]
+
+ def _check_underrun(self):
+ if self._playing and self._has_underrun():
+ assert _debug('underrun, stopping')
+ self.stop()
+ self._dispatch_new_event('on_eos')
+
+ def _get_write_size(self):
+ self.update_play_cursor()
+
+ play_cursor = self._play_cursor
+ write_cursor = self._write_cursor
+
+ return self._buffer_size - max(write_cursor - play_cursor, 0)
+
+ def write(self, audio_data, length):
+ # Pass audio_data=None to write silence
+ if length == 0:
+ return 0
+
+ write_ptr = self._ds_buffer.lock(self._write_cursor_ring, length)
+ assert 0 < length <= self._buffer_size
+ assert length == write_ptr.audio_length_1.value + write_ptr.audio_length_2.value
+
+ if audio_data:
+ ctypes.memmove(write_ptr.audio_ptr_1, audio_data.data, write_ptr.audio_length_1.value)
+ audio_data.consume(write_ptr.audio_length_1.value, self.source.audio_format)
+ if write_ptr.audio_length_2.value > 0:
+ ctypes.memmove(write_ptr.audio_ptr_2, audio_data.data, write_ptr.audio_length_2.value)
+ audio_data.consume(write_ptr.audio_length_2.value, self.source.audio_format)
+ else:
+ if self.source.audio_format.sample_size == 8:
+ c = 0x80
+ else:
+ c = 0
+ ctypes.memset(write_ptr.audio_ptr_1, c, write_ptr.audio_length_1.value)
+ if write_ptr.audio_length_2.value > 0:
+ ctypes.memset(write_ptr.audio_ptr_2, c, write_ptr.audio_length_2.value)
+ self._ds_buffer.unlock(write_ptr)
+
+ self._write_cursor += length
+ self._write_cursor_ring += length
+ self._write_cursor_ring %= self._buffer_size
+
+ def get_time(self):
+ self.update_play_cursor()
+ if self._timestamps:
+ cursor, ts = self._timestamps[0]
+ result = ts + (self._play_cursor - cursor) / float(self.source.audio_format.bytes_per_second)
+ else:
+ result = None
+
+ return result
+
+ def set_volume(self, volume):
+ self._ds_buffer.volume = _gain2db(volume)
+
+ def set_position(self, position):
+ if self._ds_buffer.is3d:
+ self._ds_buffer.position = _convert_coordinates(position)
+
+ def set_min_distance(self, min_distance):
+ if self._ds_buffer.is3d:
+ self._ds_buffer.min_distance = min_distance
+
+ def set_max_distance(self, max_distance):
+ if self._ds_buffer.is3d:
+ self._ds_buffer.max_distance = max_distance
+
+ def set_pitch(self, pitch):
+ frequency = int(pitch * self.source.audio_format.sample_rate)
+ self._ds_buffer.frequency = frequency
+
+ def set_cone_orientation(self, cone_orientation):
+ if self._ds_buffer.is3d:
+ self._ds_buffer.cone_orientation = _convert_coordinates(cone_orientation)
+
+ def set_cone_inner_angle(self, cone_inner_angle):
+ if self._ds_buffer.is3d:
+ self._cone_inner_angle = int(cone_inner_angle)
+ self._set_cone_angles()
+
+ def set_cone_outer_angle(self, cone_outer_angle):
+ if self._ds_buffer.is3d:
+ self._cone_outer_angle = int(cone_outer_angle)
+ self._set_cone_angles()
+
+ def _set_cone_angles(self):
+ inner = min(self._cone_inner_angle, self._cone_outer_angle)
+ outer = max(self._cone_inner_angle, self._cone_outer_angle)
+ self._ds_buffer.set_cone_angles(inner, outer)
+
+ def set_cone_outer_gain(self, cone_outer_gain):
+ if self._ds_buffer.is3d:
+ volume = _gain2db(cone_outer_gain)
+ self._ds_buffer.cone_outside_volume = volume
+
+ def prefill_audio(self):
+ write_size = self._get_write_size()
+ self._refill(write_size)
+
+
+class DirectSoundDriver(AbstractAudioDriver):
+ def __init__(self):
+ self._ds_driver = interface.DirectSoundDriver()
+ self._ds_listener = self._ds_driver.create_listener()
+
+ assert self._ds_driver is not None
+ assert self._ds_listener is not None
+
+ self.worker = PlayerWorkerThread()
+ self.worker.start()
+
+ def __del__(self):
+ self.delete()
+
+ def create_audio_player(self, source, player):
+ assert self._ds_driver is not None
+ # We increase IDirectSound refcount for each AudioPlayer instantiated
+ # This makes sure the AudioPlayer still has a valid _native_dsound to
+ # clean-up itself during tear-down.
+ self._ds_driver._native_dsound.AddRef()
+ return DirectSoundAudioPlayer(self, self._ds_driver, source, player)
+
+ def get_listener(self):
+ assert self._ds_driver is not None
+ assert self._ds_listener is not None
+ return DirectSoundListener(self._ds_listener, self._ds_driver.primary_buffer)
+
+ def delete(self):
+ if hasattr(self, 'worker'):
+ self.worker.stop()
+ # Make sure the _ds_listener is deleted before the _ds_driver
+ self._ds_listener = None
+
+
+class DirectSoundListener(AbstractListener):
+ def __init__(self, ds_listener, ds_buffer):
+ self._ds_listener = ds_listener
+ self._ds_buffer = ds_buffer
+
+ def _set_volume(self, volume):
+ self._volume = volume
+ self._ds_buffer.volume = _gain2db(volume)
+
+ def _set_position(self, position):
+ self._position = position
+ self._ds_listener.position = _convert_coordinates(position)
+
+ def _set_forward_orientation(self, orientation):
+ self._forward_orientation = orientation
+ self._set_orientation()
+
+ def _set_up_orientation(self, orientation):
+ self._up_orientation = orientation
+ self._set_orientation()
+
+ def _set_orientation(self):
+ self._ds_listener.orientation = (_convert_coordinates(self._forward_orientation)
+ + _convert_coordinates(self._up_orientation))
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/exceptions.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/exceptions.py
new file mode 100644
index 0000000000000000000000000000000000000000..97249a83cf54ef6b0f0a12dd07058b57686b445a
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/exceptions.py
@@ -0,0 +1,13 @@
+from pyglet.media.exceptions import MediaException
+
+
+class DirectSoundException(MediaException):
+ pass
+
+
+class DirectSoundNativeError(DirectSoundException):
+ def __init__(self, hresult):
+ self.hresult = hresult
+
+ def __repr__(self):
+ return "{}: Error {}".format(self.__class__.__name__, self.hresult)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/interface.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/interface.py
new file mode 100644
index 0000000000000000000000000000000000000000..f691d677a8e8157c53e35efd36101aa0c003e8bb
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/interface.py
@@ -0,0 +1,428 @@
+"""
+Pythonic interface to DirectSound.
+"""
+import ctypes
+import weakref
+from collections import namedtuple
+
+from pyglet.util import debug_print
+from pyglet.window.win32 import _user32
+
+from . import lib_dsound as lib
+from .exceptions import DirectSoundNativeError
+
+_debug = debug_print('debug_media')
+
+
+def _check(hresult):
+ if hresult != lib.DS_OK:
+ raise DirectSoundNativeError(hresult)
+
+
+class DirectSoundDriver:
+ def __init__(self):
+ assert _debug('Constructing DirectSoundDriver')
+
+ self._native_dsound = lib.IDirectSound()
+ _check(
+ lib.DirectSoundCreate(None, ctypes.byref(self._native_dsound), None)
+ )
+
+ # A trick used by mplayer.. use desktop as window handle since it
+ # would be complex to use pyglet window handles (and what to do when
+ # application is audio only?).
+ hwnd = _user32.GetDesktopWindow()
+ _check(
+ self._native_dsound.SetCooperativeLevel(hwnd, lib.DSSCL_NORMAL)
+ )
+
+ self._buffer_factory = DirectSoundBufferFactory(self._native_dsound)
+ self.primary_buffer = self._buffer_factory.create_primary_buffer()
+
+ def __del__(self):
+ try:
+ self.primary_buffer = None
+ self._native_dsound.Release()
+ except ValueError:
+ pass
+
+ def create_buffer(self, audio_format):
+ return self._buffer_factory.create_buffer(audio_format)
+
+ def create_listener(self):
+ return self.primary_buffer.create_listener()
+
+
+class DirectSoundBufferFactory:
+ default_buffer_size = 2.0
+
+ def __init__(self, native_dsound):
+ # We only keep a weakref to native_dsound which is owned by
+ # interface.DirectSoundDriver
+ self._native_dsound = weakref.proxy(native_dsound)
+
+ def create_buffer(self, audio_format):
+ buffer_size = int(audio_format.sample_rate * self.default_buffer_size)
+ wave_format = self._create_wave_format(audio_format)
+ buffer_desc = self._create_buffer_desc(wave_format, buffer_size)
+ return DirectSoundBuffer(
+ self._create_buffer(buffer_desc),
+ audio_format,
+ buffer_size)
+
+ def create_primary_buffer(self):
+ return DirectSoundBuffer(
+ self._create_buffer(self._create_primary_buffer_desc()),
+ None,
+ 0)
+
+ def _create_buffer(self, buffer_desc):
+ buf = lib.IDirectSoundBuffer()
+ _check(
+ self._native_dsound.CreateSoundBuffer(buffer_desc, ctypes.byref(buf), None)
+ )
+ return buf
+
+ @staticmethod
+ def _create_wave_format(audio_format):
+ wfx = lib.WAVEFORMATEX()
+ wfx.wFormatTag = lib.WAVE_FORMAT_PCM
+ wfx.nChannels = audio_format.channels
+ wfx.nSamplesPerSec = audio_format.sample_rate
+ wfx.wBitsPerSample = audio_format.sample_size
+ wfx.nBlockAlign = wfx.wBitsPerSample * wfx.nChannels // 8
+ wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign
+ return wfx
+
+ @classmethod
+ def _create_buffer_desc(cls, wave_format, buffer_size):
+ dsbdesc = lib.DSBUFFERDESC()
+ dsbdesc.dwSize = ctypes.sizeof(dsbdesc)
+ dsbdesc.dwFlags = (lib.DSBCAPS_GLOBALFOCUS |
+ lib.DSBCAPS_GETCURRENTPOSITION2 |
+ lib.DSBCAPS_CTRLFREQUENCY |
+ lib.DSBCAPS_CTRLVOLUME)
+ if wave_format.nChannels == 1:
+ dsbdesc.dwFlags |= lib.DSBCAPS_CTRL3D
+ dsbdesc.dwBufferBytes = buffer_size
+ dsbdesc.lpwfxFormat = ctypes.pointer(wave_format)
+
+ return dsbdesc
+
+ @classmethod
+ def _create_primary_buffer_desc(cls):
+ """Primary buffer with 3D and volume capabilities"""
+ buffer_desc = lib.DSBUFFERDESC()
+ buffer_desc.dwSize = ctypes.sizeof(buffer_desc)
+ buffer_desc.dwFlags = (lib.DSBCAPS_CTRL3D |
+ lib.DSBCAPS_CTRLVOLUME |
+ lib.DSBCAPS_PRIMARYBUFFER)
+
+ return buffer_desc
+
+
+class DirectSoundBuffer:
+ def __init__(self, native_buffer, audio_format, buffer_size):
+ self.audio_format = audio_format
+ self.buffer_size = buffer_size
+
+ self._native_buffer = native_buffer
+
+ if audio_format is not None and audio_format.channels == 1:
+ self._native_buffer3d = lib.IDirectSound3DBuffer()
+ self._native_buffer.QueryInterface(lib.IID_IDirectSound3DBuffer,
+ ctypes.byref(self._native_buffer3d))
+ else:
+ self._native_buffer3d = None
+
+ def __del__(self):
+ try:
+ self.delete()
+ except OSError:
+ pass
+
+ def delete(self):
+ if self._native_buffer is not None:
+ self._native_buffer.Stop()
+ self._native_buffer.Release()
+ self._native_buffer = None
+ if self._native_buffer3d is not None:
+ self._native_buffer3d.Release()
+ self._native_buffer3d = None
+
+ @property
+ def volume(self):
+ vol = lib.LONG()
+ _check(
+ self._native_buffer.GetVolume(ctypes.byref(vol))
+ )
+ return vol.value
+
+ @volume.setter
+ def volume(self, value):
+ _check(
+ self._native_buffer.SetVolume(value)
+ )
+
+ _CurrentPosition = namedtuple('_CurrentPosition', ['play_cursor', 'write_cursor'])
+
+ @property
+ def current_position(self):
+ """Tuple of current play position and current write position.
+ Only play position can be modified, so setter only accepts a single value."""
+ play_cursor = lib.DWORD()
+ write_cursor = lib.DWORD()
+ _check(
+ self._native_buffer.GetCurrentPosition(play_cursor,
+ write_cursor)
+ )
+ return self._CurrentPosition(play_cursor.value, write_cursor.value)
+
+ @current_position.setter
+ def current_position(self, value):
+ _check(
+ self._native_buffer.SetCurrentPosition(value)
+ )
+
+ @property
+ def is3d(self):
+ return self._native_buffer3d is not None
+
+ @property
+ def is_playing(self):
+ return (self._get_status() & lib.DSBSTATUS_PLAYING) != 0
+
+ @property
+ def is_buffer_lost(self):
+ return (self._get_status() & lib.DSBSTATUS_BUFFERLOST) != 0
+
+ def _get_status(self):
+ status = lib.DWORD()
+ _check(
+ self._native_buffer.GetStatus(status)
+ )
+ return status.value
+
+ @property
+ def position(self):
+ if self.is3d:
+ position = lib.D3DVECTOR()
+ _check(
+ self._native_buffer3d.GetPosition(ctypes.byref(position))
+ )
+ return position.x, position.y, position.z
+ else:
+ return 0, 0, 0
+
+ @position.setter
+ def position(self, position):
+ if self.is3d:
+ x, y, z = position
+ _check(
+ self._native_buffer3d.SetPosition(x, y, z, lib.DS3D_IMMEDIATE)
+ )
+
+ @property
+ def min_distance(self):
+ """The minimum distance, which is the distance from the
+ listener at which sounds in this buffer begin to be attenuated."""
+ if self.is3d:
+ value = lib.D3DVALUE()
+ _check(
+ self._native_buffer3d.GetMinDistance(ctypes.byref(value))
+ )
+ return value.value
+ else:
+ return 0
+
+ @min_distance.setter
+ def min_distance(self, value):
+ if self.is3d:
+ _check(
+ self._native_buffer3d.SetMinDistance(value, lib.DS3D_IMMEDIATE)
+ )
+
+ @property
+ def max_distance(self):
+ """The maximum distance, which is the distance from the listener beyond which
+ sounds in this buffer are no longer attenuated."""
+ if self.is3d:
+ value = lib.D3DVALUE()
+ _check(
+ self._native_buffer3d.GetMaxDistance(ctypes.byref(value))
+ )
+ return value.value
+ else:
+ return 0
+
+ @max_distance.setter
+ def max_distance(self, value):
+ if self.is3d:
+ _check(
+ self._native_buffer3d.SetMaxDistance(value, lib.DS3D_IMMEDIATE)
+ )
+
+ @property
+ def frequency(self):
+ value = lib.DWORD()
+ _check(
+ self._native_buffer.GetFrequency(value)
+ )
+ return value.value
+
+ @frequency.setter
+ def frequency(self, value):
+ """The frequency, in samples per second, at which the buffer is playing."""
+ _check(
+ self._native_buffer.SetFrequency(value)
+ )
+
+ @property
+ def cone_orientation(self):
+ """The orientation of the sound projection cone."""
+ if self.is3d:
+ orientation = lib.D3DVECTOR()
+ _check(
+ self._native_buffer3d.GetConeOrientation(ctypes.byref(orientation))
+ )
+ return orientation.x, orientation.y, orientation.z
+ else:
+ return 0, 0, 0
+
+ @cone_orientation.setter
+ def cone_orientation(self, value):
+ if self.is3d:
+ x, y, z = value
+ _check(
+ self._native_buffer3d.SetConeOrientation(x, y, z, lib.DS3D_IMMEDIATE)
+ )
+
+ _ConeAngles = namedtuple('_ConeAngles', ['inside', 'outside'])
+ @property
+ def cone_angles(self):
+ """The inside and outside angles of the sound projection cone."""
+ if self.is3d:
+ inside = lib.DWORD()
+ outside = lib.DWORD()
+ _check(
+ self._native_buffer3d.GetConeAngles(ctypes.byref(inside), ctypes.byref(outside))
+ )
+ return self._ConeAngles(inside.value, outside.value)
+ else:
+ return self._ConeAngles(0, 0)
+
+ def set_cone_angles(self, inside, outside):
+ """The inside and outside angles of the sound projection cone."""
+ if self.is3d:
+ _check(
+ self._native_buffer3d.SetConeAngles(inside, outside, lib.DS3D_IMMEDIATE)
+ )
+
+ @property
+ def cone_outside_volume(self):
+ """The volume of the sound outside the outside angle of the sound projection cone."""
+ if self.is3d:
+ volume = lib.LONG()
+ _check(
+ self._native_buffer3d.GetConeOutsideVolume(ctypes.byref(volume))
+ )
+ return volume.value
+ else:
+ return 0
+
+ @cone_outside_volume.setter
+ def cone_outside_volume(self, value):
+ if self.is3d:
+ _check(
+ self._native_buffer3d.SetConeOutsideVolume(value, lib.DS3D_IMMEDIATE)
+ )
+
+ def create_listener(self):
+ native_listener = lib.IDirectSound3DListener()
+ self._native_buffer.QueryInterface(lib.IID_IDirectSound3DListener,
+ ctypes.byref(native_listener))
+ return DirectSoundListener(self, native_listener)
+
+ def play(self):
+ _check(
+ self._native_buffer.Play(0, 0, lib.DSBPLAY_LOOPING)
+ )
+
+ def stop(self):
+ _check(
+ self._native_buffer.Stop()
+ )
+
+ class _WritePointer:
+ def __init__(self):
+ self.audio_ptr_1 = ctypes.c_void_p()
+ self.audio_length_1 = lib.DWORD()
+ self.audio_ptr_2 = ctypes.c_void_p()
+ self.audio_length_2 = lib.DWORD()
+
+ def lock(self, write_cursor, write_size):
+ assert _debug('DirectSoundBuffer.lock({}, {})'.format(write_cursor, write_size))
+ pointer = self._WritePointer()
+ _check(
+ self._native_buffer.Lock(write_cursor,
+ write_size,
+ ctypes.byref(pointer.audio_ptr_1),
+ pointer.audio_length_1,
+ ctypes.byref(pointer.audio_ptr_2),
+ pointer.audio_length_2,
+ 0)
+ )
+ return pointer
+
+ def unlock(self, pointer):
+ _check(
+ self._native_buffer.Unlock(pointer.audio_ptr_1,
+ pointer.audio_length_1,
+ pointer.audio_ptr_2,
+ pointer.audio_length_2)
+ )
+
+
+class DirectSoundListener:
+ def __init__(self, ds_buffer, native_listener):
+ # We only keep a weakref to ds_buffer as it is owned by
+ # interface.DirectSound or a DirectSoundAudioPlayer
+ self.ds_buffer = weakref.proxy(ds_buffer)
+ self._native_listener = native_listener
+
+ def __del__(self):
+ self.delete()
+
+ def delete(self):
+ if self._native_listener:
+ self._native_listener.Release()
+ self._native_listener = None
+
+ @property
+ def position(self):
+ vector = lib.D3DVECTOR()
+ _check(
+ self._native_listener.GetPosition(ctypes.byref(vector))
+ )
+ return vector.x, vector.y, vector.z
+
+ @position.setter
+ def position(self, value):
+ _check(
+ self._native_listener.SetPosition(*(list(value) + [lib.DS3D_IMMEDIATE]))
+ )
+
+ @property
+ def orientation(self):
+ front = lib.D3DVECTOR()
+ top = lib.D3DVECTOR()
+ _check(
+ self._native_listener.GetOrientation(ctypes.byref(front), ctypes.byref(top))
+ )
+ return front.x, front.y, front.z, top.x, top.y, top.z
+
+ @orientation.setter
+ def orientation(self, orientation):
+ _check(
+ self._native_listener.SetOrientation(*(list(orientation) + [lib.DS3D_IMMEDIATE]))
+ )
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/lib_dsound.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/lib_dsound.py
new file mode 100644
index 0000000000000000000000000000000000000000..9f9e438d1e159b0858f1e164d9ee23f50dad5d97
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/directsound/lib_dsound.py
@@ -0,0 +1,416 @@
+import ctypes
+from pyglet.libs.win32 import com
+
+lib = ctypes.oledll.dsound
+
+DWORD = ctypes.c_uint32
+LPDWORD = ctypes.POINTER(DWORD)
+LONG = ctypes.c_long
+LPLONG = ctypes.POINTER(LONG)
+WORD = ctypes.c_uint16
+HWND = DWORD
+LPUNKNOWN = ctypes.c_void_p
+
+D3DVALUE = ctypes.c_float
+PD3DVALUE = ctypes.POINTER(D3DVALUE)
+
+class D3DVECTOR(ctypes.Structure):
+ _fields_ = [
+ ('x', ctypes.c_float),
+ ('y', ctypes.c_float),
+ ('z', ctypes.c_float),
+ ]
+PD3DVECTOR = ctypes.POINTER(D3DVECTOR)
+
+class WAVEFORMATEX(ctypes.Structure):
+ _fields_ = [
+ ('wFormatTag', WORD),
+ ('nChannels', WORD),
+ ('nSamplesPerSec', DWORD),
+ ('nAvgBytesPerSec', DWORD),
+ ('nBlockAlign', WORD),
+ ('wBitsPerSample', WORD),
+ ('cbSize', WORD),
+ ]
+
+ def __repr__(self):
+ return 'WAVEFORMATEX(wFormatTag={}, nChannels={}, nSamplesPerSec={}, nAvgBytesPersec={}' \
+ ', nBlockAlign={}, wBitsPerSample={}, cbSize={})'.format(
+ self.wFormatTag, self.nChannels, self.nSamplesPerSec,
+ self.nAvgBytesPerSec, self.nBlockAlign, self.wBitsPerSample,
+ self.cbSize)
+LPWAVEFORMATEX = ctypes.POINTER(WAVEFORMATEX)
+WAVE_FORMAT_PCM = 1
+
+class DSCAPS(ctypes.Structure):
+ _fields_ = [
+ ('dwSize', DWORD),
+ ('dwFlags', DWORD),
+ ('dwMinSecondarySampleRate', DWORD),
+ ('dwMaxSecondarySampleRate', DWORD),
+ ('dwPrimaryBuffers', DWORD),
+ ('dwMaxHwMixingAllBuffers', DWORD),
+ ('dwMaxHwMixingStaticBuffers', DWORD),
+ ('dwMaxHwMixingStreamingBuffers', DWORD),
+ ('dwFreeHwMixingAllBuffers', DWORD),
+ ('dwFreeHwMixingStaticBuffers', DWORD),
+ ('dwFreeHwMixingStreamingBuffers', DWORD),
+ ('dwMaxHw3DAllBuffers', DWORD),
+ ('dwMaxHw3DStaticBuffers', DWORD),
+ ('dwMaxHw3DStreamingBuffers', DWORD),
+ ('dwFreeHw3DAllBuffers', DWORD),
+ ('dwFreeHw3DStaticBuffers', DWORD),
+ ('dwFreeHw3DStreamingBuffers', DWORD),
+ ('dwTotalHwMemBytes', DWORD),
+ ('dwFreeHwMemBytes', DWORD),
+ ('dwMaxContigFreeHwMemBytes', DWORD),
+ ('dwUnlockTransferRateHwBuffers', DWORD),
+ ('dwPlayCpuOverheadSwBuffers', DWORD),
+ ('dwReserved1', DWORD),
+ ('dwReserved2', DWORD)
+ ]
+LPDSCAPS = ctypes.POINTER(DSCAPS)
+
+class DSBCAPS(ctypes.Structure):
+ _fields_ = [
+ ('dwSize', DWORD),
+ ('dwFlags', DWORD),
+ ('dwBufferBytes', DWORD),
+ ('dwUnlockTransferRate', DWORD),
+ ('dwPlayCpuOverhead', DWORD),
+ ]
+LPDSBCAPS = ctypes.POINTER(DSBCAPS)
+
+class DSBUFFERDESC(ctypes.Structure):
+ _fields_ = [
+ ('dwSize', DWORD),
+ ('dwFlags', DWORD),
+ ('dwBufferBytes', DWORD),
+ ('dwReserved', DWORD),
+ ('lpwfxFormat', LPWAVEFORMATEX),
+ ]
+
+ def __repr__(self):
+ return 'DSBUFFERDESC(dwSize={}, dwFlags={}, dwBufferBytes={}, lpwfxFormat={})'.format(
+ self.dwSize, self.dwFlags, self.dwBufferBytes,
+ self.lpwfxFormat.contents if self.lpwfxFormat else None)
+LPDSBUFFERDESC = ctypes.POINTER(DSBUFFERDESC)
+
+class DS3DBUFFER(ctypes.Structure):
+ _fields_ = [
+ ('dwSize', DWORD),
+ ('vPosition', D3DVECTOR),
+ ('vVelocity', D3DVECTOR),
+ ('dwInsideConeAngle', DWORD),
+ ('dwOutsideConeAngle', DWORD),
+ ('vConeOrientation', D3DVECTOR),
+ ('lConeOutsideVolume', LONG),
+ ('flMinDistance', D3DVALUE),
+ ('flMaxDistance', D3DVALUE),
+ ('dwMode', DWORD),
+ ]
+LPDS3DBUFFER = ctypes.POINTER(DS3DBUFFER)
+
+class DS3DLISTENER(ctypes.Structure):
+ _fields_ = [
+ ('dwSize', DWORD),
+ ('vPosition', D3DVECTOR),
+ ('vVelocity', D3DVECTOR),
+ ('vOrientFront', D3DVECTOR),
+ ('vOrientTop', D3DVECTOR),
+ ('flDistanceFactor', D3DVALUE),
+ ('flRolloffFactor', D3DVALUE),
+ ('flDopplerFactor', D3DVALUE),
+ ]
+LPDS3DLISTENER = ctypes.POINTER(DS3DLISTENER)
+
+class IDirectSoundBuffer(com.pIUnknown):
+ _methods_ = [
+ ('GetCaps',
+ com.STDMETHOD(LPDSBCAPS)),
+ ('GetCurrentPosition',
+ com.STDMETHOD(LPDWORD, LPDWORD)),
+ ('GetFormat',
+ com.STDMETHOD(LPWAVEFORMATEX, DWORD, LPDWORD)),
+ ('GetVolume',
+ com.STDMETHOD(LPLONG)),
+ ('GetPan',
+ com.STDMETHOD(LPLONG)),
+ ('GetFrequency',
+ com.STDMETHOD(LPDWORD)),
+ ('GetStatus',
+ com.STDMETHOD(LPDWORD)),
+ ('Initialize',
+ com.STDMETHOD(ctypes.c_void_p, LPDSBUFFERDESC)),
+ ('Lock',
+ com.STDMETHOD(DWORD, DWORD,
+ ctypes.POINTER(ctypes.c_void_p), LPDWORD,
+ ctypes.POINTER(ctypes.c_void_p), LPDWORD,
+ DWORD)),
+ ('Play',
+ com.STDMETHOD(DWORD, DWORD, DWORD)),
+ ('SetCurrentPosition',
+ com.STDMETHOD(DWORD)),
+ ('SetFormat',
+ com.STDMETHOD(LPWAVEFORMATEX)),
+ ('SetVolume',
+ com.STDMETHOD(LONG)),
+ ('SetPan',
+ com.STDMETHOD(LONG)),
+ ('SetFrequency',
+ com.STDMETHOD(DWORD)),
+ ('Stop',
+ com.STDMETHOD()),
+ ('Unlock',
+ com.STDMETHOD(ctypes.c_void_p, DWORD, ctypes.c_void_p, DWORD)),
+ ('Restore',
+ com.STDMETHOD()),
+ ]
+
+IID_IDirectSound3DListener = com.GUID(
+ 0x279AFA84, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60)
+
+class IDirectSound3DListener(com.pIUnknown):
+ _methods_ = [
+ ('GetAllParameters',
+ com.STDMETHOD(LPDS3DLISTENER)),
+ ('GetDistanceFactor',
+ com.STDMETHOD(PD3DVALUE)),
+ ('GetDopplerFactor',
+ com.STDMETHOD(PD3DVALUE)),
+ ('GetOrientation',
+ com.STDMETHOD(PD3DVECTOR, PD3DVECTOR)),
+ ('GetPosition',
+ com.STDMETHOD(PD3DVECTOR)),
+ ('GetRolloffFactor',
+ com.STDMETHOD(PD3DVALUE)),
+ ('GetVelocity',
+ com.STDMETHOD(PD3DVECTOR)),
+ ('SetAllParameters',
+ com.STDMETHOD(LPDS3DLISTENER)),
+ ('SetDistanceFactor',
+ com.STDMETHOD(D3DVALUE, DWORD)),
+ ('SetDopplerFactor',
+ com.STDMETHOD(D3DVALUE, DWORD)),
+ ('SetOrientation',
+ com.STDMETHOD(D3DVALUE, D3DVALUE, D3DVALUE,
+ D3DVALUE, D3DVALUE, D3DVALUE, DWORD)),
+ ('SetPosition',
+ com.STDMETHOD(D3DVALUE, D3DVALUE, D3DVALUE, DWORD)),
+ ('SetRolloffFactor',
+ com.STDMETHOD(D3DVALUE, DWORD)),
+ ('SetVelocity',
+ com.STDMETHOD(D3DVALUE, D3DVALUE, D3DVALUE, DWORD)),
+ ('CommitDeferredSettings',
+ com.STDMETHOD()),
+ ]
+
+IID_IDirectSound3DBuffer = com.GUID(
+ 0x279AFA86, 0x4981, 0x11CE, 0xA5, 0x21, 0x00, 0x20, 0xAF, 0x0B, 0xE5, 0x60)
+
+class IDirectSound3DBuffer(com.pIUnknown):
+ _methods_ = [
+ ('GetAllParameters',
+ com.STDMETHOD(LPDS3DBUFFER)),
+ ('GetConeAngles',
+ com.STDMETHOD(LPDWORD, LPDWORD)),
+ ('GetConeOrientation',
+ com.STDMETHOD(PD3DVECTOR)),
+ ('GetConeOutsideVolume',
+ com.STDMETHOD(LPLONG)),
+ ('GetMaxDistance',
+ com.STDMETHOD(PD3DVALUE)),
+ ('GetMinDistance',
+ com.STDMETHOD(PD3DVALUE)),
+ ('GetMode',
+ com.STDMETHOD(LPDWORD)),
+ ('GetPosition',
+ com.STDMETHOD(PD3DVECTOR)),
+ ('GetVelocity',
+ com.STDMETHOD(PD3DVECTOR)),
+ ('SetAllParameters',
+ com.STDMETHOD(LPDS3DBUFFER, DWORD)),
+ ('SetConeAngles',
+ com.STDMETHOD(DWORD, DWORD, DWORD)),
+ ('SetConeOrientation',
+ com.STDMETHOD(D3DVALUE, D3DVALUE, D3DVALUE, DWORD)),
+ ('SetConeOutsideVolume',
+ com.STDMETHOD(LONG, DWORD)),
+ ('SetMaxDistance',
+ com.STDMETHOD(D3DVALUE, DWORD)),
+ ('SetMinDistance',
+ com.STDMETHOD(D3DVALUE, DWORD)),
+ ('SetMode',
+ com.STDMETHOD(DWORD, DWORD)),
+ ('SetPosition',
+ com.STDMETHOD(D3DVALUE, D3DVALUE, D3DVALUE, DWORD)),
+ ('SetVelocity',
+ com.STDMETHOD(D3DVALUE, D3DVALUE, D3DVALUE, DWORD)),
+ ]
+
+class IDirectSound(com.pIUnknown):
+ _methods_ = [
+ ('CreateSoundBuffer',
+ com.STDMETHOD(LPDSBUFFERDESC,
+ ctypes.POINTER(IDirectSoundBuffer),
+ LPUNKNOWN)),
+ ('GetCaps',
+ com.STDMETHOD(LPDSCAPS)),
+ ('DuplicateSoundBuffer',
+ com.STDMETHOD(IDirectSoundBuffer,
+ ctypes.POINTER(IDirectSoundBuffer))),
+ ('SetCooperativeLevel',
+ com.STDMETHOD(HWND, DWORD)),
+ ('Compact',
+ com.STDMETHOD()),
+ ('GetSpeakerConfig',
+ com.STDMETHOD(LPDWORD)),
+ ('SetSpeakerConfig',
+ com.STDMETHOD(DWORD)),
+ ('Initialize',
+ com.STDMETHOD(com.LPGUID)),
+ ]
+ _type_ = com.COMInterface
+
+DirectSoundCreate = lib.DirectSoundCreate
+DirectSoundCreate.argtypes = \
+ [com.LPGUID, ctypes.POINTER(IDirectSound), ctypes.c_void_p]
+
+DSCAPS_PRIMARYMONO = 0x00000001
+DSCAPS_PRIMARYSTEREO = 0x00000002
+DSCAPS_PRIMARY8BIT = 0x00000004
+DSCAPS_PRIMARY16BIT = 0x00000008
+DSCAPS_CONTINUOUSRATE = 0x00000010
+DSCAPS_EMULDRIVER = 0x00000020
+DSCAPS_CERTIFIED = 0x00000040
+DSCAPS_SECONDARYMONO = 0x00000100
+DSCAPS_SECONDARYSTEREO = 0x00000200
+DSCAPS_SECONDARY8BIT = 0x00000400
+DSCAPS_SECONDARY16BIT = 0x00000800
+
+DSSCL_NORMAL = 0x00000001
+DSSCL_PRIORITY = 0x00000002
+DSSCL_EXCLUSIVE = 0x00000003
+DSSCL_WRITEPRIMARY = 0x00000004
+
+DSSPEAKER_DIRECTOUT = 0x00000000
+DSSPEAKER_HEADPHONE = 0x00000001
+DSSPEAKER_MONO = 0x00000002
+DSSPEAKER_QUAD = 0x00000003
+DSSPEAKER_STEREO = 0x00000004
+DSSPEAKER_SURROUND = 0x00000005
+DSSPEAKER_5POINT1 = 0x00000006
+DSSPEAKER_7POINT1 = 0x00000007
+
+DSSPEAKER_GEOMETRY_MIN = 0x00000005 # 5 degrees
+DSSPEAKER_GEOMETRY_NARROW = 0x0000000A # 10 degrees
+DSSPEAKER_GEOMETRY_WIDE = 0x00000014 # 20 degrees
+DSSPEAKER_GEOMETRY_MAX = 0x000000B4 # 180 degrees
+
+DSBCAPS_PRIMARYBUFFER = 0x00000001
+DSBCAPS_STATIC = 0x00000002
+DSBCAPS_LOCHARDWARE = 0x00000004
+DSBCAPS_LOCSOFTWARE = 0x00000008
+DSBCAPS_CTRL3D = 0x00000010
+DSBCAPS_CTRLFREQUENCY = 0x00000020
+DSBCAPS_CTRLPAN = 0x00000040
+DSBCAPS_CTRLVOLUME = 0x00000080
+DSBCAPS_CTRLPOSITIONNOTIFY = 0x00000100
+DSBCAPS_CTRLFX = 0x00000200
+DSBCAPS_STICKYFOCUS = 0x00004000
+DSBCAPS_GLOBALFOCUS = 0x00008000
+DSBCAPS_GETCURRENTPOSITION2 = 0x00010000
+DSBCAPS_MUTE3DATMAXDISTANCE = 0x00020000
+DSBCAPS_LOCDEFER = 0x00040000
+
+DSBPLAY_LOOPING = 0x00000001
+DSBPLAY_LOCHARDWARE = 0x00000002
+DSBPLAY_LOCSOFTWARE = 0x00000004
+DSBPLAY_TERMINATEBY_TIME = 0x00000008
+DSBPLAY_TERMINATEBY_DISTANCE = 0x000000010
+DSBPLAY_TERMINATEBY_PRIORITY = 0x000000020
+
+DSBSTATUS_PLAYING = 0x00000001
+DSBSTATUS_BUFFERLOST = 0x00000002
+DSBSTATUS_LOOPING = 0x00000004
+DSBSTATUS_LOCHARDWARE = 0x00000008
+DSBSTATUS_LOCSOFTWARE = 0x00000010
+DSBSTATUS_TERMINATED = 0x00000020
+
+DSBLOCK_FROMWRITECURSOR = 0x00000001
+DSBLOCK_ENTIREBUFFER = 0x00000002
+
+DSBFREQUENCY_MIN = 100
+DSBFREQUENCY_MAX = 100000
+DSBFREQUENCY_ORIGINAL = 0
+
+DSBPAN_LEFT = -10000
+DSBPAN_CENTER = 0
+DSBPAN_RIGHT = 10000
+
+DSBVOLUME_MIN = -10000
+DSBVOLUME_MAX = 0
+
+DSBSIZE_MIN = 4
+DSBSIZE_MAX = 0x0FFFFFFF
+DSBSIZE_FX_MIN = 150 # NOTE: Milliseconds, not bytes
+
+DS3DMODE_NORMAL = 0x00000000
+DS3DMODE_HEADRELATIVE = 0x00000001
+DS3DMODE_DISABLE = 0x00000002
+
+DS3D_IMMEDIATE = 0x00000000
+DS3D_DEFERRED = 0x00000001
+
+DS3D_MINDISTANCEFACTOR = -1000000.0 # XXX FLT_MIN
+DS3D_MAXDISTANCEFACTOR = 1000000.0 # XXX FLT_MAX
+DS3D_DEFAULTDISTANCEFACTOR = 1.0
+
+DS3D_MINROLLOFFFACTOR = 0.0
+DS3D_MAXROLLOFFFACTOR = 10.0
+DS3D_DEFAULTROLLOFFFACTOR = 1.0
+
+DS3D_MINDOPPLERFACTOR = 0.0
+DS3D_MAXDOPPLERFACTOR = 10.0
+DS3D_DEFAULTDOPPLERFACTOR = 1.0
+
+DS3D_DEFAULTMINDISTANCE = 1.0
+DS3D_DEFAULTMAXDISTANCE = 1000000000.0
+
+DS3D_MINCONEANGLE = 0
+DS3D_MAXCONEANGLE = 360
+DS3D_DEFAULTCONEANGLE = 360
+
+DS3D_DEFAULTCONEOUTSIDEVOLUME = DSBVOLUME_MAX
+
+# Return codes
+DS_OK = 0x00000000
+DSERR_OUTOFMEMORY = 0x00000007
+DSERR_NOINTERFACE = 0x000001AE
+DS_NO_VIRTUALIZATION = 0x0878000A
+DS_INCOMPLETE = 0x08780014
+DSERR_UNSUPPORTED = 0x80004001
+DSERR_GENERIC = 0x80004005
+DSERR_ACCESSDENIED = 0x80070005
+DSERR_INVALIDPARAM = 0x80070057
+DSERR_ALLOCATED = 0x8878000A
+DSERR_CONTROLUNAVAIL = 0x8878001E
+DSERR_INVALIDCALL = 0x88780032
+DSERR_PRIOLEVELNEEDED = 0x88780046
+DSERR_BADFORMAT = 0x88780064
+DSERR_NODRIVER = 0x88780078
+DSERR_ALREADYINITIALIZED = 0x88780082
+DSERR_BUFFERLOST = 0x88780096
+DSERR_OTHERAPPHASPRIO = 0x887800A0
+DSERR_UNINITALIZED = 0x887800AA
+DSERR_BUFFERTOOSMALL = 0x887810B4
+DSERR_DS8_REQUIRED = 0x887810BE
+DSERR_SENDLOOP = 0x887810C8
+DSERR_BADSENDBUFFERGUID = 0x887810D2
+DSERR_FXUNAVAILABLE = 0x887810DC
+DSERR_OBJECTNOTFOUND = 0x88781161
+
+# Buffer status
+DSBSTATUS_PLAYING = 0x00000001
+DSBSTATUS_BUFFERLOST = 0x00000002
+DSBSTATUS_LOOPING = 0x00000004
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/listener.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/listener.py
new file mode 100644
index 0000000000000000000000000000000000000000..ad60da8b0d5edfc3a51def8419d9a1527f30ce84
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/listener.py
@@ -0,0 +1,79 @@
+from abc import ABCMeta, abstractmethod
+
+from pyglet.util import with_metaclass
+
+
+class AbstractListener(with_metaclass(ABCMeta, object)):
+ """The listener properties for positional audio.
+
+ You can obtain the singleton instance of this class by calling
+ :meth:`AbstractAudioDriver.get_listener`.
+ """
+
+ _volume = 1.0
+ _position = (0, 0, 0)
+ _forward_orientation = (0, 0, -1)
+ _up_orientation = (0, 1, 0)
+
+ @abstractmethod
+ def _set_volume(self, volume):
+ pass
+
+ volume = property(lambda self: self._volume,
+ lambda self, volume: self._set_volume(volume),
+ doc="""The master volume for sound playback.
+
+ All sound volumes are multiplied by this master volume before being
+ played. A value of 0 will silence playback (but still consume
+ resources). The nominal volume is 1.0.
+
+ :type: float
+ """)
+
+ @abstractmethod
+ def _set_position(self, position):
+ pass
+
+ position = property(lambda self: self._position,
+ lambda self, position: self._set_position(position),
+ doc="""The position of the listener in 3D space.
+
+ The position is given as a tuple of floats (x, y, z). The unit
+ defaults to meters, but can be modified with the listener
+ properties.
+
+ :type: 3-tuple of float
+ """)
+
+ @abstractmethod
+ def _set_forward_orientation(self, orientation):
+ pass
+
+ forward_orientation = property(lambda self: self._forward_orientation,
+ lambda self, o: self._set_forward_orientation(o),
+ doc="""A vector giving the direction the
+ listener is facing.
+
+ The orientation is given as a tuple of floats (x, y, z), and has
+ no unit. The forward orientation should be orthagonal to the
+ up orientation.
+
+ :type: 3-tuple of float
+ """)
+
+ @abstractmethod
+ def _set_up_orientation(self, orientation):
+ pass
+
+ up_orientation = property(lambda self: self._up_orientation,
+ lambda self, o: self._set_up_orientation(o),
+ doc="""A vector giving the "up" orientation
+ of the listener.
+
+ The orientation is given as a tuple of floats (x, y, z), and has
+ no unit. The up orientation should be orthagonal to the
+ forward orientation.
+
+ :type: 3-tuple of float
+ """)
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e149c8407e8692f3c57bcab7cd12a507567fb0d3
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/__init__.py
@@ -0,0 +1,13 @@
+from .adaptation import OpenALDriver
+
+import pyglet
+
+_debug = pyglet.options['debug_media']
+_debug_buffers = pyglet.options.get('debug_media_buffers', False)
+
+
+def create_audio_driver(device_name=None):
+ _driver = OpenALDriver(device_name)
+ if _debug:
+ print('OpenAL', _driver.get_version())
+ return _driver
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/adaptation.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/adaptation.py
new file mode 100644
index 0000000000000000000000000000000000000000..0c70ce1235cfd978e4d85e5e8f67704b7b993ff4
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/adaptation.py
@@ -0,0 +1,366 @@
+import weakref
+
+from . import interface
+from pyglet.util import debug_print
+from pyglet.media.drivers.base import AbstractAudioDriver, AbstractAudioPlayer, MediaEvent
+from pyglet.media.mediathreads import PlayerWorkerThread
+from pyglet.media.drivers.listener import AbstractListener
+
+_debug = debug_print('debug_media')
+
+
+class OpenALDriver(AbstractAudioDriver):
+ def __init__(self, device_name=None):
+ super().__init__()
+
+ self.device = interface.OpenALDevice(device_name)
+ self.context = self.device.create_context()
+ self.context.make_current()
+
+ self._listener = OpenALListener(self)
+
+ self.worker = PlayerWorkerThread()
+ self.worker.start()
+
+ def __del__(self):
+ assert _debug("Delete OpenALDriver")
+ self.delete()
+
+ def create_audio_player(self, source, player):
+ assert self.device is not None, "Device was closed"
+ return OpenALAudioPlayer(self, source, player)
+
+ def delete(self):
+ self.worker.stop()
+ self.context = None
+
+ def have_version(self, major, minor):
+ return (major, minor) <= self.get_version()
+
+ def get_version(self):
+ assert self.device is not None, "Device was closed"
+ return self.device.get_version()
+
+ def get_extensions(self):
+ assert self.device is not None, "Device was closed"
+ return self.device.get_extensions()
+
+ def have_extension(self, extension):
+ return extension in self.get_extensions()
+
+ def get_listener(self):
+ return self._listener
+
+
+class OpenALListener(AbstractListener):
+ def __init__(self, driver):
+ self._driver = weakref.proxy(driver)
+ self._al_listener = interface.OpenALListener()
+
+ def __del__(self):
+ assert _debug("Delete OpenALListener")
+
+ def _set_volume(self, volume):
+ self._al_listener.gain = volume
+ self._volume = volume
+
+ def _set_position(self, position):
+ self._al_listener.position = position
+ self._position = position
+
+ def _set_forward_orientation(self, orientation):
+ self._al_listener.orientation = orientation + self._up_orientation
+ self._forward_orientation = orientation
+
+ def _set_up_orientation(self, orientation):
+ self._al_listener.orientation = self._forward_orientation + orientation
+ self._up_orientation = orientation
+
+
+class OpenALAudioPlayer(AbstractAudioPlayer):
+ #: Minimum size of an OpenAL buffer worth bothering with, in bytes
+ min_buffer_size = 512
+
+ #: Aggregate (desired) buffer size, in seconds
+ _ideal_buffer_size = 1.0
+
+ def __init__(self, driver, source, player):
+ super(OpenALAudioPlayer, self).__init__(source, player)
+ self.driver = driver
+ self.alsource = driver.context.create_source()
+
+ # Cursor positions, like DSound and Pulse drivers, refer to a
+ # hypothetical infinite-length buffer. Cursor units are in bytes.
+
+ # Cursor position of current (head) AL buffer
+ self._buffer_cursor = 0
+
+ # Estimated playback cursor position (last seen)
+ self._play_cursor = 0
+
+ # Cursor position of end of queued AL buffer.
+ self._write_cursor = 0
+
+ # List of currently queued buffer sizes (in bytes)
+ self._buffer_sizes = []
+
+ # List of currently queued buffer timestamps
+ self._buffer_timestamps = []
+
+ # Timestamp at end of last written buffer (timestamp to return in case
+ # of underrun)
+ self._underrun_timestamp = None
+
+ # List of (cursor, MediaEvent)
+ self._events = []
+
+ # Desired play state (True even if stopped due to underrun)
+ self._playing = False
+
+ # When clearing, the play cursor can be incorrect
+ self._clearing = False
+
+ # Up to one audio data may be buffered if too much data was received
+ # from the source that could not be written immediately into the
+ # buffer. See _refill().
+ self._audiodata_buffer = None
+
+ self._refill(self.ideal_buffer_size)
+
+ def __del__(self):
+ self.delete()
+
+ def delete(self):
+ self.driver.worker.remove(self)
+ self.alsource = None
+
+ @property
+ def ideal_buffer_size(self):
+ return int(self._ideal_buffer_size * self.source.audio_format.bytes_per_second)
+
+ def play(self):
+ assert _debug('OpenALAudioPlayer.play()')
+
+ assert self.driver is not None
+ assert self.alsource is not None
+
+ if not self.alsource.is_playing:
+ self.alsource.play()
+ self._playing = True
+ self._clearing = False
+
+ self.driver.worker.add(self)
+
+ def stop(self):
+ self.driver.worker.remove(self)
+ assert _debug('OpenALAudioPlayer.stop()')
+ assert self.driver is not None
+ assert self.alsource is not None
+ self.alsource.pause()
+ self._playing = False
+
+ def clear(self):
+ assert _debug('OpenALAudioPlayer.clear()')
+
+ assert self.driver is not None
+ assert self.alsource is not None
+
+ super().clear()
+ self.alsource.stop()
+ self._handle_processed_buffers()
+ self.alsource.clear()
+ self.alsource.byte_offset = 0
+ self._playing = False
+ self._clearing = True
+ self._audiodata_buffer = None
+
+ self._buffer_cursor = 0
+ self._play_cursor = 0
+ self._write_cursor = 0
+ del self._events[:]
+ del self._buffer_sizes[:]
+ del self._buffer_timestamps[:]
+
+ def _update_play_cursor(self):
+ assert self.driver is not None
+ assert self.alsource is not None
+
+ self._handle_processed_buffers()
+
+ # Update play cursor using buffer cursor + estimate into current buffer
+ if self._clearing:
+ self._play_cursor = self._buffer_cursor
+ else:
+ self._play_cursor = self._buffer_cursor + self.alsource.byte_offset
+ assert self._check_cursors()
+
+ self._dispatch_events()
+
+ def _handle_processed_buffers(self):
+ processed = self.alsource.unqueue_buffers()
+
+ if processed > 0:
+ if (len(self._buffer_timestamps) == processed
+ and self._buffer_timestamps[-1] is not None):
+ assert _debug('OpenALAudioPlayer: Underrun')
+ # Underrun, take note of timestamp.
+ # We check that the timestamp is not None, because otherwise
+ # our source could have been cleared.
+ self._underrun_timestamp = self._buffer_timestamps[-1] + \
+ self._buffer_sizes[-1] / float(self.source.audio_format.bytes_per_second)
+ self._update_buffer_cursor(processed)
+
+ return processed
+
+ def _update_buffer_cursor(self, processed):
+ self._buffer_cursor += sum(self._buffer_sizes[:processed])
+ del self._buffer_sizes[:processed]
+ del self._buffer_timestamps[:processed]
+
+ def _dispatch_events(self):
+ while self._events and self._events[0][0] <= self._play_cursor:
+ _, event = self._events.pop(0)
+ event._sync_dispatch_to_player(self.player)
+
+ def _get_write_size(self):
+ self._update_play_cursor()
+ buffer_size = int(self._write_cursor - self._play_cursor)
+
+ # Only write when current buffer size is smaller than ideal
+ write_size = max(self.ideal_buffer_size - buffer_size, 0)
+
+ assert _debug("Write size {} bytes".format(write_size))
+ return write_size
+
+ def refill_buffer(self):
+ write_size = self._get_write_size()
+ if write_size > self.min_buffer_size:
+ self._refill(write_size)
+ return True
+ return False
+
+ def _refill(self, write_size):
+ assert _debug('_refill', write_size)
+
+ while write_size > self.min_buffer_size:
+ audio_data = self._get_audiodata()
+
+ if audio_data is None:
+ break
+
+ length = min(write_size, audio_data.length)
+ if length == 0:
+ assert _debug('Empty AudioData. Discard it.')
+
+ else:
+ assert _debug('Writing {} bytes'.format(length))
+ self._queue_audio_data(audio_data, length)
+ write_size -= length
+
+ # Check for underrun stopping playback
+ if self._playing and not self.alsource.is_playing:
+ assert _debug('underrun')
+ self.alsource.play()
+
+ def _get_audiodata(self):
+ if self._audiodata_buffer is None or self._audiodata_buffer.length == 0:
+ self._get_new_audiodata()
+
+ return self._audiodata_buffer
+
+ def _get_new_audiodata(self):
+ assert _debug('Getting new audio data buffer.')
+ compensation_time = self.get_audio_time_diff()
+ self._audiodata_buffer= self.source.get_audio_data(self.ideal_buffer_size, compensation_time)
+
+ if self._audiodata_buffer is not None:
+ assert _debug('New audio data available: {} bytes'.format(self._audiodata_buffer.length))
+ self._queue_events(self._audiodata_buffer)
+ else:
+ assert _debug('No audio data left')
+ if self._has_underrun():
+ assert _debug('Underrun')
+ MediaEvent('on_eos').sync_dispatch_to_player(self.player)
+
+ def _queue_audio_data(self, audio_data, length):
+ buf = self.alsource.get_buffer()
+ buf.data(audio_data, self.source.audio_format, length)
+ self.alsource.queue_buffer(buf)
+ self._update_write_cursor(audio_data, length)
+
+ def _update_write_cursor(self, audio_data, length):
+ self._write_cursor += length
+ self._buffer_sizes.append(length)
+ self._buffer_timestamps.append(audio_data.timestamp)
+ audio_data.consume(length, self.source.audio_format)
+ assert self._check_cursors()
+
+ def _queue_events(self, audio_data):
+ for event in audio_data.events:
+ cursor = self._write_cursor + event.timestamp * \
+ self.source.audio_format.bytes_per_second
+ self._events.append((cursor, event))
+
+ def _has_underrun(self):
+ return self.alsource.buffers_queued == 0
+
+ def get_time(self):
+ # Update first, might remove buffers
+ self._update_play_cursor()
+
+ if not self._buffer_timestamps:
+ timestamp = self._underrun_timestamp
+ assert _debug('OpenALAudioPlayer: Return underrun timestamp')
+ else:
+ timestamp = self._buffer_timestamps[0]
+ assert _debug('OpenALAudioPlayer: Buffer timestamp: {}'.format(timestamp))
+
+ if timestamp is not None:
+ timestamp += ((self._play_cursor - self._buffer_cursor) /
+ float(self.source.audio_format.bytes_per_second))
+
+ assert _debug('OpenALAudioPlayer: get_time = {}'.format(timestamp))
+
+ return timestamp
+
+ def _check_cursors(self):
+ assert self._play_cursor >= 0
+ assert self._buffer_cursor >= 0
+ assert self._write_cursor >= 0
+ assert self._buffer_cursor <= self._play_cursor
+ assert self._play_cursor <= self._write_cursor
+ assert _debug('Buffer[{}], Play[{}], Write[{}]'.format(self._buffer_cursor,
+ self._play_cursor,
+ self._write_cursor))
+ return True # Return true so it can be called in an assert (and optimized out)
+
+ def set_volume(self, volume):
+ self.alsource.gain = volume
+
+ def set_position(self, position):
+ self.alsource.position = position
+
+ def set_min_distance(self, min_distance):
+ self.alsource.reference_distance = min_distance
+
+ def set_max_distance(self, max_distance):
+ self.alsource.max_distance = max_distance
+
+ def set_pitch(self, pitch):
+ self.alsource.pitch = pitch
+
+ def set_cone_orientation(self, cone_orientation):
+ self.alsource.direction = cone_orientation
+
+ def set_cone_inner_angle(self, cone_inner_angle):
+ self.alsource.cone_inner_angle = cone_inner_angle
+
+ def set_cone_outer_angle(self, cone_outer_angle):
+ self.alsource.cone_outer_angle = cone_outer_angle
+
+ def set_cone_outer_gain(self, cone_outer_gain):
+ self.alsource.cone_outer_gain = cone_outer_gain
+
+ def prefill_audio(self):
+ write_size = self._get_write_size()
+ self._refill(write_size)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/interface.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/interface.py
new file mode 100644
index 0000000000000000000000000000000000000000..15a650373f8df3a83b0aae56ef05c670b7d42b5a
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/interface.py
@@ -0,0 +1,500 @@
+import ctypes
+import weakref
+from collections import namedtuple
+
+from . import lib_openal as al
+from . import lib_alc as alc
+
+from pyglet.util import debug_print
+from pyglet.media.exceptions import MediaException
+
+_debug = debug_print('debug_media')
+
+
+class OpenALException(MediaException):
+ def __init__(self, message=None, error_code=None, error_string=None):
+ self.message = message
+ self.error_code = error_code
+ self.error_string = error_string
+
+ def __str__(self):
+ if self.error_code is None:
+ return f'OpenAL Exception: {self.message}'
+ else:
+ return f'OpenAL Exception [{self.error_code}: {self.error_string}]: {self.message}'
+
+
+class OpenALObject:
+ """Base class for OpenAL objects."""
+ @classmethod
+ def _check_error(cls, message=None):
+ """Check whether there is an OpenAL error and raise exception if present."""
+ error_code = al.alGetError()
+ if error_code != 0:
+ error_string = al.alGetString(error_code)
+ # TODO: Fix return type in generated code?
+ error_string = ctypes.cast(error_string, ctypes.c_char_p)
+ raise OpenALException(message=message,
+ error_code=error_code,
+ error_string=str(error_string.value))
+
+ @classmethod
+ def _raise_error(cls, message):
+ """Raise an exception. Try to check for OpenAL error code too."""
+ cls._check_error(message)
+ raise OpenALException(message)
+
+
+class OpenALDevice(OpenALObject):
+ """OpenAL audio device."""
+ def __init__(self, device_name=None):
+ self._al_device = alc.alcOpenDevice(device_name)
+ self.check_context_error('Failed to open device.')
+ if self._al_device is None:
+ raise OpenALException('No OpenAL devices.')
+
+ def __del__(self):
+ assert _debug("Delete interface.OpenALDevice")
+ self.delete()
+
+ def delete(self):
+ if self._al_device is not None:
+ if alc.alcCloseDevice(self._al_device) == alc.ALC_FALSE:
+ self._raise_context_error('Failed to close device.')
+ self._al_device = None
+
+ @property
+ def is_ready(self):
+ return self._al_device is not None
+
+ def create_context(self):
+ al_context = alc.alcCreateContext(self._al_device, None)
+ self.check_context_error('Failed to create context')
+ return OpenALContext(self, al_context)
+
+ def get_version(self):
+ major = alc.ALCint()
+ minor = alc.ALCint()
+ alc.alcGetIntegerv(self._al_device, alc.ALC_MAJOR_VERSION,
+ ctypes.sizeof(major), major)
+ self.check_context_error('Failed to get version.')
+ alc.alcGetIntegerv(self._al_device, alc.ALC_MINOR_VERSION,
+ ctypes.sizeof(minor), minor)
+ self.check_context_error('Failed to get version.')
+ return major.value, minor.value
+
+ def get_extensions(self):
+ extensions = alc.alcGetString(self._al_device, alc.ALC_EXTENSIONS)
+ self.check_context_error('Failed to get extensions.')
+ return ctypes.cast(extensions, ctypes.c_char_p).value.decode('ascii').split()
+
+ def check_context_error(self, message=None):
+ """Check whether there is an OpenAL error and raise exception if present."""
+ error_code = alc.alcGetError(self._al_device)
+ if error_code != 0:
+ error_string = alc.alcGetString(self._al_device, error_code)
+ # TODO: Fix return type in generated code?
+ error_string = ctypes.cast(error_string, ctypes.c_char_p)
+ raise OpenALException(message=message,
+ error_code=error_code,
+ error_string=str(error_string.value))
+
+ def _raise_context_error(self, message):
+ """Raise an exception. Try to check for OpenAL error code too."""
+ self.check_context_error(message)
+ raise OpenALException(message)
+
+
+class OpenALContext(OpenALObject):
+ def __init__(self, device, al_context):
+ self.device = device
+ self._al_context = al_context
+ self.make_current()
+
+ def __del__(self):
+ assert _debug("Delete interface.OpenALContext")
+ self.delete()
+
+ def delete(self):
+ if self._al_context is not None:
+ # TODO: Check if this context is current
+ alc.alcMakeContextCurrent(None)
+ self.device.check_context_error('Failed to make context no longer current.')
+ alc.alcDestroyContext(self._al_context)
+ self.device.check_context_error('Failed to destroy context.')
+ self._al_context = None
+
+ def make_current(self):
+ alc.alcMakeContextCurrent(self._al_context)
+ self.device.check_context_error('Failed to make context current.')
+
+ def create_source(self):
+ self.make_current()
+ return OpenALSource(self)
+
+
+class OpenALSource(OpenALObject):
+ def __init__(self, context):
+ self.context = weakref.ref(context)
+ self.buffer_pool = OpenALBufferPool(self.context)
+
+ self._al_source = al.ALuint()
+ al.alGenSources(1, self._al_source)
+ self._check_error('Failed to create source.')
+
+ self._state = None
+ self._get_state()
+
+ self._owned_buffers = {}
+
+ def __del__(self):
+ assert _debug("Delete interface.OpenALSource")
+ self.delete()
+
+ def delete(self):
+ if self.context() and self._al_source is not None:
+ # Only delete source if the context still exists
+ al.alDeleteSources(1, self._al_source)
+ self._check_error('Failed to delete source.')
+ self.buffer_pool.clear()
+ self._al_source = None
+
+ @property
+ def is_initial(self):
+ self._get_state()
+ return self._state == al.AL_INITIAL
+
+ @property
+ def is_playing(self):
+ self._get_state()
+ return self._state == al.AL_PLAYING
+
+ @property
+ def is_paused(self):
+ self._get_state()
+ return self._state == al.AL_PAUSED
+
+ @property
+ def is_stopped(self):
+ self._get_state()
+ return self._state == al.AL_STOPPED
+
+ def _int_source_property(attribute):
+ return property(lambda self: self._get_int(attribute),
+ lambda self, value: self._set_int(attribute, value))
+
+ def _float_source_property(attribute):
+ return property(lambda self: self._get_float(attribute),
+ lambda self, value: self._set_float(attribute, value))
+
+ def _3floats_source_property(attribute):
+ return property(lambda self: self._get_3floats(attribute),
+ lambda self, value: self._set_3floats(attribute, value))
+
+ position = _3floats_source_property(al.AL_POSITION)
+ velocity = _3floats_source_property(al.AL_VELOCITY)
+ gain = _float_source_property(al.AL_GAIN)
+ buffers_queued = _int_source_property(al.AL_BUFFERS_QUEUED)
+ buffers_processed = _int_source_property(al.AL_BUFFERS_PROCESSED)
+ min_gain = _float_source_property(al.AL_MIN_GAIN)
+ max_gain = _float_source_property(al.AL_MAX_GAIN)
+ reference_distance = _float_source_property(al.AL_REFERENCE_DISTANCE)
+ rolloff_factor = _float_source_property(al.AL_ROLLOFF_FACTOR)
+ pitch = _float_source_property(al.AL_PITCH)
+ max_distance = _float_source_property(al.AL_MAX_DISTANCE)
+ direction = _3floats_source_property(al.AL_DIRECTION)
+ cone_inner_angle = _float_source_property(al.AL_CONE_INNER_ANGLE)
+ cone_outer_angle = _float_source_property(al.AL_CONE_OUTER_ANGLE)
+ cone_outer_gain = _float_source_property(al.AL_CONE_OUTER_GAIN)
+ sec_offset = _float_source_property(al.AL_SEC_OFFSET)
+ sample_offset = _float_source_property(al.AL_SAMPLE_OFFSET)
+ byte_offset = _float_source_property(al.AL_BYTE_OFFSET)
+
+ del _int_source_property
+ del _float_source_property
+ del _3floats_source_property
+
+ def play(self):
+ al.alSourcePlay(self._al_source)
+ self._check_error('Failed to play source.')
+
+ def pause(self):
+ al.alSourcePause(self._al_source)
+ self._check_error('Failed to pause source.')
+
+ def stop(self):
+ al.alSourceStop(self._al_source)
+ self._check_error('Failed to stop source.')
+
+ def clear(self):
+ self._set_int(al.AL_BUFFER, al.AL_NONE)
+ while self._owned_buffers:
+ buf_name, buf = self._owned_buffers.popitem()
+ self.buffer_pool.unqueue_buffer(buf)
+
+ def get_buffer(self):
+ return self.buffer_pool.get_buffer()
+
+ def queue_buffer(self, buf):
+ assert buf.is_valid
+ al.alSourceQueueBuffers(self._al_source, 1, ctypes.byref(buf.al_buffer))
+ self._check_error('Failed to queue buffer.')
+ self._add_buffer(buf)
+
+ def unqueue_buffers(self):
+ processed = self.buffers_processed
+ assert _debug("Processed buffer count: {}".format(processed))
+ if processed > 0:
+ buffers = (al.ALuint * processed)()
+ al.alSourceUnqueueBuffers(self._al_source, len(buffers), buffers)
+ self._check_error('Failed to unqueue buffers from source.')
+ for buf in buffers:
+ self.buffer_pool.unqueue_buffer(self._pop_buffer(buf))
+ return processed
+
+ def _get_state(self):
+ if self._al_source is not None:
+ self._state = self._get_int(al.AL_SOURCE_STATE)
+
+ def _get_int(self, key):
+ assert self._al_source is not None
+ al_int = al.ALint()
+ al.alGetSourcei(self._al_source, key, al_int)
+ self._check_error('Failed to get value')
+ return al_int.value
+
+ def _set_int(self, key, value):
+ assert self._al_source is not None
+ al.alSourcei(self._al_source, key, int(value))
+ self._check_error('Failed to set value.')
+
+ def _get_float(self, key):
+ assert self._al_source is not None
+ al_float = al.ALfloat()
+ al.alGetSourcef(self._al_source, key, al_float)
+ self._check_error('Failed to get value')
+ return al_float.value
+
+ def _set_float(self, key, value):
+ assert self._al_source is not None
+ al.alSourcef(self._al_source, key, float(value))
+ self._check_error('Failed to set value.')
+
+ def _get_3floats(self, key):
+ assert self._al_source is not None
+ x = al.ALfloat()
+ y = al.ALfloat()
+ z = al.ALfloat()
+ al.alGetSource3f(self._al_source, key, x, y, z)
+ self._check_error('Failed to get value')
+ return x.value, y.value, z.value
+
+ def _set_3floats(self, key, values):
+ assert self._al_source is not None
+ x, y, z = map(float, values)
+ al.alSource3f(self._al_source, key, x, y, z)
+ self._check_error('Failed to set value.')
+
+ def _add_buffer(self, buf):
+ self._owned_buffers[buf.name] = buf
+
+ def _pop_buffer(self, al_buffer):
+ buf = self._owned_buffers.pop(al_buffer, None)
+ assert buf is not None
+ return buf
+
+
+OpenALOrientation = namedtuple("OpenALOrientation", ['at', 'up'])
+
+
+class OpenALListener(OpenALObject):
+ @property
+ def position(self):
+ return self._get_3floats(al.AL_POSITION)
+
+ @position.setter
+ def position(self, values):
+ self._set_3floats(al.AL_POSITION, values)
+
+ @property
+ def velocity(self):
+ return self._get_3floats(al.AL_VELOCITY)
+
+ @velocity.setter
+ def velocity(self, values):
+ self._set_3floats(al.AL_VELOCITY, values)
+
+ @property
+ def gain(self):
+ return self._get_float(al.AL_GAIN)
+
+ @gain.setter
+ def gain(self, value):
+ self._set_float(al.AL_GAIN, value)
+
+ @property
+ def orientation(self):
+ values = self._get_float_vector(al.AL_ORIENTATION, 6)
+ return OpenALOrientation(values[0:3], values[3:6])
+
+ @orientation.setter
+ def orientation(self, values):
+ if len(values) == 2:
+ actual_values = values[0] + values[1]
+ elif len(values) == 6:
+ actual_values = values
+ else:
+ actual_values = []
+ if len(actual_values) != 6:
+ raise ValueError("Need 2 tuples of 3 or 1 tuple of 6.")
+ self._set_float_vector(al.AL_ORIENTATION, actual_values)
+
+ def _get_float(self, key):
+ al_float = al.ALfloat()
+ al.alGetListenerf(key, al_float)
+ self._check_error('Failed to get value')
+ return al_float.value
+
+ def _set_float(self, key, value):
+ al.alListenerf(key, float(value))
+ self._check_error('Failed to set value.')
+
+ def _get_3floats(self, key):
+ x = al.ALfloat()
+ y = al.ALfloat()
+ z = al.ALfloat()
+ al.alGetListener3f(key, x, y, z)
+ self._check_error('Failed to get value')
+ return x.value, y.value, z.value
+
+ def _set_3floats(self, key, values):
+ x, y, z = map(float, values)
+ al.alListener3f(key, x, y, z)
+ self._check_error('Failed to set value.')
+
+ def _get_float_vector(self, key, count):
+ al_float_vector = (al.ALfloat * count)()
+ al.alGetListenerfv(key, al_float_vector)
+ self._check_error('Failed to get value')
+ return [x for x in al_float_vector]
+
+ def _set_float_vector(self, key, values):
+ al_float_vector = (al.ALfloat * len(values))(*values)
+ al.alListenerfv(key, al_float_vector)
+ self._check_error('Failed to set value.')
+
+
+class OpenALBuffer(OpenALObject):
+ _format_map = {
+ (1, 8): al.AL_FORMAT_MONO8,
+ (1, 16): al.AL_FORMAT_MONO16,
+ (2, 8): al.AL_FORMAT_STEREO8,
+ (2, 16): al.AL_FORMAT_STEREO16,
+ }
+
+ def __init__(self, al_buffer, context):
+ self._al_buffer = al_buffer
+ self.context = context
+ assert self.is_valid
+
+ def __del__(self):
+ assert _debug("Delete interface.OpenALBuffer")
+ self.delete()
+
+ @property
+ def is_valid(self):
+ self._check_error('Before validate buffer.')
+ if self._al_buffer is None:
+ return False
+ valid = bool(al.alIsBuffer(self._al_buffer))
+ if not valid:
+ # Clear possible error due to invalid buffer
+ al.alGetError()
+ return valid
+
+ @property
+ def al_buffer(self):
+ assert self.is_valid
+ return self._al_buffer
+
+ @property
+ def name(self):
+ assert self.is_valid
+ return self._al_buffer.value
+
+ def delete(self):
+ if self._al_buffer is not None and self.context() and self.is_valid:
+ al.alDeleteBuffers(1, ctypes.byref(self._al_buffer))
+ self._check_error('Error deleting buffer.')
+ self._al_buffer = None
+
+ def data(self, audio_data, audio_format, length=None):
+ assert self.is_valid
+ length = length or audio_data.length
+
+ try:
+ al_format = self._format_map[(audio_format.channels, audio_format.sample_size)]
+ except KeyError:
+ raise MediaException(f"OpenAL does not support '{audio_format.sample_size}bit' audio.")
+
+ al.alBufferData(self._al_buffer,
+ al_format,
+ audio_data.data,
+ length,
+ audio_format.sample_rate)
+ self._check_error('Failed to add data to buffer.')
+
+
+class OpenALBufferPool(OpenALObject):
+ """At least Mac OS X doesn't free buffers when a source is deleted; it just
+ detaches them from the source. So keep our own recycled queue.
+ """
+ def __init__(self, context):
+ self.context = context
+ self._buffers = [] # list of free buffer names
+
+ def __del__(self):
+ assert _debug("Delete interface.OpenALBufferPool")
+ self.clear()
+
+ def __len__(self):
+ return len(self._buffers)
+
+ def clear(self):
+ while self._buffers:
+ self._buffers.pop().delete()
+
+ def get_buffer(self):
+ """Convenience for returning one buffer name"""
+ return self.get_buffers(1)[0]
+
+ def get_buffers(self, number):
+ """Returns an array containing `number` buffer names. The returned list must
+ not be modified in any way, and may get changed by subsequent calls to
+ get_buffers.
+ """
+ buffers = []
+ while number > 0:
+ if self._buffers:
+ b = self._buffers.pop()
+ else:
+ b = self._create_buffer()
+ if b.is_valid:
+ # Protect against implementations that DO free buffers
+ # when they delete a source - carry on.
+ buffers.append(b)
+ number -= 1
+
+ return buffers
+
+ def unqueue_buffer(self, buf):
+ """A buffer has finished playing, free it."""
+ if buf.is_valid:
+ self._buffers.append(buf)
+
+ def _create_buffer(self):
+ """Create a new buffer."""
+ al_buffer = al.ALuint()
+ al.alGenBuffers(1, al_buffer)
+ self._check_error('Error allocating buffer.')
+ return OpenALBuffer(al_buffer, self.context)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/lib_alc.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/lib_alc.py
new file mode 100644
index 0000000000000000000000000000000000000000..cd57159270d86f4e389ec9c70f7ea4714207ee1f
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/lib_alc.py
@@ -0,0 +1,264 @@
+"""Wrapper for openal
+
+Generated with:
+../tools/wraptypes/wrap.py /usr/include/AL/alc.h -lopenal -olib_alc.py
+
+.. Hacked to fix ALCvoid argtypes.
+"""
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('openal',
+ win32='openal32',
+ framework='OpenAL')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+ALC_API = 0 # /usr/include/AL/alc.h:19
+ALCAPI = 0 # /usr/include/AL/alc.h:37
+ALC_INVALID = 0 # /usr/include/AL/alc.h:39
+ALC_VERSION_0_1 = 1 # /usr/include/AL/alc.h:42
+
+
+class struct_ALCdevice_struct(Structure):
+ __slots__ = [
+ ]
+
+
+struct_ALCdevice_struct._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_ALCdevice_struct(Structure):
+ __slots__ = [
+ ]
+
+
+struct_ALCdevice_struct._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+ALCdevice = struct_ALCdevice_struct # /usr/include/AL/alc.h:44
+
+
+class struct_ALCcontext_struct(Structure):
+ __slots__ = [
+ ]
+
+
+struct_ALCcontext_struct._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_ALCcontext_struct(Structure):
+ __slots__ = [
+ ]
+
+
+struct_ALCcontext_struct._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+ALCcontext = struct_ALCcontext_struct # /usr/include/AL/alc.h:45
+ALCboolean = c_char # /usr/include/AL/alc.h:49
+ALCchar = c_char # /usr/include/AL/alc.h:52
+ALCbyte = c_char # /usr/include/AL/alc.h:55
+ALCubyte = c_ubyte # /usr/include/AL/alc.h:58
+ALCshort = c_short # /usr/include/AL/alc.h:61
+ALCushort = c_ushort # /usr/include/AL/alc.h:64
+ALCint = c_int # /usr/include/AL/alc.h:67
+ALCuint = c_uint # /usr/include/AL/alc.h:70
+ALCsizei = c_int # /usr/include/AL/alc.h:73
+ALCenum = c_int # /usr/include/AL/alc.h:76
+ALCfloat = c_float # /usr/include/AL/alc.h:79
+ALCdouble = c_double # /usr/include/AL/alc.h:82
+ALCvoid = None # /usr/include/AL/alc.h:85
+ALC_FALSE = 0 # /usr/include/AL/alc.h:91
+ALC_TRUE = 1 # /usr/include/AL/alc.h:94
+ALC_FREQUENCY = 4103 # /usr/include/AL/alc.h:99
+ALC_REFRESH = 4104 # /usr/include/AL/alc.h:104
+ALC_SYNC = 4105 # /usr/include/AL/alc.h:109
+ALC_MONO_SOURCES = 4112 # /usr/include/AL/alc.h:114
+ALC_STEREO_SOURCES = 4113 # /usr/include/AL/alc.h:119
+ALC_NO_ERROR = 0 # /usr/include/AL/alc.h:128
+ALC_INVALID_DEVICE = 40961 # /usr/include/AL/alc.h:133
+ALC_INVALID_CONTEXT = 40962 # /usr/include/AL/alc.h:138
+ALC_INVALID_ENUM = 40963 # /usr/include/AL/alc.h:143
+ALC_INVALID_VALUE = 40964 # /usr/include/AL/alc.h:148
+ALC_OUT_OF_MEMORY = 40965 # /usr/include/AL/alc.h:153
+ALC_DEFAULT_DEVICE_SPECIFIER = 4100 # /usr/include/AL/alc.h:159
+ALC_DEVICE_SPECIFIER = 4101 # /usr/include/AL/alc.h:160
+ALC_EXTENSIONS = 4102 # /usr/include/AL/alc.h:161
+ALC_MAJOR_VERSION = 4096 # /usr/include/AL/alc.h:163
+ALC_MINOR_VERSION = 4097 # /usr/include/AL/alc.h:164
+ALC_ATTRIBUTES_SIZE = 4098 # /usr/include/AL/alc.h:166
+ALC_ALL_ATTRIBUTES = 4099 # /usr/include/AL/alc.h:167
+ALC_CAPTURE_DEVICE_SPECIFIER = 784 # /usr/include/AL/alc.h:172
+ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER = 785 # /usr/include/AL/alc.h:173
+ALC_CAPTURE_SAMPLES = 786 # /usr/include/AL/alc.h:174
+# /usr/include/AL/alc.h:180
+alcCreateContext = _lib.alcCreateContext
+alcCreateContext.restype = POINTER(ALCcontext)
+alcCreateContext.argtypes = [POINTER(ALCdevice), POINTER(ALCint)]
+
+# /usr/include/AL/alc.h:182
+alcMakeContextCurrent = _lib.alcMakeContextCurrent
+alcMakeContextCurrent.restype = ALCboolean
+alcMakeContextCurrent.argtypes = [POINTER(ALCcontext)]
+
+# /usr/include/AL/alc.h:184
+alcProcessContext = _lib.alcProcessContext
+alcProcessContext.restype = None
+alcProcessContext.argtypes = [POINTER(ALCcontext)]
+
+# /usr/include/AL/alc.h:186
+alcSuspendContext = _lib.alcSuspendContext
+alcSuspendContext.restype = None
+alcSuspendContext.argtypes = [POINTER(ALCcontext)]
+
+# /usr/include/AL/alc.h:188
+alcDestroyContext = _lib.alcDestroyContext
+alcDestroyContext.restype = None
+alcDestroyContext.argtypes = [POINTER(ALCcontext)]
+
+# /usr/include/AL/alc.h:190
+alcGetCurrentContext = _lib.alcGetCurrentContext
+alcGetCurrentContext.restype = POINTER(ALCcontext)
+alcGetCurrentContext.argtypes = []
+
+# /usr/include/AL/alc.h:192
+alcGetContextsDevice = _lib.alcGetContextsDevice
+alcGetContextsDevice.restype = POINTER(ALCdevice)
+alcGetContextsDevice.argtypes = [POINTER(ALCcontext)]
+
+# /usr/include/AL/alc.h:198
+alcOpenDevice = _lib.alcOpenDevice
+alcOpenDevice.restype = POINTER(ALCdevice)
+alcOpenDevice.argtypes = [POINTER(ALCchar)]
+
+# /usr/include/AL/alc.h:200
+alcCloseDevice = _lib.alcCloseDevice
+alcCloseDevice.restype = ALCboolean
+alcCloseDevice.argtypes = [POINTER(ALCdevice)]
+
+# /usr/include/AL/alc.h:207
+alcGetError = _lib.alcGetError
+alcGetError.restype = ALCenum
+alcGetError.argtypes = [POINTER(ALCdevice)]
+
+# /usr/include/AL/alc.h:215
+alcIsExtensionPresent = _lib.alcIsExtensionPresent
+alcIsExtensionPresent.restype = ALCboolean
+alcIsExtensionPresent.argtypes = [POINTER(ALCdevice), POINTER(ALCchar)]
+
+# /usr/include/AL/alc.h:217
+alcGetProcAddress = _lib.alcGetProcAddress
+alcGetProcAddress.restype = POINTER(c_void)
+alcGetProcAddress.argtypes = [POINTER(ALCdevice), POINTER(ALCchar)]
+
+# /usr/include/AL/alc.h:219
+alcGetEnumValue = _lib.alcGetEnumValue
+alcGetEnumValue.restype = ALCenum
+alcGetEnumValue.argtypes = [POINTER(ALCdevice), POINTER(ALCchar)]
+
+# /usr/include/AL/alc.h:225
+alcGetString = _lib.alcGetString
+alcGetString.restype = POINTER(ALCchar)
+alcGetString.argtypes = [POINTER(ALCdevice), ALCenum]
+
+# /usr/include/AL/alc.h:227
+alcGetIntegerv = _lib.alcGetIntegerv
+alcGetIntegerv.restype = None
+alcGetIntegerv.argtypes = [POINTER(ALCdevice), ALCenum, ALCsizei, POINTER(ALCint)]
+
+# /usr/include/AL/alc.h:233
+alcCaptureOpenDevice = _lib.alcCaptureOpenDevice
+alcCaptureOpenDevice.restype = POINTER(ALCdevice)
+alcCaptureOpenDevice.argtypes = [POINTER(ALCchar), ALCuint, ALCenum, ALCsizei]
+
+# /usr/include/AL/alc.h:235
+alcCaptureCloseDevice = _lib.alcCaptureCloseDevice
+alcCaptureCloseDevice.restype = ALCboolean
+alcCaptureCloseDevice.argtypes = [POINTER(ALCdevice)]
+
+# /usr/include/AL/alc.h:237
+alcCaptureStart = _lib.alcCaptureStart
+alcCaptureStart.restype = None
+alcCaptureStart.argtypes = [POINTER(ALCdevice)]
+
+# /usr/include/AL/alc.h:239
+alcCaptureStop = _lib.alcCaptureStop
+alcCaptureStop.restype = None
+alcCaptureStop.argtypes = [POINTER(ALCdevice)]
+
+# /usr/include/AL/alc.h:241
+alcCaptureSamples = _lib.alcCaptureSamples
+alcCaptureSamples.restype = None
+alcCaptureSamples.argtypes = [POINTER(ALCdevice), POINTER(ALCvoid), ALCsizei]
+
+LPALCCREATECONTEXT = CFUNCTYPE(POINTER(ALCcontext), POINTER(ALCdevice), POINTER(ALCint)) # /usr/include/AL/alc.h:246
+LPALCMAKECONTEXTCURRENT = CFUNCTYPE(ALCboolean, POINTER(ALCcontext)) # /usr/include/AL/alc.h:247
+LPALCPROCESSCONTEXT = CFUNCTYPE(None, POINTER(ALCcontext)) # /usr/include/AL/alc.h:248
+LPALCSUSPENDCONTEXT = CFUNCTYPE(None, POINTER(ALCcontext)) # /usr/include/AL/alc.h:249
+LPALCDESTROYCONTEXT = CFUNCTYPE(None, POINTER(ALCcontext)) # /usr/include/AL/alc.h:250
+LPALCGETCURRENTCONTEXT = CFUNCTYPE(POINTER(ALCcontext)) # /usr/include/AL/alc.h:251
+LPALCGETCONTEXTSDEVICE = CFUNCTYPE(POINTER(ALCdevice), POINTER(ALCcontext)) # /usr/include/AL/alc.h:252
+LPALCOPENDEVICE = CFUNCTYPE(POINTER(ALCdevice), POINTER(ALCchar)) # /usr/include/AL/alc.h:253
+LPALCCLOSEDEVICE = CFUNCTYPE(ALCboolean, POINTER(ALCdevice)) # /usr/include/AL/alc.h:254
+LPALCGETERROR = CFUNCTYPE(ALCenum, POINTER(ALCdevice)) # /usr/include/AL/alc.h:255
+LPALCISEXTENSIONPRESENT = CFUNCTYPE(ALCboolean, POINTER(ALCdevice), POINTER(ALCchar)) # /usr/include/AL/alc.h:256
+LPALCGETPROCADDRESS = CFUNCTYPE(POINTER(c_void), POINTER(ALCdevice), POINTER(ALCchar)) # /usr/include/AL/alc.h:257
+LPALCGETENUMVALUE = CFUNCTYPE(ALCenum, POINTER(ALCdevice), POINTER(ALCchar)) # /usr/include/AL/alc.h:258
+LPALCGETSTRING = CFUNCTYPE(POINTER(ALCchar), POINTER(ALCdevice), ALCenum) # /usr/include/AL/alc.h:259
+LPALCGETINTEGERV = CFUNCTYPE(None, POINTER(ALCdevice), ALCenum, ALCsizei, POINTER(ALCint)) # /usr/include/AL/alc.h:260
+LPALCCAPTUREOPENDEVICE = CFUNCTYPE(POINTER(ALCdevice), POINTER(ALCchar), ALCuint, ALCenum, ALCsizei) # /usr/include/AL/alc.h:261
+LPALCCAPTURECLOSEDEVICE = CFUNCTYPE(ALCboolean, POINTER(ALCdevice)) # /usr/include/AL/alc.h:262
+LPALCCAPTURESTART = CFUNCTYPE(None, POINTER(ALCdevice)) # /usr/include/AL/alc.h:263
+LPALCCAPTURESTOP = CFUNCTYPE(None, POINTER(ALCdevice)) # /usr/include/AL/alc.h:264
+LPALCCAPTURESAMPLES = CFUNCTYPE(None, POINTER(ALCdevice), POINTER(ALCvoid), ALCsizei) # /usr/include/AL/alc.h:265
+
+__all__ = ['ALC_API', 'ALCAPI', 'ALC_INVALID', 'ALC_VERSION_0_1', 'ALCdevice',
+ 'ALCcontext', 'ALCboolean', 'ALCchar', 'ALCbyte', 'ALCubyte', 'ALCshort',
+ 'ALCushort', 'ALCint', 'ALCuint', 'ALCsizei', 'ALCenum', 'ALCfloat',
+ 'ALCdouble', 'ALCvoid', 'ALC_FALSE', 'ALC_TRUE', 'ALC_FREQUENCY',
+ 'ALC_REFRESH', 'ALC_SYNC', 'ALC_MONO_SOURCES', 'ALC_STEREO_SOURCES',
+ 'ALC_NO_ERROR', 'ALC_INVALID_DEVICE', 'ALC_INVALID_CONTEXT',
+ 'ALC_INVALID_ENUM', 'ALC_INVALID_VALUE', 'ALC_OUT_OF_MEMORY',
+ 'ALC_DEFAULT_DEVICE_SPECIFIER', 'ALC_DEVICE_SPECIFIER', 'ALC_EXTENSIONS',
+ 'ALC_MAJOR_VERSION', 'ALC_MINOR_VERSION', 'ALC_ATTRIBUTES_SIZE',
+ 'ALC_ALL_ATTRIBUTES', 'ALC_CAPTURE_DEVICE_SPECIFIER',
+ 'ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER', 'ALC_CAPTURE_SAMPLES',
+ 'alcCreateContext', 'alcMakeContextCurrent', 'alcProcessContext',
+ 'alcSuspendContext', 'alcDestroyContext', 'alcGetCurrentContext',
+ 'alcGetContextsDevice', 'alcOpenDevice', 'alcCloseDevice', 'alcGetError',
+ 'alcIsExtensionPresent', 'alcGetProcAddress', 'alcGetEnumValue',
+ 'alcGetString', 'alcGetIntegerv', 'alcCaptureOpenDevice',
+ 'alcCaptureCloseDevice', 'alcCaptureStart', 'alcCaptureStop',
+ 'alcCaptureSamples', 'LPALCCREATECONTEXT', 'LPALCMAKECONTEXTCURRENT',
+ 'LPALCPROCESSCONTEXT', 'LPALCSUSPENDCONTEXT', 'LPALCDESTROYCONTEXT',
+ 'LPALCGETCURRENTCONTEXT', 'LPALCGETCONTEXTSDEVICE', 'LPALCOPENDEVICE',
+ 'LPALCCLOSEDEVICE', 'LPALCGETERROR', 'LPALCISEXTENSIONPRESENT',
+ 'LPALCGETPROCADDRESS', 'LPALCGETENUMVALUE', 'LPALCGETSTRING',
+ 'LPALCGETINTEGERV', 'LPALCCAPTUREOPENDEVICE', 'LPALCCAPTURECLOSEDEVICE',
+ 'LPALCCAPTURESTART', 'LPALCCAPTURESTOP', 'LPALCCAPTURESAMPLES']
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/lib_openal.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/lib_openal.py
new file mode 100644
index 0000000000000000000000000000000000000000..7b6569841991063e421f763b02af1025232b8f38
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/openal/lib_openal.py
@@ -0,0 +1,619 @@
+"""Wrapper for openal
+
+Generated with:
+../tools/wraptypes/wrap.py /usr/include/AL/al.h -lopenal -olib_openal.py
+
+.. Hacked to remove non-existent library functions.
+
+TODO add alGetError check.
+
+.. alListener3i and alListeneriv are present in my OS X 10.4 but not another
+10.4 user's installation. They've also been removed for compatibility.
+"""
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('openal',
+ win32='openal32',
+ framework='OpenAL')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+AL_API = 0 # /usr/include/AL/al.h:39
+ALAPI = 0 # /usr/include/AL/al.h:59
+AL_INVALID = -1 # /usr/include/AL/al.h:61
+AL_ILLEGAL_ENUM = 0 # /usr/include/AL/al.h:62
+AL_ILLEGAL_COMMAND = 0 # /usr/include/AL/al.h:63
+ALboolean = c_int # Better return type than c_char, as generated
+ALchar = c_char # /usr/include/AL/al.h:73
+ALbyte = c_char # /usr/include/AL/al.h:76
+ALubyte = c_ubyte # /usr/include/AL/al.h:79
+ALshort = c_short # /usr/include/AL/al.h:82
+ALushort = c_ushort # /usr/include/AL/al.h:85
+ALint = c_int # /usr/include/AL/al.h:88
+ALuint = c_uint # /usr/include/AL/al.h:91
+ALsizei = c_int # /usr/include/AL/al.h:94
+ALenum = c_int # /usr/include/AL/al.h:97
+ALfloat = c_float # /usr/include/AL/al.h:100
+ALdouble = c_double # /usr/include/AL/al.h:103
+ALvoid = None # /usr/include/AL/al.h:106
+AL_NONE = 0 # /usr/include/AL/al.h:112
+AL_FALSE = 0 # /usr/include/AL/al.h:115
+AL_TRUE = 1 # /usr/include/AL/al.h:118
+AL_SOURCE_RELATIVE = 514 # /usr/include/AL/al.h:121
+AL_CONE_INNER_ANGLE = 4097 # /usr/include/AL/al.h:130
+AL_CONE_OUTER_ANGLE = 4098 # /usr/include/AL/al.h:137
+AL_PITCH = 4099 # /usr/include/AL/al.h:145
+AL_POSITION = 4100 # /usr/include/AL/al.h:157
+AL_DIRECTION = 4101 # /usr/include/AL/al.h:160
+AL_VELOCITY = 4102 # /usr/include/AL/al.h:163
+AL_LOOPING = 4103 # /usr/include/AL/al.h:171
+AL_BUFFER = 4105 # /usr/include/AL/al.h:178
+AL_GAIN = 4106 # /usr/include/AL/al.h:191
+AL_MIN_GAIN = 4109 # /usr/include/AL/al.h:200
+AL_MAX_GAIN = 4110 # /usr/include/AL/al.h:209
+AL_ORIENTATION = 4111 # /usr/include/AL/al.h:216
+AL_SOURCE_STATE = 4112 # /usr/include/AL/al.h:221
+AL_INITIAL = 4113 # /usr/include/AL/al.h:222
+AL_PLAYING = 4114 # /usr/include/AL/al.h:223
+AL_PAUSED = 4115 # /usr/include/AL/al.h:224
+AL_STOPPED = 4116 # /usr/include/AL/al.h:225
+AL_BUFFERS_QUEUED = 4117 # /usr/include/AL/al.h:230
+AL_BUFFERS_PROCESSED = 4118 # /usr/include/AL/al.h:231
+AL_SEC_OFFSET = 4132 # /usr/include/AL/al.h:236
+AL_SAMPLE_OFFSET = 4133 # /usr/include/AL/al.h:237
+AL_BYTE_OFFSET = 4134 # /usr/include/AL/al.h:238
+AL_SOURCE_TYPE = 4135 # /usr/include/AL/al.h:246
+AL_STATIC = 4136 # /usr/include/AL/al.h:247
+AL_STREAMING = 4137 # /usr/include/AL/al.h:248
+AL_UNDETERMINED = 4144 # /usr/include/AL/al.h:249
+AL_FORMAT_MONO8 = 4352 # /usr/include/AL/al.h:252
+AL_FORMAT_MONO16 = 4353 # /usr/include/AL/al.h:253
+AL_FORMAT_STEREO8 = 4354 # /usr/include/AL/al.h:254
+AL_FORMAT_STEREO16 = 4355 # /usr/include/AL/al.h:255
+AL_REFERENCE_DISTANCE = 4128 # /usr/include/AL/al.h:265
+AL_ROLLOFF_FACTOR = 4129 # /usr/include/AL/al.h:273
+AL_CONE_OUTER_GAIN = 4130 # /usr/include/AL/al.h:282
+AL_MAX_DISTANCE = 4131 # /usr/include/AL/al.h:292
+AL_FREQUENCY = 8193 # /usr/include/AL/al.h:300
+AL_BITS = 8194 # /usr/include/AL/al.h:301
+AL_CHANNELS = 8195 # /usr/include/AL/al.h:302
+AL_SIZE = 8196 # /usr/include/AL/al.h:303
+AL_UNUSED = 8208 # /usr/include/AL/al.h:310
+AL_PENDING = 8209 # /usr/include/AL/al.h:311
+AL_PROCESSED = 8210 # /usr/include/AL/al.h:312
+AL_NO_ERROR = 0 # /usr/include/AL/al.h:316
+AL_INVALID_NAME = 40961 # /usr/include/AL/al.h:321
+AL_INVALID_ENUM = 40962 # /usr/include/AL/al.h:326
+AL_INVALID_VALUE = 40963 # /usr/include/AL/al.h:331
+AL_INVALID_OPERATION = 40964 # /usr/include/AL/al.h:336
+AL_OUT_OF_MEMORY = 40965 # /usr/include/AL/al.h:342
+AL_VENDOR = 45057 # /usr/include/AL/al.h:346
+AL_VERSION = 45058 # /usr/include/AL/al.h:347
+AL_RENDERER = 45059 # /usr/include/AL/al.h:348
+AL_EXTENSIONS = 45060 # /usr/include/AL/al.h:349
+AL_DOPPLER_FACTOR = 49152 # /usr/include/AL/al.h:356
+AL_DOPPLER_VELOCITY = 49153 # /usr/include/AL/al.h:361
+AL_SPEED_OF_SOUND = 49155 # /usr/include/AL/al.h:366
+AL_DISTANCE_MODEL = 53248 # /usr/include/AL/al.h:375
+AL_INVERSE_DISTANCE = 53249 # /usr/include/AL/al.h:376
+AL_INVERSE_DISTANCE_CLAMPED = 53250 # /usr/include/AL/al.h:377
+AL_LINEAR_DISTANCE = 53251 # /usr/include/AL/al.h:378
+AL_LINEAR_DISTANCE_CLAMPED = 53252 # /usr/include/AL/al.h:379
+AL_EXPONENT_DISTANCE = 53253 # /usr/include/AL/al.h:380
+AL_EXPONENT_DISTANCE_CLAMPED = 53254 # /usr/include/AL/al.h:381
+# /usr/include/AL/al.h:386
+alEnable = _lib.alEnable
+alEnable.restype = None
+alEnable.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:388
+alDisable = _lib.alDisable
+alDisable.restype = None
+alDisable.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:390
+alIsEnabled = _lib.alIsEnabled
+alIsEnabled.restype = ALboolean
+alIsEnabled.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:396
+alGetString = _lib.alGetString
+alGetString.restype = POINTER(ALchar)
+alGetString.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:398
+alGetBooleanv = _lib.alGetBooleanv
+alGetBooleanv.restype = None
+alGetBooleanv.argtypes = [ALenum, POINTER(ALboolean)]
+
+# /usr/include/AL/al.h:400
+alGetIntegerv = _lib.alGetIntegerv
+alGetIntegerv.restype = None
+alGetIntegerv.argtypes = [ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:402
+alGetFloatv = _lib.alGetFloatv
+alGetFloatv.restype = None
+alGetFloatv.argtypes = [ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:404
+alGetDoublev = _lib.alGetDoublev
+alGetDoublev.restype = None
+alGetDoublev.argtypes = [ALenum, POINTER(ALdouble)]
+
+# /usr/include/AL/al.h:406
+alGetBoolean = _lib.alGetBoolean
+alGetBoolean.restype = ALboolean
+alGetBoolean.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:408
+alGetInteger = _lib.alGetInteger
+alGetInteger.restype = ALint
+alGetInteger.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:410
+alGetFloat = _lib.alGetFloat
+alGetFloat.restype = ALfloat
+alGetFloat.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:412
+alGetDouble = _lib.alGetDouble
+alGetDouble.restype = ALdouble
+alGetDouble.argtypes = [ALenum]
+
+# /usr/include/AL/al.h:419
+alGetError = _lib.alGetError
+alGetError.restype = ALenum
+alGetError.argtypes = []
+
+# /usr/include/AL/al.h:427
+alIsExtensionPresent = _lib.alIsExtensionPresent
+alIsExtensionPresent.restype = ALboolean
+alIsExtensionPresent.argtypes = [POINTER(ALchar)]
+
+# /usr/include/AL/al.h:429
+alGetProcAddress = _lib.alGetProcAddress
+alGetProcAddress.restype = POINTER(c_void)
+alGetProcAddress.argtypes = [POINTER(ALchar)]
+
+# /usr/include/AL/al.h:431
+alGetEnumValue = _lib.alGetEnumValue
+alGetEnumValue.restype = ALenum
+alGetEnumValue.argtypes = [POINTER(ALchar)]
+
+# /usr/include/AL/al.h:450
+alListenerf = _lib.alListenerf
+alListenerf.restype = None
+alListenerf.argtypes = [ALenum, ALfloat]
+
+# /usr/include/AL/al.h:452
+alListener3f = _lib.alListener3f
+alListener3f.restype = None
+alListener3f.argtypes = [ALenum, ALfloat, ALfloat, ALfloat]
+
+# /usr/include/AL/al.h:454
+alListenerfv = _lib.alListenerfv
+alListenerfv.restype = None
+alListenerfv.argtypes = [ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:456
+alListeneri = _lib.alListeneri
+alListeneri.restype = None
+alListeneri.argtypes = [ALenum, ALint]
+
+# /usr/include/AL/al.h:458
+# alListener3i = _lib.alListener3i
+# alListener3i.restype = None
+# alListener3i.argtypes = [ALenum, ALint, ALint, ALint]
+
+# /usr/include/AL/al.h:460
+# alListeneriv = _lib.alListeneriv
+# alListeneriv.restype = None
+# alListeneriv.argtypes = [ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:465
+alGetListenerf = _lib.alGetListenerf
+alGetListenerf.restype = None
+alGetListenerf.argtypes = [ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:467
+alGetListener3f = _lib.alGetListener3f
+alGetListener3f.restype = None
+alGetListener3f.argtypes = [ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:469
+alGetListenerfv = _lib.alGetListenerfv
+alGetListenerfv.restype = None
+alGetListenerfv.argtypes = [ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:471
+alGetListeneri = _lib.alGetListeneri
+alGetListeneri.restype = None
+alGetListeneri.argtypes = [ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:473
+alGetListener3i = _lib.alGetListener3i
+alGetListener3i.restype = None
+alGetListener3i.argtypes = [ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)]
+
+# /usr/include/AL/al.h:475
+alGetListeneriv = _lib.alGetListeneriv
+alGetListeneriv.restype = None
+alGetListeneriv.argtypes = [ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:512
+alGenSources = _lib.alGenSources
+alGenSources.restype = None
+alGenSources.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:515
+alDeleteSources = _lib.alDeleteSources
+alDeleteSources.restype = None
+alDeleteSources.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:518
+alIsSource = _lib.alIsSource
+alIsSource.restype = ALboolean
+alIsSource.argtypes = [ALuint]
+
+# /usr/include/AL/al.h:523
+alSourcef = _lib.alSourcef
+alSourcef.restype = None
+alSourcef.argtypes = [ALuint, ALenum, ALfloat]
+
+# /usr/include/AL/al.h:525
+alSource3f = _lib.alSource3f
+alSource3f.restype = None
+alSource3f.argtypes = [ALuint, ALenum, ALfloat, ALfloat, ALfloat]
+
+# /usr/include/AL/al.h:527
+alSourcefv = _lib.alSourcefv
+alSourcefv.restype = None
+alSourcefv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:529
+alSourcei = _lib.alSourcei
+alSourcei.restype = None
+alSourcei.argtypes = [ALuint, ALenum, ALint]
+
+# /usr/include/AL/al.h:531
+# alSource3i = _lib.alSource3i
+# alSource3i.restype = None
+# alSource3i.argtypes = [ALuint, ALenum, ALint, ALint, ALint]
+
+# /usr/include/AL/al.h:533
+# alSourceiv = _lib.alSourceiv
+# alSourceiv.restype = None
+# alSourceiv.argtypes = [ALuint, ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:538
+alGetSourcef = _lib.alGetSourcef
+alGetSourcef.restype = None
+alGetSourcef.argtypes = [ALuint, ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:540
+alGetSource3f = _lib.alGetSource3f
+alGetSource3f.restype = None
+alGetSource3f.argtypes = [ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:542
+alGetSourcefv = _lib.alGetSourcefv
+alGetSourcefv.restype = None
+alGetSourcefv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:544
+alGetSourcei = _lib.alGetSourcei
+alGetSourcei.restype = None
+alGetSourcei.argtypes = [ALuint, ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:546
+# alGetSource3i = _lib.alGetSource3i
+# alGetSource3i.restype = None
+# alGetSource3i.argtypes = [ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)]
+
+# /usr/include/AL/al.h:548
+alGetSourceiv = _lib.alGetSourceiv
+alGetSourceiv.restype = None
+alGetSourceiv.argtypes = [ALuint, ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:556
+alSourcePlayv = _lib.alSourcePlayv
+alSourcePlayv.restype = None
+alSourcePlayv.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:559
+alSourceStopv = _lib.alSourceStopv
+alSourceStopv.restype = None
+alSourceStopv.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:562
+alSourceRewindv = _lib.alSourceRewindv
+alSourceRewindv.restype = None
+alSourceRewindv.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:565
+alSourcePausev = _lib.alSourcePausev
+alSourcePausev.restype = None
+alSourcePausev.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:572
+alSourcePlay = _lib.alSourcePlay
+alSourcePlay.restype = None
+alSourcePlay.argtypes = [ALuint]
+
+# /usr/include/AL/al.h:575
+alSourceStop = _lib.alSourceStop
+alSourceStop.restype = None
+alSourceStop.argtypes = [ALuint]
+
+# /usr/include/AL/al.h:578
+alSourceRewind = _lib.alSourceRewind
+alSourceRewind.restype = None
+alSourceRewind.argtypes = [ALuint]
+
+# /usr/include/AL/al.h:581
+alSourcePause = _lib.alSourcePause
+alSourcePause.restype = None
+alSourcePause.argtypes = [ALuint]
+
+# /usr/include/AL/al.h:586
+alSourceQueueBuffers = _lib.alSourceQueueBuffers
+alSourceQueueBuffers.restype = None
+alSourceQueueBuffers.argtypes = [ALuint, ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:588
+alSourceUnqueueBuffers = _lib.alSourceUnqueueBuffers
+alSourceUnqueueBuffers.restype = None
+alSourceUnqueueBuffers.argtypes = [ALuint, ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:606
+alGenBuffers = _lib.alGenBuffers
+alGenBuffers.restype = None
+alGenBuffers.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:609
+alDeleteBuffers = _lib.alDeleteBuffers
+alDeleteBuffers.restype = None
+alDeleteBuffers.argtypes = [ALsizei, POINTER(ALuint)]
+
+# /usr/include/AL/al.h:612
+alIsBuffer = _lib.alIsBuffer
+alIsBuffer.restype = ALboolean
+alIsBuffer.argtypes = [ALuint]
+
+# /usr/include/AL/al.h:615
+alBufferData = _lib.alBufferData
+alBufferData.restype = None
+alBufferData.argtypes = [ALuint, ALenum, POINTER(ALvoid), ALsizei, ALsizei]
+
+# /usr/include/AL/al.h:620
+alBufferf = _lib.alBufferf
+alBufferf.restype = None
+alBufferf.argtypes = [ALuint, ALenum, ALfloat]
+
+# /usr/include/AL/al.h:622
+alBuffer3f = _lib.alBuffer3f
+alBuffer3f.restype = None
+alBuffer3f.argtypes = [ALuint, ALenum, ALfloat, ALfloat, ALfloat]
+
+# /usr/include/AL/al.h:624
+alBufferfv = _lib.alBufferfv
+alBufferfv.restype = None
+alBufferfv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:626
+alBufferi = _lib.alBufferi
+alBufferi.restype = None
+alBufferi.argtypes = [ALuint, ALenum, ALint]
+
+# /usr/include/AL/al.h:628
+alBuffer3i = _lib.alBuffer3i
+alBuffer3i.restype = None
+alBuffer3i.argtypes = [ALuint, ALenum, ALint, ALint, ALint]
+
+# /usr/include/AL/al.h:630
+alBufferiv = _lib.alBufferiv
+alBufferiv.restype = None
+alBufferiv.argtypes = [ALuint, ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:635
+alGetBufferf = _lib.alGetBufferf
+alGetBufferf.restype = None
+alGetBufferf.argtypes = [ALuint, ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:637
+alGetBuffer3f = _lib.alGetBuffer3f
+alGetBuffer3f.restype = None
+alGetBuffer3f.argtypes = [ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:639
+alGetBufferfv = _lib.alGetBufferfv
+alGetBufferfv.restype = None
+alGetBufferfv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]
+
+# /usr/include/AL/al.h:641
+alGetBufferi = _lib.alGetBufferi
+alGetBufferi.restype = None
+alGetBufferi.argtypes = [ALuint, ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:643
+alGetBuffer3i = _lib.alGetBuffer3i
+alGetBuffer3i.restype = None
+alGetBuffer3i.argtypes = [ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)]
+
+# /usr/include/AL/al.h:645
+alGetBufferiv = _lib.alGetBufferiv
+alGetBufferiv.restype = None
+alGetBufferiv.argtypes = [ALuint, ALenum, POINTER(ALint)]
+
+# /usr/include/AL/al.h:651
+alDopplerFactor = _lib.alDopplerFactor
+alDopplerFactor.restype = None
+alDopplerFactor.argtypes = [ALfloat]
+
+# /usr/include/AL/al.h:653
+alDopplerVelocity = _lib.alDopplerVelocity
+alDopplerVelocity.restype = None
+alDopplerVelocity.argtypes = [ALfloat]
+
+# /usr/include/AL/al.h:655
+alSpeedOfSound = _lib.alSpeedOfSound
+alSpeedOfSound.restype = None
+alSpeedOfSound.argtypes = [ALfloat]
+
+# /usr/include/AL/al.h:657
+alDistanceModel = _lib.alDistanceModel
+alDistanceModel.restype = None
+alDistanceModel.argtypes = [ALenum]
+
+LPALENABLE = CFUNCTYPE(None, ALenum) # /usr/include/AL/al.h:662
+LPALDISABLE = CFUNCTYPE(None, ALenum) # /usr/include/AL/al.h:663
+LPALISENABLED = CFUNCTYPE(ALboolean, ALenum) # /usr/include/AL/al.h:664
+LPALGETSTRING = CFUNCTYPE(POINTER(ALchar), ALenum) # /usr/include/AL/al.h:665
+LPALGETBOOLEANV = CFUNCTYPE(None, ALenum, POINTER(ALboolean)) # /usr/include/AL/al.h:666
+LPALGETINTEGERV = CFUNCTYPE(None, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:667
+LPALGETFLOATV = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:668
+LPALGETDOUBLEV = CFUNCTYPE(None, ALenum, POINTER(ALdouble)) # /usr/include/AL/al.h:669
+LPALGETBOOLEAN = CFUNCTYPE(ALboolean, ALenum) # /usr/include/AL/al.h:670
+LPALGETINTEGER = CFUNCTYPE(ALint, ALenum) # /usr/include/AL/al.h:671
+LPALGETFLOAT = CFUNCTYPE(ALfloat, ALenum) # /usr/include/AL/al.h:672
+LPALGETDOUBLE = CFUNCTYPE(ALdouble, ALenum) # /usr/include/AL/al.h:673
+LPALGETERROR = CFUNCTYPE(ALenum) # /usr/include/AL/al.h:674
+LPALISEXTENSIONPRESENT = CFUNCTYPE(ALboolean, POINTER(ALchar)) # /usr/include/AL/al.h:675
+LPALGETPROCADDRESS = CFUNCTYPE(POINTER(c_void), POINTER(ALchar)) # /usr/include/AL/al.h:676
+LPALGETENUMVALUE = CFUNCTYPE(ALenum, POINTER(ALchar)) # /usr/include/AL/al.h:677
+LPALLISTENERF = CFUNCTYPE(None, ALenum, ALfloat) # /usr/include/AL/al.h:678
+LPALLISTENER3F = CFUNCTYPE(None, ALenum, ALfloat, ALfloat, ALfloat) # /usr/include/AL/al.h:679
+LPALLISTENERFV = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:680
+LPALLISTENERI = CFUNCTYPE(None, ALenum, ALint) # /usr/include/AL/al.h:681
+LPALLISTENER3I = CFUNCTYPE(None, ALenum, ALint, ALint, ALint) # /usr/include/AL/al.h:682
+LPALLISTENERIV = CFUNCTYPE(None, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:683
+LPALGETLISTENERF = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:684
+LPALGETLISTENER3F = CFUNCTYPE(None, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)) # /usr/include/AL/al.h:685
+LPALGETLISTENERFV = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:686
+LPALGETLISTENERI = CFUNCTYPE(None, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:687
+LPALGETLISTENER3I = CFUNCTYPE(None, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)) # /usr/include/AL/al.h:688
+LPALGETLISTENERIV = CFUNCTYPE(None, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:689
+LPALGENSOURCES = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:690
+LPALDELETESOURCES = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:691
+LPALISSOURCE = CFUNCTYPE(ALboolean, ALuint) # /usr/include/AL/al.h:692
+LPALSOURCEF = CFUNCTYPE(None, ALuint, ALenum, ALfloat) # /usr/include/AL/al.h:693
+LPALSOURCE3F = CFUNCTYPE(None, ALuint, ALenum, ALfloat, ALfloat, ALfloat) # /usr/include/AL/al.h:694
+LPALSOURCEFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:695
+LPALSOURCEI = CFUNCTYPE(None, ALuint, ALenum, ALint) # /usr/include/AL/al.h:696
+LPALSOURCE3I = CFUNCTYPE(None, ALuint, ALenum, ALint, ALint, ALint) # /usr/include/AL/al.h:697
+LPALSOURCEIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:698
+LPALGETSOURCEF = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:699
+LPALGETSOURCE3F = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)) # /usr/include/AL/al.h:700
+LPALGETSOURCEFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:701
+LPALGETSOURCEI = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:702
+LPALGETSOURCE3I = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)) # /usr/include/AL/al.h:703
+LPALGETSOURCEIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:704
+LPALSOURCEPLAYV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:705
+LPALSOURCESTOPV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:706
+LPALSOURCEREWINDV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:707
+LPALSOURCEPAUSEV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:708
+LPALSOURCEPLAY = CFUNCTYPE(None, ALuint) # /usr/include/AL/al.h:709
+LPALSOURCESTOP = CFUNCTYPE(None, ALuint) # /usr/include/AL/al.h:710
+LPALSOURCEREWIND = CFUNCTYPE(None, ALuint) # /usr/include/AL/al.h:711
+LPALSOURCEPAUSE = CFUNCTYPE(None, ALuint) # /usr/include/AL/al.h:712
+LPALSOURCEQUEUEBUFFERS = CFUNCTYPE(None, ALuint, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:713
+LPALSOURCEUNQUEUEBUFFERS = CFUNCTYPE(None, ALuint, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:714
+LPALGENBUFFERS = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:715
+LPALDELETEBUFFERS = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) # /usr/include/AL/al.h:716
+LPALISBUFFER = CFUNCTYPE(ALboolean, ALuint) # /usr/include/AL/al.h:717
+LPALBUFFERDATA = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALvoid), ALsizei, ALsizei) # /usr/include/AL/al.h:718
+LPALBUFFERF = CFUNCTYPE(None, ALuint, ALenum, ALfloat) # /usr/include/AL/al.h:719
+LPALBUFFER3F = CFUNCTYPE(None, ALuint, ALenum, ALfloat, ALfloat, ALfloat) # /usr/include/AL/al.h:720
+LPALBUFFERFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:721
+LPALBUFFERI = CFUNCTYPE(None, ALuint, ALenum, ALint) # /usr/include/AL/al.h:722
+LPALBUFFER3I = CFUNCTYPE(None, ALuint, ALenum, ALint, ALint, ALint) # /usr/include/AL/al.h:723
+LPALBUFFERIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:724
+LPALGETBUFFERF = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:725
+LPALGETBUFFER3F = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)) # /usr/include/AL/al.h:726
+LPALGETBUFFERFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) # /usr/include/AL/al.h:727
+LPALGETBUFFERI = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:728
+LPALGETBUFFER3I = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)) # /usr/include/AL/al.h:729
+LPALGETBUFFERIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) # /usr/include/AL/al.h:730
+LPALDOPPLERFACTOR = CFUNCTYPE(None, ALfloat) # /usr/include/AL/al.h:731
+LPALDOPPLERVELOCITY = CFUNCTYPE(None, ALfloat) # /usr/include/AL/al.h:732
+LPALSPEEDOFSOUND = CFUNCTYPE(None, ALfloat) # /usr/include/AL/al.h:733
+LPALDISTANCEMODEL = CFUNCTYPE(None, ALenum) # /usr/include/AL/al.h:734
+
+__all__ = ['AL_API', 'ALAPI', 'AL_INVALID', 'AL_ILLEGAL_ENUM',
+ 'AL_ILLEGAL_COMMAND', 'ALboolean', 'ALchar', 'ALbyte', 'ALubyte', 'ALshort',
+ 'ALushort', 'ALint', 'ALuint', 'ALsizei', 'ALenum', 'ALfloat', 'ALdouble',
+ 'ALvoid', 'AL_NONE', 'AL_FALSE', 'AL_TRUE', 'AL_SOURCE_RELATIVE',
+ 'AL_CONE_INNER_ANGLE', 'AL_CONE_OUTER_ANGLE', 'AL_PITCH', 'AL_POSITION',
+ 'AL_DIRECTION', 'AL_VELOCITY', 'AL_LOOPING', 'AL_BUFFER', 'AL_GAIN',
+ 'AL_MIN_GAIN', 'AL_MAX_GAIN', 'AL_ORIENTATION', 'AL_SOURCE_STATE',
+ 'AL_INITIAL', 'AL_PLAYING', 'AL_PAUSED', 'AL_STOPPED', 'AL_BUFFERS_QUEUED',
+ 'AL_BUFFERS_PROCESSED', 'AL_SEC_OFFSET', 'AL_SAMPLE_OFFSET', 'AL_BYTE_OFFSET',
+ 'AL_SOURCE_TYPE', 'AL_STATIC', 'AL_STREAMING', 'AL_UNDETERMINED',
+ 'AL_FORMAT_MONO8', 'AL_FORMAT_MONO16', 'AL_FORMAT_STEREO8',
+ 'AL_FORMAT_STEREO16', 'AL_REFERENCE_DISTANCE', 'AL_ROLLOFF_FACTOR',
+ 'AL_CONE_OUTER_GAIN', 'AL_MAX_DISTANCE', 'AL_FREQUENCY', 'AL_BITS',
+ 'AL_CHANNELS', 'AL_SIZE', 'AL_UNUSED', 'AL_PENDING', 'AL_PROCESSED',
+ 'AL_NO_ERROR', 'AL_INVALID_NAME', 'AL_INVALID_ENUM', 'AL_INVALID_VALUE',
+ 'AL_INVALID_OPERATION', 'AL_OUT_OF_MEMORY', 'AL_VENDOR', 'AL_VERSION',
+ 'AL_RENDERER', 'AL_EXTENSIONS', 'AL_DOPPLER_FACTOR', 'AL_DOPPLER_VELOCITY',
+ 'AL_SPEED_OF_SOUND', 'AL_DISTANCE_MODEL', 'AL_INVERSE_DISTANCE',
+ 'AL_INVERSE_DISTANCE_CLAMPED', 'AL_LINEAR_DISTANCE',
+ 'AL_LINEAR_DISTANCE_CLAMPED', 'AL_EXPONENT_DISTANCE',
+ 'AL_EXPONENT_DISTANCE_CLAMPED', 'alEnable', 'alDisable', 'alIsEnabled',
+ 'alGetString', 'alGetBooleanv', 'alGetIntegerv', 'alGetFloatv',
+ 'alGetDoublev', 'alGetBoolean', 'alGetInteger', 'alGetFloat', 'alGetDouble',
+ 'alGetError', 'alIsExtensionPresent', 'alGetProcAddress', 'alGetEnumValue',
+ 'alListenerf', 'alListener3f', 'alListenerfv', 'alListeneri', 'alListener3i',
+ 'alListeneriv', 'alGetListenerf', 'alGetListener3f', 'alGetListenerfv',
+ 'alGetListeneri', 'alGetListener3i', 'alGetListeneriv', 'alGenSources',
+ 'alDeleteSources', 'alIsSource', 'alSourcef', 'alSource3f', 'alSourcefv',
+ 'alSourcei', 'alSource3i', 'alSourceiv', 'alGetSourcef', 'alGetSource3f',
+ 'alGetSourcefv', 'alGetSourcei', 'alGetSource3i', 'alGetSourceiv',
+ 'alSourcePlayv', 'alSourceStopv', 'alSourceRewindv', 'alSourcePausev',
+ 'alSourcePlay', 'alSourceStop', 'alSourceRewind', 'alSourcePause',
+ 'alSourceQueueBuffers', 'alSourceUnqueueBuffers', 'alGenBuffers',
+ 'alDeleteBuffers', 'alIsBuffer', 'alBufferData', 'alBufferf', 'alBuffer3f',
+ 'alBufferfv', 'alBufferi', 'alBuffer3i', 'alBufferiv', 'alGetBufferf',
+ 'alGetBuffer3f', 'alGetBufferfv', 'alGetBufferi', 'alGetBuffer3i',
+ 'alGetBufferiv', 'alDopplerFactor', 'alDopplerVelocity', 'alSpeedOfSound',
+ 'alDistanceModel', 'LPALENABLE', 'LPALDISABLE', 'LPALISENABLED',
+ 'LPALGETSTRING', 'LPALGETBOOLEANV', 'LPALGETINTEGERV', 'LPALGETFLOATV',
+ 'LPALGETDOUBLEV', 'LPALGETBOOLEAN', 'LPALGETINTEGER', 'LPALGETFLOAT',
+ 'LPALGETDOUBLE', 'LPALGETERROR', 'LPALISEXTENSIONPRESENT',
+ 'LPALGETPROCADDRESS', 'LPALGETENUMVALUE', 'LPALLISTENERF', 'LPALLISTENER3F',
+ 'LPALLISTENERFV', 'LPALLISTENERI', 'LPALLISTENER3I', 'LPALLISTENERIV',
+ 'LPALGETLISTENERF', 'LPALGETLISTENER3F', 'LPALGETLISTENERFV',
+ 'LPALGETLISTENERI', 'LPALGETLISTENER3I', 'LPALGETLISTENERIV',
+ 'LPALGENSOURCES', 'LPALDELETESOURCES', 'LPALISSOURCE', 'LPALSOURCEF',
+ 'LPALSOURCE3F', 'LPALSOURCEFV', 'LPALSOURCEI', 'LPALSOURCE3I', 'LPALSOURCEIV',
+ 'LPALGETSOURCEF', 'LPALGETSOURCE3F', 'LPALGETSOURCEFV', 'LPALGETSOURCEI',
+ 'LPALGETSOURCE3I', 'LPALGETSOURCEIV', 'LPALSOURCEPLAYV', 'LPALSOURCESTOPV',
+ 'LPALSOURCEREWINDV', 'LPALSOURCEPAUSEV', 'LPALSOURCEPLAY', 'LPALSOURCESTOP',
+ 'LPALSOURCEREWIND', 'LPALSOURCEPAUSE', 'LPALSOURCEQUEUEBUFFERS',
+ 'LPALSOURCEUNQUEUEBUFFERS', 'LPALGENBUFFERS', 'LPALDELETEBUFFERS',
+ 'LPALISBUFFER', 'LPALBUFFERDATA', 'LPALBUFFERF', 'LPALBUFFER3F',
+ 'LPALBUFFERFV', 'LPALBUFFERI', 'LPALBUFFER3I', 'LPALBUFFERIV',
+ 'LPALGETBUFFERF', 'LPALGETBUFFER3F', 'LPALGETBUFFERFV', 'LPALGETBUFFERI',
+ 'LPALGETBUFFER3I', 'LPALGETBUFFERIV', 'LPALDOPPLERFACTOR',
+ 'LPALDOPPLERVELOCITY', 'LPALSPEEDOFSOUND', 'LPALDISTANCEMODEL']
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/pulse/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/pulse/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..20c28453ebd7c163a70406e6e0e8f4b70bd17bcc
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/pulse/__init__.py
@@ -0,0 +1,13 @@
+from .adaptation import PulseAudioDriver
+
+import pyglet
+
+_debug = pyglet.options['debug_media']
+
+
+def create_audio_driver():
+ driver = PulseAudioDriver()
+ driver.connect()
+ if _debug:
+ driver.dump_debug_info()
+ return driver
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/pulse/adaptation.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/pulse/adaptation.py
new file mode 100644
index 0000000000000000000000000000000000000000..5b85114e5bfa84a933bbd2e1722c8797c8658e71
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/pulse/adaptation.py
@@ -0,0 +1,386 @@
+import weakref
+
+from pyglet.media.drivers.base import AbstractAudioDriver, AbstractAudioPlayer, MediaEvent
+from pyglet.media.drivers.listener import AbstractListener
+from pyglet.util import debug_print
+
+from . import lib_pulseaudio as pa
+from .interface import PulseAudioMainLoop
+
+
+_debug = debug_print('debug_media')
+
+
+class PulseAudioDriver(AbstractAudioDriver):
+ def __init__(self):
+ self.mainloop = PulseAudioMainLoop()
+ self.mainloop.start()
+ self.lock = self.mainloop
+ self.context = None
+
+ self._players = weakref.WeakSet()
+ self._listener = PulseAudioListener(self)
+
+ def __del__(self):
+ self.delete()
+
+ def create_audio_player(self, source, player):
+ assert self.context is not None
+ player = PulseAudioPlayer(source, player, self)
+ self._players.add(player)
+ return player
+
+ def connect(self, server=None):
+ """Connect to pulseaudio server.
+
+ :Parameters:
+ `server` : str
+ Server to connect to, or ``None`` for the default local
+ server (which may be spawned as a daemon if no server is
+ found).
+ """
+ # TODO disconnect from old
+ assert not self.context, 'Already connected'
+
+ self.context = self.mainloop.create_context()
+ self.context.connect(server)
+
+ def dump_debug_info(self):
+ print('Client version: ', pa.pa_get_library_version())
+ print('Server: ', self.context.server)
+ print('Protocol: ', self.context.protocol_version)
+ print('Server protocol:', self.context.server_protocol_version)
+ print('Local context: ', self.context.is_local and 'Yes' or 'No')
+
+ def delete(self):
+ """Completely shut down pulseaudio client."""
+ if self.mainloop is not None:
+
+ with self.mainloop:
+ if self.context is not None:
+ self.context.delete()
+ self.context = None
+
+ if self.mainloop is not None:
+ self.mainloop.delete()
+ self.mainloop = None
+ self.lock = None
+
+ def get_listener(self):
+ return self._listener
+
+
+class PulseAudioListener(AbstractListener):
+ def __init__(self, driver):
+ self.driver = weakref.proxy(driver)
+
+ def _set_volume(self, volume):
+ self._volume = volume
+ for player in self.driver._players:
+ player.set_volume(player._volume)
+
+ def _set_position(self, position):
+ self._position = position
+
+ def _set_forward_orientation(self, orientation):
+ self._forward_orientation = orientation
+
+ def _set_up_orientation(self, orientation):
+ self._up_orientation = orientation
+
+
+class PulseAudioPlayer(AbstractAudioPlayer):
+ _volume = 1.0
+
+ def __init__(self, source, player, driver):
+ super(PulseAudioPlayer, self).__init__(source, player)
+ self.driver = weakref.ref(driver)
+
+ self._events = []
+ self._timestamps = [] # List of (ref_time, timestamp)
+ self._write_index = 0 # Current write index (tracked manually)
+ self._read_index_valid = False # True only if buffer has non-stale data
+
+ self._clear_write = False
+ self._buffered_audio_data = None
+ self._playing = False
+
+ self._current_audio_data = None
+
+ self._time_sync_operation = None
+
+ audio_format = source.audio_format
+ assert audio_format
+
+ with driver.mainloop:
+ self.stream = driver.context.create_stream(audio_format)
+ self.stream.push_handlers(self)
+ self.stream.connect_playback()
+ assert self.stream.is_ready
+
+ assert _debug('PulseAudioPlayer: __init__ finished')
+
+ def on_write_needed(self, nbytes, underflow):
+ if underflow:
+ self._handle_underflow()
+ else:
+ self._write_to_stream(nbytes)
+
+ # Asynchronously update time
+ if self._events:
+ if self._time_sync_operation is not None and self._time_sync_operation.is_done:
+ self._time_sync_operation.delete()
+ self._time_sync_operation = None
+ if self._time_sync_operation is None:
+ assert _debug('PulseAudioPlayer: trigger timing info update')
+ self._time_sync_operation = self.stream.update_timing_info(self._process_events)
+
+ def _get_audio_data(self, nbytes=None):
+ if self._current_audio_data is None and self.source is not None:
+ # Always try to buffer at least 1 second of audio data
+ min_bytes = 1 * self.source.audio_format.bytes_per_second
+ if nbytes is None:
+ nbytes = min_bytes
+ else:
+ nbytes = min(min_bytes, nbytes)
+ assert _debug('PulseAudioPlayer: Try to get {} bytes of audio data'.format(nbytes))
+ compensation_time = self.get_audio_time_diff()
+ self._current_audio_data = self.source.get_audio_data(nbytes, compensation_time)
+ self._schedule_events()
+ if self._current_audio_data is None:
+ assert _debug('PulseAudioPlayer: No audio data available')
+ else:
+ assert _debug('PulseAudioPlayer: Got {} bytes of audio data'.format(
+ self._current_audio_data.length))
+ return self._current_audio_data
+
+ def _has_audio_data(self):
+ return self._get_audio_data() is not None
+
+ def _consume_audio_data(self, nbytes):
+ if self._current_audio_data is not None:
+ if nbytes == self._current_audio_data.length:
+ self._current_audio_data = None
+ else:
+ self._current_audio_data.consume(nbytes, self.source.audio_format)
+
+ def _schedule_events(self):
+ if self._current_audio_data is not None:
+ for event in self._current_audio_data.events:
+ event_index = self._write_index + event.timestamp * \
+ self.source.audio_format.bytes_per_second
+ assert _debug('PulseAudioPlayer: Schedule event at index {}'.format(event_index))
+ self._events.append((event_index, event))
+
+ def _write_to_stream(self, nbytes=None):
+ if nbytes is None:
+ nbytes = self.stream.writable_size
+ assert _debug(f'PulseAudioPlayer: Requested to write {nbytes} bytes to stream')
+
+ seek_mode = pa.PA_SEEK_RELATIVE
+ if self._clear_write:
+ # When seeking, the stream.writable_size will be 0.
+ # So we force at least 4096 bytes to overwrite the Buffer
+ # starting at read index
+ nbytes = max(4096, nbytes)
+ seek_mode = pa.PA_SEEK_RELATIVE_ON_READ
+ self._clear_write = False
+ assert _debug('PulseAudioPlayer: Clear buffer')
+
+ while self._has_audio_data() and nbytes > 0:
+ audio_data = self._get_audio_data()
+
+ write_length = min(nbytes, audio_data.length)
+ consumption = self.stream.write(audio_data, write_length, seek_mode)
+
+ seek_mode = pa.PA_SEEK_RELATIVE
+ self._read_index_valid = True
+ self._timestamps.append((self._write_index, audio_data.timestamp))
+ self._write_index += consumption
+
+ assert _debug('PulseAudioPlayer: Actually wrote {} bytes '
+ 'to stream'.format(consumption))
+ self._consume_audio_data(consumption)
+
+ nbytes -= consumption
+
+ if not self._has_audio_data():
+ # In case the source group wasn't long enough to prebuffer stream
+ # to PA's satisfaction, trigger immediate playback (has no effect
+ # if stream is already playing).
+ if self._playing:
+ op = self.stream.trigger()
+ op.delete() # Explicit delete to prevent locking
+
+ def _handle_underflow(self):
+ assert _debug('Player: underflow')
+ if self._has_audio_data():
+ self._write_to_stream()
+ else:
+ self._add_event_at_write_index('on_eos')
+
+ def _process_events(self):
+ assert _debug('PulseAudioPlayer: Process events')
+ if not self._events:
+ assert _debug('PulseAudioPlayer: No events')
+ return
+
+ # Assume this is called after time sync
+ timing_info = self.stream.get_timing_info()
+ if not timing_info:
+ assert _debug('PulseAudioPlayer: No timing info to process events')
+ return
+
+ read_index = timing_info.read_index
+ assert _debug('PulseAudioPlayer: Dispatch events at index {}'.format(read_index))
+
+ while self._events and self._events[0][0] <= read_index:
+ _, event = self._events.pop(0)
+ assert _debug('PulseAudioPlayer: Dispatch event', event)
+ event._sync_dispatch_to_player(self.player)
+
+ def _add_event_at_write_index(self, event_name):
+ assert _debug('PulseAudioPlayer: Add event at index {}'.format(self._write_index))
+ self._events.append((self._write_index, MediaEvent(event_name)))
+
+ def delete(self):
+ assert _debug('Delete PulseAudioPlayer')
+
+ self.stream.pop_handlers()
+ driver = self.driver()
+ if driver is None:
+ assert _debug('PulseAudioDriver has been garbage collected.')
+ self.stream = None
+ return
+
+ if driver.mainloop is None:
+ assert _debug('PulseAudioDriver already deleted. '
+ 'PulseAudioPlayer could not clean up properly.')
+ return
+
+ if self._time_sync_operation is not None:
+ with self._time_sync_operation:
+ self._time_sync_operation.delete()
+ self._time_sync_operation = None
+
+ self.stream.delete()
+ self.stream = None
+
+ def clear(self):
+ assert _debug('PulseAudioPlayer.clear')
+ super(PulseAudioPlayer, self).clear()
+ self._clear_write = True
+ self._write_index = self._get_read_index()
+ self._timestamps = []
+ self._events = []
+
+ with self.stream:
+ self._read_index_valid = False
+ self.stream.prebuf().wait()
+
+ def play(self):
+ assert _debug('PulseAudioPlayer.play')
+
+ with self.stream:
+ if self.stream.is_corked:
+ self.stream.resume().wait().delete()
+ assert _debug('PulseAudioPlayer: Resumed playback')
+ if self.stream.underflow:
+ self._write_to_stream()
+ if not self._has_audio_data():
+ self.stream.trigger().wait().delete()
+ assert _debug('PulseAudioPlayer: Triggered stream for immediate playback')
+ assert not self.stream.is_corked
+
+ self._playing = True
+
+ def stop(self):
+ assert _debug('PulseAudioPlayer.stop')
+
+ with self.stream:
+ if not self.stream.is_corked:
+ self.stream.pause().wait().delete()
+
+ self._playing = False
+
+ def _get_read_index(self):
+ with self.stream:
+ self.stream.update_timing_info().wait().delete()
+
+ timing_info = self.stream.get_timing_info()
+ if timing_info:
+ read_index = timing_info.read_index
+ else:
+ read_index = 0
+
+ assert _debug('_get_read_index ->', read_index)
+ return read_index
+
+ def _get_write_index(self):
+ timing_info = self.stream.get_timing_info()
+ if timing_info:
+ write_index = timing_info.write_index
+ else:
+ write_index = 0
+
+ assert _debug('_get_write_index ->', write_index)
+ return write_index
+
+ def _get_timing_info(self):
+ with self.stream:
+ self.stream.update_timing_info().wait().delete()
+
+ timing_info = self.stream.get_timing_info()
+ return timing_info
+
+ def get_time(self):
+ if not self._read_index_valid:
+ assert _debug('get_time <_read_index_valid = False> -> 0')
+ return 0
+
+ t_info = self._get_timing_info()
+ read_index = t_info.read_index
+ transport_usec = t_info.transport_usec
+ sink_usec = t_info.sink_usec
+
+ write_index = 0
+ timestamp = 0.0
+
+ try:
+ write_index, timestamp = self._timestamps[0]
+ write_index, timestamp = self._timestamps[1]
+ while read_index >= write_index:
+ del self._timestamps[0]
+ write_index, timestamp = self._timestamps[1]
+ except IndexError:
+ pass
+
+ bytes_per_second = self.source.audio_format.bytes_per_second
+ dt = (read_index - write_index) / float(bytes_per_second) * 1000000
+ # We add 2x the transport time because we didn't take it into account
+ # when we wrote the write index the first time. See _write_to_stream
+ dt += t_info.transport_usec * 2
+ dt -= t_info.sink_usec
+ # We convert back to seconds
+ dt /= 1000000
+ time = timestamp + dt
+
+ assert _debug('get_time ->', time)
+ return time
+
+ def set_volume(self, volume):
+ self._volume = volume
+
+ if self.stream:
+ driver = self.driver()
+ volume *= driver._listener._volume
+ with driver.context:
+ driver.context.set_input_volume(self.stream, volume).wait()
+
+ def set_pitch(self, pitch):
+ sample_rate = self.stream.audio_format.rate
+ with self.stream:
+ self.stream.update_sample_rate(int(pitch * sample_rate)).wait()
+
+ def prefill_audio(self):
+ self._write_to_stream(nbytes=None)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/pulse/interface.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/pulse/interface.py
new file mode 100644
index 0000000000000000000000000000000000000000..7d569bdb507258f9e0e8bf646661f0febc9f57d5
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/pulse/interface.py
@@ -0,0 +1,700 @@
+import sys
+import weakref
+
+from . import lib_pulseaudio as pa
+from pyglet.media.exceptions import MediaException
+from pyglet.util import debug_print
+
+import pyglet
+_debug = debug_print('debug_media')
+
+
+def get_uint32_or_none(value):
+ # Check for max uint32
+ if value is None or value == 4294967295:
+ return None
+ return value
+
+
+def get_bool_or_none(value):
+ if value < 0:
+ return None
+ elif value == 1:
+ return True
+ else:
+ return False
+
+
+def get_ascii_str_or_none(value):
+ if value is not None:
+ return value.decode('ascii')
+ return None
+
+
+class PulseAudioException(MediaException):
+ def __init__(self, error_code, message):
+ super(PulseAudioException, self).__init__(message)
+ self.error_code = error_code
+ self.message = message
+
+ def __str__(self):
+ return '{}: [{}] {}'.format(self.__class__.__name__, self.error_code, self.message)
+
+ __repr__ = __str__
+
+
+class PulseAudioMainLoop:
+ def __init__(self):
+ self._pa_threaded_mainloop = pa.pa_threaded_mainloop_new()
+ self._pa_mainloop = pa.pa_threaded_mainloop_get_api(self._pa_threaded_mainloop)
+ self._lock_count = 0
+
+ def __del__(self):
+ self.delete()
+
+ def start(self):
+ """Start running the mainloop."""
+ with self:
+ result = pa.pa_threaded_mainloop_start(self._pa_threaded_mainloop)
+ if result < 0:
+ raise PulseAudioException(0, "Failed to start PulseAudio mainloop")
+ assert _debug('PulseAudioMainLoop: Started')
+
+ def delete(self):
+ """Clean up the mainloop."""
+ if self._pa_threaded_mainloop is not None:
+ assert _debug("Delete PulseAudioMainLoop")
+ pa.pa_threaded_mainloop_stop(self._pa_threaded_mainloop)
+ pa.pa_threaded_mainloop_free(self._pa_threaded_mainloop)
+ self._pa_threaded_mainloop = None
+ self._pa_mainloop = None
+
+ def lock(self):
+ """Lock the threaded mainloop against events. Required for all
+ calls into PA."""
+ assert self._pa_threaded_mainloop is not None
+ pa.pa_threaded_mainloop_lock(self._pa_threaded_mainloop)
+ self._lock_count += 1
+
+ def unlock(self):
+ """Unlock the mainloop thread."""
+ assert self._pa_threaded_mainloop is not None
+ # TODO: This is not completely safe. Unlock might be called without lock.
+ assert self._lock_count > 0
+ self._lock_count -= 1
+ pa.pa_threaded_mainloop_unlock(self._pa_threaded_mainloop)
+
+ def signal(self):
+ """Signal the mainloop thread to break from a wait."""
+ assert self._pa_threaded_mainloop is not None
+ pa.pa_threaded_mainloop_signal(self._pa_threaded_mainloop, 0)
+
+ def wait(self):
+ """Wait for a signal."""
+ assert self._pa_threaded_mainloop is not None
+ # Although lock and unlock can be called reentrantly, the wait call only releases one lock.
+ assert self._lock_count > 0
+ original_lock_count = self._lock_count
+ while self._lock_count > 1:
+ self.unlock()
+ pa.pa_threaded_mainloop_wait(self._pa_threaded_mainloop)
+ while self._lock_count < original_lock_count:
+ self.lock()
+
+ def create_context(self):
+ return PulseAudioContext(self, self._context_new())
+
+ def _context_new(self):
+ """Construct a new context in this mainloop."""
+ assert self._pa_mainloop is not None
+ app_name = self._get_app_name()
+ context = pa.pa_context_new(self._pa_mainloop,
+ app_name.encode('ASCII')
+ )
+ return context
+
+ def _get_app_name(self):
+ """Get the application name as advertised to the pulseaudio server."""
+ # TODO move app name into pyglet.app (also useful for OS X menu bar?).
+ return sys.argv[0]
+
+ def __enter__(self):
+ self.lock()
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ self.unlock()
+
+
+class PulseAudioLockable:
+ def __init__(self, mainloop):
+ assert mainloop is not None
+ self.mainloop = weakref.ref(mainloop)
+
+ def lock(self):
+ """Lock the threaded mainloop against events. Required for all
+ calls into PA."""
+ self.mainloop().lock()
+
+ def unlock(self):
+ """Unlock the mainloop thread."""
+ self.mainloop().unlock()
+
+ def signal(self):
+ """Signal the mainloop thread to break from a wait."""
+ self.mainloop().signal()
+
+ def wait(self):
+ """Wait for a signal."""
+ self.mainloop().wait()
+
+ def __enter__(self):
+ self.lock()
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ self.unlock()
+
+
+class PulseAudioContext(PulseAudioLockable):
+ """Basic object for a connection to a PulseAudio server."""
+ _state_name = {pa.PA_CONTEXT_UNCONNECTED: 'Unconnected',
+ pa.PA_CONTEXT_CONNECTING: 'Connecting',
+ pa.PA_CONTEXT_AUTHORIZING: 'Authorizing',
+ pa.PA_CONTEXT_SETTING_NAME: 'Setting Name',
+ pa.PA_CONTEXT_READY: 'Ready',
+ pa.PA_CONTEXT_FAILED: 'Failed',
+ pa.PA_CONTEXT_TERMINATED: 'Terminated'}
+
+ def __init__(self, mainloop, pa_context):
+ super(PulseAudioContext, self).__init__(mainloop)
+ self._pa_context = pa_context
+ self.state = None
+
+ self._connect_callbacks()
+
+ def __del__(self):
+ if self._pa_context is not None:
+ with self:
+ self.delete()
+
+ def delete(self):
+ """Completely shut down pulseaudio client."""
+ if self._pa_context is not None:
+ assert _debug("PulseAudioContext.delete")
+ if self.is_ready:
+ pa.pa_context_disconnect(self._pa_context)
+
+ while self.state is not None and not self.is_terminated:
+ self.wait()
+
+ self._disconnect_callbacks()
+ pa.pa_context_unref(self._pa_context)
+ self._pa_context = None
+
+ @property
+ def is_ready(self):
+ return self.state == pa.PA_CONTEXT_READY
+
+ @property
+ def is_failed(self):
+ return self.state == pa.PA_CONTEXT_FAILED
+
+ @property
+ def is_terminated(self):
+ return self.state == pa.PA_CONTEXT_TERMINATED
+
+ @property
+ def server(self):
+ if self.is_ready:
+ return get_ascii_str_or_none(pa.pa_context_get_server(self._pa_context))
+ else:
+ return None
+
+ @property
+ def protocol_version(self):
+ if self._pa_context is not None:
+ return get_uint32_or_none(pa.pa_context_get_protocol_version(self._pa_context))
+
+ @property
+ def server_protocol_version(self):
+ if self._pa_context is not None:
+ return get_uint32_or_none(pa.pa_context_get_server_protocol_version(self._pa_context))
+
+ @property
+ def is_local(self):
+ if self._pa_context is not None:
+ return get_bool_or_none(pa.pa_context_is_local(self._pa_context))
+
+ def connect(self, server=None):
+ """Connect the context to a PulseAudio server.
+
+ :Parameters:
+ `server` : str
+ Server to connect to, or ``None`` for the default local
+ server (which may be spawned as a daemon if no server is
+ found).
+ """
+ assert self._pa_context is not None
+ self.state = None
+
+ with self:
+ self.check(
+ pa.pa_context_connect(self._pa_context, server, 0, None)
+ )
+ while not self.is_failed and not self.is_ready:
+ self.wait()
+
+ if self.is_failed:
+ self.raise_error()
+
+ def create_stream(self, audio_format):
+ """
+ Create a new audio stream.
+ """
+ mainloop = self.mainloop()
+ assert mainloop is not None
+ assert self.is_ready
+
+ sample_spec = self.create_sample_spec(audio_format)
+ channel_map = None
+
+ # TODO It is now recommended to use pa_stream_new_with_proplist()
+ stream = pa.pa_stream_new(self._pa_context,
+ str(id(self)).encode('ASCII'),
+ sample_spec,
+ channel_map)
+ self.check_not_null(stream)
+ return PulseAudioStream(mainloop, self, stream)
+
+ def create_sample_spec(self, audio_format):
+ """
+ Create a PulseAudio sample spec from pyglet audio format.
+ """
+ sample_spec = pa.pa_sample_spec()
+ if audio_format.sample_size == 8:
+ sample_spec.format = pa.PA_SAMPLE_U8
+ elif audio_format.sample_size == 16:
+ if sys.byteorder == 'little':
+ sample_spec.format = pa.PA_SAMPLE_S16LE
+ else:
+ sample_spec.format = pa.PA_SAMPLE_S16BE
+ elif audio_format.sample_size == 24:
+ if sys.byteorder == 'little':
+ sample_spec.format = pa.PA_SAMPLE_S24LE
+ else:
+ sample_spec.format = pa.PA_SAMPLE_S24BE
+ else:
+ raise MediaException('Unsupported sample size')
+ sample_spec.rate = audio_format.sample_rate
+ sample_spec.channels = audio_format.channels
+ return sample_spec
+
+ def set_input_volume(self, stream, volume):
+ """
+ Set the volume for a stream.
+ """
+ cvolume = self._get_cvolume_from_linear(stream, volume)
+ idx = stream.index
+ op = PulseAudioOperation(self, succes_cb_t=pa.pa_context_success_cb_t)
+ op.execute(
+ pa.pa_context_set_sink_input_volume(self._pa_context,
+ idx,
+ cvolume,
+ op.pa_callback,
+ None)
+ )
+ return op
+
+ def _get_cvolume_from_linear(self, stream, volume):
+ cvolume = pa.pa_cvolume()
+ volume = pa.pa_sw_volume_from_linear(volume)
+ pa.pa_cvolume_set(cvolume,
+ stream.audio_format.channels,
+ volume)
+ return cvolume
+
+ def _connect_callbacks(self):
+ self._state_cb_func = pa.pa_context_notify_cb_t(self._state_callback)
+ pa.pa_context_set_state_callback(self._pa_context,
+ self._state_cb_func, None)
+
+ def _disconnect_callbacks(self):
+ self._state_cb_func = None
+ pa.pa_context_set_state_callback(self._pa_context,
+ pa.pa_context_notify_cb_t(0),
+ None)
+
+ def _state_callback(self, context, userdata):
+ self.state = pa.pa_context_get_state(self._pa_context)
+ assert _debug('PulseAudioContext: state changed to {}'.format(
+ self._state_name[self.state]))
+ self.signal()
+
+ def check(self, result):
+ if result < 0:
+ self.raise_error()
+ return result
+
+ def check_not_null(self, value):
+ if value is None:
+ self.raise_error()
+ return value
+
+ def check_ptr_not_null(self, value):
+ if not value:
+ self.raise_error()
+ return value
+
+ def raise_error(self):
+ error = pa.pa_context_errno(self._pa_context)
+ raise PulseAudioException(error, get_ascii_str_or_none(pa.pa_strerror(error)))
+
+
+class PulseAudioStream(PulseAudioLockable, pyglet.event.EventDispatcher):
+ """PulseAudio audio stream."""
+
+ _state_name = {pa.PA_STREAM_UNCONNECTED: 'Unconnected',
+ pa.PA_STREAM_CREATING: 'Creating',
+ pa.PA_STREAM_READY: 'Ready',
+ pa.PA_STREAM_FAILED: 'Failed',
+ pa.PA_STREAM_TERMINATED: 'Terminated'}
+
+ def __init__(self, mainloop, context, pa_stream):
+ PulseAudioLockable.__init__(self, mainloop)
+ self._pa_stream = pa_stream
+ self.context = weakref.ref(context)
+ self.state = None
+ self.underflow = False
+
+ pa.pa_stream_ref(self._pa_stream)
+ self._connect_callbacks()
+ self._refresh_state()
+
+ def __del__(self):
+ if self._pa_stream is not None:
+ self.delete()
+
+ def delete(self):
+ context = self.context()
+ if context is None:
+ assert _debug("No active context anymore. Cannot disconnect the stream")
+ self._pa_stream = None
+ return
+
+ if self._pa_stream is None:
+ assert _debug("No stream to delete.")
+ return
+
+ assert _debug("Delete PulseAudioStream")
+ if not self.is_unconnected:
+ assert _debug("PulseAudioStream: disconnecting")
+
+ with self:
+ context.check(
+ pa.pa_stream_disconnect(self._pa_stream)
+ )
+ while not (self.is_terminated or self.is_failed):
+ self.wait()
+
+ self._disconnect_callbacks()
+ pa.pa_stream_unref(self._pa_stream)
+ self._pa_stream = None
+
+ @property
+ def is_unconnected(self):
+ return self.state == pa.PA_STREAM_UNCONNECTED
+
+ @property
+ def is_creating(self):
+ return self.state == pa.PA_STREAM_CREATING
+
+ @property
+ def is_ready(self):
+ return self.state == pa.PA_STREAM_READY
+
+ @property
+ def is_failed(self):
+ return self.state == pa.PA_STREAM_FAILED
+
+ @property
+ def is_terminated(self):
+ return self.state == pa.PA_STREAM_TERMINATED
+
+ @property
+ def writable_size(self):
+ assert self._pa_stream is not None
+ return pa.pa_stream_writable_size(self._pa_stream)
+
+ @property
+ def index(self):
+ assert self._pa_stream is not None
+ return pa.pa_stream_get_index(self._pa_stream)
+
+ @property
+ def is_corked(self):
+ assert self._pa_stream is not None
+ return get_bool_or_none(pa.pa_stream_is_corked(self._pa_stream))
+
+ @property
+ def audio_format(self):
+ assert self._pa_stream is not None
+ return pa.pa_stream_get_sample_spec(self._pa_stream)[0]
+
+ def connect_playback(self):
+ context = self.context()
+ assert self._pa_stream is not None
+ assert context is not None
+ device = None
+ buffer_attr = None
+ flags = (pa.PA_STREAM_START_CORKED |
+ pa.PA_STREAM_INTERPOLATE_TIMING |
+ pa.PA_STREAM_VARIABLE_RATE)
+ volume = None
+ sync_stream = None # TODO use this
+
+ context.check(
+ pa.pa_stream_connect_playback(self._pa_stream,
+ device,
+ buffer_attr,
+ flags,
+ volume,
+ sync_stream)
+ )
+
+ while not self.is_ready and not self.is_failed:
+ self.wait()
+ if not self.is_ready:
+ context.raise_error()
+ assert _debug('PulseAudioStream: Playback connected')
+
+ def write(self, audio_data, length=None, seek_mode=pa.PA_SEEK_RELATIVE):
+ context = self.context()
+ assert context is not None
+ assert self._pa_stream is not None
+ assert self.is_ready
+ if length is None:
+ length = min(audio_data.length, self.writable_size)
+ assert _debug('PulseAudioStream: writing {} bytes'.format(length))
+ assert _debug('PulseAudioStream: writable size before write {} bytes'.format(self.writable_size))
+ context.check(
+ pa.pa_stream_write(self._pa_stream,
+ audio_data.data,
+ length,
+ pa.pa_free_cb_t(0), # Data is copied
+ 0,
+ seek_mode)
+ )
+ assert _debug('PulseAudioStream: writable size after write {} bytes'.format(self.writable_size))
+ self.underflow = False
+ return length
+
+ def update_timing_info(self, callback=None):
+ context = self.context()
+ assert context is not None
+ assert self._pa_stream is not None
+ op = PulseAudioOperation(context, callback)
+ op.execute(
+ pa.pa_stream_update_timing_info(self._pa_stream,
+ op.pa_callback,
+ None)
+ )
+ return op
+
+ def get_timing_info(self):
+ context = self.context()
+ assert context is not None
+ assert self._pa_stream is not None
+ timing_info = context.check_ptr_not_null(
+ pa.pa_stream_get_timing_info(self._pa_stream)
+ )
+ return timing_info.contents
+
+ def trigger(self, callback=None):
+ context = self.context()
+ assert context is not None
+ assert self._pa_stream is not None
+ op = PulseAudioOperation(context)
+ op.execute(
+ pa.pa_stream_trigger(self._pa_stream,
+ op.pa_callback,
+ None)
+ )
+ return op
+
+ def prebuf(self, callback=None):
+ context = self.context()
+ assert context is not None
+ assert self._pa_stream is not None
+ op = PulseAudioOperation(context)
+ op.execute(
+ pa.pa_stream_prebuf(self._pa_stream,
+ op.pa_callback,
+ None)
+ )
+ return op
+
+ def resume(self, callback=None):
+ return self._cork(False, callback)
+
+ def pause(self, callback=None):
+ return self._cork(True, callback)
+
+ def update_sample_rate(self, sample_rate, callback=None):
+ context = self.context()
+ assert context is not None
+ assert self._pa_stream is not None
+ op = PulseAudioOperation(context)
+ op.execute(
+ pa.pa_stream_update_sample_rate(self._pa_stream,
+ int(sample_rate),
+ op.pa_callback,
+ None)
+ )
+ return op
+
+ def _cork(self, pause, callback):
+ context = self.context()
+ assert context is not None
+ assert self._pa_stream is not None
+ op = PulseAudioOperation(context)
+ op.execute(
+ pa.pa_stream_cork(self._pa_stream,
+ 1 if pause else 0,
+ op.pa_callback,
+ None)
+ )
+ return op
+
+ def _connect_callbacks(self):
+ self._cb_underflow = pa.pa_stream_notify_cb_t(self._underflow_callback)
+ self._cb_write = pa.pa_stream_request_cb_t(self._write_callback)
+ self._cb_state = pa.pa_stream_notify_cb_t(self._state_callback)
+
+ pa.pa_stream_set_underflow_callback(self._pa_stream, self._cb_underflow, None)
+ pa.pa_stream_set_write_callback(self._pa_stream, self._cb_write, None)
+ pa.pa_stream_set_state_callback(self._pa_stream, self._cb_state, None)
+
+ def _disconnect_callbacks(self):
+ self._cb_underflow = None
+ self._cb_write = None
+ self._cb_state = None
+
+ pa.pa_stream_set_underflow_callback(self._pa_stream,
+ pa.pa_stream_notify_cb_t(0),
+ None)
+ pa.pa_stream_set_write_callback(self._pa_stream,
+ pa.pa_stream_request_cb_t(0),
+ None)
+ pa.pa_stream_set_state_callback(self._pa_stream,
+ pa.pa_stream_notify_cb_t(0),
+ None)
+
+ def _underflow_callback(self, stream, userdata):
+ assert _debug("PulseAudioStream: underflow")
+ self.underflow = True
+ self._write_needed()
+ self.signal()
+
+ def _write_callback(self, stream, nbytes, userdata):
+ assert _debug("PulseAudioStream: write requested")
+ self._write_needed(nbytes)
+ self.signal()
+
+ def _state_callback(self, stream, userdata):
+ self._refresh_state()
+ assert _debug("PulseAudioStream: state changed to {}".format(self._state_name[self.state]))
+ self.signal()
+
+ def _refresh_state(self):
+ if self._pa_stream is not None:
+ self.state = pa.pa_stream_get_state(self._pa_stream)
+
+ def _write_needed(self, nbytes=None):
+ if nbytes is None:
+ nbytes = self.writable_size
+ # This dispatch call is made from the threaded mainloop thread!
+ pyglet.app.platform_event_loop.post_event(
+ self, 'on_write_needed', nbytes, self.underflow)
+
+ def on_write_needed(self, nbytes, underflow):
+ """A write is requested from PulseAudio.
+ Called from the PulseAudio mainloop, so no locking required.
+
+ :event:
+ """
+
+PulseAudioStream.register_event_type('on_write_needed')
+
+
+class PulseAudioOperation(PulseAudioLockable):
+ """Asynchronous PulseAudio operation"""
+
+ _state_name = {pa.PA_OPERATION_RUNNING: 'Running',
+ pa.PA_OPERATION_DONE: 'Done',
+ pa.PA_OPERATION_CANCELLED: 'Cancelled'}
+
+ def __init__(self, context, callback=None, pa_operation=None,
+ succes_cb_t=pa.pa_stream_success_cb_t):
+ mainloop = context.mainloop()
+ assert mainloop is not None
+ PulseAudioLockable.__init__(self, mainloop)
+ self.context = weakref.ref(context)
+ self._callback = callback
+ self.pa_callback = succes_cb_t(self._success_callback)
+ if pa_operation is not None:
+ self.execute(pa_operation)
+ else:
+ self._pa_operation = None
+
+ def __del__(self):
+ if self._pa_operation is not None:
+ with self:
+ self.delete()
+
+ def delete(self):
+ if self._pa_operation is not None:
+ assert _debug("PulseAudioOperation.delete({})".format(id(self)))
+ pa.pa_operation_unref(self._pa_operation)
+ self._pa_operation = None
+
+ def execute(self, pa_operation):
+ context = self.context()
+ assert context is not None
+ context.check_ptr_not_null(pa_operation)
+ assert _debug("PulseAudioOperation.execute({})".format(id(self)))
+ self._pa_operation = pa_operation
+ self._get_state()
+ return self
+
+ def cancel(self):
+ assert self._pa_operation is not None
+ pa.pa_operation_cancel(self._pa_operation)
+ return self
+
+ @property
+ def is_running(self):
+ return self._get_state() == pa.PA_OPERATION_RUNNING
+
+ @property
+ def is_done(self):
+ return self._get_state() == pa.PA_OPERATION_DONE
+
+ @property
+ def is_cancelled(self):
+ return self._get_state() == pa.PA_OPERATION_CANCELLED
+
+ def wait(self):
+ """Wait until operation is either done or cancelled."""
+ while self.is_running:
+ super(PulseAudioOperation, self).wait()
+ return self
+
+ def _get_state(self):
+ assert self._pa_operation is not None
+ return pa.pa_operation_get_state(self._pa_operation)
+
+ def _success_callback(self, stream, success, userdata):
+ if self._callback:
+ self._callback()
+ self.pa_callback = None # Clean up callback, not called anymore
+ self.signal()
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/pulse/lib_pulseaudio.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/pulse/lib_pulseaudio.py
new file mode 100644
index 0000000000000000000000000000000000000000..0b6e559fabb0b1f06dc08fa7fbe469c6f7b93497
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/pulse/lib_pulseaudio.py
@@ -0,0 +1,3057 @@
+"""Wrapper for pulse
+
+Generated with:
+tools/genwrappers.py pulseaudio
+
+Do not modify this file.
+
+IMPORTANT: struct_timeval is incorrectly parsed by tools/genwrappers.py and
+was manually edited in this file.
+"""
+
+import ctypes
+from ctypes import *
+
+import pyglet.lib
+
+_lib = pyglet.lib.load_library('pulse')
+
+_int_types = (c_int16, c_int32)
+if hasattr(ctypes, 'c_int64'):
+ # Some builds of ctypes apparently do not have c_int64
+ # defined; it's a pretty good bet that these builds do not
+ # have 64-bit pointers.
+ _int_types += (ctypes.c_int64,)
+for t in _int_types:
+ if sizeof(t) == sizeof(c_size_t):
+ c_ptrdiff_t = t
+
+
+class c_void(Structure):
+ # c_void_p is a buggy return type, converting to int, so
+ # POINTER(None) == c_void_p is actually written as
+ # POINTER(c_void), so it can be treated as a real pointer.
+ _fields_ = [('dummy', c_int)]
+
+
+# /usr/include/pulse/version.h:40
+pa_get_library_version = _lib.pa_get_library_version
+pa_get_library_version.restype = c_char_p
+pa_get_library_version.argtypes = []
+
+PA_API_VERSION = 12 # /usr/include/pulse/version.h:46
+PA_PROTOCOL_VERSION = 30 # /usr/include/pulse/version.h:50
+PA_MAJOR = 6 # /usr/include/pulse/version.h:53
+PA_MINOR = 0 # /usr/include/pulse/version.h:56
+PA_MICRO = 0 # /usr/include/pulse/version.h:59
+PA_CHANNELS_MAX = 32 # /usr/include/pulse/sample.h:128
+PA_RATE_MAX = 192000 # /usr/include/pulse/sample.h:131
+enum_pa_sample_format = c_int
+PA_SAMPLE_U8 = 0
+PA_SAMPLE_ALAW = 1
+PA_SAMPLE_ULAW = 2
+PA_SAMPLE_S16LE = 3
+PA_SAMPLE_S16BE = 4
+PA_SAMPLE_FLOAT32LE = 5
+PA_SAMPLE_FLOAT32BE = 6
+PA_SAMPLE_S32LE = 7
+PA_SAMPLE_S32BE = 8
+PA_SAMPLE_S24LE = 9
+PA_SAMPLE_S24BE = 10
+PA_SAMPLE_S24_32LE = 11
+PA_SAMPLE_S24_32BE = 12
+PA_SAMPLE_MAX = 13
+PA_SAMPLE_INVALID = -1
+pa_sample_format_t = enum_pa_sample_format # /usr/include/pulse/sample.h:179
+
+
+class struct_pa_sample_spec(Structure):
+ __slots__ = [
+ 'format',
+ 'rate',
+ 'channels',
+ ]
+
+
+struct_pa_sample_spec._fields_ = [
+ ('format', pa_sample_format_t),
+ ('rate', c_uint32),
+ ('channels', c_uint8),
+]
+
+pa_sample_spec = struct_pa_sample_spec # /usr/include/pulse/sample.h:257
+pa_usec_t = c_uint64 # /usr/include/pulse/sample.h:260
+# /usr/include/pulse/sample.h:263
+pa_bytes_per_second = _lib.pa_bytes_per_second
+pa_bytes_per_second.restype = c_size_t
+pa_bytes_per_second.argtypes = [POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:266
+pa_frame_size = _lib.pa_frame_size
+pa_frame_size.restype = c_size_t
+pa_frame_size.argtypes = [POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:269
+pa_sample_size = _lib.pa_sample_size
+pa_sample_size.restype = c_size_t
+pa_sample_size.argtypes = [POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:273
+pa_sample_size_of_format = _lib.pa_sample_size_of_format
+pa_sample_size_of_format.restype = c_size_t
+pa_sample_size_of_format.argtypes = [pa_sample_format_t]
+
+# /usr/include/pulse/sample.h:278
+pa_bytes_to_usec = _lib.pa_bytes_to_usec
+pa_bytes_to_usec.restype = pa_usec_t
+pa_bytes_to_usec.argtypes = [c_uint64, POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:283
+pa_usec_to_bytes = _lib.pa_usec_to_bytes
+pa_usec_to_bytes.restype = c_size_t
+pa_usec_to_bytes.argtypes = [pa_usec_t, POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:288
+pa_sample_spec_init = _lib.pa_sample_spec_init
+pa_sample_spec_init.restype = POINTER(pa_sample_spec)
+pa_sample_spec_init.argtypes = [POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:291
+# pa_sample_format_valid = _lib.pa_sample_format_valid
+# pa_sample_format_valid.restype = c_int
+# pa_sample_format_valid.argtypes = [c_uint]
+
+# /usr/include/pulse/sample.h:294
+# pa_sample_rate_valid = _lib.pa_sample_rate_valid
+# pa_sample_rate_valid.restype = c_int
+# pa_sample_rate_valid.argtypes = [c_uint32]
+
+# /usr/include/pulse/sample.h:298
+# pa_channels_valid = _lib.pa_channels_valid
+# pa_channels_valid.restype = c_int
+# pa_channels_valid.argtypes = [c_uint8]
+
+# /usr/include/pulse/sample.h:301
+pa_sample_spec_valid = _lib.pa_sample_spec_valid
+pa_sample_spec_valid.restype = c_int
+pa_sample_spec_valid.argtypes = [POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:304
+pa_sample_spec_equal = _lib.pa_sample_spec_equal
+pa_sample_spec_equal.restype = c_int
+pa_sample_spec_equal.argtypes = [POINTER(pa_sample_spec), POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/sample.h:307
+pa_sample_format_to_string = _lib.pa_sample_format_to_string
+pa_sample_format_to_string.restype = c_char_p
+pa_sample_format_to_string.argtypes = [pa_sample_format_t]
+
+# /usr/include/pulse/sample.h:310
+pa_parse_sample_format = _lib.pa_parse_sample_format
+pa_parse_sample_format.restype = pa_sample_format_t
+pa_parse_sample_format.argtypes = [c_char_p]
+
+PA_SAMPLE_SPEC_SNPRINT_MAX = 32 # /usr/include/pulse/sample.h:317
+# /usr/include/pulse/sample.h:320
+pa_sample_spec_snprint = _lib.pa_sample_spec_snprint
+pa_sample_spec_snprint.restype = c_char_p
+pa_sample_spec_snprint.argtypes = [c_char_p, c_size_t, POINTER(pa_sample_spec)]
+
+PA_BYTES_SNPRINT_MAX = 11 # /usr/include/pulse/sample.h:327
+# /usr/include/pulse/sample.h:330
+pa_bytes_snprint = _lib.pa_bytes_snprint
+pa_bytes_snprint.restype = c_char_p
+pa_bytes_snprint.argtypes = [c_char_p, c_size_t, c_uint]
+
+# /usr/include/pulse/sample.h:334
+pa_sample_format_is_le = _lib.pa_sample_format_is_le
+pa_sample_format_is_le.restype = c_int
+pa_sample_format_is_le.argtypes = [pa_sample_format_t]
+
+# /usr/include/pulse/sample.h:338
+pa_sample_format_is_be = _lib.pa_sample_format_is_be
+pa_sample_format_is_be.restype = c_int
+pa_sample_format_is_be.argtypes = [pa_sample_format_t]
+
+enum_pa_context_state = c_int
+PA_CONTEXT_UNCONNECTED = 0
+PA_CONTEXT_CONNECTING = 1
+PA_CONTEXT_AUTHORIZING = 2
+PA_CONTEXT_SETTING_NAME = 3
+PA_CONTEXT_READY = 4
+PA_CONTEXT_FAILED = 5
+PA_CONTEXT_TERMINATED = 6
+pa_context_state_t = enum_pa_context_state # /usr/include/pulse/def.h:45
+enum_pa_stream_state = c_int
+PA_STREAM_UNCONNECTED = 0
+PA_STREAM_CREATING = 1
+PA_STREAM_READY = 2
+PA_STREAM_FAILED = 3
+PA_STREAM_TERMINATED = 4
+pa_stream_state_t = enum_pa_stream_state # /usr/include/pulse/def.h:74
+enum_pa_operation_state = c_int
+PA_OPERATION_RUNNING = 0
+PA_OPERATION_DONE = 1
+PA_OPERATION_CANCELLED = 2
+pa_operation_state_t = enum_pa_operation_state # /usr/include/pulse/def.h:102
+enum_pa_context_flags = c_int
+PA_CONTEXT_NOFLAGS = 0
+PA_CONTEXT_NOAUTOSPAWN = 1
+PA_CONTEXT_NOFAIL = 2
+pa_context_flags_t = enum_pa_context_flags # /usr/include/pulse/def.h:122
+enum_pa_direction = c_int
+PA_DIRECTION_OUTPUT = 1
+PA_DIRECTION_INPUT = 2
+pa_direction_t = enum_pa_direction # /usr/include/pulse/def.h:137
+enum_pa_device_type = c_int
+PA_DEVICE_TYPE_SINK = 0
+PA_DEVICE_TYPE_SOURCE = 1
+pa_device_type_t = enum_pa_device_type # /usr/include/pulse/def.h:148
+enum_pa_stream_direction = c_int
+PA_STREAM_NODIRECTION = 0
+PA_STREAM_PLAYBACK = 1
+PA_STREAM_RECORD = 2
+PA_STREAM_UPLOAD = 3
+pa_stream_direction_t = enum_pa_stream_direction # /usr/include/pulse/def.h:161
+enum_pa_stream_flags = c_int
+PA_STREAM_NOFLAGS = 0
+PA_STREAM_START_CORKED = 1
+PA_STREAM_INTERPOLATE_TIMING = 2
+PA_STREAM_NOT_MONOTONIC = 4
+PA_STREAM_AUTO_TIMING_UPDATE = 8
+PA_STREAM_NO_REMAP_CHANNELS = 16
+PA_STREAM_NO_REMIX_CHANNELS = 32
+PA_STREAM_FIX_FORMAT = 64
+PA_STREAM_FIX_RATE = 128
+PA_STREAM_FIX_CHANNELS = 256
+PA_STREAM_DONT_MOVE = 512
+PA_STREAM_VARIABLE_RATE = 1024
+PA_STREAM_PEAK_DETECT = 2048
+PA_STREAM_START_MUTED = 4096
+PA_STREAM_ADJUST_LATENCY = 8192
+PA_STREAM_EARLY_REQUESTS = 16384
+PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND = 32768
+PA_STREAM_START_UNMUTED = 65536
+PA_STREAM_FAIL_ON_SUSPEND = 131072
+PA_STREAM_RELATIVE_VOLUME = 262144
+PA_STREAM_PASSTHROUGH = 524288
+pa_stream_flags_t = enum_pa_stream_flags # /usr/include/pulse/def.h:355
+
+
+class struct_pa_buffer_attr(Structure):
+ __slots__ = [
+ 'maxlength',
+ 'tlength',
+ 'prebuf',
+ 'minreq',
+ 'fragsize',
+ ]
+
+
+struct_pa_buffer_attr._fields_ = [
+ ('maxlength', c_uint32),
+ ('tlength', c_uint32),
+ ('prebuf', c_uint32),
+ ('minreq', c_uint32),
+ ('fragsize', c_uint32),
+]
+
+pa_buffer_attr = struct_pa_buffer_attr # /usr/include/pulse/def.h:452
+enum_pa_error_code = c_int
+PA_OK = 0
+PA_ERR_ACCESS = 1
+PA_ERR_COMMAND = 2
+PA_ERR_INVALID = 3
+PA_ERR_EXIST = 4
+PA_ERR_NOENTITY = 5
+PA_ERR_CONNECTIONREFUSED = 6
+PA_ERR_PROTOCOL = 7
+PA_ERR_TIMEOUT = 8
+PA_ERR_AUTHKEY = 9
+PA_ERR_INTERNAL = 10
+PA_ERR_CONNECTIONTERMINATED = 11
+PA_ERR_KILLED = 12
+PA_ERR_INVALIDSERVER = 13
+PA_ERR_MODINITFAILED = 14
+PA_ERR_BADSTATE = 15
+PA_ERR_NODATA = 16
+PA_ERR_VERSION = 17
+PA_ERR_TOOLARGE = 18
+PA_ERR_NOTSUPPORTED = 19
+PA_ERR_UNKNOWN = 20
+PA_ERR_NOEXTENSION = 21
+PA_ERR_OBSOLETE = 22
+PA_ERR_NOTIMPLEMENTED = 23
+PA_ERR_FORKED = 24
+PA_ERR_IO = 25
+PA_ERR_BUSY = 26
+PA_ERR_MAX = 27
+pa_error_code_t = enum_pa_error_code # /usr/include/pulse/def.h:484
+enum_pa_subscription_mask = c_int
+PA_SUBSCRIPTION_MASK_NULL = 0
+PA_SUBSCRIPTION_MASK_SINK = 1
+PA_SUBSCRIPTION_MASK_SOURCE = 2
+PA_SUBSCRIPTION_MASK_SINK_INPUT = 4
+PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT = 8
+PA_SUBSCRIPTION_MASK_MODULE = 16
+PA_SUBSCRIPTION_MASK_CLIENT = 32
+PA_SUBSCRIPTION_MASK_SAMPLE_CACHE = 64
+PA_SUBSCRIPTION_MASK_SERVER = 128
+PA_SUBSCRIPTION_MASK_AUTOLOAD = 256
+PA_SUBSCRIPTION_MASK_CARD = 512
+PA_SUBSCRIPTION_MASK_ALL = 767
+pa_subscription_mask_t = enum_pa_subscription_mask # /usr/include/pulse/def.h:554
+enum_pa_subscription_event_type = c_int
+PA_SUBSCRIPTION_EVENT_SINK = 0
+PA_SUBSCRIPTION_EVENT_SOURCE = 1
+PA_SUBSCRIPTION_EVENT_SINK_INPUT = 2
+PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT = 3
+PA_SUBSCRIPTION_EVENT_MODULE = 4
+PA_SUBSCRIPTION_EVENT_CLIENT = 5
+PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE = 6
+PA_SUBSCRIPTION_EVENT_SERVER = 7
+PA_SUBSCRIPTION_EVENT_AUTOLOAD = 8
+PA_SUBSCRIPTION_EVENT_CARD = 9
+PA_SUBSCRIPTION_EVENT_FACILITY_MASK = 15
+PA_SUBSCRIPTION_EVENT_NEW = 0
+PA_SUBSCRIPTION_EVENT_CHANGE = 16
+PA_SUBSCRIPTION_EVENT_REMOVE = 32
+PA_SUBSCRIPTION_EVENT_TYPE_MASK = 48
+pa_subscription_event_type_t = enum_pa_subscription_event_type # /usr/include/pulse/def.h:605
+
+
+class struct_pa_timing_info(Structure):
+ __slots__ = [
+ 'timestamp',
+ 'synchronized_clocks',
+ 'sink_usec',
+ 'source_usec',
+ 'transport_usec',
+ 'playing',
+ 'write_index_corrupt',
+ 'write_index',
+ 'read_index_corrupt',
+ 'read_index',
+ 'configured_sink_usec',
+ 'configured_source_usec',
+ 'since_underrun',
+ ]
+
+
+class struct_timeval(Structure):
+ _fields_ = [("tv_sec", c_long),
+ ("tv_usec", c_long)]
+
+
+struct_pa_timing_info._fields_ = [
+ ('timestamp', struct_timeval),
+ ('synchronized_clocks', c_int),
+ ('sink_usec', pa_usec_t),
+ ('source_usec', pa_usec_t),
+ ('transport_usec', pa_usec_t),
+ ('playing', c_int),
+ ('write_index_corrupt', c_int),
+ ('write_index', c_int64),
+ ('read_index_corrupt', c_int),
+ ('read_index', c_int64),
+ ('configured_sink_usec', pa_usec_t),
+ ('configured_source_usec', pa_usec_t),
+ ('since_underrun', c_int64),
+]
+
+pa_timing_info = struct_pa_timing_info # /usr/include/pulse/def.h:725
+
+
+class struct_pa_spawn_api(Structure):
+ __slots__ = [
+ 'prefork',
+ 'postfork',
+ 'atfork',
+ ]
+
+
+struct_pa_spawn_api._fields_ = [
+ ('prefork', POINTER(CFUNCTYPE(None))),
+ ('postfork', POINTER(CFUNCTYPE(None))),
+ ('atfork', POINTER(CFUNCTYPE(None))),
+]
+
+pa_spawn_api = struct_pa_spawn_api # /usr/include/pulse/def.h:749
+enum_pa_seek_mode = c_int
+PA_SEEK_RELATIVE = 0
+PA_SEEK_ABSOLUTE = 1
+PA_SEEK_RELATIVE_ON_READ = 2
+PA_SEEK_RELATIVE_END = 3
+pa_seek_mode_t = enum_pa_seek_mode # /usr/include/pulse/def.h:764
+enum_pa_sink_flags = c_int
+PA_SINK_NOFLAGS = 0
+PA_SINK_HW_VOLUME_CTRL = 1
+PA_SINK_LATENCY = 2
+PA_SINK_HARDWARE = 4
+PA_SINK_NETWORK = 8
+PA_SINK_HW_MUTE_CTRL = 16
+PA_SINK_DECIBEL_VOLUME = 32
+PA_SINK_FLAT_VOLUME = 64
+PA_SINK_DYNAMIC_LATENCY = 128
+PA_SINK_SET_FORMATS = 256
+pa_sink_flags_t = enum_pa_sink_flags # /usr/include/pulse/def.h:829
+enum_pa_sink_state = c_int
+PA_SINK_INVALID_STATE = -1
+PA_SINK_RUNNING = 0
+PA_SINK_IDLE = 1
+PA_SINK_SUSPENDED = 2
+PA_SINK_INIT = -2
+PA_SINK_UNLINKED = -3
+pa_sink_state_t = enum_pa_sink_state # /usr/include/pulse/def.h:875
+enum_pa_source_flags = c_int
+PA_SOURCE_NOFLAGS = 0
+PA_SOURCE_HW_VOLUME_CTRL = 1
+PA_SOURCE_LATENCY = 2
+PA_SOURCE_HARDWARE = 4
+PA_SOURCE_NETWORK = 8
+PA_SOURCE_HW_MUTE_CTRL = 16
+PA_SOURCE_DECIBEL_VOLUME = 32
+PA_SOURCE_DYNAMIC_LATENCY = 64
+PA_SOURCE_FLAT_VOLUME = 128
+pa_source_flags_t = enum_pa_source_flags # /usr/include/pulse/def.h:946
+enum_pa_source_state = c_int
+PA_SOURCE_INVALID_STATE = -1
+PA_SOURCE_RUNNING = 0
+PA_SOURCE_IDLE = 1
+PA_SOURCE_SUSPENDED = 2
+PA_SOURCE_INIT = -2
+PA_SOURCE_UNLINKED = -3
+pa_source_state_t = enum_pa_source_state # /usr/include/pulse/def.h:991
+pa_free_cb_t = CFUNCTYPE(None, POINTER(None)) # /usr/include/pulse/def.h:1014
+enum_pa_port_available = c_int
+PA_PORT_AVAILABLE_UNKNOWN = 0
+PA_PORT_AVAILABLE_NO = 1
+PA_PORT_AVAILABLE_YES = 2
+pa_port_available_t = enum_pa_port_available # /usr/include/pulse/def.h:1040
+
+
+class struct_pa_mainloop_api(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_mainloop_api._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_pa_mainloop_api(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_mainloop_api._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_mainloop_api = struct_pa_mainloop_api # /usr/include/pulse/mainloop-api.h:47
+enum_pa_io_event_flags = c_int
+PA_IO_EVENT_NULL = 0
+PA_IO_EVENT_INPUT = 1
+PA_IO_EVENT_OUTPUT = 2
+PA_IO_EVENT_HANGUP = 4
+PA_IO_EVENT_ERROR = 8
+pa_io_event_flags_t = enum_pa_io_event_flags # /usr/include/pulse/mainloop-api.h:56
+
+
+class struct_pa_io_event(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_io_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_pa_io_event(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_io_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_io_event = struct_pa_io_event # /usr/include/pulse/mainloop-api.h:59
+pa_io_event_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_io_event), c_int, pa_io_event_flags_t,
+ POINTER(None)) # /usr/include/pulse/mainloop-api.h:61
+pa_io_event_destroy_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_io_event),
+ POINTER(None)) # /usr/include/pulse/mainloop-api.h:63
+
+
+class struct_pa_time_event(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_time_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_pa_time_event(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_time_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_time_event = struct_pa_time_event # /usr/include/pulse/mainloop-api.h:66
+
+pa_time_event_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_time_event), POINTER(struct_timeval),
+ POINTER(None)) # /usr/include/pulse/mainloop-api.h:68
+pa_time_event_destroy_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_time_event),
+ POINTER(None)) # /usr/include/pulse/mainloop-api.h:70
+
+
+class struct_pa_defer_event(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_defer_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_pa_defer_event(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_defer_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_defer_event = struct_pa_defer_event # /usr/include/pulse/mainloop-api.h:73
+pa_defer_event_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_defer_event),
+ POINTER(None)) # /usr/include/pulse/mainloop-api.h:75
+pa_defer_event_destroy_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_defer_event),
+ POINTER(None)) # /usr/include/pulse/mainloop-api.h:77
+# /usr/include/pulse/mainloop-api.h:120
+pa_mainloop_api_once = _lib.pa_mainloop_api_once
+pa_mainloop_api_once.restype = None
+pa_mainloop_api_once.argtypes = [POINTER(pa_mainloop_api), CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(None)),
+ POINTER(None)]
+
+enum_pa_channel_position = c_int
+PA_CHANNEL_POSITION_INVALID = -1
+PA_CHANNEL_POSITION_MONO = 0
+PA_CHANNEL_POSITION_FRONT_LEFT = 1
+PA_CHANNEL_POSITION_FRONT_RIGHT = 2
+PA_CHANNEL_POSITION_FRONT_CENTER = 3
+PA_CHANNEL_POSITION_LEFT = 0
+PA_CHANNEL_POSITION_RIGHT = 0
+PA_CHANNEL_POSITION_CENTER = 0
+PA_CHANNEL_POSITION_REAR_CENTER = 1
+PA_CHANNEL_POSITION_REAR_LEFT = 2
+PA_CHANNEL_POSITION_REAR_RIGHT = 3
+PA_CHANNEL_POSITION_LFE = 4
+PA_CHANNEL_POSITION_SUBWOOFER = 0
+PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER = 1
+PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER = 2
+PA_CHANNEL_POSITION_SIDE_LEFT = 3
+PA_CHANNEL_POSITION_SIDE_RIGHT = 4
+PA_CHANNEL_POSITION_AUX0 = 5
+PA_CHANNEL_POSITION_AUX1 = 6
+PA_CHANNEL_POSITION_AUX2 = 7
+PA_CHANNEL_POSITION_AUX3 = 8
+PA_CHANNEL_POSITION_AUX4 = 9
+PA_CHANNEL_POSITION_AUX5 = 10
+PA_CHANNEL_POSITION_AUX6 = 11
+PA_CHANNEL_POSITION_AUX7 = 12
+PA_CHANNEL_POSITION_AUX8 = 13
+PA_CHANNEL_POSITION_AUX9 = 14
+PA_CHANNEL_POSITION_AUX10 = 15
+PA_CHANNEL_POSITION_AUX11 = 16
+PA_CHANNEL_POSITION_AUX12 = 17
+PA_CHANNEL_POSITION_AUX13 = 18
+PA_CHANNEL_POSITION_AUX14 = 19
+PA_CHANNEL_POSITION_AUX15 = 20
+PA_CHANNEL_POSITION_AUX16 = 21
+PA_CHANNEL_POSITION_AUX17 = 22
+PA_CHANNEL_POSITION_AUX18 = 23
+PA_CHANNEL_POSITION_AUX19 = 24
+PA_CHANNEL_POSITION_AUX20 = 25
+PA_CHANNEL_POSITION_AUX21 = 26
+PA_CHANNEL_POSITION_AUX22 = 27
+PA_CHANNEL_POSITION_AUX23 = 28
+PA_CHANNEL_POSITION_AUX24 = 29
+PA_CHANNEL_POSITION_AUX25 = 30
+PA_CHANNEL_POSITION_AUX26 = 31
+PA_CHANNEL_POSITION_AUX27 = 32
+PA_CHANNEL_POSITION_AUX28 = 33
+PA_CHANNEL_POSITION_AUX29 = 34
+PA_CHANNEL_POSITION_AUX30 = 35
+PA_CHANNEL_POSITION_AUX31 = 36
+PA_CHANNEL_POSITION_TOP_CENTER = 37
+PA_CHANNEL_POSITION_TOP_FRONT_LEFT = 38
+PA_CHANNEL_POSITION_TOP_FRONT_RIGHT = 39
+PA_CHANNEL_POSITION_TOP_FRONT_CENTER = 40
+PA_CHANNEL_POSITION_TOP_REAR_LEFT = 41
+PA_CHANNEL_POSITION_TOP_REAR_RIGHT = 42
+PA_CHANNEL_POSITION_TOP_REAR_CENTER = 43
+PA_CHANNEL_POSITION_MAX = 44
+pa_channel_position_t = enum_pa_channel_position # /usr/include/pulse/channelmap.h:147
+pa_channel_position_mask_t = c_uint64 # /usr/include/pulse/channelmap.h:210
+enum_pa_channel_map_def = c_int
+PA_CHANNEL_MAP_AIFF = 0
+PA_CHANNEL_MAP_ALSA = 1
+PA_CHANNEL_MAP_AUX = 2
+PA_CHANNEL_MAP_WAVEEX = 3
+PA_CHANNEL_MAP_OSS = 4
+PA_CHANNEL_MAP_DEF_MAX = 5
+PA_CHANNEL_MAP_DEFAULT = 0
+pa_channel_map_def_t = enum_pa_channel_map_def # /usr/include/pulse/channelmap.h:247
+
+
+class struct_pa_channel_map(Structure):
+ __slots__ = [
+ 'channels',
+ 'map',
+ ]
+
+
+struct_pa_channel_map._fields_ = [
+ ('channels', c_uint8),
+ ('map', pa_channel_position_t * 32),
+]
+
+pa_channel_map = struct_pa_channel_map # /usr/include/pulse/channelmap.h:268
+# /usr/include/pulse/channelmap.h:273
+pa_channel_map_init = _lib.pa_channel_map_init
+pa_channel_map_init.restype = POINTER(pa_channel_map)
+pa_channel_map_init.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:276
+pa_channel_map_init_mono = _lib.pa_channel_map_init_mono
+pa_channel_map_init_mono.restype = POINTER(pa_channel_map)
+pa_channel_map_init_mono.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:279
+pa_channel_map_init_stereo = _lib.pa_channel_map_init_stereo
+pa_channel_map_init_stereo.restype = POINTER(pa_channel_map)
+pa_channel_map_init_stereo.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:285
+pa_channel_map_init_auto = _lib.pa_channel_map_init_auto
+pa_channel_map_init_auto.restype = POINTER(pa_channel_map)
+pa_channel_map_init_auto.argtypes = [POINTER(pa_channel_map), c_uint, pa_channel_map_def_t]
+
+# /usr/include/pulse/channelmap.h:291
+pa_channel_map_init_extend = _lib.pa_channel_map_init_extend
+pa_channel_map_init_extend.restype = POINTER(pa_channel_map)
+pa_channel_map_init_extend.argtypes = [POINTER(pa_channel_map), c_uint, pa_channel_map_def_t]
+
+# /usr/include/pulse/channelmap.h:294
+pa_channel_position_to_string = _lib.pa_channel_position_to_string
+pa_channel_position_to_string.restype = c_char_p
+pa_channel_position_to_string.argtypes = [pa_channel_position_t]
+
+# /usr/include/pulse/channelmap.h:297
+pa_channel_position_from_string = _lib.pa_channel_position_from_string
+pa_channel_position_from_string.restype = pa_channel_position_t
+pa_channel_position_from_string.argtypes = [c_char_p]
+
+# /usr/include/pulse/channelmap.h:300
+pa_channel_position_to_pretty_string = _lib.pa_channel_position_to_pretty_string
+pa_channel_position_to_pretty_string.restype = c_char_p
+pa_channel_position_to_pretty_string.argtypes = [pa_channel_position_t]
+
+PA_CHANNEL_MAP_SNPRINT_MAX = 336 # /usr/include/pulse/channelmap.h:307
+# /usr/include/pulse/channelmap.h:310
+pa_channel_map_snprint = _lib.pa_channel_map_snprint
+pa_channel_map_snprint.restype = c_char_p
+pa_channel_map_snprint.argtypes = [c_char_p, c_size_t, POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:316
+pa_channel_map_parse = _lib.pa_channel_map_parse
+pa_channel_map_parse.restype = POINTER(pa_channel_map)
+pa_channel_map_parse.argtypes = [POINTER(pa_channel_map), c_char_p]
+
+# /usr/include/pulse/channelmap.h:319
+pa_channel_map_equal = _lib.pa_channel_map_equal
+pa_channel_map_equal.restype = c_int
+pa_channel_map_equal.argtypes = [POINTER(pa_channel_map), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:322
+pa_channel_map_valid = _lib.pa_channel_map_valid
+pa_channel_map_valid.restype = c_int
+pa_channel_map_valid.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:326
+pa_channel_map_compatible = _lib.pa_channel_map_compatible
+pa_channel_map_compatible.restype = c_int
+pa_channel_map_compatible.argtypes = [POINTER(pa_channel_map), POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/channelmap.h:329
+pa_channel_map_superset = _lib.pa_channel_map_superset
+pa_channel_map_superset.restype = c_int
+pa_channel_map_superset.argtypes = [POINTER(pa_channel_map), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:334
+pa_channel_map_can_balance = _lib.pa_channel_map_can_balance
+pa_channel_map_can_balance.restype = c_int
+pa_channel_map_can_balance.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:339
+pa_channel_map_can_fade = _lib.pa_channel_map_can_fade
+pa_channel_map_can_fade.restype = c_int
+pa_channel_map_can_fade.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:345
+pa_channel_map_to_name = _lib.pa_channel_map_to_name
+pa_channel_map_to_name.restype = c_char_p
+pa_channel_map_to_name.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:350
+pa_channel_map_to_pretty_name = _lib.pa_channel_map_to_pretty_name
+pa_channel_map_to_pretty_name.restype = c_char_p
+pa_channel_map_to_pretty_name.argtypes = [POINTER(pa_channel_map)]
+
+# /usr/include/pulse/channelmap.h:354
+pa_channel_map_has_position = _lib.pa_channel_map_has_position
+pa_channel_map_has_position.restype = c_int
+pa_channel_map_has_position.argtypes = [POINTER(pa_channel_map), pa_channel_position_t]
+
+# /usr/include/pulse/channelmap.h:357
+pa_channel_map_mask = _lib.pa_channel_map_mask
+pa_channel_map_mask.restype = pa_channel_position_mask_t
+pa_channel_map_mask.argtypes = [POINTER(pa_channel_map)]
+
+
+class struct_pa_operation(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_operation._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_pa_operation(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_operation._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_operation = struct_pa_operation # /usr/include/pulse/operation.h:33
+pa_operation_notify_cb_t = CFUNCTYPE(None, POINTER(pa_operation), POINTER(None)) # /usr/include/pulse/operation.h:36
+# /usr/include/pulse/operation.h:39
+pa_operation_ref = _lib.pa_operation_ref
+pa_operation_ref.restype = POINTER(pa_operation)
+pa_operation_ref.argtypes = [POINTER(pa_operation)]
+
+# /usr/include/pulse/operation.h:42
+pa_operation_unref = _lib.pa_operation_unref
+pa_operation_unref.restype = None
+pa_operation_unref.argtypes = [POINTER(pa_operation)]
+
+# /usr/include/pulse/operation.h:49
+pa_operation_cancel = _lib.pa_operation_cancel
+pa_operation_cancel.restype = None
+pa_operation_cancel.argtypes = [POINTER(pa_operation)]
+
+# /usr/include/pulse/operation.h:52
+pa_operation_get_state = _lib.pa_operation_get_state
+pa_operation_get_state.restype = pa_operation_state_t
+pa_operation_get_state.argtypes = [POINTER(pa_operation)]
+
+# /usr/include/pulse/operation.h:60
+pa_operation_set_state_callback = _lib.pa_operation_set_state_callback
+pa_operation_set_state_callback.restype = None
+pa_operation_set_state_callback.argtypes = [POINTER(pa_operation), pa_operation_notify_cb_t, POINTER(None)]
+
+
+class struct_pa_context(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_context._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_pa_context(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_context._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_context = struct_pa_context # /usr/include/pulse/context.h:154
+pa_context_notify_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(None)) # /usr/include/pulse/context.h:157
+pa_context_success_cb_t = CFUNCTYPE(None, POINTER(pa_context), c_int, POINTER(None)) # /usr/include/pulse/context.h:160
+
+
+class struct_pa_proplist(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_proplist._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_pa_proplist(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_proplist._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_proplist = struct_pa_proplist # /usr/include/pulse/proplist.h:272
+pa_context_event_cb_t = CFUNCTYPE(None, POINTER(pa_context), c_char_p, POINTER(pa_proplist),
+ POINTER(None)) # /usr/include/pulse/context.h:167
+# /usr/include/pulse/context.h:172
+pa_context_new = _lib.pa_context_new
+pa_context_new.restype = POINTER(pa_context)
+pa_context_new.argtypes = [POINTER(pa_mainloop_api), c_char_p]
+
+# /usr/include/pulse/context.h:177
+pa_context_new_with_proplist = _lib.pa_context_new_with_proplist
+pa_context_new_with_proplist.restype = POINTER(pa_context)
+pa_context_new_with_proplist.argtypes = [POINTER(pa_mainloop_api), c_char_p, POINTER(pa_proplist)]
+
+# /usr/include/pulse/context.h:180
+pa_context_unref = _lib.pa_context_unref
+pa_context_unref.restype = None
+pa_context_unref.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:183
+pa_context_ref = _lib.pa_context_ref
+pa_context_ref.restype = POINTER(pa_context)
+pa_context_ref.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:186
+pa_context_set_state_callback = _lib.pa_context_set_state_callback
+pa_context_set_state_callback.restype = None
+pa_context_set_state_callback.argtypes = [POINTER(pa_context), pa_context_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:190
+pa_context_set_event_callback = _lib.pa_context_set_event_callback
+pa_context_set_event_callback.restype = None
+pa_context_set_event_callback.argtypes = [POINTER(pa_context), pa_context_event_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:193
+pa_context_errno = _lib.pa_context_errno
+pa_context_errno.restype = c_int
+pa_context_errno.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:196
+pa_context_is_pending = _lib.pa_context_is_pending
+pa_context_is_pending.restype = c_int
+pa_context_is_pending.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:199
+pa_context_get_state = _lib.pa_context_get_state
+pa_context_get_state.restype = pa_context_state_t
+pa_context_get_state.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:209
+pa_context_connect = _lib.pa_context_connect
+pa_context_connect.restype = c_int
+pa_context_connect.argtypes = [POINTER(pa_context), c_char_p, pa_context_flags_t, POINTER(pa_spawn_api)]
+
+# /usr/include/pulse/context.h:212
+pa_context_disconnect = _lib.pa_context_disconnect
+pa_context_disconnect.restype = None
+pa_context_disconnect.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:215
+pa_context_drain = _lib.pa_context_drain
+pa_context_drain.restype = POINTER(pa_operation)
+pa_context_drain.argtypes = [POINTER(pa_context), pa_context_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:220
+pa_context_exit_daemon = _lib.pa_context_exit_daemon
+pa_context_exit_daemon.restype = POINTER(pa_operation)
+pa_context_exit_daemon.argtypes = [POINTER(pa_context), pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:223
+pa_context_set_default_sink = _lib.pa_context_set_default_sink
+pa_context_set_default_sink.restype = POINTER(pa_operation)
+pa_context_set_default_sink.argtypes = [POINTER(pa_context), c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:226
+pa_context_set_default_source = _lib.pa_context_set_default_source
+pa_context_set_default_source.restype = POINTER(pa_operation)
+pa_context_set_default_source.argtypes = [POINTER(pa_context), c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:229
+pa_context_is_local = _lib.pa_context_is_local
+pa_context_is_local.restype = c_int
+pa_context_is_local.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:232
+pa_context_set_name = _lib.pa_context_set_name
+pa_context_set_name.restype = POINTER(pa_operation)
+pa_context_set_name.argtypes = [POINTER(pa_context), c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:235
+pa_context_get_server = _lib.pa_context_get_server
+pa_context_get_server.restype = c_char_p
+pa_context_get_server.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:238
+pa_context_get_protocol_version = _lib.pa_context_get_protocol_version
+pa_context_get_protocol_version.restype = c_uint32
+pa_context_get_protocol_version.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:241
+pa_context_get_server_protocol_version = _lib.pa_context_get_server_protocol_version
+pa_context_get_server_protocol_version.restype = c_uint32
+pa_context_get_server_protocol_version.argtypes = [POINTER(pa_context)]
+
+enum_pa_update_mode = c_int
+PA_UPDATE_SET = 0
+PA_UPDATE_MERGE = 1
+PA_UPDATE_REPLACE = 2
+pa_update_mode_t = enum_pa_update_mode # /usr/include/pulse/proplist.h:337
+# /usr/include/pulse/context.h:248
+pa_context_proplist_update = _lib.pa_context_proplist_update
+pa_context_proplist_update.restype = POINTER(pa_operation)
+pa_context_proplist_update.argtypes = [POINTER(pa_context), pa_update_mode_t, POINTER(pa_proplist),
+ pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:251
+pa_context_proplist_remove = _lib.pa_context_proplist_remove
+pa_context_proplist_remove.restype = POINTER(pa_operation)
+pa_context_proplist_remove.argtypes = [POINTER(pa_context), POINTER(c_char_p), pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:256
+pa_context_get_index = _lib.pa_context_get_index
+pa_context_get_index.restype = c_uint32
+pa_context_get_index.argtypes = [POINTER(pa_context)]
+
+# /usr/include/pulse/context.h:260
+pa_context_rttime_new = _lib.pa_context_rttime_new
+pa_context_rttime_new.restype = POINTER(pa_time_event)
+pa_context_rttime_new.argtypes = [POINTER(pa_context), pa_usec_t, pa_time_event_cb_t, POINTER(None)]
+
+# /usr/include/pulse/context.h:264
+pa_context_rttime_restart = _lib.pa_context_rttime_restart
+pa_context_rttime_restart.restype = None
+pa_context_rttime_restart.argtypes = [POINTER(pa_context), POINTER(pa_time_event), pa_usec_t]
+
+# /usr/include/pulse/context.h:279
+pa_context_get_tile_size = _lib.pa_context_get_tile_size
+pa_context_get_tile_size.restype = c_size_t
+pa_context_get_tile_size.argtypes = [POINTER(pa_context), POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/context.h:287
+# pa_context_load_cookie_from_file = _lib.pa_context_load_cookie_from_file
+# pa_context_load_cookie_from_file.restype = c_int
+# pa_context_load_cookie_from_file.argtypes = [POINTER(pa_context), c_char_p]
+
+pa_volume_t = c_uint32 # /usr/include/pulse/volume.h:120
+
+
+class struct_pa_cvolume(Structure):
+ __slots__ = [
+ 'channels',
+ 'values',
+ ]
+
+
+struct_pa_cvolume._fields_ = [
+ ('channels', c_uint8),
+ ('values', pa_volume_t * 32),
+]
+
+pa_cvolume = struct_pa_cvolume # /usr/include/pulse/volume.h:151
+# /usr/include/pulse/volume.h:154
+pa_cvolume_equal = _lib.pa_cvolume_equal
+pa_cvolume_equal.restype = c_int
+pa_cvolume_equal.argtypes = [POINTER(pa_cvolume), POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:159
+pa_cvolume_init = _lib.pa_cvolume_init
+pa_cvolume_init.restype = POINTER(pa_cvolume)
+pa_cvolume_init.argtypes = [POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:168
+pa_cvolume_set = _lib.pa_cvolume_set
+pa_cvolume_set.restype = POINTER(pa_cvolume)
+pa_cvolume_set.argtypes = [POINTER(pa_cvolume), c_uint, pa_volume_t]
+
+PA_CVOLUME_SNPRINT_MAX = 320 # /usr/include/pulse/volume.h:175
+# /usr/include/pulse/volume.h:178
+pa_cvolume_snprint = _lib.pa_cvolume_snprint
+pa_cvolume_snprint.restype = c_char_p
+pa_cvolume_snprint.argtypes = [c_char_p, c_size_t, POINTER(pa_cvolume)]
+
+PA_SW_CVOLUME_SNPRINT_DB_MAX = 448 # /usr/include/pulse/volume.h:185
+# /usr/include/pulse/volume.h:188
+pa_sw_cvolume_snprint_dB = _lib.pa_sw_cvolume_snprint_dB
+pa_sw_cvolume_snprint_dB.restype = c_char_p
+pa_sw_cvolume_snprint_dB.argtypes = [c_char_p, c_size_t, POINTER(pa_cvolume)]
+
+PA_CVOLUME_SNPRINT_VERBOSE_MAX = 1984 # /usr/include/pulse/volume.h:194
+# /usr/include/pulse/volume.h:200
+# pa_cvolume_snprint_verbose = _lib.pa_cvolume_snprint_verbose
+# pa_cvolume_snprint_verbose.restype = c_char_p
+# pa_cvolume_snprint_verbose.argtypes = [c_char_p, c_size_t, POINTER(pa_cvolume), POINTER(pa_channel_map), c_int]
+
+PA_VOLUME_SNPRINT_MAX = 10 # /usr/include/pulse/volume.h:207
+# /usr/include/pulse/volume.h:210
+pa_volume_snprint = _lib.pa_volume_snprint
+pa_volume_snprint.restype = c_char_p
+pa_volume_snprint.argtypes = [c_char_p, c_size_t, pa_volume_t]
+
+PA_SW_VOLUME_SNPRINT_DB_MAX = 11 # /usr/include/pulse/volume.h:217
+# /usr/include/pulse/volume.h:220
+pa_sw_volume_snprint_dB = _lib.pa_sw_volume_snprint_dB
+pa_sw_volume_snprint_dB.restype = c_char_p
+pa_sw_volume_snprint_dB.argtypes = [c_char_p, c_size_t, pa_volume_t]
+
+PA_VOLUME_SNPRINT_VERBOSE_MAX = 35 # /usr/include/pulse/volume.h:226
+# /usr/include/pulse/volume.h:231
+# pa_volume_snprint_verbose = _lib.pa_volume_snprint_verbose
+# pa_volume_snprint_verbose.restype = c_char_p
+# pa_volume_snprint_verbose.argtypes = [c_char_p, c_size_t, pa_volume_t, c_int]
+
+# /usr/include/pulse/volume.h:234
+pa_cvolume_avg = _lib.pa_cvolume_avg
+pa_cvolume_avg.restype = pa_volume_t
+pa_cvolume_avg.argtypes = [POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:241
+pa_cvolume_avg_mask = _lib.pa_cvolume_avg_mask
+pa_cvolume_avg_mask.restype = pa_volume_t
+pa_cvolume_avg_mask.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), pa_channel_position_mask_t]
+
+# /usr/include/pulse/volume.h:244
+pa_cvolume_max = _lib.pa_cvolume_max
+pa_cvolume_max.restype = pa_volume_t
+pa_cvolume_max.argtypes = [POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:251
+pa_cvolume_max_mask = _lib.pa_cvolume_max_mask
+pa_cvolume_max_mask.restype = pa_volume_t
+pa_cvolume_max_mask.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), pa_channel_position_mask_t]
+
+# /usr/include/pulse/volume.h:254
+pa_cvolume_min = _lib.pa_cvolume_min
+pa_cvolume_min.restype = pa_volume_t
+pa_cvolume_min.argtypes = [POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:261
+pa_cvolume_min_mask = _lib.pa_cvolume_min_mask
+pa_cvolume_min_mask.restype = pa_volume_t
+pa_cvolume_min_mask.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), pa_channel_position_mask_t]
+
+# /usr/include/pulse/volume.h:264
+pa_cvolume_valid = _lib.pa_cvolume_valid
+pa_cvolume_valid.restype = c_int
+pa_cvolume_valid.argtypes = [POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:267
+pa_cvolume_channels_equal_to = _lib.pa_cvolume_channels_equal_to
+pa_cvolume_channels_equal_to.restype = c_int
+pa_cvolume_channels_equal_to.argtypes = [POINTER(pa_cvolume), pa_volume_t]
+
+# /usr/include/pulse/volume.h:278
+pa_sw_volume_multiply = _lib.pa_sw_volume_multiply
+pa_sw_volume_multiply.restype = pa_volume_t
+pa_sw_volume_multiply.argtypes = [pa_volume_t, pa_volume_t]
+
+# /usr/include/pulse/volume.h:283
+pa_sw_cvolume_multiply = _lib.pa_sw_cvolume_multiply
+pa_sw_cvolume_multiply.restype = POINTER(pa_cvolume)
+pa_sw_cvolume_multiply.argtypes = [POINTER(pa_cvolume), POINTER(pa_cvolume), POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:289
+pa_sw_cvolume_multiply_scalar = _lib.pa_sw_cvolume_multiply_scalar
+pa_sw_cvolume_multiply_scalar.restype = POINTER(pa_cvolume)
+pa_sw_cvolume_multiply_scalar.argtypes = [POINTER(pa_cvolume), POINTER(pa_cvolume), pa_volume_t]
+
+# /usr/include/pulse/volume.h:295
+pa_sw_volume_divide = _lib.pa_sw_volume_divide
+pa_sw_volume_divide.restype = pa_volume_t
+pa_sw_volume_divide.argtypes = [pa_volume_t, pa_volume_t]
+
+# /usr/include/pulse/volume.h:300
+pa_sw_cvolume_divide = _lib.pa_sw_cvolume_divide
+pa_sw_cvolume_divide.restype = POINTER(pa_cvolume)
+pa_sw_cvolume_divide.argtypes = [POINTER(pa_cvolume), POINTER(pa_cvolume), POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:306
+pa_sw_cvolume_divide_scalar = _lib.pa_sw_cvolume_divide_scalar
+pa_sw_cvolume_divide_scalar.restype = POINTER(pa_cvolume)
+pa_sw_cvolume_divide_scalar.argtypes = [POINTER(pa_cvolume), POINTER(pa_cvolume), pa_volume_t]
+
+# /usr/include/pulse/volume.h:309
+pa_sw_volume_from_dB = _lib.pa_sw_volume_from_dB
+pa_sw_volume_from_dB.restype = pa_volume_t
+pa_sw_volume_from_dB.argtypes = [c_double]
+
+# /usr/include/pulse/volume.h:312
+pa_sw_volume_to_dB = _lib.pa_sw_volume_to_dB
+pa_sw_volume_to_dB.restype = c_double
+pa_sw_volume_to_dB.argtypes = [pa_volume_t]
+
+# /usr/include/pulse/volume.h:316
+pa_sw_volume_from_linear = _lib.pa_sw_volume_from_linear
+pa_sw_volume_from_linear.restype = pa_volume_t
+pa_sw_volume_from_linear.argtypes = [c_double]
+
+# /usr/include/pulse/volume.h:319
+pa_sw_volume_to_linear = _lib.pa_sw_volume_to_linear
+pa_sw_volume_to_linear.restype = c_double
+pa_sw_volume_to_linear.argtypes = [pa_volume_t]
+
+# /usr/include/pulse/volume.h:329
+pa_cvolume_remap = _lib.pa_cvolume_remap
+pa_cvolume_remap.restype = POINTER(pa_cvolume)
+pa_cvolume_remap.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/volume.h:333
+pa_cvolume_compatible = _lib.pa_cvolume_compatible
+pa_cvolume_compatible.restype = c_int
+pa_cvolume_compatible.argtypes = [POINTER(pa_cvolume), POINTER(pa_sample_spec)]
+
+# /usr/include/pulse/volume.h:337
+pa_cvolume_compatible_with_channel_map = _lib.pa_cvolume_compatible_with_channel_map
+pa_cvolume_compatible_with_channel_map.restype = c_int
+pa_cvolume_compatible_with_channel_map.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/volume.h:344
+pa_cvolume_get_balance = _lib.pa_cvolume_get_balance
+pa_cvolume_get_balance.restype = c_float
+pa_cvolume_get_balance.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/volume.h:355
+pa_cvolume_set_balance = _lib.pa_cvolume_set_balance
+pa_cvolume_set_balance.restype = POINTER(pa_cvolume)
+pa_cvolume_set_balance.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), c_float]
+
+# /usr/include/pulse/volume.h:362
+pa_cvolume_get_fade = _lib.pa_cvolume_get_fade
+pa_cvolume_get_fade.restype = c_float
+pa_cvolume_get_fade.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/volume.h:373
+pa_cvolume_set_fade = _lib.pa_cvolume_set_fade
+pa_cvolume_set_fade.restype = POINTER(pa_cvolume)
+pa_cvolume_set_fade.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), c_float]
+
+# /usr/include/pulse/volume.h:378
+pa_cvolume_scale = _lib.pa_cvolume_scale
+pa_cvolume_scale.restype = POINTER(pa_cvolume)
+pa_cvolume_scale.argtypes = [POINTER(pa_cvolume), pa_volume_t]
+
+# /usr/include/pulse/volume.h:384
+pa_cvolume_scale_mask = _lib.pa_cvolume_scale_mask
+pa_cvolume_scale_mask.restype = POINTER(pa_cvolume)
+pa_cvolume_scale_mask.argtypes = [POINTER(pa_cvolume), pa_volume_t, POINTER(pa_channel_map), pa_channel_position_mask_t]
+
+# /usr/include/pulse/volume.h:391
+pa_cvolume_set_position = _lib.pa_cvolume_set_position
+pa_cvolume_set_position.restype = POINTER(pa_cvolume)
+pa_cvolume_set_position.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), pa_channel_position_t, pa_volume_t]
+
+# /usr/include/pulse/volume.h:397
+pa_cvolume_get_position = _lib.pa_cvolume_get_position
+pa_cvolume_get_position.restype = pa_volume_t
+pa_cvolume_get_position.argtypes = [POINTER(pa_cvolume), POINTER(pa_channel_map), pa_channel_position_t]
+
+# /usr/include/pulse/volume.h:402
+pa_cvolume_merge = _lib.pa_cvolume_merge
+pa_cvolume_merge.restype = POINTER(pa_cvolume)
+pa_cvolume_merge.argtypes = [POINTER(pa_cvolume), POINTER(pa_cvolume), POINTER(pa_cvolume)]
+
+# /usr/include/pulse/volume.h:406
+pa_cvolume_inc_clamp = _lib.pa_cvolume_inc_clamp
+pa_cvolume_inc_clamp.restype = POINTER(pa_cvolume)
+pa_cvolume_inc_clamp.argtypes = [POINTER(pa_cvolume), pa_volume_t, pa_volume_t]
+
+# /usr/include/pulse/volume.h:410
+pa_cvolume_inc = _lib.pa_cvolume_inc
+pa_cvolume_inc.restype = POINTER(pa_cvolume)
+pa_cvolume_inc.argtypes = [POINTER(pa_cvolume), pa_volume_t]
+
+# /usr/include/pulse/volume.h:414
+pa_cvolume_dec = _lib.pa_cvolume_dec
+pa_cvolume_dec.restype = POINTER(pa_cvolume)
+pa_cvolume_dec.argtypes = [POINTER(pa_cvolume), pa_volume_t]
+
+
+class struct_pa_stream(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_stream._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_pa_stream(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_stream._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_stream = struct_pa_stream # /usr/include/pulse/stream.h:335
+pa_stream_success_cb_t = CFUNCTYPE(None, POINTER(pa_stream), c_int, POINTER(None)) # /usr/include/pulse/stream.h:338
+pa_stream_request_cb_t = CFUNCTYPE(None, POINTER(pa_stream), c_size_t, POINTER(None)) # /usr/include/pulse/stream.h:341
+pa_stream_notify_cb_t = CFUNCTYPE(None, POINTER(pa_stream), POINTER(None)) # /usr/include/pulse/stream.h:344
+pa_stream_event_cb_t = CFUNCTYPE(None, POINTER(pa_stream), c_char_p, POINTER(pa_proplist),
+ POINTER(None)) # /usr/include/pulse/stream.h:352
+# /usr/include/pulse/stream.h:357
+pa_stream_new = _lib.pa_stream_new
+pa_stream_new.restype = POINTER(pa_stream)
+pa_stream_new.argtypes = [POINTER(pa_context), c_char_p, POINTER(pa_sample_spec), POINTER(pa_channel_map)]
+
+# /usr/include/pulse/stream.h:366
+pa_stream_new_with_proplist = _lib.pa_stream_new_with_proplist
+pa_stream_new_with_proplist.restype = POINTER(pa_stream)
+pa_stream_new_with_proplist.argtypes = [POINTER(pa_context), c_char_p, POINTER(pa_sample_spec), POINTER(pa_channel_map),
+ POINTER(pa_proplist)]
+
+
+class struct_pa_format_info(Structure):
+ __slots__ = [
+ 'encoding',
+ 'plist',
+ ]
+
+
+enum_pa_encoding = c_int
+PA_ENCODING_ANY = 0
+PA_ENCODING_PCM = 1
+PA_ENCODING_AC3_IEC61937 = 2
+PA_ENCODING_EAC3_IEC61937 = 3
+PA_ENCODING_MPEG_IEC61937 = 4
+PA_ENCODING_DTS_IEC61937 = 5
+PA_ENCODING_MPEG2_AAC_IEC61937 = 6
+PA_ENCODING_MAX = 7
+PA_ENCODING_INVALID = -1
+pa_encoding_t = enum_pa_encoding # /usr/include/pulse/format.h:64
+struct_pa_format_info._fields_ = [
+ ('encoding', pa_encoding_t),
+ ('plist', POINTER(pa_proplist)),
+]
+
+pa_format_info = struct_pa_format_info # /usr/include/pulse/format.h:91
+# /usr/include/pulse/stream.h:377
+pa_stream_new_extended = _lib.pa_stream_new_extended
+pa_stream_new_extended.restype = POINTER(pa_stream)
+pa_stream_new_extended.argtypes = [POINTER(pa_context), c_char_p, POINTER(POINTER(pa_format_info)), c_uint,
+ POINTER(pa_proplist)]
+
+# /usr/include/pulse/stream.h:385
+pa_stream_unref = _lib.pa_stream_unref
+pa_stream_unref.restype = None
+pa_stream_unref.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:388
+pa_stream_ref = _lib.pa_stream_ref
+pa_stream_ref.restype = POINTER(pa_stream)
+pa_stream_ref.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:391
+pa_stream_get_state = _lib.pa_stream_get_state
+pa_stream_get_state.restype = pa_stream_state_t
+pa_stream_get_state.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:394
+pa_stream_get_context = _lib.pa_stream_get_context
+pa_stream_get_context.restype = POINTER(pa_context)
+pa_stream_get_context.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:400
+pa_stream_get_index = _lib.pa_stream_get_index
+pa_stream_get_index.restype = c_uint32
+pa_stream_get_index.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:411
+pa_stream_get_device_index = _lib.pa_stream_get_device_index
+pa_stream_get_device_index.restype = c_uint32
+pa_stream_get_device_index.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:422
+pa_stream_get_device_name = _lib.pa_stream_get_device_name
+pa_stream_get_device_name.restype = c_char_p
+pa_stream_get_device_name.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:428
+pa_stream_is_suspended = _lib.pa_stream_is_suspended
+pa_stream_is_suspended.restype = c_int
+pa_stream_is_suspended.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:432
+pa_stream_is_corked = _lib.pa_stream_is_corked
+pa_stream_is_corked.restype = c_int
+pa_stream_is_corked.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:458
+pa_stream_connect_playback = _lib.pa_stream_connect_playback
+pa_stream_connect_playback.restype = c_int
+pa_stream_connect_playback.argtypes = [POINTER(pa_stream), c_char_p, POINTER(pa_buffer_attr), pa_stream_flags_t,
+ POINTER(pa_cvolume), POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:467
+pa_stream_connect_record = _lib.pa_stream_connect_record
+pa_stream_connect_record.restype = c_int
+pa_stream_connect_record.argtypes = [POINTER(pa_stream), c_char_p, POINTER(pa_buffer_attr), pa_stream_flags_t]
+
+# /usr/include/pulse/stream.h:474
+pa_stream_disconnect = _lib.pa_stream_disconnect
+pa_stream_disconnect.restype = c_int
+pa_stream_disconnect.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:508
+pa_stream_begin_write = _lib.pa_stream_begin_write
+pa_stream_begin_write.restype = c_int
+pa_stream_begin_write.argtypes = [POINTER(pa_stream), POINTER(POINTER(None)), POINTER(c_size_t)]
+
+# /usr/include/pulse/stream.h:522
+pa_stream_cancel_write = _lib.pa_stream_cancel_write
+pa_stream_cancel_write.restype = c_int
+pa_stream_cancel_write.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:547
+pa_stream_write = _lib.pa_stream_write
+pa_stream_write.restype = c_int
+pa_stream_write.argtypes = [POINTER(pa_stream), POINTER(None), c_size_t, pa_free_cb_t, c_int64, pa_seek_mode_t]
+
+# /usr/include/pulse/stream.h:557
+# pa_stream_write_ext_free = _lib.pa_stream_write_ext_free
+# pa_stream_write_ext_free.restype = c_int
+# pa_stream_write_ext_free.argtypes = [POINTER(pa_stream), POINTER(None), c_size_t, pa_free_cb_t, POINTER(None), c_int64, pa_seek_mode_t]
+
+# /usr/include/pulse/stream.h:582
+pa_stream_peek = _lib.pa_stream_peek
+pa_stream_peek.restype = c_int
+pa_stream_peek.argtypes = [POINTER(pa_stream), POINTER(POINTER(None)), POINTER(c_size_t)]
+
+# /usr/include/pulse/stream.h:589
+pa_stream_drop = _lib.pa_stream_drop
+pa_stream_drop.restype = c_int
+pa_stream_drop.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:592
+pa_stream_writable_size = _lib.pa_stream_writable_size
+pa_stream_writable_size.restype = c_size_t
+pa_stream_writable_size.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:595
+pa_stream_readable_size = _lib.pa_stream_readable_size
+pa_stream_readable_size.restype = c_size_t
+pa_stream_readable_size.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:601
+pa_stream_drain = _lib.pa_stream_drain
+pa_stream_drain.restype = POINTER(pa_operation)
+pa_stream_drain.argtypes = [POINTER(pa_stream), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:607
+pa_stream_update_timing_info = _lib.pa_stream_update_timing_info
+pa_stream_update_timing_info.restype = POINTER(pa_operation)
+pa_stream_update_timing_info.argtypes = [POINTER(pa_stream), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:610
+pa_stream_set_state_callback = _lib.pa_stream_set_state_callback
+pa_stream_set_state_callback.restype = None
+pa_stream_set_state_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:614
+pa_stream_set_write_callback = _lib.pa_stream_set_write_callback
+pa_stream_set_write_callback.restype = None
+pa_stream_set_write_callback.argtypes = [POINTER(pa_stream), pa_stream_request_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:617
+pa_stream_set_read_callback = _lib.pa_stream_set_read_callback
+pa_stream_set_read_callback.restype = None
+pa_stream_set_read_callback.argtypes = [POINTER(pa_stream), pa_stream_request_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:620
+pa_stream_set_overflow_callback = _lib.pa_stream_set_overflow_callback
+pa_stream_set_overflow_callback.restype = None
+pa_stream_set_overflow_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:626
+pa_stream_get_underflow_index = _lib.pa_stream_get_underflow_index
+pa_stream_get_underflow_index.restype = c_int64
+pa_stream_get_underflow_index.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:629
+pa_stream_set_underflow_callback = _lib.pa_stream_set_underflow_callback
+pa_stream_set_underflow_callback.restype = None
+pa_stream_set_underflow_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:636
+pa_stream_set_started_callback = _lib.pa_stream_set_started_callback
+pa_stream_set_started_callback.restype = None
+pa_stream_set_started_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:641
+pa_stream_set_latency_update_callback = _lib.pa_stream_set_latency_update_callback
+pa_stream_set_latency_update_callback.restype = None
+pa_stream_set_latency_update_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:648
+pa_stream_set_moved_callback = _lib.pa_stream_set_moved_callback
+pa_stream_set_moved_callback.restype = None
+pa_stream_set_moved_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:658
+pa_stream_set_suspended_callback = _lib.pa_stream_set_suspended_callback
+pa_stream_set_suspended_callback.restype = None
+pa_stream_set_suspended_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:662
+pa_stream_set_event_callback = _lib.pa_stream_set_event_callback
+pa_stream_set_event_callback.restype = None
+pa_stream_set_event_callback.argtypes = [POINTER(pa_stream), pa_stream_event_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:669
+pa_stream_set_buffer_attr_callback = _lib.pa_stream_set_buffer_attr_callback
+pa_stream_set_buffer_attr_callback.restype = None
+pa_stream_set_buffer_attr_callback.argtypes = [POINTER(pa_stream), pa_stream_notify_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:681
+pa_stream_cork = _lib.pa_stream_cork
+pa_stream_cork.restype = POINTER(pa_operation)
+pa_stream_cork.argtypes = [POINTER(pa_stream), c_int, pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:686
+pa_stream_flush = _lib.pa_stream_flush
+pa_stream_flush.restype = POINTER(pa_operation)
+pa_stream_flush.argtypes = [POINTER(pa_stream), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:690
+pa_stream_prebuf = _lib.pa_stream_prebuf
+pa_stream_prebuf.restype = POINTER(pa_operation)
+pa_stream_prebuf.argtypes = [POINTER(pa_stream), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:695
+pa_stream_trigger = _lib.pa_stream_trigger
+pa_stream_trigger.restype = POINTER(pa_operation)
+pa_stream_trigger.argtypes = [POINTER(pa_stream), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:698
+pa_stream_set_name = _lib.pa_stream_set_name
+pa_stream_set_name.restype = POINTER(pa_operation)
+pa_stream_set_name.argtypes = [POINTER(pa_stream), c_char_p, pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:731
+pa_stream_get_time = _lib.pa_stream_get_time
+pa_stream_get_time.restype = c_int
+pa_stream_get_time.argtypes = [POINTER(pa_stream), POINTER(pa_usec_t)]
+
+# /usr/include/pulse/stream.h:745
+pa_stream_get_latency = _lib.pa_stream_get_latency
+pa_stream_get_latency.restype = c_int
+pa_stream_get_latency.argtypes = [POINTER(pa_stream), POINTER(pa_usec_t), POINTER(c_int)]
+
+# /usr/include/pulse/stream.h:761
+pa_stream_get_timing_info = _lib.pa_stream_get_timing_info
+pa_stream_get_timing_info.restype = POINTER(pa_timing_info)
+pa_stream_get_timing_info.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:764
+pa_stream_get_sample_spec = _lib.pa_stream_get_sample_spec
+pa_stream_get_sample_spec.restype = POINTER(pa_sample_spec)
+pa_stream_get_sample_spec.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:767
+pa_stream_get_channel_map = _lib.pa_stream_get_channel_map
+pa_stream_get_channel_map.restype = POINTER(pa_channel_map)
+pa_stream_get_channel_map.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:770
+pa_stream_get_format_info = _lib.pa_stream_get_format_info
+pa_stream_get_format_info.restype = POINTER(pa_format_info)
+pa_stream_get_format_info.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:780
+pa_stream_get_buffer_attr = _lib.pa_stream_get_buffer_attr
+pa_stream_get_buffer_attr.restype = POINTER(pa_buffer_attr)
+pa_stream_get_buffer_attr.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/stream.h:790
+pa_stream_set_buffer_attr = _lib.pa_stream_set_buffer_attr
+pa_stream_set_buffer_attr.restype = POINTER(pa_operation)
+pa_stream_set_buffer_attr.argtypes = [POINTER(pa_stream), POINTER(pa_buffer_attr), pa_stream_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/stream.h:797
+pa_stream_update_sample_rate = _lib.pa_stream_update_sample_rate
+pa_stream_update_sample_rate.restype = POINTER(pa_operation)
+pa_stream_update_sample_rate.argtypes = [POINTER(pa_stream), c_uint32, pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:805
+pa_stream_proplist_update = _lib.pa_stream_proplist_update
+pa_stream_proplist_update.restype = POINTER(pa_operation)
+pa_stream_proplist_update.argtypes = [POINTER(pa_stream), pa_update_mode_t, POINTER(pa_proplist),
+ pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:809
+pa_stream_proplist_remove = _lib.pa_stream_proplist_remove
+pa_stream_proplist_remove.restype = POINTER(pa_operation)
+pa_stream_proplist_remove.argtypes = [POINTER(pa_stream), POINTER(c_char_p), pa_stream_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/stream.h:815
+pa_stream_set_monitor_stream = _lib.pa_stream_set_monitor_stream
+pa_stream_set_monitor_stream.restype = c_int
+pa_stream_set_monitor_stream.argtypes = [POINTER(pa_stream), c_uint32]
+
+# /usr/include/pulse/stream.h:820
+pa_stream_get_monitor_stream = _lib.pa_stream_get_monitor_stream
+pa_stream_get_monitor_stream.restype = c_uint32
+pa_stream_get_monitor_stream.argtypes = [POINTER(pa_stream)]
+
+
+class struct_pa_sink_port_info(Structure):
+ __slots__ = [
+ 'name',
+ 'description',
+ 'priority',
+ 'available',
+ ]
+
+
+struct_pa_sink_port_info._fields_ = [
+ ('name', c_char_p),
+ ('description', c_char_p),
+ ('priority', c_uint32),
+ ('available', c_int),
+]
+
+pa_sink_port_info = struct_pa_sink_port_info # /usr/include/pulse/introspect.h:232
+
+
+class struct_pa_sink_info(Structure):
+ __slots__ = [
+ 'name',
+ 'index',
+ 'description',
+ 'sample_spec',
+ 'channel_map',
+ 'owner_module',
+ 'volume',
+ 'mute',
+ 'monitor_source',
+ 'monitor_source_name',
+ 'latency',
+ 'driver',
+ 'flags',
+ 'proplist',
+ 'configured_latency',
+ 'base_volume',
+ 'state',
+ 'n_volume_steps',
+ 'card',
+ 'n_ports',
+ 'ports',
+ 'active_port',
+ 'n_formats',
+ 'formats',
+ ]
+
+
+struct_pa_sink_info._fields_ = [
+ ('name', c_char_p),
+ ('index', c_uint32),
+ ('description', c_char_p),
+ ('sample_spec', pa_sample_spec),
+ ('channel_map', pa_channel_map),
+ ('owner_module', c_uint32),
+ ('volume', pa_cvolume),
+ ('mute', c_int),
+ ('monitor_source', c_uint32),
+ ('monitor_source_name', c_char_p),
+ ('latency', pa_usec_t),
+ ('driver', c_char_p),
+ ('flags', pa_sink_flags_t),
+ ('proplist', POINTER(pa_proplist)),
+ ('configured_latency', pa_usec_t),
+ ('base_volume', pa_volume_t),
+ ('state', pa_sink_state_t),
+ ('n_volume_steps', c_uint32),
+ ('card', c_uint32),
+ ('n_ports', c_uint32),
+ ('ports', POINTER(POINTER(pa_sink_port_info))),
+ ('active_port', POINTER(pa_sink_port_info)),
+ ('n_formats', c_uint8),
+ ('formats', POINTER(POINTER(pa_format_info))),
+]
+
+pa_sink_info = struct_pa_sink_info # /usr/include/pulse/introspect.h:262
+pa_sink_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_sink_info), c_int,
+ POINTER(None)) # /usr/include/pulse/introspect.h:265
+# /usr/include/pulse/introspect.h:268
+pa_context_get_sink_info_by_name = _lib.pa_context_get_sink_info_by_name
+pa_context_get_sink_info_by_name.restype = POINTER(pa_operation)
+pa_context_get_sink_info_by_name.argtypes = [POINTER(pa_context), c_char_p, pa_sink_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:271
+pa_context_get_sink_info_by_index = _lib.pa_context_get_sink_info_by_index
+pa_context_get_sink_info_by_index.restype = POINTER(pa_operation)
+pa_context_get_sink_info_by_index.argtypes = [POINTER(pa_context), c_uint32, pa_sink_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:274
+pa_context_get_sink_info_list = _lib.pa_context_get_sink_info_list
+pa_context_get_sink_info_list.restype = POINTER(pa_operation)
+pa_context_get_sink_info_list.argtypes = [POINTER(pa_context), pa_sink_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:277
+pa_context_set_sink_volume_by_index = _lib.pa_context_set_sink_volume_by_index
+pa_context_set_sink_volume_by_index.restype = POINTER(pa_operation)
+pa_context_set_sink_volume_by_index.argtypes = [POINTER(pa_context), c_uint32, POINTER(pa_cvolume),
+ pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:280
+pa_context_set_sink_volume_by_name = _lib.pa_context_set_sink_volume_by_name
+pa_context_set_sink_volume_by_name.restype = POINTER(pa_operation)
+pa_context_set_sink_volume_by_name.argtypes = [POINTER(pa_context), c_char_p, POINTER(pa_cvolume),
+ pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:283
+pa_context_set_sink_mute_by_index = _lib.pa_context_set_sink_mute_by_index
+pa_context_set_sink_mute_by_index.restype = POINTER(pa_operation)
+pa_context_set_sink_mute_by_index.argtypes = [POINTER(pa_context), c_uint32, c_int, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:286
+pa_context_set_sink_mute_by_name = _lib.pa_context_set_sink_mute_by_name
+pa_context_set_sink_mute_by_name.restype = POINTER(pa_operation)
+pa_context_set_sink_mute_by_name.argtypes = [POINTER(pa_context), c_char_p, c_int, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:289
+pa_context_suspend_sink_by_name = _lib.pa_context_suspend_sink_by_name
+pa_context_suspend_sink_by_name.restype = POINTER(pa_operation)
+pa_context_suspend_sink_by_name.argtypes = [POINTER(pa_context), c_char_p, c_int, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:292
+pa_context_suspend_sink_by_index = _lib.pa_context_suspend_sink_by_index
+pa_context_suspend_sink_by_index.restype = POINTER(pa_operation)
+pa_context_suspend_sink_by_index.argtypes = [POINTER(pa_context), c_uint32, c_int, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:295
+pa_context_set_sink_port_by_index = _lib.pa_context_set_sink_port_by_index
+pa_context_set_sink_port_by_index.restype = POINTER(pa_operation)
+pa_context_set_sink_port_by_index.argtypes = [POINTER(pa_context), c_uint32, c_char_p, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:298
+pa_context_set_sink_port_by_name = _lib.pa_context_set_sink_port_by_name
+pa_context_set_sink_port_by_name.restype = POINTER(pa_operation)
+pa_context_set_sink_port_by_name.argtypes = [POINTER(pa_context), c_char_p, c_char_p, pa_context_success_cb_t,
+ POINTER(None)]
+
+
+class struct_pa_source_port_info(Structure):
+ __slots__ = [
+ 'name',
+ 'description',
+ 'priority',
+ 'available',
+ ]
+
+
+struct_pa_source_port_info._fields_ = [
+ ('name', c_char_p),
+ ('description', c_char_p),
+ ('priority', c_uint32),
+ ('available', c_int),
+]
+
+pa_source_port_info = struct_pa_source_port_info # /usr/include/pulse/introspect.h:312
+
+
+class struct_pa_source_info(Structure):
+ __slots__ = [
+ 'name',
+ 'index',
+ 'description',
+ 'sample_spec',
+ 'channel_map',
+ 'owner_module',
+ 'volume',
+ 'mute',
+ 'monitor_of_sink',
+ 'monitor_of_sink_name',
+ 'latency',
+ 'driver',
+ 'flags',
+ 'proplist',
+ 'configured_latency',
+ 'base_volume',
+ 'state',
+ 'n_volume_steps',
+ 'card',
+ 'n_ports',
+ 'ports',
+ 'active_port',
+ 'n_formats',
+ 'formats',
+ ]
+
+
+struct_pa_source_info._fields_ = [
+ ('name', c_char_p),
+ ('index', c_uint32),
+ ('description', c_char_p),
+ ('sample_spec', pa_sample_spec),
+ ('channel_map', pa_channel_map),
+ ('owner_module', c_uint32),
+ ('volume', pa_cvolume),
+ ('mute', c_int),
+ ('monitor_of_sink', c_uint32),
+ ('monitor_of_sink_name', c_char_p),
+ ('latency', pa_usec_t),
+ ('driver', c_char_p),
+ ('flags', pa_source_flags_t),
+ ('proplist', POINTER(pa_proplist)),
+ ('configured_latency', pa_usec_t),
+ ('base_volume', pa_volume_t),
+ ('state', pa_source_state_t),
+ ('n_volume_steps', c_uint32),
+ ('card', c_uint32),
+ ('n_ports', c_uint32),
+ ('ports', POINTER(POINTER(pa_source_port_info))),
+ ('active_port', POINTER(pa_source_port_info)),
+ ('n_formats', c_uint8),
+ ('formats', POINTER(POINTER(pa_format_info))),
+]
+
+pa_source_info = struct_pa_source_info # /usr/include/pulse/introspect.h:342
+pa_source_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_source_info), c_int,
+ POINTER(None)) # /usr/include/pulse/introspect.h:345
+# /usr/include/pulse/introspect.h:348
+pa_context_get_source_info_by_name = _lib.pa_context_get_source_info_by_name
+pa_context_get_source_info_by_name.restype = POINTER(pa_operation)
+pa_context_get_source_info_by_name.argtypes = [POINTER(pa_context), c_char_p, pa_source_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:351
+pa_context_get_source_info_by_index = _lib.pa_context_get_source_info_by_index
+pa_context_get_source_info_by_index.restype = POINTER(pa_operation)
+pa_context_get_source_info_by_index.argtypes = [POINTER(pa_context), c_uint32, pa_source_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:354
+pa_context_get_source_info_list = _lib.pa_context_get_source_info_list
+pa_context_get_source_info_list.restype = POINTER(pa_operation)
+pa_context_get_source_info_list.argtypes = [POINTER(pa_context), pa_source_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:357
+pa_context_set_source_volume_by_index = _lib.pa_context_set_source_volume_by_index
+pa_context_set_source_volume_by_index.restype = POINTER(pa_operation)
+pa_context_set_source_volume_by_index.argtypes = [POINTER(pa_context), c_uint32, POINTER(pa_cvolume),
+ pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:360
+pa_context_set_source_volume_by_name = _lib.pa_context_set_source_volume_by_name
+pa_context_set_source_volume_by_name.restype = POINTER(pa_operation)
+pa_context_set_source_volume_by_name.argtypes = [POINTER(pa_context), c_char_p, POINTER(pa_cvolume),
+ pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:363
+pa_context_set_source_mute_by_index = _lib.pa_context_set_source_mute_by_index
+pa_context_set_source_mute_by_index.restype = POINTER(pa_operation)
+pa_context_set_source_mute_by_index.argtypes = [POINTER(pa_context), c_uint32, c_int, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:366
+pa_context_set_source_mute_by_name = _lib.pa_context_set_source_mute_by_name
+pa_context_set_source_mute_by_name.restype = POINTER(pa_operation)
+pa_context_set_source_mute_by_name.argtypes = [POINTER(pa_context), c_char_p, c_int, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:369
+pa_context_suspend_source_by_name = _lib.pa_context_suspend_source_by_name
+pa_context_suspend_source_by_name.restype = POINTER(pa_operation)
+pa_context_suspend_source_by_name.argtypes = [POINTER(pa_context), c_char_p, c_int, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:372
+pa_context_suspend_source_by_index = _lib.pa_context_suspend_source_by_index
+pa_context_suspend_source_by_index.restype = POINTER(pa_operation)
+pa_context_suspend_source_by_index.argtypes = [POINTER(pa_context), c_uint32, c_int, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:375
+pa_context_set_source_port_by_index = _lib.pa_context_set_source_port_by_index
+pa_context_set_source_port_by_index.restype = POINTER(pa_operation)
+pa_context_set_source_port_by_index.argtypes = [POINTER(pa_context), c_uint32, c_char_p, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:378
+pa_context_set_source_port_by_name = _lib.pa_context_set_source_port_by_name
+pa_context_set_source_port_by_name.restype = POINTER(pa_operation)
+pa_context_set_source_port_by_name.argtypes = [POINTER(pa_context), c_char_p, c_char_p, pa_context_success_cb_t,
+ POINTER(None)]
+
+
+class struct_pa_server_info(Structure):
+ __slots__ = [
+ 'user_name',
+ 'host_name',
+ 'server_version',
+ 'server_name',
+ 'sample_spec',
+ 'default_sink_name',
+ 'default_source_name',
+ 'cookie',
+ 'channel_map',
+ ]
+
+
+struct_pa_server_info._fields_ = [
+ ('user_name', c_char_p),
+ ('host_name', c_char_p),
+ ('server_version', c_char_p),
+ ('server_name', c_char_p),
+ ('sample_spec', pa_sample_spec),
+ ('default_sink_name', c_char_p),
+ ('default_source_name', c_char_p),
+ ('cookie', c_uint32),
+ ('channel_map', pa_channel_map),
+]
+
+pa_server_info = struct_pa_server_info # /usr/include/pulse/introspect.h:397
+pa_server_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_server_info),
+ POINTER(None)) # /usr/include/pulse/introspect.h:400
+# /usr/include/pulse/introspect.h:403
+pa_context_get_server_info = _lib.pa_context_get_server_info
+pa_context_get_server_info.restype = POINTER(pa_operation)
+pa_context_get_server_info.argtypes = [POINTER(pa_context), pa_server_info_cb_t, POINTER(None)]
+
+
+class struct_pa_module_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'argument',
+ 'n_used',
+ 'auto_unload',
+ 'proplist',
+ ]
+
+
+struct_pa_module_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('argument', c_char_p),
+ ('n_used', c_uint32),
+ ('auto_unload', c_int),
+ ('proplist', POINTER(pa_proplist)),
+]
+
+pa_module_info = struct_pa_module_info # /usr/include/pulse/introspect.h:421
+pa_module_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_module_info), c_int,
+ POINTER(None)) # /usr/include/pulse/introspect.h:424
+# /usr/include/pulse/introspect.h:427
+pa_context_get_module_info = _lib.pa_context_get_module_info
+pa_context_get_module_info.restype = POINTER(pa_operation)
+pa_context_get_module_info.argtypes = [POINTER(pa_context), c_uint32, pa_module_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:430
+pa_context_get_module_info_list = _lib.pa_context_get_module_info_list
+pa_context_get_module_info_list.restype = POINTER(pa_operation)
+pa_context_get_module_info_list.argtypes = [POINTER(pa_context), pa_module_info_cb_t, POINTER(None)]
+
+pa_context_index_cb_t = CFUNCTYPE(None, POINTER(pa_context), c_uint32,
+ POINTER(None)) # /usr/include/pulse/introspect.h:433
+# /usr/include/pulse/introspect.h:436
+pa_context_load_module = _lib.pa_context_load_module
+pa_context_load_module.restype = POINTER(pa_operation)
+pa_context_load_module.argtypes = [POINTER(pa_context), c_char_p, c_char_p, pa_context_index_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:439
+pa_context_unload_module = _lib.pa_context_unload_module
+pa_context_unload_module.restype = POINTER(pa_operation)
+pa_context_unload_module.argtypes = [POINTER(pa_context), c_uint32, pa_context_success_cb_t, POINTER(None)]
+
+
+class struct_pa_client_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'owner_module',
+ 'driver',
+ 'proplist',
+ ]
+
+
+struct_pa_client_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('owner_module', c_uint32),
+ ('driver', c_char_p),
+ ('proplist', POINTER(pa_proplist)),
+]
+
+pa_client_info = struct_pa_client_info # /usr/include/pulse/introspect.h:454
+pa_client_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_client_info), c_int,
+ POINTER(None)) # /usr/include/pulse/introspect.h:457
+# /usr/include/pulse/introspect.h:460
+pa_context_get_client_info = _lib.pa_context_get_client_info
+pa_context_get_client_info.restype = POINTER(pa_operation)
+pa_context_get_client_info.argtypes = [POINTER(pa_context), c_uint32, pa_client_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:463
+pa_context_get_client_info_list = _lib.pa_context_get_client_info_list
+pa_context_get_client_info_list.restype = POINTER(pa_operation)
+pa_context_get_client_info_list.argtypes = [POINTER(pa_context), pa_client_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:466
+pa_context_kill_client = _lib.pa_context_kill_client
+pa_context_kill_client.restype = POINTER(pa_operation)
+pa_context_kill_client.argtypes = [POINTER(pa_context), c_uint32, pa_context_success_cb_t, POINTER(None)]
+
+
+class struct_pa_card_profile_info(Structure):
+ __slots__ = [
+ 'name',
+ 'description',
+ 'n_sinks',
+ 'n_sources',
+ 'priority',
+ ]
+
+
+struct_pa_card_profile_info._fields_ = [
+ ('name', c_char_p),
+ ('description', c_char_p),
+ ('n_sinks', c_uint32),
+ ('n_sources', c_uint32),
+ ('priority', c_uint32),
+]
+
+pa_card_profile_info = struct_pa_card_profile_info # /usr/include/pulse/introspect.h:479
+
+
+class struct_pa_card_profile_info2(Structure):
+ __slots__ = [
+ 'name',
+ 'description',
+ 'n_sinks',
+ 'n_sources',
+ 'priority',
+ 'available',
+ ]
+
+
+struct_pa_card_profile_info2._fields_ = [
+ ('name', c_char_p),
+ ('description', c_char_p),
+ ('n_sinks', c_uint32),
+ ('n_sources', c_uint32),
+ ('priority', c_uint32),
+ ('available', c_int),
+]
+
+pa_card_profile_info2 = struct_pa_card_profile_info2 # /usr/include/pulse/introspect.h:496
+
+
+class struct_pa_card_port_info(Structure):
+ __slots__ = [
+ 'name',
+ 'description',
+ 'priority',
+ 'available',
+ 'direction',
+ 'n_profiles',
+ 'profiles',
+ 'proplist',
+ 'latency_offset',
+ 'profiles2',
+ ]
+
+
+struct_pa_card_port_info._fields_ = [
+ ('name', c_char_p),
+ ('description', c_char_p),
+ ('priority', c_uint32),
+ ('available', c_int),
+ ('direction', c_int),
+ ('n_profiles', c_uint32),
+ ('profiles', POINTER(POINTER(pa_card_profile_info))),
+ ('proplist', POINTER(pa_proplist)),
+ ('latency_offset', c_int64),
+ ('profiles2', POINTER(POINTER(pa_card_profile_info2))),
+]
+
+pa_card_port_info = struct_pa_card_port_info # /usr/include/pulse/introspect.h:512
+
+
+class struct_pa_card_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'owner_module',
+ 'driver',
+ 'n_profiles',
+ 'profiles',
+ 'active_profile',
+ 'proplist',
+ 'n_ports',
+ 'ports',
+ 'profiles2',
+ 'active_profile2',
+ ]
+
+
+struct_pa_card_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('owner_module', c_uint32),
+ ('driver', c_char_p),
+ ('n_profiles', c_uint32),
+ ('profiles', POINTER(pa_card_profile_info)),
+ ('active_profile', POINTER(pa_card_profile_info)),
+ ('proplist', POINTER(pa_proplist)),
+ ('n_ports', c_uint32),
+ ('ports', POINTER(POINTER(pa_card_port_info))),
+ ('profiles2', POINTER(POINTER(pa_card_profile_info2))),
+ ('active_profile2', POINTER(pa_card_profile_info2)),
+]
+
+pa_card_info = struct_pa_card_info # /usr/include/pulse/introspect.h:530
+pa_card_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_card_info), c_int,
+ POINTER(None)) # /usr/include/pulse/introspect.h:533
+# /usr/include/pulse/introspect.h:536
+pa_context_get_card_info_by_index = _lib.pa_context_get_card_info_by_index
+pa_context_get_card_info_by_index.restype = POINTER(pa_operation)
+pa_context_get_card_info_by_index.argtypes = [POINTER(pa_context), c_uint32, pa_card_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:539
+pa_context_get_card_info_by_name = _lib.pa_context_get_card_info_by_name
+pa_context_get_card_info_by_name.restype = POINTER(pa_operation)
+pa_context_get_card_info_by_name.argtypes = [POINTER(pa_context), c_char_p, pa_card_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:542
+pa_context_get_card_info_list = _lib.pa_context_get_card_info_list
+pa_context_get_card_info_list.restype = POINTER(pa_operation)
+pa_context_get_card_info_list.argtypes = [POINTER(pa_context), pa_card_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:545
+pa_context_set_card_profile_by_index = _lib.pa_context_set_card_profile_by_index
+pa_context_set_card_profile_by_index.restype = POINTER(pa_operation)
+pa_context_set_card_profile_by_index.argtypes = [POINTER(pa_context), c_uint32, c_char_p, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:548
+pa_context_set_card_profile_by_name = _lib.pa_context_set_card_profile_by_name
+pa_context_set_card_profile_by_name.restype = POINTER(pa_operation)
+pa_context_set_card_profile_by_name.argtypes = [POINTER(pa_context), c_char_p, c_char_p, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:551
+pa_context_set_port_latency_offset = _lib.pa_context_set_port_latency_offset
+pa_context_set_port_latency_offset.restype = POINTER(pa_operation)
+pa_context_set_port_latency_offset.argtypes = [POINTER(pa_context), c_char_p, c_char_p, c_int64,
+ pa_context_success_cb_t, POINTER(None)]
+
+
+class struct_pa_sink_input_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'owner_module',
+ 'client',
+ 'sink',
+ 'sample_spec',
+ 'channel_map',
+ 'volume',
+ 'buffer_usec',
+ 'sink_usec',
+ 'resample_method',
+ 'driver',
+ 'mute',
+ 'proplist',
+ 'corked',
+ 'has_volume',
+ 'volume_writable',
+ 'format',
+ ]
+
+
+struct_pa_sink_input_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('owner_module', c_uint32),
+ ('client', c_uint32),
+ ('sink', c_uint32),
+ ('sample_spec', pa_sample_spec),
+ ('channel_map', pa_channel_map),
+ ('volume', pa_cvolume),
+ ('buffer_usec', pa_usec_t),
+ ('sink_usec', pa_usec_t),
+ ('resample_method', c_char_p),
+ ('driver', c_char_p),
+ ('mute', c_int),
+ ('proplist', POINTER(pa_proplist)),
+ ('corked', c_int),
+ ('has_volume', c_int),
+ ('volume_writable', c_int),
+ ('format', POINTER(pa_format_info)),
+]
+
+pa_sink_input_info = struct_pa_sink_input_info # /usr/include/pulse/introspect.h:579
+pa_sink_input_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_sink_input_info), c_int,
+ POINTER(None)) # /usr/include/pulse/introspect.h:582
+# /usr/include/pulse/introspect.h:585
+pa_context_get_sink_input_info = _lib.pa_context_get_sink_input_info
+pa_context_get_sink_input_info.restype = POINTER(pa_operation)
+pa_context_get_sink_input_info.argtypes = [POINTER(pa_context), c_uint32, pa_sink_input_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:588
+pa_context_get_sink_input_info_list = _lib.pa_context_get_sink_input_info_list
+pa_context_get_sink_input_info_list.restype = POINTER(pa_operation)
+pa_context_get_sink_input_info_list.argtypes = [POINTER(pa_context), pa_sink_input_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:591
+pa_context_move_sink_input_by_name = _lib.pa_context_move_sink_input_by_name
+pa_context_move_sink_input_by_name.restype = POINTER(pa_operation)
+pa_context_move_sink_input_by_name.argtypes = [POINTER(pa_context), c_uint32, c_char_p, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:594
+pa_context_move_sink_input_by_index = _lib.pa_context_move_sink_input_by_index
+pa_context_move_sink_input_by_index.restype = POINTER(pa_operation)
+pa_context_move_sink_input_by_index.argtypes = [POINTER(pa_context), c_uint32, c_uint32, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:597
+pa_context_set_sink_input_volume = _lib.pa_context_set_sink_input_volume
+pa_context_set_sink_input_volume.restype = POINTER(pa_operation)
+pa_context_set_sink_input_volume.argtypes = [POINTER(pa_context), c_uint32, POINTER(pa_cvolume),
+ pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:600
+pa_context_set_sink_input_mute = _lib.pa_context_set_sink_input_mute
+pa_context_set_sink_input_mute.restype = POINTER(pa_operation)
+pa_context_set_sink_input_mute.argtypes = [POINTER(pa_context), c_uint32, c_int, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:603
+pa_context_kill_sink_input = _lib.pa_context_kill_sink_input
+pa_context_kill_sink_input.restype = POINTER(pa_operation)
+pa_context_kill_sink_input.argtypes = [POINTER(pa_context), c_uint32, pa_context_success_cb_t, POINTER(None)]
+
+
+class struct_pa_source_output_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'owner_module',
+ 'client',
+ 'source',
+ 'sample_spec',
+ 'channel_map',
+ 'buffer_usec',
+ 'source_usec',
+ 'resample_method',
+ 'driver',
+ 'proplist',
+ 'corked',
+ 'volume',
+ 'mute',
+ 'has_volume',
+ 'volume_writable',
+ 'format',
+ ]
+
+
+struct_pa_source_output_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('owner_module', c_uint32),
+ ('client', c_uint32),
+ ('source', c_uint32),
+ ('sample_spec', pa_sample_spec),
+ ('channel_map', pa_channel_map),
+ ('buffer_usec', pa_usec_t),
+ ('source_usec', pa_usec_t),
+ ('resample_method', c_char_p),
+ ('driver', c_char_p),
+ ('proplist', POINTER(pa_proplist)),
+ ('corked', c_int),
+ ('volume', pa_cvolume),
+ ('mute', c_int),
+ ('has_volume', c_int),
+ ('volume_writable', c_int),
+ ('format', POINTER(pa_format_info)),
+]
+
+pa_source_output_info = struct_pa_source_output_info # /usr/include/pulse/introspect.h:631
+pa_source_output_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_source_output_info), c_int,
+ POINTER(None)) # /usr/include/pulse/introspect.h:634
+# /usr/include/pulse/introspect.h:637
+pa_context_get_source_output_info = _lib.pa_context_get_source_output_info
+pa_context_get_source_output_info.restype = POINTER(pa_operation)
+pa_context_get_source_output_info.argtypes = [POINTER(pa_context), c_uint32, pa_source_output_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:640
+pa_context_get_source_output_info_list = _lib.pa_context_get_source_output_info_list
+pa_context_get_source_output_info_list.restype = POINTER(pa_operation)
+pa_context_get_source_output_info_list.argtypes = [POINTER(pa_context), pa_source_output_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:643
+pa_context_move_source_output_by_name = _lib.pa_context_move_source_output_by_name
+pa_context_move_source_output_by_name.restype = POINTER(pa_operation)
+pa_context_move_source_output_by_name.argtypes = [POINTER(pa_context), c_uint32, c_char_p, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:646
+pa_context_move_source_output_by_index = _lib.pa_context_move_source_output_by_index
+pa_context_move_source_output_by_index.restype = POINTER(pa_operation)
+pa_context_move_source_output_by_index.argtypes = [POINTER(pa_context), c_uint32, c_uint32, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:649
+pa_context_set_source_output_volume = _lib.pa_context_set_source_output_volume
+pa_context_set_source_output_volume.restype = POINTER(pa_operation)
+pa_context_set_source_output_volume.argtypes = [POINTER(pa_context), c_uint32, POINTER(pa_cvolume),
+ pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:652
+pa_context_set_source_output_mute = _lib.pa_context_set_source_output_mute
+pa_context_set_source_output_mute.restype = POINTER(pa_operation)
+pa_context_set_source_output_mute.argtypes = [POINTER(pa_context), c_uint32, c_int, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/introspect.h:655
+pa_context_kill_source_output = _lib.pa_context_kill_source_output
+pa_context_kill_source_output.restype = POINTER(pa_operation)
+pa_context_kill_source_output.argtypes = [POINTER(pa_context), c_uint32, pa_context_success_cb_t, POINTER(None)]
+
+
+class struct_pa_stat_info(Structure):
+ __slots__ = [
+ 'memblock_total',
+ 'memblock_total_size',
+ 'memblock_allocated',
+ 'memblock_allocated_size',
+ 'scache_size',
+ ]
+
+
+struct_pa_stat_info._fields_ = [
+ ('memblock_total', c_uint32),
+ ('memblock_total_size', c_uint32),
+ ('memblock_allocated', c_uint32),
+ ('memblock_allocated_size', c_uint32),
+ ('scache_size', c_uint32),
+]
+
+pa_stat_info = struct_pa_stat_info # /usr/include/pulse/introspect.h:670
+pa_stat_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_stat_info),
+ POINTER(None)) # /usr/include/pulse/introspect.h:673
+# /usr/include/pulse/introspect.h:676
+pa_context_stat = _lib.pa_context_stat
+pa_context_stat.restype = POINTER(pa_operation)
+pa_context_stat.argtypes = [POINTER(pa_context), pa_stat_info_cb_t, POINTER(None)]
+
+
+class struct_pa_sample_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'volume',
+ 'sample_spec',
+ 'channel_map',
+ 'duration',
+ 'bytes',
+ 'lazy',
+ 'filename',
+ 'proplist',
+ ]
+
+
+struct_pa_sample_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('volume', pa_cvolume),
+ ('sample_spec', pa_sample_spec),
+ ('channel_map', pa_channel_map),
+ ('duration', pa_usec_t),
+ ('bytes', c_uint32),
+ ('lazy', c_int),
+ ('filename', c_char_p),
+ ('proplist', POINTER(pa_proplist)),
+]
+
+pa_sample_info = struct_pa_sample_info # /usr/include/pulse/introspect.h:696
+pa_sample_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_sample_info), c_int,
+ POINTER(None)) # /usr/include/pulse/introspect.h:699
+# /usr/include/pulse/introspect.h:702
+pa_context_get_sample_info_by_name = _lib.pa_context_get_sample_info_by_name
+pa_context_get_sample_info_by_name.restype = POINTER(pa_operation)
+pa_context_get_sample_info_by_name.argtypes = [POINTER(pa_context), c_char_p, pa_sample_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:705
+pa_context_get_sample_info_by_index = _lib.pa_context_get_sample_info_by_index
+pa_context_get_sample_info_by_index.restype = POINTER(pa_operation)
+pa_context_get_sample_info_by_index.argtypes = [POINTER(pa_context), c_uint32, pa_sample_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:708
+pa_context_get_sample_info_list = _lib.pa_context_get_sample_info_list
+pa_context_get_sample_info_list.restype = POINTER(pa_operation)
+pa_context_get_sample_info_list.argtypes = [POINTER(pa_context), pa_sample_info_cb_t, POINTER(None)]
+
+enum_pa_autoload_type = c_int
+PA_AUTOLOAD_SINK = 0
+PA_AUTOLOAD_SOURCE = 1
+pa_autoload_type_t = enum_pa_autoload_type # /usr/include/pulse/introspect.h:720
+
+
+class struct_pa_autoload_info(Structure):
+ __slots__ = [
+ 'index',
+ 'name',
+ 'type',
+ 'module',
+ 'argument',
+ ]
+
+
+struct_pa_autoload_info._fields_ = [
+ ('index', c_uint32),
+ ('name', c_char_p),
+ ('type', pa_autoload_type_t),
+ ('module', c_char_p),
+ ('argument', c_char_p),
+]
+
+pa_autoload_info = struct_pa_autoload_info # /usr/include/pulse/introspect.h:731
+pa_autoload_info_cb_t = CFUNCTYPE(None, POINTER(pa_context), POINTER(pa_autoload_info), c_int,
+ POINTER(None)) # /usr/include/pulse/introspect.h:734
+# /usr/include/pulse/introspect.h:737
+pa_context_get_autoload_info_by_name = _lib.pa_context_get_autoload_info_by_name
+pa_context_get_autoload_info_by_name.restype = POINTER(pa_operation)
+pa_context_get_autoload_info_by_name.argtypes = [POINTER(pa_context), c_char_p, pa_autoload_type_t,
+ pa_autoload_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:740
+pa_context_get_autoload_info_by_index = _lib.pa_context_get_autoload_info_by_index
+pa_context_get_autoload_info_by_index.restype = POINTER(pa_operation)
+pa_context_get_autoload_info_by_index.argtypes = [POINTER(pa_context), c_uint32, pa_autoload_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:743
+pa_context_get_autoload_info_list = _lib.pa_context_get_autoload_info_list
+pa_context_get_autoload_info_list.restype = POINTER(pa_operation)
+pa_context_get_autoload_info_list.argtypes = [POINTER(pa_context), pa_autoload_info_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:746
+pa_context_add_autoload = _lib.pa_context_add_autoload
+pa_context_add_autoload.restype = POINTER(pa_operation)
+pa_context_add_autoload.argtypes = [POINTER(pa_context), c_char_p, pa_autoload_type_t, c_char_p, c_char_p,
+ pa_context_index_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:749
+pa_context_remove_autoload_by_name = _lib.pa_context_remove_autoload_by_name
+pa_context_remove_autoload_by_name.restype = POINTER(pa_operation)
+pa_context_remove_autoload_by_name.argtypes = [POINTER(pa_context), c_char_p, pa_autoload_type_t,
+ pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/introspect.h:752
+pa_context_remove_autoload_by_index = _lib.pa_context_remove_autoload_by_index
+pa_context_remove_autoload_by_index.restype = POINTER(pa_operation)
+pa_context_remove_autoload_by_index.argtypes = [POINTER(pa_context), c_uint32, pa_context_success_cb_t, POINTER(None)]
+
+pa_context_subscribe_cb_t = CFUNCTYPE(None, POINTER(pa_context), pa_subscription_event_type_t, c_uint32,
+ POINTER(None)) # /usr/include/pulse/subscribe.h:73
+# /usr/include/pulse/subscribe.h:76
+pa_context_subscribe = _lib.pa_context_subscribe
+pa_context_subscribe.restype = POINTER(pa_operation)
+pa_context_subscribe.argtypes = [POINTER(pa_context), pa_subscription_mask_t, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/subscribe.h:79
+pa_context_set_subscribe_callback = _lib.pa_context_set_subscribe_callback
+pa_context_set_subscribe_callback.restype = None
+pa_context_set_subscribe_callback.argtypes = [POINTER(pa_context), pa_context_subscribe_cb_t, POINTER(None)]
+
+pa_context_play_sample_cb_t = CFUNCTYPE(None, POINTER(pa_context), c_uint32,
+ POINTER(None)) # /usr/include/pulse/scache.h:85
+# /usr/include/pulse/scache.h:88
+pa_stream_connect_upload = _lib.pa_stream_connect_upload
+pa_stream_connect_upload.restype = c_int
+pa_stream_connect_upload.argtypes = [POINTER(pa_stream), c_size_t]
+
+# /usr/include/pulse/scache.h:93
+pa_stream_finish_upload = _lib.pa_stream_finish_upload
+pa_stream_finish_upload.restype = c_int
+pa_stream_finish_upload.argtypes = [POINTER(pa_stream)]
+
+# /usr/include/pulse/scache.h:96
+pa_context_remove_sample = _lib.pa_context_remove_sample
+pa_context_remove_sample.restype = POINTER(pa_operation)
+pa_context_remove_sample.argtypes = [POINTER(pa_context), c_char_p, pa_context_success_cb_t, POINTER(None)]
+
+# /usr/include/pulse/scache.h:101
+pa_context_play_sample = _lib.pa_context_play_sample
+pa_context_play_sample.restype = POINTER(pa_operation)
+pa_context_play_sample.argtypes = [POINTER(pa_context), c_char_p, c_char_p, pa_volume_t, pa_context_success_cb_t,
+ POINTER(None)]
+
+# /usr/include/pulse/scache.h:113
+pa_context_play_sample_with_proplist = _lib.pa_context_play_sample_with_proplist
+pa_context_play_sample_with_proplist.restype = POINTER(pa_operation)
+pa_context_play_sample_with_proplist.argtypes = [POINTER(pa_context), c_char_p, c_char_p, pa_volume_t,
+ POINTER(pa_proplist), pa_context_play_sample_cb_t, POINTER(None)]
+
+# /usr/include/pulse/error.h:33
+pa_strerror = _lib.pa_strerror
+pa_strerror.restype = c_char_p
+pa_strerror.argtypes = [c_int]
+
+# /usr/include/pulse/xmalloc.h:39
+pa_xmalloc = _lib.pa_xmalloc
+pa_xmalloc.restype = POINTER(c_void)
+pa_xmalloc.argtypes = [c_size_t]
+
+# /usr/include/pulse/xmalloc.h:42
+pa_xmalloc0 = _lib.pa_xmalloc0
+pa_xmalloc0.restype = POINTER(c_void)
+pa_xmalloc0.argtypes = [c_size_t]
+
+# /usr/include/pulse/xmalloc.h:45
+pa_xrealloc = _lib.pa_xrealloc
+pa_xrealloc.restype = POINTER(c_void)
+pa_xrealloc.argtypes = [POINTER(None), c_size_t]
+
+# /usr/include/pulse/xmalloc.h:48
+pa_xfree = _lib.pa_xfree
+pa_xfree.restype = None
+pa_xfree.argtypes = [POINTER(None)]
+
+# /usr/include/pulse/xmalloc.h:51
+pa_xstrdup = _lib.pa_xstrdup
+pa_xstrdup.restype = c_char_p
+pa_xstrdup.argtypes = [c_char_p]
+
+# /usr/include/pulse/xmalloc.h:54
+pa_xstrndup = _lib.pa_xstrndup
+pa_xstrndup.restype = c_char_p
+pa_xstrndup.argtypes = [c_char_p, c_size_t]
+
+# /usr/include/pulse/xmalloc.h:57
+pa_xmemdup = _lib.pa_xmemdup
+pa_xmemdup.restype = POINTER(c_void)
+pa_xmemdup.argtypes = [POINTER(None), c_size_t]
+
+# /usr/include/pulse/utf8.h:35
+pa_utf8_valid = _lib.pa_utf8_valid
+pa_utf8_valid.restype = c_char_p
+pa_utf8_valid.argtypes = [c_char_p]
+
+# /usr/include/pulse/utf8.h:38
+pa_ascii_valid = _lib.pa_ascii_valid
+pa_ascii_valid.restype = c_char_p
+pa_ascii_valid.argtypes = [c_char_p]
+
+# /usr/include/pulse/utf8.h:41
+pa_utf8_filter = _lib.pa_utf8_filter
+pa_utf8_filter.restype = c_char_p
+pa_utf8_filter.argtypes = [c_char_p]
+
+# /usr/include/pulse/utf8.h:44
+pa_ascii_filter = _lib.pa_ascii_filter
+pa_ascii_filter.restype = c_char_p
+pa_ascii_filter.argtypes = [c_char_p]
+
+# /usr/include/pulse/utf8.h:47
+pa_utf8_to_locale = _lib.pa_utf8_to_locale
+pa_utf8_to_locale.restype = c_char_p
+pa_utf8_to_locale.argtypes = [c_char_p]
+
+# /usr/include/pulse/utf8.h:50
+pa_locale_to_utf8 = _lib.pa_locale_to_utf8
+pa_locale_to_utf8.restype = c_char_p
+pa_locale_to_utf8.argtypes = [c_char_p]
+
+
+class struct_pa_threaded_mainloop(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_threaded_mainloop._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_pa_threaded_mainloop(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_threaded_mainloop._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_threaded_mainloop = struct_pa_threaded_mainloop # /usr/include/pulse/thread-mainloop.h:246
+# /usr/include/pulse/thread-mainloop.h:251
+pa_threaded_mainloop_new = _lib.pa_threaded_mainloop_new
+pa_threaded_mainloop_new.restype = POINTER(pa_threaded_mainloop)
+pa_threaded_mainloop_new.argtypes = []
+
+# /usr/include/pulse/thread-mainloop.h:256
+pa_threaded_mainloop_free = _lib.pa_threaded_mainloop_free
+pa_threaded_mainloop_free.restype = None
+pa_threaded_mainloop_free.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:259
+pa_threaded_mainloop_start = _lib.pa_threaded_mainloop_start
+pa_threaded_mainloop_start.restype = c_int
+pa_threaded_mainloop_start.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:263
+pa_threaded_mainloop_stop = _lib.pa_threaded_mainloop_stop
+pa_threaded_mainloop_stop.restype = None
+pa_threaded_mainloop_stop.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:271
+pa_threaded_mainloop_lock = _lib.pa_threaded_mainloop_lock
+pa_threaded_mainloop_lock.restype = None
+pa_threaded_mainloop_lock.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:274
+pa_threaded_mainloop_unlock = _lib.pa_threaded_mainloop_unlock
+pa_threaded_mainloop_unlock.restype = None
+pa_threaded_mainloop_unlock.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:285
+pa_threaded_mainloop_wait = _lib.pa_threaded_mainloop_wait
+pa_threaded_mainloop_wait.restype = None
+pa_threaded_mainloop_wait.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:292
+pa_threaded_mainloop_signal = _lib.pa_threaded_mainloop_signal
+pa_threaded_mainloop_signal.restype = None
+pa_threaded_mainloop_signal.argtypes = [POINTER(pa_threaded_mainloop), c_int]
+
+# /usr/include/pulse/thread-mainloop.h:298
+pa_threaded_mainloop_accept = _lib.pa_threaded_mainloop_accept
+pa_threaded_mainloop_accept.restype = None
+pa_threaded_mainloop_accept.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:302
+pa_threaded_mainloop_get_retval = _lib.pa_threaded_mainloop_get_retval
+pa_threaded_mainloop_get_retval.restype = c_int
+pa_threaded_mainloop_get_retval.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:307
+pa_threaded_mainloop_get_api = _lib.pa_threaded_mainloop_get_api
+pa_threaded_mainloop_get_api.restype = POINTER(pa_mainloop_api)
+pa_threaded_mainloop_get_api.argtypes = [POINTER(pa_threaded_mainloop)]
+
+# /usr/include/pulse/thread-mainloop.h:310
+pa_threaded_mainloop_in_thread = _lib.pa_threaded_mainloop_in_thread
+pa_threaded_mainloop_in_thread.restype = c_int
+pa_threaded_mainloop_in_thread.argtypes = [POINTER(pa_threaded_mainloop)]
+
+
+# /usr/include/pulse/thread-mainloop.h:313
+# pa_threaded_mainloop_set_name = _lib.pa_threaded_mainloop_set_name
+# pa_threaded_mainloop_set_name.restype = None
+# pa_threaded_mainloop_set_name.argtypes = [POINTER(pa_threaded_mainloop), c_char_p]
+
+class struct_pa_mainloop(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_mainloop._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_pa_mainloop(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_mainloop._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_mainloop = struct_pa_mainloop # /usr/include/pulse/mainloop.h:78
+# /usr/include/pulse/mainloop.h:81
+pa_mainloop_new = _lib.pa_mainloop_new
+pa_mainloop_new.restype = POINTER(pa_mainloop)
+pa_mainloop_new.argtypes = []
+
+# /usr/include/pulse/mainloop.h:84
+pa_mainloop_free = _lib.pa_mainloop_free
+pa_mainloop_free.restype = None
+pa_mainloop_free.argtypes = [POINTER(pa_mainloop)]
+
+# /usr/include/pulse/mainloop.h:89
+pa_mainloop_prepare = _lib.pa_mainloop_prepare
+pa_mainloop_prepare.restype = c_int
+pa_mainloop_prepare.argtypes = [POINTER(pa_mainloop), c_int]
+
+# /usr/include/pulse/mainloop.h:92
+pa_mainloop_poll = _lib.pa_mainloop_poll
+pa_mainloop_poll.restype = c_int
+pa_mainloop_poll.argtypes = [POINTER(pa_mainloop)]
+
+# /usr/include/pulse/mainloop.h:96
+pa_mainloop_dispatch = _lib.pa_mainloop_dispatch
+pa_mainloop_dispatch.restype = c_int
+pa_mainloop_dispatch.argtypes = [POINTER(pa_mainloop)]
+
+# /usr/include/pulse/mainloop.h:99
+pa_mainloop_get_retval = _lib.pa_mainloop_get_retval
+pa_mainloop_get_retval.restype = c_int
+pa_mainloop_get_retval.argtypes = [POINTER(pa_mainloop)]
+
+# /usr/include/pulse/mainloop.h:107
+pa_mainloop_iterate = _lib.pa_mainloop_iterate
+pa_mainloop_iterate.restype = c_int
+pa_mainloop_iterate.argtypes = [POINTER(pa_mainloop), c_int, POINTER(c_int)]
+
+# /usr/include/pulse/mainloop.h:110
+pa_mainloop_run = _lib.pa_mainloop_run
+pa_mainloop_run.restype = c_int
+pa_mainloop_run.argtypes = [POINTER(pa_mainloop), POINTER(c_int)]
+
+# /usr/include/pulse/mainloop.h:115
+pa_mainloop_get_api = _lib.pa_mainloop_get_api
+pa_mainloop_get_api.restype = POINTER(pa_mainloop_api)
+pa_mainloop_get_api.argtypes = [POINTER(pa_mainloop)]
+
+# /usr/include/pulse/mainloop.h:118
+pa_mainloop_quit = _lib.pa_mainloop_quit
+pa_mainloop_quit.restype = None
+pa_mainloop_quit.argtypes = [POINTER(pa_mainloop), c_int]
+
+# /usr/include/pulse/mainloop.h:121
+pa_mainloop_wakeup = _lib.pa_mainloop_wakeup
+pa_mainloop_wakeup.restype = None
+pa_mainloop_wakeup.argtypes = [POINTER(pa_mainloop)]
+
+
+class struct_pollfd(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pollfd._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_pollfd(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pollfd._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_poll_func = CFUNCTYPE(c_int, POINTER(struct_pollfd), c_ulong, c_int,
+ POINTER(None)) # /usr/include/pulse/mainloop.h:124
+# /usr/include/pulse/mainloop.h:127
+pa_mainloop_set_poll_func = _lib.pa_mainloop_set_poll_func
+pa_mainloop_set_poll_func.restype = None
+pa_mainloop_set_poll_func.argtypes = [POINTER(pa_mainloop), pa_poll_func, POINTER(None)]
+
+
+class struct_pa_signal_event(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_signal_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+
+class struct_pa_signal_event(Structure):
+ __slots__ = [
+ ]
+
+
+struct_pa_signal_event._fields_ = [
+ ('_opaque_struct', c_int)
+]
+
+pa_signal_event = struct_pa_signal_event # /usr/include/pulse/mainloop-signal.h:39
+pa_signal_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_signal_event), c_int,
+ POINTER(None)) # /usr/include/pulse/mainloop-signal.h:42
+pa_signal_destroy_cb_t = CFUNCTYPE(None, POINTER(pa_mainloop_api), POINTER(pa_signal_event),
+ POINTER(None)) # /usr/include/pulse/mainloop-signal.h:45
+# /usr/include/pulse/mainloop-signal.h:48
+pa_signal_init = _lib.pa_signal_init
+pa_signal_init.restype = c_int
+pa_signal_init.argtypes = [POINTER(pa_mainloop_api)]
+
+# /usr/include/pulse/mainloop-signal.h:51
+pa_signal_done = _lib.pa_signal_done
+pa_signal_done.restype = None
+pa_signal_done.argtypes = []
+
+# /usr/include/pulse/mainloop-signal.h:54
+pa_signal_new = _lib.pa_signal_new
+pa_signal_new.restype = POINTER(pa_signal_event)
+pa_signal_new.argtypes = [c_int, pa_signal_cb_t, POINTER(None)]
+
+# /usr/include/pulse/mainloop-signal.h:57
+pa_signal_free = _lib.pa_signal_free
+pa_signal_free.restype = None
+pa_signal_free.argtypes = [POINTER(pa_signal_event)]
+
+# /usr/include/pulse/mainloop-signal.h:60
+pa_signal_set_destroy = _lib.pa_signal_set_destroy
+pa_signal_set_destroy.restype = None
+pa_signal_set_destroy.argtypes = [POINTER(pa_signal_event), pa_signal_destroy_cb_t]
+
+# /usr/include/pulse/util.h:35
+pa_get_user_name = _lib.pa_get_user_name
+pa_get_user_name.restype = c_char_p
+pa_get_user_name.argtypes = [c_char_p, c_size_t]
+
+# /usr/include/pulse/util.h:38
+pa_get_host_name = _lib.pa_get_host_name
+pa_get_host_name.restype = c_char_p
+pa_get_host_name.argtypes = [c_char_p, c_size_t]
+
+# /usr/include/pulse/util.h:41
+pa_get_fqdn = _lib.pa_get_fqdn
+pa_get_fqdn.restype = c_char_p
+pa_get_fqdn.argtypes = [c_char_p, c_size_t]
+
+# /usr/include/pulse/util.h:44
+pa_get_home_dir = _lib.pa_get_home_dir
+pa_get_home_dir.restype = c_char_p
+pa_get_home_dir.argtypes = [c_char_p, c_size_t]
+
+# /usr/include/pulse/util.h:48
+pa_get_binary_name = _lib.pa_get_binary_name
+pa_get_binary_name.restype = c_char_p
+pa_get_binary_name.argtypes = [c_char_p, c_size_t]
+
+# /usr/include/pulse/util.h:52
+pa_path_get_filename = _lib.pa_path_get_filename
+pa_path_get_filename.restype = c_char_p
+pa_path_get_filename.argtypes = [c_char_p]
+
+# /usr/include/pulse/util.h:55
+pa_msleep = _lib.pa_msleep
+pa_msleep.restype = c_int
+pa_msleep.argtypes = [c_ulong]
+
+# /usr/include/pulse/timeval.h:61
+pa_gettimeofday = _lib.pa_gettimeofday
+pa_gettimeofday.restype = POINTER(struct_timeval)
+pa_gettimeofday.argtypes = [POINTER(struct_timeval)]
+
+# /usr/include/pulse/timeval.h:65
+pa_timeval_diff = _lib.pa_timeval_diff
+pa_timeval_diff.restype = pa_usec_t
+pa_timeval_diff.argtypes = [POINTER(struct_timeval), POINTER(struct_timeval)]
+
+# /usr/include/pulse/timeval.h:68
+pa_timeval_cmp = _lib.pa_timeval_cmp
+pa_timeval_cmp.restype = c_int
+pa_timeval_cmp.argtypes = [POINTER(struct_timeval), POINTER(struct_timeval)]
+
+# /usr/include/pulse/timeval.h:71
+pa_timeval_age = _lib.pa_timeval_age
+pa_timeval_age.restype = pa_usec_t
+pa_timeval_age.argtypes = [POINTER(struct_timeval)]
+
+# /usr/include/pulse/timeval.h:74
+pa_timeval_add = _lib.pa_timeval_add
+pa_timeval_add.restype = POINTER(struct_timeval)
+pa_timeval_add.argtypes = [POINTER(struct_timeval), pa_usec_t]
+
+# /usr/include/pulse/timeval.h:77
+pa_timeval_sub = _lib.pa_timeval_sub
+pa_timeval_sub.restype = POINTER(struct_timeval)
+pa_timeval_sub.argtypes = [POINTER(struct_timeval), pa_usec_t]
+
+# /usr/include/pulse/timeval.h:80
+pa_timeval_store = _lib.pa_timeval_store
+pa_timeval_store.restype = POINTER(struct_timeval)
+pa_timeval_store.argtypes = [POINTER(struct_timeval), pa_usec_t]
+
+# /usr/include/pulse/timeval.h:83
+pa_timeval_load = _lib.pa_timeval_load
+pa_timeval_load.restype = pa_usec_t
+pa_timeval_load.argtypes = [POINTER(struct_timeval)]
+
+__all__ = ['pa_get_library_version', 'PA_API_VERSION', 'PA_PROTOCOL_VERSION',
+ 'PA_MAJOR', 'PA_MINOR', 'PA_MICRO', 'PA_CHANNELS_MAX', 'PA_RATE_MAX',
+ 'pa_sample_format_t', 'PA_SAMPLE_U8', 'PA_SAMPLE_ALAW', 'PA_SAMPLE_ULAW',
+ 'PA_SAMPLE_S16LE', 'PA_SAMPLE_S16BE', 'PA_SAMPLE_FLOAT32LE',
+ 'PA_SAMPLE_FLOAT32BE', 'PA_SAMPLE_S32LE', 'PA_SAMPLE_S32BE',
+ 'PA_SAMPLE_S24LE', 'PA_SAMPLE_S24BE', 'PA_SAMPLE_S24_32LE',
+ 'PA_SAMPLE_S24_32BE', 'PA_SAMPLE_MAX', 'PA_SAMPLE_INVALID', 'pa_sample_spec',
+ 'pa_usec_t', 'pa_bytes_per_second', 'pa_frame_size', 'pa_sample_size',
+ 'pa_sample_size_of_format', 'pa_bytes_to_usec', 'pa_usec_to_bytes',
+ 'pa_sample_spec_init', 'pa_sample_format_valid', 'pa_sample_rate_valid',
+ 'pa_channels_valid', 'pa_sample_spec_valid', 'pa_sample_spec_equal',
+ 'pa_sample_format_to_string', 'pa_parse_sample_format',
+ 'PA_SAMPLE_SPEC_SNPRINT_MAX', 'pa_sample_spec_snprint',
+ 'PA_BYTES_SNPRINT_MAX', 'pa_bytes_snprint', 'pa_sample_format_is_le',
+ 'pa_sample_format_is_be', 'pa_context_state_t', 'PA_CONTEXT_UNCONNECTED',
+ 'PA_CONTEXT_CONNECTING', 'PA_CONTEXT_AUTHORIZING', 'PA_CONTEXT_SETTING_NAME',
+ 'PA_CONTEXT_READY', 'PA_CONTEXT_FAILED', 'PA_CONTEXT_TERMINATED',
+ 'pa_stream_state_t', 'PA_STREAM_UNCONNECTED', 'PA_STREAM_CREATING',
+ 'PA_STREAM_READY', 'PA_STREAM_FAILED', 'PA_STREAM_TERMINATED',
+ 'pa_operation_state_t', 'PA_OPERATION_RUNNING', 'PA_OPERATION_DONE',
+ 'PA_OPERATION_CANCELLED', 'pa_context_flags_t', 'PA_CONTEXT_NOFLAGS',
+ 'PA_CONTEXT_NOAUTOSPAWN', 'PA_CONTEXT_NOFAIL', 'pa_direction_t',
+ 'PA_DIRECTION_OUTPUT', 'PA_DIRECTION_INPUT', 'pa_device_type_t',
+ 'PA_DEVICE_TYPE_SINK', 'PA_DEVICE_TYPE_SOURCE', 'pa_stream_direction_t',
+ 'PA_STREAM_NODIRECTION', 'PA_STREAM_PLAYBACK', 'PA_STREAM_RECORD',
+ 'PA_STREAM_UPLOAD', 'pa_stream_flags_t', 'PA_STREAM_NOFLAGS',
+ 'PA_STREAM_START_CORKED', 'PA_STREAM_INTERPOLATE_TIMING',
+ 'PA_STREAM_NOT_MONOTONIC', 'PA_STREAM_AUTO_TIMING_UPDATE',
+ 'PA_STREAM_NO_REMAP_CHANNELS', 'PA_STREAM_NO_REMIX_CHANNELS',
+ 'PA_STREAM_FIX_FORMAT', 'PA_STREAM_FIX_RATE', 'PA_STREAM_FIX_CHANNELS',
+ 'PA_STREAM_DONT_MOVE', 'PA_STREAM_VARIABLE_RATE', 'PA_STREAM_PEAK_DETECT',
+ 'PA_STREAM_START_MUTED', 'PA_STREAM_ADJUST_LATENCY',
+ 'PA_STREAM_EARLY_REQUESTS', 'PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND',
+ 'PA_STREAM_START_UNMUTED', 'PA_STREAM_FAIL_ON_SUSPEND',
+ 'PA_STREAM_RELATIVE_VOLUME', 'PA_STREAM_PASSTHROUGH', 'pa_buffer_attr',
+ 'pa_error_code_t', 'PA_OK', 'PA_ERR_ACCESS', 'PA_ERR_COMMAND',
+ 'PA_ERR_INVALID', 'PA_ERR_EXIST', 'PA_ERR_NOENTITY',
+ 'PA_ERR_CONNECTIONREFUSED', 'PA_ERR_PROTOCOL', 'PA_ERR_TIMEOUT',
+ 'PA_ERR_AUTHKEY', 'PA_ERR_INTERNAL', 'PA_ERR_CONNECTIONTERMINATED',
+ 'PA_ERR_KILLED', 'PA_ERR_INVALIDSERVER', 'PA_ERR_MODINITFAILED',
+ 'PA_ERR_BADSTATE', 'PA_ERR_NODATA', 'PA_ERR_VERSION', 'PA_ERR_TOOLARGE',
+ 'PA_ERR_NOTSUPPORTED', 'PA_ERR_UNKNOWN', 'PA_ERR_NOEXTENSION',
+ 'PA_ERR_OBSOLETE', 'PA_ERR_NOTIMPLEMENTED', 'PA_ERR_FORKED', 'PA_ERR_IO',
+ 'PA_ERR_BUSY', 'PA_ERR_MAX', 'pa_subscription_mask_t',
+ 'PA_SUBSCRIPTION_MASK_NULL', 'PA_SUBSCRIPTION_MASK_SINK',
+ 'PA_SUBSCRIPTION_MASK_SOURCE', 'PA_SUBSCRIPTION_MASK_SINK_INPUT',
+ 'PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT', 'PA_SUBSCRIPTION_MASK_MODULE',
+ 'PA_SUBSCRIPTION_MASK_CLIENT', 'PA_SUBSCRIPTION_MASK_SAMPLE_CACHE',
+ 'PA_SUBSCRIPTION_MASK_SERVER', 'PA_SUBSCRIPTION_MASK_AUTOLOAD',
+ 'PA_SUBSCRIPTION_MASK_CARD', 'PA_SUBSCRIPTION_MASK_ALL',
+ 'pa_subscription_event_type_t', 'PA_SUBSCRIPTION_EVENT_SINK',
+ 'PA_SUBSCRIPTION_EVENT_SOURCE', 'PA_SUBSCRIPTION_EVENT_SINK_INPUT',
+ 'PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT', 'PA_SUBSCRIPTION_EVENT_MODULE',
+ 'PA_SUBSCRIPTION_EVENT_CLIENT', 'PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE',
+ 'PA_SUBSCRIPTION_EVENT_SERVER', 'PA_SUBSCRIPTION_EVENT_AUTOLOAD',
+ 'PA_SUBSCRIPTION_EVENT_CARD', 'PA_SUBSCRIPTION_EVENT_FACILITY_MASK',
+ 'PA_SUBSCRIPTION_EVENT_NEW', 'PA_SUBSCRIPTION_EVENT_CHANGE',
+ 'PA_SUBSCRIPTION_EVENT_REMOVE', 'PA_SUBSCRIPTION_EVENT_TYPE_MASK',
+ 'pa_timing_info', 'pa_spawn_api', 'pa_seek_mode_t', 'PA_SEEK_RELATIVE',
+ 'PA_SEEK_ABSOLUTE', 'PA_SEEK_RELATIVE_ON_READ', 'PA_SEEK_RELATIVE_END',
+ 'pa_sink_flags_t', 'PA_SINK_NOFLAGS', 'PA_SINK_HW_VOLUME_CTRL',
+ 'PA_SINK_LATENCY', 'PA_SINK_HARDWARE', 'PA_SINK_NETWORK',
+ 'PA_SINK_HW_MUTE_CTRL', 'PA_SINK_DECIBEL_VOLUME', 'PA_SINK_FLAT_VOLUME',
+ 'PA_SINK_DYNAMIC_LATENCY', 'PA_SINK_SET_FORMATS', 'pa_sink_state_t',
+ 'PA_SINK_INVALID_STATE', 'PA_SINK_RUNNING', 'PA_SINK_IDLE',
+ 'PA_SINK_SUSPENDED', 'PA_SINK_INIT', 'PA_SINK_UNLINKED', 'pa_source_flags_t',
+ 'PA_SOURCE_NOFLAGS', 'PA_SOURCE_HW_VOLUME_CTRL', 'PA_SOURCE_LATENCY',
+ 'PA_SOURCE_HARDWARE', 'PA_SOURCE_NETWORK', 'PA_SOURCE_HW_MUTE_CTRL',
+ 'PA_SOURCE_DECIBEL_VOLUME', 'PA_SOURCE_DYNAMIC_LATENCY',
+ 'PA_SOURCE_FLAT_VOLUME', 'pa_source_state_t', 'PA_SOURCE_INVALID_STATE',
+ 'PA_SOURCE_RUNNING', 'PA_SOURCE_IDLE', 'PA_SOURCE_SUSPENDED',
+ 'PA_SOURCE_INIT', 'PA_SOURCE_UNLINKED', 'pa_free_cb_t', 'pa_port_available_t',
+ 'PA_PORT_AVAILABLE_UNKNOWN', 'PA_PORT_AVAILABLE_NO', 'PA_PORT_AVAILABLE_YES',
+ 'pa_mainloop_api', 'pa_io_event_flags_t', 'PA_IO_EVENT_NULL',
+ 'PA_IO_EVENT_INPUT', 'PA_IO_EVENT_OUTPUT', 'PA_IO_EVENT_HANGUP',
+ 'PA_IO_EVENT_ERROR', 'pa_io_event', 'pa_io_event_cb_t',
+ 'pa_io_event_destroy_cb_t', 'pa_time_event', 'pa_time_event_cb_t',
+ 'pa_time_event_destroy_cb_t', 'pa_defer_event', 'pa_defer_event_cb_t',
+ 'pa_defer_event_destroy_cb_t', 'pa_mainloop_api_once',
+ 'pa_channel_position_t', 'PA_CHANNEL_POSITION_INVALID',
+ 'PA_CHANNEL_POSITION_MONO', 'PA_CHANNEL_POSITION_FRONT_LEFT',
+ 'PA_CHANNEL_POSITION_FRONT_RIGHT', 'PA_CHANNEL_POSITION_FRONT_CENTER',
+ 'PA_CHANNEL_POSITION_LEFT', 'PA_CHANNEL_POSITION_RIGHT',
+ 'PA_CHANNEL_POSITION_CENTER', 'PA_CHANNEL_POSITION_REAR_CENTER',
+ 'PA_CHANNEL_POSITION_REAR_LEFT', 'PA_CHANNEL_POSITION_REAR_RIGHT',
+ 'PA_CHANNEL_POSITION_LFE', 'PA_CHANNEL_POSITION_SUBWOOFER',
+ 'PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER',
+ 'PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER', 'PA_CHANNEL_POSITION_SIDE_LEFT',
+ 'PA_CHANNEL_POSITION_SIDE_RIGHT', 'PA_CHANNEL_POSITION_AUX0',
+ 'PA_CHANNEL_POSITION_AUX1', 'PA_CHANNEL_POSITION_AUX2',
+ 'PA_CHANNEL_POSITION_AUX3', 'PA_CHANNEL_POSITION_AUX4',
+ 'PA_CHANNEL_POSITION_AUX5', 'PA_CHANNEL_POSITION_AUX6',
+ 'PA_CHANNEL_POSITION_AUX7', 'PA_CHANNEL_POSITION_AUX8',
+ 'PA_CHANNEL_POSITION_AUX9', 'PA_CHANNEL_POSITION_AUX10',
+ 'PA_CHANNEL_POSITION_AUX11', 'PA_CHANNEL_POSITION_AUX12',
+ 'PA_CHANNEL_POSITION_AUX13', 'PA_CHANNEL_POSITION_AUX14',
+ 'PA_CHANNEL_POSITION_AUX15', 'PA_CHANNEL_POSITION_AUX16',
+ 'PA_CHANNEL_POSITION_AUX17', 'PA_CHANNEL_POSITION_AUX18',
+ 'PA_CHANNEL_POSITION_AUX19', 'PA_CHANNEL_POSITION_AUX20',
+ 'PA_CHANNEL_POSITION_AUX21', 'PA_CHANNEL_POSITION_AUX22',
+ 'PA_CHANNEL_POSITION_AUX23', 'PA_CHANNEL_POSITION_AUX24',
+ 'PA_CHANNEL_POSITION_AUX25', 'PA_CHANNEL_POSITION_AUX26',
+ 'PA_CHANNEL_POSITION_AUX27', 'PA_CHANNEL_POSITION_AUX28',
+ 'PA_CHANNEL_POSITION_AUX29', 'PA_CHANNEL_POSITION_AUX30',
+ 'PA_CHANNEL_POSITION_AUX31', 'PA_CHANNEL_POSITION_TOP_CENTER',
+ 'PA_CHANNEL_POSITION_TOP_FRONT_LEFT', 'PA_CHANNEL_POSITION_TOP_FRONT_RIGHT',
+ 'PA_CHANNEL_POSITION_TOP_FRONT_CENTER', 'PA_CHANNEL_POSITION_TOP_REAR_LEFT',
+ 'PA_CHANNEL_POSITION_TOP_REAR_RIGHT', 'PA_CHANNEL_POSITION_TOP_REAR_CENTER',
+ 'PA_CHANNEL_POSITION_MAX', 'pa_channel_position_mask_t',
+ 'pa_channel_map_def_t', 'PA_CHANNEL_MAP_AIFF', 'PA_CHANNEL_MAP_ALSA',
+ 'PA_CHANNEL_MAP_AUX', 'PA_CHANNEL_MAP_WAVEEX', 'PA_CHANNEL_MAP_OSS',
+ 'PA_CHANNEL_MAP_DEF_MAX', 'PA_CHANNEL_MAP_DEFAULT', 'pa_channel_map',
+ 'pa_channel_map_init', 'pa_channel_map_init_mono',
+ 'pa_channel_map_init_stereo', 'pa_channel_map_init_auto',
+ 'pa_channel_map_init_extend', 'pa_channel_position_to_string',
+ 'pa_channel_position_from_string', 'pa_channel_position_to_pretty_string',
+ 'PA_CHANNEL_MAP_SNPRINT_MAX', 'pa_channel_map_snprint',
+ 'pa_channel_map_parse', 'pa_channel_map_equal', 'pa_channel_map_valid',
+ 'pa_channel_map_compatible', 'pa_channel_map_superset',
+ 'pa_channel_map_can_balance', 'pa_channel_map_can_fade',
+ 'pa_channel_map_to_name', 'pa_channel_map_to_pretty_name',
+ 'pa_channel_map_has_position', 'pa_channel_map_mask', 'pa_operation',
+ 'pa_operation_notify_cb_t', 'pa_operation_ref', 'pa_operation_unref',
+ 'pa_operation_cancel', 'pa_operation_get_state',
+ 'pa_operation_set_state_callback', 'pa_context', 'pa_context_notify_cb_t',
+ 'pa_context_success_cb_t', 'pa_context_event_cb_t', 'pa_context_new',
+ 'pa_context_new_with_proplist', 'pa_context_unref', 'pa_context_ref',
+ 'pa_context_set_state_callback', 'pa_context_set_event_callback',
+ 'pa_context_errno', 'pa_context_is_pending', 'pa_context_get_state',
+ 'pa_context_connect', 'pa_context_disconnect', 'pa_context_drain',
+ 'pa_context_exit_daemon', 'pa_context_set_default_sink',
+ 'pa_context_set_default_source', 'pa_context_is_local', 'pa_context_set_name',
+ 'pa_context_get_server', 'pa_context_get_protocol_version',
+ 'pa_context_get_server_protocol_version', 'PA_UPDATE_SET', 'PA_UPDATE_MERGE',
+ 'PA_UPDATE_REPLACE', 'pa_context_proplist_update',
+ 'pa_context_proplist_remove', 'pa_context_get_index', 'pa_context_rttime_new',
+ 'pa_context_rttime_restart', 'pa_context_get_tile_size',
+ 'pa_context_load_cookie_from_file', 'pa_volume_t', 'pa_cvolume',
+ 'pa_cvolume_equal', 'pa_cvolume_init', 'pa_cvolume_set',
+ 'PA_CVOLUME_SNPRINT_MAX', 'pa_cvolume_snprint',
+ 'PA_SW_CVOLUME_SNPRINT_DB_MAX', 'pa_sw_cvolume_snprint_dB',
+ 'PA_CVOLUME_SNPRINT_VERBOSE_MAX', 'pa_cvolume_snprint_verbose',
+ 'PA_VOLUME_SNPRINT_MAX', 'pa_volume_snprint', 'PA_SW_VOLUME_SNPRINT_DB_MAX',
+ 'pa_sw_volume_snprint_dB', 'PA_VOLUME_SNPRINT_VERBOSE_MAX',
+ 'pa_volume_snprint_verbose', 'pa_cvolume_avg', 'pa_cvolume_avg_mask',
+ 'pa_cvolume_max', 'pa_cvolume_max_mask', 'pa_cvolume_min',
+ 'pa_cvolume_min_mask', 'pa_cvolume_valid', 'pa_cvolume_channels_equal_to',
+ 'pa_sw_volume_multiply', 'pa_sw_cvolume_multiply',
+ 'pa_sw_cvolume_multiply_scalar', 'pa_sw_volume_divide',
+ 'pa_sw_cvolume_divide', 'pa_sw_cvolume_divide_scalar', 'pa_sw_volume_from_dB',
+ 'pa_sw_volume_to_dB', 'pa_sw_volume_from_linear', 'pa_sw_volume_to_linear',
+ 'pa_cvolume_remap', 'pa_cvolume_compatible',
+ 'pa_cvolume_compatible_with_channel_map', 'pa_cvolume_get_balance',
+ 'pa_cvolume_set_balance', 'pa_cvolume_get_fade', 'pa_cvolume_set_fade',
+ 'pa_cvolume_scale', 'pa_cvolume_scale_mask', 'pa_cvolume_set_position',
+ 'pa_cvolume_get_position', 'pa_cvolume_merge', 'pa_cvolume_inc_clamp',
+ 'pa_cvolume_inc', 'pa_cvolume_dec', 'pa_stream', 'pa_stream_success_cb_t',
+ 'pa_stream_request_cb_t', 'pa_stream_notify_cb_t', 'pa_stream_event_cb_t',
+ 'pa_stream_new', 'pa_stream_new_with_proplist', 'PA_ENCODING_ANY',
+ 'PA_ENCODING_PCM', 'PA_ENCODING_AC3_IEC61937', 'PA_ENCODING_EAC3_IEC61937',
+ 'PA_ENCODING_MPEG_IEC61937', 'PA_ENCODING_DTS_IEC61937',
+ 'PA_ENCODING_MPEG2_AAC_IEC61937', 'PA_ENCODING_MAX', 'PA_ENCODING_INVALID',
+ 'pa_stream_new_extended', 'pa_stream_unref', 'pa_stream_ref',
+ 'pa_stream_get_state', 'pa_stream_get_context', 'pa_stream_get_index',
+ 'pa_stream_get_device_index', 'pa_stream_get_device_name',
+ 'pa_stream_is_suspended', 'pa_stream_is_corked', 'pa_stream_connect_playback',
+ 'pa_stream_connect_record', 'pa_stream_disconnect', 'pa_stream_begin_write',
+ 'pa_stream_cancel_write', 'pa_stream_write', 'pa_stream_write_ext_free',
+ 'pa_stream_peek', 'pa_stream_drop', 'pa_stream_writable_size',
+ 'pa_stream_readable_size', 'pa_stream_drain', 'pa_stream_update_timing_info',
+ 'pa_stream_set_state_callback', 'pa_stream_set_write_callback',
+ 'pa_stream_set_read_callback', 'pa_stream_set_overflow_callback',
+ 'pa_stream_get_underflow_index', 'pa_stream_set_underflow_callback',
+ 'pa_stream_set_started_callback', 'pa_stream_set_latency_update_callback',
+ 'pa_stream_set_moved_callback', 'pa_stream_set_suspended_callback',
+ 'pa_stream_set_event_callback', 'pa_stream_set_buffer_attr_callback',
+ 'pa_stream_cork', 'pa_stream_flush', 'pa_stream_prebuf', 'pa_stream_trigger',
+ 'pa_stream_set_name', 'pa_stream_get_time', 'pa_stream_get_latency',
+ 'pa_stream_get_timing_info', 'pa_stream_get_sample_spec',
+ 'pa_stream_get_channel_map', 'pa_stream_get_format_info',
+ 'pa_stream_get_buffer_attr', 'pa_stream_set_buffer_attr',
+ 'pa_stream_update_sample_rate', 'pa_stream_proplist_update',
+ 'pa_stream_proplist_remove', 'pa_stream_set_monitor_stream',
+ 'pa_stream_get_monitor_stream', 'pa_sink_port_info', 'pa_sink_info',
+ 'pa_sink_info_cb_t', 'pa_context_get_sink_info_by_name',
+ 'pa_context_get_sink_info_by_index', 'pa_context_get_sink_info_list',
+ 'pa_context_set_sink_volume_by_index', 'pa_context_set_sink_volume_by_name',
+ 'pa_context_set_sink_mute_by_index', 'pa_context_set_sink_mute_by_name',
+ 'pa_context_suspend_sink_by_name', 'pa_context_suspend_sink_by_index',
+ 'pa_context_set_sink_port_by_index', 'pa_context_set_sink_port_by_name',
+ 'pa_source_port_info', 'pa_source_info', 'pa_source_info_cb_t',
+ 'pa_context_get_source_info_by_name', 'pa_context_get_source_info_by_index',
+ 'pa_context_get_source_info_list', 'pa_context_set_source_volume_by_index',
+ 'pa_context_set_source_volume_by_name', 'pa_context_set_source_mute_by_index',
+ 'pa_context_set_source_mute_by_name', 'pa_context_suspend_source_by_name',
+ 'pa_context_suspend_source_by_index', 'pa_context_set_source_port_by_index',
+ 'pa_context_set_source_port_by_name', 'pa_server_info', 'pa_server_info_cb_t',
+ 'pa_context_get_server_info', 'pa_module_info', 'pa_module_info_cb_t',
+ 'pa_context_get_module_info', 'pa_context_get_module_info_list',
+ 'pa_context_index_cb_t', 'pa_context_load_module', 'pa_context_unload_module',
+ 'pa_client_info', 'pa_client_info_cb_t', 'pa_context_get_client_info',
+ 'pa_context_get_client_info_list', 'pa_context_kill_client',
+ 'pa_card_profile_info', 'pa_card_profile_info2', 'pa_card_port_info',
+ 'pa_card_info', 'pa_card_info_cb_t', 'pa_context_get_card_info_by_index',
+ 'pa_context_get_card_info_by_name', 'pa_context_get_card_info_list',
+ 'pa_context_set_card_profile_by_index', 'pa_context_set_card_profile_by_name',
+ 'pa_context_set_port_latency_offset', 'pa_sink_input_info',
+ 'pa_sink_input_info_cb_t', 'pa_context_get_sink_input_info',
+ 'pa_context_get_sink_input_info_list', 'pa_context_move_sink_input_by_name',
+ 'pa_context_move_sink_input_by_index', 'pa_context_set_sink_input_volume',
+ 'pa_context_set_sink_input_mute', 'pa_context_kill_sink_input',
+ 'pa_source_output_info', 'pa_source_output_info_cb_t',
+ 'pa_context_get_source_output_info', 'pa_context_get_source_output_info_list',
+ 'pa_context_move_source_output_by_name',
+ 'pa_context_move_source_output_by_index',
+ 'pa_context_set_source_output_volume', 'pa_context_set_source_output_mute',
+ 'pa_context_kill_source_output', 'pa_stat_info', 'pa_stat_info_cb_t',
+ 'pa_context_stat', 'pa_sample_info', 'pa_sample_info_cb_t',
+ 'pa_context_get_sample_info_by_name', 'pa_context_get_sample_info_by_index',
+ 'pa_context_get_sample_info_list', 'pa_autoload_type_t', 'PA_AUTOLOAD_SINK',
+ 'PA_AUTOLOAD_SOURCE', 'pa_autoload_info', 'pa_autoload_info_cb_t',
+ 'pa_context_get_autoload_info_by_name',
+ 'pa_context_get_autoload_info_by_index', 'pa_context_get_autoload_info_list',
+ 'pa_context_add_autoload', 'pa_context_remove_autoload_by_name',
+ 'pa_context_remove_autoload_by_index', 'pa_context_subscribe_cb_t',
+ 'pa_context_subscribe', 'pa_context_set_subscribe_callback',
+ 'pa_context_play_sample_cb_t', 'pa_stream_connect_upload',
+ 'pa_stream_finish_upload', 'pa_context_remove_sample',
+ 'pa_context_play_sample', 'pa_context_play_sample_with_proplist',
+ 'pa_strerror', 'pa_xmalloc', 'pa_xmalloc0', 'pa_xrealloc', 'pa_xfree',
+ 'pa_xstrdup', 'pa_xstrndup', 'pa_xmemdup', '_pa_xnew_internal',
+ '_pa_xnew0_internal', '_pa_xnewdup_internal', '_pa_xrenew_internal',
+ 'pa_utf8_valid', 'pa_ascii_valid', 'pa_utf8_filter', 'pa_ascii_filter',
+ 'pa_utf8_to_locale', 'pa_locale_to_utf8', 'pa_threaded_mainloop',
+ 'pa_threaded_mainloop_new', 'pa_threaded_mainloop_free',
+ 'pa_threaded_mainloop_start', 'pa_threaded_mainloop_stop',
+ 'pa_threaded_mainloop_lock', 'pa_threaded_mainloop_unlock',
+ 'pa_threaded_mainloop_wait', 'pa_threaded_mainloop_signal',
+ 'pa_threaded_mainloop_accept', 'pa_threaded_mainloop_get_retval',
+ 'pa_threaded_mainloop_get_api', 'pa_threaded_mainloop_in_thread',
+ 'pa_threaded_mainloop_set_name', 'pa_mainloop', 'pa_mainloop_new',
+ 'pa_mainloop_free', 'pa_mainloop_prepare', 'pa_mainloop_poll',
+ 'pa_mainloop_dispatch', 'pa_mainloop_get_retval', 'pa_mainloop_iterate',
+ 'pa_mainloop_run', 'pa_mainloop_get_api', 'pa_mainloop_quit',
+ 'pa_mainloop_wakeup', 'pa_poll_func', 'pa_mainloop_set_poll_func',
+ 'pa_signal_event', 'pa_signal_cb_t', 'pa_signal_destroy_cb_t',
+ 'pa_signal_init', 'pa_signal_done', 'pa_signal_new', 'pa_signal_free',
+ 'pa_signal_set_destroy', 'pa_get_user_name', 'pa_get_host_name',
+ 'pa_get_fqdn', 'pa_get_home_dir', 'pa_get_binary_name',
+ 'pa_path_get_filename', 'pa_msleep', 'pa_gettimeofday', 'pa_timeval_diff',
+ 'pa_timeval_cmp', 'pa_timeval_age', 'pa_timeval_add', 'pa_timeval_sub',
+ 'pa_timeval_store', 'pa_timeval_load']
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/silent/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/silent/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..ebf66602590f5bffb4058c9e644d2de67d03db68
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/silent/__init__.py
@@ -0,0 +1,8 @@
+from . import adaptation
+
+
+def create_audio_driver():
+ return adaptation.SilentDriver()
+
+
+__all__ = ["create_audio_driver"]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/silent/adaptation.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/silent/adaptation.py
new file mode 100644
index 0000000000000000000000000000000000000000..538f1081ae1a75142872495f508b00969c1a3c6d
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/silent/adaptation.py
@@ -0,0 +1,83 @@
+from pyglet.media.drivers.base import AbstractAudioDriver, AbstractAudioPlayer
+from pyglet.media.drivers.listener import AbstractListener
+
+
+class SilentAudioPlayer(AbstractAudioPlayer):
+
+ def delete(self):
+ pass
+
+ def play(self):
+ pass
+
+ def stop(self):
+ pass
+
+ def clear(self):
+ pass
+
+ def write(self, audio_data, length):
+ pass
+
+ def get_time(self):
+ return 0
+
+ def set_volume(self, volume):
+ pass
+
+ def set_position(self, position):
+ pass
+
+ def set_min_distance(self, min_distance):
+ pass
+
+ def set_max_distance(self, max_distance):
+ pass
+
+ def set_pitch(self, pitch):
+ pass
+
+ def set_cone_orientation(self, cone_orientation):
+ pass
+
+ def set_cone_inner_angle(self, cone_inner_angle):
+ pass
+
+ def set_cone_outer_angle(self, cone_outer_angle):
+ pass
+
+ def set_cone_outer_gain(self, cone_outer_gain):
+ pass
+
+ def prefill_audio(self):
+ pass
+
+
+class SilentDriver(AbstractAudioDriver):
+
+ def create_audio_player(self, source, player):
+ return SilentAudioPlayer(source, player)
+
+ def get_listener(self):
+ return SilentListener()
+
+ def delete(self):
+ pass
+
+
+class SilentListener(AbstractListener):
+
+ def _set_volume(self, volume):
+ pass
+
+ def _set_position(self, position):
+ pass
+
+ def _set_forward_orientation(self, orientation):
+ pass
+
+ def _set_up_orientation(self, orientation):
+ pass
+
+ def _set_orientation(self):
+ pass
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/xaudio2/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/xaudio2/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..d337fd48ca9938f60c06af99fbf0acbec017676a
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/xaudio2/__init__.py
@@ -0,0 +1,8 @@
+from . import adaptation
+
+
+def create_audio_driver():
+ return adaptation.XAudio2Driver()
+
+
+__all__ = ["create_audio_driver"]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/xaudio2/adaptation.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/xaudio2/adaptation.py
new file mode 100644
index 0000000000000000000000000000000000000000..0287edf478b6d825d7edba8b1e9532c25c294b8e
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/xaudio2/adaptation.py
@@ -0,0 +1,348 @@
+import math
+
+import pyglet
+from pyglet.media.drivers.base import AbstractAudioDriver, AbstractAudioPlayer, MediaEvent
+from pyglet.media.drivers.listener import AbstractListener
+from pyglet.util import debug_print
+from . import interface
+
+_debug = debug_print('debug_media')
+
+
+def _convert_coordinates(coordinates):
+ x, y, z = coordinates
+ return x, y, -z
+
+
+class XAudio2AudioPlayer(AbstractAudioPlayer):
+ # Need to cache these because pyglet API allows update separately, but
+ # DSound requires both to be set at once.
+ _cone_inner_angle = 360
+ _cone_outer_angle = 360
+
+ min_buffer_size = 9600
+
+ max_buffer_count = 3 # Max in queue at once, increasing may impact performance depending on buffer size.
+
+ def __init__(self, driver, xa2_driver, source, player):
+ super(XAudio2AudioPlayer, self).__init__(source, player)
+ # We keep here a strong reference because the AudioDriver is anyway
+ # a singleton object which will only be deleted when the application
+ # shuts down. The AudioDriver does not keep a ref to the AudioPlayer.
+ self.driver = driver
+ self._xa2_driver = xa2_driver
+
+ # If cleared, we need to check when it's done clearing.
+ self._flushing = False
+
+ # If deleted, we need to make sure it's done deleting.
+ self._deleted = False
+
+ # Desired play state (may be actually paused due to underrun -- not
+ # implemented yet).
+ self._playing = False
+
+ # Theoretical write and play cursors for an infinite buffer. play
+ # cursor is always <= write cursor (when equal, underrun is
+ # happening).
+ self._write_cursor = 0
+ self._play_cursor = 0
+
+ # List of (play_cursor, MediaEvent), in sort order
+ self._events = []
+
+ # List of (cursor, timestamp), in sort order (cursor gives expiry
+ # place of the timestamp)
+ self._timestamps = []
+
+ # This will be True if the last buffer has already been submitted.
+ self.buffer_end_submitted = False
+
+ self._buffers = [] # Current buffers in queue waiting to be played.
+
+ self._xa2_source_voice = self._xa2_driver.get_source_voice(source, self)
+
+ self._buffer_size = int(source.audio_format.sample_rate * 2)
+
+ def on_driver_destroy(self):
+ self.stop()
+ self._xa2_source_voice = None
+
+ def on_driver_reset(self):
+ self._xa2_source_voice = self._xa2_driver.get_source_voice(self.source, self)
+
+ # Queue up any buffers that are still in queue but weren't deleted. This does not pickup where the last sample
+ # played, only where the last buffer was submitted. As such it's possible for audio to be replayed if buffer is
+ # large enough.
+ for cx2_buffer in self._buffers:
+ self._xa2_source_voice.submit_buffer(cx2_buffer)
+
+ def __del__(self):
+ if self._xa2_source_voice:
+ self._xa2_source_voice = None
+
+ def delete(self):
+ """Called from Player. Docs says to cleanup resources, but other drivers wait for GC to do it?"""
+ if self._xa2_source_voice:
+ self._deleted = True
+
+ if not self._buffers:
+ self._xa2_driver.return_voice(self._xa2_source_voice)
+
+
+ def play(self):
+ assert _debug('XAudio2 play')
+
+ if not self._playing:
+ self._playing = True
+ if not self._flushing:
+ self._xa2_source_voice.play()
+
+ assert _debug('return XAudio2 play')
+
+ def stop(self):
+ assert _debug('XAudio2 stop')
+
+ if self._playing:
+ self._playing = False
+ self.buffer_end_submitted = False
+ self._xa2_source_voice.stop()
+
+ assert _debug('return XAudio2 stop')
+
+ def clear(self):
+ assert _debug('XAudio2 clear')
+ super(XAudio2AudioPlayer, self).clear()
+ self._play_cursor = 0
+ self._write_cursor = 0
+ self.buffer_end_submitted = False
+ self._deleted = False
+
+ if self._buffers:
+ self._flushing = True
+
+ self._xa2_source_voice.flush()
+ self._buffers.clear()
+ del self._events[:]
+ del self._timestamps[:]
+
+ def _restart(self, dt):
+ """Prefill audio and attempt to replay audio."""
+ if self._playing and self._xa2_source_voice:
+ self.refill_source_player()
+ self._xa2_source_voice.play()
+
+ def refill_source_player(self):
+ """Obtains audio data from the source, puts it into a buffer to submit to the voice.
+ Unlike the other drivers this does not carve pieces of audio from the buffer and slowly
+ consume it. This submits the buffer retrieved from the decoder in it's entirety.
+ """
+
+ buffers_queued = self._xa2_source_voice.buffers_queued
+
+ # Free any buffers that have ended.
+ while len(self._buffers) > buffers_queued:
+ # Clean out any buffers that have played.
+ buffer = self._buffers.pop(0)
+ self._play_cursor += buffer.AudioBytes
+ del buffer # Does this remove AudioData within the buffer? Let GC remove or explicit remove?
+
+ # We have to wait for all of the buffers we are flushing to end before we restart next buffer.
+ # When voice reaches 0 buffers, it is available for re-use.
+ if self._flushing:
+ if buffers_queued == 0:
+ self._flushing = False
+
+ # This is required because the next call to play will come before all flushes are done.
+ # Restart at next available opportunity.
+ pyglet.clock.schedule_once(self._restart, 0)
+ return
+
+ if self._deleted:
+ if buffers_queued == 0:
+ self._deleted = False
+ self._xa2_driver.return_voice(self._xa2_source_voice)
+ return
+
+ # Wait for the playback to hit 0 buffers before we eos.
+ if self.buffer_end_submitted:
+ if buffers_queued == 0:
+ self._xa2_source_voice.stop()
+ MediaEvent("on_eos").sync_dispatch_to_player(self.player)
+ else:
+ current_buffers = []
+ while buffers_queued < self.max_buffer_count:
+ audio_data = self.source.get_audio_data(self._buffer_size, 0.0)
+ if audio_data:
+ assert _debug(
+ 'Xaudio2: audio data - length: {}, duration: {}, buffer size: {}'.format(audio_data.length,
+ audio_data.duration,
+ self._buffer_size))
+
+ if audio_data.length == 0: # Sometimes audio data has 0 length at the front?
+ continue
+
+ x2_buffer = self._xa2_driver.create_buffer(audio_data)
+
+ current_buffers.append(x2_buffer)
+
+ self._write_cursor += x2_buffer.AudioBytes # We've pushed this many bytes into the source player.
+
+ self._add_audiodata_events(audio_data)
+ self._add_audiodata_timestamp(audio_data)
+
+ buffers_queued += 1
+ else:
+ # End of audio data, set last packet as end.
+ self.buffer_end_submitted = True
+ break
+
+ # We submit the buffers here, just in-case the end of stream was found.
+ for cx2_buffer in current_buffers:
+ self._xa2_source_voice.submit_buffer(cx2_buffer)
+
+ # Store buffers temporarily, otherwise they get GC'd.
+ self._buffers.extend(current_buffers)
+
+ self._dispatch_pending_events()
+
+ def _dispatch_new_event(self, event_name):
+ MediaEvent(event_name).sync_dispatch_to_player(self.player)
+
+ def _add_audiodata_events(self, audio_data):
+ for event in audio_data.events:
+ event_cursor = self._write_cursor + event.timestamp * self.source.audio_format.bytes_per_second
+ assert _debug('Adding event', event, 'at', event_cursor)
+ self._events.append((event_cursor, event))
+
+ def _add_audiodata_timestamp(self, audio_data):
+ ts_cursor = self._write_cursor + audio_data.length
+ self._timestamps.append(
+ (ts_cursor, audio_data.timestamp + audio_data.duration))
+
+ def _dispatch_pending_events(self):
+ pending_events = []
+ while self._events and self._events[0][0] <= self._play_cursor:
+ _, event = self._events.pop(0)
+ pending_events.append(event)
+
+ assert _debug('Dispatching pending events: {}'.format(pending_events))
+ assert _debug('Remaining events: {}'.format(self._events))
+
+ for event in pending_events:
+ event._sync_dispatch_to_player(self.player)
+
+ def _cleanup_timestamps(self):
+ while self._timestamps and self._timestamps[0][0] < self._play_cursor:
+ del self._timestamps[0]
+
+ def get_time(self):
+ self.update_play_cursor()
+ if self._timestamps:
+ cursor, ts = self._timestamps[0]
+ result = ts + (self._play_cursor - cursor) / float(self.source.audio_format.bytes_per_second)
+ else:
+ result = None
+
+ return result
+
+ def set_volume(self, volume):
+ self._xa2_source_voice.volume = volume
+
+ def set_position(self, position):
+ if self._xa2_source_voice.is_emitter:
+ self._xa2_source_voice.position = _convert_coordinates(position)
+
+ def set_min_distance(self, min_distance):
+ """Not a true min distance, but similar effect. Changes CurveDistanceScaler default is 1."""
+ if self._xa2_source_voice.is_emitter:
+ self._xa2_source_voice.distance_scaler = min_distance
+
+ def set_max_distance(self, max_distance):
+ """No such thing built into xaudio2"""
+ return
+
+ def set_pitch(self, pitch):
+ self._xa2_source_voice.frequency = pitch
+
+ def set_cone_orientation(self, cone_orientation):
+ if self._xa2_source_voice.is_emitter:
+ self._xa2_source_voice.cone_orientation = _convert_coordinates(cone_orientation)
+
+ def set_cone_inner_angle(self, cone_inner_angle):
+ if self._xa2_source_voice.is_emitter:
+ self._cone_inner_angle = int(cone_inner_angle)
+ self._set_cone_angles()
+
+ def set_cone_outer_angle(self, cone_outer_angle):
+ if self._xa2_source_voice.is_emitter:
+ self._cone_outer_angle = int(cone_outer_angle)
+ self._set_cone_angles()
+
+ def _set_cone_angles(self):
+ inner = min(self._cone_inner_angle, self._cone_outer_angle)
+ outer = max(self._cone_inner_angle, self._cone_outer_angle)
+ self._xa2_source_voice.set_cone_angles(math.radians(inner), math.radians(outer))
+
+ def set_cone_outer_gain(self, cone_outer_gain):
+ if self._xa2_source_voice.is_emitter:
+ self._xa2_source_voice.cone_outside_volume = cone_outer_gain
+
+ def prefill_audio(self):
+ # Cannot refill during a flush. Schedule will handle it.
+ if not self._flushing:
+ self.refill_source_player()
+
+
+class XAudio2Driver(AbstractAudioDriver):
+ def __init__(self):
+ self._xa2_driver = interface.XAudio2Driver()
+ self._xa2_listener = self._xa2_driver.create_listener()
+
+ assert self._xa2_driver is not None
+ assert self._xa2_listener is not None
+
+ def __del__(self):
+ self.delete()
+
+ def get_performance(self):
+ assert self._xa2_driver is not None
+ return self._xa2_driver.get_performance()
+
+ def create_audio_player(self, source, player):
+ assert self._xa2_driver is not None
+ return XAudio2AudioPlayer(self, self._xa2_driver, source, player)
+
+ def get_listener(self):
+ assert self._xa2_driver is not None
+ assert self._xa2_listener is not None
+ return XAudio2Listener(self._xa2_listener, self._xa2_driver)
+
+ def delete(self):
+ self._xa2_listener = None
+
+
+class XAudio2Listener(AbstractListener):
+ def __init__(self, xa2_listener, xa2_driver):
+ self._xa2_listener = xa2_listener
+ self._xa2_driver = xa2_driver
+
+ def _set_volume(self, volume):
+ self._volume = volume
+ self._xa2_driver.volume = volume
+
+ def _set_position(self, position):
+ self._position = position
+ self._xa2_listener.position = _convert_coordinates(position)
+
+ def _set_forward_orientation(self, orientation):
+ self._forward_orientation = orientation
+ self._set_orientation()
+
+ def _set_up_orientation(self, orientation):
+ self._up_orientation = orientation
+ self._set_orientation()
+
+ def _set_orientation(self):
+ self._xa2_listener.orientation = _convert_coordinates(self._forward_orientation) + _convert_coordinates(
+ self._up_orientation)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/xaudio2/interface.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/xaudio2/interface.py
new file mode 100644
index 0000000000000000000000000000000000000000..e1594f6b831dbe746b54344d7ce31911763f1970
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/xaudio2/interface.py
@@ -0,0 +1,582 @@
+import weakref
+from collections import namedtuple, defaultdict
+
+import pyglet
+from pyglet.libs.win32.types import *
+from pyglet.util import debug_print
+from pyglet.media.devices import get_audio_device_manager
+from . import lib_xaudio2 as lib
+
+_debug = debug_print('debug_media')
+
+
+class XAudio2Driver:
+ # Specifies if positional audio should be used. Can be enabled later, but not disabled.
+ allow_3d = True
+
+ # Which processor to use. (#1 by default)
+ processor = lib.XAUDIO2_DEFAULT_PROCESSOR
+
+ # Which stream classification Windows uses on this driver.
+ category = lib.AudioCategory_GameEffects
+
+ # If the driver errors or disappears, it will attempt to restart the engine.
+ restart_on_error = True
+
+ # Max Frequency a voice can have. Setting this higher/lower will increase/decrease memory allocation.
+ max_frequency_ratio = 2.0
+
+ def __init__(self):
+ """Creates an XAudio2 master voice and sets up 3D audio if specified. This attaches to the default audio
+ device and will create a virtual audio endpoint that changes with the system. It will not recover if a
+ critical error is encountered such as no more audio devices are present.
+ """
+ assert _debug('Constructing XAudio2Driver')
+ self._listener = None
+ self._xaudio2 = None
+ self._dead = False
+
+ self._emitting_voices = [] # Contains all of the emitting source voices.
+ self._voice_pool = defaultdict(list)
+ self._in_use = [] # All voices currently in use.
+
+ self._players = [] # Only used for resetting/restoring xaudio2. Store players to callback.
+
+ self._create_xa2()
+
+ if self.restart_on_error:
+ audio_devices = get_audio_device_manager()
+ if audio_devices:
+ assert _debug('Audio device instance found.')
+ audio_devices.push_handlers(self)
+
+ if audio_devices.get_default_output() is None:
+ raise ImportError("No default audio device found, can not create driver.")
+
+ pyglet.clock.schedule_interval_soft(self._check_state, 0.5)
+
+ def _check_state(self, dt):
+ """Hack/workaround, you cannot shutdown/create XA2 within a COM callback, set a schedule to check state."""
+ if self._dead is True:
+ if self._xaudio2:
+ self._shutdown_xaudio2()
+ else:
+ if not self._xaudio2:
+ self._create_xa2()
+ # Notify all active it's reset.
+ for player in self._players:
+ player.dispatch_event('on_driver_reset')
+
+ self._players.clear()
+
+ def on_default_changed(self, device):
+ """Callback derived from the Audio Devices to help us determine when the system no longer has output."""
+ if device is None:
+ assert _debug('Error: Default audio device was removed or went missing.')
+ self._dead = True
+ else:
+ if self._dead:
+ assert _debug('Warning: Default audio device added after going missing.')
+ self._dead = False
+
+ def _create_xa2(self, device_id=None):
+ self._xaudio2 = lib.IXAudio2()
+
+ try:
+ lib.XAudio2Create(ctypes.byref(self._xaudio2), 0, self.processor)
+ except OSError:
+ raise ImportError("XAudio2 driver could not be initialized.")
+
+ if _debug:
+ # Debug messages are found in Windows Event Viewer, you must enable event logging:
+ # Applications and Services -> Microsoft -> Windows -> Xaudio2 -> Debug Logging.
+ # Right click -> Enable Logs
+ debug = lib.XAUDIO2_DEBUG_CONFIGURATION()
+ debug.LogThreadID = True
+ debug.TraceMask = lib.XAUDIO2_LOG_ERRORS | lib.XAUDIO2_LOG_WARNINGS
+ debug.BreakMask = lib.XAUDIO2_LOG_WARNINGS
+
+ self._xaudio2.SetDebugConfiguration(ctypes.byref(debug), None)
+
+ self._master_voice = lib.IXAudio2MasteringVoice()
+ self._xaudio2.CreateMasteringVoice(byref(self._master_voice),
+ lib.XAUDIO2_DEFAULT_CHANNELS,
+ lib.XAUDIO2_DEFAULT_SAMPLERATE,
+ 0, device_id, None, self.category)
+
+ if self.allow_3d:
+ self.enable_3d()
+
+ @property
+ def active_voices(self):
+ return self._in_use
+
+ @property
+ def pooled_voices(self):
+ return [voice for voices in self._voice_pool.values() for voice in voices]
+
+ @property
+ def all_voices(self):
+ """All pooled and active voices."""
+ return self.active_voices + self.all_voices
+
+ def clear_pool(self):
+ """Destroy and then clear the pool of voices"""
+ for voice in self.pooled_voices:
+ voice.destroy()
+
+ for voice_key in self._voice_pool:
+ self._voice_pool[voice_key].clear()
+
+ def clear_active(self):
+ """Destroy and then clear all active voices"""
+ for voice in self._in_use:
+ voice.destroy()
+
+ self._in_use.clear()
+
+ def set_device(self, device):
+ """Attach XA2 with a specific device rather than the virtual device."""
+ self._shutdown_xaudio2()
+ self._create_xa2(device.id)
+
+ # Notify all active players it's reset..
+ for player in self._players:
+ player.dispatch_event('on_driver_reset')
+
+ self._players.clear()
+
+ def _shutdown_xaudio2(self):
+ """Stops and destroys all active voices, then destroys XA2 instance."""
+ for voice in self.active_voices:
+ voice.player.on_driver_destroy()
+ self._players.append(voice.player.player)
+
+ self._delete_driver()
+
+ def _delete_driver(self):
+ if self._xaudio2:
+ # Stop 3d
+ if self.allow_3d:
+ pyglet.clock.unschedule(self._calculate_3d_sources)
+
+ # Destroy all pooled voices as master will change.
+ self.clear_pool()
+ self.clear_active()
+
+ self._xaudio2.StopEngine()
+ self._xaudio2.Release()
+ self._xaudio2 = None
+
+ def enable_3d(self):
+ """Initializes the prerequisites for 3D positional audio and initializes with default DSP settings."""
+ channel_mask = DWORD()
+ self._master_voice.GetChannelMask(byref(channel_mask))
+
+ self._x3d_handle = lib.X3DAUDIO_HANDLE()
+ lib.X3DAudioInitialize(channel_mask.value, lib.X3DAUDIO_SPEED_OF_SOUND, self._x3d_handle)
+
+ self._mvoice_details = lib.XAUDIO2_VOICE_DETAILS()
+ self._master_voice.GetVoiceDetails(byref(self._mvoice_details))
+
+ matrix = (FLOAT * self._mvoice_details.InputChannels)()
+ self._dsp_settings = lib.X3DAUDIO_DSP_SETTINGS()
+ self._dsp_settings.SrcChannelCount = 1
+ self._dsp_settings.DstChannelCount = self._mvoice_details.InputChannels
+ self._dsp_settings.pMatrixCoefficients = matrix
+
+ pyglet.clock.schedule_interval_soft(self._calculate_3d_sources, 1 / 15.0)
+
+ @property
+ def volume(self):
+ vol = c_float()
+ self._master_voice.GetVolume(ctypes.byref(vol))
+ return vol.value
+
+ @volume.setter
+ def volume(self, value):
+ """Sets global volume of the master voice."""
+ self._master_voice.SetVolume(value, 0)
+
+ def _calculate_3d_sources(self, dt):
+ """We calculate the 3d emitters and sources every 15 fps, committing everything after deferring all changes."""
+ for source_voice in self._emitting_voices:
+ self.apply3d(source_voice)
+
+ self._xaudio2.CommitChanges(0)
+
+ def _calculate3d(self, listener, emitter):
+ lib.X3DAudioCalculate(
+ self._x3d_handle,
+ listener,
+ emitter,
+ lib.default_dsp_calculation,
+ self._dsp_settings
+ )
+
+ def _apply3d(self, voice, commit):
+ """Calculates the output channels based on the listener and emitter and default DSP settings.
+ Commit determines if the settings are applied immediately (0) or committed at once through the xaudio driver.
+ """
+ voice.SetOutputMatrix(self._master_voice,
+ 1,
+ self._mvoice_details.InputChannels,
+ self._dsp_settings.pMatrixCoefficients,
+ commit)
+
+ voice.SetFrequencyRatio(self._dsp_settings.DopplerFactor, commit)
+
+ def apply3d(self, source_voice, commit=1):
+ self._calculate3d(self._listener.listener, source_voice._emitter)
+ self._apply3d(source_voice._voice, commit)
+
+ def __del__(self):
+ try:
+ self._delete_driver()
+ pyglet.clock.unschedule(self._check_state)
+ except AttributeError:
+ # Usually gets unloaded by default on app exit, but be safe.
+ pass
+
+ def get_performance(self):
+ """Retrieve some basic XAudio2 performance data such as memory usage and source counts."""
+ pf = lib.XAUDIO2_PERFORMANCE_DATA()
+ self._xaudio2.GetPerformanceData(ctypes.byref(pf))
+ return pf
+
+ def create_listener(self):
+ assert self._listener is None, "You can only create one listener."
+ self._listener = XAudio2Listener(self)
+ return self._listener
+
+ def get_source_voice(self, source, player):
+ """ Get a source voice from the pool. Source voice creation can be slow to create/destroy. So pooling is
+ recommended. We pool based on audio channels as channels must be the same as well as frequency.
+ Source voice handles all of the audio playing and state for a single source."""
+ voice_key = (source.audio_format.channels, source.audio_format.sample_size, source.audio_format.sample_rate)
+ if len(self._voice_pool[voice_key]) > 0:
+ source_voice = self._voice_pool[voice_key].pop(0)
+ source_voice.acquired(player)
+ else:
+ source_voice = self._get_voice(source, player)
+
+ if source_voice.is_emitter:
+ self._emitting_voices.append(source_voice)
+
+ self._in_use.append(source_voice)
+ return source_voice
+
+ def _create_new_voice(self, source, player):
+ """Has the driver create a new source voice for the source."""
+ voice = lib.IXAudio2SourceVoice()
+
+ wfx_format = self.create_wave_format(source.audio_format)
+
+ callback = lib.XA2SourceCallback(player)
+ self._xaudio2.CreateSourceVoice(ctypes.byref(voice),
+ ctypes.byref(wfx_format),
+ 0,
+ self.max_frequency_ratio,
+ callback,
+ None, None)
+ return voice, callback
+
+ def _get_voice(self, source, player):
+ """Creates a new source voice and puts it into XA2SourceVoice high level wrap."""
+ voice, callback = self._create_new_voice(source, player)
+ return XA2SourceVoice(voice, callback, source.audio_format)
+
+ def return_voice(self, voice):
+ """Reset a voice and return it to the pool."""
+ voice.reset()
+ voice_key = (voice.audio_format.channels, voice.audio_format.sample_size, voice.audio_format.sample_rate)
+ self._voice_pool[voice_key].append(voice)
+
+ if voice.is_emitter:
+ self._emitting_voices.remove(voice)
+
+ @staticmethod
+ def create_buffer(audio_data):
+ """Creates a XAUDIO2_BUFFER to be used with a source voice.
+ Audio data cannot be purged until the source voice has played it; doing so will cause glitches.
+ Furthermore, if the data is not in a string buffer, such as pure bytes, it must be converted."""
+ if type(audio_data.data) == bytes:
+ data = (ctypes.c_char * audio_data.length)()
+ ctypes.memmove(data, audio_data.data, audio_data.length)
+ else:
+ data = audio_data.data
+
+ buff = lib.XAUDIO2_BUFFER()
+ buff.AudioBytes = audio_data.length
+ buff.pAudioData = data
+ return buff
+
+ @staticmethod
+ def create_wave_format(audio_format):
+ wfx = lib.WAVEFORMATEX()
+ wfx.wFormatTag = lib.WAVE_FORMAT_PCM
+ wfx.nChannels = audio_format.channels
+ wfx.nSamplesPerSec = audio_format.sample_rate
+ wfx.wBitsPerSample = audio_format.sample_size
+ wfx.nBlockAlign = wfx.wBitsPerSample * wfx.nChannels // 8
+ wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign
+ return wfx
+
+
+class XA2SourceVoice:
+
+ def __init__(self, voice, callback, audio_format):
+ self._voice_state = lib.XAUDIO2_VOICE_STATE() # Used for buffer state, will be reused constantly.
+ self._voice = voice
+ self._callback = callback
+
+ self.audio_format = audio_format
+ # If it's a mono source, then we can make it an emitter.
+ # In the future, non-mono source's can be supported as well.
+ if audio_format is not None and audio_format.channels == 1:
+ self._emitter = lib.X3DAUDIO_EMITTER()
+ self._emitter.ChannelCount = audio_format.channels
+ self._emitter.CurveDistanceScaler = 1.0
+
+ # Commented are already set by the Player class.
+ # Leaving for visibility on default values
+ cone = lib.X3DAUDIO_CONE()
+ # cone.InnerAngle = math.radians(360)
+ # cone.OuterAngle = math.radians(360)
+ cone.InnerVolume = 1.0
+ # cone.OuterVolume = 1.0
+
+ self._emitter.pCone = pointer(cone)
+ self._emitter.pVolumeCurve = None
+ else:
+ self._emitter = None
+
+ @property
+ def player(self):
+ """Returns the player class, stored within the callback."""
+ return self._callback.xa2_player
+
+ def delete(self):
+ self._emitter = None
+ self._voice.Stop(0, 0)
+ self._voice.FlushSourceBuffers()
+ self._voice = None
+ self._callback.xa2_player = None
+
+ def __del__(self):
+ self.destroy()
+
+ def destroy(self):
+ """Completely destroy the voice."""
+ self._emitter = None
+
+ if self._voice is not None:
+ try:
+ self._voice.Stop(0, 0)
+ self._voice.FlushSourceBuffers()
+ self._voice.DestroyVoice()
+ except TypeError:
+ pass
+
+ self._voice = None
+
+ self._callback = None
+
+ def acquired(self, player):
+ """A voice has been reacquired, set the player for callback."""
+ self._callback.xa2_player = player
+
+ def reset(self):
+ """When a voice is returned to the pool, reset position on emitter."""
+ if self._emitter is not None:
+ self.position = (0, 0, 0)
+
+ self._voice.Stop(0, 0)
+ self._voice.FlushSourceBuffers()
+ self._callback.xa2_player = None
+
+ @property
+ def buffers_queued(self):
+ """Get the amount of buffers in the current voice. Adding flag for no samples played is 3x faster."""
+ self._voice.GetState(ctypes.byref(self._voice_state), lib.XAUDIO2_VOICE_NOSAMPLESPLAYED)
+ return self._voice_state.BuffersQueued
+
+ @property
+ def volume(self):
+ vol = c_float()
+ self._voice.GetVolume(ctypes.byref(vol))
+ return vol.value
+
+ @volume.setter
+ def volume(self, value):
+ self._voice.SetVolume(value, 0)
+
+ @property
+ def is_emitter(self):
+ return self._emitter is not None
+
+ @property
+ def position(self):
+ if self.is_emitter:
+ return self._emitter.Position.x, self._emitter.Position.y, self._emitter.Position.z
+ else:
+ return 0, 0, 0
+
+ @position.setter
+ def position(self, position):
+ if self.is_emitter:
+ x, y, z = position
+ self._emitter.Position.x = x
+ self._emitter.Position.y = y
+ self._emitter.Position.z = z
+
+ @property
+ def min_distance(self):
+ """Curve distance scaler that is used to scale normalized distance curves to user-defined world units,
+ and/or to exaggerate their effect."""
+ if self.is_emitter:
+ return self._emitter.CurveDistanceScaler
+ else:
+ return 0
+
+ @min_distance.setter
+ def min_distance(self, value):
+ if self.is_emitter:
+ if self._emitter.CurveDistanceScaler != value:
+ self._emitter.CurveDistanceScaler = min(value, lib.FLT_MAX)
+
+ @property
+ def frequency(self):
+ """The actual frequency ratio. If voice is 3d enabled, will be overwritten next apply3d cycle."""
+ value = c_float()
+ self._voice.GetFrequencyRatio(byref(value))
+ return value.value
+
+ @frequency.setter
+ def frequency(self, value):
+ if self.frequency == value:
+ return
+
+ self._voice.SetFrequencyRatio(value, 0)
+
+ @property
+ def cone_orientation(self):
+ """The orientation of the sound emitter."""
+ if self.is_emitter:
+ return self._emitter.OrientFront.x, self._emitter.OrientFront.y, self._emitter.OrientFront.z
+ else:
+ return 0, 0, 0
+
+ @cone_orientation.setter
+ def cone_orientation(self, value):
+ if self.is_emitter:
+ x, y, z = value
+ self._emitter.OrientFront.x = x
+ self._emitter.OrientFront.y = y
+ self._emitter.OrientFront.z = z
+
+ _ConeAngles = namedtuple('_ConeAngles', ['inside', 'outside'])
+
+ @property
+ def cone_angles(self):
+ """The inside and outside angles of the sound projection cone."""
+ if self.is_emitter:
+ return self._ConeAngles(self._emitter.pCone.contents.InnerAngle, self._emitter.pCone.contents.OuterAngle)
+ else:
+ return self._ConeAngles(0, 0)
+
+ def set_cone_angles(self, inside, outside):
+ """The inside and outside angles of the sound projection cone."""
+ if self.is_emitter:
+ self._emitter.pCone.contents.InnerAngle = inside
+ self._emitter.pCone.contents.OuterAngle = outside
+
+ @property
+ def cone_outside_volume(self):
+ """The volume scaler of the sound beyond the outer cone."""
+ if self.is_emitter:
+ return self._emitter.pCone.contents.OuterVolume
+ else:
+ return 0
+
+ @cone_outside_volume.setter
+ def cone_outside_volume(self, value):
+ if self.is_emitter:
+ self._emitter.pCone.contents.OuterVolume = value
+
+ @property
+ def cone_inside_volume(self):
+ """The volume scaler of the sound within the inner cone."""
+ if self.is_emitter:
+ return self._emitter.pCone.contents.InnerVolume
+ else:
+ return 0
+
+ @cone_inside_volume.setter
+ def cone_inside_volume(self, value):
+ if self.is_emitter:
+ self._emitter.pCone.contents.InnerVolume = value
+
+ def flush(self):
+ """Stop and removes all buffers already queued. OnBufferEnd is called for each."""
+ self._voice.Stop(0, 0)
+ self._voice.FlushSourceBuffers()
+
+ def play(self):
+ self._voice.Start(0, 0)
+
+ def stop(self):
+ self._voice.Stop(0, 0)
+
+ def submit_buffer(self, x2_buffer):
+ self._voice.SubmitSourceBuffer(ctypes.byref(x2_buffer), None)
+
+
+class XAudio2Listener:
+ def __init__(self, driver):
+ self.xa2_driver = weakref.proxy(driver)
+ self.listener = lib.X3DAUDIO_LISTENER()
+
+ # Default listener orientations for DirectSound/XAudio2:
+ # Front: (0, 0, 1), Up: (0, 1, 0)
+ self.listener.OrientFront.x = 0
+ self.listener.OrientFront.y = 0
+ self.listener.OrientFront.z = 1
+
+ self.listener.OrientTop.x = 0
+ self.listener.OrientTop.y = 1
+ self.listener.OrientTop.z = 0
+
+ def __del__(self):
+ self.delete()
+
+ def delete(self):
+ self.listener = None
+
+ @property
+ def position(self):
+ return self.listener.Position.x, self.listener.Position.y, self.listener.Position.z
+
+ @position.setter
+ def position(self, value):
+ x, y, z = value
+ self.listener.Position.x = x
+ self.listener.Position.y = y
+ self.listener.Position.z = z
+
+ @property
+ def orientation(self):
+ return self.listener.OrientFront.x, self.listener.OrientFront.y, self.listener.OrientFront.z, \
+ self.listener.OrientTop.x, self.listener.OrientTop.y, self.listener.OrientTop.z
+
+ @orientation.setter
+ def orientation(self, orientation):
+ front_x, front_y, front_z, top_x, top_y, top_z = orientation
+
+ self.listener.OrientFront.x = front_x
+ self.listener.OrientFront.y = front_y
+ self.listener.OrientFront.z = front_z
+
+ self.listener.OrientTop.x = top_x
+ self.listener.OrientTop.y = top_y
+ self.listener.OrientTop.z = top_z
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/xaudio2/lib_xaudio2.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/xaudio2/lib_xaudio2.py
new file mode 100644
index 0000000000000000000000000000000000000000..3ee7f30b5897c90b31760a8dad48b727b1c381e8
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/drivers/xaudio2/lib_xaudio2.py
@@ -0,0 +1,678 @@
+import ctypes
+import platform
+import os
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.types import *
+from pyglet.libs.win32 import com
+from pyglet.util import debug_print
+
+_debug = debug_print('debug_media')
+
+
+def load_xaudio2(dll_name):
+ """This will attempt to load a version of XAudio2. Versions supported: 2.9, 2.8.
+ While Windows 8 ships with 2.8 and Windows 10 ships with version 2.9, it is possible to install 2.9 on 8/8.1.
+ """
+ xaudio2 = dll_name
+ # System32 and SysWOW64 folders are opposite perception in Windows x64.
+ # System32 = x64 dll's | SysWOW64 = x86 dlls
+ # By default ctypes only seems to look in system32 regardless of Python architecture, which has x64 dlls.
+ if platform.architecture()[0] == '32bit':
+ if platform.machine().endswith('64'): # Machine is 64 bit, Python is 32 bit.
+ xaudio2 = os.path.join(os.environ['WINDIR'], 'SysWOW64', '{}.dll'.format(xaudio2))
+
+ xaudio2_lib = ctypes.windll.LoadLibrary(xaudio2)
+
+ # Somehow x3d uses different calling structure than the rest of the DLL; Only affects 32 bit? Microsoft...
+ x3d_lib = ctypes.cdll.LoadLibrary(xaudio2)
+ return xaudio2_lib, x3d_lib
+
+
+try:
+ xaudio2_lib, x3d_lib = load_xaudio2("xaudio2_9")
+except OSError:
+ _debug("Could not load XAudio2.9 library")
+ try:
+ xaudio2_lib, x3d_lib = load_xaudio2("xaudio2_8")
+ except OSError:
+ _debug("Could not load XAudio2.8 library")
+ raise ImportError('Could not locate a supported XAudio2 library.')
+
+
+UINT32 = c_uint32
+FLOAT32 = c_float
+
+
+class XAUDIO2_DEBUG_CONFIGURATION(ctypes.Structure):
+ _fields_ = [
+ ('TraceMask', UINT32),
+ ('BreakMask', UINT32),
+ ('LogThreadID', BOOL),
+ ('LogFileline', BOOL),
+ ('LogFunctionName', BOOL),
+ ('LogTiming', BOOL),
+ ]
+
+
+class XAUDIO2_PERFORMANCE_DATA(ctypes.Structure):
+ _fields_ = [
+ ('AudioCyclesSinceLastQuery', c_uint64),
+ ('TotalCyclesSinceLastQuery', c_uint64),
+ ('MinimumCyclesPerQuantum', UINT32),
+ ('MaximumCyclesPerQuantum', UINT32),
+ ('MemoryUsageInBytes', UINT32),
+ ('CurrentLatencyInSamples', UINT32),
+ ('GlitchesSinceEngineStarted', UINT32),
+ ('ActiveSourceVoiceCount', UINT32),
+ ('TotalSourceVoiceCount', UINT32),
+ ('ActiveSubmixVoiceCount', UINT32),
+ ('ActiveResamplerCount', UINT32),
+ ('ActiveMatrixMixCount', UINT32),
+ ('ActiveXmaSourceVoices', UINT32),
+ ('ActiveXmaStreams', UINT32),
+ ]
+
+ def __repr__(self):
+ return "XAUDIO2PerformanceData(active_voices={}, total_voices={}, glitches={}, latency={} samples, memory_usage={} bytes)".format(self.ActiveSourceVoiceCount, self.TotalSourceVoiceCount, self.GlitchesSinceEngineStarted, self.CurrentLatencyInSamples, self.MemoryUsageInBytes)
+
+
+class XAUDIO2_VOICE_SENDS(ctypes.Structure):
+ _fields_ = [
+ ('SendCount', UINT32),
+ ('pSends', c_void_p),
+ ]
+
+
+class XAUDIO2_BUFFER(ctypes.Structure):
+ _fields_ = [
+ ('Flags', UINT32),
+ ('AudioBytes', UINT32),
+ ('pAudioData', POINTER(c_char)),
+ ('PlayBegin', UINT32),
+ ('PlayLength', UINT32),
+ ('LoopBegin', UINT32),
+ ('LoopLength', UINT32),
+ ('LoopCount', UINT32),
+ ('pContext', c_void_p),
+ ]
+
+class XAUDIO2_VOICE_STATE(ctypes.Structure):
+ _fields_ = [
+ ('pCurrentBufferContext', c_void_p),
+ ('BuffersQueued', UINT32),
+ ('SamplesPlayed', UINT32)
+ ]
+
+ def __repr__(self):
+ return "XAUDIO2_VOICE_STATE(BuffersQueued={0}, SamplesPlayed={1})".format(self.BuffersQueued, self.SamplesPlayed)
+
+class WAVEFORMATEX(ctypes.Structure):
+ _fields_ = [
+ ('wFormatTag', WORD),
+ ('nChannels', WORD),
+ ('nSamplesPerSec', DWORD),
+ ('nAvgBytesPerSec', DWORD),
+ ('nBlockAlign', WORD),
+ ('wBitsPerSample', WORD),
+ ('cbSize', WORD),
+ ]
+
+ def __repr__(self):
+ return 'WAVEFORMATEX(wFormatTag={}, nChannels={}, nSamplesPerSec={}, nAvgBytesPersec={}' \
+ ', nBlockAlign={}, wBitsPerSample={}, cbSize={})'.format(
+ self.wFormatTag, self.nChannels, self.nSamplesPerSec,
+ self.nAvgBytesPerSec, self.nBlockAlign, self.wBitsPerSample,
+ self.cbSize)
+
+XAUDIO2_USE_DEFAULT_PROCESSOR = 0x00000000 # Win 10+
+
+if WINDOWS_10_ANNIVERSARY_UPDATE_OR_GREATER:
+ XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_USE_DEFAULT_PROCESSOR
+else:
+ XAUDIO2_DEFAULT_PROCESSOR = 0x00000001 # Windows 8/8.1
+
+
+XAUDIO2_LOG_ERRORS = 0x0001 # For handled errors with serious effects.
+XAUDIO2_LOG_WARNINGS = 0x0002 # For handled errors that may be recoverable.
+XAUDIO2_LOG_INFO = 0x0004 # Informational chit-chat (e.g. state changes).
+XAUDIO2_LOG_DETAIL = 0x0008 # More detailed chit-chat.
+XAUDIO2_LOG_API_CALLS = 0x0010 # Public API function entries and exits.
+XAUDIO2_LOG_FUNC_CALLS = 0x0020 # Internal function entries and exits.
+XAUDIO2_LOG_TIMING = 0x0040 # Delays detected and other timing data.
+XAUDIO2_LOG_LOCKS = 0x0080 # Usage of critical sections and mutexes.
+XAUDIO2_LOG_MEMORY = 0x0100 # Memory heap usage information.
+XAUDIO2_LOG_STREAMING = 0x1000 # Audio streaming information.
+
+
+# Some XAUDIO2 global settings, most not used, but useful information
+XAUDIO2_MAX_BUFFER_BYTES = 0x80000000 # Maximum bytes allowed in a source buffer
+XAUDIO2_MAX_QUEUED_BUFFERS = 64 # Maximum buffers allowed in a voice queue
+XAUDIO2_MAX_BUFFERS_SYSTEM = 2 # Maximum buffers allowed for system threads (Xbox 360 only)
+XAUDIO2_MAX_AUDIO_CHANNELS = 64 # Maximum channels in an audio stream
+XAUDIO2_MIN_SAMPLE_RATE = 1000 # Minimum audio sample rate supported
+XAUDIO2_MAX_SAMPLE_RATE = 200000 # Maximum audio sample rate supported
+XAUDIO2_MAX_VOLUME_LEVEL = 16777216.0 # Maximum acceptable volume level (2^24)
+XAUDIO2_MIN_FREQ_RATIO = (1/1024.0) # Minimum SetFrequencyRatio argument
+XAUDIO2_MAX_FREQ_RATIO = 1024.0 # Maximum MaxFrequencyRatio argument
+XAUDIO2_DEFAULT_FREQ_RATIO = 2.0 # Default MaxFrequencyRatio argument
+XAUDIO2_MAX_FILTER_ONEOVERQ = 1.5 # Maximum XAUDIO2_FILTER_PARAMETERS.OneOverQ
+XAUDIO2_MAX_FILTER_FREQUENCY = 1.0 # Maximum XAUDIO2_FILTER_PARAMETERS.Frequency
+XAUDIO2_MAX_LOOP_COUNT = 254 # Maximum non-infinite XAUDIO2_BUFFER.LoopCount
+XAUDIO2_MAX_INSTANCES = 8 # Maximum simultaneous XAudio2 objects on Xbox 360
+
+
+XAUDIO2_FILTER_TYPE = UINT
+LowPassFilter = 0 # Attenuates frequencies above the cutoff frequency (state-variable filter).
+BandPassFilter = 1 # Attenuates frequencies outside a given range (state-variable filter).
+HighPassFilter = 2 # Attenuates frequencies below the cutoff frequency (state-variable filter).
+NotchFilter = 3 # Attenuates frequencies inside a given range (state-variable filter).
+LowPassOnePoleFilter = 4 # Attenuates frequencies above the cutoff frequency (one-pole filter, XAUDIO2_FILTER_PARAMETERS.OneOverQ has no effect)
+HighPassOnePoleFilter = 5 # Attenuates frequencies below the cutoff frequency (one-pole filter, XAUDIO2_FILTER_PARAMETERS.OneOverQ has no effect)
+
+XAUDIO2_NO_LOOP_REGION = 0 # Used in XAUDIO2_BUFFER.LoopCount
+XAUDIO2_LOOP_INFINITE = 255 # Used in XAUDIO2_BUFFER.LoopCount
+XAUDIO2_DEFAULT_CHANNELS = 0 # Used in CreateMasteringVoice
+XAUDIO2_DEFAULT_SAMPLERATE = 0 # Used in CreateMasteringVoice
+
+WAVE_FORMAT_PCM = 1
+
+XAUDIO2_DEBUG_ENGINE = 0x0001 # Used in XAudio2Create
+XAUDIO2_VOICE_NOPITCH = 0x0002 # Used in IXAudio2::CreateSourceVoice
+XAUDIO2_VOICE_NOSRC = 0x0004 # Used in IXAudio2::CreateSourceVoice
+XAUDIO2_VOICE_USEFILTER = 0x0008 # Used in IXAudio2::CreateSource/SubmixVoice
+XAUDIO2_PLAY_TAILS = 0x0020 # Used in IXAudio2SourceVoice::Stop
+XAUDIO2_END_OF_STREAM = 0x0040 # Used in XAUDIO2_BUFFER.Flags
+XAUDIO2_SEND_USEFILTER = 0x0080 # Used in XAUDIO2_SEND_DESCRIPTOR.Flags
+XAUDIO2_VOICE_NOSAMPLESPLAYED = 0x0100 # Used in IXAudio2SourceVoice::GetState
+XAUDIO2_STOP_ENGINE_WHEN_IDLE = 0x2000 # Used in XAudio2Create to force the engine to Stop when no source voices are Started, and Start when a voice is Started
+XAUDIO2_1024_QUANTUM = 0x8000 # Used in XAudio2Create to specify nondefault processing quantum of 21.33 ms (1024 samples at 48KHz)
+XAUDIO2_NO_VIRTUAL_AUDIO_CLIENT = 0x10000 # Used in CreateMasteringVoice to create a virtual audio client
+
+
+class IXAudio2VoiceCallback(com.Interface):
+ _methods_ = [
+ ('OnVoiceProcessingPassStart',
+ com.STDMETHOD(UINT32)),
+ ('OnVoiceProcessingPassEnd',
+ com.STDMETHOD()),
+ ('onStreamEnd',
+ com.STDMETHOD()),
+ ('onBufferStart',
+ com.STDMETHOD(ctypes.c_void_p)),
+ ('OnBufferEnd',
+ com.STDMETHOD(ctypes.c_void_p)),
+ ('OnLoopEnd',
+ com.STDMETHOD(ctypes.c_void_p)),
+ ]
+
+
+class XA2SourceCallback(com.COMObject):
+ """Callback class used to trigger when buffers or streams end..
+ WARNING: Whenever a callback is running, XAudio2 cannot generate audio.
+ Make sure these functions run as fast as possible and do not block/delay more than a few milliseconds.
+ MS Recommendation:
+ At a minimum, callback functions must not do the following:
+ - Access the hard disk or other permanent storage
+ - Make expensive or blocking API calls
+ - Synchronize with other parts of client code
+ - Require significant CPU usage
+ """
+ _interfaces_ = [IXAudio2VoiceCallback]
+
+ def __init__(self, xa2_player):
+ self.xa2_player = xa2_player
+
+ def OnVoiceProcessingPassStart(self, bytesRequired):
+ pass
+
+ def OnVoiceProcessingPassEnd(self):
+ pass
+
+ def onStreamEnd(self):
+ pass
+
+ def onBufferStart(self, pBufferContext):
+ pass
+
+ def OnBufferEnd(self, pBufferContext):
+ """At the end of playing one buffer, attempt to refill again.
+ Even if the player is out of sources, it needs to be called to purge all buffers.
+ """
+ if self.xa2_player:
+ self.xa2_player.refill_source_player()
+
+ def OnLoopEnd(self, this, pBufferContext):
+ pass
+
+ def onVoiceError(self, this, pBufferContext, hresult):
+ raise Exception("Error occurred during audio playback.", hresult)
+
+
+class XAUDIO2_EFFECT_DESCRIPTOR(Structure):
+ _fields_ = [
+ ('pEffect', com.pIUnknown),
+ ('InitialState', c_bool),
+ ('OutputChannels', UINT32)
+ ]
+
+
+class XAUDIO2_EFFECT_CHAIN(ctypes.Structure):
+ _fields_ = [
+ ('EffectCount', UINT32),
+ ('pEffectDescriptors', POINTER(XAUDIO2_EFFECT_DESCRIPTOR)),
+ ]
+
+
+class XAUDIO2_FILTER_PARAMETERS(Structure):
+ _fields_ = [
+ ('Type', XAUDIO2_FILTER_TYPE),
+ ('Frequency', FLOAT),
+ ('OneOverQ', FLOAT)
+ ]
+
+
+class XAUDIO2_VOICE_DETAILS(Structure):
+ _fields_ = [
+ ('CreationFlags', UINT32),
+ ('ActiveFlags', UINT32),
+ ('InputChannels', UINT32),
+ ('InputSampleRate', UINT32)
+ ]
+
+
+class IXAudio2Voice(com.pInterface):
+ _methods_ = [
+ ('GetVoiceDetails',
+ com.STDMETHOD(POINTER(XAUDIO2_VOICE_DETAILS))),
+ ('SetOutputVoices',
+ com.STDMETHOD()),
+ ('SetEffectChain',
+ com.STDMETHOD(POINTER(XAUDIO2_EFFECT_CHAIN))),
+ ('EnableEffect',
+ com.STDMETHOD()),
+ ('DisableEffect',
+ com.STDMETHOD()),
+ ('GetEffectState',
+ com.STDMETHOD()),
+ ('SetEffectParameters',
+ com.STDMETHOD()),
+ ('GetEffectParameters',
+ com.STDMETHOD()),
+ ('SetFilterParameters',
+ com.STDMETHOD(POINTER(XAUDIO2_FILTER_PARAMETERS), UINT32)),
+ ('GetFilterParameters',
+ com.STDMETHOD()),
+ ('SetOutputFilterParameters',
+ com.STDMETHOD()),
+ ('GetOutputFilterParameters',
+ com.STDMETHOD()),
+ ('SetVolume',
+ com.STDMETHOD(ctypes.c_float, UINT32)),
+ ('GetVolume',
+ com.STDMETHOD(POINTER(c_float))),
+ ('SetChannelVolumes',
+ com.STDMETHOD()),
+ ('GetChannelVolumes',
+ com.STDMETHOD()),
+ ('SetOutputMatrix',
+ com.STDMETHOD(c_void_p, UINT32, UINT32, POINTER(FLOAT), UINT32)),
+ ('GetOutputMatrix',
+ com.STDMETHOD()),
+ ('DestroyVoice',
+ com.STDMETHOD())
+ ]
+
+
+class IXAudio2SubmixVoice(IXAudio2Voice):
+ pass
+
+
+class IXAudio2SourceVoice(IXAudio2Voice):
+ _methods_ = [
+ ('Start',
+ com.STDMETHOD(UINT32, UINT32)),
+ ('Stop',
+ com.STDMETHOD(UINT32, UINT32)),
+ ('SubmitSourceBuffer',
+ com.STDMETHOD(POINTER(XAUDIO2_BUFFER), c_void_p)),
+ ('FlushSourceBuffers',
+ com.STDMETHOD()),
+ ('Discontinuity',
+ com.STDMETHOD()),
+ ('ExitLoop',
+ com.STDMETHOD()),
+ ('GetState',
+ com.STDMETHOD(POINTER(XAUDIO2_VOICE_STATE), UINT32)),
+ ('SetFrequencyRatio',
+ com.STDMETHOD(FLOAT, UINT32)),
+ ('GetFrequencyRatio',
+ com.STDMETHOD(POINTER(c_float))),
+ ('SetSourceSampleRate',
+ com.STDMETHOD()),
+ ]
+
+
+class IXAudio2MasteringVoice(IXAudio2Voice):
+ _methods_ = [
+ ('GetChannelMask',
+ com.STDMETHOD(POINTER(DWORD)))
+ ]
+
+
+class IXAudio2EngineCallback(com.Interface):
+ _methods_ = [
+ ('OnProcessingPassStart',
+ com.METHOD(ctypes.c_void_p)),
+ ('OnProcessingPassEnd',
+ com.METHOD(ctypes.c_void_p)),
+ ('OnCriticalError',
+ com.METHOD(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_ulong)),
+ ]
+
+
+class XA2EngineCallback(com.COMObject):
+ _interfaces_ = [IXAudio2EngineCallback]
+
+ def OnProcessingPassStart(self):
+ pass
+
+ def OnProcessingPassEnd(self):
+ pass
+
+ def OnCriticalError(self, this, hresult):
+ raise Exception("Critical Error:", hresult)
+
+
+
+# -------------- 3D Audio Positioning----------
+class X3DAUDIO_DISTANCE_CURVE_POINT(ctypes.Structure):
+ _fields_ = [
+ ('Distance', FLOAT32),
+ ('DSPSetting', FLOAT32)
+ ]
+
+
+class X3DAUDIO_DISTANCE_CURVE(ctypes.Structure):
+ _fields_ = [
+ ('pPoints', POINTER(X3DAUDIO_DISTANCE_CURVE_POINT)),
+ ('PointCount', UINT32)
+ ]
+
+
+class X3DAUDIO_VECTOR(ctypes.Structure):
+ _fields_ = [
+ ('x', c_float),
+ ('y', c_float),
+ ('z', c_float),
+ ]
+
+
+
+"""Cone:
+ Specifies directionality for a listener or single-channel emitter by
+ modifying DSP behaviour with respect to its front orientation.
+ This is modeled using two sound cones: an inner cone and an outer cone.
+ On/within the inner cone, DSP settings are scaled by the inner values.
+ On/beyond the outer cone, DSP settings are scaled by the outer values.
+ If on both the cones, DSP settings are scaled by the inner values only.
+ Between the two cones, the scaler is linearly interpolated between the
+ inner and outer values. Set both cone angles to 0 or X3DAUDIO_2PI for
+ omnidirectionality using only the outer or inner values respectively."""
+class X3DAUDIO_CONE(Structure):
+ _fields_ = [
+ ('InnerAngle', FLOAT32), # inner cone angle in radians, must be within [0.0f, X3DAUDIO_2PI]
+ ('OuterAngle', FLOAT32), # outer cone angle in radians, must be within [InnerAngle, X3DAUDIO_2PI]
+ ('InnerVolume', FLOAT32), # volume level scaler on/within inner cone, used only for matrix calculations, must be within [0.0f, 2.0f] when used
+ ('OuterVolume', FLOAT32), # volume level scaler on/beyond outer cone, used only for matrix calculations, must be within [0.0f, 2.0f] when used
+ ('InnerLPF', FLOAT32), # LPF (both direct and reverb paths) coefficient subtrahend on/within inner cone, used only for LPF (both direct and reverb paths) calculations, must be within [0.0f, 1.0f] when used
+ ('OuterLPF', FLOAT32), # LPF (both direct and reverb paths) coefficient subtrahend on/beyond outer cone, used only for LPF (both direct and reverb paths) calculations, must be within [0.0f, 1.0f] when used
+ ('InnerReverb', FLOAT32), # reverb send level scaler on/within inner cone, used only for reverb calculations, must be within [0.0f, 2.0f] when used
+ ('OuterReverb', FLOAT32) # reverb send level scaler on/beyond outer cone, used only for reverb calculations, must be within [0.0f, 2.0f] when used
+ ]
+
+
+class X3DAUDIO_LISTENER(Structure):
+ _fields_ = [
+ ('OrientFront', X3DAUDIO_VECTOR), # orientation of front direction, used only for matrix and delay calculations or listeners with cones for matrix, LPF (both direct and reverb paths), and reverb calculations, must be normalized when used
+ ('OrientTop', X3DAUDIO_VECTOR), # orientation of top direction, used only for matrix and delay calculations, must be orthonormal with OrientFront when used
+ ('Position', X3DAUDIO_VECTOR), # position in user-defined world units, does not affect Velocity
+ ('Velocity', X3DAUDIO_VECTOR), # velocity vector in user-defined world units/second, used only for doppler calculations, does not affect Position
+ ('pCone', POINTER(X3DAUDIO_CONE)) # sound cone, used only for matrix, LPF (both direct and reverb paths), and reverb calculations, NULL specifies omnidirectionality
+ ]
+
+
+class X3DAUDIO_EMITTER(Structure):
+ _fields_ = [
+ ('pCone', POINTER(X3DAUDIO_CONE)),
+ ('OrientFront', X3DAUDIO_VECTOR),
+ ('OrientTop', X3DAUDIO_VECTOR),
+ ('Position', X3DAUDIO_VECTOR),
+ ('Velocity', X3DAUDIO_VECTOR),
+ ('InnerRadius', FLOAT32),
+ ('InnerRadiusAngle', FLOAT32),
+ ('ChannelCount', UINT32),
+ ('ChannelRadius', FLOAT32),
+ ('pChannelAzimuths', POINTER(FLOAT32)),
+ ('pVolumeCurve', POINTER(X3DAUDIO_DISTANCE_CURVE)),
+ ('pLFECurve', POINTER(X3DAUDIO_DISTANCE_CURVE)),
+ ('pLPFDirectCurve', POINTER(X3DAUDIO_DISTANCE_CURVE)),
+ ('pLPFReverbCurve', POINTER(X3DAUDIO_DISTANCE_CURVE)),
+ ('pReverbCurve', POINTER(X3DAUDIO_DISTANCE_CURVE)),
+ ('CurveDistanceScaler', FLOAT32),
+ ('DopplerScaler', FLOAT32)
+ ]
+
+
+class X3DAUDIO_DSP_SETTINGS(Structure):
+ _fields_ = [
+ ('pMatrixCoefficients', POINTER(FLOAT)), # float array
+ ('pDelayTimes', POINTER(FLOAT32)),
+ ('SrcChannelCount', UINT32),
+ ('DstChannelCount', UINT32),
+ ('LPFDirectCoefficient', FLOAT32),
+ ('LPFReverbCoefficient', FLOAT32),
+ ('ReverbLevel', FLOAT32),
+ ('DopplerFactor', FLOAT32),
+ ('EmitterToListenerAngle', FLOAT32),
+ ('EmitterToListenerDistance', FLOAT32),
+ ('EmitterVelocityComponent', FLOAT32),
+ ('ListenerVelocityComponent', FLOAT32)
+ ]
+
+# Other constants that may or may not be used in X3D.
+
+SPEAKER_FRONT_LEFT = 0x00000001
+SPEAKER_FRONT_RIGHT = 0x00000002
+SPEAKER_FRONT_CENTER = 0x00000004
+SPEAKER_LOW_FREQUENCY = 0x00000008
+SPEAKER_BACK_LEFT = 0x00000010
+SPEAKER_BACK_RIGHT = 0x00000020
+SPEAKER_FRONT_LEFT_OF_CENTER = 0x00000040
+SPEAKER_FRONT_RIGHT_OF_CENTER = 0x00000080
+SPEAKER_BACK_CENTER = 0x00000100
+SPEAKER_SIDE_LEFT = 0x00000200
+SPEAKER_SIDE_RIGHT = 0x00000400
+SPEAKER_TOP_CENTER = 0x00000800
+SPEAKER_TOP_FRONT_LEFT = 0x00001000
+SPEAKER_TOP_FRONT_CENTER = 0x00002000
+SPEAKER_TOP_FRONT_RIGHT = 0x00004000
+SPEAKER_TOP_BACK_LEFT = 0x00008000
+SPEAKER_TOP_BACK_CENTER = 0x00010000
+SPEAKER_TOP_BACK_RIGHT = 0x00020000
+SPEAKER_RESERVED = 0x7FFC0000 # bit mask locations reserved for future use
+SPEAKER_ALL = 0x80000000 # used to specify that any possible permutation of speaker configurations
+
+SPEAKER_MONO = SPEAKER_FRONT_CENTER
+SPEAKER_STEREO = (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT)
+SPEAKER_2POINT1 = (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY)
+SPEAKER_SURROUND = (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER)
+SPEAKER_QUAD = (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
+SPEAKER_4POINT1 = (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
+SPEAKER_5POINT1 = (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
+SPEAKER_7POINT1 = (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER)
+SPEAKER_5POINT1_SURROUND = (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
+SPEAKER_7POINT1_SURROUND = (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
+
+
+DBL_DECIMAL_DIG = 17 # # of decimal digits of rounding precision
+DBL_DIG = 15 # # of decimal digits of precision
+DBL_EPSILON = 2.2204460492503131e-016 # smallest such that 1.0+DBL_EPSILON != 1.0
+DBL_HAS_SUBNORM = 1 # type does support subnormal numbers
+DBL_MANT_DIG = 53 # # of bits in mantissa
+DBL_MAX = 1.7976931348623158e+308 # max value
+DBL_MAX_10_EXP = 308 # max decimal exponent
+DBL_MAX_EXP = 1024 # max binary exponent
+DBL_MIN = 2.2250738585072014e-308 # min positive value
+DBL_MIN_10_EXP = (-307) # min decimal exponent
+DBL_MIN_EXP = (-1021) # min binary exponent
+_DBL_RADIX = 2 # exponent radix
+DBL_TRUE_MIN = 4.9406564584124654e-324 # min positive value
+
+FLT_DECIMAL_DIG = 9 # # of decimal digits of rounding precision
+FLT_DIG = 6 # # of decimal digits of precision
+FLT_EPSILON = 1.192092896e-07 # smallest such that 1.0+FLT_EPSILON != 1.0
+FLT_HAS_SUBNORM = 1 # type does support subnormal numbers
+FLT_GUARD = 0
+FLT_MANT_DIG = 24 # # of bits in mantissa
+FLT_MAX = 3.402823466e+38 # max value
+FLT_MAX_10_EXP = 38 # max decimal exponent
+FLT_MAX_EXP = 128 # max binary exponent
+FLT_MIN = 1.175494351e-38 # min normalized positive value
+FLT_MIN_10_EXP = (-37) # min decimal exponent
+FLT_MIN_EXP = (-125) # min binary exponent
+FLT_NORMALIZE = 0
+FLT_RADIX = 2 # exponent radix
+FLT_TRUE_MIN = 1.401298464e-45 # min positive value
+
+LDBL_DIG = DBL_DIG # # of decimal digits of precision
+LDBL_EPSILON = DBL_EPSILON # smallest such that 1.0+LDBL_EPSILON != 1.0
+LDBL_HAS_SUBNORM = DBL_HAS_SUBNORM # type does support subnormal numbers
+LDBL_MANT_DIG = DBL_MANT_DIG # # of bits in mantissa
+LDBL_MAX = DBL_MAX # max value
+LDBL_MAX_10_EXP = DBL_MAX_10_EXP # max decimal exponent
+LDBL_MAX_EXP = DBL_MAX_EXP # max binary exponent
+LDBL_MIN = DBL_MIN # min normalized positive value
+LDBL_MIN_10_EXP = DBL_MIN_10_EXP # min decimal exponent
+LDBL_MIN_EXP = DBL_MIN_EXP # min binary exponent
+_LDBL_RADIX = _DBL_RADIX # exponent radix
+LDBL_TRUE_MIN = DBL_TRUE_MIN # min positive value
+
+DECIMAL_DIG = DBL_DECIMAL_DIG
+
+
+X3DAUDIO_HANDLE_BYTESIZE = 20
+X3DAUDIO_HANDLE = (BYTE * X3DAUDIO_HANDLE_BYTESIZE)
+
+
+# speed of sound in meters per second for dry air at approximately 20C, used with X3DAudioInitialize
+X3DAUDIO_SPEED_OF_SOUND = 343.5
+
+
+X3DAUDIO_CALCULATE_MATRIX = 0x00000001 # enable matrix coefficient table calculation
+X3DAUDIO_CALCULATE_DELAY = 0x00000002 # enable delay time array calculation (stereo final mix only)
+X3DAUDIO_CALCULATE_LPF_DIRECT = 0x00000004 # enable LPF direct-path coefficient calculation
+X3DAUDIO_CALCULATE_LPF_REVERB = 0x00000008 # enable LPF reverb-path coefficient calculation
+X3DAUDIO_CALCULATE_REVERB = 0x00000010 # enable reverb send level calculation
+X3DAUDIO_CALCULATE_DOPPLER = 0x00000020 # enable doppler shift factor calculation
+X3DAUDIO_CALCULATE_EMITTER_ANGLE = 0x00000040 # enable emitter-to-listener interior angle calculation
+X3DAUDIO_CALCULATE_ZEROCENTER = 0x00010000 # do not position to front center speaker, signal positioned to remaining speakers instead, front center destination channel will be zero in returned matrix coefficient table, valid only for matrix calculations with final mix formats that have a front center channel
+X3DAUDIO_CALCULATE_REDIRECT_TO_LFE = 0x00020000 # apply equal mix of all source channels to LFE destination channel, valid only for matrix calculations with sources that have no LFE channel and final mix formats that have an LFE channel
+
+default_dsp_calculation = X3DAUDIO_CALCULATE_MATRIX | X3DAUDIO_CALCULATE_DOPPLER
+
+X3DAudioInitialize = x3d_lib.X3DAudioInitialize
+X3DAudioInitialize.restype = HRESULT
+X3DAudioInitialize.argtypes = [c_int, c_float, c_void_p]
+
+
+X3DAudioCalculate = x3d_lib.X3DAudioCalculate
+X3DAudioCalculate.restype = c_void
+X3DAudioCalculate.argtypes = [POINTER(X3DAUDIO_HANDLE), POINTER(X3DAUDIO_LISTENER), POINTER(X3DAUDIO_EMITTER), UINT32, POINTER(X3DAUDIO_DSP_SETTINGS)]
+
+
+AudioCategory_Other = 0
+AudioCategory_ForegroundOnlyMedia = 1
+AudioCategory_Communications = 3
+AudioCategory_Alerts = 4
+AudioCategory_SoundEffects = 5
+AudioCategory_GameEffects = 6
+AudioCategory_GameMedia = 7
+AudioCategory_GameChat = 8
+AudioCategory_Speech = 9
+AudioCategory_Movie = 10
+AudioCategory_Media = 11
+
+# Reverb not implemented but if someone wants to take a stab at it.
+class XAUDIO2FX_REVERB_PARAMETERS(Structure):
+ _fields_ = [
+ ('WetDryMix', c_float), # ratio of wet (processed) signal to dry (original) signal
+
+ # Delay times
+ ('ReflectionsDelay', UINT32), # [0, 300] in ms
+ ('ReverbDelay', BYTE), # [0, 85] in ms
+ ('RearDelay', UINT32), # 7.1: [0, 20] in ms, all other: [0, 5] in ms
+ ('SideDelay', UINT32), # .1: [0, 5] in ms, all other: not used, but still validated # WIN 10 only.
+
+ # Indexed Paremeters
+ ('PositionLeft', BYTE), # [0, 30] no units
+ ('PositionRight', BYTE), # 0, 30] no units, ignored when configured to mono
+ ('PositionMatrixLeft', BYTE), # [0, 30] no units
+ ('PositionMatrixRight', BYTE), # [0, 30] no units, ignored when configured to mono
+ ('EarlyDiffusion', BYTE), # [0, 15] no units
+ ('LateDiffusion', BYTE), # [0, 15] no units
+ ('LowEQGain', BYTE), # [0, 12] no units
+ ('LowEQCutoff', BYTE), # [0, 9] no units
+ ('LowEQCutoff', BYTE), # [0, 8] no units
+ ('HighEQCutoff', BYTE), # [0, 14] no units
+
+ # Direct parameters
+ ('RoomFilterFreq', c_float), # [20, 20000] in Hz
+ ('RoomFilterMain', c_float), # [-100, 0] in dB
+ ('RoomFilterHF', c_float), # [-100, 0] in dB
+ ('ReflectionsGain', c_float), # [-100, 20] in dB
+ ('ReverbGain', c_float), # [-100, 20] in dB
+ ('DecayTime', c_float), # [0.1, inf] in seconds
+ ('Density', c_float), # [0, 100] (percentage)
+ ('RoomSize', c_float), # [1, 100] in feet
+
+ # component control
+ ('DisableLateField', c_bool), # TRUE to disable late field reflections
+ ]
+
+
+class IXAudio2(com.pIUnknown):
+ _methods_ = [
+ ('RegisterForCallbacks',
+ com.STDMETHOD(POINTER(IXAudio2EngineCallback))),
+ ('UnregisterForCallbacks',
+ com.METHOD(ctypes.c_void_p, POINTER(IXAudio2EngineCallback))),
+ ('CreateSourceVoice',
+ com.STDMETHOD(POINTER(IXAudio2SourceVoice), POINTER(WAVEFORMATEX), UINT32, c_float,
+ POINTER(IXAudio2VoiceCallback), POINTER(XAUDIO2_VOICE_SENDS), POINTER(XAUDIO2_EFFECT_CHAIN))),
+ ('CreateSubmixVoice',
+ com.STDMETHOD(POINTER(IXAudio2SubmixVoice), UINT32, UINT32, UINT32, UINT32,
+ POINTER(XAUDIO2_VOICE_SENDS), POINTER(XAUDIO2_EFFECT_CHAIN))),
+ ('CreateMasteringVoice',
+ com.STDMETHOD(POINTER(IXAudio2MasteringVoice), UINT32, UINT32, UINT32, LPCWSTR, POINTER(XAUDIO2_EFFECT_CHAIN),
+ UINT32)),
+ ('StartEngine',
+ com.STDMETHOD()),
+ ('StopEngine',
+ com.STDMETHOD()),
+ ('CommitChanges',
+ com.STDMETHOD(UINT32)),
+ ('GetPerformanceData',
+ com.METHOD(c_void, POINTER(XAUDIO2_PERFORMANCE_DATA))),
+ ('SetDebugConfiguration',
+ com.STDMETHOD(POINTER(XAUDIO2_DEBUG_CONFIGURATION), c_void_p)),
+ ]
+
+
+XAudio2Create = xaudio2_lib.XAudio2Create
+XAudio2Create.restype = HRESULT
+XAudio2Create.argtypes = [POINTER(IXAudio2), UINT32, UINT32]
+
+CreateAudioReverb = xaudio2_lib.CreateAudioReverb
+CreateAudioReverb.restype = HRESULT
+CreateAudioReverb.argtypes = [POINTER(com.pIUnknown)]
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/exceptions.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/exceptions.py
new file mode 100644
index 0000000000000000000000000000000000000000..9bc5d7ae93fa13af12d1c8c40fa478240399ea73
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/exceptions.py
@@ -0,0 +1,11 @@
+
+class MediaException(Exception):
+ pass
+
+
+class MediaFormatException(MediaException):
+ pass
+
+
+class CannotSeekException(MediaException):
+ pass
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/instrumentation.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/instrumentation.py
new file mode 100644
index 0000000000000000000000000000000000000000..eb96c3ad336d56f7a130920a0f8119886ba5476a
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/instrumentation.py
@@ -0,0 +1,298 @@
+"""
+Responsabilities
+
+ Defines the events that modify media_player state
+ Defines which events are potential defects
+ Gives the low level support to extract info from the recorded data
+ For new code here, keep accepting and returning only data structures,
+ never paths or files.
+"""
+
+# events definition
+mp_events = {
+ "version": 1.1,
+
+ # : {
+ # "desc": ,
+ # "update_names": ,
+ # "other_fields":
+ # },
+
+ "crash": {
+ "desc": "media_player crashed.",
+ "update_names": ["evname", "sample"],
+ "other_fields": [],
+ "test_cases": [("crash", "small.mp4")]
+ },
+
+ "mp.im": {
+ "desc": "Play",
+ "update_names": ["evname", "sample"],
+ "other_fields": [],
+ "test_cases": [("mp.im", 3, "small.mp4")]
+ },
+
+ "p.P._sp": {
+ "desc": "Start playing",
+ "update_names": ["evname", "wall_time"],
+ "other_fields": [],
+ "test_cases": [("p.P._sp", 1.23)]
+ },
+
+ "p.P.sk": {
+ "desc": "Seek",
+ "update_names": ["evname", "seek_to_time"],
+ "other_fields": [],
+ "test_cases": [("p.P.sk", 1.23), ("p.P.sk", None)]
+ },
+
+ "p.P.ut.1.0": {
+ "desc": "Enter update_texture",
+ "update_names": ["evname", "pyglet_dt", "current_time",
+ "audio_time", "wall_time"],
+ "other_fields": [],
+ "test_cases": [("p.P.ut.1.0", 0.02, 2.31, 2.28, 1.21),
+ ("p.P.ut.1.0", 0.02, None, 2.28, 1.21),
+ ("p.P.ut.1.0", None, 2.31, 2.28, 1.21)]
+ },
+ "p.P.ut.1.5": {
+ "desc": "Discard video frame too old,",
+ "update_names": ["evname", "video_time"],
+ "other_fields": ["current_time"],
+ "test_cases": [("p.P.ut.1.5", 1.21)]
+ },
+ "p.P.ut.1.6": {
+ "desc": "Current video frame,",
+ "update_names": ["evname", "video_time"],
+ "other_fields": [],
+ "test_cases": [("p.P.ut.1.6", 1.21)]
+ },
+ "p.P.ut.1.7": {
+ "desc": "Early return doing nothing because video_time is None (likely EOV),",
+ "update_names": ["evname", "rescheduling_time"],
+ "other_fields": [],
+ "test_cases": [("p.P.ut.1.7", 0.02)]
+ },
+ "p.P.ut.1.8": {
+ "desc": "Image frame is None (?)",
+ "update_names": ["evname"],
+ "other_fields": [],
+ "test_cases": [("p.P.ut.1.8",)]
+ },
+ # in log_render_anomalies list only if rescheduling_time < 0
+ "p.P.ut.1.9": {
+ "desc": "Re-scheduling,",
+ "update_names": ["evname", "rescheduling_time", "next_video_time"],
+ "other_fields": [],
+ "test_cases": [("p.P.ut.1.9", 0.02, None), ("p.P.ut.1.9", 0.02, 2.7)]
+ },
+
+ # crash_detection relies in this being the last event in the log_entries
+ "p.P.oe": {
+ "desc": ">>> play ends",
+ "update_names": ["evname"],
+ "other_fields": [],
+ "test_cases": [("p.P.oe",)]
+ },
+ }
+
+# events to examine for defects detection
+mp_bads = {"crash", "p.P.ut.1.5", "p.P.ut.1.7", "p.P.ut.1.8"}
+
+
+class MediaPlayerStateIterator:
+ """Exposes for analysis the sequence of media_player states
+
+ Typical use
+ mp_states = MediaPlayerStateIterator()
+ for st in mp_states:
+ do something with st, the current media_player state.
+
+ If desired a callback can be called just before processing an event, the
+ signature is
+ fn_pre_event(event, state_before_event)
+
+ The mp state is handled as a dict, with keys in cls.fields
+ """
+ fields = {
+ # real
+ "evname": None,
+ "evnum": -1, # synthetic, ordinal last event processed
+ "sample": None,
+ "wall_time": None,
+ "current_time": None,
+ "audio_time": None,
+ "seek_to_time": None,
+ "pyglet_dt": None,
+ "video_time": None,
+ "rescheduling_time": None,
+ "next_video_time": None,
+ # synthetics, probably invalid after using seek
+ "pyglet_time": 0,
+ "frame_num": 0,
+ }
+
+ def __init__(self, recorded_events, events_definition=mp_events, fn_pre_event=None):
+ self.fn_pre_event = fn_pre_event
+ self.state = dict(self.fields)
+ self.events_definition = events_definition
+ self.iter_events = iter(recorded_events)
+ version_args = next(self.iter_events)
+ assert version_args == ("version", self.events_definition["version"])
+
+ def __iter__(self):
+ return self
+
+ def __next__(self):
+ event = next(self.iter_events)
+ if self.fn_pre_event is not None:
+ self.fn_pre_event(event, self.state)
+ event_dict = self.event_as_dict(event)
+ self.update(event_dict)
+ return self.state
+
+ def event_as_dict(self, event):
+ names = self.events_definition[event[0]]["update_names"]
+ updated = {a: b for a, b in zip(names, event)}
+ return updated
+
+ def update(self, event_dict):
+ self.state.update(event_dict)
+ self.state["evnum"] += 1
+ evname = event_dict["evname"]
+ if evname == "p.P.ut.1.0":
+ self.state["pyglet_time"] += event_dict["pyglet_dt"]
+ elif evname == "p.P.ut.1.5" or evname == "p.P.ut.1.9":
+ self.state["frame_num"] += 1
+
+
+class TimelineBuilder:
+ """At each call to player.Player.update_texture we capture selected player
+ state, before accepting the changes in the event. This is the same as
+ capturing the state at the end of previous update call.
+ Output is a sequence of tuples capturing the desired fields.
+ Meant to extract info on behalf of other sw, especially visualization.
+ """
+ def __init__(self, recorded_events, events_definition=mp_events):
+ mp = MediaPlayerStateIterator(recorded_events, events_definition, self.pre)
+ self.mp_state_iterator = mp
+ self.timeline = []
+
+ def pre(self, event, st):
+ if event[0] == "p.P.ut.1.0":
+ p = (st["wall_time"], st["pyglet_time"], st["audio_time"],
+ st["current_time"], st["frame_num"], st["rescheduling_time"])
+ self.timeline.append(p)
+
+ def get_timeline(self):
+ """remember video_time and audio_time can be None"""
+ # real work is done in rhe callback pre
+ for st in self.mp_state_iterator:
+ pass
+ # The first entry is bogus, because there was no previous call so discard
+ return self.timeline[1:]
+
+
+def timeline_postprocessing(timeline):
+ """ Eliminates Nones in timeline so other software don't error.
+ Extra lists are built for the vars with nones, each list with one point
+ for each None in the form (wall_time, prev_value).
+ """
+ current_time_nones = []
+ audio_time_nones = []
+ old_current_time = 0
+ old_audio_time = 0
+ filtered_timeline = []
+ for wall_time, pt, audio_time, current_time, fnum, rt in timeline:
+ if current_time is None:
+ current_time = old_current_time
+ current_time_nones.append((wall_time, old_current_time))
+ else:
+ current_time_time = current_time
+
+ if audio_time is None:
+ audio_time = old_audio_time
+ audio_time_nones.append((wall_time, old_audio_time))
+ else:
+ old_audio_time = audio_time
+
+ filtered_timeline.append((wall_time, pt, audio_time, current_time, fnum, rt))
+
+ return filtered_timeline, current_time_nones, audio_time_nones
+
+
+# works for buffered log, needs other implementation if unbuffered
+def crash_detected(recorded_events):
+ crashed = recorded_events[-1][0] != "p.P.oe"
+ return crashed
+
+
+class CountBads:
+ """Helper to report anomalies in the media_player states seen when playing
+ a sample.
+
+ - provides .anomalies_description, a dict :
+ - calling .count_bads(recorded_events) will return a dict of
+ anomaly:
+ - preprocessing: ad-hoc prefiltering the events stream for noise reduction
+ """
+ def __init__(self, events_definition=mp_events, bads=mp_bads):
+ self.events_definition = events_definition
+ self.bads = bads
+ self.anomalies_description = self.build_anomalies_description()
+
+ def build_anomalies_description(self):
+ """builds descriptions for the anomalies"""
+ d = self.events_definition
+ anomalies_description = {evname: d[evname]["desc"] for evname in self.bads}
+ anomalies_description["scheduling_in_past"] = "Scheduling in the past"
+ return anomalies_description
+
+ def preprocessing(self, recorded_events):
+ """
+ I see all recordings ending with some potential anomalies in the few
+ frames just before the '>>> play ends'; visually the play is perfect so
+ I assume they are false positives if just at EOF. Deleting the offending
+ events (only if near EOL) to reduce noise in summarize.py
+ """
+ recorded_events = list(recorded_events)
+ if (len(recorded_events) > 9 and
+ recorded_events[-2][0] == "p.P.ut.1.7" and
+ recorded_events[-6][0] == "p.P.ut.1.7" and
+ recorded_events[-10][0] == "p.P.ut.1.7"):
+ del recorded_events[-10]
+ del recorded_events[-6]
+ del recorded_events[-2]
+
+ elif (len(recorded_events) > 6 and
+ recorded_events[-2][0] == "p.P.ut.1.7" and
+ recorded_events[-6][0] == "p.P.ut.1.7"):
+ del recorded_events[-6]
+ del recorded_events[-2]
+
+ elif len(recorded_events) > 2 and recorded_events[-2][0] == "p.P.ut.1.7":
+ del recorded_events[-2]
+
+ return recorded_events
+
+ def count_bads(self, recorded_events):
+ """returns counts of anomalies as a dict of anomaly: count
+
+ recorded_events: media_player events recorded while playing a sample
+
+ Notice that 'counters' has one more key than 'bads': "scheduling_in_past"
+ """
+ recorded_events = self.preprocessing(recorded_events)
+ counters = {k: 0 for k in self.bads}
+ cnt_scheduling_in_past = 0
+ mp_states = MediaPlayerStateIterator(recorded_events, self.events_definition)
+ for st in mp_states:
+ evname = st["evname"]
+ if evname in counters:
+ counters[evname] += 1
+ elif ("p.P.ut.1.9" and
+ st["rescheduling_time"] is not None and
+ st["rescheduling_time"] < 0):
+ cnt_scheduling_in_past += 1
+ counters["scheduling_in_past"] = cnt_scheduling_in_past
+ return counters
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/mediathreads.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/mediathreads.py
new file mode 100644
index 0000000000000000000000000000000000000000..130868b75a831ab2b236b8845af4cff4be279a56
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/mediathreads.py
@@ -0,0 +1,148 @@
+import time
+import atexit
+import threading
+
+import pyglet
+
+from pyglet.util import debug_print
+
+
+_debug = debug_print('debug_media')
+
+
+class MediaThread:
+ """A thread that cleanly exits on interpreter shutdown, and provides
+ a sleep method that can be interrupted and a termination method.
+
+ :Ivariables:
+ `_condition` : threading.Condition
+ Lock _condition on all instance variables.
+ `_stopped` : bool
+ True if `stop` has been called.
+
+ """
+ _threads = set()
+ _threads_lock = threading.Lock()
+
+ def __init__(self):
+ self._thread = threading.Thread(target=self._thread_run, daemon=True)
+ self._condition = threading.Condition()
+ self._stopped = False
+
+ def run(self):
+ raise NotImplementedError
+
+ def _thread_run(self):
+ if pyglet.options['debug_trace']:
+ pyglet._install_trace()
+
+ with self._threads_lock:
+ self._threads.add(self)
+ self.run()
+ with self._threads_lock:
+ self._threads.remove(self)
+
+ def start(self):
+ self._thread.start()
+
+ def stop(self):
+ """Stop the thread and wait for it to terminate.
+
+ The `stop` instance variable is set to ``True`` and the condition is
+ notified. It is the responsibility of the `run` method to check
+ the value of `stop` after each sleep or wait and to return if set.
+ """
+ assert _debug('MediaThread.stop()')
+ with self._condition:
+ self._stopped = True
+ self._condition.notify()
+ self._thread.join()
+
+ def sleep(self, timeout):
+ """Wait for some amount of time, or until notified.
+
+ :Parameters:
+ `timeout` : float
+ Time to wait, in seconds.
+
+ """
+ assert _debug(f'MediaThread.sleep({timeout!r})')
+ with self._condition:
+ if not self._stopped:
+ self._condition.wait(timeout)
+
+ def notify(self):
+ """Interrupt the current sleep operation.
+
+ If the thread is currently sleeping, it will be woken immediately,
+ instead of waiting the full duration of the timeout.
+ """
+ assert _debug('MediaThread.notify()')
+ with self._condition:
+ self._condition.notify()
+
+ @classmethod
+ def atexit(cls):
+ with cls._threads_lock:
+ threads = list(cls._threads)
+ for thread in threads:
+ thread.stop()
+
+
+atexit.register(MediaThread.atexit)
+
+
+class PlayerWorkerThread(MediaThread):
+ """Worker thread for refilling players."""
+
+ # Time to wait if there are players, but they're all full:
+ _nap_time = 0.05
+
+ def __init__(self):
+ super().__init__()
+ self.players = set()
+
+ def run(self):
+ while True:
+ # This is a big lock, but ensures a player is not deleted while
+ # we're processing it -- this saves on extra checks in the
+ # player's methods that would otherwise have to check that it's
+ # still alive.
+ with self._condition:
+ assert _debug('PlayerWorkerThread: woke up @{}'.format(time.time()))
+ if self._stopped:
+ break
+ sleep_time = -1
+
+ if self.players:
+ filled = False
+ for player in list(self.players):
+ filled = player.refill_buffer()
+ if not filled:
+ sleep_time = self._nap_time
+ else:
+ assert _debug('PlayerWorkerThread: No active players')
+ sleep_time = None # sleep until a player is added
+
+ if sleep_time != -1:
+ self.sleep(sleep_time)
+ else:
+ # We MUST sleep, or we will starve pyglet's main loop. It
+ # also looks like if we don't sleep enough, we'll starve out
+ # various updates that stop us from properly removing players
+ # that should be removed.
+ self.sleep(self._nap_time)
+
+ def add(self, player):
+ assert player is not None
+ assert _debug('PlayerWorkerThread: player added')
+ with self._condition:
+ self.players.add(player)
+ self._condition.notify()
+
+ def remove(self, player):
+ assert _debug('PlayerWorkerThread: player removed')
+ with self._condition:
+ if player in self.players:
+ self.players.remove(player)
+ self._condition.notify()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/player.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/player.py
new file mode 100644
index 0000000000000000000000000000000000000000..4590543f5ed9758df96ed1fa8416abfb5fc7e1c7
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/player.py
@@ -0,0 +1,665 @@
+"""High-level sound and video player."""
+
+import time
+from collections import deque
+
+import pyglet
+from pyglet.gl import GL_TEXTURE_2D
+from pyglet.media import buffered_logger as bl
+from pyglet.media.drivers import get_audio_driver
+from pyglet.media.codecs.base import Source, SourceGroup
+
+_debug = pyglet.options['debug_media']
+
+
+class PlaybackTimer:
+ """Playback Timer.
+
+ This is a simple timer object which tracks the time elapsed. It can be
+ paused and reset.
+ """
+
+ def __init__(self):
+ """Initialize the timer with time 0."""
+ self._time = 0.0
+ self._systime = None
+
+ def start(self):
+ """Start the timer."""
+ self._systime = time.time()
+
+ def pause(self):
+ """Pause the timer."""
+ self._time = self.get_time()
+ self._systime = None
+
+ def reset(self):
+ """Reset the timer to 0."""
+ self._time = 0.0
+ if self._systime is not None:
+ self._systime = time.time()
+
+ def get_time(self):
+ """Get the elapsed time."""
+ if self._systime is None:
+ now = self._time
+ else:
+ now = time.time() - self._systime + self._time
+ return now
+
+ def set_time(self, value):
+ """
+ Manually set the elapsed time.
+
+ Args:
+ value (float): the new elapsed time value
+ """
+ self.reset()
+ self._time = value
+
+
+class _PlayerProperty:
+ """Descriptor for Player attributes to forward to the AudioPlayer.
+
+ We want the Player to have attributes like volume, pitch, etc. These are
+ actually implemented by the AudioPlayer. So this descriptor will forward
+ an assignement to one of the attributes to the AudioPlayer. For example
+ `player.volume = 0.5` will call `player._audio_player.set_volume(0.5)`.
+
+ The Player class has default values at the class level which are retrieved
+ if not found on the instance.
+ """
+
+ def __init__(self, attribute, doc=None):
+ self.attribute = attribute
+ self.__doc__ = doc or ''
+
+ def __get__(self, obj, objtype=None):
+ if obj is None:
+ return self
+ if '_' + self.attribute in obj.__dict__:
+ return obj.__dict__['_' + self.attribute]
+ return getattr(objtype, '_' + self.attribute)
+
+ def __set__(self, obj, value):
+ obj.__dict__['_' + self.attribute] = value
+ if obj._audio_player:
+ getattr(obj._audio_player, 'set_' + self.attribute)(value)
+
+
+class Player(pyglet.event.EventDispatcher):
+ """High-level sound and video player."""
+
+ # Spacialisation attributes, preserved between audio players
+ _volume = 1.0
+ _min_distance = 1.0
+ _max_distance = 100000000.
+
+ _position = (0, 0, 0)
+ _pitch = 1.0
+
+ _cone_orientation = (0, 0, 1)
+ _cone_inner_angle = 360.
+ _cone_outer_angle = 360.
+ _cone_outer_gain = 1.
+
+ def __init__(self):
+ """Initialize the Player with a MasterClock."""
+ self._source = None
+ self._playlists = deque()
+ self._audio_player = None
+
+ self._texture = None
+ # Desired play state (not an indication of actual state).
+ self._playing = False
+
+ self._timer = PlaybackTimer()
+ #: Loop the current source indefinitely or until
+ #: :meth:`~Player.next_source` is called. Defaults to ``False``.
+ #:
+ #: :type: bool
+ #:
+ #: .. versionadded:: 1.4
+ self.loop = False
+
+ def __del__(self):
+ """Release the Player resources."""
+ self.delete()
+
+ def queue(self, source):
+ """
+ Queue the source on this player.
+
+ If the player has no source, the player will start to play immediately
+ or pause depending on its :attr:`.playing` attribute.
+
+ Args:
+ source (Source or Iterable[Source]): The source to queue.
+ """
+ if isinstance(source, (Source, SourceGroup)):
+ source = _one_item_playlist(source)
+ else:
+ try:
+ source = iter(source)
+ except TypeError:
+ raise TypeError("source must be either a Source or an iterable."
+ " Received type {0}".format(type(source)))
+ self._playlists.append(source)
+
+ if self.source is None:
+ source = next(self._playlists[0])
+ self._source = source.get_queue_source()
+
+ self._set_playing(self._playing)
+
+ def _set_playing(self, playing):
+ # stopping = self._playing and not playing
+ # starting = not self._playing and playing
+
+ self._playing = playing
+ source = self.source
+
+ if playing and source:
+ if source.audio_format:
+ if self._audio_player is None:
+ self._create_audio_player()
+ if self._audio_player:
+ # We succesfully created an audio player
+ self._audio_player.prefill_audio()
+
+ if bl.logger is not None:
+ bl.logger.init_wall_time()
+ bl.logger.log("p.P._sp", 0.0)
+
+ if source.video_format:
+ if not self._texture:
+ self._create_texture()
+
+ if self._audio_player:
+ self._audio_player.play()
+ if source.video_format:
+ pyglet.clock.schedule_once(self.update_texture, 0)
+ # For audio synchronization tests, the following will
+ # add a delay to de-synchronize the audio.
+ # Negative number means audio runs ahead.
+ # self._mclock._systime += -0.3
+ self._timer.start()
+ if self._audio_player is None and source.video_format is None:
+ pyglet.clock.schedule_once(lambda dt: self.dispatch_event("on_eos"), source.duration)
+
+
+ else:
+ if self._audio_player:
+ self._audio_player.stop()
+
+ pyglet.clock.unschedule(self.update_texture)
+ self._timer.pause()
+
+ @property
+ def playing(self):
+ """
+ bool: Read-only. Determine if the player state is playing.
+
+ The *playing* property is irrespective of whether or not there is
+ actually a source to play. If *playing* is ``True`` and a source is
+ queued, it will begin to play immediately. If *playing* is ``False``,
+ it is implied that the player is paused. There is no other possible
+ state.
+ """
+ return self._playing
+
+ def play(self):
+ """Begin playing the current source.
+
+ This has no effect if the player is already playing.
+ """
+ self._set_playing(True)
+
+ def pause(self):
+ """Pause playback of the current source.
+
+ This has no effect if the player is already paused.
+ """
+ self._set_playing(False)
+
+ def delete(self):
+ """Release the resources acquired by this player.
+
+ The internal audio player and the texture will be deleted.
+ """
+ if self._source:
+ self.source.is_player_source = False
+ if self._audio_player:
+ self._audio_player.delete()
+ self._audio_player = None
+ if self._texture:
+ self._texture = None
+
+ def next_source(self):
+ """Move immediately to the next source in the current playlist.
+
+ If the playlist is empty, discard it and check if another playlist
+ is queued. There may be a gap in playback while the audio buffer
+ is refilled.
+ """
+ was_playing = self._playing
+ self.pause()
+ self._timer.reset()
+
+ if self._source:
+ # Reset source to the beginning
+ self.seek(0.0)
+ self.source.is_player_source = False
+
+ playlists = self._playlists
+ if not playlists:
+ return
+
+ try:
+ new_source = next(playlists[0])
+ except StopIteration:
+ self._playlists.popleft()
+ if not self._playlists:
+ new_source = None
+ else:
+ # Could someone queue an iterator which is empty??
+ new_source = next(self._playlists[0])
+
+ if new_source is None:
+ self._source = None
+ self.delete()
+ self.dispatch_event('on_player_eos')
+ else:
+ old_audio_format = self._source.audio_format
+ old_video_format = self._source.video_format
+ self._source = new_source.get_queue_source()
+
+ if self._audio_player:
+ if old_audio_format == self._source.audio_format:
+ self._audio_player.clear()
+ self._audio_player.source = self._source
+ else:
+ self._audio_player.delete()
+ self._audio_player = None
+ if old_video_format != self._source.video_format:
+ self._texture = None
+ pyglet.clock.unschedule(self.update_texture)
+
+ self._set_playing(was_playing)
+ self.dispatch_event('on_player_next_source')
+
+ def seek(self, timestamp):
+ """
+ Seek for playback to the indicated timestamp on the current source.
+
+ Timestamp is expressed in seconds. If the timestamp is outside the
+ duration of the source, it will be clamped to the end.
+
+ Args:
+ timestamp (float): The time where to seek in the source, clamped to the
+ beginning and end of the source.
+ """
+ playing = self._playing
+ if playing:
+ self.pause()
+ if not self.source:
+ return
+
+ if bl.logger is not None:
+ bl.logger.log("p.P.sk", timestamp)
+
+ timestamp = max(timestamp, 0)
+
+ self._timer.set_time(timestamp)
+ self._source.seek(timestamp)
+ if self._audio_player:
+ # XXX: According to docstring in AbstractAudioPlayer this cannot
+ # be called when the player is not stopped
+ self._audio_player.clear()
+ if self.source.video_format:
+ self.update_texture()
+ pyglet.clock.unschedule(self.update_texture)
+ self._set_playing(playing)
+
+ def _create_audio_player(self):
+ assert not self._audio_player
+ assert self.source
+
+ source = self.source
+ audio_driver = get_audio_driver()
+ if audio_driver is None:
+ # Failed to find a valid audio driver
+ return
+
+ self._audio_player = audio_driver.create_audio_player(source, self)
+
+ # Set the audio player attributes
+ for attr in ('volume', 'min_distance', 'max_distance', 'position',
+ 'pitch', 'cone_orientation', 'cone_inner_angle',
+ 'cone_outer_angle', 'cone_outer_gain'):
+ value = getattr(self, attr)
+ setattr(self, attr, value)
+
+ @property
+ def source(self):
+ """Source: Read-only. The current :class:`Source`, or ``None``."""
+ return self._source
+
+ @property
+ def time(self):
+ """
+ float: Read-only. Current playback time of the current source.
+
+ The playback time is a float expressed in seconds, with 0.0 being the
+ beginning of the media. The playback time returned represents the
+ player master clock time which is used to synchronize both the audio
+ and the video.
+ """
+ return self._timer.get_time()
+
+ def _create_texture(self):
+ video_format = self.source.video_format
+ self._texture = pyglet.image.Texture.create(video_format.width, video_format.height, GL_TEXTURE_2D)
+ self._texture = self._texture.get_transform(flip_y=True)
+ # After flipping the texture along the y axis, the anchor_y is set
+ # to the top of the image. We want to keep it at the bottom.
+ self._texture.anchor_y = 0
+ return self._texture
+
+ @property
+ def texture(self):
+ """
+ :class:`pyglet.image.Texture`: Get the texture for the current video frame.
+
+ You should call this method every time you display a frame of video,
+ as multiple textures might be used. The return value will be None if
+ there is no video in the current source.
+ """
+ return self._texture
+
+ def get_texture(self):
+ """
+ Get the texture for the current video frame.
+
+ You should call this method every time you display a frame of video,
+ as multiple textures might be used. The return value will be None if
+ there is no video in the current source.
+
+ Returns:
+ :class:`pyglet.image.Texture`
+
+ .. deprecated:: 1.4
+ Use :attr:`~texture` instead
+ """
+ return self.texture
+
+ def refill_buffer(self):
+ raise NotImplemented
+
+ def seek_next_frame(self):
+ """Step forwards one video frame in the current source."""
+ time = self.source.get_next_video_timestamp()
+ if time is None:
+ return
+ self.seek(time)
+
+ def update_texture(self, dt=None):
+ """Manually update the texture from the current source.
+
+ This happens automatically, so you shouldn't need to call this method.
+
+ Args:
+ dt (float): The time elapsed since the last call to
+ ``update_texture``.
+ """
+ # self.pr.disable()
+ # if dt > 0.05:
+ # print("update_texture dt:", dt)
+ # import pstats
+ # ps = pstats.Stats(self.pr).sort_stats("cumulative")
+ # ps.print_stats()
+ source = self.source
+ time = self.time
+ if bl.logger is not None:
+ bl.logger.log(
+ "p.P.ut.1.0", dt, time,
+ self._audio_player.get_time() if self._audio_player else 0,
+ bl.logger.rebased_wall_time()
+ )
+
+ frame_rate = source.video_format.frame_rate
+ frame_duration = 1 / frame_rate
+ ts = source.get_next_video_timestamp()
+ # Allow up to frame_duration difference
+ while ts is not None and ts + frame_duration < time:
+ source.get_next_video_frame() # Discard frame
+ if bl.logger is not None:
+ bl.logger.log("p.P.ut.1.5", ts)
+ ts = source.get_next_video_timestamp()
+
+ if bl.logger is not None:
+ bl.logger.log("p.P.ut.1.6", ts)
+
+ if ts is None:
+ # No more video frames to show. End of video stream.
+ if bl.logger is not None:
+ bl.logger.log("p.P.ut.1.7", frame_duration)
+
+ pyglet.clock.schedule_once(self._video_finished, 0)
+ return
+ elif ts > time:
+ # update_texture called too early (probably manually!)
+ pyglet.clock.schedule_once(self.update_texture, ts - time)
+ return
+
+
+ image = source.get_next_video_frame()
+ if image is not None:
+ if self._texture is None:
+ self._create_texture()
+ self._texture.blit_into(image, 0, 0, 0)
+ elif bl.logger is not None:
+ bl.logger.log("p.P.ut.1.8")
+
+ ts = source.get_next_video_timestamp()
+ if ts is None:
+ delay = frame_duration
+ else:
+ delay = ts - time
+
+ delay = max(0.0, delay)
+ if bl.logger is not None:
+ bl.logger.log("p.P.ut.1.9", delay, ts)
+ pyglet.clock.schedule_once(self.update_texture, delay)
+ # self.pr.enable()
+
+ def _video_finished(self, dt):
+ if self._audio_player is None:
+ self.dispatch_event("on_eos")
+
+ volume = _PlayerProperty('volume', doc="""
+ The volume level of sound playback.
+
+ The nominal level is 1.0, and 0.0 is silence.
+
+ The volume level is affected by the distance from the listener (if
+ positioned).
+ """)
+ min_distance = _PlayerProperty('min_distance', doc="""
+ The distance beyond which the sound volume drops by half, and within
+ which no attenuation is applied.
+
+ The minimum distance controls how quickly a sound is attenuated as it
+ moves away from the listener. The gain is clamped at the nominal value
+ within the min distance. By default the value is 1.0.
+
+ The unit defaults to meters, but can be modified with the listener
+ properties. """)
+ max_distance = _PlayerProperty('max_distance', doc="""
+ The distance at which no further attenuation is applied.
+
+ When the distance from the listener to the player is greater than this
+ value, attenuation is calculated as if the distance were value. By
+ default the maximum distance is infinity.
+
+ The unit defaults to meters, but can be modified with the listener
+ properties.
+ """)
+ position = _PlayerProperty('position', doc="""
+ The position of the sound in 3D space.
+
+ The position is given as a tuple of floats (x, y, z). The unit
+ defaults to meters, but can be modified with the listener properties.
+ """)
+ pitch = _PlayerProperty('pitch', doc="""
+ The pitch shift to apply to the sound.
+
+ The nominal pitch is 1.0. A pitch of 2.0 will sound one octave higher,
+ and play twice as fast. A pitch of 0.5 will sound one octave lower, and
+ play twice as slow. A pitch of 0.0 is not permitted.
+ """)
+ cone_orientation = _PlayerProperty('cone_orientation', doc="""
+ The direction of the sound in 3D space.
+
+ The direction is specified as a tuple of floats (x, y, z), and has no
+ unit. The default direction is (0, 0, -1). Directional effects are only
+ noticeable if the other cone properties are changed from their default
+ values.
+ """)
+ cone_inner_angle = _PlayerProperty('cone_inner_angle', doc="""
+ The interior angle of the inner cone.
+
+ The angle is given in degrees, and defaults to 360. When the listener
+ is positioned within the volume defined by the inner cone, the sound is
+ played at normal gain (see :attr:`volume`).
+ """)
+ cone_outer_angle = _PlayerProperty('cone_outer_angle', doc="""
+ The interior angle of the outer cone.
+
+ The angle is given in degrees, and defaults to 360. When the listener
+ is positioned within the volume defined by the outer cone, but outside
+ the volume defined by the inner cone, the gain applied is a smooth
+ interpolation between :attr:`volume` and :attr:`cone_outer_gain`.
+ """)
+ cone_outer_gain = _PlayerProperty('cone_outer_gain', doc="""
+ The gain applied outside the cone.
+
+ When the listener is positioned outside the volume defined by the outer
+ cone, this gain is applied instead of :attr:`volume`.
+ """)
+
+ # Events
+
+ def on_player_eos(self):
+ """The player ran out of sources. The playlist is empty.
+
+ :event:
+ """
+ if _debug:
+ print('Player.on_player_eos')
+
+ def on_eos(self):
+ """The current source ran out of data.
+
+ The default behaviour is to advance to the next source in the
+ playlist if the :attr:`.loop` attribute is set to ``False``.
+ If :attr:`.loop` attribute is set to ``True``, the current source
+ will start to play again until :meth:`next_source` is called or
+ :attr:`.loop` is set to ``False``.
+
+ :event:
+ """
+ if _debug:
+ print('Player.on_eos')
+ if bl.logger is not None:
+ bl.logger.log("p.P.oe")
+ bl.logger.close()
+
+ if self.loop:
+ was_playing = self._playing
+ self.pause()
+ self._timer.reset()
+
+ if self.source:
+ # Reset source to the beginning
+ self.seek(0.0)
+ if self._audio_player:
+ self._audio_player.clear()
+ self._set_playing(was_playing)
+
+ else:
+ self.next_source()
+
+ def on_player_next_source(self):
+ """The player starts to play the next queued source in the playlist.
+
+ This is a useful event for adjusting the window size to the new
+ source :class:`VideoFormat` for example.
+
+ :event:
+ """
+ pass
+
+ def on_driver_reset(self):
+ """The audio driver has been reset, by default this will kill the current audio player and create a new one,
+ and requeue the buffers. Any buffers that may have been queued in a player will be resubmitted. It will
+ continue from the last buffers submitted, not played and may cause sync issues if using video.
+
+ :event:
+ """
+ if self._audio_player:
+ self._audio_player.on_driver_reset()
+
+ # Voice has been changed, will need to reset all options on the voice.
+ for attr in ('volume', 'min_distance', 'max_distance', 'position',
+ 'pitch', 'cone_orientation', 'cone_inner_angle',
+ 'cone_outer_angle', 'cone_outer_gain'):
+ value = getattr(self, attr)
+ setattr(self, attr, value)
+
+ if self._playing:
+ self._audio_player.play()
+
+
+Player.register_event_type('on_eos')
+Player.register_event_type('on_player_eos')
+Player.register_event_type('on_player_next_source')
+Player.register_event_type('on_driver_reset')
+
+
+def _one_item_playlist(source):
+ yield source
+
+
+class PlayerGroup:
+ """Group of players that can be played and paused simultaneously.
+
+ Create a player group for the given list of players.
+
+ All players in the group must currently not belong to any other group.
+
+ Args:
+ players (List[Player]): List of :class:`.Player` s in this group.
+ """
+
+ def __init__(self, players):
+ """Initialize the PlayerGroup with the players."""
+ self.players = list(players)
+
+ def play(self):
+ """Begin playing all players in the group simultaneously."""
+ audio_players = [p._audio_player
+ for p in self.players if p._audio_player]
+ if audio_players:
+ audio_players[0]._play_group(audio_players)
+ for player in self.players:
+ player.play()
+
+ def pause(self):
+ """Pause all players in the group simultaneously."""
+ audio_players = [p._audio_player
+ for p in self.players if p._audio_player]
+ if audio_players:
+ audio_players[0]._stop_group(audio_players)
+ for player in self.players:
+ player.pause()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/synthesis.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/synthesis.py
new file mode 100644
index 0000000000000000000000000000000000000000..37b5bcbd232f416ea232eac74405bef7a96b9950
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/media/synthesis.py
@@ -0,0 +1,331 @@
+import math as _math
+import struct as _struct
+
+from random import uniform as _uniform
+
+from pyglet.media.codecs.base import Source, AudioFormat, AudioData
+
+
+# Envelope classes:
+
+class _Envelope:
+ """Base class for SynthesisSource amplitude envelopes."""
+
+ def get_generator(self, sample_rate, duration):
+ raise NotImplementedError
+
+
+class FlatEnvelope(_Envelope):
+ """A flat envelope, providing basic amplitude setting.
+
+ :Parameters:
+ `amplitude` : float
+ The amplitude (volume) of the wave, from 0.0 to 1.0.
+ Values outside this range will be clamped.
+ """
+
+ def __init__(self, amplitude=0.5):
+ self.amplitude = max(min(1.0, amplitude), 0)
+
+ def get_generator(self, sample_rate, duration):
+ amplitude = self.amplitude
+ while True:
+ yield amplitude
+
+
+class LinearDecayEnvelope(_Envelope):
+ """A linearly decaying envelope.
+
+ This envelope linearly decays the amplitude from the peak value
+ to 0, over the length of the waveform.
+
+ :Parameters:
+ `peak` : float
+ The Initial peak value of the envelope, from 0.0 to 1.0.
+ Values outside this range will be clamped.
+ """
+
+ def __init__(self, peak=1.0):
+ self.peak = max(min(1.0, peak), 0)
+
+ def get_generator(self, sample_rate, duration):
+ peak = self.peak
+ total_bytes = int(sample_rate * duration)
+ for i in range(total_bytes):
+ yield (total_bytes - i) / total_bytes * peak
+ while True:
+ yield 0
+
+
+class ADSREnvelope(_Envelope):
+ """A four part Attack, Decay, Suspend, Release envelope.
+
+ This is a four part ADSR envelope. The attack, decay, and release
+ parameters should be provided in seconds. For example, a value of
+ 0.1 would be 100ms. The sustain_amplitude parameter affects the
+ sustain volume. This defaults to a value of 0.5, but can be provided
+ on a scale from 0.0 to 1.0.
+
+ :Parameters:
+ `attack` : float
+ The attack time, in seconds.
+ `decay` : float
+ The decay time, in seconds.
+ `release` : float
+ The release time, in seconds.
+ `sustain_amplitude` : float
+ The sustain amplitude (volume), from 0.0 to 1.0.
+ """
+
+ def __init__(self, attack, decay, release, sustain_amplitude=0.5):
+ self.attack = attack
+ self.decay = decay
+ self.release = release
+ self.sustain_amplitude = max(min(1.0, sustain_amplitude), 0)
+
+ def get_generator(self, sample_rate, duration):
+ sustain_amplitude = self.sustain_amplitude
+ total_bytes = int(sample_rate * duration)
+ attack_bytes = int(sample_rate * self.attack)
+ decay_bytes = int(sample_rate * self.decay)
+ release_bytes = int(sample_rate * self.release)
+ sustain_bytes = total_bytes - attack_bytes - decay_bytes - release_bytes
+ decay_step = (1 - sustain_amplitude) / decay_bytes
+ release_step = sustain_amplitude / release_bytes
+ for i in range(1, attack_bytes + 1):
+ yield i / attack_bytes
+ for i in range(1, decay_bytes + 1):
+ yield 1 - (i * decay_step)
+ for i in range(1, sustain_bytes + 1):
+ yield sustain_amplitude
+ for i in range(1, release_bytes + 1):
+ yield sustain_amplitude - (i * release_step)
+ while True:
+ yield 0
+
+
+class TremoloEnvelope(_Envelope):
+ """A tremolo envelope, for modulation amplitude.
+
+ A tremolo envelope that modulates the amplitude of the
+ waveform with a sinusoidal pattern. The depth and rate
+ of modulation can be specified. Depth is calculated as
+ a percentage of the maximum amplitude. For example:
+ a depth of 0.2 and amplitude of 0.5 will fluctuate
+ the amplitude between 0.4 an 0.5.
+
+ :Parameters:
+ `depth` : float
+ The amount of fluctuation, from 0.0 to 1.0.
+ `rate` : float
+ The fluctuation frequency, in seconds.
+ `amplitude` : float
+ The peak amplitude (volume), from 0.0 to 1.0.
+ """
+
+ def __init__(self, depth, rate, amplitude=0.5):
+ self.depth = max(min(1.0, depth), 0)
+ self.rate = rate
+ self.amplitude = max(min(1.0, amplitude), 0)
+
+ def get_generator(self, sample_rate, duration):
+ total_bytes = int(sample_rate * duration)
+ period = total_bytes / duration
+ max_amplitude = self.amplitude
+ min_amplitude = max(0.0, (1.0 - self.depth) * self.amplitude)
+ step = (_math.pi * 2) / period / self.rate
+ for i in range(total_bytes):
+ value = _math.sin(step * i)
+ yield value * (max_amplitude - min_amplitude) + min_amplitude
+ while True:
+ yield 0
+
+
+# Waveform generators
+
+def silence_generator(frequency, sample_rate):
+ while True:
+ yield 0
+
+
+def noise_generator(frequency, sample_rate):
+ while True:
+ yield _uniform(-1, 1)
+
+
+def sine_generator(frequency, sample_rate):
+ step = 2 * _math.pi * frequency / sample_rate
+ i = 0
+ while True:
+ yield _math.sin(i * step)
+ i += 1
+
+
+def triangle_generator(frequency, sample_rate):
+ step = 4 * frequency / sample_rate
+ value = 0
+ while True:
+ if value > 1:
+ value = 1 - (value - 1)
+ step = -step
+ if value < -1:
+ value = -1 - (value - -1)
+ step = -step
+ yield value
+ value += step
+
+
+def sawtooth_generator(frequency, sample_rate):
+ period_length = int(sample_rate / frequency)
+ step = 2 * frequency / sample_rate
+ i = 0
+ while True:
+ yield step * (i % period_length) - 1
+ i += 1
+
+
+def pulse_generator(frequency, sample_rate, duty_cycle=50):
+ period_length = int(sample_rate / frequency)
+ duty_cycle = int(duty_cycle * period_length / 100)
+ i = 0
+ while True:
+ yield int(i % period_length < duty_cycle) * 2 - 1
+ i += 1
+
+
+# Source classes:
+
+class SynthesisSource(Source):
+ """Base class for synthesized waveforms.
+
+ :Parameters:
+ `generator` : A non-instantiated generator object
+ A waveform generator that produces a stream of floats from (-1, 1)
+ `duration` : float
+ The length, in seconds, of audio that you wish to generate.
+ `sample_rate` : int
+ Audio samples per second. (CD quality is 44100).
+ `envelope` : :py:class:`pyglet.media.synthesis._Envelope`
+ An optional Envelope to apply to the waveform.
+ """
+ def __init__(self, generator, duration, sample_rate=44800, envelope=None):
+ self._generator = generator
+ self._duration = duration
+ self.audio_format = AudioFormat(channels=1, sample_size=16, sample_rate=sample_rate)
+
+ self._envelope = envelope or FlatEnvelope(amplitude=1.0)
+ self._envelope_generator = self._envelope.get_generator(sample_rate, duration)
+
+ # Two bytes per sample (16-bit):
+ self._bytes_per_second = sample_rate * 2
+ # Maximum offset, aligned to sample:
+ self._max_offset = int(self._bytes_per_second * duration) & 0xfffffffe
+ self._offset = 0
+
+ def get_audio_data(self, num_bytes, compensation_time=0.0):
+ """Return `num_bytes` bytes of audio data."""
+ num_bytes = min(num_bytes, self._max_offset - self._offset)
+ if num_bytes <= 0:
+ return None
+
+ timestamp = self._offset / self._bytes_per_second
+ duration = num_bytes / self._bytes_per_second
+ self._offset += num_bytes
+
+ # Generate bytes:
+ samples = num_bytes >> 1
+ generator = self._generator
+ envelope = self._envelope_generator
+ data = (int(next(generator) * next(envelope) * 0x7fff) for _ in range(samples))
+ data = _struct.pack(f"{samples}h", *data)
+
+ return AudioData(data, num_bytes, timestamp, duration, [])
+
+ def seek(self, timestamp):
+ # Bound within duration & align to sample:
+ offset = int(timestamp * self._bytes_per_second)
+ self._offset = min(max(offset, 0), self._max_offset) & 0xfffffffe
+ self._envelope_generator = self._envelope.get_generator(self.audio_format.sample_rate, self._duration)
+
+
+class Silence(SynthesisSource):
+ def __init__(self, duration, frequency=440, sample_rate=44800, envelope=None):
+ """Create a Silent waveform."""
+ super().__init__(silence_generator(frequency, sample_rate), duration, sample_rate, envelope)
+
+
+class WhiteNoise(SynthesisSource):
+ def __init__(self, duration, frequency=440, sample_rate=44800, envelope=None):
+ """Create a random white noise waveform."""
+ super().__init__(noise_generator(frequency, sample_rate), duration, sample_rate, envelope)
+
+
+class Sine(SynthesisSource):
+ def __init__(self, duration, frequency=440, sample_rate=44800, envelope=None):
+ """Create a sinusoid (sine) waveform."""
+ super().__init__(sine_generator(frequency, sample_rate), duration, sample_rate, envelope)
+
+
+class Square(SynthesisSource):
+ def __init__(self, duration, frequency=440, sample_rate=44800, envelope=None):
+ """Create a Square (pulse) waveform."""
+ super().__init__(pulse_generator(frequency, sample_rate), duration, sample_rate, envelope)
+
+
+class Triangle(SynthesisSource):
+ def __init__(self, duration, frequency=440, sample_rate=44800, envelope=None):
+ """Create a Triangle waveform."""
+ super().__init__(triangle_generator(frequency, sample_rate), duration, sample_rate, envelope)
+
+
+class Sawtooth(SynthesisSource):
+ def __init__(self, duration, frequency=440, sample_rate=44800, envelope=None):
+ """Create a Sawtooth waveform."""
+ super().__init__(sawtooth_generator(frequency, sample_rate), duration, sample_rate, envelope)
+
+
+#############################################
+# Experimental multi-operator FM synthesis:
+#############################################
+
+def sine_operator(sample_rate=44800, frequency=440, index=1, modulator=None, envelope=None):
+ """A sine wave generator that can be optionally modulated with another generator.
+
+ This generator represents a single FM Operator. It can be used by itself as a
+ simple sine wave, or modulated by another waveform generator. Multiple operators
+ can be linked together in this way. For example::
+
+ operator1 = sine_operator(samplerate=44800, frequency=1.22)
+ operator2 = sine_operator(samplerate=44800, frequency=99, modulator=operator1)
+ operator3 = sine_operator(samplerate=44800, frequency=333, modulator=operator2)
+ operator4 = sine_operator(samplerate=44800, frequency=545, modulator=operator3)
+
+ :Parameters:
+ `sample_rate` : int
+ Audio samples per second. (CD quality is 44100).
+ `frequency` : float
+ The frequency, in Hz, of the waveform you wish to generate.
+ `index` : float
+ The modulation index. Defaults to 1
+ `modulator` : sine_operator
+ An optional operator to modulate this one.
+ `envelope` : :py:class:`pyglet.media.synthesis._Envelope`
+ An optional Envelope to apply to the waveform.
+ """
+ # FM equation: sin((i * 2 * pi * carrier_frequency) + sin(i * 2 * pi * modulator_frequency))
+ envelope = envelope or FlatEnvelope(1).get_generator(sample_rate, duration=None)
+ sin = _math.sin
+ step = 2 * _math.pi * frequency / sample_rate
+ i = 0
+ if modulator:
+ while True:
+ yield sin(i * step + index * next(modulator)) * next(envelope)
+ i += 1
+ else:
+ while True:
+ yield sin(i * step) * next(envelope)
+ i += 1
+
+
+def composite_operator(*operators):
+ return (sum(samples) / len(samples) for samples in zip(*operators))
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/model/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/model/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..b2cc563b209984fc6efa7cc2770a717b4c346bb9
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/model/__init__.py
@@ -0,0 +1,334 @@
+"""Loading of 3D models.
+
+A :py:class:`~pyglet.model.Model` is an instance of a 3D object.
+
+The following example loads a ``"teapot.obj"`` model::
+
+ import pyglet
+
+ window = pyglet.window.Window()
+
+ teapot = pyglet.model.load('teapot.obj')
+
+ @window.event
+ def on_draw():
+ teapot.draw()
+
+ pyglet.app.run()
+
+
+You can also load models with :py:meth:`~pyglet.resource.model`.
+See :py:mod:`~pyglet.resource` for more information.
+
+
+Efficient Drawing
+=================
+
+As with Sprites or Text, Models can be added to a
+:py:class:`~pyglet.graphics.Batch` for efficient drawing. This is
+preferred to calling their ``draw`` methods individually. To do this,
+simply pass in a reference to the :py:class:`~pyglet.graphics.Batch`
+instance when loading the Model::
+
+
+ import pyglet
+
+ window = pyglet.window.Window()
+ batch = pyglet.graphics.Batch()
+
+ teapot = pyglet.model.load('teapot.obj', batch=batch)
+
+ @window.event
+ def on_draw():
+ batch.draw()
+
+ pyglet.app.run()
+
+
+.. versionadded:: 1.4
+"""
+
+import pyglet
+
+from pyglet import gl
+from pyglet import graphics
+from pyglet.gl import current_context
+from pyglet.math import Mat4, Vec3
+from pyglet.graphics import shader
+
+from .codecs import registry as _codec_registry
+from .codecs import add_default_codecs as _add_default_codecs
+
+
+def load(filename, file=None, decoder=None, batch=None, group=None):
+ """Load a 3D model from a file.
+
+ :Parameters:
+ `filename` : str
+ Used to guess the model format, and to load the file if `file` is
+ unspecified.
+ `file` : file-like object or None
+ Source of model data in any supported format.
+ `decoder` : ModelDecoder or None
+ If unspecified, all decoders that are registered for the filename
+ extension are tried. An exception is raised if no codecs are
+ registered for the file extension, or if decoding fails.
+ `batch` : Batch or None
+ An optional Batch instance to add this model to.
+ `group` : Group or None
+ An optional top level Group.
+
+ :rtype: :py:mod:`~pyglet.model.Model`
+ """
+ if decoder:
+ return decoder.decode(filename, file, batch=batch, group=group)
+ else:
+ return _codec_registry.decode(filename, file, batch=batch, group=group)
+
+
+def get_default_shader():
+ try:
+ return pyglet.gl.current_context.model_default_plain_shader
+ except AttributeError:
+ vert_shader = shader.Shader(MaterialGroup.default_vert_src, 'vertex')
+ frag_shader = shader.Shader(MaterialGroup.default_frag_src, 'fragment')
+ default_shader_program = shader.ShaderProgram(vert_shader, frag_shader)
+ pyglet.gl.current_context.model_default_plain_shader = default_shader_program
+ return pyglet.gl.current_context.model_default_plain_shader
+
+
+def get_default_textured_shader():
+ try:
+ return pyglet.gl.current_context.model_default_textured_shader
+ except AttributeError:
+ vert_shader = shader.Shader(TexturedMaterialGroup.default_vert_src, 'vertex')
+ frag_shader = shader.Shader(TexturedMaterialGroup.default_frag_src, 'fragment')
+ default_shader_program = shader.ShaderProgram(vert_shader, frag_shader)
+ pyglet.gl.current_context.model_default_textured_shader = default_shader_program
+ return current_context.model_default_textured_shader
+
+
+class Model:
+ """Instance of a 3D object.
+
+ See the module documentation for usage.
+ """
+
+ def __init__(self, vertex_lists, groups, batch):
+ """Create a model.
+
+ :Parameters:
+ `vertex_lists` : list
+ A list of `~pyglet.graphics.VertexList` or
+ `~pyglet.graphics.IndexedVertexList`.
+ `groups` : list
+ A list of `~pyglet.model.TexturedMaterialGroup`, or
+ `~pyglet.model.MaterialGroup`. Each group corresponds to
+ a vertex list in `vertex_lists` of the same index.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the model to. If no batch is provided,
+ the model will maintain its own internal batch.
+ """
+ self.vertex_lists = vertex_lists
+ self.groups = groups
+ self._batch = batch
+ self._modelview_matrix = Mat4()
+
+ @property
+ def batch(self):
+ """The graphics Batch that the Model belongs to.
+
+ The Model can be migrated from one batch to another, or removed from
+ a batch (for individual drawing). If not part of any batch, the Model
+ will keep its own internal batch. Note that batch migration can be
+ an expensive operation.
+
+ :type: :py:class:`pyglet.graphics.Batch`
+ """
+ return self._batch
+
+ @batch.setter
+ def batch(self, batch):
+ if self._batch == batch:
+ return
+
+ if batch is None:
+ batch = graphics.Batch()
+
+ for group, vlist in zip(self.groups, self.vertex_lists):
+ self._batch.migrate(vlist, gl.GL_TRIANGLES, group, batch)
+
+ self._batch = batch
+
+ @property
+ def matrix(self):
+ return self._modelview_matrix
+
+ @matrix.setter
+ def matrix(self, matrix):
+ self._modelview_matrix = matrix
+ for group in self.groups:
+ group.matrix = matrix
+
+ def draw(self):
+ """Draw the model.
+
+ This is not recommended. See the module documentation
+ for information on efficient drawing of multiple models.
+ """
+ gl.current_context.window_block.bind(0)
+ self._batch.draw_subset(self.vertex_lists)
+
+
+class Material:
+ __slots__ = ("name", "diffuse", "ambient", "specular", "emission", "shininess", "texture_name")
+
+ def __init__(self, name, diffuse, ambient, specular, emission, shininess, texture_name=None):
+ self.name = name
+ self.diffuse = diffuse
+ self.ambient = ambient
+ self.specular = specular
+ self.emission = emission
+ self.shininess = shininess
+ self.texture_name = texture_name
+
+ def __eq__(self, other):
+ return (self.name == other.name and
+ self.diffuse == other.diffuse and
+ self.ambient == other.ambient and
+ self.specular == other.specular and
+ self.emission == other.emission and
+ self.shininess == other.shininess and
+ self.texture_name == other.texture_name)
+
+
+class BaseMaterialGroup(graphics.Group):
+ default_vert_src = None
+ default_frag_src = None
+ matrix = Mat4()
+
+ def __init__(self, material, program, order=0, parent=None):
+ super().__init__(order, parent)
+ self.material = material
+ self.program = program
+
+
+class TexturedMaterialGroup(BaseMaterialGroup):
+ default_vert_src = """#version 330 core
+ in vec3 vertices;
+ in vec3 normals;
+ in vec2 tex_coords;
+ in vec4 colors;
+
+ out vec4 vertex_colors;
+ out vec3 vertex_normals;
+ out vec2 texture_coords;
+ out vec3 vertex_position;
+
+ uniform WindowBlock
+ {
+ mat4 projection;
+ mat4 view;
+ } window;
+
+ uniform mat4 model;
+
+ void main()
+ {
+ vec4 pos = window.view * model * vec4(vertices, 1.0);
+ gl_Position = window.projection * pos;
+ mat3 normal_matrix = transpose(inverse(mat3(model)));
+
+ vertex_position = pos.xyz;
+ vertex_colors = colors;
+ texture_coords = tex_coords;
+ vertex_normals = normal_matrix * normals;
+ }
+ """
+ default_frag_src = """#version 330 core
+ in vec4 vertex_colors;
+ in vec3 vertex_normals;
+ in vec2 texture_coords;
+ in vec3 vertex_position;
+ out vec4 final_colors;
+
+ uniform sampler2D our_texture;
+
+ void main()
+ {
+ float l = dot(normalize(-vertex_position), normalize(vertex_normals));
+ final_colors = (texture(our_texture, texture_coords) * vertex_colors) * l * 1.2;
+ }
+ """
+
+ def __init__(self, material, program, texture, order=0, parent=None):
+ super().__init__(material, program, order, parent)
+ self.texture = texture
+
+ def set_state(self):
+ gl.glActiveTexture(gl.GL_TEXTURE0)
+ gl.glBindTexture(self.texture.target, self.texture.id)
+ self.program.use()
+ self.program['model'] = self.matrix
+
+ def __hash__(self):
+ return hash((self.texture.target, self.texture.id, self.program, self.order, self.parent))
+
+ def __eq__(self, other):
+ return (self.__class__ is other.__class__ and
+ self.material == other.material and
+ self.texture.target == other.texture.target and
+ self.texture.id == other.texture.id and
+ self.program == other.program and
+ self.order == other.order and
+ self.parent == other.parent)
+
+
+class MaterialGroup(BaseMaterialGroup):
+ default_vert_src = """#version 330 core
+ in vec3 vertices;
+ in vec3 normals;
+ in vec4 colors;
+
+ out vec4 vertex_colors;
+ out vec3 vertex_normals;
+ out vec3 vertex_position;
+
+ uniform WindowBlock
+ {
+ mat4 projection;
+ mat4 view;
+ } window;
+
+ uniform mat4 model;
+
+ void main()
+ {
+ vec4 pos = window.view * model * vec4(vertices, 1.0);
+ gl_Position = window.projection * pos;
+ mat3 normal_matrix = transpose(inverse(mat3(model)));
+
+ vertex_position = pos.xyz;
+ vertex_colors = colors;
+ vertex_normals = normal_matrix * normals;
+ }
+ """
+ default_frag_src = """#version 330 core
+ in vec4 vertex_colors;
+ in vec3 vertex_normals;
+ in vec3 vertex_position;
+ out vec4 final_colors;
+
+ void main()
+ {
+ float l = dot(normalize(-vertex_position), normalize(vertex_normals));
+ final_colors = vertex_colors * l * 1.2;
+ }
+ """
+
+ def set_state(self):
+ self.program.use()
+ self.program['model'] = self.matrix
+
+
+_add_default_codecs()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/model/codecs/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/model/codecs/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..1ee609b3081bf9cbeb2ab02a9a48bcfd9c7c31ff
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/model/codecs/__init__.py
@@ -0,0 +1,54 @@
+from pyglet.util import CodecRegistry, Decoder, Encoder, DecodeException, EncodeException
+
+
+registry = CodecRegistry()
+add_decoders = registry.add_decoders
+add_encoders = registry.add_encoders
+get_decoders = registry.get_decoders
+get_encoders = registry.get_encoders
+
+
+class ModelDecodeException(DecodeException):
+ pass
+
+
+class ModelEncodeException(EncodeException):
+ pass
+
+
+class ModelDecoder(Decoder):
+ def decode(self, filename, file, batch, group):
+ """Decode the given file object and return an instance of `Model`.
+ Throws ModelDecodeException if there is an error. filename
+ can be a file type hint.
+ """
+ raise NotImplementedError()
+
+
+class ModelEncoder(Encoder):
+
+ def encode(self, model, filename, file):
+ """Encode the given model to the given file. filename
+ provides a hint to the file format desired. options are
+ encoder-specific, and unknown options should be ignored or
+ issue warnings.
+ """
+ raise NotImplementedError()
+
+
+def add_default_codecs():
+ # Add all bundled codecs. These should be listed in order of
+ # preference. This is called automatically by pyglet.model.
+
+ try:
+ from pyglet.model.codecs import obj
+ registry.add_decoders(obj)
+ except ImportError:
+ pass
+
+ # TODO: complete this decoder, and enable it by default
+ # try:
+ # from pyglet.model.codecs import gltf
+ # add_decoders(gltf)
+ # except ImportError:
+ # pass
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/model/codecs/gltf.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/model/codecs/gltf.py
new file mode 100644
index 0000000000000000000000000000000000000000..71e6a79e0d7627965bae9412ef4f940470a8d381
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/model/codecs/gltf.py
@@ -0,0 +1,248 @@
+import json
+import struct
+
+import pyglet
+
+from pyglet.gl import GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_FLOAT
+from pyglet.gl import GL_UNSIGNED_INT, GL_ELEMENT_ARRAY_BUFFER, GL_ARRAY_BUFFER, GL_TRIANGLES
+
+from .. import Model, Material, MaterialGroup
+from . import ModelDecodeException, ModelDecoder
+
+
+# pyglet.graphics types
+_pyglet_types = {
+ GL_BYTE: 'b',
+ GL_UNSIGNED_BYTE: 'B',
+ GL_SHORT: 's',
+ GL_UNSIGNED_SHORT: 'S',
+ GL_UNSIGNED_INT: 'I',
+ GL_FLOAT: 'f',
+}
+
+# struct module types
+_struct_types = {
+ GL_BYTE: 'b',
+ GL_UNSIGNED_BYTE: 'B',
+ GL_SHORT: 'h',
+ GL_UNSIGNED_SHORT: 'H',
+ GL_UNSIGNED_INT: 'I',
+ GL_FLOAT: 'f',
+}
+
+# OpenGL type sizes
+_component_sizes = {
+ GL_BYTE: 1,
+ GL_UNSIGNED_BYTE: 1,
+ GL_SHORT: 2,
+ GL_UNSIGNED_SHORT: 2,
+ GL_UNSIGNED_INT: 4,
+ GL_FLOAT: 4
+}
+
+_accessor_type_sizes = {
+ "SCALAR": 1,
+ "VEC2": 2,
+ "VEC3": 3,
+ "VEC4": 4,
+ "MAT2": 4,
+ "MAT3": 9,
+ "MAT4": 16
+}
+
+_targets = {
+ GL_ELEMENT_ARRAY_BUFFER: "element_array",
+ GL_ARRAY_BUFFER: "array",
+}
+
+# GLTF to pyglet shorthand types:
+_attributes = {
+ 'POSITION': 'v',
+ 'NORMAL': 'n',
+ 'TANGENT': None,
+ 'TEXCOORD_0': '0t',
+ 'TEXCOORD_1': '1t',
+ 'COLOR_0': 'c',
+ 'JOINTS_0': None,
+ 'WEIGHTS_0': None
+}
+
+
+class Buffer:
+ # TODO: support GLB format
+ # TODO: support data uris
+ def __init__(self, length, uri):
+ self._length = length
+ self._uri = uri
+
+ def read(self, offset, length):
+ file = pyglet.resource.file(self._uri, 'rb')
+ file.seek(offset)
+ data = file.read(length)
+ file.close()
+ return data
+
+
+class BufferView:
+ def __init__(self, buffer, offset, length, target, stride):
+ self.buffer = buffer
+ self.offset = offset
+ self.length = length
+ self.target = target
+ self.stride = stride
+
+
+class Accessor:
+ # TODO: support sparse accessors
+ def __init__(self, buffer_view, offset, comp_type, count,
+ maximum, minimum, accessor_type, sparse):
+ self.buffer_view = buffer_view
+ self.offset = offset
+ self.component_type = comp_type
+ self.count = count
+ self.maximum = maximum
+ self.minimum = minimum
+ self.type = accessor_type
+ self.sparse = sparse
+ self.size = _component_sizes[comp_type] * _accessor_type_sizes[accessor_type]
+
+ def read(self):
+ offset = self.offset + self.buffer_view.offset
+ length = self.size * self.count
+ stride = self.buffer_view.stride or 1
+ # TODO: handle stride
+ data = self.buffer_view.buffer.read(offset, length)
+ return data
+
+
+def parse_gltf_file(file, filename, batch):
+
+ if file is None:
+ file = pyglet.resource.file(filename, 'r')
+ elif file.mode != 'r':
+ file.close()
+ file = pyglet.resource.file(filename, 'r')
+
+ try:
+ data = json.load(file)
+ except json.JSONDecodeError:
+ raise ModelDecodeException('Json error. Does not appear to be a valid glTF file.')
+ finally:
+ file.close()
+
+ if 'asset' not in data:
+ raise ModelDecodeException('Not a valid glTF file. Asset property not found.')
+ else:
+ if float(data['asset']['version']) < 2.0:
+ raise ModelDecodeException('Only glTF 2.0+ models are supported')
+
+ buffers = dict()
+ buffer_views = dict()
+ accessors = dict()
+ materials = dict()
+
+ for i, item in enumerate(data.get('buffers', [])):
+ buffers[i] = Buffer(item['byteLength'], item['uri'])
+
+ for i, item in enumerate(data.get('bufferViews', [])):
+ buffer_index = item['buffer']
+ buffer = buffers[buffer_index]
+ offset = item.get('byteOffset', 0)
+ length = item.get('byteLength')
+ target = item.get('target')
+ stride = item.get('byteStride', 1)
+ buffer_views[i] = BufferView(buffer, offset, length, target, stride)
+
+ for i, item in enumerate(data.get('accessors', [])):
+ buf_view_index = item.get('bufferView')
+ buf_view = buffer_views[buf_view_index]
+ offset = item.get('byteOffset', 0)
+ comp_type = item.get('componentType')
+ count = item.get('count')
+ maxi = item.get('max')
+ mini = item.get('min')
+ acc_type = item.get('type')
+ sparse = item.get('sparse', None)
+ accessors[i] = Accessor(buf_view, offset, comp_type, count, maxi, mini, acc_type, sparse)
+
+ vertex_lists = []
+
+ for mesh_data in data.get('meshes'):
+
+ for primitive in mesh_data.get('primitives', []):
+ indices = None
+ attribute_list = []
+ count = 0
+
+ for attribute_type, i in primitive['attributes'].items():
+ accessor = accessors[i]
+ attrib = _attributes[attribute_type]
+ if not attrib:
+ # TODO: Add support for these attribute types to pyglet
+ continue
+ attrib_size = _accessor_type_sizes[accessor.type]
+ pyglet_type = _pyglet_types[accessor.component_type]
+ pyglet_fmt = "{0}{1}{2}".format(attrib, attrib_size, pyglet_type)
+
+ count = accessor.count
+ struct_fmt = str(count * attrib_size) + _struct_types[accessor.component_type]
+ array = struct.unpack('<' + struct_fmt, accessor.read())
+
+ attribute_list.append((pyglet_fmt, array))
+
+ if 'indices' in primitive:
+ indices_index = primitive.get('indices')
+ accessor = accessors[indices_index]
+ attrib_size = _accessor_type_sizes[accessor.type]
+ fmt = str(accessor.count * attrib_size) + _struct_types[accessor.component_type]
+ indices = struct.unpack('<' + fmt, accessor.read())
+
+ # if 'material' in primitive:
+ # material_index = primitive.get('material')
+ # color = materials[material_index]
+ # attribute_list.append(('c4f', color * count))
+
+ diffuse = [1.0, 1.0, 1.0]
+ ambient = [1.0, 1.0, 1.0]
+ specular = [1.0, 1.0, 1.0]
+ emission = [0.0, 0.0, 0.0]
+ shininess = 100.0
+ opacity = 1.0
+ material = Material("Default", diffuse, ambient, specular, emission, shininess, opacity)
+ group = MaterialGroup(material=material)
+
+ if indices:
+ vlist = batch.add_indexed(count, GL_TRIANGLES, group, indices, *attribute_list)
+ else:
+ vlist = batch.add(count, GL_TRIANGLES, group, *attribute_list)
+
+ vertex_lists.append(vlist)
+
+ return vertex_lists
+
+
+###################################################
+# Decoder definitions start here:
+###################################################
+
+class GLTFModelDecoder(ModelDecoder):
+ def get_file_extensions(self):
+ return ['.gltf']
+
+ def decode(self, file, filename, batch):
+
+ if not batch:
+ batch = pyglet.graphics.Batch()
+
+ vertex_lists = parse_gltf_file(file=file, filename=filename, batch=batch)
+ textures = {}
+
+ return Model(vertex_lists, textures, batch=batch)
+
+
+def get_decoders():
+ return [GLTFModelDecoder()]
+
+
+def get_encoders():
+ return []
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/model/codecs/obj.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/model/codecs/obj.py
new file mode 100644
index 0000000000000000000000000000000000000000..6b33bed63de081cb0e4a695de4a03ccbc86891df
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/model/codecs/obj.py
@@ -0,0 +1,238 @@
+import os
+
+import pyglet
+
+from pyglet.gl import GL_TRIANGLES
+from pyglet.util import asstr
+
+from .. import Model, Material, MaterialGroup, TexturedMaterialGroup
+from . import ModelDecodeException, ModelDecoder
+
+
+class Mesh:
+ def __init__(self, name):
+ self.name = name
+ self.material = None
+
+ self.indices = []
+ self.vertices = []
+ self.normals = []
+ self.tex_coords = []
+ self.colors = []
+
+
+def load_material_library(filename):
+ file = open(filename, 'r')
+
+ name = None
+ diffuse = [1.0, 1.0, 1.0]
+ ambient = [1.0, 1.0, 1.0]
+ specular = [1.0, 1.0, 1.0]
+ emission = [0.0, 0.0, 0.0]
+ shininess = 100.0
+ opacity = 1.0
+ texture_name = None
+
+ matlib = {}
+
+ for line in file:
+ if line.startswith('#'):
+ continue
+ values = line.split()
+ if not values:
+ continue
+
+ if values[0] == 'newmtl':
+ if name is not None:
+ # save previous material
+ for item in (diffuse, ambient, specular, emission):
+ item.append(opacity)
+ matlib[name] = Material(name, diffuse, ambient, specular, emission, shininess, texture_name)
+ name = values[1]
+
+ elif name is None:
+ raise ModelDecodeException(f'Expected "newmtl" in {filename}')
+
+ try:
+ if values[0] == 'Kd':
+ diffuse = list(map(float, values[1:]))
+ elif values[0] == 'Ka':
+ ambient = list(map(float, values[1:]))
+ elif values[0] == 'Ks':
+ specular = list(map(float, values[1:]))
+ elif values[0] == 'Ke':
+ emission = list(map(float, values[1:]))
+ elif values[0] == 'Ns':
+ shininess = float(values[1]) # Blender exports 1~1000
+ shininess = (shininess * 128) / 1000 # Normalize to 1~128 for OpenGL
+ elif values[0] == 'd':
+ opacity = float(values[1])
+ elif values[0] == 'map_Kd':
+ texture_name = values[1]
+
+ except BaseException as ex:
+ raise ModelDecodeException('Parsing error in {0}.'.format((filename, ex)))
+
+ file.close()
+
+ for item in (diffuse, ambient, specular, emission):
+ item.append(opacity)
+
+ matlib[name] = Material(name, diffuse, ambient, specular, emission, shininess, texture_name)
+
+ return matlib
+
+
+def parse_obj_file(filename, file=None):
+ materials = {}
+ mesh_list = []
+
+ location = os.path.dirname(filename)
+
+ try:
+ if file is None:
+ with open(filename, 'r') as f:
+ file_contents = f.read()
+ else:
+ file_contents = asstr(file.read())
+ except (UnicodeDecodeError, OSError):
+ raise ModelDecodeException
+
+ material = None
+ mesh = None
+
+ vertices = [[0., 0., 0.]]
+ normals = [[0., 0., 0.]]
+ tex_coords = [[0., 0.]]
+
+ diffuse = [1.0, 1.0, 1.0, 1.0]
+ ambient = [1.0, 1.0, 1.0, 1.0]
+ specular = [1.0, 1.0, 1.0, 1.0]
+ emission = [0.0, 0.0, 0.0, 1.0]
+ shininess = 100.0
+
+ default_material = Material("Default", diffuse, ambient, specular, emission, shininess)
+
+ for line in file_contents.splitlines():
+
+ if line.startswith('#'):
+ continue
+ values = line.split()
+ if not values:
+ continue
+
+ if values[0] == 'v':
+ vertices.append(list(map(float, values[1:4])))
+ elif values[0] == 'vn':
+ normals.append(list(map(float, values[1:4])))
+ elif values[0] == 'vt':
+ tex_coords.append(list(map(float, values[1:3])))
+
+ elif values[0] == 'mtllib':
+ material_abspath = os.path.join(location, values[1])
+ materials = load_material_library(filename=material_abspath)
+
+ elif values[0] in ('usemtl', 'usemat'):
+ material = materials.get(values[1])
+ if mesh is not None:
+ mesh.material = material
+
+ elif values[0] == 'o':
+ mesh = Mesh(name=values[1])
+ mesh_list.append(mesh)
+
+ elif values[0] == 'f':
+ if mesh is None:
+ mesh = Mesh(name='')
+ mesh_list.append(mesh)
+ if material is None:
+ material = default_material
+ if mesh.material is None:
+ mesh.material = material
+
+ # For fan triangulation, remember first and latest vertices
+ n1 = None
+ nlast = None
+ t1 = None
+ tlast = None
+ v1 = None
+ vlast = None
+
+ for i, v in enumerate(values[1:]):
+ v_i, t_i, n_i = (list(map(int, [j or 0 for j in v.split('/')])) + [0, 0])[:3]
+ if v_i < 0:
+ v_i += len(vertices) - 1
+ if t_i < 0:
+ t_i += len(tex_coords) - 1
+ if n_i < 0:
+ n_i += len(normals) - 1
+
+ mesh.normals += normals[n_i]
+ mesh.tex_coords += tex_coords[t_i]
+ mesh.vertices += vertices[v_i]
+
+ if i >= 3:
+ # Triangulate
+ mesh.normals += n1 + nlast
+ mesh.tex_coords += t1 + tlast
+ mesh.vertices += v1 + vlast
+
+ if i == 0:
+ n1 = normals[n_i]
+ t1 = tex_coords[t_i]
+ v1 = vertices[v_i]
+ nlast = normals[n_i]
+ tlast = tex_coords[t_i]
+ vlast = vertices[v_i]
+
+ return mesh_list
+
+
+###################################################
+# Decoder definitions start here:
+###################################################
+
+class OBJModelDecoder(ModelDecoder):
+ def get_file_extensions(self):
+ return ['.obj']
+
+ def decode(self, filename, file, batch, group=None):
+
+ if not batch:
+ batch = pyglet.graphics.Batch()
+
+ mesh_list = parse_obj_file(filename=filename, file=file)
+
+ vertex_lists = []
+ groups = []
+
+ for mesh in mesh_list:
+ material = mesh.material
+ count = len(mesh.vertices) // 3
+ if material.texture_name:
+ program = pyglet.model.get_default_textured_shader()
+ texture = pyglet.resource.texture(material.texture_name)
+ matgroup = TexturedMaterialGroup(material, program, texture, parent=group)
+ vertex_lists.append(program.vertex_list(count, GL_TRIANGLES, batch, matgroup,
+ vertices=('f', mesh.vertices),
+ normals=('f', mesh.normals),
+ tex_coords=('f', mesh.tex_coords),
+ colors=('f', material.diffuse * count)))
+ else:
+ program = pyglet.model.get_default_shader()
+ matgroup = MaterialGroup(material, program, parent=group)
+ vertex_lists.append(program.vertex_list(count, GL_TRIANGLES, batch, matgroup,
+ vertices=('f', mesh.vertices),
+ normals=('f', mesh.normals),
+ colors=('f', material.diffuse * count)))
+ groups.append(matgroup)
+
+ return Model(vertex_lists=vertex_lists, groups=groups, batch=batch)
+
+
+def get_decoders():
+ return [OBJModelDecoder()]
+
+
+def get_encoders():
+ return []
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/resource.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/resource.py
new file mode 100644
index 0000000000000000000000000000000000000000..a28d4597f8e8b02726b59bb1fd2f8b940b1d1edc
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/resource.py
@@ -0,0 +1,865 @@
+"""Load application resources from a known path.
+
+Loading resources by specifying relative paths to filenames is often
+problematic in Python, as the working directory is not necessarily the same
+directory as the application's script files.
+
+This module allows applications to specify a search path for resources.
+Relative paths are taken to be relative to the application's ``__main__``
+module. ZIP files can appear on the path; they will be searched inside. The
+resource module also behaves as expected when applications are bundled using
+Freezers such as PyInstaller, py2exe, py2app, etc..
+
+In addition to providing file references (with the :py:func:`file` function),
+the resource module also contains convenience functions for loading images,
+textures, fonts, media and documents.
+
+3rd party modules or packages not bound to a specific application should
+construct their own :py:class:`Loader` instance and override the path to use the
+resources in the module's directory.
+
+Path format
+^^^^^^^^^^^
+
+The resource path :py:attr:`path` (see also :py:meth:`Loader.__init__` and
+:py:meth:`Loader.path`)
+is a list of locations to search for resources. Locations are searched in the
+order given in the path. If a location is not valid (for example, if the
+directory does not exist), it is skipped.
+
+Locations in the path beginning with an "at" symbol (''@'') specify
+Python packages. Other locations specify a ZIP archive or directory on the
+filesystem. Locations that are not absolute are assumed to be relative to the
+script home. Some examples::
+
+ # Search just the `res` directory, assumed to be located alongside the
+ # main script file.
+ path = ['res']
+
+ # Search the directory containing the module `levels.level1`, followed
+ # by the `res/images` directory.
+ path = ['@levels.level1', 'res/images']
+
+Paths are always **case-sensitive** and **forward slashes are always used**
+as path separators, even in cases when the filesystem or platform does not do this.
+This avoids a common programmer error when porting applications between platforms.
+
+The default path is ``['.']``. If you modify the path, you must call
+:py:func:`reindex`.
+
+.. versionadded:: 1.1
+"""
+
+import os
+import sys
+import zipfile
+import weakref
+
+from io import BytesIO
+
+import pyglet
+
+
+class ResourceNotFoundException(Exception):
+ """The named resource was not found on the search path."""
+
+ def __init__(self, name):
+ message = ("Resource '{}' was not found on the path. "
+ "Ensure that the filename has the correct capitalisation.".format(name))
+ Exception.__init__(self, message)
+
+
+class UndetectableShaderType(Exception):
+ """The type of the Shader source could not be identified."""
+
+ def __init__(self, name):
+ message = ("The Shader type of '{}' could not be determined. "
+ "Ensure that your source file has a standard extension, "
+ "or provide a valid 'shader_type' parameter.".format(name))
+ Exception.__init__(self, message)
+
+
+def get_script_home():
+ """Get the directory containing the program entry module.
+
+ For ordinary Python scripts, this is the directory containing the
+ ``__main__`` module. For executables created with py2exe the result is
+ the directory containing the running executable file. For OS X bundles
+ created using Py2App the result is the Resources directory within the
+ running bundle.
+
+ If none of the above cases apply and the file for ``__main__`` cannot
+ be determined the working directory is returned.
+
+ When the script is being run by a Python profiler, this function
+ may return the directory where the profiler is running instead of
+ the directory of the real script. To workaround this behaviour the
+ full path to the real script can be specified in :py:attr:`pyglet.resource.path`.
+
+ :rtype: str
+ """
+ frozen = getattr(sys, 'frozen', None)
+ meipass = getattr(sys, '_MEIPASS', None)
+ if meipass:
+ # PyInstaller
+ return meipass
+ elif frozen in ('windows_exe', 'console_exe'):
+ return os.path.dirname(sys.executable)
+ elif frozen == 'macosx_app':
+ # py2app
+ return os.environ['RESOURCEPATH']
+ else:
+ main = sys.modules['__main__']
+ if hasattr(main, '__file__'):
+ return os.path.dirname(os.path.abspath(main.__file__))
+ else:
+ if 'python' in os.path.basename(sys.executable):
+ # interactive
+ return os.getcwd()
+ else:
+ # cx_Freeze
+ return os.path.dirname(sys.executable)
+
+
+def get_settings_path(name):
+ """Get a directory to save user preferences.
+
+ Different platforms have different conventions for where to save user
+ preferences, saved games, and settings. This function implements those
+ conventions. Note that the returned path may not exist: applications
+ should use ``os.makedirs`` to construct it if desired.
+
+ On Linux, a directory `name` in the user's configuration directory is
+ returned (usually under ``~/.config``).
+
+ On Windows (including under Cygwin) the `name` directory in the user's
+ ``Application Settings`` directory is returned.
+
+ On Mac OS X the `name` directory under ``~/Library/Application Support``
+ is returned.
+
+ :Parameters:
+ `name` : str
+ The name of the application.
+
+ :rtype: str
+ """
+
+ if pyglet.compat_platform in ('cygwin', 'win32'):
+ if 'APPDATA' in os.environ:
+ return os.path.join(os.environ['APPDATA'], name)
+ else:
+ return os.path.expanduser(f'~/{name}')
+ elif pyglet.compat_platform == 'darwin':
+ return os.path.expanduser(f'~/Library/Application Support/{name}')
+ elif pyglet.compat_platform.startswith('linux'):
+ if 'XDG_CONFIG_HOME' in os.environ:
+ return os.path.join(os.environ['XDG_CONFIG_HOME'], name)
+ else:
+ return os.path.expanduser(f'~/.config/{name}')
+ else:
+ return os.path.expanduser(f'~/.{name}')
+
+
+def get_data_path(name):
+ """Get a directory to save user data.
+
+ For a Posix or Linux based system many distributions have a separate
+ directory to store user data for a specific application and this
+ function returns the path to that location. Note that the returned
+ path may not exist: applications should use ``os.makedirs`` to
+ construct it if desired.
+
+ On Linux, a directory `name` in the user's data directory is returned
+ (usually under ``~/.local/share``).
+
+ On Windows (including under Cygwin) the `name` directory in the user's
+ ``Application Settings`` directory is returned.
+
+ On Mac OS X the `name` directory under ``~/Library/Application Support``
+ is returned.
+
+ :Parameters:
+ `name` : str
+ The name of the application.
+
+ :rtype: str
+ """
+
+ if pyglet.compat_platform in ('cygwin', 'win32'):
+ if 'APPDATA' in os.environ:
+ return os.path.join(os.environ['APPDATA'], name)
+ else:
+ return os.path.expanduser(f'~/{name}')
+ elif pyglet.compat_platform == 'darwin':
+ return os.path.expanduser(f'~/Library/Application Support/{name}')
+ elif pyglet.compat_platform.startswith('linux'):
+ if 'XDG_DATA_HOME' in os.environ:
+ return os.path.join(os.environ['XDG_DATA_HOME'], name)
+ else:
+ return os.path.expanduser(f'~/.local/share/{name}')
+ else:
+ return os.path.expanduser(f'~/.{name}')
+
+
+class Location:
+ """Abstract resource location.
+
+ Given a location, a file can be loaded from that location with the `open`
+ method. This provides a convenient way to specify a path to load files
+ from, and not necessarily have that path reside on the filesystem.
+ """
+
+ def open(self, filename, mode='rb'):
+ """Open a file at this location.
+
+ :Parameters:
+ `filename` : str
+ The filename to open. Absolute paths are not supported.
+ Relative paths are not supported by most locations (you
+ should specify only a filename with no path component).
+ `mode` : str
+ The file mode to open with. Only files opened on the
+ filesystem make use of this parameter; others ignore it.
+
+ :rtype: file object
+ """
+ raise NotImplementedError('abstract')
+
+
+class FileLocation(Location):
+ """Location on the filesystem.
+ """
+
+ def __init__(self, filepath):
+ """Create a location given a relative or absolute path.
+
+ :Parameters:
+ `filepath` : str
+ Path on the filesystem.
+ """
+ self.path = filepath
+
+ def open(self, filename, mode='rb'):
+ return open(os.path.join(self.path, filename), mode)
+
+
+class ZIPLocation(Location):
+ """Location within a ZIP file.
+ """
+
+ def __init__(self, zip, dir):
+ """Create a location given an open ZIP file and a path within that
+ file.
+
+ :Parameters:
+ `zip` : ``zipfile.ZipFile``
+ An open ZIP file from the ``zipfile`` module.
+ `dir` : str
+ A path within that ZIP file. Can be empty to specify files at
+ the top level of the ZIP file.
+
+ """
+ self.zip = zip
+ self.dir = dir
+
+ def open(self, filename, mode='rb'):
+ if self.dir:
+ path = self.dir + '/' + filename
+ else:
+ path = filename
+
+ forward_slash_path = path.replace(os.sep, '/') # zip can only handle forward slashes
+ text = self.zip.read(forward_slash_path)
+ return BytesIO(text)
+
+
+class URLLocation(Location):
+ """Location on the network.
+
+ This class uses the ``urlparse`` and ``urllib2`` modules to open files on
+ the network given a URL.
+ """
+
+ def __init__(self, base_url):
+ """Create a location given a base URL.
+
+ :Parameters:
+ `base_url` : str
+ URL string to prepend to filenames.
+
+ """
+ self.base = base_url
+
+ def open(self, filename, mode='rb'):
+ import urllib.parse
+ import urllib.request
+ url = urllib.parse.urljoin(self.base, filename)
+ return urllib.request.urlopen(url)
+
+
+class Loader:
+ """Load program resource files from disk.
+
+ The loader contains a search path which can include filesystem
+ directories, ZIP archives and Python packages.
+
+ :Ivariables:
+ `path` : list of str
+ List of search locations. After modifying the path you must
+ call the `reindex` method.
+ `script_home` : str
+ Base resource location, defaulting to the location of the
+ application script.
+
+ """
+ def __init__(self, path=None, script_home=None):
+ """Create a loader for the given path.
+
+ If no path is specified it defaults to ``['.']``; that is, just the
+ program directory.
+
+ See the module documentation for details on the path format.
+
+ :Parameters:
+ `path` : list of str
+ List of locations to search for resources.
+ `script_home` : str
+ Base location of relative files. Defaults to the result of
+ `get_script_home`.
+
+ """
+ if path is None:
+ path = ['.']
+ if isinstance(path, str):
+ path = [path]
+ self.path = list(path)
+ self._script_home = script_home or get_script_home()
+ self._index = None
+
+ # Map bin size to list of atlases
+ self._texture_atlas_bins = {}
+
+ # map name to image etc.
+ self._cached_textures = weakref.WeakValueDictionary()
+ self._cached_images = weakref.WeakValueDictionary()
+ self._cached_animations = weakref.WeakValueDictionary()
+
+ def _require_index(self):
+ if self._index is None:
+ self.reindex()
+
+ def reindex(self):
+ """Refresh the file index.
+
+ You must call this method if `path` is changed or the filesystem
+ layout changes.
+ """
+ self._index = {}
+ for path in self.path:
+ if path.startswith('@'):
+ # Module
+ name = path[1:]
+
+ try:
+ module = __import__(name)
+ except:
+ continue
+
+ for component in name.split('.')[1:]:
+ module = getattr(module, component)
+
+ if hasattr(module, '__file__'):
+ path = os.path.dirname(module.__file__)
+ else:
+ path = '' # interactive
+ elif not os.path.isabs(path):
+ # Add script base unless absolute
+ assert r'\\' not in path, "Backslashes are not permitted in relative paths"
+ path = os.path.join(self._script_home, path)
+
+ if os.path.isdir(path):
+ # Filesystem directory
+ path = path.rstrip(os.path.sep)
+ location = FileLocation(path)
+ for dirpath, dirnames, filenames in os.walk(path):
+ dirpath = dirpath[len(path) + 1:]
+ # Force forward slashes for index
+ if dirpath:
+ parts = [part
+ for part
+ in dirpath.split(os.sep)
+ if part is not None]
+ dirpath = '/'.join(parts)
+ for filename in filenames:
+ if dirpath:
+ index_name = dirpath + '/' + filename
+ else:
+ index_name = filename
+ self._index_file(index_name, location)
+ else:
+ # Find path component that looks like the ZIP file.
+ dir = ''
+ old_path = None
+ while path and not (os.path.isfile(path) or os.path.isfile(path + '.001')):
+ old_path = path
+ path, tail_dir = os.path.split(path)
+ if path == old_path:
+ break
+ dir = '/'.join((tail_dir, dir))
+ if path == old_path:
+ continue
+ dir = dir.rstrip('/')
+
+ # path looks like a ZIP file, dir resides within ZIP
+ if not path:
+ continue
+
+ zip_stream = self._get_stream(path)
+ if zip_stream:
+ zip = zipfile.ZipFile(zip_stream, 'r')
+ location = ZIPLocation(zip, dir)
+ for zip_name in zip.namelist():
+ # zip_name_dir, zip_name = os.path.split(zip_name)
+ # assert '\\' not in name_dir
+ # assert not name_dir.endswith('/')
+ if zip_name.startswith(dir):
+ if dir:
+ zip_name = zip_name[len(dir) + 1:]
+ self._index_file(zip_name, location)
+
+ def _get_stream(self, path):
+ if zipfile.is_zipfile(path):
+ return path
+ elif not os.path.exists(path + '.001'):
+ return None
+ else:
+ with open(path + '.001', 'rb') as volume:
+ bytes_ = bytes(volume.read())
+
+ volume_index = 2
+ while os.path.exists(path + '.{0:0>3}'.format(volume_index)):
+ with open(path + '.{0:0>3}'.format(volume_index), 'rb') as volume:
+ bytes_ += bytes(volume.read())
+
+ volume_index += 1
+
+ zip_stream = BytesIO(bytes_)
+ if zipfile.is_zipfile(zip_stream):
+ return zip_stream
+ else:
+ return None
+
+ def _index_file(self, name, location):
+ if name not in self._index:
+ self._index[name] = location
+
+ def file(self, name, mode='rb'):
+ """Load a resource.
+
+ :Parameters:
+ `name` : str
+ Filename of the resource to load.
+ `mode` : str
+ Combination of ``r``, ``w``, ``a``, ``b`` and ``t`` characters
+ with the meaning as for the builtin ``open`` function.
+
+ :rtype: file object
+ """
+ self._require_index()
+ try:
+ location = self._index[name]
+ return location.open(name, mode)
+ except KeyError:
+ raise ResourceNotFoundException(name)
+
+ def location(self, name):
+ """Get the location of a resource.
+
+ This method is useful for opening files referenced from a resource.
+ For example, an HTML file loaded as a resource might reference some
+ images. These images should be located relative to the HTML file, not
+ looked up individually in the loader's path.
+
+ :Parameters:
+ `name` : str
+ Filename of the resource to locate.
+
+ :rtype: `Location`
+ """
+ self._require_index()
+ try:
+ return self._index[name]
+ except KeyError:
+ raise ResourceNotFoundException(name)
+
+ def add_font(self, name):
+ """Add a font resource to the application.
+
+ Fonts not installed on the system must be added to pyglet before they
+ can be used with `font.load`. Although the font is added with
+ its filename using this function, it is loaded by specifying its
+ family name. For example::
+
+ resource.add_font('action_man.ttf')
+ action_man = font.load('Action Man')
+
+ :Parameters:
+ `name` : str
+ Filename of the font resource to add.
+
+ """
+ self._require_index()
+ from pyglet import font
+ file = self.file(name)
+ font.add_file(file)
+
+ def _alloc_image(self, name, atlas, border):
+ file = self.file(name)
+ try:
+ img = pyglet.image.load(name, file=file)
+ finally:
+ file.close()
+
+ if not atlas:
+ return img.get_texture()
+
+ # find an atlas suitable for the image
+ bin = self._get_texture_atlas_bin(img.width, img.height, border)
+ if bin is None:
+ return img.get_texture()
+
+ return bin.add(img, border)
+
+ def _get_texture_atlas_bin(self, width, height, border):
+ """A heuristic for determining the atlas bin to use for a given image
+ size. Returns None if the image should not be placed in an atlas (too
+ big), otherwise the bin (a list of TextureAtlas).
+ """
+ # Large images are not placed in an atlas
+ max_texture_size = pyglet.image.get_max_texture_size()
+ max_size = min(2048, max_texture_size) - border
+ if width > max_size or height > max_size:
+ return None
+
+ # Group images with small height separately to larger height
+ # (as the allocator can't stack within a single row).
+ bin_size = 1
+ if height > max_size / 4:
+ bin_size = 2
+
+ try:
+ texture_bin = self._texture_atlas_bins[bin_size]
+ except KeyError:
+ texture_bin = pyglet.image.atlas.TextureBin()
+ self._texture_atlas_bins[bin_size] = texture_bin
+
+ return texture_bin
+
+ def image(self, name, flip_x=False, flip_y=False, rotate=0, atlas=True, border=1):
+ """Load an image with optional transformation.
+
+ This is similar to `texture`, except the resulting image will be
+ packed into a :py:class:`~pyglet.image.atlas.TextureBin` if it is an appropriate size for packing.
+ This is more efficient than loading images into separate textures.
+
+ :Parameters:
+ `name` : str
+ Filename of the image source to load.
+ `flip_x` : bool
+ If True, the returned image will be flipped horizontally.
+ `flip_y` : bool
+ If True, the returned image will be flipped vertically.
+ `rotate` : int
+ The returned image will be rotated clockwise by the given
+ number of degrees (a multiple of 90).
+ `atlas` : bool
+ If True, the image will be loaded into an atlas managed by
+ pyglet. If atlas loading is not appropriate for specific
+ texturing reasons (e.g. border control is required) then set
+ this argument to False.
+ `border` : int
+ Leaves specified pixels of blank space around each image in
+ an atlas, which may help reduce texture bleeding.
+
+ :rtype: `Texture`
+ :return: A complete texture if the image is large or not in an atlas,
+ otherwise a :py:class:`~pyglet.image.TextureRegion` of a texture atlas.
+ """
+ self._require_index()
+ if name in self._cached_images:
+ identity = self._cached_images[name]
+ else:
+ identity = self._cached_images[name] = self._alloc_image(name, atlas, border)
+
+ if not rotate and not flip_x and not flip_y:
+ return identity
+
+ return identity.get_transform(flip_x, flip_y, rotate)
+
+ def animation(self, name, flip_x=False, flip_y=False, rotate=0, border=1):
+ """Load an animation with optional transformation.
+
+ Animations loaded from the same source but with different
+ transformations will use the same textures.
+
+ :Parameters:
+ `name` : str
+ Filename of the animation source to load.
+ `flip_x` : bool
+ If True, the returned image will be flipped horizontally.
+ `flip_y` : bool
+ If True, the returned image will be flipped vertically.
+ `rotate` : int
+ The returned image will be rotated clockwise by the given
+ number of degrees (a multiple of 90).
+ `border` : int
+ Leaves specified pixels of blank space around each image in
+ an atlas, which may help reduce texture bleeding.
+
+ :rtype: :py:class:`~pyglet.image.Animation`
+ """
+ self._require_index()
+ try:
+ identity = self._cached_animations[name]
+ except KeyError:
+ animation = pyglet.image.load_animation(name, self.file(name))
+ bin = self._get_texture_atlas_bin(animation.get_max_width(),
+ animation.get_max_height(),
+ border)
+ if bin:
+ animation.add_to_texture_bin(bin, border)
+
+ identity = self._cached_animations[name] = animation
+
+ if not rotate and not flip_x and not flip_y:
+ return identity
+
+ return identity.get_transform(flip_x, flip_y, rotate)
+
+ def get_cached_image_names(self):
+ """Get a list of image filenames that have been cached.
+
+ This is useful for debugging and profiling only.
+
+ :rtype: list
+ :return: List of str
+ """
+ self._require_index()
+ return list(self._cached_images.keys())
+
+ def get_cached_animation_names(self):
+ """Get a list of animation filenames that have been cached.
+
+ This is useful for debugging and profiling only.
+
+ :rtype: list
+ :return: List of str
+ """
+ self._require_index()
+ return list(self._cached_animations.keys())
+
+ def get_texture_bins(self):
+ """Get a list of texture bins in use.
+
+ This is useful for debugging and profiling only.
+
+ :rtype: list
+ :return: List of :py:class:`~pyglet.image.atlas.TextureBin`
+ """
+ self._require_index()
+ return list(self._texture_atlas_bins.values())
+
+ def media(self, name, streaming=True):
+ """Load a sound or video resource.
+
+ The meaning of `streaming` is as for `media.load`. Compressed
+ sources cannot be streamed (that is, video and compressed audio
+ cannot be streamed from a ZIP archive).
+
+ :Parameters:
+ `name` : str
+ Filename of the media source to load.
+ `streaming` : bool
+ True if the source should be streamed from disk, False if
+ it should be entirely decoded into memory immediately.
+
+ :rtype: `media.Source`
+ """
+ self._require_index()
+ from pyglet import media
+ try:
+ location = self._index[name]
+ if isinstance(location, FileLocation):
+ # Don't open the file if it's streamed from disk
+ path = os.path.join(location.path, name)
+ return media.load(path, streaming=streaming)
+ else:
+ file = location.open(name)
+
+ return media.load(name, file=file, streaming=streaming)
+ except KeyError:
+ raise ResourceNotFoundException(name)
+
+ def texture(self, name):
+ """Load a texture.
+
+ The named image will be loaded as a single OpenGL texture. If the
+ dimensions of the image are not powers of 2 a :py:class:`~pyglet.image.TextureRegion` will
+ be returned.
+
+ :Parameters:
+ `name` : str
+ Filename of the image resource to load.
+
+ :rtype: `Texture`
+ """
+ self._require_index()
+ if name in self._cached_textures:
+ return self._cached_textures[name]
+
+ file = self.file(name)
+ texture = pyglet.image.load(name, file=file).get_texture()
+ self._cached_textures[name] = texture
+ return texture
+
+ def model(self, name, batch=None):
+ """Load a 3D model.
+
+ :Parameters:
+ `name` : str
+ Filename of the 3D model to load.
+ `batch` : Batch or None
+ An optional Batch instance to add this model to.
+
+ :rtype: `Model`
+ """
+ self._require_index()
+ abspathname = os.path.join(os.path.abspath(self.location(name).path), name)
+ return pyglet.model.load(filename=abspathname, file=self.file(name), batch=batch)
+
+ def html(self, name):
+ """Load an HTML document.
+
+ :Parameters:
+ `name` : str
+ Filename of the HTML resource to load.
+
+ :rtype: `FormattedDocument`
+ """
+ self._require_index()
+ file = self.file(name)
+ return pyglet.text.load(name, file, 'text/html')
+
+ def attributed(self, name):
+ """Load an attributed text document.
+
+ See `pyglet.text.formats.attributed` for details on this format.
+
+ :Parameters:
+ `name` : str
+ Filename of the attribute text resource to load.
+
+ :rtype: `FormattedDocument`
+ """
+ self._require_index()
+ file = self.file(name)
+ return pyglet.text.load(name, file, 'text/vnd.pyglet-attributed')
+
+ def text(self, name):
+ """Load a plain text document.
+
+ :Parameters:
+ `name` : str
+ Filename of the plain text resource to load.
+
+ :rtype: `UnformattedDocument`
+ """
+ self._require_index()
+ fileobj = self.file(name)
+ return pyglet.text.load(name, fileobj, 'text/plain')
+
+ def shader(self, name, shader_type=None):
+ """Load a Shader object.
+
+ :Parameters:
+ `name` : str
+ Filename of the Shader source to load.
+ `shader_type` : str
+ A hint for the type of shader, such as 'vertex', 'fragment', etc.
+ Not required if your shader has a standard file extension.
+
+ :rtype: A compiled `Shader` object.
+ """
+ # https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/
+ shader_extensions = {'comp': "compute",
+ 'frag': "fragment",
+ 'geom': "geometry",
+ 'tesc': "tescontrol",
+ 'tese': "tesevaluation",
+ 'vert': "vertex"}
+ fileobj = self.file(name, 'r')
+ source_string = fileobj.read()
+
+ if not shader_type:
+ try:
+ _, extension = os.path.splitext(name)
+ shader_type = shader_extensions.get(extension.strip("."))
+ except KeyError:
+ raise UndetectableShaderType(name=name)
+
+ if shader_type not in shader_extensions.values():
+ raise UndetectableShaderType(name=name)
+
+ return pyglet.graphics.shader.Shader(source_string, shader_type)
+
+ def get_cached_texture_names(self):
+ """Get the names of textures currently cached.
+
+ :rtype: list of str
+ """
+ self._require_index()
+ return list(self._cached_textures.keys())
+
+
+#: Default resource search path.
+#:
+#: Locations in the search path are searched in order and are always
+#: case-sensitive. After changing the path you must call `reindex`.
+#:
+#: See the module documentation for details on the path format.
+#:
+#: :type: list of str
+path = []
+
+
+class _DefaultLoader(Loader):
+
+ @property
+ def path(self):
+ return path
+
+ @path.setter
+ def path(self, value):
+ global path
+ path = value
+
+
+_default_loader = _DefaultLoader()
+reindex = _default_loader.reindex
+file = _default_loader.file
+location = _default_loader.location
+add_font = _default_loader.add_font
+image = _default_loader.image
+animation = _default_loader.animation
+model = _default_loader.model
+media = _default_loader.media
+texture = _default_loader.texture
+html = _default_loader.html
+attributed = _default_loader.attributed
+text = _default_loader.text
+shader = _default_loader.shader
+get_cached_texture_names = _default_loader.get_cached_texture_names
+get_cached_image_names = _default_loader.get_cached_image_names
+get_cached_animation_names = _default_loader.get_cached_animation_names
+get_texture_bins = _default_loader.get_texture_bins
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/shapes.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/shapes.py
new file mode 100644
index 0000000000000000000000000000000000000000..a37ce016eccdee7b29f6c5c0f2da41ade21fb2c0
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/shapes.py
@@ -0,0 +1,1742 @@
+"""2D shapes.
+
+This module provides classes for a variety of simplistic 2D shapes,
+such as Rectangles, Circles, and Lines. These shapes are made
+internally from OpenGL primitives, and provide excellent performance
+when drawn as part of a :py:class:`~pyglet.graphics.Batch`.
+Convenience methods are provided for positioning, changing color
+and opacity, and rotation (where applicable). To create more
+complex shapes than what is provided here, the lower level
+graphics API is more appropriate.
+See the :ref:`guide_graphics` for more details.
+
+A simple example of drawing shapes::
+
+ import pyglet
+ from pyglet import shapes
+
+ window = pyglet.window.Window(960, 540)
+ batch = pyglet.graphics.Batch()
+
+ circle = shapes.Circle(700, 150, 100, color=(50, 225, 30), batch=batch)
+ square = shapes.Rectangle(200, 200, 200, 200, color=(55, 55, 255), batch=batch)
+ rectangle = shapes.Rectangle(250, 300, 400, 200, color=(255, 22, 20), batch=batch)
+ rectangle.opacity = 128
+ rectangle.rotation = 33
+ line = shapes.Line(100, 100, 100, 200, width=19, batch=batch)
+ line2 = shapes.Line(150, 150, 444, 111, width=4, color=(200, 20, 20), batch=batch)
+ star = shapes.Star(800, 400, 60, 40, num_spikes=20, color=(255, 255, 0), batch=batch)
+
+ @window.event
+ def on_draw():
+ window.clear()
+ batch.draw()
+
+ pyglet.app.run()
+
+
+.. note:: Some Shapes, such as Lines and Triangles, have multiple coordinates.
+ If you update the x, y coordinate, this will also affect the secondary
+ coordinates. This allows you to move the shape without affecting it's
+ overall dimensions.
+
+.. versionadded:: 1.5.4
+"""
+
+import math
+
+from abc import ABC, abstractmethod
+
+import pyglet
+
+from pyglet.gl import GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
+from pyglet.gl import GL_TRIANGLES, GL_LINES, GL_BLEND
+from pyglet.gl import glBlendFunc, glEnable, glDisable
+from pyglet.graphics import Batch, Group
+
+
+vertex_source = """#version 150 core
+ in vec2 vertices;
+ in vec2 translation;
+ in vec4 colors;
+ in float rotation;
+
+
+ out vec4 vertex_colors;
+
+ uniform WindowBlock
+ {
+ mat4 projection;
+ mat4 view;
+ } window;
+
+ mat4 m_rotation = mat4(1.0);
+ mat4 m_translate = mat4(1.0);
+
+ void main()
+ {
+ m_translate[3][0] = translation.x;
+ m_translate[3][1] = translation.y;
+ m_rotation[0][0] = cos(-radians(rotation));
+ m_rotation[0][1] = sin(-radians(rotation));
+ m_rotation[1][0] = -sin(-radians(rotation));
+ m_rotation[1][1] = cos(-radians(rotation));
+
+ gl_Position = window.projection * window.view * m_translate * m_rotation * vec4(vertices, 0.0, 1.0);
+ vertex_colors = colors;
+ }
+"""
+
+fragment_source = """#version 150 core
+ in vec4 vertex_colors;
+ out vec4 final_color;
+
+ void main()
+ {
+ final_color = vertex_colors;
+ }
+"""
+
+
+def get_default_shader():
+ try:
+ return pyglet.gl.current_context.pyglet_shapes_default_shader
+ except AttributeError:
+ _default_vert_shader = pyglet.graphics.shader.Shader(vertex_source, 'vertex')
+ _default_frag_shader = pyglet.graphics.shader.Shader(fragment_source, 'fragment')
+ default_shader_program = pyglet.graphics.shader.ShaderProgram(_default_vert_shader, _default_frag_shader)
+ pyglet.gl.current_context.pyglet_shapes_default_shader = default_shader_program
+ return default_shader_program
+
+
+class _ShapeGroup(Group):
+ """Shared Shape rendering Group.
+
+ The group is automatically coalesced with other shape groups
+ sharing the same parent group and blend parameters.
+ """
+
+ def __init__(self, blend_src, blend_dest, program, parent=None):
+ """Create a Shape group.
+
+ The group is created internally. Usually you do not
+ need to explicitly create it.
+
+ :Parameters:
+ `blend_src` : int
+ OpenGL blend source mode; for example,
+ ``GL_SRC_ALPHA``.
+ `blend_dest` : int
+ OpenGL blend destination mode; for example,
+ ``GL_ONE_MINUS_SRC_ALPHA``.
+ `program` : `~pyglet.graphics.shader.ShaderProgram`
+ The ShaderProgram to use.
+ `parent` : `~pyglet.graphics.Group`
+ Optional parent group.
+ """
+ super().__init__(parent=parent)
+ self.program = program
+ self.blend_src = blend_src
+ self.blend_dest = blend_dest
+
+ def set_state(self):
+ self.program.bind()
+ glEnable(GL_BLEND)
+ glBlendFunc(self.blend_src, self.blend_dest)
+
+ def unset_state(self):
+ glDisable(GL_BLEND)
+ self.program.unbind()
+
+ def __eq__(self, other):
+ return (other.__class__ is self.__class__ and
+ self.program == other.program and
+ self.parent == other.parent and
+ self.blend_src == other.blend_src and
+ self.blend_dest == other.blend_dest)
+
+ def __hash__(self):
+ return hash((self.program, self.parent, self.blend_src, self.blend_dest))
+
+
+class ShapeBase(ABC):
+ """Base class for all shape objects.
+
+ A number of default shapes are provided in this module. Curves are
+ approximated using multiple vertices.
+
+ If you need shapes or functionality not provided in this module,
+ you can write your own custom subclass of `ShapeBase` by using
+ the provided shapes as reference.
+ """
+
+ _rgba = (255, 255, 255, 255)
+ _visible = True
+ _x = 0
+ _y = 0
+ _anchor_x = 0
+ _anchor_y = 0
+ _batch = None
+ _group = None
+ _num_verts = 0
+ _vertex_list = None
+ _draw_mode = GL_TRIANGLES
+
+ def __del__(self):
+ if self._vertex_list is not None:
+ self._vertex_list.delete()
+
+ def _update_color(self):
+ """Send the new colors for each vertex to the GPU.
+
+ This method must set the contents of `self._vertex_list.colors`
+ using a list or tuple that contains the RGBA color components
+ for each vertex in the shape. This is usually done by repeating
+ `self._rgba` for each vertex.
+ """
+ self._vertex_list.colors[:] = self._rgba * self._num_verts
+
+ def _update_translation(self):
+ self._vertex_list.translation[:] = (self._x, self._y) * self._num_verts
+
+ def _create_vertex_list(self):
+ """Build internal vertex list.
+
+ This method must create a vertex list and assign it to
+ `self._vertex_list`. It is advisable to use it
+ during `__init__` and to then update the vertices accordingly
+ with `self._update_vertices`.
+
+ While it is not mandatory to implement it, some properties (
+ namely `batch` and `group`) rely on this method to properly
+ recreate the vertex list.
+ """
+ raise NotImplementedError('_create_vertex_list must be defined in '
+ 'order to use group or batch properties')
+
+ @abstractmethod
+ def _update_vertices(self):
+ """
+ Generate up-to-date vertex positions & send them to the GPU.
+
+ This method must set the contents of `self._vertex_list.vertices`
+ using a list or tuple that contains the new vertex coordinates for
+ each vertex in the shape. See the `ShapeBase` subclasses in this
+ module for examples of how to do this.
+ """
+ raise NotImplementedError("_update_vertices must be defined"
+ "for every ShapeBase subclass")
+
+ def draw(self):
+ """Draw the shape at its current position.
+
+ Using this method is not recommended. Instead, add the
+ shape to a `pyglet.graphics.Batch` for efficient rendering.
+ """
+ self._group.set_state_recursive()
+ self._vertex_list.draw(self._draw_mode)
+ self._group.unset_state_recursive()
+
+ def delete(self):
+ self._vertex_list.delete()
+ self._vertex_list = None
+
+ @property
+ def x(self):
+ """X coordinate of the shape.
+
+ :type: int or float
+ """
+ return self._x
+
+ @x.setter
+ def x(self, value):
+ self._x = value
+ self._update_translation()
+
+ @property
+ def y(self):
+ """Y coordinate of the shape.
+
+ :type: int or float
+ """
+ return self._y
+
+ @y.setter
+ def y(self, value):
+ self._y = value
+ self._update_translation()
+
+ @property
+ def position(self):
+ """The (x, y) coordinates of the shape, as a tuple.
+
+ :Parameters:
+ `x` : int or float
+ X coordinate of the sprite.
+ `y` : int or float
+ Y coordinate of the sprite.
+ """
+ return self._x, self._y
+
+ @position.setter
+ def position(self, values):
+ self._x, self._y = values
+ self._update_translation()
+
+ @property
+ def anchor_x(self):
+ """The X coordinate of the anchor point
+
+ :type: int or float
+ """
+ return self._anchor_x
+
+ @anchor_x.setter
+ def anchor_x(self, value):
+ self._anchor_x = value
+ self._update_vertices()
+
+ @property
+ def anchor_y(self):
+ """The Y coordinate of the anchor point
+
+ :type: int or float
+ """
+ return self._anchor_y
+
+ @anchor_y.setter
+ def anchor_y(self, value):
+ self._anchor_y = value
+ self._update_vertices()
+
+ @property
+ def anchor_position(self):
+ """The (x, y) coordinates of the anchor point, as a tuple.
+
+ :Parameters:
+ `x` : int or float
+ X coordinate of the anchor point.
+ `y` : int or float
+ Y coordinate of the anchor point.
+ """
+ return self._anchor_x, self._anchor_y
+
+ @anchor_position.setter
+ def anchor_position(self, values):
+ self._anchor_x, self._anchor_y = values
+ self._update_vertices()
+
+ @property
+ def color(self):
+ """The shape color.
+
+ This property sets the color of the shape.
+
+ The color is specified as an RGB tuple of integers '(red, green, blue)'.
+ Each color component must be in the range 0 (dark) to 255 (saturated).
+
+ :type: (int, int, int)
+ """
+ return self._rgba
+
+ @color.setter
+ def color(self, values):
+ r, g, b, *a = values
+
+ if a:
+ self._rgba = r, g, b, a[0]
+ else:
+ self._rgba = r, g, b, self._rgba[3]
+
+ self._update_color()
+
+ @property
+ def opacity(self):
+ """Blend opacity.
+
+ This property sets the alpha component of the color of the shape.
+ With the default blend mode (see the constructor), this allows the
+ shape to be drawn with fractional opacity, blending with the
+ background.
+
+ An opacity of 255 (the default) has no effect. An opacity of 128
+ will make the shape appear translucent.
+
+ :type: int
+ """
+ return self._rgba[3]
+
+ @opacity.setter
+ def opacity(self, value):
+ self._rgba = (*self._rgba[:3], value)
+ self._update_color()
+
+ @property
+ def visible(self):
+ """True if the shape will be drawn.
+
+ :type: bool
+ """
+ return self._visible
+
+ @visible.setter
+ def visible(self, value):
+ self._visible = value
+ self._update_vertices()
+
+ @property
+ def group(self):
+ """User assigned :class:`Group` object."""
+ return self._group.parent
+
+ @group.setter
+ def group(self, group):
+ if self._group.parent == group:
+ return
+ self._group = _ShapeGroup(self._group.blend_src,
+ self._group.blend_dest,
+ self._group.program,
+ group)
+ self._batch.migrate(self._vertex_list, self._draw_mode, self._group,
+ self._batch)
+
+ @property
+ def batch(self):
+ """User assigned :class:`Batch` object."""
+ return self._batch
+
+ @batch.setter
+ def batch(self, batch):
+ if self._batch == batch:
+ return
+
+ if batch is not None and self._batch is not None:
+ self._batch.migrate(self._vertex_list, self._draw_mode,
+ self._group, batch)
+ self._batch = batch
+ else:
+ self._vertex_list.delete()
+ self._batch = batch
+ self._create_vertex_list()
+
+
+class Arc(ShapeBase):
+ _draw_mode = GL_LINES
+
+ def __init__(self, x, y, radius, segments=None, angle=math.tau, start_angle=0,
+ closed=False, color=(255, 255, 255, 255), batch=None, group=None):
+ """Create an Arc.
+
+ The Arc's anchor point (x, y) defaults to its center.
+
+ :Parameters:
+ `x` : float
+ X coordinate of the circle.
+ `y` : float
+ Y coordinate of the circle.
+ `radius` : float
+ The desired radius.
+ `segments` : int
+ You can optionally specify how many distinct line segments
+ the arc should be made from. If not specified it will be
+ automatically calculated using the formula:
+ `max(14, int(radius / 1.25))`.
+ `angle` : float
+ The angle of the arc, in radians. Defaults to tau (pi * 2),
+ which is a full circle.
+ `start_angle` : float
+ The start angle of the arc, in radians. Defaults to 0.
+ `closed` : bool
+ If True, the ends of the arc will be connected with a line.
+ defaults to False.
+ `color` : (int, int, int, int)
+ The RGB or RGBA color of the arc, specified as a
+ tuple of 3 or 4 ints in the range of 0-255. RGB colors
+ will be treated as having opacity of 255.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the circle to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the circle.
+ """
+ self._x = x
+ self._y = y
+ self._radius = radius
+ self._segments = segments or max(14, int(radius / 1.25))
+ self._num_verts = self._segments * 2 + (2 if closed else 0)
+
+ # handle both 3 and 4 byte colors
+ r, g, b, *a = color
+ self._rgba = r, g, b, a[0] if a else 255
+
+ self._angle = angle
+ self._start_angle = start_angle
+ self._closed = closed
+ self._rotation = 0
+
+ self._batch = batch or Batch()
+ program = get_default_shader()
+ self._group = _ShapeGroup(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, program, group)
+
+ self._create_vertex_list()
+ self._update_vertices()
+
+ def _create_vertex_list(self):
+ self._vertex_list = self._group.program.vertex_list(
+ self._num_verts, self._draw_mode, self._batch, self._group,
+ colors=('Bn', self._rgba * self._num_verts),
+ translation=('f', (self._x, self._y) * self._num_verts))
+
+ def _update_vertices(self):
+ if not self._visible:
+ vertices = (0,) * (self._segments + 1) * 4
+ else:
+ x = -self._anchor_x
+ y = -self._anchor_y
+ r = self._radius
+ tau_segs = self._angle / self._segments
+ start_angle = self._start_angle - math.radians(self._rotation)
+
+ # Calculate the outer points of the arc:
+ points = [(x + (r * math.cos((i * tau_segs) + start_angle)),
+ y + (r * math.sin((i * tau_segs) + start_angle))) for i in range(self._segments + 1)]
+
+ # Create a list of doubled-up points from the points:
+ vertices = []
+ for i in range(len(points) - 1):
+ line_points = *points[i], *points[i + 1]
+ vertices.extend(line_points)
+
+ if self._closed:
+ chord_points = *points[-1], *points[0]
+ vertices.extend(chord_points)
+
+ self._vertex_list.vertices[:] = vertices
+
+ @property
+ def rotation(self):
+ """Clockwise rotation of the arc, in degrees.
+
+ The arc will be rotated about its (anchor_x, anchor_y)
+ position.
+
+ :type: float
+ """
+ return self._rotation
+
+ @rotation.setter
+ def rotation(self, rotation):
+ self._rotation = rotation
+ self._vertex_list.rotation[:] = (rotation,) * self._num_verts
+
+ @property
+ def angle(self):
+ """The angle of the arc.
+
+ :type: float
+ """
+ return self._angle
+
+ @angle.setter
+ def angle(self, value):
+ self._angle = value
+ self._update_vertices()
+
+ @property
+ def start_angle(self):
+ """The start angle of the arc.
+
+ :type: float
+ """
+ return self._start_angle
+
+ @start_angle.setter
+ def start_angle(self, angle):
+ self._start_angle = angle
+ self._update_vertices()
+
+ def draw(self):
+ """Draw the shape at its current position.
+
+ Using this method is not recommended. Instead, add the
+ shape to a `pyglet.graphics.Batch` for efficient rendering.
+ """
+ self._vertex_list.draw(self._draw_mode)
+
+
+class BezierCurve(ShapeBase):
+ _draw_mode = GL_LINES
+
+ def __init__(self, *points, t=1.0, segments=100, color=(255, 255, 255, 255), batch=None, group=None):
+ """Create a Bézier curve.
+
+ The curve's anchor point (x, y) defaults to its first control point.
+
+ :Parameters:
+ `points` : List[[int, int]]
+ Control points of the curve.
+ `t` : float
+ Draw `100*t` percent of the curve. 0.5 means the curve
+ is half drawn and 1.0 means draw the whole curve.
+ `segments` : int
+ You can optionally specify how many line segments the
+ curve should be made from.
+ `color` : (int, int, int, int)
+ The RGB or RGBA color of the curve, specified as a
+ tuple of 3 or 4 ints in the range of 0-255. RGB colors
+ will be treated as having an opacity of 255.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the curve to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the curve.
+ """
+ self._points = list(points)
+ self._t = t
+ self._segments = segments
+ self._num_verts = self._segments * 2
+ r, g, b, *a = color
+ self._rgba = r, g, b, a[0] if a else 255
+
+ program = get_default_shader()
+ self._batch = batch or Batch()
+ self._group = _ShapeGroup(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, program, group)
+
+ self._create_vertex_list()
+ self._update_vertices()
+
+ def _make_curve(self, t):
+ n = len(self._points) - 1
+ p = [0, 0]
+ for i in range(n + 1):
+ m = math.comb(n, i) * (1 - t) ** (n - i) * t ** i
+ p[0] += m * self._points[i][0]
+ p[1] += m * self._points[i][1]
+ return p
+
+ def _create_vertex_list(self):
+ self._vertex_list = self._group.program.vertex_list(
+ self._num_verts, self._draw_mode, self._batch, self._group,
+ colors=('Bn', self._rgba * self._num_verts),
+ translation=('f', (self._points[0]) * self._num_verts))
+
+ def _update_vertices(self):
+ if not self._visible:
+ vertices = (0,) * self._segments * 4
+ else:
+ x = -self._anchor_x
+ y = -self._anchor_y
+
+ # Calculate the points of the curve:
+ points = [(x + self._make_curve(self._t * t / self._segments)[0],
+ y + self._make_curve(self._t * t / self._segments)[1]) for t in range(self._segments + 1)]
+ trans_x, trans_y = points[0]
+ trans_x += self._anchor_x
+ trans_y += self._anchor_y
+ coords = [[x - trans_x, y - trans_y] for x, y in points]
+
+ # Create a list of doubled-up points from the points:
+ vertices = []
+ for i in range(len(coords) - 1):
+ line_points = *coords[i], *coords[i + 1]
+ vertices.extend(line_points)
+
+ self._vertex_list.vertices[:] = vertices
+
+ @property
+ def points(self):
+ """Control points of the curve.
+
+ :type: List[[int, int]]
+ """
+ return self._points
+
+ @points.setter
+ def points(self, value):
+ self._points = value
+ self._update_vertices()
+
+ @property
+ def t(self):
+ """Draw `100*t` percent of the curve.
+
+ :type: float
+ """
+ return self._t
+
+ @t.setter
+ def t(self, value):
+ self._t = value
+ self._update_vertices()
+
+
+class Circle(ShapeBase):
+ def __init__(self, x, y, radius, segments=None, color=(255, 255, 255, 255),
+ batch=None, group=None):
+ """Create a circle.
+
+ The circle's anchor point (x, y) defaults to the center of the circle.
+
+ :Parameters:
+ `x` : float
+ X coordinate of the circle.
+ `y` : float
+ Y coordinate of the circle.
+ `radius` : float
+ The desired radius.
+ `segments` : int
+ You can optionally specify how many distinct triangles
+ the circle should be made from. If not specified it will
+ be automatically calculated using the formula:
+ `max(14, int(radius / 1.25))`.
+ `color` : (int, int, int, int)
+ The RGB or RGBA color of the circle, specified as a
+ tuple of 3 or 4 ints in the range of 0-255. RGB colors
+ will be treated as having an opacity of 255.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the circle to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the circle.
+ """
+ self._x = x
+ self._y = y
+ self._radius = radius
+ self._segments = segments or max(14, int(radius / 1.25))
+ self._num_verts = self._segments * 3
+ r, g, b, *a = color
+ self._rgba = r, g, b, a[0] if a else 255
+
+ program = get_default_shader()
+ self._batch = batch or Batch()
+ self._group = _ShapeGroup(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, program, group)
+
+ self._create_vertex_list()
+ self._update_vertices()
+
+ def _create_vertex_list(self):
+ self._vertex_list = self._group.program.vertex_list(
+ self._segments*3, self._draw_mode, self._batch, self._group,
+ colors=('Bn', self._rgba * self._num_verts),
+ translation=('f', (self._x, self._y) * self._num_verts))
+
+ def _update_vertices(self):
+ if not self._visible:
+ vertices = (0,) * self._segments * 6
+ else:
+ x = -self._anchor_x
+ y = -self._anchor_y
+ r = self._radius
+ tau_segs = math.pi * 2 / self._segments
+
+ # Calculate the outer points of the circle:
+ points = [(x + (r * math.cos(i * tau_segs)),
+ y + (r * math.sin(i * tau_segs))) for i in range(self._segments)]
+
+ # Create a list of triangles from the points:
+ vertices = []
+ for i, point in enumerate(points):
+ triangle = x, y, *points[i - 1], *point
+ vertices.extend(triangle)
+
+ self._vertex_list.vertices[:] = vertices
+
+ @property
+ def radius(self):
+ """The radius of the circle.
+
+ :type: float
+ """
+ return self._radius
+
+ @radius.setter
+ def radius(self, value):
+ self._radius = value
+ self._update_vertices()
+
+
+class Ellipse(ShapeBase):
+ _draw_mode = GL_LINES
+
+ def __init__(self, x, y, a, b, color=(255, 255, 255, 255),
+ batch=None, group=None):
+ """Create an ellipse.
+
+ The ellipse's anchor point (x, y) defaults to the center of the ellipse.
+
+ :Parameters:
+ `x` : float
+ X coordinate of the ellipse.
+ `y` : float
+ Y coordinate of the ellipse.
+ `a` : float
+ Semi-major axes of the ellipse.
+ `b`: float
+ Semi-minor axes of the ellipse.
+ `color` : (int, int, int, int)
+ The RGB or RGBA color of the ellipse, specified as a
+ tuple of 3 or 4 ints in the range of 0-255. RGB colors
+ will be treated as having an opacity of 255.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the circle to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the circle.
+ """
+ self._x = x
+ self._y = y
+ self._a = a
+ self._b = b
+
+ # Break with conventions in other _Shape constructors
+ # because a & b are used as meaningful variable names.
+ color_r, color_g, color_b, *color_a = color
+ self._rgba = color_r, color_g, color_b, color_a[0] if color_a else 255
+
+ self._rotation = 0
+ self._segments = int(max(a, b) / 1.25)
+ self._num_verts = self._segments * 2
+
+ program = get_default_shader()
+ self._batch = batch or Batch()
+ self._group = _ShapeGroup(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, program, group)
+
+ self._create_vertex_list()
+ self._update_vertices()
+
+ def _create_vertex_list(self):
+ self._vertex_list = self._group.program.vertex_list(
+ self._num_verts, self._draw_mode, self._batch, self._group,
+ colors=('Bn', self._rgba * self._num_verts),
+ translation=('f', (self._x, self._y) * self._num_verts))
+
+ def _update_vertices(self):
+ if not self._visible:
+ vertices = (0,) * self._num_verts * 4
+ else:
+ x = -self._anchor_x
+ y = -self._anchor_y
+ tau_segs = math.pi * 2 / self._segments
+
+ # Calculate the points of the ellipse by formula:
+ points = [(x + self._a * math.cos(i * tau_segs),
+ y + self._b * math.sin(i * tau_segs)) for i in range(self._segments + 1)]
+
+ # Create a list of lines from the points:
+ vertices = []
+ for i in range(len(points) - 1):
+ line_points = *points[i], *points[i + 1]
+ vertices.extend(line_points)
+
+ self._vertex_list.vertices[:] = vertices
+
+ @property
+ def a(self):
+ """The semi-major axes of the ellipse.
+
+ :type: float
+ """
+ return self._a
+
+ @a.setter
+ def a(self, value):
+ self._a = value
+ self._update_vertices()
+
+ @property
+ def b(self):
+ """The semi-minor axes of the ellipse.
+
+ :type: float
+ """
+ return self._b
+
+ @b.setter
+ def b(self, value):
+ self._b = value
+ self._update_vertices()
+
+ @property
+ def rotation(self):
+ """Clockwise rotation of the arc, in degrees.
+
+ The arc will be rotated about its (anchor_x, anchor_y)
+ position.
+
+ :type: float
+ """
+ return self._rotation
+
+ @rotation.setter
+ def rotation(self, rotation):
+ self._rotation = rotation
+ self._vertex_list.rotation[:] = (rotation,) * self._num_verts
+
+
+class Sector(ShapeBase):
+ def __init__(self, x, y, radius, segments=None, angle=math.tau, start_angle=0,
+ color=(255, 255, 255, 255), batch=None, group=None):
+ """Create a Sector of a circle.
+
+ The sector's anchor point (x, y) defaults to the center of the circle.
+
+ :Parameters:
+ `x` : float
+ X coordinate of the sector.
+ `y` : float
+ Y coordinate of the sector.
+ `radius` : float
+ The desired radius.
+ `segments` : int
+ You can optionally specify how many distinct triangles
+ the sector should be made from. If not specified it will
+ be automatically calculated using the formula:
+ `max(14, int(radius / 1.25))`.
+ `angle` : float
+ The angle of the sector, in radians. Defaults to tau (pi * 2),
+ which is a full circle.
+ `start_angle` : float
+ The start angle of the sector, in radians. Defaults to 0.
+ `color` : (int, int, int, int)
+ The RGB or RGBA color of the circle, specified as a
+ tuple of 3 or 4 ints in the range of 0-255. RGB colors
+ will be treated as having an opacity of 255.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the sector to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the sector.
+ """
+ self._x = x
+ self._y = y
+ self._radius = radius
+ self._segments = segments or max(14, int(radius / 1.25))
+ self._num_verts = self._segments * 3
+
+ r, g, b, *a = color
+ self._rgba = r, g, b, a[0] if a else 255
+
+ self._angle = angle
+ self._start_angle = start_angle
+ self._rotation = 0
+
+ program = get_default_shader()
+ self._batch = batch or Batch()
+ self._group = _ShapeGroup(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, program, group)
+
+ self._create_vertex_list()
+ self._update_vertices()
+
+ def _create_vertex_list(self):
+ self._vertex_list = self._group.program.vertex_list(
+ self._num_verts, self._draw_mode, self._batch, self._group,
+ colors=('Bn', self._rgba * self._num_verts),
+ translation=('f', (self._x, self._y) * self._num_verts))
+
+ def _update_vertices(self):
+ if not self._visible:
+ vertices = (0,) * self._segments * 6
+ else:
+ x = -self._anchor_x
+ y = -self._anchor_y
+ r = self._radius
+ tau_segs = self._angle / self._segments
+ start_angle = self._start_angle - math.radians(self._rotation)
+
+ # Calculate the outer points of the sector.
+ points = [(x + (r * math.cos((i * tau_segs) + start_angle)),
+ y + (r * math.sin((i * tau_segs) + start_angle))) for i in range(self._segments + 1)]
+
+ # Create a list of triangles from the points
+ vertices = []
+ for i, point in enumerate(points[1:], start=1):
+ triangle = x, y, *points[i - 1], *point
+ vertices.extend(triangle)
+
+ self._vertex_list.vertices[:] = vertices
+
+ @property
+ def angle(self):
+ """The angle of the sector.
+
+ :type: float
+ """
+ return self._angle
+
+ @angle.setter
+ def angle(self, value):
+ self._angle = value
+ self._update_vertices()
+
+ @property
+ def start_angle(self):
+ """The start angle of the sector.
+
+ :type: float
+ """
+ return self._start_angle
+
+ @start_angle.setter
+ def start_angle(self, angle):
+ self._start_angle = angle
+ self._update_vertices()
+
+ @property
+ def radius(self):
+ """The radius of the sector.
+
+ :type: float
+ """
+ return self._radius
+
+ @radius.setter
+ def radius(self, value):
+ self._radius = value
+ self._update_vertices()
+
+ @property
+ def rotation(self):
+ """Clockwise rotation of the sector, in degrees.
+
+ The sector will be rotated about its (anchor_x, anchor_y)
+ position.
+
+ :type: float
+ """
+ return self._rotation
+
+ @rotation.setter
+ def rotation(self, rotation):
+ self._rotation = rotation
+ self._vertex_list.rotation[:] = (rotation,) * self._num_verts
+
+
+class Line(ShapeBase):
+ def __init__(self, x, y, x2, y2, width=1, color=(255, 255, 255, 255),
+ batch=None, group=None):
+ """Create a line.
+
+ The line's anchor point defaults to the center of the line's
+ width on the X axis, and the Y axis.
+
+ :Parameters:
+ `x` : float
+ The first X coordinate of the line.
+ `y` : float
+ The first Y coordinate of the line.
+ `x2` : float
+ The second X coordinate of the line.
+ `y2` : float
+ The second Y coordinate of the line.
+ `width` : float
+ The desired width of the line.
+ `color` : (int, int, int, int)
+ The RGB or RGBA color of the line, specified as a
+ tuple of 3 or 4 ints in the range of 0-255. RGB colors
+ will be treated as having an opacity of 255.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the line to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the line.
+ """
+ self._x = x
+ self._y = y
+ self._x2 = x2
+ self._y2 = y2
+
+ self._width = width
+ self._rotation = math.degrees(math.atan2(y2 - y, x2 - x))
+ self._num_verts = 6
+
+ r, g, b, *a = color
+ self._rgba = r, g, b, a[0] if a else 255
+
+ program = get_default_shader()
+ self._batch = batch or Batch()
+ self._group = _ShapeGroup(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, program, group)
+
+ self._create_vertex_list()
+ self._update_vertices()
+
+ def _create_vertex_list(self):
+ self._vertex_list = self._group.program.vertex_list(
+ 6, self._draw_mode, self._batch, self._group,
+ colors=('Bn', self._rgba * self._num_verts),
+ translation=('f', (self._x, self._y) * self._num_verts))
+
+ def _update_vertices(self):
+ if not self._visible:
+ self._vertex_list.vertices[:] = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ else:
+ x1 = -self._anchor_x
+ y1 = self._anchor_y - self._width / 2
+ x2 = x1 + math.hypot(self._y2 - self._y, self._x2 - self._x)
+ y2 = y1 + self._width
+
+ r = math.atan2(self._y2 - self._y, self._x2 - self._x)
+ cr = math.cos(r)
+ sr = math.sin(r)
+ ax = x1 * cr - y1 * sr
+ ay = x1 * sr + y1 * cr
+ bx = x2 * cr - y1 * sr
+ by = x2 * sr + y1 * cr
+ cx = x2 * cr - y2 * sr
+ cy = x2 * sr + y2 * cr
+ dx = x1 * cr - y2 * sr
+ dy = x1 * sr + y2 * cr
+
+ self._vertex_list.vertices[:] = (ax, ay, bx, by, cx, cy, ax, ay, cx, cy, dx, dy)
+
+ @property
+ def x2(self):
+ """Second X coordinate of the shape.
+
+ :type: int or float
+ """
+ return self._x2
+
+ @x2.setter
+ def x2(self, value):
+ self._x2 = value
+ self._update_vertices()
+
+ @property
+ def y2(self):
+ """Second Y coordinate of the shape.
+
+ :type: int or float
+ """
+ return self._y2
+
+ @y2.setter
+ def y2(self, value):
+ self._y2 = value
+ self._update_vertices()
+
+
+class Rectangle(ShapeBase):
+ def __init__(self, x, y, width, height, color=(255, 255, 255, 255),
+ batch=None, group=None):
+ """Create a rectangle or square.
+
+ The rectangle's anchor point defaults to the (x, y) coordinates,
+ which are at the bottom left.
+
+ :Parameters:
+ `x` : float
+ The X coordinate of the rectangle.
+ `y` : float
+ The Y coordinate of the rectangle.
+ `width` : float
+ The width of the rectangle.
+ `height` : float
+ The height of the rectangle.
+ `color` : (int, int, int, int)
+ The RGB or RGBA color of the circle, specified as a
+ tuple of 3 or 4 ints in the range of 0-255. RGB colors
+ will be treated as having an opacity of 255.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the rectangle to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the rectangle.
+ """
+ self._x = x
+ self._y = y
+ self._width = width
+ self._height = height
+ self._rotation = 0
+ self._num_verts = 6
+
+ r, g, b, *a = color
+ self._rgba = r, g, b, a[0] if a else 255
+
+ program = get_default_shader()
+ self._batch = batch or Batch()
+ self._group = _ShapeGroup(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, program, group)
+
+ self._create_vertex_list()
+ self._update_vertices()
+
+ def _create_vertex_list(self):
+ self._vertex_list = self._group.program.vertex_list(
+ 6, self._draw_mode, self._batch, self._group,
+ colors=('Bn', self._rgba * self._num_verts),
+ translation=('f', (self._x, self._y) * self._num_verts))
+
+ def _update_vertices(self):
+ if not self._visible:
+ self._vertex_list.vertices[:] = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ else:
+ x1 = -self._anchor_x
+ y1 = -self._anchor_y
+ x2 = x1 + self._width
+ y2 = y1 + self._height
+
+ self._vertex_list.vertices[:] = x1, y1, x2, y1, x2, y2, x1, y1, x2, y2, x1, y2
+
+ @property
+ def width(self):
+ """The width of the rectangle.
+
+ :type: float
+ """
+ return self._width
+
+ @width.setter
+ def width(self, value):
+ self._width = value
+ self._update_vertices()
+
+ @property
+ def height(self):
+ """The height of the rectangle.
+
+ :type: float
+ """
+ return self._height
+
+ @height.setter
+ def height(self, value):
+ self._height = value
+ self._update_vertices()
+
+ @property
+ def rotation(self):
+ """Clockwise rotation of the rectangle, in degrees.
+
+ The Rectangle will be rotated about its (anchor_x, anchor_y)
+ position.
+
+ :type: float
+ """
+ return self._rotation
+
+ @rotation.setter
+ def rotation(self, rotation):
+ self._rotation = rotation
+ self._vertex_list.rotation[:] = (rotation,) * self._num_verts
+
+
+class BorderedRectangle(ShapeBase):
+ def __init__(self, x, y, width, height, border=1, color=(255, 255, 255),
+ border_color=(100, 100, 100), batch=None, group=None):
+ """Create a rectangle or square.
+
+ The rectangle's anchor point defaults to the (x, y) coordinates,
+ which are at the bottom left.
+
+ :Parameters:
+ `x` : float
+ The X coordinate of the rectangle.
+ `y` : float
+ The Y coordinate of the rectangle.
+ `width` : float
+ The width of the rectangle.
+ `height` : float
+ The height of the rectangle.
+ `border` : float
+ The thickness of the border.
+ `color` : (int, int, int, int)
+ The RGB or RGBA fill color of the rectangle, specified
+ as a tuple of 3 or 4 ints in the range of 0-255. RGB
+ colors will be treated as having an opacity of 255.
+ `border_color` : (int, int, int, int)
+ The RGB or RGBA fill color of the rectangle, specified
+ as a tuple of 3 or 4 ints in the range of 0-255. RGB
+ colors will be treated as having an opacity of 255.
+
+ The alpha values must match if you pass RGBA values to
+ both this argument and `border_color`. If they do not,
+ a `ValueError` will be raised informing you of the
+ ambiguity.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the rectangle to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the rectangle.
+ """
+ self._x = x
+ self._y = y
+ self._width = width
+ self._height = height
+ self._rotation = 0
+ self._border = border
+ self._num_verts = 8
+
+ fill_r, fill_g, fill_b, *fill_a = color
+ border_r, border_g, border_b, *border_a = border_color
+
+ # Start with a default alpha value of 255.
+ alpha = 255
+ # Raise Exception if we have conflicting alpha values
+ if fill_a and border_a and fill_a[0] != border_a[0]:
+ raise ValueError("When color and border_color are both RGBA values,"
+ "they must both have the same opacity")
+
+ # Choose a value to use if there is no conflict
+ elif fill_a:
+ alpha = fill_a[0]
+ elif border_a:
+ alpha = border_a[0]
+
+ # Although the shape is only allowed one opacity, the alpha is
+ # stored twice to keep other code concise and reduce cpu usage
+ # from stitching together sequences.
+ self._rgba = fill_r, fill_g, fill_b, alpha
+ self._border_rgba = border_r, border_g, border_b, alpha
+
+ program = get_default_shader()
+ self._batch = batch or Batch()
+ self._group = _ShapeGroup(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, program, group)
+
+ self._create_vertex_list()
+ self._update_vertices()
+
+ def _create_vertex_list(self):
+ indices = [0, 1, 2, 0, 2, 3, 0, 4, 3, 4, 7, 3, 0, 1, 5, 0, 5, 4, 1, 2, 5, 5, 2, 6, 6, 2, 3, 6, 3, 7]
+ self._vertex_list = self._group.program.vertex_list_indexed(
+ 8, self._draw_mode, indices, self._batch, self._group,
+ colors=('Bn', self._rgba * 4 + self._border_rgba * 4),
+ translation=('f', (self._x, self._y) * self._num_verts))
+
+ def _update_color(self):
+ self._vertex_list.colors[:] = self._rgba * 4 + self._border_rgba * 4
+
+ def _update_vertices(self):
+ if not self._visible:
+ self._vertex_list.vertices[:] = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ else:
+ bx1 = -self._anchor_x
+ by1 = -self._anchor_y
+ bx2 = bx1 + self._width
+ by2 = by1 + self._height
+ b = self._border
+ ix1 = bx1 + b
+ iy1 = by1 + b
+ ix2 = bx2 - b
+ iy2 = by2 - b
+
+ self._vertex_list.vertices[:] = (ix1, iy1, ix2, iy1, ix2, iy2, ix1, iy2,
+ bx1, by1, bx2, by1, bx2, by2, bx1, by2)
+
+ @property
+ def width(self):
+ """The width of the rectangle.
+
+ :type: float
+ """
+ return self._width
+
+ @width.setter
+ def width(self, value):
+ self._width = value
+ self._update_vertices()
+
+ @property
+ def height(self):
+ """The height of the rectangle.
+
+ :type: float
+ """
+ return self._height
+
+ @height.setter
+ def height(self, value):
+ self._height = value
+ self._update_vertices()
+
+ @property
+ def rotation(self):
+ """Clockwise rotation of the rectangle, in degrees.
+
+ The Rectangle will be rotated about its (anchor_x, anchor_y)
+ position.
+
+ :type: float
+ """
+ return self._rotation
+
+ @rotation.setter
+ def rotation(self, rotation):
+ self._rotation = rotation
+ self._vertex_list.rotation[:] = (rotation,) * self._num_verts
+
+ @property
+ def border_color(self):
+ """The rectangle's border color.
+
+ This property sets the color of the border of a bordered rectangle.
+
+ The color is specified as an RGB tuple of integers '(red, green, blue)'
+ or an RGBA tuple of integers '(red, green, blue, alpha)`. Setting the
+ alpha on this property will change the alpha of the entire shape,
+ including both the fill and the border.
+
+ Each color component must be in the range 0 (dark) to 255 (saturated).
+
+ :type: (int, int, int, int)
+ """
+ return self._border_rgba
+
+ @border_color.setter
+ def border_color(self, values):
+ r, g, b, *a = values
+
+ if a:
+ alpha = a[0]
+ else:
+ alpha = self._rgba[3]
+
+ self._border_rgba = r, g, b, alpha
+ self._rgba = *self._rgba[:3], alpha
+
+ self._update_color()
+
+ @property
+ def color(self):
+ """The rectangle's fill color.
+
+ This property sets the color of the inside of a bordered rectangle.
+
+ The color is specified as an RGB tuple of integers '(red, green, blue)'
+ or an RGBA tuple of integers '(red, green, blue, alpha)`. Setting the
+ alpha on this property will change the alpha of the entire shape,
+ including both the fill and the border.
+
+ Each color component must be in the range 0 (dark) to 255 (saturated).
+
+ :type: (int, int, int, int)
+ """
+ return self._rgba
+
+ @color.setter
+ def color(self, values):
+ r, g, b, *a = values
+
+ if a:
+ alpha = a[0]
+ else:
+ alpha = self._rgba[3]
+
+ self._rgba = r, g, b, alpha
+ self._border_rgba = *self._border_rgba[:3], alpha
+ self._update_color()
+
+
+class Triangle(ShapeBase):
+ def __init__(self, x, y, x2, y2, x3, y3, color=(255, 255, 255, 255),
+ batch=None, group=None):
+ """Create a triangle.
+
+ The triangle's anchor point defaults to the first vertex point.
+
+ :Parameters:
+ `x` : float
+ The first X coordinate of the triangle.
+ `y` : float
+ The first Y coordinate of the triangle.
+ `x2` : float
+ The second X coordinate of the triangle.
+ `y2` : float
+ The second Y coordinate of the triangle.
+ `x3` : float
+ The third X coordinate of the triangle.
+ `y3` : float
+ The third Y coordinate of the triangle.
+ `color` : (int, int, int, int)
+ The RGB or RGBA color of the triangle, specified as a
+ tuple of 3 or 4 ints in the range of 0-255. RGB colors
+ will be treated as having an opacity of 255.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the triangle to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the triangle.
+ """
+ self._x = x
+ self._y = y
+ self._x2 = x2
+ self._y2 = y2
+ self._x3 = x3
+ self._y3 = y3
+ self._rotation = 0
+ self._num_verts = 3
+
+ r, g, b, *a = color
+ self._rgba = r, g, b, a[0] if a else 255
+
+ program = get_default_shader()
+ self._batch = batch or Batch()
+ self._group = _ShapeGroup(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, program, group)
+
+ self._create_vertex_list()
+ self._update_vertices()
+
+ def _create_vertex_list(self):
+ self._vertex_list = self._group.program.vertex_list(
+ 3, self._draw_mode, self._batch, self._group,
+ colors=('Bn', self._rgba * self._num_verts),
+ translation=('f', (self._x, self._y) * self._num_verts))
+
+ def _update_vertices(self):
+ if not self._visible:
+ self._vertex_list.vertices[:] = (0, 0, 0, 0, 0, 0)
+ else:
+ x1 = -self._anchor_x
+ y1 = -self._anchor_y
+ x2 = self._x2 + x1 - self._x
+ y2 = self._y2 + y1 - self._y
+ x3 = self._x3 + x1 - self._x
+ y3 = self._y3 + y1 - self._y
+ self._vertex_list.vertices[:] = (x1, y1, x2, y2, x3, y3)
+
+ @property
+ def x2(self):
+ """Second X coordinate of the shape.
+
+ :type: int or float
+ """
+ return self._x + self._x2
+
+ @x2.setter
+ def x2(self, value):
+ self._x2 = value
+ self._update_vertices()
+
+ @property
+ def y2(self):
+ """Second Y coordinate of the shape.
+
+ :type: int or float
+ """
+ return self._y + self._y2
+
+ @y2.setter
+ def y2(self, value):
+ self._y2 = value
+ self._update_vertices()
+
+ @property
+ def x3(self):
+ """Third X coordinate of the shape.
+
+ :type: int or float
+ """
+ return self._x + self._x3
+
+ @x3.setter
+ def x3(self, value):
+ self._x3 = value
+ self._update_vertices()
+
+ @property
+ def y3(self):
+ """Third Y coordinate of the shape.
+
+ :type: int or float
+ """
+ return self._y + self._y3
+
+ @y3.setter
+ def y3(self, value):
+ self._y3 = value
+ self._update_vertices()
+
+
+class Star(ShapeBase):
+ def __init__(self, x, y, outer_radius, inner_radius, num_spikes, rotation=0,
+ color=(255, 255, 255, 255), batch=None, group=None) -> None:
+ """Create a star.
+
+ The star's anchor point (x, y) defaults to the center of the star.
+
+ :Parameters:
+ `x` : float
+ The X coordinate of the star.
+ `y` : float
+ The Y coordinate of the star.
+ `outer_radius` : float
+ The desired outer radius of the star.
+ `inner_radius` : float
+ The desired inner radius of the star.
+ `num_spikes` : float
+ The desired number of spikes of the star.
+ `rotation` : float
+ The rotation of the star in degrees. A rotation of 0 degrees
+ will result in one spike lining up with the X axis in
+ positive direction.
+ `color` : (int, int, int)
+ The RGB or RGBA color of the star, specified as a
+ tuple of 3 or 4 ints in the range of 0-255. RGB colors
+ will be treated as having an opacity of 255.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the star to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the star.
+ """
+ self._x = x
+ self._y = y
+ self._outer_radius = outer_radius
+ self._inner_radius = inner_radius
+ self._num_spikes = num_spikes
+ self._num_verts = num_spikes * 6
+ self._rotation = rotation
+
+ r, g, b, *a = color
+ self._rgba = r, g, b, a[0] if a else 255
+
+ program = get_default_shader()
+ self._batch = batch or Batch()
+ self._group = _ShapeGroup(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, program, group)
+
+ self._create_vertex_list()
+ self._update_vertices()
+
+ def _create_vertex_list(self):
+ self._vertex_list = self._group.program.vertex_list(
+ self._num_verts, self._draw_mode, self._batch, self._group,
+ colors=('Bn', self._rgba * self._num_verts),
+ rotation=('f', (self._rotation,) * self._num_verts),
+ translation=('f', (self._x, self._y) * self._num_verts))
+
+ def _update_vertices(self):
+ if not self._visible:
+ vertices = (0, 0) * self._num_spikes * 6
+ else:
+ x = -self._anchor_x
+ y = -self._anchor_y
+ r_i = self._inner_radius
+ r_o = self._outer_radius
+
+ # get angle covered by each line (= half a spike)
+ d_theta = math.pi / self._num_spikes
+
+ # calculate alternating points on outer and outer circles
+ points = []
+ for i in range(self._num_spikes):
+ points.append((x + (r_o * math.cos(2*i * d_theta)),
+ y + (r_o * math.sin(2*i * d_theta))))
+ points.append((x + (r_i * math.cos((2*i+1) * d_theta)),
+ y + (r_i * math.sin((2*i+1) * d_theta))))
+
+ # create a list of doubled-up points from the points
+ vertices = []
+ for i, point in enumerate(points):
+ triangle = x, y, *points[i - 1], *point
+ vertices.extend(triangle)
+
+ self._vertex_list.vertices[:] = vertices
+
+ @property
+ def outer_radius(self):
+ """The outer radius of the star."""
+ return self._outer_radius
+
+ @outer_radius.setter
+ def outer_radius(self, value):
+ self._outer_radius = value
+ self._update_vertices()
+
+ @property
+ def inner_radius(self):
+ """The inner radius of the star."""
+ return self._inner_radius
+
+ @inner_radius.setter
+ def inner_radius(self, value):
+ self._inner_radius = value
+ self._update_vertices()
+
+ @property
+ def num_spikes(self):
+ """Number of spikes of the star."""
+ return self._num_spikes
+
+ @num_spikes.setter
+ def num_spikes(self, value):
+ self._num_spikes = value
+ self._update_vertices()
+
+ @property
+ def rotation(self):
+ """Rotation of the star, in degrees.
+ """
+ return self._rotation
+
+ @rotation.setter
+ def rotation(self, rotation):
+ self._rotation = rotation
+ self._vertex_list.rotation[:] = (rotation,) * self._num_verts
+
+
+class Polygon(ShapeBase):
+ def __init__(self, *coordinates, color=(255, 255, 255, 255), batch=None, group=None):
+ """Create a convex polygon.
+
+ The polygon's anchor point defaults to the first vertex point.
+
+ :Parameters:
+ `coordinates` : List[[int, int]]
+ The coordinates for each point in the polygon.
+ `color` : (int, int, int)
+ The RGB or RGBA color of the polygon, specified as a
+ tuple of 3 or 4 ints in the range of 0-255. RGB colors
+ will be treated as having an opacity of 255.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the polygon to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the polygon.
+ """
+
+ # len(self._coordinates) = the number of vertices and sides in the shape.
+ self._rotation = 0
+ self._coordinates = list(coordinates)
+ self._num_verts = (len(self._coordinates) - 2) * 3
+
+ r, g, b, *a = color
+ self._rgba = r, g, b, a[0] if a else 255
+
+ program = get_default_shader()
+ self._batch = batch or Batch()
+ self._group = _ShapeGroup(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, program, group)
+
+ self._create_vertex_list()
+ self._update_vertices()
+ self._update_color()
+
+ def _create_vertex_list(self):
+ self._vertex_list = self._group.program.vertex_list(
+ self._num_verts, self._draw_mode, self._batch, self._group,
+ colors=('Bn', self._rgba * self._num_verts),
+ translation=('f', (self._coordinates[0]) * self._num_verts))
+
+ def _update_vertices(self):
+ if not self._visible:
+ self._vertex_list.vertices[:] = tuple([0] * ((len(self._coordinates) - 2) * 6))
+ else:
+ # Adjust all coordinates by the anchor.
+ trans_x, trans_y = self._coordinates[0]
+ trans_x += self._anchor_x
+ trans_y += self._anchor_y
+ coords = [[x - trans_x, y - trans_y] for x, y in self._coordinates]
+
+ # Triangulate the convex polygon.
+ triangles = []
+ for n in range(len(coords) - 2):
+ triangles += [coords[0], coords[n + 1], coords[n + 2]]
+
+ # Flattening the list before setting vertices to it.
+ self._vertex_list.vertices[:] = tuple(value for coordinate in triangles for value in coordinate)
+
+ @property
+ def rotation(self):
+ """Clockwise rotation of the polygon, in degrees.
+
+ The Polygon will be rotated about its (anchor_x, anchor_y)
+ position.
+
+ :type: float
+ """
+ return self._rotation
+
+ @rotation.setter
+ def rotation(self, rotation):
+ self._rotation = rotation
+ self._vertex_list.rotation[:] = (rotation,) * self._num_verts
+
+
+__all__ = 'Arc', 'BezierCurve', 'Circle', 'Ellipse', 'Line', 'Rectangle', 'BorderedRectangle', 'Triangle', 'Star', 'Polygon', 'Sector'
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/sprite.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/sprite.py
new file mode 100644
index 0000000000000000000000000000000000000000..31ad3e2fa4358e631bc398d8905e8413e0cd7532
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/sprite.py
@@ -0,0 +1,843 @@
+"""Display positioned, scaled and rotated images.
+
+A sprite is an instance of an image displayed on-screen. Multiple sprites can
+display the same image at different positions on the screen. Sprites can also
+be scaled larger or smaller, rotated at any angle and drawn at a fractional
+opacity.
+
+The following complete example loads a ``"ball.png"`` image and creates a
+sprite for that image. The sprite is then drawn in the window's
+draw event handler::
+
+ import pyglet
+
+ ball_image = pyglet.image.load('ball.png')
+ ball = pyglet.sprite.Sprite(ball_image, x=50, y=50)
+
+ window = pyglet.window.Window()
+
+ @window.event
+ def on_draw():
+ ball.draw()
+
+ pyglet.app.run()
+
+The sprite can be moved by modifying the :py:attr:`~pyglet.sprite.Sprite.x` and
+:py:attr:`~pyglet.sprite.Sprite.y` properties. Other
+properties determine the sprite's :py:attr:`~pyglet.sprite.Sprite.rotation`,
+:py:attr:`~pyglet.sprite.Sprite.scale` and
+:py:attr:`~pyglet.sprite.Sprite.opacity`.
+
+By default, sprite coordinates are restricted to integer values to avoid
+sub-pixel artifacts. If you require to use floats, for example for smoother
+animations, you can set the ``subpixel`` parameter to ``True`` when creating
+the sprite (:since: pyglet 1.2).
+
+The sprite's positioning, rotation and scaling all honor the original
+image's anchor (:py:attr:`~pyglet.image.AbstractImage.anchor_x`,
+:py:attr:`~pyglet.image.AbstractImage.anchor_y`).
+
+
+Drawing multiple sprites
+========================
+
+Sprites can be "batched" together and drawn at once more quickly than if each
+of their ``draw`` methods were called individually. The following example
+creates one hundred ball sprites and adds each of them to a :py:class:`~pyglet.graphics.Batch`. The
+entire batch of sprites is then drawn in one call::
+
+ batch = pyglet.graphics.Batch()
+
+ ball_sprites = []
+ for i in range(100):
+ x, y = i * 10, 50
+ ball_sprites.append(pyglet.sprite.Sprite(ball_image, x, y, batch=batch))
+
+ @window.event
+ def on_draw():
+ batch.draw()
+
+Sprites can be freely modified in any way even after being added to a batch,
+however a sprite can belong to at most one batch. See the documentation for
+:py:mod:`pyglet.graphics` for more details on batched rendering, and grouping of
+sprites within batches.
+
+.. versionadded:: 1.1
+"""
+
+import sys
+
+import pyglet
+
+from pyglet.gl import *
+from pyglet import clock
+from pyglet import event
+from pyglet import graphics
+from pyglet import image
+
+_is_pyglet_doc_run = hasattr(sys, "is_pyglet_doc_run") and sys.is_pyglet_doc_run
+
+
+vertex_source = """#version 150 core
+ in vec3 translate;
+ in vec4 colors;
+ in vec3 tex_coords;
+ in vec2 scale;
+ in vec3 position;
+ in float rotation;
+
+ out vec4 vertex_colors;
+ out vec3 texture_coords;
+
+ uniform WindowBlock
+ {
+ mat4 projection;
+ mat4 view;
+ } window;
+
+ mat4 m_scale = mat4(1.0);
+ mat4 m_rotation = mat4(1.0);
+ mat4 m_translate = mat4(1.0);
+
+ void main()
+ {
+ m_scale[0][0] = scale.x;
+ m_scale[1][1] = scale.y;
+ m_translate[3][0] = translate.x;
+ m_translate[3][1] = translate.y;
+ m_translate[3][2] = translate.z;
+ m_rotation[0][0] = cos(-radians(rotation));
+ m_rotation[0][1] = sin(-radians(rotation));
+ m_rotation[1][0] = -sin(-radians(rotation));
+ m_rotation[1][1] = cos(-radians(rotation));
+
+ gl_Position = window.projection * window.view * m_translate * m_rotation * m_scale * vec4(position, 1.0);
+
+ vertex_colors = colors;
+ texture_coords = tex_coords;
+ }
+"""
+
+fragment_source = """#version 150 core
+ in vec4 vertex_colors;
+ in vec3 texture_coords;
+ out vec4 final_colors;
+
+ uniform sampler2D sprite_texture;
+
+ void main()
+ {
+ final_colors = texture(sprite_texture, texture_coords.xy) * vertex_colors;
+ }
+"""
+
+fragment_array_source = """#version 150 core
+ in vec4 vertex_colors;
+ in vec3 texture_coords;
+ out vec4 final_colors;
+
+ uniform sampler2DArray sprite_texture;
+
+ void main()
+ {
+ final_colors = texture(sprite_texture, texture_coords) * vertex_colors;
+ }
+"""
+
+
+def get_default_shader():
+ try:
+ return pyglet.gl.current_context.pyglet_sprite_default_shader
+ except AttributeError:
+ _default_vert_shader = graphics.shader.Shader(vertex_source, 'vertex')
+ _default_frag_shader = graphics.shader.Shader(fragment_source, 'fragment')
+ default_shader_program = graphics.shader.ShaderProgram(_default_vert_shader, _default_frag_shader)
+ pyglet.gl.current_context.pyglet_sprite_default_shader = default_shader_program
+ return pyglet.gl.current_context.pyglet_sprite_default_shader
+
+
+def get_default_array_shader():
+ try:
+ return pyglet.gl.current_context.pyglet_sprite_default_array_shader
+ except AttributeError:
+ _default_vert_shader = graphics.shader.Shader(vertex_source, 'vertex')
+ _default_array_frag_shader = graphics.shader.Shader(fragment_array_source, 'fragment')
+ default_shader_program = graphics.shader.ShaderProgram(_default_vert_shader, _default_array_frag_shader)
+ pyglet.gl.current_context.pyglet_sprite_default_array_shader = default_shader_program
+ return pyglet.gl.current_context.pyglet_sprite_default_array_shader
+
+
+class SpriteGroup(graphics.Group):
+ """Shared sprite rendering group.
+
+ The group is automatically coalesced with other sprite groups sharing the
+ same parent group, texture and blend parameters.
+ """
+
+ def __init__(self, texture, blend_src, blend_dest, program, parent=None):
+ """Create a sprite group.
+
+ The group is created internally when a :py:class:`~pyglet.sprite.Sprite`
+ is created; applications usually do not need to explicitly create it.
+
+ :Parameters:
+ `texture` : `~pyglet.image.Texture`
+ The (top-level) texture containing the sprite image.
+ `blend_src` : int
+ OpenGL blend source mode; for example,
+ ``GL_SRC_ALPHA``.
+ `blend_dest` : int
+ OpenGL blend destination mode; for example,
+ ``GL_ONE_MINUS_SRC_ALPHA``.
+ `program` : `~pyglet.graphics.shader.ShaderProgram`
+ A custom ShaderProgram.
+ `order` : int
+ Change the order to render above or below other Groups.
+ `parent` : `~pyglet.graphics.Group`
+ Optional parent group.
+ """
+ super().__init__(parent=parent)
+ self.texture = texture
+ self.blend_src = blend_src
+ self.blend_dest = blend_dest
+ self.program = program
+
+ def set_state(self):
+ self.program.use()
+
+ glActiveTexture(GL_TEXTURE0)
+ glBindTexture(self.texture.target, self.texture.id)
+
+ glEnable(GL_BLEND)
+ glBlendFunc(self.blend_src, self.blend_dest)
+
+ def unset_state(self):
+ glDisable(GL_BLEND)
+ self.program.stop()
+
+ def __repr__(self):
+ return "{0}({1})".format(self.__class__.__name__, self.texture)
+
+ def __eq__(self, other):
+ return (other.__class__ is self.__class__ and
+ self.program is other.program and
+ self.parent == other.parent and
+ self.texture.target == other.texture.target and
+ self.texture.id == other.texture.id and
+ self.blend_src == other.blend_src and
+ self.blend_dest == other.blend_dest)
+
+ def __hash__(self):
+ return hash((self.program, self.parent,
+ self.texture.id, self.texture.target,
+ self.blend_src, self.blend_dest))
+
+
+class Sprite(event.EventDispatcher):
+ """Instance of an on-screen image.
+
+ See the module documentation for usage.
+ """
+
+ _batch = None
+ _animation = None
+ _frame_index = 0
+ _paused = False
+ _rotation = 0
+ _opacity = 255
+ _rgb = (255, 255, 255)
+ _scale = 1.0
+ _scale_x = 1.0
+ _scale_y = 1.0
+ _visible = True
+ _vertex_list = None
+ group_class = SpriteGroup
+
+ def __init__(self,
+ img, x=0, y=0, z=0,
+ blend_src=GL_SRC_ALPHA,
+ blend_dest=GL_ONE_MINUS_SRC_ALPHA,
+ batch=None,
+ group=None,
+ subpixel=False):
+ """Create a sprite.
+
+ :Parameters:
+ `img` : `~pyglet.image.AbstractImage` or `~pyglet.image.Animation`
+ Image or animation to display.
+ `x` : int
+ X coordinate of the sprite.
+ `y` : int
+ Y coordinate of the sprite.
+ `z` : int
+ Z coordinate of the sprite.
+ `blend_src` : int
+ OpenGL blend source mode. The default is suitable for
+ compositing sprites drawn from back-to-front.
+ `blend_dest` : int
+ OpenGL blend destination mode. The default is suitable for
+ compositing sprites drawn from back-to-front.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional batch to add the sprite to.
+ `group` : `~pyglet.graphics.Group`
+ Optional parent group of the sprite.
+ `subpixel` : bool
+ Allow floating-point coordinates for the sprite. By default,
+ coordinates are restricted to integer values.
+ """
+ self._x = x
+ self._y = y
+ self._z = z
+ self._img = img
+
+ if isinstance(img, image.Animation):
+ self._animation = img
+ self._texture = img.frames[0].image.get_texture()
+ self._next_dt = img.frames[0].duration
+ if self._next_dt:
+ clock.schedule_once(self._animate, self._next_dt)
+ else:
+ self._texture = img.get_texture()
+
+ self._batch = batch or graphics.get_default_batch()
+ self._group = self.group_class(self._texture, blend_src, blend_dest, self.program, group)
+ self._subpixel = subpixel
+ self._create_vertex_list()
+
+ @property
+ def program(self):
+ if isinstance(self._img, image.TextureArrayRegion):
+ program = get_default_array_shader()
+ else:
+ program = get_default_shader()
+
+ return program
+
+ def __del__(self):
+ try:
+ if self._vertex_list is not None:
+ self._vertex_list.delete()
+ except:
+ pass
+
+ def delete(self):
+ """Force immediate removal of the sprite from video memory.
+
+ This is often necessary when using batches, as the Python garbage
+ collector will not necessarily call the finalizer as soon as the
+ sprite is garbage.
+ """
+ if self._animation:
+ clock.unschedule(self._animate)
+ self._vertex_list.delete()
+ self._vertex_list = None
+ self._texture = None
+
+ # Easy way to break circular reference, speeds up GC
+ self._group = None
+
+ def _animate(self, dt):
+ self._frame_index += 1
+ if self._frame_index >= len(self._animation.frames):
+ self._frame_index = 0
+ self.dispatch_event('on_animation_end')
+ if self._vertex_list is None:
+ return # Deleted in event handler.
+
+ frame = self._animation.frames[self._frame_index]
+ self._set_texture(frame.image.get_texture())
+
+ if frame.duration is not None:
+ duration = frame.duration - (self._next_dt - dt)
+ duration = min(max(0, duration), frame.duration)
+ clock.schedule_once(self._animate, duration)
+ self._next_dt = duration
+ else:
+ self.dispatch_event('on_animation_end')
+
+ @property
+ def batch(self):
+ """Graphics batch.
+
+ The sprite can be migrated from one batch to another, or removed from
+ its batch (for individual drawing). Note that this can be an expensive
+ operation.
+
+ :type: :py:class:`pyglet.graphics.Batch`
+ """
+ return self._batch
+
+ @batch.setter
+ def batch(self, batch):
+ if self._batch == batch:
+ return
+
+ if batch is not None and self._batch is not None:
+ self._batch.migrate(self._vertex_list, GL_TRIANGLES, self._group, batch)
+ self._batch = batch
+ else:
+ self._vertex_list.delete()
+ self._batch = batch
+ self._create_vertex_list()
+
+ @property
+ def group(self):
+ """Parent graphics group.
+
+ The sprite can change its rendering group, however this can be an
+ expensive operation.
+
+ :type: :py:class:`pyglet.graphics.Group`
+ """
+ return self._group.parent
+
+ @group.setter
+ def group(self, group):
+ if self._group.parent == group:
+ return
+ self._group = self.group_class(self._texture,
+ self._group.blend_src,
+ self._group.blend_dest,
+ self._group.program,
+ group)
+ self._batch.migrate(self._vertex_list, GL_TRIANGLES, self._group, self._batch)
+
+ @property
+ def image(self):
+ """Image or animation to display.
+
+ :type: :py:class:`~pyglet.image.AbstractImage` or
+ :py:class:`~pyglet.image.Animation`
+ """
+ if self._animation:
+ return self._animation
+ return self._texture
+
+ @image.setter
+ def image(self, img):
+ if self._animation is not None:
+ clock.unschedule(self._animate)
+ self._animation = None
+
+ if isinstance(img, image.Animation):
+ self._animation = img
+ self._frame_index = 0
+ self._set_texture(img.frames[0].image.get_texture())
+ self._next_dt = img.frames[0].duration
+ if self._next_dt:
+ clock.schedule_once(self._animate, self._next_dt)
+ else:
+ self._set_texture(img.get_texture())
+ self._update_position()
+
+ def _set_texture(self, texture):
+ if texture.id is not self._texture.id:
+ self._group = self._group.__class__(texture,
+ self._group.blend_src,
+ self._group.blend_dest,
+ self._group.program,
+ self._group.parent)
+ self._vertex_list.delete()
+ self._texture = texture
+ self._create_vertex_list()
+ else:
+ self._vertex_list.tex_coords[:] = texture.tex_coords
+ self._texture = texture
+
+ def _create_vertex_list(self):
+ self._vertex_list = self.program.vertex_list_indexed(
+ 4, GL_TRIANGLES, [0, 1, 2, 0, 2, 3], self._batch, self._group,
+ colors=('Bn', (*self._rgb, int(self._opacity)) * 4),
+ translate=('f', (self._x, self._y, self._z) * 4),
+ scale=('f', (self._scale*self._scale_x, self._scale*self._scale_y) * 4),
+ rotation=('f', (self._rotation,) * 4),
+ tex_coords=('f', self._texture.tex_coords))
+ self._update_position()
+
+ def _update_position(self):
+ if not self._visible:
+ self._vertex_list.position[:] = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ else:
+ img = self._texture
+ x1 = -img.anchor_x
+ y1 = -img.anchor_y
+ x2 = x1 + img.width
+ y2 = y1 + img.height
+ vertices = (x1, y1, 0, x2, y1, 0, x2, y2, 0, x1, y2, 0)
+
+ if not self._subpixel:
+ self._vertex_list.position[:] = tuple(map(int, vertices))
+ else:
+ self._vertex_list.position[:] = vertices
+
+ @property
+ def position(self):
+ """The (x, y, z) coordinates of the sprite, as a tuple.
+
+ :Parameters:
+ `x` : int
+ X coordinate of the sprite.
+ `y` : int
+ Y coordinate of the sprite.
+ `z` : int
+ Z coordinate of the sprite.
+ """
+ return self._x, self._y, self._z
+
+ @position.setter
+ def position(self, position):
+ self._x, self._y, self._z = position
+ self._vertex_list.translate[:] = position * 4
+
+ @property
+ def x(self):
+ """X coordinate of the sprite.
+
+ :type: int
+ """
+ return self._x
+
+ @x.setter
+ def x(self, x):
+ self._x = x
+ self._vertex_list.translate[:] = (x, self._y, self._z) * 4
+
+ @property
+ def y(self):
+ """Y coordinate of the sprite.
+
+ :type: int
+ """
+ return self._y
+
+ @y.setter
+ def y(self, y):
+ self._y = y
+ self._vertex_list.translate[:] = (self._x, y, self._z) * 4
+
+ @property
+ def z(self):
+ """Z coordinate of the sprite.
+
+ :type: int
+ """
+ return self._z
+
+ @z.setter
+ def z(self, z):
+ self._z = z
+ self._vertex_list.translate[:] = (self._x, self._y, z) * 4
+
+ @property
+ def rotation(self):
+ """Clockwise rotation of the sprite, in degrees.
+
+ The sprite image will be rotated about its image's (anchor_x, anchor_y)
+ position.
+
+ :type: float
+ """
+ return self._rotation
+
+ @rotation.setter
+ def rotation(self, rotation):
+ self._rotation = rotation
+ self._vertex_list.rotation[:] = (self._rotation,) * 4
+
+ @property
+ def scale(self):
+ """Base Scaling factor.
+
+ A scaling factor of 1 (the default) has no effect. A scale of 2 will
+ draw the sprite at twice the native size of its image.
+
+ :type: float
+ """
+ return self._scale
+
+ @scale.setter
+ def scale(self, scale):
+ self._scale = scale
+ self._vertex_list.scale[:] = (scale * self._scale_x, scale * self._scale_y) * 4
+
+ @property
+ def scale_x(self):
+ """Horizontal scaling factor.
+
+ A scaling factor of 1 (the default) has no effect. A scale of 2 will
+ draw the sprite at twice the native width of its image.
+
+ :type: float
+ """
+ return self._scale_x
+
+ @scale_x.setter
+ def scale_x(self, scale_x):
+ self._scale_x = scale_x
+ self._vertex_list.scale[:] = (self._scale * scale_x, self._scale * self._scale_y) * 4
+
+ @property
+ def scale_y(self):
+ """Vertical scaling factor.
+
+ A scaling factor of 1 (the default) has no effect. A scale of 2 will
+ draw the sprite at twice the native height of its image.
+
+ :type: float
+ """
+ return self._scale_y
+
+ @scale_y.setter
+ def scale_y(self, scale_y):
+ self._scale_y = scale_y
+ self._vertex_list.scale[:] = (self._scale * self._scale_x, self._scale * scale_y) * 4
+
+ def update(self, x=None, y=None, z=None, rotation=None, scale=None, scale_x=None, scale_y=None):
+ """Simultaneously change the position, rotation or scale.
+
+ This method is provided for convenience. There is not much
+ performance benefit to updating multiple Sprite attributes at once.
+
+ :Parameters:
+ `x` : int
+ X coordinate of the sprite.
+ `y` : int
+ Y coordinate of the sprite.
+ `z` : int
+ Z coordinate of the sprite.
+ `rotation` : float
+ Clockwise rotation of the sprite, in degrees.
+ `scale` : float
+ Scaling factor.
+ `scale_x` : float
+ Horizontal scaling factor.
+ `scale_y` : float
+ Vertical scaling factor.
+ """
+
+ translations_outdated = False
+
+ # only bother updating if the translation actually changed
+ if x is not None:
+ self._x = x
+ translations_outdated = True
+ if y is not None:
+ self._y = y
+ translations_outdated = True
+ if z is not None:
+ self._z = z
+ translations_outdated = True
+
+ if translations_outdated:
+ self._vertex_list.translate[:] = (self._x, self._y, self._z) * 4
+
+ if rotation is not None and rotation != self._rotation:
+ self._rotation = rotation
+ self._vertex_list.rotation[:] = (rotation,) * 4
+
+ scales_outdated = False
+
+ # only bother updating if the scale actually changed
+ if scale is not None:
+ self._scale = scale
+ scales_outdated = True
+ if scale_x is not None:
+ self._scale_x = scale_x
+ scales_outdated = True
+ if scale_y is not None:
+ self._scale_y = scale_y
+ scales_outdated = True
+
+ if scales_outdated:
+ self._vertex_list.scale[:] = (self._scale * self._scale_x, self._scale * self._scale_y) * 4
+
+ @property
+ def width(self):
+ """Scaled width of the sprite.
+
+ Read-only. Invariant under rotation.
+
+ :type: int
+ """
+ if self._subpixel:
+ return self._texture.width * abs(self._scale_x) * abs(self._scale)
+ else:
+ return int(self._texture.width * abs(self._scale_x) * abs(self._scale))
+
+ @property
+ def height(self):
+ """Scaled height of the sprite.
+
+ Read-only. Invariant under rotation.
+
+ :type: int
+ """
+ if self._subpixel:
+ return self._texture.height * abs(self._scale_y) * abs(self._scale)
+ else:
+ return int(self._texture.height * abs(self._scale_y) * abs(self._scale))
+
+ @property
+ def opacity(self):
+ """Blend opacity.
+
+ This property sets the alpha component of the colour of the sprite's
+ vertices. With the default blend mode (see the constructor), this
+ allows the sprite to be drawn with fractional opacity, blending with the
+ background.
+
+ An opacity of 255 (the default) has no effect. An opacity of 128 will
+ make the sprite appear translucent.
+
+ :type: int
+ """
+ return self._opacity
+
+ @opacity.setter
+ def opacity(self, opacity):
+ self._opacity = opacity
+ self._vertex_list.colors[:] = (*self._rgb, int(self._opacity)) * 4
+
+ @property
+ def color(self):
+ """Blend color.
+
+ This property sets the color of the sprite's vertices. This allows the
+ sprite to be drawn with a color tint.
+
+ The color is specified as an RGB tuple of integers '(red, green, blue)'.
+ Each color component must be in the range 0 (dark) to 255 (saturated).
+
+ :type: (int, int, int)
+ """
+ return self._rgb
+
+ @color.setter
+ def color(self, rgb):
+ self._rgb = list(map(int, rgb))
+ self._vertex_list.colors[:] = (*self._rgb, int(self._opacity)) * 4
+
+ @property
+ def visible(self):
+ """True if the sprite will be drawn.
+
+ :type: bool
+ """
+ return self._visible
+
+ @visible.setter
+ def visible(self, visible):
+ self._visible = visible
+ self._update_position()
+
+ @property
+ def paused(self):
+ """Pause/resume the Sprite's Animation
+
+ If `Sprite.image` is an Animation, you can pause or resume
+ the animation by setting this property to True or False.
+ If not an Animation, this has no effect.
+
+ :type: bool
+ """
+ return self._paused
+
+ @paused.setter
+ def paused(self, pause):
+ if not hasattr(self, '_animation') or pause == self._paused:
+ return
+ if pause is True:
+ clock.unschedule(self._animate)
+ else:
+ frame = self._animation.frames[self._frame_index]
+ self._next_dt = frame.duration
+ if self._next_dt:
+ clock.schedule_once(self._animate, self._next_dt)
+ self._paused = pause
+
+ @property
+ def frame_index(self):
+ """The current Animation frame.
+
+ If the `Sprite.image` is an `Animation`,
+ you can query or set the current frame.
+ If not an Animation, this will always
+ be 0.
+
+ :type: int
+ """
+ return self._frame_index
+
+ @frame_index.setter
+ def frame_index(self, index):
+ # Bound to available number of frames
+ if self._animation is None:
+ return
+ self._frame_index = max(0, min(index, len(self._animation.frames)-1))
+
+ def draw(self):
+ """Draw the sprite at its current position.
+
+ See the module documentation for hints on drawing multiple sprites
+ efficiently.
+ """
+ self._group.set_state_recursive()
+ self._vertex_list.draw(GL_TRIANGLES)
+ self._group.unset_state_recursive()
+
+ if _is_pyglet_doc_run:
+ def on_animation_end(self):
+ """The sprite animation reached the final frame.
+
+ The event is triggered only if the sprite has an animation, not an
+ image. For looping animations, the event is triggered each time
+ the animation loops.
+
+ :event:
+ """
+
+
+Sprite.register_event_type('on_animation_end')
+
+
+class AdvancedSprite(pyglet.sprite.Sprite):
+ """Is a sprite that lets you change the shader program during initialization and after
+ For advanced users who understand shaders."""
+ def __init__(self,
+ img, x=0, y=0, z=0,
+ blend_src=GL_SRC_ALPHA,
+ blend_dest=GL_ONE_MINUS_SRC_ALPHA,
+ batch=None,
+ group=None,
+ subpixel=False,
+ program=None):
+
+ self._program = program
+
+ if not program:
+ if isinstance(img, image.TextureArrayRegion):
+ self._program = get_default_array_shader()
+ else:
+ self._program = get_default_shader()
+
+ super().__init__(img, x, y, z, blend_src, blend_dest, batch, group, subpixel)
+
+ @property
+ def program(self):
+ return self._program
+
+ @program.setter
+ def program(self, program):
+ if self._program == program:
+ return
+ self._group = self.group_class(self._texture,
+ self._group.blend_src,
+ self._group.blend_dest,
+ program,
+ self._group)
+ self._batch.migrate(self._vertex_list, GL_TRIANGLES, self._group, self._batch)
+ self._program = program
+
+
+
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..0772500426f9397c5f171a0d326fa2f3a8aa5f94
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/__init__.py
@@ -0,0 +1,523 @@
+"""Text formatting, layout and display.
+
+This module provides classes for loading styled documents from text files,
+HTML files and a pyglet-specific markup format. Documents can be styled with
+multiple fonts, colours, styles, text sizes, margins, paragraph alignments,
+and so on.
+
+Using the layout classes, documents can be laid out on a single line or
+word-wrapped to fit a rectangle. A layout can then be efficiently drawn in
+a window or updated incrementally (for example, to support interactive text
+editing).
+
+The label classes provide a simple interface for the common case where an
+application simply needs to display some text in a window.
+
+A plain text label can be created with::
+
+ label = pyglet.text.Label('Hello, world',
+ font_name='Times New Roman',
+ font_size=36,
+ x=10, y=10)
+
+Alternatively, a styled text label using HTML can be created with::
+
+ label = pyglet.text.HTMLLabel('Hello, world',
+ x=10, y=10)
+
+Either label can then be drawn at any time with::
+
+ label.draw()
+
+For details on the subset of HTML supported, see `pyglet.text.formats.html`.
+
+Refer to the Programming Guide for advanced usage of the document and layout
+classes, including interactive editing, embedding objects within documents and
+creating scrollable layouts.
+
+.. versionadded:: 1.1
+"""
+
+from os.path import dirname as _dirname
+from os.path import splitext as _splitext
+
+import pyglet
+
+from pyglet.text import layout, document, caret
+
+
+class DocumentDecodeException(Exception):
+ """An error occurred decoding document text."""
+ pass
+
+
+class DocumentDecoder:
+ """Abstract document decoder.
+ """
+
+ def decode(self, text, location=None):
+ """Decode document text.
+
+ :Parameters:
+ `text` : str
+ Text to decode
+ `location` : `Location`
+ Location to use as base path for additional resources
+ referenced within the document (for example, HTML images).
+
+ :rtype: `AbstractDocument`
+ """
+ raise NotImplementedError('abstract')
+
+
+def get_decoder(filename, mimetype=None):
+ """Get a document decoder for the given filename and MIME type.
+
+ If `mimetype` is omitted it is guessed from the filename extension.
+
+ The following MIME types are supported:
+
+ ``text/plain``
+ Plain text
+ ``text/html``
+ HTML 4 Transitional
+ ``text/vnd.pyglet-attributed``
+ Attributed text; see `pyglet.text.formats.attributed`
+
+ `DocumentDecodeException` is raised if another MIME type is given.
+
+ :Parameters:
+ `filename` : str
+ Filename to guess the MIME type from. If a MIME type is given,
+ the filename is ignored.
+ `mimetype` : str
+ MIME type to lookup, or ``None`` to guess the type from the
+ filename.
+
+ :rtype: `DocumentDecoder`
+ """
+ if mimetype is None:
+ _, ext = _splitext(filename)
+ if ext.lower() in ('.htm', '.html', '.xhtml'):
+ mimetype = 'text/html'
+ else:
+ mimetype = 'text/plain'
+
+ if mimetype == 'text/plain':
+ from pyglet.text.formats import plaintext
+ return plaintext.PlainTextDecoder()
+ elif mimetype == 'text/html':
+ from pyglet.text.formats import html
+ return html.HTMLDecoder()
+ elif mimetype == 'text/vnd.pyglet-attributed':
+ from pyglet.text.formats import attributed
+ return attributed.AttributedTextDecoder()
+ else:
+ raise DocumentDecodeException(f'Unknown format "{mimetype}"')
+
+
+def load(filename, file=None, mimetype=None):
+ """Load a document from a file.
+
+ :Parameters:
+ `filename` : str
+ Filename of document to load.
+ `file` : file-like object
+ File object containing encoded data. If omitted, `filename` is
+ loaded from disk.
+ `mimetype` : str
+ MIME type of the document. If omitted, the filename extension is
+ used to guess a MIME type. See `get_decoder` for a list of
+ supported MIME types.
+
+ :rtype: `AbstractDocument`
+ """
+ decoder = get_decoder(filename, mimetype)
+ if not file:
+ with open(filename) as f:
+ file_contents = f.read()
+ else:
+ file_contents = file.read()
+ file.close()
+
+ if hasattr(file_contents, "decode"):
+ file_contents = file_contents.decode()
+
+ location = pyglet.resource.FileLocation(_dirname(filename))
+ return decoder.decode(file_contents, location)
+
+
+def decode_html(text, location=None):
+ """Create a document directly from some HTML formatted text.
+
+ :Parameters:
+ `text` : str
+ HTML data to decode.
+ `location` : str
+ Location giving the base path for additional resources
+ referenced from the document (e.g., images).
+
+ :rtype: `FormattedDocument`
+ """
+ decoder = get_decoder(None, 'text/html')
+ return decoder.decode(text, location)
+
+
+def decode_attributed(text):
+ """Create a document directly from some attributed text.
+
+ See `pyglet.text.formats.attributed` for a description of attributed text.
+
+ :Parameters:
+ `text` : str
+ Attributed text to decode.
+
+ :rtype: `FormattedDocument`
+ """
+ decoder = get_decoder(None, 'text/vnd.pyglet-attributed')
+ return decoder.decode(text)
+
+
+def decode_text(text):
+ """Create a document directly from some plain text.
+
+ :Parameters:
+ `text` : str
+ Plain text to initialise the document with.
+
+ :rtype: `UnformattedDocument`
+ """
+ decoder = get_decoder(None, 'text/plain')
+ return decoder.decode(text)
+
+
+class DocumentLabel(layout.TextLayout):
+ """Base label class.
+
+ A label is a layout that exposes convenience methods for manipulating the
+ associated document.
+ """
+
+ def __init__(self, document=None,
+ x=0, y=0, z=0, width=None, height=None,
+ anchor_x='left', anchor_y='baseline',
+ multiline=False, dpi=None, batch=None, group=None, rotation=0):
+ """Create a label for a given document.
+
+ :Parameters:
+ `document` : `AbstractDocument`
+ Document to attach to the layout.
+ `x` : int
+ X coordinate of the label.
+ `y` : int
+ Y coordinate of the label.
+ `z` : int
+ Z coordinate of the label.
+ `width` : int
+ Width of the label in pixels, or None
+ `height` : int
+ Height of the label in pixels, or None
+ `anchor_x` : str
+ Anchor point of the X coordinate: one of ``"left"``,
+ ``"center"`` or ``"right"``.
+ `anchor_y` : str
+ Anchor point of the Y coordinate: one of ``"bottom"``,
+ ``"baseline"``, ``"center"`` or ``"top"``.
+ `multiline` : bool
+ If True, the label will be word-wrapped and accept newline
+ characters. You must also set the width of the label.
+ `dpi` : float
+ Resolution of the fonts in this layout. Defaults to 96.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional graphics batch to add the label to.
+ `group` : `~pyglet.graphics.Group`
+ Optional graphics group to use.
+ `rotation`: float
+ The amount to rotate the label in degrees. A positive amount
+ will be a clockwise rotation, negative values will result in
+ counter-clockwise rotation.
+
+ """
+ super().__init__(document, width, height, multiline, dpi, batch, group)
+ self._x = x
+ self._y = y
+ self._z = z
+ self._rotation = rotation
+ self._anchor_x = anchor_x
+ self._anchor_y = anchor_y
+ self._update()
+
+ @property
+ def text(self):
+ """The text of the label.
+
+ :type: str
+ """
+ return self.document.text
+
+ @text.setter
+ def text(self, text):
+ self.document.text = text
+
+ @property
+ def color(self):
+ """Text color.
+
+ Color is a 4-tuple of RGBA components, each in range [0, 255].
+
+ :type: (int, int, int, int)
+ """
+ return self.document.get_style('color')
+
+ @color.setter
+ def color(self, color):
+ self.document.set_style(0, len(self.document.text), {'color': color})
+
+ @property
+ def opacity(self):
+ """Blend opacity.
+
+ This property sets the alpha component of the colour of the label's
+ vertices. With the default blend mode, this allows the layout to be
+ drawn with fractional opacity, blending with the background.
+
+ An opacity of 255 (the default) has no effect. An opacity of 128 will
+ make the label appear semi-translucent.
+
+ :type: int
+ """
+ return self.color[3]
+
+ @opacity.setter
+ def opacity(self, alpha):
+ if alpha != self.color[3]:
+ self.color = list(map(int, (*self.color[:3], alpha)))
+
+ @property
+ def font_name(self):
+ """Font family name.
+
+ The font name, as passed to :py:func:`pyglet.font.load`. A list of names can
+ optionally be given: the first matching font will be used.
+
+ :type: str or list
+ """
+ return self.document.get_style('font_name')
+
+ @font_name.setter
+ def font_name(self, font_name):
+ self.document.set_style(0, len(self.document.text), {'font_name': font_name})
+
+ @property
+ def font_size(self):
+ """Font size, in points.
+
+ :type: float
+ """
+ return self.document.get_style('font_size')
+
+ @font_size.setter
+ def font_size(self, font_size):
+ self.document.set_style(0, len(self.document.text), {'font_size': font_size})
+
+ @property
+ def bold(self):
+ """Bold font style.
+
+ :type: bool
+ """
+ return self.document.get_style('bold')
+
+ @bold.setter
+ def bold(self, bold):
+ self.document.set_style(0, len(self.document.text), {'bold': bold})
+
+ @property
+ def italic(self):
+ """Italic font style.
+
+ :type: bool
+ """
+ return self.document.get_style('italic')
+
+ @italic.setter
+ def italic(self, italic):
+ self.document.set_style(0, len(self.document.text), {'italic': italic})
+
+ def get_style(self, name):
+ """Get a document style value by name.
+
+ If the document has more than one value of the named style,
+ `pyglet.text.document.STYLE_INDETERMINATE` is returned.
+
+ :Parameters:
+ `name` : str
+ Style name to query. See documentation for
+ `pyglet.text.layout` for known style names.
+
+ :rtype: object
+ """
+ return self.document.get_style_range(name, 0, len(self.document.text))
+
+ def set_style(self, name, value):
+ """Set a document style value by name over the whole document.
+
+ :Parameters:
+ `name` : str
+ Name of the style to set. See documentation for
+ `pyglet.text.layout` for known style names.
+ `value` : object
+ Value of the style.
+
+ """
+ self.document.set_style(0, len(self.document.text), {name: value})
+
+ def __del__(self):
+ self.delete()
+
+
+class Label(DocumentLabel):
+ """Plain text label.
+ """
+
+ def __init__(self, text='',
+ font_name=None, font_size=None, bold=False, italic=False, stretch=False,
+ color=(255, 255, 255, 255),
+ x=0, y=0, z=0, width=None, height=None,
+ anchor_x='left', anchor_y='baseline',
+ align='left',
+ multiline=False, dpi=None, batch=None, group=None, rotation=0):
+ """Create a plain text label.
+
+ :Parameters:
+ `text` : str
+ Text to display.
+ `font_name` : str or list
+ Font family name(s). If more than one name is given, the
+ first matching name is used.
+ `font_size` : float
+ Font size, in points.
+ `bold` : bool/str
+ Bold font style.
+ `italic` : bool/str
+ Italic font style.
+ `stretch` : bool/str
+ Stretch font style.
+ `color` : (int, int, int, int)
+ Font colour, as RGBA components in range [0, 255].
+ `x` : int
+ X coordinate of the label.
+ `y` : int
+ Y coordinate of the label.
+ `z` : int
+ Z coordinate of the label.
+ `width` : int
+ Width of the label in pixels, or None
+ `height` : int
+ Height of the label in pixels, or None
+ `anchor_x` : str
+ Anchor point of the X coordinate: one of ``"left"``,
+ ``"center"`` or ``"right"``.
+ `anchor_y` : str
+ Anchor point of the Y coordinate: one of ``"bottom"``,
+ ``"baseline"``, ``"center"`` or ``"top"``.
+ `align` : str
+ Horizontal alignment of text on a line, only applies if
+ a width is supplied. One of ``"left"``, ``"center"``
+ or ``"right"``.
+ `multiline` : bool
+ If True, the label will be word-wrapped and accept newline
+ characters. You must also set the width of the label.
+ `dpi` : float
+ Resolution of the fonts in this layout. Defaults to 96.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional graphics batch to add the label to.
+ `group` : `~pyglet.graphics.Group`
+ Optional graphics group to use.
+ `rotation`: float
+ The amount to rotate the label in degrees. A positive amount
+ will be a clockwise rotation, negative values will result in
+ counter-clockwise rotation.
+
+ """
+ doc = decode_text(text)
+ super().__init__(doc, x, y, z, width, height, anchor_x, anchor_y, multiline, dpi, batch, group, rotation)
+
+ self.document.set_style(0, len(self.document.text), {
+ 'font_name': font_name,
+ 'font_size': font_size,
+ 'bold': bold,
+ 'italic': italic,
+ 'stretch': stretch,
+ 'color': color,
+ 'align': align,
+ })
+
+
+class HTMLLabel(DocumentLabel):
+ """HTML formatted text label.
+
+ A subset of HTML 4.01 is supported. See `pyglet.text.formats.html` for
+ details.
+ """
+
+ def __init__(self, text='', location=None,
+ x=0, y=0, z=0, width=None, height=None,
+ anchor_x='left', anchor_y='baseline',
+ multiline=False, dpi=None, batch=None, group=None, rotation=0):
+ """Create a label with an HTML string.
+
+ :Parameters:
+ `text` : str
+ HTML formatted text to display.
+ `location` : `Location`
+ Location object for loading images referred to in the
+ document. By default, the working directory is used.
+ `x` : int
+ X coordinate of the label.
+ `y` : int
+ Y coordinate of the label.
+ `z` : int
+ Z coordinate of the label.
+ `width` : int
+ Width of the label in pixels, or None
+ `height` : int
+ Height of the label in pixels, or None
+ `anchor_x` : str
+ Anchor point of the X coordinate: one of ``"left"``,
+ ``"center"`` or ``"right"``.
+ `anchor_y` : str
+ Anchor point of the Y coordinate: one of ``"bottom"``,
+ ``"baseline"``, ``"center"`` or ``"top"``.
+ `multiline` : bool
+ If True, the label will be word-wrapped and render paragraph
+ and line breaks. You must also set the width of the label.
+ `dpi` : float
+ Resolution of the fonts in this layout. Defaults to 96.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional graphics batch to add the label to.
+ `group` : `~pyglet.graphics.Group`
+ Optional graphics group to use.
+ `rotation`: float
+ The amount to rotate the label in degrees. A positive amount
+ will be a clockwise rotation, negative values will result in
+ counter-clockwise rotation.
+
+ """
+ self._text = text
+ self._location = location
+ doc = decode_html(text, location)
+ super().__init__(doc, x, y, z, width, height, anchor_x, anchor_y, multiline, dpi, batch, group, rotation)
+
+ @property
+ def text(self):
+ """HTML formatted text of the label.
+
+ :type: str
+ """
+ return self._text
+
+ @text.setter
+ def text(self, text):
+ self._text = text
+ self.document = decode_html(text, self._location)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/caret.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/caret.py
new file mode 100644
index 0000000000000000000000000000000000000000..e78ea645bd0334cf75adfd67ccd2b98853df2b7d
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/caret.py
@@ -0,0 +1,545 @@
+"""Provides keyboard and mouse editing procedures for text layout.
+
+Example usage::
+
+ from pyglet import window
+ from pyglet.text import layout, caret
+
+ my_window = window.Window(...)
+ my_layout = layout.IncrementalTextLayout(...)
+ my_caret = caret.Caret(my_layout)
+ my_window.push_handlers(my_caret)
+
+.. versionadded:: 1.1
+"""
+
+import re
+import time
+
+from pyglet import clock
+from pyglet import event
+from pyglet.window import key
+
+
+class Caret:
+ """Visible text insertion marker for
+ `pyglet.text.layout.IncrementalTextLayout`.
+
+ The caret is drawn as a single vertical bar at the document `position`
+ on a text layout object. If `mark` is not None, it gives the unmoving
+ end of the current text selection. The visible text selection on the
+ layout is updated along with `mark` and `position`.
+
+ By default the layout's graphics batch is used, so the caret does not need
+ to be drawn explicitly. Even if a different graphics batch is supplied,
+ the caret will be correctly positioned and clipped within the layout.
+
+ Updates to the document (and so the layout) are automatically propagated
+ to the caret.
+
+ The caret object can be pushed onto a window event handler stack with
+ `Window.push_handlers`. The caret will respond correctly to keyboard,
+ text, mouse and activation events, including double- and triple-clicks.
+ If the text layout is being used alongside other graphical widgets, a
+ GUI toolkit will be needed to delegate keyboard and mouse events to the
+ appropriate widget. pyglet does not provide such a toolkit at this stage.
+ """
+
+ _next_word_re = re.compile(r'(?<=\W)\w')
+ _previous_word_re = re.compile(r'(?<=\W)\w+\W*$')
+ _next_para_re = re.compile(r'\n', flags=re.DOTALL)
+ _previous_para_re = re.compile(r'\n', flags=re.DOTALL)
+
+ _position = 0
+
+ _active = True
+ _visible = True
+ _blink_visible = True
+ _click_count = 0
+ _click_time = 0
+
+ #: Blink period, in seconds.
+ PERIOD = 0.5
+
+ #: Pixels to scroll viewport per mouse scroll wheel movement.
+ #: Defaults to 12pt at 96dpi.
+ SCROLL_INCREMENT = 12 * 96 // 72
+
+ _mark = None
+
+ def __init__(self, layout, batch=None, color=(0, 0, 0)):
+ """Create a caret for a layout.
+
+ By default the layout's batch is used, so the caret does not need to
+ be drawn explicitly.
+
+ :Parameters:
+ `layout` : `~pyglet.text.layout.TextLayout`
+ Layout to control.
+ `batch` : `~pyglet.graphics.Batch`
+ Graphics batch to add vertices to.
+ `color` : (int, int, int)
+ RGB tuple with components in range [0, 255].
+
+ """
+ from pyglet import gl
+ self._layout = layout
+ batch = batch or layout.batch
+ group = layout.foreground_decoration_group
+ colors = (*color, 255, *color, 255)
+
+ self._list = group.program.vertex_list(2, gl.GL_LINES, batch, group, colors=('Bn', colors))
+ self._ideal_x = None
+ self._ideal_line = None
+ self._next_attributes = {}
+
+ self.visible = True
+
+ layout.push_handlers(self)
+
+ def delete(self):
+ """Remove the caret from its batch.
+
+ Also disconnects the caret from further layout events.
+ """
+ self._list.delete()
+ self._layout.remove_handlers(self)
+
+ def _blink(self, dt):
+ if self.PERIOD:
+ self._blink_visible = not self._blink_visible
+ if self._visible and self._active and self._blink_visible:
+ alpha = 255
+ else:
+ alpha = 0
+ self._list.colors[3] = alpha
+ self._list.colors[7] = alpha
+
+ def _nudge(self):
+ self.visible = True
+
+ @property
+ def visible(self):
+ """Caret visibility.
+
+ The caret may be hidden despite this property due to the periodic blinking
+ or by `on_deactivate` if the event handler is attached to a window.
+
+ :type: bool
+ """
+ return self._visible
+
+ @visible.setter
+ def visible(self, visible):
+ self._visible = visible
+ clock.unschedule(self._blink)
+ if visible and self._active and self.PERIOD:
+ clock.schedule_interval(self._blink, self.PERIOD)
+ self._blink_visible = False # flipped immediately by next blink
+ self._blink(0)
+
+ @property
+ def color(self):
+ """Caret color.
+
+ The default caret color is ``[0, 0, 0]`` (black). Each RGB color
+ component is in the range 0 to 255.
+
+ :type: (int, int, int)
+ """
+ return self._list.colors[:3]
+
+ @color.setter
+ def color(self, color):
+ self._list.colors[:3] = color
+ self._list.colors[4:7] = color
+
+ @property
+ def position(self):
+ """Position of caret within document."""
+ return self._position
+
+ @position.setter
+ def position(self, position):
+ self._position = position
+ self._next_attributes.clear()
+ self._update()
+
+ @property
+ def mark(self):
+ """Position of immovable end of text selection within document.
+
+ An interactive text selection is determined by its immovable end (the
+ caret's position when a mouse drag begins) and the caret's position, which
+ moves interactively by mouse and keyboard input.
+
+ This property is ``None`` when there is no selection.
+
+ :type: int
+ """
+ return self._mark
+
+ @mark.setter
+ def mark(self, mark):
+ self._mark = mark
+ self._update(line=self._ideal_line)
+ if mark is None:
+ self._layout.set_selection(0, 0)
+
+ @property
+ def line(self):
+ """Index of line containing the caret's position.
+
+ When set, `position` is modified to place the caret on requested line
+ while maintaining the closest possible X offset.
+
+ :rtype: int
+ """
+ if self._ideal_line is not None:
+ return self._ideal_line
+ else:
+ return self._layout.get_line_from_position(self._position)
+
+ @line.setter
+ def line(self, line):
+ if self._ideal_x is None:
+ self._ideal_x, _ = self._layout.get_point_from_position(self._position)
+ self._position = self._layout.get_position_on_line(line, self._ideal_x)
+ self._update(line=line, update_ideal_x=False)
+
+ def get_style(self, attribute):
+ """Get the document's named style at the caret's current position.
+
+ If there is a text selection and the style varies over the selection,
+ `pyglet.text.document.STYLE_INDETERMINATE` is returned.
+
+ :Parameters:
+ `attribute` : str
+ Name of style attribute to retrieve. See
+ `pyglet.text.document` for a list of recognised attribute
+ names.
+
+ :rtype: object
+ """
+ if self._mark is None or self._mark == self._position:
+ try:
+ return self._next_attributes[attribute]
+ except KeyError:
+ return self._layout.document.get_style(attribute, self._position)
+
+ start = min(self._position, self._mark)
+ end = max(self._position, self._mark)
+ return self._layout.document.get_style_range(attribute, start, end)
+
+ def set_style(self, attributes):
+ """Set the document style at the caret's current position.
+
+ If there is a text selection the style is modified immediately.
+ Otherwise, the next text that is entered before the position is
+ modified will take on the given style.
+
+ :Parameters:
+ `attributes` : dict
+ Dict mapping attribute names to style values. See
+ `pyglet.text.document` for a list of recognised attribute
+ names.
+
+ """
+
+ if self._mark is None or self._mark == self._position:
+ self._next_attributes.update(attributes)
+ return
+
+ start = min(self._position, self._mark)
+ end = max(self._position, self._mark)
+ self._layout.document.set_style(start, end, attributes)
+
+ def _delete_selection(self):
+ start = min(self._mark, self._position)
+ end = max(self._mark, self._position)
+ self._position = start
+ self._mark = None
+ self._layout.document.delete_text(start, end)
+ self._layout.set_selection(0, 0)
+
+ def move_to_point(self, x, y):
+ """Move the caret close to the given window coordinate.
+
+ The `mark` will be reset to ``None``.
+
+ :Parameters:
+ `x` : int
+ X coordinate.
+ `y` : int
+ Y coordinate.
+
+ """
+ line = self._layout.get_line_from_point(x, y)
+ self._mark = None
+ self._layout.set_selection(0, 0)
+ self._position = self._layout.get_position_on_line(line, x)
+ self._update(line=line)
+ self._next_attributes.clear()
+
+ def select_to_point(self, x, y):
+ """Move the caret close to the given window coordinate while
+ maintaining the `mark`.
+
+ :Parameters:
+ `x` : int
+ X coordinate.
+ `y` : int
+ Y coordinate.
+
+ """
+ line = self._layout.get_line_from_point(x, y)
+ self._position = self._layout.get_position_on_line(line, x)
+ self._update(line=line)
+ self._next_attributes.clear()
+
+ def select_word(self, x, y):
+ """Select the word at the given window coordinate.
+
+ :Parameters:
+ `x` : int
+ X coordinate.
+ `y` : int
+ Y coordinate.
+
+ """
+ line = self._layout.get_line_from_point(x, y)
+ p = self._layout.get_position_on_line(line, x)
+ m1 = self._previous_word_re.search(self._layout.document.text, 0, p+1)
+ if not m1:
+ m1 = 0
+ else:
+ m1 = m1.start()
+ self.mark = m1
+
+ m2 = self._next_word_re.search(self._layout.document.text, p)
+ if not m2:
+ m2 = len(self._layout.document.text)
+ else:
+ m2 = m2.start()
+
+ self._position = m2
+ self._update(line=line)
+ self._next_attributes.clear()
+
+ def select_paragraph(self, x, y):
+ """Select the paragraph at the given window coordinate.
+
+ :Parameters:
+ `x` : int
+ X coordinate.
+ `y` : int
+ Y coordinate.
+
+ """
+ line = self._layout.get_line_from_point(x, y)
+ p = self._layout.get_position_on_line(line, x)
+ self.mark = self._layout.document.get_paragraph_start(p)
+ self._position = self._layout.document.get_paragraph_end(p)
+ self._update(line=line)
+ self._next_attributes.clear()
+
+ def _update(self, line=None, update_ideal_x=True):
+ if line is None:
+ line = self._layout.get_line_from_position(self._position)
+ self._ideal_line = None
+ else:
+ self._ideal_line = line
+ x, y = self._layout.get_point_from_position(self._position, line)
+ z = self._layout.z
+ if update_ideal_x:
+ self._ideal_x = x
+
+ x += self._layout.x
+ y += self._layout.y + self._layout.height
+
+ font = self._layout.document.get_font(max(0, self._position - 1))
+ self._list.position[:] = [x, y + font.descent, z, x, y + font.ascent, z]
+
+ if self._mark is not None:
+ self._layout.set_selection(min(self._position, self._mark), max(self._position, self._mark))
+
+ self._layout.ensure_line_visible(line)
+ self._layout.ensure_x_visible(x)
+
+ def on_layout_update(self):
+ """Handler for the `IncrementalTextLayout.on_layout_update` event.
+ """
+ if self.position > len(self._layout.document.text):
+ self.position = len(self._layout.document.text)
+ self._update()
+
+ def on_text(self, text):
+ """Handler for the `pyglet.window.Window.on_text` event.
+
+ Caret keyboard handlers assume the layout always has keyboard focus.
+ GUI toolkits should filter keyboard and text events by widget focus
+ before invoking this handler.
+ """
+ if self._mark is not None:
+ self._delete_selection()
+
+ text = text.replace('\r', '\n')
+ pos = self._position
+ self._position += len(text)
+ self._layout.document.insert_text(pos, text, self._next_attributes)
+ self._nudge()
+ return event.EVENT_HANDLED
+
+ def on_text_motion(self, motion, select=False):
+ """Handler for the `pyglet.window.Window.on_text_motion` event.
+
+ Caret keyboard handlers assume the layout always has keyboard focus.
+ GUI toolkits should filter keyboard and text events by widget focus
+ before invoking this handler.
+ """
+ if motion == key.MOTION_BACKSPACE:
+ if self.mark is not None:
+ self._delete_selection()
+ elif self._position > 0:
+ self._position -= 1
+ self._layout.document.delete_text(self._position, self._position + 1)
+ self._update()
+ elif motion == key.MOTION_DELETE:
+ if self.mark is not None:
+ self._delete_selection()
+ elif self._position < len(self._layout.document.text):
+ self._layout.document.delete_text(self._position, self._position + 1)
+ elif self._mark is not None and not select:
+ self._mark = None
+ self._layout.set_selection(0, 0)
+
+ if motion == key.MOTION_LEFT:
+ self.position = max(0, self.position - 1)
+ elif motion == key.MOTION_RIGHT:
+ self.position = min(len(self._layout.document.text), self.position + 1)
+ elif motion == key.MOTION_UP:
+ self.line = max(0, self.line - 1)
+ elif motion == key.MOTION_DOWN:
+ line = self.line
+ if line < self._layout.get_line_count() - 1:
+ self.line = line + 1
+ elif motion == key.MOTION_BEGINNING_OF_LINE:
+ self.position = self._layout.get_position_from_line(self.line)
+ elif motion == key.MOTION_END_OF_LINE:
+ line = self.line
+ if line < self._layout.get_line_count() - 1:
+ self._position = self._layout.get_position_from_line(line + 1) - 1
+ self._update(line)
+ else:
+ self.position = len(self._layout.document.text)
+ elif motion == key.MOTION_BEGINNING_OF_FILE:
+ self.position = 0
+ elif motion == key.MOTION_END_OF_FILE:
+ self.position = len(self._layout.document.text)
+ elif motion == key.MOTION_NEXT_WORD:
+ pos = self._position + 1
+ m = self._next_word_re.search(self._layout.document.text, pos)
+ if not m:
+ self.position = len(self._layout.document.text)
+ else:
+ self.position = m.start()
+ elif motion == key.MOTION_PREVIOUS_WORD:
+ pos = self._position
+ m = self._previous_word_re.search(self._layout.document.text, 0, pos)
+ if not m:
+ self.position = 0
+ else:
+ self.position = m.start()
+
+ self._next_attributes.clear()
+ self._nudge()
+ return event.EVENT_HANDLED
+
+ def on_text_motion_select(self, motion):
+ """Handler for the `pyglet.window.Window.on_text_motion_select` event.
+
+ Caret keyboard handlers assume the layout always has keyboard focus.
+ GUI toolkits should filter keyboard and text events by widget focus
+ before invoking this handler.
+ """
+ if self.mark is None:
+ self.mark = self.position
+ self.on_text_motion(motion, True)
+ return event.EVENT_HANDLED
+
+ def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
+ """Handler for the `pyglet.window.Window.on_mouse_scroll` event.
+
+ Mouse handlers do not check the bounds of the coordinates: GUI
+ toolkits should filter events that do not intersect the layout
+ before invoking this handler.
+
+ The layout viewport is scrolled by `SCROLL_INCREMENT` pixels per
+ "click".
+ """
+ self._layout.view_x -= scroll_x * self.SCROLL_INCREMENT
+ self._layout.view_y += scroll_y * self.SCROLL_INCREMENT
+ return event.EVENT_HANDLED
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ """Handler for the `pyglet.window.Window.on_mouse_press` event.
+
+ Mouse handlers do not check the bounds of the coordinates: GUI
+ toolkits should filter events that do not intersect the layout
+ before invoking this handler.
+
+ This handler keeps track of the number of mouse presses within
+ a short span of time and uses this to reconstruct double- and
+ triple-click events for selecting words and paragraphs. This
+ technique is not suitable when a GUI toolkit is in use, as the active
+ widget must also be tracked. Do not use this mouse handler if
+ a GUI toolkit is being used.
+ """
+ t = time.time()
+ if t - self._click_time < 0.25:
+ self._click_count += 1
+ else:
+ self._click_count = 1
+ self._click_time = time.time()
+
+ if self._click_count == 1:
+ self.move_to_point(x, y)
+ elif self._click_count == 2:
+ self.select_word(x, y)
+ elif self._click_count == 3:
+ self.select_paragraph(x, y)
+ self._click_count = 0
+
+ self._nudge()
+ return event.EVENT_HANDLED
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ """Handler for the `pyglet.window.Window.on_mouse_drag` event.
+
+ Mouse handlers do not check the bounds of the coordinates: GUI
+ toolkits should filter events that do not intersect the layout
+ before invoking this handler.
+ """
+ if self.mark is None:
+ self.mark = self.position
+ self.select_to_point(x, y)
+ self._nudge()
+ return event.EVENT_HANDLED
+
+ def on_activate(self):
+ """Handler for the `pyglet.window.Window.on_activate` event.
+
+ The caret is hidden when the window is not active.
+ """
+ self._active = True
+ self.visible = self._active
+ return event.EVENT_HANDLED
+
+ def on_deactivate(self):
+ """Handler for the `pyglet.window.Window.on_deactivate` event.
+
+ The caret is hidden when the window is not active.
+ """
+ self._active = False
+ self.visible = self._active
+ return event.EVENT_HANDLED
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/document.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/document.py
new file mode 100644
index 0000000000000000000000000000000000000000..5d3a44aa17675f292ed7aff3d1d39667d109456a
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/document.py
@@ -0,0 +1,701 @@
+"""Formatted and unformatted document interfaces used by text layout.
+
+Abstract representation
+=======================
+
+Styled text in pyglet is represented by one of the :py:class:`~pyglet.text.document.AbstractDocument` classes,
+which manage the state representation of text and style independently of how
+it is loaded or rendered.
+
+A document consists of the document text (a Unicode string) and a set of
+named style ranges. For example, consider the following (artificial)
+example::
+
+ 0 5 10 15 20
+ The cat sat on the mat.
+ +++++++ +++++++ "bold"
+ ++++++ "italic"
+
+If this example were to be rendered, "The cat" and "the mat" would be in bold,
+and "on the" in italics. Note that the second "the" is both bold and italic.
+
+The document styles recorded for this example would be ``"bold"`` over ranges
+(0-7, 15-22) and ``"italic"`` over range (12-18). Overlapping styles are
+permitted; unlike HTML and other structured markup, the ranges need not be
+nested.
+
+The document has no knowledge of the semantics of ``"bold"`` or ``"italic"``,
+it stores only the style names. The pyglet layout classes give meaning to
+these style names in the way they are rendered; but you are also free to
+invent your own style names (which will be ignored by the layout classes).
+This can be useful to tag areas of interest in a document, or maintain
+references back to the source material.
+
+As well as text, the document can contain arbitrary elements represented by
+:py:class:`~pyglet.text.document.InlineElement`. An inline element behaves
+like a single character in the document, but can be rendered by the application.
+
+Paragraph breaks
+================
+
+Paragraph breaks are marked with a "newline" character (U+0010). The Unicode
+paragraph break (U+2029) can also be used.
+
+Line breaks (U+2028) can be used to force a line break within a paragraph.
+
+See Unicode recommendation UTR #13 for more information:
+http://unicode.org/reports/tr13/tr13-5.html.
+
+Document classes
+================
+
+Any class implementing :py:class:`~pyglet.text.document.AbstractDocument` provides an interface to a
+document model as described above. In theory a structured document such as
+HTML or XML could export this model, though the classes provided by pyglet
+implement only unstructured documents.
+
+The :py:class:`~pyglet.text.document.UnformattedDocument` class assumes any styles set are set over the entire
+document. So, regardless of the range specified when setting a ``"bold"``
+style attribute, for example, the entire document will receive that style.
+
+The :py:class:`~pyglet.text.document.FormattedDocument` class implements the document model directly, using
+the `RunList` class to represent style runs efficiently.
+
+Style attributes
+================
+
+The following character style attribute names are recognised by pyglet:
+
+``font_name``
+ Font family name, as given to :py:func:`pyglet.font.load`.
+``font_size``
+ Font size, in points.
+``bold``
+ Boolean.
+``italic``
+ Boolean.
+``underline``
+ 4-tuple of ints in range (0, 255) giving RGBA underline color, or None
+ (default) for no underline.
+``kerning``
+ Additional space to insert between glyphs, in points. Defaults to 0.
+``baseline``
+ Offset of glyph baseline from line baseline, in points. Positive values
+ give a superscript, negative values give a subscript. Defaults to 0.
+``color``
+ 4-tuple of ints in range (0, 255) giving RGBA text color
+``background_color``
+ 4-tuple of ints in range (0, 255) giving RGBA text background color; or
+ ``None`` for no background fill.
+
+The following paragraph style attribute names are recognised by pyglet. Note
+that paragraph styles are handled no differently from character styles by the
+document: it is the application's responsibility to set the style over an
+entire paragraph, otherwise results are undefined.
+
+``align``
+ ``left`` (default), ``center`` or ``right``.
+``indent``
+ Additional horizontal space to insert before the first
+``leading``
+ Additional space to insert between consecutive lines within a paragraph,
+ in points. Defaults to 0.
+``line_spacing``
+ Distance between consecutive baselines in a paragraph, in points.
+ Defaults to ``None``, which automatically calculates the tightest line
+ spacing for each line based on the font ascent and descent.
+``margin_left``
+ Left paragraph margin, in pixels.
+``margin_right``
+ Right paragraph margin, in pixels.
+``margin_top``
+ Margin above paragraph, in pixels.
+``margin_bottom``
+ Margin below paragraph, in pixels. Adjacent margins do not collapse.
+``tab_stops``
+ List of horizontal tab stops, in pixels, measured from the left edge of
+ the text layout. Defaults to the empty list. When the tab stops
+ are exhausted, they implicitly continue at 50 pixel intervals.
+``wrap``
+ Boolean. If True (the default), text wraps within the width of the layout.
+
+Other attributes can be used to store additional style information within the
+document; it will be ignored by the built-in text classes.
+
+All style attributes (including those not present in a document) default to
+``None`` (including the so-called "boolean" styles listed above). The meaning
+of a ``None`` style is style- and application-dependent.
+
+.. versionadded:: 1.1
+"""
+
+import re
+import sys
+
+from pyglet import event
+from pyglet.text import runlist
+
+_is_pyglet_doc_run = hasattr(sys, "is_pyglet_doc_run") and sys.is_pyglet_doc_run
+
+#: The style attribute takes on multiple values in the document.
+STYLE_INDETERMINATE = 'indeterminate'
+
+
+class InlineElement:
+ """Arbitrary inline element positioned within a formatted document.
+
+ Elements behave like a single glyph in the document. They are
+ measured by their horizontal advance, ascent above the baseline, and
+ descent below the baseline.
+
+ The pyglet layout classes reserve space in the layout for elements and
+ call the element's methods to ensure they are rendered at the
+ appropriate position.
+
+ If the size of a element (any of the `advance`, `ascent`, or `descent`
+ instance variables) is modified it is the application's responsibility to
+ trigger a reflow of the appropriate area in the affected layouts. This
+ can be done by forcing a style change over the element's position.
+
+ :Ivariables:
+ `ascent` : int
+ Ascent of the element above the baseline, in pixels.
+ `descent` : int
+ Descent of the element below the baseline, in pixels.
+ Typically negative.
+ `advance` : int
+ Width of the element, in pixels.
+
+ """
+
+ def __init__(self, ascent, descent, advance):
+ self.ascent = ascent
+ self.descent = descent
+ self.advance = advance
+ self._position = None
+
+ @property
+ def position(self):
+ """Position of the element within the document. Read-only.
+
+ :type: int
+ """
+ return self._position
+
+ def place(self, layout, x, y, z):
+ """Construct an instance of the element at the given coordinates.
+
+ Called when the element's position within a layout changes, either
+ due to the initial condition, changes in the document or changes in
+ the layout size.
+
+ It is the responsibility of the element to clip itself against
+ the layout boundaries, and position itself appropriately with respect
+ to the layout's position and viewport offset.
+
+ The `TextLayout.top_state` graphics state implements this transform
+ and clipping into window space.
+
+ :Parameters:
+ `layout` : `pyglet.text.layout.TextLayout`
+ The layout the element moved within.
+ `x` : int
+ Position of the left edge of the element, relative
+ to the left edge of the document, in pixels.
+ `y` : int
+ Position of the baseline, relative to the top edge of the
+ document, in pixels. Note that this is typically negative.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def remove(self, layout):
+ """Remove this element from a layout.
+
+ The counterpart of `place`; called when the element is no longer
+ visible in the given layout.
+
+ :Parameters:
+ `layout` : `pyglet.text.layout.TextLayout`
+ The layout the element was removed from.
+
+ """
+ raise NotImplementedError('abstract')
+
+
+class AbstractDocument(event.EventDispatcher):
+ """Abstract document interface used by all :py:mod:`pyglet.text` classes.
+
+ This class can be overridden to interface pyglet with a third-party
+ document format. It may be easier to implement the document format in
+ terms of one of the supplied concrete classes :py:class:`~pyglet.text.document.FormattedDocument` or
+ :py:class:`~pyglet.text.document.UnformattedDocument`.
+ """
+ _previous_paragraph_re = re.compile(u'\n[^\n\u2029]*$')
+ _next_paragraph_re = re.compile(u'[\n\u2029]')
+
+ def __init__(self, text=''):
+ super().__init__()
+ self._text = u''
+ self._elements = []
+ if text:
+ self.insert_text(0, text)
+
+ @property
+ def text(self):
+ """Document text.
+
+ For efficient incremental updates, use the :py:func:`~pyglet.text.document.AbstractDocument.insert_text` and
+ :py:func:`~pyglet.text.document.AbstractDocument.delete_text` methods instead of replacing this property.
+
+ :type: str
+ """
+ return self._text
+
+ @text.setter
+ def text(self, text):
+ if text == self._text:
+ return
+ self.delete_text(0, len(self._text))
+ self.insert_text(0, text)
+
+ def get_paragraph_start(self, pos):
+ """Get the starting position of a paragraph.
+
+ :Parameters:
+ `pos` : int
+ Character position within paragraph.
+
+ :rtype: int
+ """
+ # Tricky special case where the $ in pattern matches before the
+ # \n at the end of the string instead of the end of the string.
+ if self._text[:pos + 1].endswith('\n') or self._text[:pos + 1].endswith(u'\u2029'):
+ return pos
+
+ m = self._previous_paragraph_re.search(self._text, 0, pos + 1)
+ if not m:
+ return 0
+ return m.start() + 1
+
+ def get_paragraph_end(self, pos):
+ """Get the end position of a paragraph.
+
+ :Parameters:
+ `pos` : int
+ Character position within paragraph.
+
+ :rtype: int
+ """
+ m = self._next_paragraph_re.search(self._text, pos)
+ if not m:
+ return len(self._text)
+ return m.start() + 1
+
+ def get_style_runs(self, attribute):
+ """Get a style iterator over the given style attribute.
+
+ :Parameters:
+ `attribute` : str
+ Name of style attribute to query.
+
+ :rtype: `AbstractRunIterator`
+ """
+ raise NotImplementedError('abstract')
+
+ def get_style(self, attribute, position=0):
+ """Get an attribute style at the given position.
+
+ :Parameters:
+ `attribute` : str
+ Name of style attribute to query.
+ `position` : int
+ Character position of document to query.
+
+ :return: The style set for the attribute at the given position.
+ """
+ raise NotImplementedError('abstract')
+
+ def get_style_range(self, attribute, start, end):
+ """Get an attribute style over the given range.
+
+ If the style varies over the range, `STYLE_INDETERMINATE` is returned.
+
+ :Parameters:
+ `attribute` : str
+ Name of style attribute to query.
+ `start` : int
+ Starting character position.
+ `end` : int
+ Ending character position (exclusive).
+
+ :return: The style set for the attribute over the given range, or
+ `STYLE_INDETERMINATE` if more than one value is set.
+ """
+ iterable = self.get_style_runs(attribute)
+ _, value_end, value = next(iterable.ranges(start, end))
+ if value_end < end:
+ return STYLE_INDETERMINATE
+ else:
+ return value
+
+ def get_font_runs(self, dpi=None):
+ """Get a style iterator over the `pyglet.font.Font` instances used in
+ the document.
+
+ The font instances are created on-demand by inspection of the
+ ``font_name``, ``font_size``, ``bold`` and ``italic`` style
+ attributes.
+
+ :Parameters:
+ `dpi` : float
+ Optional resolution to construct fonts at. See
+ :py:func:`pyglet.font.load`.
+
+ :rtype: `AbstractRunIterator`
+ """
+ raise NotImplementedError('abstract')
+
+ def get_font(self, position, dpi=None):
+ """Get the font instance used at the given position.
+
+ :see: `get_font_runs`
+
+ :Parameters:
+ `position` : int
+ Character position of document to query.
+ `dpi` : float
+ Optional resolution to construct fonts at. See
+ :py:func:`pyglet.font.load`.
+
+ :rtype: `pyglet.font.Font`
+ :return: The font at the given position.
+ """
+ raise NotImplementedError('abstract')
+
+ def insert_text(self, start, text, attributes=None):
+ """Insert text into the document.
+
+ :Parameters:
+ `start` : int
+ Character insertion point within document.
+ `text` : str
+ Text to insert.
+ `attributes` : dict
+ Optional dictionary giving named style attributes of the
+ inserted text.
+
+ """
+ self._insert_text(start, text, attributes)
+ self.dispatch_event('on_insert_text', start, text)
+
+ def _insert_text(self, start, text, attributes):
+ self._text = u''.join((self._text[:start], text, self._text[start:]))
+ len_text = len(text)
+ for element in self._elements:
+ if element._position >= start:
+ element._position += len_text
+
+ def delete_text(self, start, end):
+ """Delete text from the document.
+
+ :Parameters:
+ `start` : int
+ Starting character position to delete from.
+ `end` : int
+ Ending character position to delete to (exclusive).
+
+ """
+ self._delete_text(start, end)
+ self.dispatch_event('on_delete_text', start, end)
+
+ def _delete_text(self, start, end):
+ for element in list(self._elements):
+ if start <= element._position < end:
+ self._elements.remove(element)
+ elif element._position >= end: # fix bug 538
+ element._position -= (end - start)
+
+ self._text = self._text[:start] + self._text[end:]
+
+ def insert_element(self, position, element, attributes=None):
+ """Insert a element into the document.
+
+ See the :py:class:`~pyglet.text.document.InlineElement` class
+ documentation for details of usage.
+
+ :Parameters:
+ `position` : int
+ Character insertion point within document.
+ `element` : `~pyglet.text.document.InlineElement`
+ Element to insert.
+ `attributes` : dict
+ Optional dictionary giving named style attributes of the
+ inserted text.
+
+ """
+ assert element._position is None, 'Element is already in a document.'
+ self.insert_text(position, '\0', attributes)
+ element._position = position
+ self._elements.append(element)
+ self._elements.sort(key=lambda d: d.position)
+
+ def get_element(self, position):
+ """Get the element at a specified position.
+
+ :Parameters:
+ `position` : int
+ Position in the document of the element.
+
+ :rtype: :py:class:`~pyglet.text.document.InlineElement`
+ """
+ for element in self._elements:
+ if element._position == position:
+ return element
+ raise RuntimeError(f'No element at position {position}')
+
+ def set_style(self, start, end, attributes):
+ """Set text style of some or all of the document.
+
+ :Parameters:
+ `start` : int
+ Starting character position.
+ `end` : int
+ Ending character position (exclusive).
+ `attributes` : dict
+ Dictionary giving named style attributes of the text.
+
+ """
+ self._set_style(start, end, attributes)
+ self.dispatch_event('on_style_text', start, end, attributes)
+
+ def _set_style(self, start, end, attributes):
+ raise NotImplementedError('abstract')
+
+ def set_paragraph_style(self, start, end, attributes):
+ """Set the style for a range of paragraphs.
+
+ This is a convenience method for `set_style` that aligns the
+ character range to the enclosing paragraph(s).
+
+ :Parameters:
+ `start` : int
+ Starting character position.
+ `end` : int
+ Ending character position (exclusive).
+ `attributes` : dict
+ Dictionary giving named style attributes of the paragraphs.
+
+ """
+ start = self.get_paragraph_start(start)
+ end = self.get_paragraph_end(end)
+ self._set_style(start, end, attributes)
+ self.dispatch_event('on_style_text', start, end, attributes)
+
+ if _is_pyglet_doc_run:
+ def on_insert_text(self, start, text):
+ """Text was inserted into the document.
+
+ :Parameters:
+ `start` : int
+ Character insertion point within document.
+ `text` : str
+ The text that was inserted.
+
+ :event:
+ """
+
+ def on_delete_text(self, start, end):
+ """Text was deleted from the document.
+
+ :Parameters:
+ `start` : int
+ Starting character position of deleted text.
+ `end` : int
+ Ending character position of deleted text (exclusive).
+
+ :event:
+ """
+
+ def on_style_text(self, start, end, attributes):
+ """Text character style was modified.
+
+ :Parameters:
+ `start` : int
+ Starting character position of modified text.
+ `end` : int
+ Ending character position of modified text (exclusive).
+ `attributes` : dict
+ Dictionary giving updated named style attributes of the
+ text.
+
+ :event:
+ """
+
+
+AbstractDocument.register_event_type('on_insert_text')
+AbstractDocument.register_event_type('on_delete_text')
+AbstractDocument.register_event_type('on_style_text')
+
+
+class UnformattedDocument(AbstractDocument):
+ """A document having uniform style over all text.
+
+ Changes to the style of text within the document affects the entire
+ document. For convenience, the ``position`` parameters of the style
+ methods may therefore be omitted.
+ """
+
+ def __init__(self, text=''):
+ super().__init__(text)
+ self.styles = {}
+
+ def get_style_runs(self, attribute):
+ value = self.styles.get(attribute)
+ return runlist.ConstRunIterator(len(self.text), value)
+
+ def get_style(self, attribute, position=None):
+ return self.styles.get(attribute)
+
+ def set_style(self, start, end, attributes):
+ return super().set_style(0, len(self.text), attributes)
+
+ def _set_style(self, start, end, attributes):
+ self.styles.update(attributes)
+
+ def set_paragraph_style(self, start, end, attributes):
+ return super().set_paragraph_style(0, len(self.text), attributes)
+
+ def get_font_runs(self, dpi=None):
+ ft = self.get_font(dpi=dpi)
+ return runlist.ConstRunIterator(len(self.text), ft)
+
+ def get_font(self, position=None, dpi=None):
+ from pyglet import font
+ font_name = self.styles.get('font_name')
+ font_size = self.styles.get('font_size')
+ bold = self.styles.get('bold', False)
+ italic = self.styles.get('italic', False)
+ stretch = self.styles.get('stretch', False)
+ return font.load(font_name, font_size, bold=bold, italic=italic, stretch=stretch, dpi=dpi)
+
+ def get_element_runs(self):
+ return runlist.ConstRunIterator(len(self._text), None)
+
+
+class FormattedDocument(AbstractDocument):
+ """Simple implementation of a document that maintains text formatting.
+
+ Changes to text style are applied according to the description in
+ :py:class:`~pyglet.text.document.AbstractDocument`. All styles default to ``None``.
+ """
+
+ def __init__(self, text=''):
+ self._style_runs = {}
+ super().__init__(text)
+
+ def get_style_runs(self, attribute):
+ try:
+ return self._style_runs[attribute].get_run_iterator()
+ except KeyError:
+ return _no_style_range_iterator
+
+ def get_style(self, attribute, position=0):
+ try:
+ return self._style_runs[attribute][position]
+ except KeyError:
+ return None
+
+ def _set_style(self, start, end, attributes):
+ for attribute, value in attributes.items():
+ try:
+ runs = self._style_runs[attribute]
+ except KeyError:
+ runs = self._style_runs[attribute] = runlist.RunList(0, None)
+ runs.insert(0, len(self._text))
+ runs.set_run(start, end, value)
+
+ def get_font_runs(self, dpi=None):
+ return _FontStyleRunsRangeIterator(
+ self.get_style_runs('font_name'),
+ self.get_style_runs('font_size'),
+ self.get_style_runs('bold'),
+ self.get_style_runs('italic'),
+ self.get_style_runs('stretch'),
+ dpi)
+
+ def get_font(self, position, dpi=None):
+ runs_iter = self.get_font_runs(dpi)
+ return runs_iter[position]
+
+ def get_element_runs(self):
+ return _ElementIterator(self._elements, len(self._text))
+
+ def _insert_text(self, start, text, attributes):
+ super()._insert_text(start, text, attributes)
+
+ len_text = len(text)
+ for runs in self._style_runs.values():
+ runs.insert(start, len_text)
+
+ if attributes is not None:
+ for attribute, value in attributes.items():
+ try:
+ runs = self._style_runs[attribute]
+ except KeyError:
+ runs = self._style_runs[attribute] = runlist.RunList(0, None)
+ runs.insert(0, len(self.text))
+ runs.set_run(start, start + len_text, value)
+
+ def _delete_text(self, start, end):
+ super()._delete_text(start, end)
+ for runs in self._style_runs.values():
+ runs.delete(start, end)
+
+
+def _iter_elements(elements, length):
+ last = 0
+ for element in elements:
+ p = element.position
+ yield last, p, None
+ yield p, p + 1, element
+ last = p + 1
+ yield last, length, None
+
+
+class _ElementIterator(runlist.RunIterator):
+ def __init__(self, elements, length):
+ self._run_list_iter = _iter_elements(elements, length)
+ self.start, self.end, self.value = next(self)
+
+
+class _FontStyleRunsRangeIterator:
+ # XXX subclass runlist
+ def __init__(self, font_names, font_sizes, bolds, italics, stretch, dpi):
+ self.zip_iter = runlist.ZipRunIterator((font_names, font_sizes, bolds, italics, stretch))
+ self.dpi = dpi
+
+ def ranges(self, start, end):
+ from pyglet import font
+ for start, end, styles in self.zip_iter.ranges(start, end):
+ font_name, font_size, bold, italic, stretch = styles
+ ft = font.load(font_name, font_size, bold=bool(bold), italic=bool(italic), stretch=stretch, dpi=self.dpi)
+ yield start, end, ft
+
+ def __getitem__(self, index):
+ from pyglet import font
+ font_name, font_size, bold, italic, stretch = self.zip_iter[index]
+ return font.load(font_name, font_size, bold=bool(bold), italic=bool(italic), stretch=stretch, dpi=self.dpi)
+
+
+class _NoStyleRangeIterator:
+ # XXX subclass runlist
+ @staticmethod
+ def ranges(start, end):
+ yield start, end, None
+
+ def __getitem__(self, index):
+ return None
+
+
+_no_style_range_iterator = _NoStyleRangeIterator()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..a9e1fbeef6f8799416cb3b462de9c7c9d932e743
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/__init__.py
@@ -0,0 +1,4 @@
+"""Document formats.
+
+.. versionadded:: 1.1
+"""
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/attributed.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/attributed.py
new file mode 100644
index 0000000000000000000000000000000000000000..8c779c4a5e17791f15689c0aa3a666b2b0e37565
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/attributed.py
@@ -0,0 +1,80 @@
+"""Extensible attributed text format for representing pyglet formatted
+documents.
+"""
+
+import re
+import ast
+
+import pyglet
+
+_pattern = re.compile(r"""
+ (?P\{\#x(?P[0-9a-fA-F]+)\})
+ | (?P\{\#(?P[0-9]+)\})
+ | (?P\{\{)
+ | (?P\}\})
+ | (?P\{
+ (?P[^ \{\}]+)\s+
+ (?P[^\}]+)\})
+ | (?P\n(?=[ \t]))
+ | (?P\{\}\n)
+ | (?P\n(?=\S))
+ | (?P\n\n+)
+ | (?P[^\{\}\n]+)
+ """, re.VERBOSE | re.DOTALL)
+
+
+class AttributedTextDecoder(pyglet.text.DocumentDecoder):
+
+ def __init__(self):
+ self.doc = pyglet.text.document.FormattedDocument()
+ self.length = 0
+ self.attributes = {}
+
+ def decode(self, text, location=None):
+ next_trailing_space = True
+ trailing_newline = True
+
+ for m in _pattern.finditer(text):
+ group = m.lastgroup
+ trailing_space = True
+ if group == 'text':
+ t = m.group('text')
+ self.append(t)
+ trailing_space = t.endswith(' ')
+ trailing_newline = False
+ elif group == 'nl_soft':
+ if not next_trailing_space:
+ self.append(' ')
+ trailing_newline = False
+ elif group in ('nl_hard1', 'nl_hard2'):
+ self.append('\n')
+ trailing_newline = True
+ elif group == 'nl_para':
+ self.append(m.group('nl_para')[1:]) # ignore the first \n
+ trailing_newline = True
+ elif group == 'attr':
+ value = ast.literal_eval(m.group('attr_val'))
+ name = m.group('attr_name')
+ if name[0] == '.':
+ if trailing_newline:
+ self.attributes[name[1:]] = value
+ else:
+ self.doc.set_paragraph_style(self.length, self.length, {name[1:]: value})
+ else:
+ self.attributes[name] = value
+ elif group == 'escape_dec':
+ self.append(chr(int(m.group('escape_dec_val'))))
+ elif group == 'escape_hex':
+ self.append(chr(int(m.group('escape_hex_val'), 16)))
+ elif group == 'escape_lbrace':
+ self.append('{')
+ elif group == 'escape_rbrace':
+ self.append('}')
+ next_trailing_space = trailing_space
+
+ return self.doc
+
+ def append(self, text):
+ self.doc.insert_text(self.length, text, self.attributes)
+ self.length += len(text)
+ self.attributes.clear()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/html.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/html.py
new file mode 100644
index 0000000000000000000000000000000000000000..7a5b04283c15a043bb1b6e86fc3c6d2f2f8b9262
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/html.py
@@ -0,0 +1,336 @@
+"""Decode HTML into attributed text.
+
+A subset of HTML 4.01 Transitional is implemented. The following elements are
+supported fully::
+
+ B BLOCKQUOTE BR CENTER CODE DD DIR DL EM FONT H1 H2 H3 H4 H5 H6 I IMG KBD
+ LI MENU OL P PRE Q SAMP STRONG SUB SUP TT U UL VAR
+
+The mark (bullet or number) of a list item is separated from the body of the
+list item with a tab, as the pyglet document model does not allow
+out-of-stream text. This means lists display as expected, but behave a little
+oddly if edited.
+
+No CSS styling is supported.
+"""
+
+import re
+
+from html.parser import HTMLParser
+from html import entities
+
+import pyglet
+from pyglet.text.formats import structured
+
+
+def _hex_color(val):
+ return [(val >> 16) & 0xff, (val >> 8) & 0xff, val & 0xff, 255]
+
+
+_color_names = {
+ 'black': _hex_color(0x000000),
+ 'silver': _hex_color(0xc0c0c0),
+ 'gray': _hex_color(0x808080),
+ 'white': _hex_color(0xffffff),
+ 'maroon': _hex_color(0x800000),
+ 'red': _hex_color(0xff0000),
+ 'purple': _hex_color(0x800080),
+ 'fucsia': _hex_color(0x008000),
+ 'green': _hex_color(0x00ff00),
+ 'lime': _hex_color(0xffff00),
+ 'olive': _hex_color(0x808000),
+ 'yellow': _hex_color(0xff0000),
+ 'navy': _hex_color(0x000080),
+ 'blue': _hex_color(0x0000ff),
+ 'teal': _hex_color(0x008080),
+ 'aqua': _hex_color(0x00ffff),
+}
+
+
+def _parse_color(value):
+ if value.startswith('#'):
+ return _hex_color(int(value[1:], 16))
+ else:
+ try:
+ return _color_names[value.lower()]
+ except KeyError:
+ raise ValueError()
+
+
+_whitespace_re = re.compile(u'[\u0020\u0009\u000c\u200b\r\n]+', re.DOTALL)
+
+_metadata_elements = ['head', 'title']
+
+_block_elements = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
+ 'ul', 'ol', 'dir', 'menu',
+ 'pre', 'dl', 'div', 'center',
+ 'noscript', 'noframes', 'blockquote', 'form',
+ 'isindex', 'hr', 'table', 'fieldset', 'address',
+ # Incorrect, but we treat list items as blocks:
+ 'li', 'dd', 'dt', ]
+
+_block_containers = ['_top_block',
+ 'body', 'div', 'center', 'object', 'applet',
+ 'blockquote', 'ins', 'del', 'dd', 'li', 'form',
+ 'fieldset', 'button', 'th', 'td', 'iframe', 'noscript',
+ 'noframes',
+ # Incorrect, but we treat list items as blocks:
+ 'ul', 'ol', 'dir', 'menu', 'dl']
+
+
+class HTMLDecoder(HTMLParser, structured.StructuredTextDecoder):
+ """Decoder for HTML documents.
+ """
+ #: Default style attributes for unstyled text in the HTML document.
+ #:
+ #: :type: dict
+ default_style = {
+ 'font_name': 'Times New Roman',
+ 'font_size': 12,
+ 'margin_bottom': '12pt',
+ 'bold': False,
+ 'italic': False,
+ }
+
+ #: Map HTML font sizes to actual font sizes, in points.
+ #:
+ #: :type: dict
+ font_sizes = {
+ 1: 8,
+ 2: 10,
+ 3: 12,
+ 4: 14,
+ 5: 18,
+ 6: 24,
+ 7: 48
+ }
+
+ def decode_structured(self, text, location):
+ self.location = location
+ self._font_size_stack = [3]
+ self.list_stack.append(structured.UnorderedListBuilder({}))
+ self.strip_leading_space = True
+ self.block_begin = True
+ self.need_block_begin = False
+ self.element_stack = ['_top_block']
+ self.in_metadata = False
+ self.in_pre = False
+
+ self.push_style('_default', self.default_style)
+
+ self.feed(text)
+ self.close()
+
+ def get_image(self, filename):
+ return pyglet.image.load(filename, file=self.location.open(filename))
+
+ def prepare_for_data(self):
+ if self.need_block_begin:
+ self.add_text('\n')
+ self.block_begin = True
+ self.need_block_begin = False
+
+ def handle_data(self, data):
+ if self.in_metadata:
+ return
+
+ if self.in_pre:
+ self.add_text(data)
+ else:
+ data = _whitespace_re.sub(' ', data)
+ if data.strip():
+ self.prepare_for_data()
+ if self.block_begin or self.strip_leading_space:
+ data = data.lstrip()
+ self.block_begin = False
+ self.add_text(data)
+ self.strip_leading_space = data.endswith(' ')
+
+ def handle_starttag(self, tag, case_attrs):
+ if self.in_metadata:
+ return
+
+ element = tag.lower()
+ attrs = {}
+ for key, value in case_attrs:
+ attrs[key.lower()] = value
+
+ if element in _metadata_elements:
+ self.in_metadata = True
+ elif element in _block_elements:
+ # Pop off elements until we get to a block container.
+ while self.element_stack[-1] not in _block_containers:
+ self.handle_endtag(self.element_stack[-1])
+ if not self.block_begin:
+ self.add_text('\n')
+ self.block_begin = True
+ self.need_block_begin = False
+ self.element_stack.append(element)
+
+ style = {}
+ if element in ('b', 'strong'):
+ style['bold'] = True
+ elif element in ('i', 'em', 'var'):
+ style['italic'] = True
+ elif element in ('tt', 'code', 'samp', 'kbd'):
+ style['font_name'] = 'Courier New'
+ elif element == 'u':
+ color = self.current_style.get('color')
+ if color is None:
+ color = [0, 0, 0, 255]
+ style['underline'] = color
+ elif element == 'font':
+ if 'face' in attrs:
+ style['font_name'] = attrs['face'].split(',')
+ if 'size' in attrs:
+ size = attrs['size']
+ try:
+ if size.startswith('+'):
+ size = self._font_size_stack[-1] + int(size[1:])
+ elif size.startswith('-'):
+ size = self._font_size_stack[-1] - int(size[1:])
+ else:
+ size = int(size)
+ except ValueError:
+ size = 3
+ self._font_size_stack.append(size)
+ if size in self.font_sizes:
+ style['font_size'] = self.font_sizes.get(size, 3)
+ elif 'real_size' in attrs:
+ size = int(attrs['real_size'])
+ self._font_size_stack.append(size)
+ style['font_size'] = size
+ else:
+ self._font_size_stack.append(self._font_size_stack[-1])
+ if 'color' in attrs:
+ try:
+ style['color'] = _parse_color(attrs['color'])
+ except ValueError:
+ pass
+ elif element == 'sup':
+ size = self._font_size_stack[-1] - 1
+ style['font_size'] = self.font_sizes.get(size, 1)
+ style['baseline'] = '3pt'
+ elif element == 'sub':
+ size = self._font_size_stack[-1] - 1
+ style['font_size'] = self.font_sizes.get(size, 1)
+ style['baseline'] = '-3pt'
+ elif element == 'h1':
+ style['font_size'] = 24
+ style['bold'] = True
+ style['align'] = 'center'
+ elif element == 'h2':
+ style['font_size'] = 18
+ style['bold'] = True
+ elif element == 'h3':
+ style['font_size'] = 16
+ style['bold'] = True
+ elif element == 'h4':
+ style['font_size'] = 14
+ style['bold'] = True
+ elif element == 'h5':
+ style['font_size'] = 12
+ style['bold'] = True
+ elif element == 'h6':
+ style['font_size'] = 12
+ style['italic'] = True
+ elif element == 'br':
+ self.add_text(u'\u2028')
+ self.strip_leading_space = True
+ elif element == 'p':
+ if attrs.get('align') in ('left', 'center', 'right'):
+ style['align'] = attrs['align']
+ elif element == 'center':
+ style['align'] = 'center'
+ elif element == 'pre':
+ style['font_name'] = 'Courier New'
+ style['margin_bottom'] = 0
+ self.in_pre = True
+ elif element == 'blockquote':
+ left_margin = self.current_style.get('margin_left') or 0
+ right_margin = self.current_style.get('margin_right') or 0
+ style['margin_left'] = left_margin + 60
+ style['margin_right'] = right_margin + 60
+ elif element == 'q':
+ self.handle_data(u'\u201c')
+ elif element == 'ol':
+ try:
+ start = int(attrs.get('start', 1))
+ except ValueError:
+ start = 1
+ format = attrs.get('type', '1') + '.'
+ builder = structured.OrderedListBuilder(start, format)
+ builder.begin(self, style)
+ self.list_stack.append(builder)
+ elif element in ('ul', 'dir', 'menu'):
+ type = attrs.get('type', 'disc').lower()
+ if type == 'circle':
+ mark = u'\u25cb'
+ elif type == 'square':
+ mark = u'\u25a1'
+ else:
+ mark = u'\u25cf'
+ builder = structured.UnorderedListBuilder(mark)
+ builder.begin(self, style)
+ self.list_stack.append(builder)
+ elif element == 'li':
+ self.list_stack[-1].item(self, style)
+ self.strip_leading_space = True
+ elif element == 'dl':
+ style['margin_bottom'] = 0
+ elif element == 'dd':
+ left_margin = self.current_style.get('margin_left') or 0
+ style['margin_left'] = left_margin + 30
+ elif element == 'img':
+ image = self.get_image(attrs.get('src'))
+ if image:
+ width = attrs.get('width')
+ if width:
+ width = int(width)
+ height = attrs.get('height')
+ if height:
+ height = int(height)
+ self.prepare_for_data()
+ self.add_element(structured.ImageElement(image, width, height))
+ self.strip_leading_space = False
+
+ self.push_style(element, style)
+
+ def handle_endtag(self, tag):
+ element = tag.lower()
+ if element not in self.element_stack:
+ return
+
+ self.pop_style(element)
+ while self.element_stack.pop() != element:
+ pass
+
+ if element in _metadata_elements:
+ self.in_metadata = False
+ elif element in _block_elements:
+ self.block_begin = False
+ self.need_block_begin = True
+
+ if element == 'font' and len(self._font_size_stack) > 1:
+ self._font_size_stack.pop()
+ elif element == 'pre':
+ self.in_pre = False
+ elif element == 'q':
+ self.handle_data(u'\u201d')
+ elif element in ('ul', 'ol'):
+ if len(self.list_stack) > 1:
+ self.list_stack.pop()
+
+ def handle_entityref(self, name):
+ if name in entities.name2codepoint:
+ self.handle_data(chr(entities.name2codepoint[name]))
+
+ def handle_charref(self, name):
+ name = name.lower()
+ try:
+ if name.startswith('x'):
+ self.handle_data(chr(int(name[1:], 16)))
+ else:
+ self.handle_data(chr(int(name)))
+ except ValueError:
+ pass
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/plaintext.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/plaintext.py
new file mode 100644
index 0000000000000000000000000000000000000000..e4a4a31721f60e26d772d9040899a0f3eca99d71
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/plaintext.py
@@ -0,0 +1,11 @@
+"""Plain text decoder.
+"""
+
+import pyglet
+
+
+class PlainTextDecoder(pyglet.text.DocumentDecoder):
+ def decode(self, text, location=None):
+ document = pyglet.text.document.UnformattedDocument()
+ document.insert_text(0, text)
+ return document
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/structured.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/structured.py
new file mode 100644
index 0000000000000000000000000000000000000000..cce52f53c767d2c2885e5998cfc7b76e01b637d4
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/formats/structured.py
@@ -0,0 +1,265 @@
+"""Base class for structured (hierarchical) document formats.
+"""
+
+import re
+
+import pyglet
+
+from pyglet.gl import *
+
+
+class _InlineElementGroup(pyglet.graphics.Group):
+ def __init__(self, texture, program, order=0, parent=None):
+ super().__init__(order, parent)
+ self.texture = texture
+ self.program = program
+
+ def set_state(self):
+ self.program.use()
+
+ glActiveTexture(GL_TEXTURE0)
+ glBindTexture(self.texture.target, self.texture.id)
+
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+
+ def unset_state(self):
+ glDisable(GL_BLEND)
+ self.program.stop()
+
+ def __eq__(self, other):
+ return (self.__class__ is other.__class__ and
+ self._order == other.order and
+ self.program == other.program and
+ self.parent == other.parent and
+ self.texture.target == other.texture.target and
+ self.texture.id == other.texture.id)
+
+ def __hash__(self):
+ return hash((self._order, self.program, self.parent,
+ self.texture.target, self.texture.id))
+
+
+class ImageElement(pyglet.text.document.InlineElement):
+ def __init__(self, image, width=None, height=None):
+ self.image = image.get_texture()
+ self.width = width is None and image.width or width
+ self.height = height is None and image.height or height
+ self.vertex_lists = {}
+
+ anchor_y = self.height // image.height * image.anchor_y
+ ascent = max(0, self.height - anchor_y)
+ descent = min(0, -anchor_y)
+ super().__init__(ascent, descent, self.width)
+
+ def place(self, layout, x, y, z):
+ program = pyglet.text.layout.get_default_image_layout_shader()
+ group = _InlineElementGroup(self.image.get_texture(), program, 0, layout.group)
+ x1 = x
+ y1 = y + self.descent
+ x2 = x + self.width
+ y2 = y + self.height + self.descent
+ vertex_list = program.vertex_list_indexed(4, pyglet.gl.GL_TRIANGLES, [0, 1, 2, 0, 2, 3],
+ layout.batch, group,
+ position=('f', (x1, y1, z, x2, y1, z, x2, y2, z, x1, y2, z)),
+ tex_coords=('f', self.image.tex_coords))
+ self.vertex_lists[layout] = vertex_list
+
+ def remove(self, layout):
+ self.vertex_lists[layout].delete()
+ del self.vertex_lists[layout]
+
+
+def _int_to_roman(number):
+ # From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81611
+ if not 0 < number < 4000:
+ raise ValueError("Argument must be between 1 and 3999")
+ integers = (1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1)
+ numerals = ('M', 'CM', 'D', 'CD','C', 'XC','L','XL','X','IX','V','IV','I')
+ result = ""
+ for i in range(len(integers)):
+ count = int(number // integers[i])
+ result += numerals[i] * count
+ number -= integers[i] * count
+ return result
+
+
+class ListBuilder:
+
+ def begin(self, decoder, style):
+ """Begin a list.
+
+ :Parameters:
+ `decoder` : `StructuredTextDecoder`
+ Decoder.
+ `style` : dict
+ Style dictionary that applies over the entire list.
+
+ """
+ left_margin = decoder.current_style.get('margin_left') or 0
+ tab_stops = decoder.current_style.get('tab_stops')
+ if tab_stops:
+ tab_stops = list(tab_stops)
+ else:
+ tab_stops = []
+ tab_stops.append(left_margin + 50)
+ style['margin_left'] = left_margin + 50
+ style['indent'] = -30
+ style['tab_stops'] = tab_stops
+
+ def item(self, decoder, style, value=None):
+ """Begin a list item.
+
+ :Parameters:
+ `decoder` : `StructuredTextDecoder`
+ Decoder.
+ `style` : dict
+ Style dictionary that applies over the list item.
+ `value` : str
+ Optional value of the list item. The meaning is list-type
+ dependent.
+
+ """
+ mark = self.get_mark(value)
+ if mark:
+ decoder.add_text(mark)
+ decoder.add_text('\t')
+
+ def get_mark(self, value=None):
+ """Get the mark text for the next list item.
+
+ :Parameters:
+ `value` : str
+ Optional value of the list item. The meaning is list-type
+ dependent.
+
+ :rtype: str
+ """
+ return ''
+
+
+class UnorderedListBuilder(ListBuilder):
+
+ def __init__(self, mark):
+ """Create an unordered list with constant mark text.
+
+ :Parameters:
+ `mark` : str
+ Mark to prepend to each list item.
+
+ """
+ self.mark = mark
+
+ def get_mark(self, value):
+ return self.mark
+
+
+class OrderedListBuilder(ListBuilder):
+ format_re = re.compile('(.*?)([1aAiI])(.*)')
+
+ def __init__(self, start, fmt):
+ """Create an ordered list with sequentially numbered mark text.
+
+ The format is composed of an optional prefix text, a numbering
+ scheme character followed by suffix text. Valid numbering schemes
+ are:
+
+ ``1``
+ Decimal Arabic
+ ``a``
+ Lowercase alphanumeric
+ ``A``
+ Uppercase alphanumeric
+ ``i``
+ Lowercase Roman
+ ``I``
+ Uppercase Roman
+
+ Prefix text may typically be ``(`` or ``[`` and suffix text is
+ typically ``.``, ``)`` or empty, but either can be any string.
+
+ :Parameters:
+ `start` : int
+ First list item number.
+ `fmt` : str
+ Format style, for example ``"1."``.
+
+ """
+ self.next_value = start
+
+ self.prefix, self.numbering, self.suffix = self.format_re.match(fmt).groups()
+ assert self.numbering in '1aAiI'
+
+ def get_mark(self, value):
+ if value is None:
+ value = self.next_value
+ self.next_value = value + 1
+ if self.numbering in 'aA':
+ try:
+ mark = 'abcdefghijklmnopqrstuvwxyz'[value - 1]
+ except ValueError:
+ mark = '?'
+ if self.numbering == 'A':
+ mark = mark.upper()
+ return f'{self.prefix}{mark}{self.suffix}'
+ elif self.numbering in 'iI':
+ try:
+ mark = _int_to_roman(value)
+ except ValueError:
+ mark = '?'
+ if self.numbering == 'i':
+ mark = mark.lower()
+ return f'{self.prefix}{mark}{self.suffix}'
+ else:
+ return f'{self.prefix}{value}{self.suffix}'
+
+
+class StructuredTextDecoder(pyglet.text.DocumentDecoder):
+ def decode(self, text, location=None):
+ self.len_text = 0
+ self.current_style = {}
+ self.next_style = {}
+ self.stack = []
+ self.list_stack = []
+ self.document = pyglet.text.document.FormattedDocument()
+ if location is None:
+ location = pyglet.resource.FileLocation('')
+ self.decode_structured(text, location)
+ return self.document
+
+ def decode_structured(self, text, location):
+ raise NotImplementedError('abstract')
+
+ def push_style(self, key, styles):
+ old_styles = {}
+ for name in styles.keys():
+ old_styles[name] = self.current_style.get(name)
+ self.stack.append((key, old_styles))
+ self.current_style.update(styles)
+ self.next_style.update(styles)
+
+ def pop_style(self, key):
+ # Don't do anything if key is not in stack
+ for match, _ in self.stack:
+ if key == match:
+ break
+ else:
+ return
+
+ # Remove all innermost elements until key is closed.
+ while True:
+ match, old_styles = self.stack.pop()
+ self.next_style.update(old_styles)
+ self.current_style.update(old_styles)
+ if match == key:
+ break
+
+ def add_text(self, text):
+ self.document.insert_text(self.len_text, text, self.next_style)
+ self.next_style.clear()
+ self.len_text += len(text)
+
+ def add_element(self, element):
+ self.document.insert_element(self.len_text, element, self.next_style)
+ self.next_style.clear()
+ self.len_text += 1
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/layout.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/layout.py
new file mode 100644
index 0000000000000000000000000000000000000000..d3268de3af3a2097273d7d78cff136d6075671c6
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/layout.py
@@ -0,0 +1,2796 @@
+"""Render simple text and formatted documents efficiently.
+
+Three layout classes are provided:
+
+:py:class:`~pyglet.text.layout.TextLayout`
+ The entire document is laid out before it is rendered. The layout will
+ be grouped with other layouts in the same batch (allowing for efficient
+ rendering of multiple layouts).
+
+ Any change to the layout or document,
+ and even querying some properties, will cause the entire document
+ to be laid out again.
+
+:py:class:`~pyglet.text.layout.ScrollableTextLayout`
+ Based on :py:func:`~pyglet.text.layout.TextLayout`.
+
+ A separate group is used for layout which crops the contents of the
+ layout to the layout rectangle. Additionally, the contents of the
+ layout can be "scrolled" within that rectangle with the ``view_x`` and
+ ``view_y`` properties.
+
+:py:class:`~pyglet.text.layout.IncrementalTextLayout`
+ Based on :py:class:`~pyglet.text.layout.ScrollableTextLayout`.
+
+ When the layout or document are modified, only the affected regions
+ are laid out again. This permits efficient interactive editing and
+ styling of text.
+
+ Only the visible portion of the layout is actually rendered; as the
+ viewport is scrolled additional sections are rendered and discarded as
+ required. This permits efficient viewing and editing of large documents.
+
+ Additionally, this class provides methods for locating the position of a
+ caret in the document, and for displaying interactive text selections.
+
+All three layout classes can be used with either :py:class:`~pyglet.text.document.UnformattedDocument` or
+:py:class:`~pyglet.text.document.FormattedDocument`, and can be either single-line or ``multiline``. The
+combinations of these options effectively provides 12 different text display
+possibilities.
+
+Style attributes
+================
+
+The following character style attribute names are recognised by the layout
+classes. Data types and units are as specified.
+
+Where an attribute is marked "as a distance" the value is assumed to be
+in pixels if given as an int or float, otherwise a string of the form
+``"0u"`` is required, where ``0`` is the distance and ``u`` is the unit; one
+of ``"px"`` (pixels), ``"pt"`` (points), ``"pc"`` (picas), ``"cm"``
+(centimeters), ``"mm"`` (millimeters) or ``"in"`` (inches). For example,
+``"14pt"`` is the distance covering 14 points, which at the default DPI of 96
+is 18 pixels.
+
+``font_name``
+ Font family name, as given to :py:func:`pyglet.font.load`.
+``font_size``
+ Font size, in points.
+``bold``
+ Boolean.
+``italic``
+ Boolean.
+``underline``
+ 4-tuple of ints in range (0, 255) giving RGBA underline color, or None
+ (default) for no underline.
+``kerning``
+ Additional space to insert between glyphs, as a distance. Defaults to 0.
+``baseline``
+ Offset of glyph baseline from line baseline, as a distance. Positive
+ values give a superscript, negative values give a subscript. Defaults to
+ 0.
+``color``
+ 4-tuple of ints in range (0, 255) giving RGBA text color
+``background_color``
+ 4-tuple of ints in range (0, 255) giving RGBA text background color; or
+ ``None`` for no background fill.
+
+The following paragraph style attribute names are recognised. Note
+that paragraph styles are handled no differently from character styles by the
+document: it is the application's responsibility to set the style over an
+entire paragraph, otherwise results are undefined.
+
+``align``
+ ``left`` (default), ``center`` or ``right``.
+``indent``
+ Additional horizontal space to insert before the first glyph of the
+ first line of a paragraph, as a distance.
+``leading``
+ Additional space to insert between consecutive lines within a paragraph,
+ as a distance. Defaults to 0.
+``line_spacing``
+ Distance between consecutive baselines in a paragraph, as a distance.
+ Defaults to ``None``, which automatically calculates the tightest line
+ spacing for each line based on the font ascent and descent.
+``margin_left``
+ Left paragraph margin, as a distance.
+``margin_right``
+ Right paragraph margin, as a distance.
+``margin_top``
+ Margin above paragraph, as a distance.
+``margin_bottom``
+ Margin below paragraph, as a distance. Adjacent margins do not collapse.
+``tab_stops``
+ List of horizontal tab stops, as distances, measured from the left edge of
+ the text layout. Defaults to the empty list. When the tab stops
+ are exhausted, they implicitly continue at 50 pixel intervals.
+``wrap``
+ ``char``, ``word``, True (default) or False. The boundaries at which to
+ wrap text to prevent it overflowing a line. With ``char``, the line
+ wraps anywhere in the text; with ``word`` or True, the line wraps at
+ appropriate boundaries between words; with False the line does not wrap,
+ and may overflow the layout width. ``char`` and ``word`` styles are
+ since pyglet 1.2.
+
+Other attributes can be used to store additional style information within the
+document; they will be ignored by the built-in text classes.
+
+.. versionadded:: 1.1
+"""
+
+import re
+import sys
+
+import pyglet
+
+from pyglet import graphics
+from pyglet.gl import *
+from pyglet.event import EventDispatcher
+from pyglet.text import runlist
+from pyglet.graphics import shader
+from pyglet.font.base import grapheme_break
+
+_is_pyglet_doc_run = hasattr(sys, "is_pyglet_doc_run") and sys.is_pyglet_doc_run
+
+_distance_re = re.compile(r'([-0-9.]+)([a-zA-Z]+)')
+
+
+def _parse_distance(distance, dpi):
+ """Parse a distance string and return corresponding distance in pixels as
+ an integer.
+ """
+ if isinstance(distance, int):
+ return distance
+ elif isinstance(distance, float):
+ return int(distance)
+
+ match = _distance_re.match(distance)
+ assert match, f'Could not parse distance {distance}'
+ if not match:
+ return 0
+
+ value, unit = match.groups()
+ value = float(value)
+ if unit == 'px':
+ return int(value)
+ elif unit == 'pt':
+ return int(value * dpi / 72.0)
+ elif unit == 'pc':
+ return int(value * dpi / 6.0)
+ elif unit == 'in':
+ return int(value * dpi)
+ elif unit == 'mm':
+ return int(value * dpi * 0.0393700787)
+ elif unit == 'cm':
+ return int(value * dpi * 0.393700787)
+ else:
+ assert False, f'Unknown distance unit {unit}'
+
+
+class _Line:
+ align = 'left'
+
+ margin_left = 0
+ margin_right = 0
+
+ length = 0
+
+ ascent = 0
+ descent = 0
+ width = 0
+ paragraph_begin = False
+ paragraph_end = False
+
+ x = None
+ y = None
+
+ def __init__(self, start):
+ self.vertex_lists = []
+ self.start = start
+ self.boxes = []
+
+ def __repr__(self):
+ return f'_Line({self.boxes})'
+
+ def add_box(self, box):
+ self.boxes.append(box)
+ self.length += box.length
+ self.ascent = max(self.ascent, box.ascent)
+ self.descent = min(self.descent, box.descent)
+ self.width += box.advance
+
+ def delete(self, layout):
+ for vertex_list in self.vertex_lists:
+ vertex_list.delete()
+ self.vertex_lists = []
+
+ for box in self.boxes:
+ box.delete(layout)
+
+
+class _LayoutContext:
+ def __init__(self, layout, document, colors_iter, background_iter):
+ self.colors_iter = colors_iter
+ underline_iter = document.get_style_runs('underline')
+ self.decoration_iter = runlist.ZipRunIterator((background_iter, underline_iter))
+ self.baseline_iter = runlist.FilteredRunIterator(
+ document.get_style_runs('baseline'),
+ lambda value: value is not None, 0)
+
+
+class _StaticLayoutContext(_LayoutContext):
+ def __init__(self, layout, document, colors_iter, background_iter):
+ super().__init__(layout, document, colors_iter, background_iter)
+ self.vertex_lists = layout._vertex_lists
+ self.boxes = layout._boxes
+
+ def add_list(self, vertex_list):
+ self.vertex_lists.append(vertex_list)
+
+ def add_box(self, box):
+ self.boxes.append(box)
+
+
+class _IncrementalLayoutContext(_LayoutContext):
+ line = None
+
+ def add_list(self, vertex_list):
+ self.line.vertex_lists.append(vertex_list)
+
+ def add_box(self, box):
+ pass
+
+
+class _AbstractBox:
+ owner = None
+
+ def __init__(self, ascent, descent, advance, length):
+ self.ascent = ascent
+ self.descent = descent
+ self.advance = advance
+ self.length = length
+
+ def place(self, layout, i, x, y, z, rotation, anchor_x, anchor_y, context):
+ raise NotImplementedError('abstract')
+
+ def delete(self, layout):
+ raise NotImplementedError('abstract')
+
+ def get_position_in_box(self, x):
+ raise NotImplementedError('abstract')
+
+ def get_point_in_box(self, position):
+ raise NotImplementedError('abstract')
+
+
+class _GlyphBox(_AbstractBox):
+ def __init__(self, owner, font, glyphs, advance):
+ """Create a run of glyphs sharing the same texture.
+
+ :Parameters:
+ `owner` : `pyglet.image.Texture`
+ Texture of all glyphs in this run.
+ `font` : `pyglet.font.base.Font`
+ Font of all glyphs in this run.
+ `glyphs` : list of (int, `pyglet.font.base.Glyph`)
+ Pairs of ``(kern, glyph)``, where ``kern`` gives horizontal
+ displacement of the glyph in pixels (typically 0).
+ `advance` : int
+ Width of glyph run; must correspond to the sum of advances
+ and kerns in the glyph list.
+
+ """
+ super().__init__(font.ascent, font.descent, advance, len(glyphs))
+ assert owner
+ self.owner = owner
+ self.font = font
+ self.glyphs = glyphs
+ self.advance = advance
+
+ def place(self, layout, i, x, y, z, rotation, anchor_x, anchor_y, context):
+ assert self.glyphs
+ program = get_default_layout_shader()
+
+ try:
+ group = layout.group_cache[self.owner]
+ except KeyError:
+ group = layout.group_class(self.owner, program, order=1, parent=layout.group)
+ layout.group_cache[self.owner] = group
+
+ n_glyphs = self.length
+ vertices = []
+ tex_coords = []
+ baseline = 0
+ x1 = x
+ for start, end, baseline in context.baseline_iter.ranges(i, i + n_glyphs):
+ baseline = layout.parse_distance(baseline)
+ assert len(self.glyphs[start - i:end - i]) == end - start
+ for kern, glyph in self.glyphs[start - i:end - i]:
+ x1 += kern
+ v0, v1, v2, v3 = glyph.vertices
+ v0 += x1
+ v2 += x1
+ v1 += y + baseline
+ v3 += y + baseline
+ vertices.extend(map(round, [v0, v1, z, v2, v1, z, v2, v3, z, v0, v3, z]))
+ t = glyph.tex_coords
+ tex_coords.extend(t)
+ x1 += glyph.advance
+
+ # Text color
+ colors = []
+ for start, end, color in context.colors_iter.ranges(i, i + n_glyphs):
+ if color is None:
+ color = (0, 0, 0, 255)
+ if len(color) != 4:
+ raise ValueError("Color requires 4 values (R, G, B, A). Value received: {}".format(color))
+ colors.extend(color * ((end - start) * 4))
+
+ indices = []
+ # Create indices for each glyph quad:
+ for glyph_idx in range(n_glyphs):
+ indices.extend([element + (glyph_idx * 4) for element in [0, 1, 2, 0, 2, 3]])
+
+ vertex_list = program.vertex_list_indexed(n_glyphs * 4, GL_TRIANGLES, indices, layout.batch, group,
+ position=('f', vertices),
+ colors=('Bn', colors),
+ tex_coords=('f', tex_coords),
+ rotation=('f', ((rotation,) * 4) * n_glyphs),
+ anchor=('f', ((anchor_x, anchor_y) * 4) * n_glyphs))
+ context.add_list(vertex_list)
+
+ # Decoration (background color and underline)
+ # -------------------------------------------
+ # Should iterate over baseline too, but in practice any sensible
+ # change in baseline will correspond with a change in font size,
+ # and thus glyph run as well. So we cheat and just use whatever
+ # baseline was seen last.
+ background_vertices = []
+ background_colors = []
+ underline_vertices = []
+ underline_colors = []
+ y1 = y + self.descent + baseline
+ y2 = y + self.ascent + baseline
+ x1 = x
+
+ for start, end, decoration in context.decoration_iter.ranges(i, i + n_glyphs):
+ bg, underline = decoration
+ x2 = x1
+ for kern, glyph in self.glyphs[start - i:end - i]:
+ x2 += glyph.advance + kern
+
+ if bg is not None:
+ if len(bg) != 4:
+ raise ValueError(f"Background color requires 4 values (R, G, B, A). Value received: {bg}")
+
+ background_vertices.extend([x1, y1, z, x2, y1, z, x2, y2, z, x1, y2, z])
+ background_colors.extend(bg * 4)
+
+ if underline is not None:
+ if len(underline) != 4:
+ raise ValueError(f"Underline color requires 4 values (R, G, B, A). Value received: {underline}")
+
+ underline_vertices.extend([x1, y + baseline - 2, z, x2, y + baseline - 2, z])
+ underline_colors.extend(underline * 2)
+
+ x1 = x2
+
+ if background_vertices:
+ background_indices = []
+ bg_count = len(background_vertices) // 2
+ decoration_program = get_default_decoration_shader()
+ for bg_idx in range(bg_count):
+ background_indices.extend([element + (bg_idx * 4) for element in [0, 1, 2, 0, 2, 3]])
+
+ background_list = decoration_program.vertex_list_indexed(bg_count * 4, GL_TRIANGLES, background_indices,
+ layout.batch, layout.background_decoration_group,
+ position=('f', background_vertices),
+ colors=('Bn', background_colors),
+ rotation=('f', (rotation,) * 4),
+ anchor=('f', (anchor_x, anchor_y) * 4))
+ context.add_list(background_list)
+
+ if underline_vertices:
+ ul_count = len(underline_vertices) // 3
+ decoration_program = get_default_decoration_shader()
+ underline_list = decoration_program.vertex_list(ul_count, GL_LINES,
+ layout.batch, layout.foreground_decoration_group,
+ position=('f', underline_vertices),
+ colors=('Bn', underline_colors),
+ rotation=('f', (rotation,) * ul_count),
+ anchor=('f', (anchor_x, anchor_y) * ul_count))
+ context.add_list(underline_list)
+
+ def delete(self, layout):
+ pass
+
+ def get_point_in_box(self, position):
+ x = 0
+ for (kern, glyph) in self.glyphs:
+ if position == 0:
+ break
+ position -= 1
+ x += glyph.advance + kern
+ return x
+
+ def get_position_in_box(self, x):
+ position = 0
+ last_glyph_x = 0
+ for kern, glyph in self.glyphs:
+ last_glyph_x += kern
+ if last_glyph_x + glyph.advance // 2 > x:
+ return position
+ position += 1
+ last_glyph_x += glyph.advance
+ return position
+
+ def __repr__(self):
+ return f'_GlyphBox({self.glyphs})'
+
+
+class _InlineElementBox(_AbstractBox):
+ def __init__(self, element):
+ """Create a glyph run holding a single element.
+ """
+ super().__init__(element.ascent, element.descent, element.advance, 1)
+ self.element = element
+ self.placed = False
+
+ def place(self, layout, i, x, y, z, rotation, anchor_x, anchor_y, context):
+ self.element.place(layout, x, y, z)
+ self.placed = True
+ context.add_box(self)
+
+ def delete(self, layout):
+ # font == element
+ if self.placed:
+ self.element.remove(layout)
+ self.placed = False
+
+ def get_point_in_box(self, position):
+ if position == 0:
+ return 0
+ else:
+ return self.advance
+
+ def get_position_in_box(self, x):
+ if x < self.advance // 2:
+ return 0
+ else:
+ return 1
+
+ def __repr__(self):
+ return f'_InlineElementBox({self.element})'
+
+
+class _InvalidRange:
+ # Used by the IncrementalTextLayout
+
+ def __init__(self):
+ self.start = sys.maxsize
+ self.end = 0
+
+ def insert(self, start, length):
+ if self.start >= start:
+ self.start += length
+ if self.end >= start:
+ self.end += length
+ self.invalidate(start, start + length)
+
+ def delete(self, start, end):
+ if self.start > end:
+ self.start -= end - start
+ elif self.start > start:
+ self.start = start
+ if self.end > end:
+ self.end -= end - start
+ elif self.end > start:
+ self.end = start
+
+ def invalidate(self, start, end):
+ if end <= start:
+ return
+ self.start = min(self.start, start)
+ self.end = max(self.end, end)
+
+ def validate(self):
+ start, end = self.start, self.end
+ self.start = sys.maxsize
+ self.end = 0
+ return start, end
+
+ def is_invalid(self):
+ return self.end > self.start
+
+
+layout_vertex_source = """#version 330 core
+ in vec3 position;
+ in vec4 colors;
+ in vec3 tex_coords;
+ in vec3 translation;
+ in vec2 anchor;
+ in float rotation;
+
+ out vec4 text_colors;
+ out vec2 texture_coords;
+ out vec4 vert_position;
+
+ uniform WindowBlock
+ {
+ mat4 projection;
+ mat4 view;
+ } window;
+
+ mat4 m_rotation = mat4(1.0);
+ mat4 m_anchor = mat4(1.0);
+ mat4 m_neganchor = mat4(1.0);
+
+ void main()
+ {
+ m_anchor[3][0] = anchor.x;
+ m_anchor[3][1] = anchor.y;
+ m_neganchor[3][0] = -anchor.x;
+ m_neganchor[3][1] = -anchor.y;
+ m_rotation[0][0] = cos(-radians(rotation));
+ m_rotation[0][1] = sin(-radians(rotation));
+ m_rotation[1][0] = -sin(-radians(rotation));
+ m_rotation[1][1] = cos(-radians(rotation));
+
+ gl_Position = window.projection * window.view * m_anchor * m_rotation * m_neganchor * vec4(position + translation, 1.0);
+
+ vert_position = vec4(position + translation, 1.0);
+ text_colors = colors;
+ texture_coords = tex_coords.xy;
+ }
+"""
+
+layout_fragment_source = """#version 330 core
+ in vec4 text_colors;
+ in vec2 texture_coords;
+ in vec4 vert_position;
+
+ out vec4 final_colors;
+
+ uniform sampler2D text;
+ uniform bool scissor;
+ uniform vec4 scissor_area;
+
+ void main()
+ {
+ final_colors = vec4(text_colors.rgb, texture(text, texture_coords).a * text_colors.a);
+ if (scissor == true) {
+ if (vert_position.x < scissor_area[0]) discard; // left
+ if (vert_position.y < scissor_area[1]) discard; // bottom
+ if (vert_position.x > scissor_area[0] + scissor_area[2]) discard; // right
+ if (vert_position.y > scissor_area[1] + scissor_area[3]) discard; // top
+ }
+ }
+"""
+
+layout_fragment_image_source = """#version 330 core
+ in vec4 text_colors;
+ in vec2 texture_coords;
+ in vec4 vert_position;
+
+ uniform sampler2D image_texture;
+
+ out vec4 final_colors;
+
+ uniform sampler2D text;
+ uniform bool scissor;
+ uniform vec4 scissor_area;
+
+ void main()
+ {
+ final_colors = texture(image_texture, texture_coords.xy);
+ if (scissor == true) {
+ if (vert_position.x < scissor_area[0]) discard; // left
+ if (vert_position.y < scissor_area[1]) discard; // bottom
+ if (vert_position.x > scissor_area[0] + scissor_area[2]) discard; // right
+ if (vert_position.y > scissor_area[1] + scissor_area[3]) discard; // top
+ }
+ }
+"""
+
+decoration_vertex_source = """#version 330 core
+ in vec3 position;
+ in vec4 colors;
+ in vec3 translation;
+ in vec2 anchor;
+ in float rotation;
+
+ out vec4 vert_colors;
+ out vec4 vert_position;
+
+ uniform WindowBlock
+ {
+ mat4 projection;
+ mat4 view;
+ } window;
+
+ mat4 m_rotation = mat4(1.0);
+ mat4 m_anchor = mat4(1.0);
+ mat4 m_neganchor = mat4(1.0);
+
+ void main()
+ {
+ m_anchor[3][0] = anchor.x;
+ m_anchor[3][1] = anchor.y;
+ m_neganchor[3][0] = -anchor.x;
+ m_neganchor[3][1] = -anchor.y;
+ m_rotation[0][0] = cos(-radians(rotation));
+ m_rotation[0][1] = sin(-radians(rotation));
+ m_rotation[1][0] = -sin(-radians(rotation));
+ m_rotation[1][1] = cos(-radians(rotation));
+
+ gl_Position = window.projection * window.view * m_anchor * m_rotation * m_neganchor * vec4(position + translation, 1.0);
+
+ vert_position = vec4(position + translation, 1.0);
+ vert_colors = colors;
+ }
+"""
+
+decoration_fragment_source = """#version 330 core
+ in vec4 vert_colors;
+ in vec4 vert_position;
+
+ out vec4 final_colors;
+
+ uniform bool scissor;
+ uniform vec4 scissor_area;
+
+ void main()
+ {
+ final_colors = vert_colors;
+ if (scissor == true) {
+ if (vert_position.x < scissor_area[0]) discard; // left
+ if (vert_position.y < scissor_area[1]) discard; // bottom
+ if (vert_position.x > scissor_area[0] + scissor_area[2]) discard; // right
+ if (vert_position.y > scissor_area[1] + scissor_area[3]) discard; // top
+ }
+ }
+"""
+
+
+def get_default_layout_shader():
+ try:
+ return pyglet.gl.current_context.pyglet_text_layout_shader
+ except AttributeError:
+ pyglet.gl.current_context.pyglet_text_layout_shader = shader.ShaderProgram(
+ shader.Shader(layout_vertex_source, 'vertex'),
+ shader.Shader(layout_fragment_source, 'fragment'),
+ )
+ return pyglet.gl.current_context.pyglet_text_layout_shader
+
+
+def get_default_image_layout_shader():
+ try:
+ return pyglet.gl.current_context.pyglet_text_layout_image_shader
+ except AttributeError:
+ pyglet.gl.current_context.pyglet_text_layout_image_shader = shader.ShaderProgram(
+ shader.Shader(layout_vertex_source, 'vertex'),
+ shader.Shader(layout_fragment_image_source, 'fragment'),
+ )
+ return pyglet.gl.current_context.pyglet_text_layout_image_shader
+
+
+def get_default_decoration_shader():
+ try:
+ return pyglet.gl.current_context.pyglet_text_decoration_shader
+ except AttributeError:
+ pyglet.gl.current_context.pyglet_text_decoration_shader = shader.ShaderProgram(
+ shader.Shader(decoration_vertex_source, 'vertex'),
+ shader.Shader(decoration_fragment_source, 'fragment'),
+ )
+ return pyglet.gl.current_context.pyglet_text_decoration_shader
+
+
+class TextLayoutGroup(graphics.Group):
+ def __init__(self, texture, program, order=1, parent=None):
+ """Create a text layout rendering group.
+
+ The group is created internally when a :py:class:`~pyglet.text.Label`
+ is created; applications usually do not need to explicitly create it.
+ """
+ super().__init__(order=order, parent=parent)
+ self.texture = texture
+ self.program = program
+
+ def set_state(self):
+ self.program.use()
+ self.program['scissor'] = False
+
+ glActiveTexture(GL_TEXTURE0)
+ glBindTexture(self.texture.target, self.texture.id)
+
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+
+ def unset_state(self):
+ glDisable(GL_BLEND)
+ self.program.stop()
+
+ def __repr__(self):
+ return "{0}({1})".format(self.__class__.__name__, self.texture)
+
+ def __eq__(self, other):
+ return (other.__class__ is self.__class__ and
+ self.parent is other.parent and
+ self.program.id is other.program.id and
+ self.order == other.order and
+ self.texture.target == other.texture.target and
+ self.texture.id == other.texture.id)
+
+ def __hash__(self):
+ return hash((id(self.parent), self.program.id, self.order, self.texture.target, self.texture.id))
+
+
+class ScrollableTextLayoutGroup(graphics.Group):
+ scissor_area = 0, 0, 0, 0
+
+ def __init__(self, texture, program, order=1, parent=None):
+ """Default rendering group for :py:class:`~pyglet.text.layout.ScrollableTextLayout`.
+
+ The group maintains internal state for specifying the viewable
+ area, and for scrolling. Because the group has internal state
+ specific to the text layout, the group is never shared.
+ """
+ super().__init__(order=order, parent=parent)
+ self.texture = texture
+ self.program = program
+
+ def set_state(self):
+ self.program.use()
+ self.program['scissor'] = True
+ self.program['scissor_area'] = self.scissor_area
+
+ glActiveTexture(GL_TEXTURE0)
+ glBindTexture(self.texture.target, self.texture.id)
+
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+
+ def unset_state(self):
+ glDisable(GL_BLEND)
+ self.program.stop()
+
+ def __repr__(self):
+ return f"{self.__class__.__name__}({self.texture})"
+
+ def __eq__(self, other):
+ return self is other
+
+ def __hash__(self):
+ return id(self)
+
+
+class IncrementalTextLayoutGroup(ScrollableTextLayoutGroup):
+ # Subclass so that the scissor_area isn't shared with the
+ # ScrollableTextLayout. We use a class variable here so
+ # that it can be set before the document glyphs are created.
+ scissor_area = 0, 0, 0, 0
+
+
+class TextDecorationGroup(graphics.Group):
+ def __init__(self, program, order=0, parent=None):
+ """Create a text decoration rendering group.
+
+ The group is created internally when a :py:class:`~pyglet.text.Label`
+ is created; applications usually do not need to explicitly create it.
+ """
+ super().__init__(order=order, parent=parent)
+ self.program = program
+
+ def set_state(self):
+ self.program.use()
+ self.program['scissor'] = False
+
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+
+ def unset_state(self):
+ glDisable(GL_BLEND)
+ self.program.stop()
+
+
+class ScrollableTextDecorationGroup(graphics.Group):
+ scissor_area = 0, 0, 0, 0
+
+ def __init__(self, program, order=0, parent=None):
+ """Create a text decoration rendering group.
+
+ The group is created internally when a :py:class:`~pyglet.text.Label`
+ is created; applications usually do not need to explicitly create it.
+ """
+ super().__init__(order=order, parent=parent)
+ self.program = program
+
+ def set_state(self):
+ self.program.use()
+ self.program['scissor'] = True
+ self.program['scissor_area'] = self.scissor_area
+
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+
+ def unset_state(self):
+ glDisable(GL_BLEND)
+ self.program.stop()
+
+ def __repr__(self):
+ return f"{self.__class__.__name__}(scissor={self.scissor_area})"
+
+ def __eq__(self, other):
+ return self is other
+
+ def __hash__(self):
+ return id(self)
+
+
+class IncrementalTextDecorationGroup(ScrollableTextDecorationGroup):
+ # Subclass so that the scissor_area isn't shared with the
+ # ScrollableTextDecorationGroup. We use a class variable here so
+ # that it can be set before the document glyphs are created.
+ scissor_area = 0, 0, 0, 0
+
+
+# ####################
+
+
+class TextLayout:
+ """Lay out and display documents.
+
+ This class is intended for displaying documents that do not change
+ regularly -- any change will cost some time to lay out the complete
+ document again and regenerate all vertex lists.
+
+ The benefit of this class is that texture state is shared between
+ all layouts of this class. The time to draw one :py:func:`~pyglet.text.layout.TextLayout` may be
+ roughly the same as the time to draw one :py:class:`~pyglet.text.layout.IncrementalTextLayout`; but
+ drawing ten :py:func:`~pyglet.text.layout.TextLayout` objects in one batch is much faster than drawing
+ ten incremental or scrollable text layouts.
+
+ :py:func:`~pyglet.text.Label` and :py:func:`~pyglet.text.HTMLLabel` provide a convenient interface to this class.
+
+ :Ivariables:
+ `content_width` : int
+ Calculated width of the text in the layout. This may overflow
+ the desired width if word-wrapping failed.
+ `content_height` : int
+ Calculated height of the text in the layout.
+ `group_class` : `~pyglet.graphics.Group`
+ Top-level rendering group.
+ `background_decoration_group` : `~pyglet.graphics.Group`
+ Rendering group for background color.
+ `foreground_decoration_group` : `~pyglet.graphics.Group`
+ Rendering group for glyph underlines.
+
+ """
+ _document = None
+ _vertex_lists = []
+ _boxes = []
+
+ _update_enabled = True
+ _own_batch = False
+ group_class = TextLayoutGroup
+ decoration_class = TextDecorationGroup
+
+ _x = 0
+ _y = 0
+ _z = 0
+ _rotation = 0
+ _width = None
+ _height = None
+ _anchor_x = 'left'
+ _anchor_y = 'bottom'
+ _content_valign = 'top'
+ _multiline = False
+ _visible = True
+
+ def __init__(self, document, width=None, height=None,
+ multiline=False, dpi=None, batch=None, group=None,
+ wrap_lines=True):
+ """Create a text layout.
+
+ :Parameters:
+ `document` : `AbstractDocument`
+ Document to display.
+ `width` : int
+ Width of the layout in pixels, or None
+ `height` : int
+ Height of the layout in pixels, or None
+ `multiline` : bool
+ If False, newline and paragraph characters are ignored, and
+ text is not word-wrapped.
+ If True, text is wrapped only if the `wrap_lines` is True.
+ `dpi` : float
+ Font resolution; defaults to 96.
+ `batch` : `~pyglet.graphics.Batch`
+ Optional graphics batch to add this layout to.
+ `group` : `~pyglet.graphics.Group`
+ Optional Group to parent all internal Groups that this text
+ layout uses. Note that layouts with the same Groups will
+ be rendered simultaneously in a Batch.
+ `wrap_lines` : bool
+ If True and `multiline` is True, the text is word-wrapped using
+ the specified width.
+
+ """
+ self.content_width = 0
+ self.content_height = 0
+
+ self._user_group = group
+ self.group_cache = {}
+ self._initialize_groups()
+
+ if batch is None:
+ batch = graphics.Batch()
+ self._own_batch = True
+ self._batch = batch
+
+ self._width = width
+ self._height = height
+ self._multiline = multiline
+
+ self._wrap_lines_flag = wrap_lines
+ self._wrap_lines_invariant()
+
+ self._dpi = dpi or 96
+ self.document = document
+
+ @property
+ def _flow_glyphs(self):
+ if self._multiline:
+ return self._flow_glyphs_wrap
+ else:
+ return self._flow_glyphs_single_line
+
+ def _initialize_groups(self):
+ decoration_shader = get_default_decoration_shader()
+ self.background_decoration_group = self.decoration_class(decoration_shader, order=0, parent=self._user_group)
+ self.foreground_decoration_group = self.decoration_class(decoration_shader, order=2, parent=self._user_group)
+
+ @property
+ def group(self):
+ return self._user_group
+
+ @group.setter
+ def group(self, group):
+ self._user_group = group
+ self._initialize_groups()
+ self._update()
+
+ @property
+ def dpi(self):
+ """Get DPI used by this layout.
+
+ :type: float
+ """
+ return self._dpi
+
+ @property
+ def document(self):
+ """Document to display.
+
+ For :py:class:`~pyglet.text.layout.IncrementalTextLayout` it is
+ far more efficient to modify a document in-place than to replace
+ the document instance on the layout.
+
+ :type: `AbstractDocument`
+ """
+ return self._document
+
+ @document.setter
+ def document(self, document):
+ if self._document:
+ self._document.remove_handlers(self)
+ self._uninit_document()
+ document.push_handlers(self)
+ self._document = document
+ self._init_document()
+
+ @property
+ def batch(self):
+ """The Batch that this Layout is assigned to.
+
+ If no Batch is assigned, an internal Batch is
+ created and used.
+
+ :type: :py:class:`~pyglet.graphics.Batch`
+
+ """
+ return self._batch
+
+ @batch.setter
+ def batch(self, batch):
+ if self._batch == batch:
+ return
+
+ if batch is None:
+ self._batch = graphics.Batch()
+ self._own_batch = True
+ self._update()
+ elif batch is not None:
+ self._batch = batch
+ self._own_batch = False
+ self._update()
+
+ @property
+ def x(self):
+ """X coordinate of the layout.
+
+ See also :py:attr:`~pyglet.text.layout.TextLayout.anchor_x`.
+
+ :type: int
+ """
+ return self._x
+
+ @x.setter
+ def x(self, x):
+ self._set_x(x)
+
+ def _set_x(self, x):
+ if self._boxes:
+ self._x = x
+ self._update()
+ else:
+ dx = x - self._x
+ for vertex_list in self._vertex_lists:
+ vertices = vertex_list.position[:]
+ vertices[::3] = [x + dx for x in vertices[::3]]
+ vertex_list.position[:] = vertices
+ self._x = x
+
+ @property
+ def y(self):
+ """Y coordinate of the layout.
+
+ See also `anchor_y`.
+
+ :type: int
+ """
+ return self._y
+
+ @y.setter
+ def y(self, y):
+ self._set_y(y)
+
+ def _set_y(self, y):
+ if self._boxes:
+ self._y = y
+ self._update()
+ else:
+ dy = y - self._y
+ for vertex_list in self._vertex_lists:
+ vertices = vertex_list.position[:]
+ vertices[1::3] = [y + dy for y in vertices[1::3]]
+ vertex_list.position[:] = vertices
+ self._y = y
+
+ @property
+ def z(self):
+ """Z coordinate of the layout.
+
+ :type: int
+ """
+ return self._z
+
+ @z.setter
+ def z(self, z):
+ self._set_z(z)
+
+ def _set_z(self, z):
+ if self._boxes:
+ self._z = z
+ self._update()
+ else:
+ dz = z - self.z
+ for vertex_list in self._vertex_lists:
+ vertices = vertex_list.position[:]
+ vertices[2::3] = [z + dz for z in vertices[2::3]]
+ vertex_list.position[:] = vertices
+ self._z = z
+
+ @property
+ def rotation(self):
+ """Rotation of the layout.
+
+ :type: float
+ """
+ return self._rotation
+
+ @rotation.setter
+ def rotation(self, rotation):
+ self._set_rotation(rotation)
+
+ def _set_rotation(self, rotation):
+ self._rotation = rotation
+ self._update()
+
+ @property
+ def position(self):
+ """The (X, Y, Z) coordinates of the layout, as a tuple.
+
+ See also :py:attr:`~pyglet.text.layout.TextLayout.anchor_x`,
+ and :py:attr:`~pyglet.text.layout.TextLayout.anchor_y`.
+
+ :type: (int, int, int)
+ """
+ return self._x, self._y, self._z
+
+ @position.setter
+ def position(self, values):
+ x, y, z = values
+ if self._boxes:
+ self._x = x
+ self._y = y
+ self._z = z
+ self._update()
+ else:
+ dx = x - self._x
+ dy = y - self._y
+ dz = z - self._z
+ for vertex_list in self._vertex_lists:
+ vertices = vertex_list.position[:]
+ vertices[::3] = [x + dx for x in vertices[::3]]
+ vertices[1::3] = [y + dy for y in vertices[1::3]]
+ vertices[2::3] = [z + dz for z in vertices[2::3]]
+ vertex_list.position[:] = vertices
+ self._x = x
+ self._y = y
+ self._z = z
+
+ @property
+ def visible(self):
+ """True if the layout will be drawn.
+
+ :type: bool
+ """
+ return self._visible
+
+ @visible.setter
+ def visible(self, value):
+ if value != self._visible:
+ self._visible = value
+
+ if value:
+ self._update()
+ else:
+ self.delete()
+
+ @property
+ def width(self):
+ """Width of the layout.
+
+ This property has no effect if `multiline` is False or `wrap_lines` is False.
+
+ :type: int
+ """
+ return self._width
+
+ @width.setter
+ def width(self, width):
+ self._width = width
+ self._wrap_lines_invariant()
+ self._update()
+
+ @property
+ def height(self):
+ """Height of the layout.
+
+ :type: int
+ """
+ return self._height
+
+ @height.setter
+ def height(self, height):
+ self._height = height
+ self._update()
+
+ @property
+ def multiline(self):
+ """Set if multiline layout is enabled.
+
+ If multiline is False, newline and paragraph characters are ignored and
+ text is not word-wrapped.
+ If True, the text is word-wrapped only if the `wrap_lines` is True.
+
+ :type: bool
+ """
+ return self._multiline
+
+ @multiline.setter
+ def multiline(self, multiline):
+ self._multiline = multiline
+ self._wrap_lines_invariant()
+ self._update()
+
+ @property
+ def anchor_x(self):
+ """Horizontal anchor alignment.
+
+ This property determines the meaning of the `x` coordinate.
+ It is one of the enumerants:
+
+ ``"left"`` (default)
+ The X coordinate gives the position of the left edge of the layout.
+ ``"center"``
+ The X coordinate gives the position of the center of the layout.
+ ``"right"``
+ The X coordinate gives the position of the right edge of the layout.
+
+ For the purposes of calculating the position resulting from this
+ alignment, the width of the layout is taken to be `width` if `multiline`
+ is True and `wrap_lines` is True, otherwise `content_width`.
+
+ :type: str
+ """
+ return self._anchor_x
+
+ @anchor_x.setter
+ def anchor_x(self, anchor_x):
+ self._anchor_x = anchor_x
+ self._update()
+
+ @property
+ def anchor_y(self):
+ """Vertical anchor alignment.
+
+ This property determines the meaning of the `y` coordinate.
+ It is one of the enumerants:
+
+ ``"top"``
+ The Y coordinate gives the position of the top edge of the layout.
+ ``"center"``
+ The Y coordinate gives the position of the center of the layout.
+ ``"baseline"``
+ The Y coordinate gives the position of the baseline of the first
+ line of text in the layout.
+ ``"bottom"`` (default)
+ The Y coordinate gives the position of the bottom edge of the layout.
+
+ For the purposes of calculating the position resulting from this
+ alignment, the height of the layout is taken to be the smaller of
+ `height` and `content_height`.
+
+ See also `content_valign`.
+
+ :type: str
+ """
+ return self._anchor_y
+
+ @anchor_y.setter
+ def anchor_y(self, anchor_y):
+ self._anchor_y = anchor_y
+ self._update()
+
+ @property
+ def content_valign(self):
+ """Vertical alignment of content within larger layout box.
+
+ This property determines how content is positioned within the layout
+ box when ``content_height`` is less than ``height``. It is one
+ of the enumerants:
+
+ ``top`` (default)
+ Content is aligned to the top of the layout box.
+ ``center``
+ Content is centered vertically within the layout box.
+ ``bottom``
+ Content is aligned to the bottom of the layout box.
+
+ This property has no effect when ``content_height`` is greater
+ than ``height`` (in which case the content is aligned to the top) or when
+ ``height`` is ``None`` (in which case there is no vertical layout box
+ dimension).
+
+ :type: str
+ """
+ return self._content_valign
+
+ @content_valign.setter
+ def content_valign(self, content_valign):
+ self._content_valign = content_valign
+ self._update()
+
+ def _wrap_lines_invariant(self):
+ self._wrap_lines = self._multiline and self._wrap_lines_flag
+ assert not self._wrap_lines or self._width, \
+ "When the parameters 'multiline' and 'wrap_lines' are True, the parameter 'width' must be a number."
+
+ def parse_distance(self, distance):
+ if distance is None:
+ return None
+ return _parse_distance(distance, self._dpi)
+
+ def begin_update(self):
+ """Indicate that a number of changes to the layout or document
+ are about to occur.
+
+ Changes to the layout or document between calls to `begin_update` and
+ `end_update` do not trigger any costly relayout of text. Relayout of
+ all changes is performed when `end_update` is called.
+
+ Note that between the `begin_update` and `end_update` calls, values
+ such as `content_width` and `content_height` are undefined (i.e., they
+ may or may not be updated to reflect the latest changes).
+ """
+ self._update_enabled = False
+
+ def end_update(self):
+ """Perform pending layout changes since `begin_update`.
+
+ See `begin_update`.
+ """
+ self._update_enabled = True
+ self._update()
+
+ def delete(self):
+ """Remove this layout from its batch.
+ """
+ for vertex_list in self._vertex_lists:
+ vertex_list.delete()
+ self._vertex_lists.clear()
+
+ for box in self._boxes:
+ box.delete(self)
+ self._boxes.clear()
+
+ def draw(self):
+ """Draw this text layout.
+
+ Note that this method performs very badly if a batch was supplied to
+ the constructor. If you add this layout to a batch, you should
+ ideally use only the batch's draw method.
+ """
+ if self._own_batch:
+ self._batch.draw()
+ else:
+ self._batch.draw_subset(self._vertex_lists)
+
+ def _get_lines(self):
+ len_text = len(self._document.text)
+ glyphs = self._get_glyphs()
+ owner_runs = runlist.RunList(len_text, None)
+ self._get_owner_runs(owner_runs, glyphs, 0, len_text)
+ lines = [line for line in self._flow_glyphs(glyphs, owner_runs, 0, len_text)]
+ self.content_width = 0
+ self._flow_lines(lines, 0, len(lines))
+ return lines
+
+ def _update(self):
+ if not self._update_enabled:
+ return
+
+ for _vertex_list in self._vertex_lists:
+ _vertex_list.delete()
+ for box in self._boxes:
+ box.delete(self)
+ self._vertex_lists = []
+ self._boxes = []
+ self.group_cache.clear()
+
+ if not self._document or not self._document.text:
+ return
+
+ lines = self._get_lines()
+
+ colors_iter = self._document.get_style_runs('color')
+ background_iter = self._document.get_style_runs('background_color')
+
+ left = self._get_left()
+ top = self._get_top(lines)
+
+ context = _StaticLayoutContext(self, self._document, colors_iter, background_iter)
+ for line in lines:
+ self._create_vertex_lists(left + line.x, top + line.y, self._z, line.start, line.boxes, context)
+
+ def _update_color(self):
+ colors_iter = self._document.get_style_runs('color')
+ colors = []
+ for start, end, color in colors_iter.ranges(0, colors_iter.end):
+ if color is None:
+ color = (0, 0, 0, 255)
+ colors.extend(color * ((end - start) * 4))
+
+ start = 0
+ for _vertex_list in self._vertex_lists:
+ _vertex_list.colors = colors[start:start + len(_vertex_list.colors)]
+ start += len(_vertex_list.colors)
+
+ def _get_left(self):
+ if self._multiline:
+ width = self._width if self._wrap_lines else self.content_width
+ else:
+ width = self.content_width
+
+ if self._anchor_x == 'left':
+ return self._x
+ elif self._anchor_x == 'center':
+ return self._x - width // 2
+ elif self._anchor_x == 'right':
+ return self._x - width
+ else:
+ assert False, '`anchor_x` must be either "left", "center", or "right".'
+
+ def _get_top(self, lines):
+ if self._height is None:
+ height = self.content_height
+ offset = 0
+ else:
+ height = self._height
+ if self._content_valign == 'top':
+ offset = 0
+ elif self._content_valign == 'bottom':
+ offset = max(0, self._height - self.content_height)
+ elif self._content_valign == 'center':
+ offset = max(0, self._height - self.content_height) // 2
+ else:
+ assert False, '`content_valign` must be either "top", "bottom", or "center".'
+
+ if self._anchor_y == 'top':
+ return self._y - offset
+ elif self._anchor_y == 'baseline':
+ return self._y + lines[0].ascent - offset
+ elif self._anchor_y == 'bottom':
+ return self._y + height - offset
+ elif self._anchor_y == 'center':
+ if len(lines) == 1 and self._height is None:
+ # This "looks" more centered than considering all of the descent.
+ line = lines[0]
+ return self._y + line.ascent // 2 - line.descent // 4
+ else:
+ return self._y + height // 2 - offset
+ else:
+ assert False, '`anchor_y` must be either "top", "bottom", "center", or "baseline".'
+
+ def _get_bottom(self, lines):
+ height = self._height or self.content_height
+
+ if self._anchor_y == 'top':
+ return self._y - height
+ elif self._anchor_y == 'bottom':
+ return self._y
+ elif self._anchor_y == 'center':
+ return self._y - height // 2
+ elif self._anchor_y == 'baseline':
+ return self._y - height + lines[0].ascent
+ else:
+ assert False, '`anchor_y` must be either "top", "bottom", "center", or "baseline".'
+
+ def _init_document(self):
+ self._update()
+
+ def _uninit_document(self):
+ pass
+
+ def on_insert_text(self, start, text):
+ """Event handler for `AbstractDocument.on_insert_text`.
+
+ The event handler is bound by the text layout; there is no need for
+ applications to interact with this method.
+ """
+ if self._visible:
+ self._init_document()
+ else:
+ if self.document.text:
+ # Update content width and height, since text may change while hidden.
+ self._get_lines()
+
+ def on_delete_text(self, start, end):
+ """Event handler for `AbstractDocument.on_delete_text`.
+
+ The event handler is bound by the text layout; there is no need for
+ applications to interact with this method.
+ """
+ if self._visible:
+ self._init_document()
+
+ def on_style_text(self, start, end, attributes):
+ """Event handler for `AbstractDocument.on_style_text`.
+
+ The event handler is bound by the text layout; there is no need for
+ applications to interact with this method.
+ """
+ if len(attributes) == 1 and 'color' in attributes.keys():
+ self._update_color()
+ else:
+ self._init_document()
+
+ def _get_glyphs(self):
+ glyphs = []
+ runs = runlist.ZipRunIterator((
+ self._document.get_font_runs(dpi=self._dpi),
+ self._document.get_element_runs()))
+ text = self._document.text
+ for start, end, (font, element) in runs.ranges(0, len(text)):
+ if element:
+ glyphs.append(_InlineElementBox(element))
+ else:
+ glyphs.extend(font.get_glyphs(text[start:end]))
+ return glyphs
+
+ def _get_owner_runs(self, owner_runs, glyphs, start, end):
+ owner = glyphs[start].owner
+ run_start = start
+ # TODO avoid glyph slice on non-incremental
+ for i, glyph in enumerate(glyphs[start:end]):
+ if owner != glyph.owner:
+ owner_runs.set_run(run_start, i + start, owner)
+ owner = glyph.owner
+ run_start = i + start
+ owner_runs.set_run(run_start, end, owner)
+
+ def _flow_glyphs_wrap(self, glyphs, owner_runs, start, end):
+ """Word-wrap styled text into lines of fixed width.
+
+ Fits `glyphs` in range `start` to `end` into `_Line` s which are
+ then yielded.
+ """
+ owner_iterator = owner_runs.get_run_iterator().ranges(start, end)
+
+ font_iterator = self._document.get_font_runs(dpi=self._dpi)
+
+ align_iterator = runlist.FilteredRunIterator(self._document.get_style_runs('align'),
+ lambda value: value in ('left', 'right', 'center'),
+ 'left')
+ if self._width is None:
+ wrap_iterator = runlist.ConstRunIterator(len(self.document.text), False)
+ else:
+ wrap_iterator = runlist.FilteredRunIterator(self._document.get_style_runs('wrap'),
+ lambda value: value in (True, False, 'char', 'word'),
+ True)
+ margin_left_iterator = runlist.FilteredRunIterator(self._document.get_style_runs('margin_left'),
+ lambda value: value is not None, 0)
+ margin_right_iterator = runlist.FilteredRunIterator(self._document.get_style_runs('margin_right'),
+ lambda value: value is not None, 0)
+ indent_iterator = runlist.FilteredRunIterator(self._document.get_style_runs('indent'),
+ lambda value: value is not None, 0)
+ kerning_iterator = runlist.FilteredRunIterator(self._document.get_style_runs('kerning'),
+ lambda value: value is not None, 0)
+ tab_stops_iterator = runlist.FilteredRunIterator(self._document.get_style_runs('tab_stops'),
+ lambda value: value is not None, [])
+ line = _Line(start)
+ line.align = align_iterator[start]
+ line.margin_left = self.parse_distance(margin_left_iterator[start])
+ line.margin_right = self.parse_distance(margin_right_iterator[start])
+ if start == 0 or self.document.text[start - 1] in u'\n\u2029':
+ line.paragraph_begin = True
+ line.margin_left += self.parse_distance(indent_iterator[start])
+ wrap = wrap_iterator[start]
+ if self._wrap_lines:
+ width = self._width - line.margin_left - line.margin_right
+
+ # Current right-most x position in line being laid out.
+ x = 0
+
+ # Boxes accumulated but not yet committed to a line.
+ run_accum = []
+ run_accum_width = 0
+
+ # Amount of whitespace accumulated at end of line
+ eol_ws = 0
+
+ # Iterate over glyph owners (texture states); these form GlyphBoxes,
+ # but broken into lines.
+ font = None
+ for start, end, owner in owner_iterator:
+ font = font_iterator[start]
+
+ # Glyphs accumulated in this owner but not yet committed to a
+ # line.
+ owner_accum = []
+ owner_accum_width = 0
+
+ # Glyphs accumulated in this owner AND also committed to the
+ # current line (some whitespace has followed all of the committed
+ # glyphs).
+ owner_accum_commit = []
+ owner_accum_commit_width = 0
+
+ # Ignore kerning of first glyph on each line
+ nokern = True
+
+ # Current glyph index
+ index = start
+
+ # Iterate over glyphs in this owner run. `text` is the
+ # corresponding character data for the glyph, and is used to find
+ # whitespace and newlines.
+ for (text, glyph) in zip(self.document.text[start:end], glyphs[start:end]):
+ if nokern:
+ kern = 0
+ nokern = False
+ else:
+ kern = self.parse_distance(kerning_iterator[index])
+
+ if wrap != 'char' and text in u'\u0020\u200b\t':
+ # Whitespace: commit pending runs to this line.
+ for run in run_accum:
+ line.add_box(run)
+ run_accum = []
+ run_accum_width = 0
+
+ if text == '\t':
+ # Fix up kern for this glyph to align to the next tab stop
+ for tab_stop in tab_stops_iterator[index]:
+ tab_stop = self.parse_distance(tab_stop)
+ if tab_stop > x + line.margin_left:
+ break
+ else:
+ # No more tab stops, tab to 100 pixels
+ tab = 50.
+ tab_stop = (((x + line.margin_left) // tab) + 1) * tab
+ kern = int(tab_stop - x - line.margin_left - glyph.advance)
+
+ owner_accum.append((kern, glyph))
+ owner_accum_commit.extend(owner_accum)
+ owner_accum_commit_width += owner_accum_width + glyph.advance + kern
+ eol_ws += glyph.advance + kern
+
+ owner_accum = []
+ owner_accum_width = 0
+
+ x += glyph.advance + kern
+ index += 1
+
+ # The index at which the next line will begin (the
+ # current index, because this is the current best
+ # breakpoint).
+ next_start = index
+ else:
+ new_paragraph = text in u'\n\u2029'
+ new_line = (text == u'\u2028') or new_paragraph
+ if (wrap and self._wrap_lines and x + kern + glyph.advance >= width) or new_line:
+ # Either the pending runs have overflowed the allowed
+ # line width or a newline was encountered. Either
+ # way, the current line must be flushed.
+
+ if new_line or wrap == 'char':
+ # Forced newline or char-level wrapping. Commit
+ # everything pending without exception.
+ for run in run_accum:
+ line.add_box(run)
+ run_accum = []
+ run_accum_width = 0
+ owner_accum_commit.extend(owner_accum)
+ owner_accum_commit_width += owner_accum_width
+ owner_accum = []
+ owner_accum_width = 0
+
+ line.length += 1
+ next_start = index
+ if new_line:
+ next_start += 1
+
+ # Create the _GlyphBox for the committed glyphs in the
+ # current owner.
+ if owner_accum_commit:
+ line.add_box(_GlyphBox(owner, font, owner_accum_commit, owner_accum_commit_width))
+ owner_accum_commit = []
+ owner_accum_commit_width = 0
+
+ if new_line and not line.boxes:
+ # Empty line: give it the current font's default
+ # line-height.
+ line.ascent = font.ascent
+ line.descent = font.descent
+
+ # Flush the line, unless nothing got committed, in
+ # which case it's a really long string of glyphs
+ # without any breakpoints (in which case it will be
+ # flushed at the earliest breakpoint, not before
+ # something is committed).
+ if line.boxes or new_line:
+ # Trim line width of whitespace on right-side.
+ line.width -= eol_ws
+ if new_paragraph:
+ line.paragraph_end = True
+ yield line
+ try:
+ line = _Line(next_start)
+ line.align = align_iterator[next_start]
+ line.margin_left = self.parse_distance(margin_left_iterator[next_start])
+ line.margin_right = self.parse_distance(margin_right_iterator[next_start])
+ except IndexError:
+ # XXX This used to throw StopIteration in some cases, causing the
+ # final part of this method not to be executed. Refactoring
+ # required to fix this
+ return
+ if new_paragraph:
+ line.paragraph_begin = True
+
+ # Remove kern from first glyph of line
+ if run_accum and hasattr(run_accum, 'glyphs') and run_accum.glyphs:
+ k, g = run_accum[0].glyphs[0]
+ run_accum[0].glyphs[0] = (0, g)
+ run_accum_width -= k
+ elif owner_accum:
+ k, g = owner_accum[0]
+ owner_accum[0] = (0, g)
+ owner_accum_width -= k
+ else:
+ nokern = True
+
+ x = run_accum_width + owner_accum_width
+ if self._wrap_lines:
+ width = self._width - line.margin_left - line.margin_right
+
+ if isinstance(glyph, _AbstractBox):
+ # Glyph is already in a box. XXX Ignore kern?
+ run_accum.append(glyph)
+ run_accum_width += glyph.advance
+ x += glyph.advance
+ elif new_paragraph:
+ # New paragraph started, update wrap style
+ wrap = wrap_iterator[next_start]
+ line.margin_left += self.parse_distance(indent_iterator[next_start])
+ if self._wrap_lines:
+ width = self._width - line.margin_left - line.margin_right
+ elif not new_line:
+ # If the glyph was any non-whitespace, non-newline
+ # character, add it to the pending run.
+ owner_accum.append((kern, glyph))
+ owner_accum_width += glyph.advance + kern
+ x += glyph.advance + kern
+ index += 1
+ eol_ws = 0
+
+ # The owner run is finished; create GlyphBoxes for the committed
+ # and pending glyphs.
+ if owner_accum_commit:
+ line.add_box(_GlyphBox(owner, font, owner_accum_commit, owner_accum_commit_width))
+ if owner_accum:
+ run_accum.append(_GlyphBox(owner, font, owner_accum, owner_accum_width))
+ run_accum_width += owner_accum_width
+
+ # All glyphs have been processed: commit everything pending and flush
+ # the final line.
+ for run in run_accum:
+ line.add_box(run)
+
+ if not line.boxes:
+ # Empty line gets font's line-height
+ if font is None:
+ font = self._document.get_font(0, dpi=self._dpi)
+ line.ascent = font.ascent
+ line.descent = font.descent
+
+ yield line
+
+ def _flow_glyphs_single_line(self, glyphs, owner_runs, start, end):
+ owner_iterator = owner_runs.get_run_iterator().ranges(start, end)
+ font_iterator = self.document.get_font_runs(dpi=self._dpi)
+ kern_iterator = runlist.FilteredRunIterator(self.document.get_style_runs('kerning'),
+ lambda value: value is not None, 0)
+
+ line = _Line(start)
+ font = font_iterator[0]
+
+ if self._width:
+ align_iterator = runlist.FilteredRunIterator(
+ self._document.get_style_runs('align'),
+ lambda value: value in ('left', 'right', 'center'),
+ 'left')
+ line.align = align_iterator[start]
+
+ for start, end, owner in owner_iterator:
+ font = font_iterator[start]
+ width = 0
+ owner_glyphs = []
+ for kern_start, kern_end, kern in kern_iterator.ranges(start, end):
+ gs = glyphs[kern_start:kern_end]
+ width += sum([g.advance for g in gs])
+ width += kern * (kern_end - kern_start)
+ owner_glyphs.extend(zip([kern] * (kern_end - kern_start), gs))
+ if owner is None:
+ # Assume glyphs are already boxes.
+ for kern, glyph in owner_glyphs:
+ line.add_box(glyph)
+ else:
+ line.add_box(_GlyphBox(owner, font, owner_glyphs, width))
+
+ if not line.boxes:
+ line.ascent = font.ascent
+ line.descent = font.descent
+
+ line.paragraph_begin = line.paragraph_end = True
+
+ yield line
+
+ def _flow_lines(self, lines, start, end):
+ margin_top_iterator = runlist.FilteredRunIterator(self._document.get_style_runs('margin_top'),
+ lambda value: value is not None, 0)
+ margin_bottom_iterator = runlist.FilteredRunIterator(self._document.get_style_runs('margin_bottom'),
+ lambda value: value is not None, 0)
+ line_spacing_iterator = self._document.get_style_runs('line_spacing')
+ leading_iterator = runlist.FilteredRunIterator(self._document.get_style_runs('leading'),
+ lambda value: value is not None, 0)
+
+ if start == 0:
+ y = 0
+ else:
+ line = lines[start - 1]
+ line_spacing = self.parse_distance(line_spacing_iterator[line.start])
+ leading = self.parse_distance(leading_iterator[line.start])
+
+ y = line.y
+ if line_spacing is None:
+ y += line.descent
+ if line.paragraph_end:
+ y -= self.parse_distance(margin_bottom_iterator[line.start])
+
+ line_index = start
+ for line in lines[start:]:
+ if line.paragraph_begin:
+ y -= self.parse_distance(margin_top_iterator[line.start])
+ line_spacing = self.parse_distance(line_spacing_iterator[line.start])
+ leading = self.parse_distance(leading_iterator[line.start])
+ else:
+ y -= leading
+
+ if line_spacing is None:
+ y -= line.ascent
+ else:
+ y -= line_spacing
+ if line.align == 'left' or line.width > self.width:
+ line.x = line.margin_left
+ elif line.align == 'center':
+ line.x = (self.width - line.margin_left - line.margin_right - line.width) // 2 + line.margin_left
+ elif line.align == 'right':
+ line.x = self.width - line.margin_right - line.width
+
+ self.content_width = max(self.content_width, line.width + line.margin_left)
+
+ if line.y == y and line_index >= end:
+ # Early exit: all invalidated lines have been reflowed and the
+ # next line has no change (therefore subsequent lines do not
+ # need to be changed).
+ break
+ line.y = y
+
+ if line_spacing is None:
+ y += line.descent
+ if line.paragraph_end:
+ y -= self.parse_distance(margin_bottom_iterator[line.start])
+
+ line_index += 1
+ else:
+ self.content_height = -y
+
+ return line_index
+
+ def _create_vertex_lists(self, x, y, z, i, boxes, context):
+ for box in boxes:
+ box.place(self, i, x, y, z, self._rotation, self._x, self._y, context)
+ x += box.advance
+ i += box.length
+
+
+class ScrollableTextLayout(TextLayout):
+ """Display text in a scrollable viewport.
+
+ This class does not display a scrollbar or handle scroll events; it merely
+ clips the text that would be drawn in :py:func:`~pyglet.text.layout.TextLayout`
+ to the bounds of the layout given by `x`, `y`, `width` and `height`;
+ and offsets the text by a scroll offset.
+
+ Use `view_x` and `view_y` to scroll the text within the viewport.
+ """
+
+ group_class = ScrollableTextLayoutGroup
+ decoration_class = ScrollableTextDecorationGroup
+
+ _translate_x = 0
+ _translate_y = 0
+
+ def __init__(self, document, width, height, multiline=False, dpi=None, batch=None, group=None, wrap_lines=True):
+ super().__init__(document, width, height, multiline, dpi, batch, group, wrap_lines)
+ self._update_scissor_area()
+
+ def _update_scissor_area(self):
+ if not self.document.text:
+ return
+ area = self._get_left(), self._get_bottom(self._get_lines()), self._width, self._height
+ for group in self.group_cache.values():
+ group.scissor_area = area
+
+ self.background_decoration_group.scissor_area = area
+ self.foreground_decoration_group.scissor_area = area
+
+ def _update(self):
+ super()._update()
+ self._update_scissor_area()
+
+ # Properties
+
+ @property
+ def x(self):
+ return self._x
+
+ @x.setter
+ def x(self, x):
+ super()._set_x(x)
+ self._update_scissor_area()
+
+ @property
+ def y(self):
+ return self._y
+
+ @y.setter
+ def y(self, y):
+ super()._set_y(y)
+ self._update_scissor_area()
+
+ @property
+ def position(self):
+ return self._x, self._y, self._z
+
+ @position.setter
+ def position(self, position):
+ self.x, self.y, self.z = position
+
+ @property
+ def anchor_x(self):
+ return self._anchor_x
+
+ @anchor_x.setter
+ def anchor_x(self, anchor_x):
+ self._anchor_x = anchor_x
+ super()._update()
+ self._update_scissor_area()
+
+ @property
+ def anchor_y(self):
+ return self._anchor_y
+
+ @anchor_y.setter
+ def anchor_y(self, anchor_y):
+ self._anchor_y = anchor_y
+ super()._update()
+ self._update_scissor_area()
+
+ # Offset of content within viewport
+
+ def _update_translation(self):
+ for _vertex_list in self._vertex_lists:
+ _vertex_list.translation[:] = (-self._translate_x, -self._translate_y, 0) * _vertex_list.count
+
+ @property
+ def view_x(self):
+ """Horizontal scroll offset.
+
+ The initial value is 0, and the left edge of the text will touch the left
+ side of the layout bounds. A positive value causes the text to "scroll"
+ to the right. Values are automatically clipped into the range
+ ``[0, content_width - width]``
+
+ :type: int
+ """
+ return self._translate_x
+
+ @view_x.setter
+ def view_x(self, view_x):
+ self._translate_x = max(0, min(self.content_width - self._width, view_x))
+ self._update_translation()
+
+ @property
+ def view_y(self):
+ """Vertical scroll offset.
+
+ The initial value is 0, and the top of the text will touch the top of the
+ layout bounds (unless the content height is less than the layout height,
+ in which case `content_valign` is used).
+
+ A negative value causes the text to "scroll" upwards. Values outside of
+ the range ``[height - content_height, 0]`` are automatically clipped in
+ range.
+
+ :type: int
+ """
+ return self._translate_y
+
+ @view_y.setter
+ def view_y(self, view_y):
+ # view_y must be negative.
+ self._translate_y = min(0, max(self.height - self.content_height, view_y))
+ self._update_translation()
+
+
+class IncrementalTextLayout(TextLayout, EventDispatcher):
+ """Displayed text suitable for interactive editing and/or scrolling
+ large documents.
+
+ Unlike :py:func:`~pyglet.text.layout.TextLayout` and
+ :py:class:`~pyglet.text.layout.ScrollableTextLayout`, this class generates
+ vertex lists only for lines of text that are visible. As the document is
+ scrolled, vertex lists are deleted and created as appropriate to keep
+ video memory usage to a minimum and improve rendering speed.
+
+ Changes to the document are quickly reflected in this layout, as only the
+ affected line(s) are reflowed. Use `begin_update` and `end_update` to
+ further reduce the amount of processing required.
+
+ The layout can also display a text selection (text with a different
+ background color). The :py:class:`~pyglet.text.caret.Caret` class implements
+ a visible text cursor and provides event handlers for scrolling, selecting and
+ editing text in an incremental text layout.
+ """
+
+ _selection_start = 0
+ _selection_end = 0
+ _selection_color = [255, 255, 255, 255]
+ _selection_background_color = [46, 106, 197, 255]
+
+ group_class = IncrementalTextLayoutGroup
+ decoration_class = IncrementalTextDecorationGroup
+
+ _translate_x = 0
+ _translate_y = 0
+
+ def __init__(self, document, width, height, multiline=False, dpi=None, batch=None, group=None, wrap_lines=True):
+
+ self.glyphs = []
+ self.lines = []
+
+ self.invalid_glyphs = _InvalidRange()
+ self.invalid_flow = _InvalidRange()
+ self.invalid_lines = _InvalidRange()
+ self.invalid_style = _InvalidRange()
+ self.invalid_vertex_lines = _InvalidRange()
+ self.visible_lines = _InvalidRange()
+
+ self.owner_runs = runlist.RunList(0, None)
+
+ super().__init__(document, width, height, multiline, dpi, batch, group, wrap_lines)
+ self._update_translation()
+ self._update_scissor_area()
+
+ def _update_scissor_area(self):
+ area = self._get_left(), self._get_bottom(self._get_lines()), self._width, self._height
+ for group in self.group_cache.values():
+ group.scissor_area = area
+ self.background_decoration_group.scissor_area = area
+ self.foreground_decoration_group.scissor_area = area
+
+ def _init_document(self):
+ assert self._document, 'Cannot remove document from IncrementalTextLayout'
+ self.on_insert_text(0, self._document.text)
+
+ def _uninit_document(self):
+ self.on_delete_text(0, len(self._document.text))
+
+ def _get_lines(self):
+ return self.lines
+
+ def delete(self):
+ for line in self.lines:
+ line.delete(self)
+ self._batch = None
+ if self._document:
+ self._document.remove_handlers(self)
+ self._document = None
+
+ def on_insert_text(self, start, text):
+ len_text = len(text)
+ self.glyphs[start:start] = [None] * len_text
+
+ self.invalid_glyphs.insert(start, len_text)
+ self.invalid_flow.insert(start, len_text)
+ self.invalid_style.insert(start, len_text)
+
+ self.owner_runs.insert(start, len_text)
+
+ for line in self.lines:
+ if line.start >= start:
+ line.start += len_text
+
+ self._update()
+
+ def on_delete_text(self, start, end):
+ self.glyphs[start:end] = []
+
+ self.invalid_glyphs.delete(start, end)
+ self.invalid_flow.delete(start, end)
+ self.invalid_style.delete(start, end)
+
+ self.owner_runs.delete(start, end)
+
+ size = end - start
+ for line in self.lines:
+ if line.start > start:
+ line.start = max(line.start - size, start)
+
+ if start == 0:
+ self.invalid_flow.invalidate(0, 1)
+ else:
+ self.invalid_flow.invalidate(start - 1, start)
+
+ self._update()
+
+ def on_style_text(self, start, end, attributes):
+ if 'font_name' in attributes or 'font_size' in attributes or 'bold' in attributes or 'italic' in attributes:
+ self.invalid_glyphs.invalidate(start, end)
+ elif 'color' in attributes or 'background_color' in attributes:
+ self.invalid_style.invalidate(start, end)
+ else: # Attributes that change flow
+ self.invalid_flow.invalidate(start, end)
+
+ self._update()
+
+ def _update(self):
+ if not self._update_enabled:
+ return
+
+ trigger_update_event = (self.invalid_glyphs.is_invalid() or
+ self.invalid_flow.is_invalid() or
+ self.invalid_lines.is_invalid())
+
+ len_groups = len(self.group_cache)
+ # Special care if there is no text:
+ if not self.glyphs:
+ for line in self.lines:
+ line.delete(self)
+ del self.lines[:]
+ self.lines.append(_Line(0))
+ font = self.document.get_font(0, dpi=self._dpi)
+ self.lines[0].ascent = font.ascent
+ self.lines[0].descent = font.descent
+ self.lines[0].paragraph_begin = self.lines[0].paragraph_end = True
+ self.invalid_lines.invalidate(0, 1)
+
+ self._update_glyphs()
+ self._update_flow_glyphs()
+ self._update_flow_lines()
+ self._update_visible_lines()
+ self._update_vertex_lists()
+
+ # Update group cache areas if the count has changed. Usually if it starts with no text.
+ # Group cache is only cleared in a regular TextLayout. May need revisiting if that changes.
+ if len_groups != len(self.group_cache):
+ self._update_scissor_area()
+
+ if trigger_update_event:
+ self.dispatch_event('on_layout_update')
+
+ def _update_glyphs(self):
+ invalid_start, invalid_end = self.invalid_glyphs.validate()
+
+ if invalid_end - invalid_start <= 0:
+ return
+
+ # Find grapheme breaks and extend glyph range to encompass.
+ text = self.document.text
+ while invalid_start > 0:
+ if grapheme_break(text[invalid_start - 1], text[invalid_start]):
+ break
+ invalid_start -= 1
+
+ len_text = len(text)
+ while invalid_end < len_text:
+ if grapheme_break(text[invalid_end - 1], text[invalid_end]):
+ break
+ invalid_end += 1
+
+ # Update glyphs
+ runs = runlist.ZipRunIterator((
+ self._document.get_font_runs(dpi=self._dpi),
+ self._document.get_element_runs()))
+ for start, end, (font, element) in runs.ranges(invalid_start, invalid_end):
+ if element:
+ self.glyphs[start] = _InlineElementBox(element)
+ else:
+ text = self.document.text[start:end]
+ self.glyphs[start:end] = font.get_glyphs(text)
+
+ # Update owner runs
+ self._get_owner_runs(self.owner_runs, self.glyphs, invalid_start, invalid_end)
+
+ # Updated glyphs need flowing
+ self.invalid_flow.invalidate(invalid_start, invalid_end)
+
+ def _update_flow_glyphs(self):
+ invalid_start, invalid_end = self.invalid_flow.validate()
+
+ if invalid_end - invalid_start <= 0:
+ return
+
+ # Find first invalid line
+ line_index = 0
+ for i, line in enumerate(self.lines):
+ if line.start >= invalid_start:
+ break
+ line_index = i
+
+ # Flow from previous line; fixes issue with adding a space into
+ # overlong line (glyphs before space would then flow back onto
+ # previous line).
+ # TODO: Could optimise this by keeping track of where the overlong lines are.
+ line_index = max(0, line_index - 1)
+
+ # (No need to find last invalid line; the update loop below stops
+ # calling the flow generator when no more changes are necessary.)
+
+ try:
+ line = self.lines[line_index]
+ invalid_start = min(invalid_start, line.start)
+ line.delete(self)
+ self.lines[line_index] = _Line(invalid_start)
+ self.invalid_lines.invalidate(line_index, line_index + 1)
+ except IndexError:
+ line_index = 0
+ invalid_start = 0
+ line = _Line(0)
+ self.lines.append(line)
+ self.invalid_lines.insert(0, 1)
+
+ content_width_invalid = False
+ next_start = invalid_start
+
+ for line in self._flow_glyphs(self.glyphs, self.owner_runs, invalid_start, len(self._document.text)):
+ try:
+ old_line = self.lines[line_index]
+ old_line.delete(self)
+ old_line_width = old_line.width + old_line.margin_left
+ new_line_width = line.width + line.margin_left
+ if old_line_width == self.content_width and new_line_width < old_line_width:
+ content_width_invalid = True
+ self.lines[line_index] = line
+ self.invalid_lines.invalidate(line_index, line_index + 1)
+ except IndexError:
+ self.lines.append(line)
+ self.invalid_lines.insert(line_index, 1)
+
+ next_start = line.start + line.length
+ line_index += 1
+
+ try:
+ next_line = self.lines[line_index]
+ if next_start == next_line.start and next_start > invalid_end:
+ # No more lines need to be modified, early exit.
+ break
+ except IndexError:
+ pass
+ else:
+ # The last line is at line_index - 1, if there are any more lines
+ # after that they are stale and need to be deleted.
+ if next_start == len(self._document.text) and line_index > 0:
+ for line in self.lines[line_index:]:
+ old_line_width = old_line.width + old_line.margin_left
+ if old_line_width == self.content_width:
+ content_width_invalid = True
+ line.delete(self)
+ del self.lines[line_index:]
+
+ if content_width_invalid:
+ # Rescan all lines to look for the new maximum content width
+ content_width = 0
+ for line in self.lines:
+ content_width = max(line.width + line.margin_left, content_width)
+ self.content_width = content_width
+
+ def _update_flow_lines(self):
+ invalid_start, invalid_end = self.invalid_lines.validate()
+ if invalid_end - invalid_start <= 0:
+ return
+
+ invalid_end = self._flow_lines(self.lines, invalid_start, invalid_end)
+
+ # Invalidate lines that need new vertex lists.
+ self.invalid_vertex_lines.invalidate(invalid_start, invalid_end)
+
+ def _update_visible_lines(self):
+ start = sys.maxsize
+ end = 0
+
+ for i, line in enumerate(self.lines):
+ if line.y + line.descent < self._translate_y:
+ start = min(start, i)
+ if line.y + line.ascent > self._translate_y - self.height:
+ end = max(end, i) + 1
+
+ # Delete newly invisible lines
+ for i in range(self.visible_lines.start, min(start, len(self.lines))):
+ self.lines[i].delete(self)
+ for i in range(end, min(self.visible_lines.end, len(self.lines))):
+ self.lines[i].delete(self)
+
+ # Invalidate newly visible lines
+ self.invalid_vertex_lines.invalidate(start, self.visible_lines.start)
+ self.invalid_vertex_lines.invalidate(self.visible_lines.end, end)
+
+ self.visible_lines.start = start
+ self.visible_lines.end = end
+
+ def _update_vertex_lists(self):
+ # Find lines that have been affected by style changes
+ style_invalid_start, style_invalid_end = self.invalid_style.validate()
+ self.invalid_vertex_lines.invalidate(
+ self.get_line_from_position(style_invalid_start),
+ self.get_line_from_position(style_invalid_end) + 1)
+
+ invalid_start, invalid_end = self.invalid_vertex_lines.validate()
+ if invalid_end - invalid_start <= 0:
+ return
+
+ colors_iter = self.document.get_style_runs('color')
+ background_iter = self.document.get_style_runs('background_color')
+ if self._selection_end - self._selection_start > 0:
+ colors_iter = runlist.OverriddenRunIterator(
+ colors_iter,
+ self._selection_start,
+ self._selection_end,
+ self._selection_color)
+ background_iter = runlist.OverriddenRunIterator(
+ background_iter,
+ self._selection_start,
+ self._selection_end,
+ self._selection_background_color)
+
+ context = _IncrementalLayoutContext(self, self._document, colors_iter, background_iter)
+
+ left = self._get_left()
+ top = self._get_top(self.lines[invalid_start:invalid_end])
+
+ for line in self.lines[invalid_start:invalid_end]:
+ line.delete(self)
+ context.line = line
+ y = line.y
+
+ # Early out if not visible
+ if y + line.descent > self._translate_y:
+ continue
+ elif y + line.ascent < self._translate_y - self.height:
+ break
+
+ self._create_vertex_lists(left + line.x, top + y, self._z, line.start, line.boxes, context)
+
+ @property
+ def x(self):
+ return self._x
+
+ @x.setter
+ def x(self, x):
+ self._x = x
+ self._uninit_document()
+ self._init_document()
+ self._update_scissor_area()
+
+ @property
+ def y(self):
+ return self._y
+
+ @y.setter
+ def y(self, y):
+ self._y = y
+ self._uninit_document()
+ self._init_document()
+ self._update_scissor_area()
+
+ @property
+ def position(self):
+ return self._x, self._y, self._z
+
+ @position.setter
+ def position(self, position):
+ self._x, self._y, self._z = position
+ self._uninit_document()
+ self._init_document()
+ self._update_scissor_area()
+
+ @property
+ def anchor_x(self):
+ return self._anchor_x
+
+ @anchor_x.setter
+ def anchor_x(self, anchor_x):
+ self._anchor_x = anchor_x
+ self._update_scissor_area()
+ self._init_document()
+
+ @property
+ def anchor_y(self):
+ return self._anchor_y
+
+ @anchor_y.setter
+ def anchor_y(self, anchor_y):
+ self._anchor_y = anchor_y
+ self._update_scissor_area()
+ self._init_document()
+
+ @property
+ def width(self):
+ return self._width
+
+ @width.setter
+ def width(self, width):
+ # Invalidate everything when width changes
+ if width == self._width:
+ return
+ self._width = width
+ self.invalid_flow.invalidate(0, len(self.document.text))
+ self._update_scissor_area()
+
+ @property
+ def height(self):
+ return self._height
+
+ @height.setter
+ def height(self, height):
+ # Recalculate visible lines when height changes
+ if height == self._height:
+ return
+ self._height = height
+ if self._update_enabled:
+ self._update_visible_lines()
+ self._update_vertex_lists()
+
+ @property
+ def multiline(self):
+ return self._multiline
+
+ @multiline.setter
+ def multiline(self, multiline):
+ self.invalid_flow.invalidate(0, len(self.document.text))
+ self._multiline = multiline
+ self._wrap_lines_invariant()
+ self._update()
+
+ def _set_rotation(self, rotation):
+ self._rotation = rotation
+ self.invalid_flow.invalidate(0, len(self.document.text))
+ self._update()
+
+ # Offset of content within viewport
+
+ def _update_translation(self):
+ for line in self.lines:
+ for vlist in line.vertex_lists:
+ vlist.translation[:] = (-self._translate_x, -self._translate_y, 0) * vlist.count
+
+ @property
+ def view_x(self):
+ """Horizontal scroll offset.
+
+ The initial value is 0, and the left edge of the text will touch the left
+ side of the layout bounds. A positive value causes the text to "scroll"
+ to the right. Values are automatically clipped into the range
+ ``[0, content_width - width]``
+
+ :type: int
+ """
+ return self._translate_x
+
+ @view_x.setter
+ def view_x(self, view_x):
+ self._translate_x = max(0, min(self.content_width - self._width, view_x))
+ self._update_translation()
+
+ @property
+ def view_y(self):
+ """Vertical scroll offset.
+
+ The initial value is 0, and the top of the text will touch the top of the
+ layout bounds (unless the content height is less than the layout height,
+ in which case `content_valign` is used).
+
+ A negative value causes the text to "scroll" upwards. Values outside of
+ the range ``[height - content_height, 0]`` are automatically clipped in
+ range.
+
+ :type: int
+ """
+ return self._translate_y
+
+ @view_y.setter
+ def view_y(self, view_y):
+ # Invalidate invisible/visible lines when y scrolls
+ # view_y must be negative.
+ self._translate_y = min(0, max(self.height - self.content_height, view_y))
+ self._update_translation()
+ self._update_visible_lines()
+ self._update_vertex_lists()
+
+ # Visible selection
+
+ def set_selection(self, start, end):
+ """Set the text selection range.
+
+ If ``start`` equals ``end`` no selection will be visible.
+
+ :Parameters:
+ `start` : int
+ Starting character position of selection.
+ `end` : int
+ End of selection, exclusive.
+
+ """
+ start = max(0, start)
+ end = min(end, len(self.document.text))
+ if start == self._selection_start and end == self._selection_end:
+ return
+
+ if end > self._selection_start and start < self._selection_end:
+ # Overlapping, only invalidate difference
+ self.invalid_style.invalidate(min(start, self._selection_start), max(start, self._selection_start))
+ self.invalid_style.invalidate(min(end, self._selection_end), max(end, self._selection_end))
+ else:
+ # Non-overlapping, invalidate both ranges
+ self.invalid_style.invalidate(self._selection_start, self._selection_end)
+ self.invalid_style.invalidate(start, end)
+
+ self._selection_start = start
+ self._selection_end = end
+
+ self._update()
+
+ @property
+ def selection_start(self):
+ """Starting position of the active selection.
+
+ :see: `set_selection`
+
+ :type: int
+ """
+ return self._selection_start
+
+ @selection_start.setter
+ def selection_start(self, start):
+ self.set_selection(start, self._selection_end)
+
+ @property
+ def selection_end(self):
+ """End position of the active selection (exclusive).
+
+ :see: `set_selection`
+
+ :type: int
+ """
+ return self._selection_end
+
+ @selection_end.setter
+ def selection_end(self, end):
+ self.set_selection(self._selection_start, end)
+
+ @property
+ def selection_color(self):
+ """Text color of active selection.
+
+ The color is an RGBA tuple with components in range [0, 255].
+
+ :type: (int, int, int, int)
+ """
+ return self._selection_color
+
+ @selection_color.setter
+ def selection_color(self, color):
+ self._selection_color = color
+ self.invalid_style.invalidate(self._selection_start, self._selection_end)
+
+ @property
+ def selection_background_color(self):
+ """Background color of active selection.
+
+ The color is an RGBA tuple with components in range [0, 255].
+
+ :type: (int, int, int, int)
+ """
+ return self._selection_background_color
+
+ @selection_background_color.setter
+ def selection_background_color(self, background_color):
+ self._selection_background_color = background_color
+ self.invalid_style.invalidate(self._selection_start, self._selection_end)
+
+ # Coordinate translation
+
+ def get_position_from_point(self, x, y):
+ """Get the closest document position to a point.
+
+ :Parameters:
+ `x` : int
+ X coordinate
+ `y` : int
+ Y coordinate
+
+ """
+ line = self.get_line_from_point(x, y)
+ return self.get_position_on_line(line, x)
+
+ def get_point_from_position(self, position, line=None):
+ """Get the X, Y coordinates of a position in the document.
+
+ The position that ends a line has an ambiguous point: it can be either
+ the end of the line, or the beginning of the next line. You may
+ optionally specify a line index to disambiguate the case.
+
+ The resulting Y coordinate gives the baseline of the line.
+
+ :Parameters:
+ `position` : int
+ Character position within document.
+ `line` : int
+ Line index.
+
+ :rtype: (int, int)
+ :return: (x, y)
+ """
+ if line is None:
+ line = self.lines[0]
+ for next_line in self.lines:
+ if next_line.start > position:
+ break
+ line = next_line
+ else:
+ line = self.lines[line]
+
+ x = line.x
+
+ baseline = self._document.get_style('baseline', max(0, position - 1))
+ if baseline is None:
+ baseline = 0
+ else:
+ baseline = self.parse_distance(baseline)
+
+ position -= line.start
+ for box in line.boxes:
+ if position - box.length <= 0:
+ x += box.get_point_in_box(position)
+ break
+ position -= box.length
+ x += box.advance
+
+ return x - self._translate_x, line.y + self._translate_y + baseline
+
+ def get_line_from_point(self, x, y):
+ """Get the closest line index to a point.
+
+ :Parameters:
+ `x` : int
+ X coordinate.
+ `y` : int
+ Y coordinate.
+
+ :rtype: int
+ """
+ x -= self._translate_x
+ y -= self._translate_y + self._height
+
+ line_index = 0
+ for line in self.lines:
+ if y > line.y + line.descent:
+ break
+ line_index += 1
+ if line_index >= len(self.lines):
+ line_index = len(self.lines) - 1
+ return line_index
+
+ def get_point_from_line(self, line):
+ """Get the X, Y coordinates of a line index.
+
+ :Parameters:
+ `line` : int
+ Line index.
+
+ :rtype: (int, int)
+ :return: (x, y)
+ """
+ line = self.lines[line]
+ return line.x + self._translate_x, line.y + self._translate_y
+
+ def get_line_from_position(self, position):
+ """Get the line index of a character position in the document.
+
+ :Parameters:
+ `position` : int
+ Document position.
+
+ :rtype: int
+ """
+ line = -1
+ for next_line in self.lines:
+ if next_line.start > position:
+ break
+ line += 1
+ return line
+
+ def get_position_from_line(self, line):
+ """Get the first document character position of a given line index.
+
+ :Parameters:
+ `line` : int
+ Line index.
+
+ :rtype: int
+ """
+ return self.lines[line].start + self._x
+
+ def get_position_on_line(self, line, x):
+ """Get the closest document position for a given line index and X
+ coordinate.
+
+ :Parameters:
+ `line` : int
+ Line index.
+ `x` : int
+ X coordinate.
+
+ :rtype: int
+ """
+ line = self.lines[line]
+
+ x += self._translate_x
+ x -= self._x
+
+ if x < line.x:
+ return line.start
+
+ position = line.start
+ last_glyph_x = line.x
+ for box in line.boxes:
+ if 0 <= x - last_glyph_x < box.advance:
+ position += box.get_position_in_box(x - last_glyph_x)
+ break
+ last_glyph_x += box.advance
+ position += box.length
+
+ return position
+
+ def get_line_count(self):
+ """Get the number of lines in the text layout.
+
+ :rtype: int
+ """
+ return len(self.lines)
+
+ def ensure_line_visible(self, line):
+ """Adjust `view_y` so that the line with the given index is visible.
+
+ :Parameters:
+ `line` : int
+ Line index.
+
+ """
+ line = self.lines[line]
+ y1 = line.y + line.ascent
+ y2 = line.y + line.descent
+ if y1 > self.view_y:
+ self.view_y = y1
+ elif y2 < self.view_y - self.height:
+ self.view_y = y2 + self.height
+
+ def ensure_x_visible(self, x):
+ """Adjust `view_x` so that the given X coordinate is visible.
+
+ The X coordinate is given relative to the current `view_x`.
+
+ :Parameters:
+ `x` : int
+ X coordinate
+
+ """
+ x += self.view_x - self._x
+
+ if x <= self.view_x + 10:
+ self.view_x = x - 10
+ elif x >= self.view_x + self.width:
+ self.view_x = x - self.width + 10
+ elif x >= self.view_x + self.width - 10 and self.content_width > self.width:
+ self.view_x = x - self.width + 10
+
+ if _is_pyglet_doc_run:
+ def on_layout_update(self):
+ """Some or all of the layout text was reflowed.
+
+ Text reflow is caused by document edits or changes to the layout's
+ size. Changes to the layout's position or active selection, and
+ certain document edits such as text color, do not cause a reflow.
+
+ Handle this event to update the position of a graphical element
+ that depends on the laid out position of a glyph or line.
+
+ :event:
+ """
+
+
+IncrementalTextLayout.register_event_type('on_layout_update')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/runlist.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/runlist.py
new file mode 100644
index 0000000000000000000000000000000000000000..d91cda70eb0fefd5474400fa56711f0cb19d1b56
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/text/runlist.py
@@ -0,0 +1,410 @@
+"""Run list encoding utilities.
+
+.. versionadded:: 1.1
+"""
+
+
+class _Run:
+ def __init__(self, value, count):
+ self.value = value
+ self.count = count
+
+ def __repr__(self):
+ return f'Run({self.value}, {self.count})'
+
+
+class RunList:
+ """List of contiguous runs of values.
+
+ A `RunList` is an efficient encoding of a sequence of values. For
+ example, the sequence ``aaaabbccccc`` is encoded as ``(4, a), (2, b),
+ (5, c)``. The class provides methods for modifying and querying the
+ run list without needing to deal with the tricky cases of splitting and
+ merging the run list entries.
+
+ Run lists are used to represent formatted character data in pyglet. A
+ separate run list is maintained for each style attribute, for example,
+ bold, italic, font size, and so on. Unless you are overriding the
+ document interfaces, the only interaction with run lists is via
+ `RunIterator`.
+
+ The length and ranges of a run list always refer to the character
+ positions in the decoded list. For example, in the above sequence,
+ ``set_run(2, 5, 'x')`` would change the sequence to ``aaxxxbccccc``.
+ """
+
+ def __init__(self, size, initial):
+ """Create a run list of the given size and a default value.
+
+ :Parameters:
+ `size` : int
+ Number of characters to represent initially.
+ `initial` : object
+ The value of all characters in the run list.
+
+ """
+ self.runs = [_Run(initial, size)]
+
+ def insert(self, pos, length):
+ """Insert characters into the run list.
+
+ The inserted characters will take on the value immediately preceding
+ the insertion point (or the value of the first character, if `pos` is
+ 0).
+
+ :Parameters:
+ `pos` : int
+ Insertion index
+ `length` : int
+ Number of characters to insert.
+
+ """
+
+ i = 0
+ for run in self.runs:
+ if i <= pos <= i + run.count:
+ run.count += length
+ i += run.count
+
+ def delete(self, start, end):
+ """Remove characters from the run list.
+
+ :Parameters:
+ `start` : int
+ Starting index to remove from.
+ `end` : int
+ End index, exclusive.
+
+ """
+ i = 0
+
+ for run in self.runs:
+ if end - start == 0:
+ break
+ if i <= start <= i + run.count:
+ trim = min(end - start, i + run.count - start)
+ run.count -= trim
+ end -= trim
+ i += run.count
+ self.runs = [r for r in self.runs if r.count > 0]
+
+ # Don't leave an empty list
+ if not self.runs:
+ self.runs = [_Run(run.value, 0)]
+
+ def set_run(self, start, end, value):
+ """Set the value of a range of characters.
+
+ :Parameters:
+ `start` : int
+ Start index of range.
+ `end` : int
+ End of range, exclusive.
+ `value` : object
+ Value to set over the range.
+
+ """
+ if end - start <= 0:
+ return
+
+ # Find runs that need to be split
+ i = 0
+ start_i = None
+ start_trim = 0
+ end_i = None
+ end_trim = 0
+ for run_i, run in enumerate(self.runs):
+ count = run.count
+ if i < start < i + count:
+ start_i = run_i
+ start_trim = start - i
+ if i < end < i + count:
+ end_i = run_i
+ end_trim = end - i
+ i += count
+
+ # Split runs
+ if start_i is not None:
+ run = self.runs[start_i]
+ self.runs.insert(start_i, _Run(run.value, start_trim))
+ run.count -= start_trim
+ if end_i is not None:
+ if end_i == start_i:
+ end_trim -= start_trim
+ end_i += 1
+ if end_i is not None:
+ run = self.runs[end_i]
+ self.runs.insert(end_i, _Run(run.value, end_trim))
+ run.count -= end_trim
+
+ # Set new value on runs
+ i = 0
+ for run in self.runs:
+ if start <= i and i + run.count <= end:
+ run.value = value
+ i += run.count
+
+ # Merge adjacent runs
+ last_run = self.runs[0]
+ for run in self.runs[1:]:
+ if run.value == last_run.value:
+ run.count += last_run.count
+ last_run.count = 0
+ last_run = run
+
+ # Delete collapsed runs
+ self.runs = [r for r in self.runs if r.count > 0]
+
+ def __iter__(self):
+ i = 0
+ for run in self.runs:
+ yield i, i + run.count, run.value
+ i += run.count
+
+ def get_run_iterator(self):
+ """Get an extended iterator over the run list.
+
+ :rtype: `RunIterator`
+ """
+ return RunIterator(self)
+
+ def __getitem__(self, index):
+ """Get the value at a character position.
+
+ :Parameters:
+ `index` : int
+ Index of character. Must be within range and non-negative.
+
+ :rtype: object
+ """
+ i = 0
+ for run in self.runs:
+ if i <= index < i + run.count:
+ return run.value
+ i += run.count
+
+ # Append insertion point
+ if index == i:
+ return self.runs[-1].value
+
+ raise IndexError
+
+ def __repr__(self):
+ return str(list(self))
+
+
+class AbstractRunIterator:
+ """Range iteration over `RunList`.
+
+ `AbstractRunIterator` objects allow any monotonically non-decreasing
+ access of the iteration, including repeated iteration over the same index.
+ Use the ``[index]`` operator to get the value at a particular index within
+ the document. For example::
+
+ run_iter = iter(run_list)
+ value = run_iter[0]
+ value = run_iter[0] # non-decreasing access is OK
+ value = run_iter[15]
+ value = run_iter[17]
+ value = run_iter[16] # this is illegal, the index decreased.
+
+ Using `AbstractRunIterator` to access increasing indices of the value runs
+ is more efficient than calling `RunList.__getitem__` repeatedly.
+
+ You can also iterate over monotonically non-decreasing ranges over the
+ iteration. For example::
+
+ run_iter = iter(run_list)
+ for start, end, value in run_iter.ranges(0, 20):
+ pass
+ for start, end, value in run_iter.ranges(25, 30):
+ pass
+ for start, end, value in run_iter.ranges(30, 40):
+ pass
+
+ Both start and end indices of the slice are required and must be positive.
+ """
+
+ def __getitem__(self, index):
+ """Get the value at a given index.
+
+ See the class documentation for examples of valid usage.
+
+ :Parameters:
+ `index` : int
+ Document position to query.
+
+ :rtype: object
+ """
+
+ def ranges(self, start, end):
+ """Iterate over a subrange of the run list.
+
+ See the class documentation for examples of valid usage.
+
+ :Parameters:
+ `start` : int
+ Start index to iterate from.
+ `end` : int
+ End index, exclusive.
+
+ :rtype: iterator
+ :return: Iterator over (start, end, value) tuples.
+ """
+
+
+class RunIterator(AbstractRunIterator):
+ def __init__(self, run_list):
+ self._run_list_iter = iter(run_list)
+ self.start, self.end, self.value = next(self)
+
+ def __next__(self):
+ return next(self._run_list_iter)
+
+ def __getitem__(self, index):
+ try:
+ while index >= self.end and index > self.start:
+ # condition has special case for 0-length run (fixes issue 471)
+ self.start, self.end, self.value = next(self)
+ return self.value
+ except StopIteration:
+ raise IndexError
+
+ def ranges(self, start, end):
+ try:
+ while start >= self.end:
+ self.start, self.end, self.value = next(self)
+ yield start, min(self.end, end), self.value
+ while end > self.end:
+ self.start, self.end, self.value = next(self)
+ yield self.start, min(self.end, end), self.value
+ except StopIteration:
+ return
+
+
+class OverriddenRunIterator(AbstractRunIterator):
+ """Iterator over a `RunIterator`, with a value temporarily replacing
+ a given range.
+ """
+
+ def __init__(self, base_iterator, start, end, value):
+ """Create a derived iterator.
+
+ :Parameters:
+ `start` : int
+ Start of range to override
+ `end` : int
+ End of range to override, exclusive
+ `value` : object
+ Value to replace over the range
+
+ """
+ self.iter = base_iterator
+ self.override_start = start
+ self.override_end = end
+ self.override_value = value
+
+ def ranges(self, start, end):
+ if end <= self.override_start or start >= self.override_end:
+ # No overlap
+ for r in self.iter.ranges(start, end):
+ yield r
+ else:
+ # Overlap: before, override, after
+ if start < self.override_start < end:
+ for r in self.iter.ranges(start, self.override_start):
+ yield r
+ yield (max(self.override_start, start),
+ min(self.override_end, end),
+ self.override_value)
+ if start < self.override_end < end:
+ for r in self.iter.ranges(self.override_end, end):
+ yield r
+
+ def __getitem__(self, index):
+ if self.override_start <= index < self.override_end:
+ return self.override_value
+ else:
+ return self.iter[index]
+
+
+class FilteredRunIterator(AbstractRunIterator):
+ """Iterate over an `AbstractRunIterator` with filtered values replaced
+ by a default value.
+ """
+
+ def __init__(self, base_iterator, filter, default):
+ """Create a filtered run iterator.
+
+ :Parameters:
+ `base_iterator` : `AbstractRunIterator`
+ Source of runs.
+ `filter` : ``lambda object: bool``
+ Function taking a value as parameter, and returning ``True``
+ if the value is acceptable, and ``False`` if the default value
+ should be substituted.
+ `default` : object
+ Default value to replace filtered values.
+
+ """
+ self.iter = base_iterator
+ self.filter = filter
+ self.default = default
+
+ def ranges(self, start, end):
+ for start, end, value in self.iter.ranges(start, end):
+ if self.filter(value):
+ yield start, end, value
+ else:
+ yield start, end, self.default
+
+ def __getitem__(self, index):
+ value = self.iter[index]
+ if self.filter(value):
+ return value
+ return self.default
+
+
+class ZipRunIterator(AbstractRunIterator):
+ """Iterate over multiple run iterators concurrently."""
+
+ def __init__(self, range_iterators):
+ self.range_iterators = range_iterators
+
+ def ranges(self, start, end):
+ try:
+ iterators = [i.ranges(start, end) for i in self.range_iterators]
+ starts, ends, values = zip(*[next(i) for i in iterators])
+ starts = list(starts)
+ ends = list(ends)
+ values = list(values)
+ while start < end:
+ min_end = min(ends)
+ yield start, min_end, values
+ start = min_end
+ for i, iterator in enumerate(iterators):
+ if ends[i] == min_end:
+ starts[i], ends[i], values[i] = next(iterator)
+ except StopIteration:
+ return
+
+ def __getitem__(self, index):
+ return [i[index] for i in self.range_iterators]
+
+
+class ConstRunIterator(AbstractRunIterator):
+ """Iterate over a constant value without creating a RunList."""
+
+ def __init__(self, length, value):
+ self.length = length
+ self.end = length
+ self.value = value
+
+ def __next__(self):
+ yield 0, self.length, self.value
+
+ def ranges(self, start, end):
+ yield start, end, self.value
+
+ def __getitem__(self, index):
+ return self.value
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/util.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/util.py
new file mode 100644
index 0000000000000000000000000000000000000000..6f6314e8c160140afc79ec2512cad004e2149483
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/util.py
@@ -0,0 +1,255 @@
+"""Various utility functions used internally by pyglet
+"""
+
+import os
+import sys
+
+import pyglet
+
+
+def asbytes(s):
+ if isinstance(s, bytes):
+ return s
+ elif isinstance(s, str):
+ return bytes(ord(c) for c in s)
+ else:
+ return bytes(s)
+
+
+def asbytes_filename(s):
+ if isinstance(s, bytes):
+ return s
+ elif isinstance(s, str):
+ return s.encode(encoding=sys.getfilesystemencoding())
+
+
+def asstr(s):
+ if s is None:
+ return ''
+ if isinstance(s, str):
+ return s
+ return s.decode("utf-8")
+
+
+def with_metaclass(meta, *bases):
+ """
+ Function from jinja2/_compat.py. License: BSD.
+ Use it like this::
+ class BaseForm:
+ pass
+ class FormType(type):
+ pass
+ class Form(with_metaclass(FormType, BaseForm)):
+ pass
+ This requires a bit of explanation: the basic idea is to make a
+ dummy metaclass for one level of class instantiation that replaces
+ itself with the actual metaclass. Because of internal type checks
+ we also need to make sure that we downgrade the custom metaclass
+ for one level to something closer to type (that's why __call__ and
+ __init__ comes back from type etc.).
+ This has the advantage over six.with_metaclass of not introducing
+ dummy classes into the final MRO.
+ """
+ class MetaClass(meta):
+ __call__ = type.__call__
+ __init__ = type.__init__
+
+ def __new__(cls, name, this_bases, d):
+ if this_bases is None:
+ return type.__new__(cls, name, (), d)
+ return meta(name, bases, d)
+
+ return MetaClass('temporary_class', None, {})
+
+
+def debug_print(enabled_or_option='debug'):
+ """Get a debug printer that is enabled based on a boolean input or a pyglet option.
+ The debug print function returned should be used in an assert. This way it can be
+ optimized out when running python with the -O flag.
+
+ Usage example::
+
+ from pyglet.debug import debug_print
+ _debug_media = debug_print('debug_media')
+
+ def some_func():
+ assert _debug_media('My debug statement')
+
+ :parameters:
+ `enabled_or_options` : bool or str
+ If a bool is passed, debug printing is enabled if it is True. If str is passed
+ debug printing is enabled if the pyglet option with that name is True.
+
+ :returns: Function for debug printing.
+ """
+ if isinstance(enabled_or_option, bool):
+ enabled = enabled_or_option
+ else:
+ enabled = pyglet.options.get(enabled_or_option, False)
+
+ if enabled:
+ def _debug_print(*args, **kwargs):
+ print(*args, **kwargs)
+ return True
+
+ else:
+ def _debug_print(*args, **kwargs):
+ return True
+
+ return _debug_print
+
+
+class CodecRegistry:
+ """Utility class for handling adding and querying of codecs."""
+
+ def __init__(self):
+ self._decoders = []
+ self._encoders = []
+ self._decoder_extensions = {} # Map str -> list of matching Decoders
+ self._encoder_extensions = {} # Map str -> list of matching Encoders
+
+ def get_encoders(self, filename=None):
+ """Get a list of all encoders. If a `filename` is provided, only
+ encoders supporting that extension will be returned. An empty list
+ will be return if no encoders for that extension are available.
+ """
+ if filename:
+ extension = os.path.splitext(filename)[1].lower()
+ return self._encoder_extensions.get(extension, [])
+ return self._encoders
+
+ def get_decoders(self, filename=None):
+ """Get a list of all decoders. If a `filename` is provided, only
+ decoders supporting that extension will be returned. An empty list
+ will be return if no encoders for that extension are available.
+ """
+ if filename:
+ extension = os.path.splitext(filename)[1].lower()
+ return self._decoder_extensions.get(extension, [])
+ return self._decoders
+
+ def add_decoders(self, module):
+ """Add a decoder module. The module must define `get_decoders`. Once
+ added, the appropriate decoders defined in the codec will be returned by
+ CodecRegistry.get_decoders.
+ """
+ for decoder in module.get_decoders():
+ self._decoders.append(decoder)
+ for extension in decoder.get_file_extensions():
+ if extension not in self._decoder_extensions:
+ self._decoder_extensions[extension] = []
+ self._decoder_extensions[extension].append(decoder)
+
+ def add_encoders(self, module):
+ """Add an encoder module. The module must define `get_encoders`. Once
+ added, the appropriate encoders defined in the codec will be returned by
+ CodecRegistry.get_encoders.
+ """
+ for encoder in module.get_encoders():
+ self._encoders.append(encoder)
+ for extension in encoder.get_file_extensions():
+ if extension not in self._encoder_extensions:
+ self._encoder_extensions[extension] = []
+ self._encoder_extensions[extension].append(encoder)
+
+ def decode(self, filename, file, **kwargs):
+ """Attempt to decode a file, using the available registered decoders.
+ Any decoders that match the file extension will be tried first. If no
+ decoders match the extension, all decoders will then be tried in order.
+ """
+ first_exception = None
+
+ for decoder in self.get_decoders(filename):
+ try:
+ return decoder.decode(filename, file, **kwargs)
+ except DecodeException as e:
+ if not first_exception:
+ first_exception = e
+ if file:
+ file.seek(0)
+
+ for decoder in self.get_decoders():
+ try:
+ return decoder.decode(filename, file, **kwargs)
+ except DecodeException:
+ if file:
+ file.seek(0)
+
+ if not first_exception:
+ raise DecodeException(f"No decoders available for this file type: {filename}")
+ raise first_exception
+
+ def encode(self, media, filename, file=None, **kwargs):
+ """Attempt to encode a pyglet object to a specified format. All registered
+ encoders that advertise support for the specific file extension will be tried.
+ If no encoders are available, an EncodeException will be raised.
+ """
+
+ first_exception = None
+ for encoder in self.get_encoders(filename):
+
+ try:
+ return encoder.encode(media, filename, file, **kwargs)
+ except EncodeException as e:
+ first_exception = first_exception or e
+
+ if not first_exception:
+ raise EncodeException(f"No Encoders are available for this extension: '{filename}'")
+ raise first_exception
+
+
+class Decoder:
+ def get_file_extensions(self):
+ """Return a list or tuple of accepted file extensions, e.g. ['.wav', '.ogg']
+ Lower-case only.
+ """
+ raise NotImplementedError()
+
+ def decode(self, *args, **kwargs):
+ """Read and decode the given file object and return an approprite
+ pyglet object. Throws DecodeException if there is an error.
+ `filename` can be a file type hint.
+ """
+ raise NotImplementedError()
+
+ def __hash__(self):
+ return hash(self.__class__.__name__)
+
+ def __eq__(self, other):
+ return self.__class__.__name__ == other.__class__.__name__
+
+ def __repr__(self):
+ return "{0}{1}".format(self.__class__.__name__, self.get_file_extensions())
+
+
+class Encoder:
+ def get_file_extensions(self):
+ """Return a list or tuple of accepted file extensions, e.g. ['.wav', '.ogg']
+ Lower-case only.
+ """
+ raise NotImplementedError()
+
+ def encode(self, media, filename, file):
+ """Encode the given media type to the given file. `filename`
+ provides a hint to the file format desired. options are
+ encoder-specific, and unknown options should be ignored or
+ issue warnings.
+ """
+ raise NotImplementedError()
+
+ def __hash__(self):
+ return hash(self.__class__.__name__)
+
+ def __eq__(self, other):
+ return self.__class__.__name__ == other.__class__.__name__
+
+ def __repr__(self):
+ return "{0}{1}".format(self.__class__.__name__, self.get_file_extensions())
+
+
+class DecodeException(Exception):
+ __module__ = "CodecRegistry"
+
+
+class EncodeException(Exception):
+ __module__ = "CodecRegistry"
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..fd125e231bddc215a782adb5a8a837e80c434205
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/__init__.py
@@ -0,0 +1,1887 @@
+"""Windowing and user-interface events.
+
+This module allows applications to create and display windows with an
+OpenGL context. Windows can be created with a variety of border styles
+or set fullscreen.
+
+You can register event handlers for keyboard, mouse and window events.
+For games and kiosks you can also restrict the input to your windows,
+for example disabling users from switching away from the application
+with certain key combinations or capturing and hiding the mouse.
+
+Getting started
+---------------
+
+Call the Window constructor to create a new window::
+
+ from pyglet.window import Window
+ win = Window(width=960, height=540)
+
+Attach your own event handlers::
+
+ @win.event
+ def on_key_press(symbol, modifiers):
+ # ... handle this event ...
+
+Place drawing code for the window within the `Window.on_draw` event handler::
+
+ @win.event
+ def on_draw():
+ # ... drawing code ...
+
+Call `pyglet.app.run` to enter the main event loop (by default, this
+returns when all open windows are closed)::
+
+ from pyglet import app
+ app.run()
+
+Creating a game window
+----------------------
+
+Use :py:meth:`~pyglet.window.Window.set_exclusive_mouse` to hide the mouse
+cursor and receive relative mouse movement events. Specify ``fullscreen=True``
+as a keyword argument to the :py:class:`~pyglet.window.Window` constructor to
+render to the entire screen rather than opening a window::
+
+ win = Window(fullscreen=True)
+ win.set_exclusive_mouse()
+
+Working with multiple screens
+-----------------------------
+
+By default, fullscreen windows are opened on the primary display (typically
+set by the user in their operating system settings). You can retrieve a list
+of attached screens and select one manually if you prefer. This is useful for
+opening a fullscreen window on each screen::
+
+ display = pyglet.canvas.get_display()
+ screens = display.get_screens()
+ windows = []
+ for screen in screens:
+ windows.append(window.Window(fullscreen=True, screen=screen))
+
+Specifying a screen has no effect if the window is not fullscreen.
+
+Specifying the OpenGL context properties
+----------------------------------------
+
+Each window has its own context which is created when the window is created.
+You can specify the properties of the context before it is created
+by creating a "template" configuration::
+
+ from pyglet import gl
+ # Create template config
+ config = gl.Config()
+ config.stencil_size = 8
+ config.aux_buffers = 4
+ # Create a window using this config
+ win = window.Window(config=config)
+
+To determine if a given configuration is supported, query the screen (see
+above, "Working with multiple screens")::
+
+ configs = screen.get_matching_configs(config)
+ if not configs:
+ # ... config is not supported
+ else:
+ win = window.Window(config=configs[0])
+
+"""
+
+import sys
+from typing import Tuple
+
+import pyglet
+import pyglet.window.key
+import pyglet.window.mouse
+
+from pyglet import gl
+from pyglet.math import Mat4
+from pyglet.event import EventDispatcher
+from pyglet.window import key, event
+from pyglet.util import with_metaclass
+from pyglet.graphics import shader
+
+
+_is_pyglet_doc_run = hasattr(sys, "is_pyglet_doc_run") and sys.is_pyglet_doc_run
+
+
+class WindowException(Exception):
+ """The root exception for all window-related errors."""
+ pass
+
+
+class NoSuchDisplayException(WindowException):
+ """An exception indicating the requested display is not available."""
+ pass
+
+
+class NoSuchConfigException(WindowException):
+ """An exception indicating the requested configuration is not
+ available."""
+ pass
+
+
+class NoSuchScreenModeException(WindowException):
+ """An exception indicating the requested screen resolution could not be
+ met."""
+ pass
+
+
+class MouseCursorException(WindowException):
+ """The root exception for all mouse cursor-related errors."""
+ pass
+
+
+class MouseCursor:
+ """An abstract mouse cursor."""
+
+ #: Indicates if the cursor is drawn
+ #: using OpenGL, or natively.
+ gl_drawable = True
+ hw_drawable = False
+
+ def draw(self, x, y):
+ """Abstract render method.
+
+ The cursor should be drawn with the "hot" spot at the given
+ coordinates. The projection is set to the pyglet default (i.e.,
+ orthographic in window-space), however no other aspects of the
+ state can be assumed.
+
+ :Parameters:
+ `x` : int
+ X coordinate of the mouse pointer's hot spot.
+ `y` : int
+ Y coordinate of the mouse pointer's hot spot.
+
+ """
+ pass
+
+
+class DefaultMouseCursor(MouseCursor):
+ """The default mouse cursor set by the operating system."""
+ gl_drawable = False
+ hw_drawable = True
+
+
+class ImageMouseCursor(MouseCursor):
+ """A user-defined mouse cursor created from an image.
+
+ Use this class to create your own mouse cursors and assign them
+ to windows. Cursors can be drawn by OpenGL, or optionally passed
+ to the OS to render natively. There are no restrictions on cursors
+ drawn by OpenGL, but natively rendered cursors may have some
+ platform limitations (such as color depth, or size). In general,
+ reasonably sized cursors will render correctly
+ """
+ def __init__(self, image, hot_x=0, hot_y=0, acceleration=False):
+ """Create a mouse cursor from an image.
+
+ :Parameters:
+ `image` : `pyglet.image.AbstractImage`
+ Image to use for the mouse cursor. It must have a
+ valid ``texture`` attribute.
+ `hot_x` : int
+ X coordinate of the "hot" spot in the image relative to the
+ image's anchor. May be clamped to the maximum image width
+ if ``acceleration=True``.
+ `hot_y` : int
+ Y coordinate of the "hot" spot in the image, relative to the
+ image's anchor. May be clamped to the maximum image height
+ if ``acceleration=True``.
+ `acceleration` : int
+ If True, draw the cursor natively instead of usign OpenGL.
+ The image may be downsampled or color reduced to fit the
+ platform limitations.
+ """
+ self.texture = image.get_texture()
+ self.hot_x = hot_x
+ self.hot_y = hot_y
+
+ self.gl_drawable = not acceleration
+ self.hw_drawable = acceleration
+
+ def draw(self, x, y):
+ gl.glEnable(gl.GL_BLEND)
+ gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
+ self.texture.blit(x - self.hot_x, y - self.hot_y, 0)
+ gl.glDisable(gl.GL_BLEND)
+
+
+def _PlatformEventHandler(data):
+ """Decorator for platform event handlers.
+
+ Apply giving the platform-specific data needed by the window to associate
+ the method with an event. See platform-specific subclasses of this
+ decorator for examples.
+
+ The following attributes are set on the function, which is returned
+ otherwise unchanged:
+
+ _platform_event
+ True
+ _platform_event_data
+ List of data applied to the function (permitting multiple decorators
+ on the same method).
+ """
+ def _event_wrapper(f):
+ f._platform_event = True
+ if not hasattr(f, '_platform_event_data'):
+ f._platform_event_data = []
+ f._platform_event_data.append(data)
+ return f
+
+ return _event_wrapper
+
+
+def _ViewEventHandler(f):
+ f._view = True
+ return f
+
+
+class _WindowMetaclass(type):
+ """Sets the _platform_event_names class variable on the window
+ subclass.
+ """
+
+ def __init__(cls, name, bases, dict):
+ cls._platform_event_names = set()
+ for base in bases:
+ if hasattr(base, '_platform_event_names'):
+ cls._platform_event_names.update(base._platform_event_names)
+ for name, func in dict.items():
+ if hasattr(func, '_platform_event'):
+ cls._platform_event_names.add(name)
+ super(_WindowMetaclass, cls).__init__(name, bases, dict)
+
+
+class BaseWindow(with_metaclass(_WindowMetaclass, EventDispatcher)):
+ """Platform-independent application window.
+
+ A window is a "heavyweight" object occupying operating system resources.
+ The "client" or "content" area of a window is filled entirely with
+ an OpenGL viewport. Applications have no access to operating system
+ widgets or controls; all rendering must be done via OpenGL.
+
+ Windows may appear as floating regions or can be set to fill an entire
+ screen (fullscreen). When floating, windows may appear borderless or
+ decorated with a platform-specific frame (including, for example, the
+ title bar, minimize and close buttons, resize handles, and so on).
+
+ While it is possible to set the location of a window, it is recommended
+ that applications allow the platform to place it according to local
+ conventions. This will ensure it is not obscured by other windows,
+ and appears on an appropriate screen for the user.
+
+ To render into a window, you must first call `switch_to`, to make
+ it the current OpenGL context. If you use only one window in the
+ application, there is no need to do this.
+ """
+
+ # Filled in by metaclass with the names of all methods on this (sub)class
+ # that are platform event handlers.
+ _platform_event_names = set()
+
+ #: The default window style.
+ WINDOW_STYLE_DEFAULT = None
+ #: The window style for pop-up dialogs.
+ WINDOW_STYLE_DIALOG = 'dialog'
+ #: The window style for tool windows.
+ WINDOW_STYLE_TOOL = 'tool'
+ #: A window style without any decoration.
+ WINDOW_STYLE_BORDERLESS = 'borderless'
+ #: A window style for transparent, interactable windows
+ WINDOW_STYLE_TRANSPARENT = 'transparent'
+ #: A window style for transparent, topmost, click-through-able overlays
+ WINDOW_STYLE_OVERLAY = 'overlay'
+
+ #: The default mouse cursor.
+ CURSOR_DEFAULT = None
+ #: A crosshair mouse cursor.
+ CURSOR_CROSSHAIR = 'crosshair'
+ #: A pointing hand mouse cursor.
+ CURSOR_HAND = 'hand'
+ #: A "help" mouse cursor; typically a question mark and an arrow.
+ CURSOR_HELP = 'help'
+ #: A mouse cursor indicating that the selected operation is not permitted.
+ CURSOR_NO = 'no'
+ #: A mouse cursor indicating the element can be resized.
+ CURSOR_SIZE = 'size'
+ #: A mouse cursor indicating the element can be resized from the top
+ #: border.
+ CURSOR_SIZE_UP = 'size_up'
+ #: A mouse cursor indicating the element can be resized from the
+ #: upper-right corner.
+ CURSOR_SIZE_UP_RIGHT = 'size_up_right'
+ #: A mouse cursor indicating the element can be resized from the right
+ #: border.
+ CURSOR_SIZE_RIGHT = 'size_right'
+ #: A mouse cursor indicating the element can be resized from the lower-right
+ #: corner.
+ CURSOR_SIZE_DOWN_RIGHT = 'size_down_right'
+ #: A mouse cursor indicating the element can be resized from the bottom
+ #: border.
+ CURSOR_SIZE_DOWN = 'size_down'
+ #: A mouse cursor indicating the element can be resized from the lower-left
+ #: corner.
+ CURSOR_SIZE_DOWN_LEFT = 'size_down_left'
+ #: A mouse cursor indicating the element can be resized from the left
+ #: border.
+ CURSOR_SIZE_LEFT = 'size_left'
+ #: A mouse cursor indicating the element can be resized from the upper-left
+ #: corner.
+ CURSOR_SIZE_UP_LEFT = 'size_up_left'
+ #: A mouse cursor indicating the element can be resized vertically.
+ CURSOR_SIZE_UP_DOWN = 'size_up_down'
+ #: A mouse cursor indicating the element can be resized horizontally.
+ CURSOR_SIZE_LEFT_RIGHT = 'size_left_right'
+ #: A text input mouse cursor (I-beam).
+ CURSOR_TEXT = 'text'
+ #: A "wait" mouse cursor; typically an hourglass or watch.
+ CURSOR_WAIT = 'wait'
+ #: The "wait" mouse cursor combined with an arrow.
+ CURSOR_WAIT_ARROW = 'wait_arrow'
+
+ #: True if the user has attempted to close the window.
+ #:
+ #: :deprecated: Windows are closed immediately by the default
+ #: :py:meth:`~pyglet.window.Window.on_close` handler when `pyglet.app.event_loop` is being
+ #: used.
+ has_exit = False
+
+ #: Window display contents validity. The :py:mod:`pyglet.app` event loop
+ #: examines every window each iteration and only dispatches the :py:meth:`~pyglet.window.Window.on_draw`
+ #: event to windows that have `invalid` set. By default, windows always
+ #: have `invalid` set to ``True``.
+ #:
+ #: You can prevent redundant redraws by setting this variable to ``False``
+ #: in the window's :py:meth:`~pyglet.window.Window.on_draw` handler, and setting it to True again in
+ #: response to any events that actually do require a window contents
+ #: update.
+ #:
+ #: :type: bool
+ #: .. versionadded:: 1.1
+ invalid = True
+
+ # Instance variables accessible only via properties
+ _width = None
+ _height = None
+ _caption = None
+ _resizable = False
+ _style = WINDOW_STYLE_DEFAULT
+ _fullscreen = False
+ _visible = False
+ _vsync = False
+ _file_drops = False
+ _screen = None
+ _config = None
+ _context = None
+ _projection_matrix = pyglet.math.Mat4()
+ _view_matrix = pyglet.math.Mat4()
+ _viewport = 0, 0, 0, 0
+
+ # Used to restore window size and position after fullscreen
+ _windowed_size = None
+ _windowed_location = None
+
+ _minimum_size = None
+ _maximum_size = None
+
+ _keyboard_exclusive = False
+
+ # Subclasses should update these after relevant events
+ _mouse_cursor = DefaultMouseCursor()
+ _mouse_x = 0
+ _mouse_y = 0
+ _mouse_visible = True
+ _mouse_exclusive = False
+ _mouse_in_window = False
+
+ _event_queue = None
+ _enable_event_queue = True # overridden by EventLoop.
+ _allow_dispatch_event = False # controlled by dispatch_events stack frame
+
+ # Class attributes
+ _default_width = 960
+ _default_height = 540
+
+ # Create a default ShaderProgram, so the Window instance can
+ # update the `WindowBlock` UBO shared by all default shaders.
+ _default_vertex_source = """#version 150 core
+ in vec4 position;
+
+ uniform WindowBlock
+ {
+ mat4 projection;
+ mat4 view;
+ } window;
+
+ void main()
+ {
+ gl_Position = window.projection * window.view * position;
+ }
+ """
+ _default_fragment_source = """#version 150 core
+ out vec4 color;
+
+ void main()
+ {
+ color = vec4(1.0, 0.0, 0.0, 1.0);
+ }
+ """
+
+ def __init__(self,
+ width=None,
+ height=None,
+ caption=None,
+ resizable=False,
+ style=WINDOW_STYLE_DEFAULT,
+ fullscreen=False,
+ visible=True,
+ vsync=True,
+ file_drops=False,
+ display=None,
+ screen=None,
+ config=None,
+ context=None,
+ mode=None):
+ """Create a window.
+
+ All parameters are optional, and reasonable defaults are assumed
+ where they are not specified.
+
+ The `display`, `screen`, `config` and `context` parameters form
+ a hierarchy of control: there is no need to specify more than
+ one of these. For example, if you specify `screen` the `display`
+ will be inferred, and a default `config` and `context` will be
+ created.
+
+ `config` is a special case; it can be a template created by the
+ user specifying the attributes desired, or it can be a complete
+ `config` as returned from `Screen.get_matching_configs` or similar.
+
+ The context will be active as soon as the window is created, as if
+ `switch_to` was just called.
+
+ :Parameters:
+ `width` : int
+ Width of the window, in pixels. Defaults to 960, or the
+ screen width if `fullscreen` is True.
+ `height` : int
+ Height of the window, in pixels. Defaults to 540, or the
+ screen height if `fullscreen` is True.
+ `caption` : str or unicode
+ Initial caption (title) of the window. Defaults to
+ ``sys.argv[0]``.
+ `resizable` : bool
+ If True, the window will be resizable. Defaults to False.
+ `style` : int
+ One of the ``WINDOW_STYLE_*`` constants specifying the
+ border style of the window.
+ `fullscreen` : bool
+ If True, the window will cover the entire screen rather
+ than floating. Defaults to False.
+ `visible` : bool
+ Determines if the window is visible immediately after
+ creation. Defaults to True. Set this to False if you
+ would like to change attributes of the window before
+ having it appear to the user.
+ `vsync` : bool
+ If True, buffer flips are synchronised to the primary screen's
+ vertical retrace, eliminating flicker.
+ `display` : `Display`
+ The display device to use. Useful only under X11.
+ `screen` : `Screen`
+ The screen to use, if in fullscreen.
+ `config` : `pyglet.gl.Config`
+ Either a template from which to create a complete config,
+ or a complete config.
+ `context` : `pyglet.gl.Context`
+ The context to attach to this window. The context must
+ not already be attached to another window.
+ `mode` : `ScreenMode`
+ The screen will be switched to this mode if `fullscreen` is
+ True. If None, an appropriate mode is selected to accomodate
+ `width` and `height.`
+
+ """
+ EventDispatcher.__init__(self)
+ self._event_queue = []
+
+ if not display:
+ display = pyglet.canvas.get_display()
+
+ if not screen:
+ screen = display.get_default_screen()
+
+ if not config:
+ for template_config in [gl.Config(double_buffer=True, depth_size=24, major_version=3, minor_version=3),
+ gl.Config(double_buffer=True, depth_size=16, major_version=3, minor_version=3),
+ None]:
+ try:
+ config = screen.get_best_config(template_config)
+ break
+ except NoSuchConfigException:
+ pass
+ if not config:
+ raise NoSuchConfigException('No standard config is available.')
+
+ # Necessary on Windows. More investigation needed:
+ if style in ('transparent', 'overlay'):
+ config.alpha = 8
+
+ if not config.is_complete():
+ config = screen.get_best_config(config)
+
+ if not context:
+ context = config.create_context(gl.current_context)
+
+ # Set these in reverse order to above, to ensure we get user preference
+ self._context = context
+ self._config = self._context.config
+
+ # XXX deprecate config's being screen-specific
+ if hasattr(self._config, 'screen'):
+ self._screen = self._config.screen
+ else:
+ self._screen = screen
+ self._display = self._screen.display
+
+ if fullscreen:
+ if width is None and height is None:
+ self._windowed_size = self._default_width, self._default_height
+ width, height = self._set_fullscreen_mode(mode, width, height)
+ if not self._windowed_size:
+ self._windowed_size = width, height
+ else:
+ if width is None:
+ width = self._default_width
+ if height is None:
+ height = self._default_height
+
+ self._width = width
+ self._height = height
+ self._resizable = resizable
+ self._fullscreen = fullscreen
+ self._style = style
+ if pyglet.options['vsync'] is not None:
+ self._vsync = pyglet.options['vsync']
+ else:
+ self._vsync = vsync
+
+ self._file_drops = file_drops
+ self._caption = caption or sys.argv[0]
+
+ from pyglet import app
+ app.windows.add(self)
+ self._create()
+
+ self.switch_to()
+
+ self._create_projection()
+
+ if visible:
+ self.set_visible(True)
+ self.activate()
+
+ def _create_projection(self):
+ self._default_program = shader.ShaderProgram(
+ shader.Shader(self._default_vertex_source, 'vertex'),
+ shader.Shader(self._default_fragment_source, 'fragment'))
+
+ self.ubo = self._default_program.uniform_blocks['WindowBlock'].create_ubo()
+
+ self._viewport = 0, 0, *self.get_framebuffer_size()
+
+ self.view = Mat4()
+ self.projection = Mat4.orthogonal_projection(0, self._width, 0, self._height, -255, 255)
+
+ def __del__(self):
+ # Always try to clean up the window when it is dereferenced.
+ # Makes sure there are no dangling pointers or memory leaks.
+ # If the window is already closed, pass silently.
+ try:
+ self.close()
+ except: # XXX Avoid a NoneType error if already closed.
+ pass
+
+ def __repr__(self):
+ return f'{self.__class__.__name__}=(width={self.width}, height={self.height})'
+
+ def _create(self):
+ raise NotImplementedError('abstract')
+
+ def _recreate(self, changes):
+ """Recreate the window with current attributes.
+
+ :Parameters:
+ `changes` : list of str
+ List of attribute names that were changed since the last
+ `_create` or `_recreate`. For example, ``['fullscreen']``
+ is given if the window is to be toggled to or from fullscreen.
+ """
+ raise NotImplementedError('abstract')
+
+ # Public methods (sort alphabetically):
+ def activate(self):
+ """Attempt to restore keyboard focus to the window.
+
+ Depending on the window manager or operating system, this may not
+ be successful. For example, on Windows XP an application is not
+ allowed to "steal" focus from another application. Instead, the
+ window's taskbar icon will flash, indicating it requires attention.
+ """
+ raise NotImplementedError('abstract')
+
+ @staticmethod
+ def clear():
+ """Clear the window.
+
+ This is a convenience method for clearing the color and depth
+ buffer. The window must be the active context (see `switch_to`).
+ """
+ gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
+
+ def close(self):
+ """Close the window.
+
+ After closing the window, the GL context will be invalid. The
+ window instance cannot be reused once closed (see also `set_visible`).
+
+ The `pyglet.app.EventLoop.on_window_close` event is dispatched on
+ `pyglet.app.event_loop` when this method is called.
+ """
+ from pyglet import app
+ if not self._context:
+ return
+ app.windows.remove(self)
+ self._context.destroy()
+ self._config = None
+ self._context = None
+ if app.event_loop:
+ app.event_loop.dispatch_event('on_window_close', self)
+ self._event_queue = []
+
+ def dispatch_event(self, *args):
+ if not self._enable_event_queue or self._allow_dispatch_event:
+ super().dispatch_event(*args)
+ else:
+ self._event_queue.append(args)
+
+ def dispatch_events(self):
+ """Poll the operating system event queue for new events and call
+ attached event handlers.
+
+ This method is provided for legacy applications targeting pyglet 1.0,
+ and advanced applications that must integrate their event loop
+ into another framework.
+
+ Typical applications should use `pyglet.app.run`.
+ """
+ raise NotImplementedError('abstract')
+
+ def draw_mouse_cursor(self):
+ """Draw the custom mouse cursor.
+
+ If the current mouse cursor has ``drawable`` set, this method
+ is called before the buffers are flipped to render it.
+
+ There is little need to override this method; instead, subclass
+ :py:class:`MouseCursor` and provide your own
+ :py:meth:`~MouseCursor.draw` method.
+ """
+ # Draw mouse cursor if set and visible.
+
+ if self._mouse_cursor.gl_drawable and self._mouse_visible and self._mouse_in_window:
+ # TODO: consider projection differences
+ self._mouse_cursor.draw(self._mouse_x, self._mouse_y)
+
+ def flip(self):
+ """Swap the OpenGL front and back buffers.
+
+ Call this method on a double-buffered window to update the
+ visible display with the back buffer. The contents of the back buffer
+ is undefined after this operation.
+
+ Windows are double-buffered by default. This method is called
+ automatically by `EventLoop` after the :py:meth:`~pyglet.window.Window.on_draw` event.
+ """
+ raise NotImplementedError('abstract')
+
+ def get_framebuffer_size(self):
+ """Return the size in actual pixels of the Window framebuffer.
+
+ When using HiDPI screens, the size of the Window's framebuffer
+ can be higher than that of the Window size requested. If you
+ are performing operations that require knowing the actual number
+ of pixels in the window, this method should be used instead of
+ :py:func:`Window.get_size()`. For example, setting the Window
+ projection or setting the glViewport size.
+
+ :rtype: (int, int)
+ :return: The width and height of the Window's framebuffer, in pixels.
+ """
+ return self.get_size()
+
+ def get_location(self):
+ """Return the current position of the window.
+
+ :rtype: (int, int)
+ :return: The distances of the left and top edges from their respective
+ edges on the virtual desktop, in pixels.
+ """
+ raise NotImplementedError('abstract')
+
+ def get_pixel_ratio(self):
+ """Return the framebuffer/window size ratio.
+
+ Some platforms and/or window systems support subpixel scaling,
+ making the framebuffer size larger than the window size.
+ Retina screens on OS X and Gnome on Linux are some examples.
+
+ On a Retina systems the returned ratio would usually be 2.0 as a
+ window of size 500 x 500 would have a framebuffer of 1000 x 1000.
+ Fractional values between 1.0 and 2.0, as well as values above
+ 2.0 may also be encountered.
+
+ :rtype: float
+ :return: The framebuffer/window size ratio
+ """
+ return self.get_framebuffer_size()[0] / self.width
+
+ def get_size(self) -> Tuple[int, int]:
+ """Return the current size of the window.
+
+ This does not include the windows' border or title bar.
+
+ :rtype: (int, int)
+ :return: The width and height of the window, in pixels.
+ """
+ return self._width, self._height
+
+ def get_system_mouse_cursor(self, name):
+ """Obtain a system mouse cursor.
+
+ Use `set_mouse_cursor` to make the cursor returned by this method
+ active. The names accepted by this method are the ``CURSOR_*``
+ constants defined on this class.
+
+ :Parameters:
+ `name` : str
+ Name describing the mouse cursor to return. For example,
+ ``CURSOR_WAIT``, ``CURSOR_HELP``, etc.
+
+ :rtype: `MouseCursor`
+ :return: A mouse cursor which can be used with `set_mouse_cursor`.
+ """
+ raise NotImplementedError()
+
+ def minimize(self):
+ """Minimize the window.
+ """
+ raise NotImplementedError('abstract')
+
+ def maximize(self):
+ """Maximize the window.
+
+ The behaviour of this method is somewhat dependent on the user's
+ display setup. On a multi-monitor system, the window may maximize
+ to either a single screen or the entire virtual desktop.
+ """
+ raise NotImplementedError('abstract')
+
+ def on_close(self):
+ """Default on_close handler."""
+ self.has_exit = True
+ from pyglet import app
+ if app.event_loop.is_running:
+ self.close()
+
+ def on_key_press(self, symbol, modifiers):
+ """Default on_key_press handler."""
+ if symbol == key.ESCAPE and not (modifiers & ~(key.MOD_NUMLOCK |
+ key.MOD_CAPSLOCK |
+ key.MOD_SCROLLLOCK)):
+ self.dispatch_event('on_close')
+
+ def on_resize(self, width, height):
+ """A default resize event handler.
+
+ This default handler updates the GL viewport to cover the entire
+ window. The bottom-left corner is (0, 0) and the top-right
+ corner is the width and height of the window's framebuffer.
+ In addition, the projection matrix is set to an orghogonal
+ projection based on the same dimensions.
+ """
+ gl.glViewport(0, 0, *self.get_framebuffer_size())
+ self.projection = Mat4.orthogonal_projection(0, width, 0, height, -255, 255)
+
+ def set_caption(self, caption):
+ """Set the window's caption.
+
+ The caption appears in the titlebar of the window, if it has one,
+ and in the taskbar on Windows and many X11 window managers.
+
+ :Parameters:
+ `caption` : str or unicode
+ The caption to set.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def set_fullscreen(self, fullscreen=True, screen=None, mode=None, width=None, height=None):
+ """Toggle to or from fullscreen.
+
+ After toggling fullscreen, the GL context should have retained its
+ state and objects, however the buffers will need to be cleared and
+ redrawn.
+
+ If `width` and `height` are specified and `fullscreen` is True, the
+ screen may be switched to a different resolution that most closely
+ matches the given size. If the resolution doesn't match exactly,
+ a higher resolution is selected and the window will be centered
+ within a black border covering the rest of the screen.
+
+ :Parameters:
+ `fullscreen` : bool
+ True if the window should be made fullscreen, False if it
+ should be windowed.
+ `screen` : Screen
+ If not None and fullscreen is True, the window is moved to the
+ given screen. The screen must belong to the same display as
+ the window.
+ `mode` : `ScreenMode`
+ The screen will be switched to the given mode. The mode must
+ have been obtained by enumerating `Screen.get_modes`. If
+ None, an appropriate mode will be selected from the given
+ `width` and `height`.
+ `width` : int
+ Optional width of the window. If unspecified, defaults to the
+ previous window size when windowed, or the screen size if
+ fullscreen.
+
+ .. versionadded:: 1.2
+ `height` : int
+ Optional height of the window. If unspecified, defaults to
+ the previous window size when windowed, or the screen size if
+ fullscreen.
+
+ .. versionadded:: 1.2
+ """
+ if (fullscreen == self._fullscreen and
+ (screen is None or screen is self._screen) and
+ (width is None or width == self._width) and
+ (height is None or height == self._height)):
+ return
+
+ if not self._fullscreen:
+ # Save windowed size
+ self._windowed_size = self.get_size()
+ self._windowed_location = self.get_location()
+
+ if fullscreen and screen is not None:
+ assert screen.display is self.display
+ self._screen = screen
+
+ self._fullscreen = fullscreen
+ if self._fullscreen:
+ self._width, self._height = self._set_fullscreen_mode(mode, width, height)
+ else:
+ self.screen.restore_mode()
+
+ self._width, self._height = self._windowed_size
+ if width is not None:
+ self._width = width
+ if height is not None:
+ self._height = height
+
+ self._recreate(['fullscreen'])
+
+ if not self._fullscreen and self._windowed_location:
+ # Restore windowed location.
+ self.set_location(*self._windowed_location)
+
+ def _set_fullscreen_mode(self, mode, width, height):
+ if mode is not None:
+ self.screen.set_mode(mode)
+ if width is None:
+ width = self.screen.width
+ if height is None:
+ height = self.screen.height
+ elif width is not None or height is not None:
+ if width is None:
+ width = 0
+ if height is None:
+ height = 0
+ mode = self.screen.get_closest_mode(width, height)
+ if mode is not None:
+ self.screen.set_mode(mode)
+ elif self.screen.get_modes():
+ # Only raise exception if mode switching is at all possible.
+ raise NoSuchScreenModeException(f'No mode matching {width}x{height}')
+ else:
+ width = self.screen.width
+ height = self.screen.height
+ return width, height
+
+ def set_minimum_size(self, width: int, height: int) -> None:
+ """Set the minimum size of the window.
+
+ Once set, the user will not be able to resize the window smaller
+ than the given dimensions. There is no way to remove the
+ minimum size constraint on a window (but you could set it to 0,0).
+
+ The behaviour is undefined if the minimum size is set larger than
+ the current size of the window.
+
+ The window size does not include the border or title bar.
+
+ :Parameters:
+ `width` : int
+ Minimum width of the window, in pixels.
+ `height` : int
+ Minimum height of the window, in pixels.
+
+ """
+ if width < 1 or height < 1:
+ raise ValueError('width and height must be positive integers')
+
+ self._minimum_size = width, height
+
+ def set_maximum_size(self, width: int, height: int) -> None:
+ """Set the maximum size of the window.
+
+ Once set, the user will not be able to resize the window larger
+ than the given dimensions. There is no way to remove the
+ maximum size constraint on a window (but you could set it to a large
+ value).
+
+ The behaviour is undefined if the maximum size is set smaller than
+ the current size of the window.
+
+ The window size does not include the border or title bar.
+
+ :Parameters:
+ `width` : int
+ Maximum width of the window, in pixels.
+ `height` : int
+ Maximum height of the window, in pixels.
+
+ """
+ if width < 1 or height < 1:
+ raise ValueError('width and height must be positive integers')
+
+ self._maximum_size = width, height
+
+ def set_size(self, width: int, height: int) -> None:
+ """Resize the window.
+
+ The behaviour is undefined if the window is not resizable, or if
+ it is currently fullscreen.
+
+ The window size does not include the border or title bar.
+
+ :Parameters:
+ `width` : int
+ New width of the window, in pixels.
+ `height` : int
+ New height of the window, in pixels.
+
+ """
+ if self._fullscreen:
+ raise WindowException('Cannot set size of fullscreen window.')
+ if width < 1 or height < 1:
+ raise ValueError('width and height must be positive integers')
+
+ self._width, self._height = width, height
+
+ def set_location(self, x, y):
+ """Set the position of the window.
+
+ :Parameters:
+ `x` : int
+ Distance of the left edge of the window from the left edge
+ of the virtual desktop, in pixels.
+ `y` : int
+ Distance of the top edge of the window from the top edge of
+ the virtual desktop, in pixels.
+
+ """
+ raise NotImplementedError('abstract')
+
+ def set_visible(self, visible: bool = True) -> None:
+ """Show or hide the window.
+
+ :Parameters:
+ `visible` : bool
+ If True, the window will be shown; otherwise it will be
+ hidden.
+ """
+ self._visible = visible
+
+ def set_vsync(self, vsync: bool) -> None:
+ """Enable or disable vertical sync control.
+
+ When enabled, this option ensures flips from the back to the front
+ buffer are performed only during the vertical retrace period of the
+ primary display. This can prevent "tearing" or flickering when
+ the buffer is updated in the middle of a video scan.
+
+ Note that LCD monitors have an analogous time in which they are not
+ reading from the video buffer; while it does not correspond to
+ a vertical retrace it has the same effect.
+
+ Also note that with multi-monitor systems the secondary monitor
+ cannot be synchronised to, so tearing and flicker cannot be avoided
+ when the window is positioned outside of the primary display.
+
+ :Parameters:
+ `vsync` : bool
+ If True, vsync is enabled, otherwise it is disabled.
+
+ """
+ self._vsync = vsync
+
+ def set_mouse_visible(self, visible=True):
+ """Show or hide the mouse cursor.
+
+ The mouse cursor will only be hidden while it is positioned within
+ this window. Mouse events will still be processed as usual.
+
+ :Parameters:
+ `visible` : bool
+ If True, the mouse cursor will be visible, otherwise it
+ will be hidden.
+
+ """
+ self._mouse_visible = visible
+ self.set_mouse_platform_visible()
+
+ def set_mouse_platform_visible(self, platform_visible=None):
+ """Set the platform-drawn mouse cursor visibility. This is called
+ automatically after changing the mouse cursor or exclusive mode.
+
+ Applications should not normally need to call this method, see
+ `set_mouse_visible` instead.
+
+ :Parameters:
+ `platform_visible` : bool or None
+ If None, sets platform visibility to the required visibility
+ for the current exclusive mode and cursor type. Otherwise,
+ a bool value will override and force a visibility.
+
+ """
+ raise NotImplementedError()
+
+ def set_mouse_cursor(self, cursor=None):
+ """Change the appearance of the mouse cursor.
+
+ The appearance of the mouse cursor is only changed while it is
+ within this window.
+
+ :Parameters:
+ `cursor` : `MouseCursor`
+ The cursor to set, or None to restore the default cursor.
+
+ """
+ if cursor is None:
+ cursor = DefaultMouseCursor()
+ self._mouse_cursor = cursor
+ self.set_mouse_platform_visible()
+
+ def set_exclusive_mouse(self, exclusive=True):
+ """Hide the mouse cursor and direct all mouse events to this
+ window.
+
+ When enabled, this feature prevents the mouse leaving the window. It
+ is useful for certain styles of games that require complete control of
+ the mouse. The position of the mouse as reported in subsequent events
+ is meaningless when exclusive mouse is enabled; you should only use
+ the relative motion parameters ``dx`` and ``dy``.
+
+ :Parameters:
+ `exclusive` : bool
+ If True, exclusive mouse is enabled, otherwise it is disabled.
+
+ """
+ self._mouse_exclusive = exclusive
+
+ def set_exclusive_keyboard(self, exclusive=True):
+ """Prevent the user from switching away from this window using
+ keyboard accelerators.
+
+ When enabled, this feature disables certain operating-system specific
+ key combinations such as Alt+Tab (Command+Tab on OS X). This can be
+ useful in certain kiosk applications, it should be avoided in general
+ applications or games.
+
+ :Parameters:
+ `exclusive` : bool
+ If True, exclusive keyboard is enabled, otherwise it is
+ disabled.
+
+ """
+ self._keyboard_exclusive = exclusive
+
+ def set_icon(self, *images):
+ """Set the window icon.
+
+ If multiple images are provided, one with an appropriate size
+ will be selected (if the correct size is not provided, the image
+ will be scaled).
+
+ Useful sizes to provide are 16x16, 32x32, 64x64 (Mac only) and
+ 128x128 (Mac only).
+
+ :Parameters:
+ `images` : sequence of `pyglet.image.AbstractImage`
+ List of images to use for the window icon.
+
+ """
+ pass
+
+ def switch_to(self):
+ """Make this window the current OpenGL rendering context.
+
+ Only one OpenGL context can be active at a time. This method sets
+ the current window's context to be current. You should use this
+ method in preference to `pyglet.gl.Context.set_current`, as it may
+ perform additional initialisation functions.
+ """
+ raise NotImplementedError('abstract')
+
+ # Attributes (sort alphabetically):
+ @property
+ def caption(self):
+ """The window caption (title). Read-only.
+
+ :type: str
+ """
+ return self._caption
+
+ @property
+ def resizeable(self):
+ """True if the window is resizable. Read-only.
+
+ :type: bool
+ """
+ return self._resizable
+
+ @property
+ def style(self):
+ """The window style; one of the ``WINDOW_STYLE_*`` constants.
+ Read-only.
+
+ :type: int
+ """
+ return self._style
+
+ @property
+ def fullscreen(self):
+ """True if the window is currently fullscreen. Read-only.
+
+ :type: bool
+ """
+ return self._fullscreen
+
+ @property
+ def visible(self):
+ """True if the window is currently visible. Read-only.
+
+ :type: bool
+ """
+ return self._visible
+
+ @property
+ def vsync(self):
+ """True if buffer flips are synchronised to the screen's vertical
+ retrace. Read-only.
+
+ :type: bool
+ """
+ return self._vsync
+
+ @property
+ def display(self):
+ """The display this window belongs to. Read-only.
+
+ :type: :py:class:`Display`
+ """
+ return self._display
+
+ @property
+ def screen(self):
+ """The screen this window is fullscreen in. Read-only.
+
+ :type: :py:class:`Screen`
+ """
+ return self._screen
+
+ @property
+ def config(self):
+ """A GL config describing the context of this window. Read-only.
+
+ :type: :py:class:`pyglet.gl.Config`
+ """
+ return self._config
+
+ @property
+ def context(self):
+ """The OpenGL context attached to this window. Read-only.
+
+ :type: :py:class:`pyglet.gl.Context`
+ """
+ return self._context
+
+ # These are the only properties that can be set
+ @property
+ def width(self):
+ """The width of the window, in pixels. Read-write.
+
+ :type: int
+ """
+ return self.get_size()[0]
+
+ @width.setter
+ def width(self, new_width):
+ self.set_size(new_width, self.height)
+
+ @property
+ def height(self):
+ """The height of the window, in pixels. Read-write.
+
+ :type: int
+ """
+ return self.get_size()[1]
+
+ @height.setter
+ def height(self, new_height):
+ self.set_size(self.width, new_height)
+
+ @property
+ def size(self):
+ """The size of the window. Read-Write.
+
+ :type: tuple
+ """
+ return self.get_size()
+
+ @size.setter
+ def size(self, new_size):
+ self.set_size(*new_size)
+
+ @property
+ def aspect_ratio(self):
+ """The aspect ratio of the window. Read-Only.
+
+ :type: float
+ """
+ w, h = self.get_size()
+ return w / h
+
+ @property
+ def projection(self):
+ """The OpenGL window projection matrix. Read-write.
+
+ This matrix is used to transform vertices when using any of the built-in
+ drawable classes. `view` is done first, then `projection`.
+
+ The default projection matrix is orthographic (2D),
+ but a custom :py:class:`pyglet.math.Mat4` instance
+ can be set. Alternatively, you can supply a flat
+ tuple of 16 values.
+
+ (2D), but can be changed to any 4x4 matrix desired.
+ See :py:class:`pyglet.math.Mat4`.
+
+ :type: :py:class:`pyglet.math.Mat4`
+ """
+ return self._projection_matrix
+
+ @projection.setter
+ def projection(self, matrix: Mat4):
+
+ with self.ubo as window_block:
+ window_block.projection[:] = matrix
+
+ self._projection_matrix = matrix
+
+ @property
+ def view(self):
+ """The OpenGL window view matrix. Read-write.
+
+ This matrix is used to transform vertices when using any of the built-in
+ drawable classes. `view` is done first, then `projection`.
+
+ The default view is an identity matrix, but a custom
+ :py:class:`pyglet.math.Mat4` instance can be set.
+ Alternatively, you can supply a flat tuple of 16 values.
+
+ :type: :py:class:`pyglet.math.Mat4`
+ """
+ return self._view_matrix
+
+ @view.setter
+ def view(self, matrix: Mat4):
+
+ with self.ubo as window_block:
+ window_block.view[:] = matrix
+
+ self._view_matrix = matrix
+
+ @property
+ def viewport(self):
+ """The Window viewport
+
+ The Window viewport, expressed as (x, y, width, height).
+
+ :rtype: (int, int, int, int)
+ :return: The viewport size as a tuple of four ints.
+ """
+ return self._viewport
+
+ @viewport.setter
+ def viewport(self, values):
+ self._viewport = values
+ pr = self.get_pixel_ratio()
+ x, y, w, h = values
+ pyglet.gl.glViewport(int(x * pr), int(y * pr), int(w * pr), int(h * pr))
+
+ # If documenting, show the event methods. Otherwise, leave them out
+ # as they are not really methods.
+ if _is_pyglet_doc_run:
+ def on_activate(self):
+ """The window was activated.
+
+ This event can be triggered by clicking on the title bar, bringing
+ it to the foreground; or by some platform-specific method.
+
+ When a window is "active" it has the keyboard focus.
+
+ :event:
+ """
+
+ def on_close(self):
+ """The user attempted to close the window.
+
+ This event can be triggered by clicking on the "X" control box in
+ the window title bar, or by some other platform-dependent manner.
+
+ The default handler sets `has_exit` to ``True``. In pyglet 1.1, if
+ `pyglet.app.event_loop` is being used, `close` is also called,
+ closing the window immediately.
+
+ :event:
+ """
+
+ def on_context_lost(self):
+ """The window's GL context was lost.
+
+ When the context is lost no more GL methods can be called until it
+ is recreated. This is a rare event, triggered perhaps by the user
+ switching to an incompatible video mode. When it occurs, an
+ application will need to reload all objects (display lists, texture
+ objects, shaders) as well as restore the GL state.
+
+ :event:
+ """
+
+ def on_context_state_lost(self):
+ """The state of the window's GL context was lost.
+
+ pyglet may sometimes need to recreate the window's GL context if
+ the window is moved to another video device, or between fullscreen
+ or windowed mode. In this case it will try to share the objects
+ (display lists, texture objects, shaders) between the old and new
+ contexts. If this is possible, only the current state of the GL
+ context is lost, and the application should simply restore state.
+
+ :event:
+ """
+
+ def on_deactivate(self):
+ """The window was deactivated.
+
+ This event can be triggered by clicking on another application
+ window. When a window is deactivated it no longer has the
+ keyboard focus.
+
+ :event:
+ """
+
+ def on_draw(self, dt):
+ """The window contents must be redrawn.
+
+ The `EventLoop` will dispatch this event when the window
+ should be redrawn. This will happen during idle time after
+ any window events and after any scheduled functions were called.
+
+ The window will already have the GL context, so there is no
+ need to call `switch_to`. The window's `flip` method will
+ be called after this event, so your event handler should not.
+
+ You should make no assumptions about the window contents when
+ this event is triggered; a resize or expose event may have
+ invalidated the framebuffer since the last time it was drawn.
+
+ .. versionadded:: 1.1
+
+ :event:
+ """
+
+ def on_expose(self):
+ """A portion of the window needs to be redrawn.
+
+ This event is triggered when the window first appears, and any time
+ the contents of the window is invalidated due to another window
+ obscuring it.
+
+ There is no way to determine which portion of the window needs
+ redrawing. Note that the use of this method is becoming
+ increasingly uncommon, as newer window managers composite windows
+ automatically and keep a backing store of the window contents.
+
+ :event:
+ """
+
+ def on_file_drop(self, x, y, paths):
+ """File(s) were dropped into the window, will return the position of the cursor and
+ a list of paths to the files that were dropped.
+
+ .. versionadded:: 1.5.1
+
+ :event:
+ """
+
+ def on_hide(self):
+ """The window was hidden.
+
+ This event is triggered when a window is minimised
+ or hidden by the user.
+
+ :event:
+ """
+
+ def on_key_press(self, symbol, modifiers):
+ """A key on the keyboard was pressed (and held down).
+
+ Since pyglet 1.1 the default handler dispatches the :py:meth:`~pyglet.window.Window.on_close`
+ event if the ``ESC`` key is pressed.
+
+ :Parameters:
+ `symbol` : int
+ The key symbol pressed.
+ `modifiers` : int
+ Bitwise combination of the key modifiers active.
+
+ :event:
+ """
+
+ def on_key_release(self, symbol, modifiers):
+ """A key on the keyboard was released.
+
+ :Parameters:
+ `symbol` : int
+ The key symbol pressed.
+ `modifiers` : int
+ Bitwise combination of the key modifiers active.
+
+ :event:
+ """
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ """The mouse was moved with no buttons held down.
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+ `dx` : int
+ Relative X position from the previous mouse position.
+ `dy` : int
+ Relative Y position from the previous mouse position.
+
+ :event:
+ """
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ """The mouse was moved with one or more mouse buttons pressed.
+
+ This event will continue to be fired even if the mouse leaves
+ the window, so long as the drag buttons are continuously held down.
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+ `dx` : int
+ Relative X position from the previous mouse position.
+ `dy` : int
+ Relative Y position from the previous mouse position.
+ `buttons` : int
+ Bitwise combination of the mouse buttons currently pressed.
+ `modifiers` : int
+ Bitwise combination of any keyboard modifiers currently
+ active.
+
+ :event:
+ """
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ """A mouse button was pressed (and held down).
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+ `button` : int
+ The mouse button that was pressed.
+ `modifiers` : int
+ Bitwise combination of any keyboard modifiers currently
+ active.
+
+ :event:
+ """
+
+ def on_mouse_release(self, x, y, button, modifiers):
+ """A mouse button was released.
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+ `button` : int
+ The mouse button that was released.
+ `modifiers` : int
+ Bitwise combination of any keyboard modifiers currently
+ active.
+
+ :event:
+ """
+
+ def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
+ """The mouse wheel was scrolled.
+
+ Note that most mice have only a vertical scroll wheel, so
+ `scroll_x` is usually 0. An exception to this is the Apple Mighty
+ Mouse, which has a mouse ball in place of the wheel which allows
+ both `scroll_x` and `scroll_y` movement.
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+ `scroll_x` : float
+ Amount of movement on the horizontal axis.
+ `scroll_y` : float
+ Amount of movement on the vertical axis.
+
+ :event:
+ """
+
+ def on_mouse_enter(self, x, y):
+ """The mouse was moved into the window.
+
+ This event will not be triggered if the mouse is currently being
+ dragged.
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+
+ :event:
+ """
+
+ def on_mouse_leave(self, x, y):
+ """The mouse was moved outside of the window.
+
+ This event will not be triggered if the mouse is currently being
+ dragged. Note that the coordinates of the mouse pointer will be
+ outside of the window rectangle.
+
+ :Parameters:
+ `x` : int
+ Distance in pixels from the left edge of the window.
+ `y` : int
+ Distance in pixels from the bottom edge of the window.
+
+ :event:
+ """
+
+ def on_move(self, x, y):
+ """The window was moved.
+
+ :Parameters:
+ `x` : int
+ Distance from the left edge of the screen to the left edge
+ of the window.
+ `y` : int
+ Distance from the top edge of the screen to the top edge of
+ the window. Note that this is one of few methods in pyglet
+ which use a Y-down coordinate system.
+
+ :event:
+ """
+
+ def on_refresh(self, dt):
+ """The window contents must be redrawn.
+
+ The `EventLoop` will dispatch this event when the window
+ should be redrawn.
+
+ The window will already have the GL context, so there is no
+ need to call `switch_to`. The window's `flip` method will
+ be called after this event, so your event handler should not.
+
+ You should make no assumptions about the window contents when
+ this event is triggered; a resize or expose event may have
+ invalidated the framebuffer since the last time it was drawn.
+
+ .. versionadded:: 2.0
+
+ :event:
+ """
+
+ def on_resize(self, width, height):
+ """The window was resized.
+
+ The window will have the GL context when this event is dispatched;
+ there is no need to call `switch_to` in this handler.
+
+ :Parameters:
+ `width` : int
+ The new width of the window, in pixels.
+ `height` : int
+ The new height of the window, in pixels.
+
+ :event:
+ """
+
+ def on_show(self):
+ """The window was shown.
+
+ This event is triggered when a window is restored after being
+ minimised, hidden, or after being displayed for the first time.
+
+ :event:
+ """
+
+ def on_text(self, text):
+ """The user input some text.
+
+ Typically this is called after :py:meth:`~pyglet.window.Window.on_key_press` and before
+ :py:meth:`~pyglet.window.Window.on_key_release`, but may also be called multiple times if the key
+ is held down (key repeating); or called without key presses if
+ another input method was used (e.g., a pen input).
+
+ You should always use this method for interpreting text, as the
+ key symbols often have complex mappings to their unicode
+ representation which this event takes care of.
+
+ :Parameters:
+ `text` : unicode
+ The text entered by the user.
+
+ :event:
+ """
+
+ def on_text_motion(self, motion):
+ """The user moved the text input cursor.
+
+ Typically this is called after :py:meth:`~pyglet.window.Window.on_key_press` and before
+ :py:meth:`~pyglet.window.Window.on_key_release`, but may also be called multiple times if the key
+ is help down (key repeating).
+
+ You should always use this method for moving the text input cursor
+ (caret), as different platforms have different default keyboard
+ mappings, and key repeats are handled correctly.
+
+ The values that `motion` can take are defined in
+ :py:mod:`pyglet.window.key`:
+
+ * MOTION_UP
+ * MOTION_RIGHT
+ * MOTION_DOWN
+ * MOTION_LEFT
+ * MOTION_NEXT_WORD
+ * MOTION_PREVIOUS_WORD
+ * MOTION_BEGINNING_OF_LINE
+ * MOTION_END_OF_LINE
+ * MOTION_NEXT_PAGE
+ * MOTION_PREVIOUS_PAGE
+ * MOTION_BEGINNING_OF_FILE
+ * MOTION_END_OF_FILE
+ * MOTION_BACKSPACE
+ * MOTION_DELETE
+
+ :Parameters:
+ `motion` : int
+ The direction of motion; see remarks.
+
+ :event:
+ """
+
+ def on_text_motion_select(self, motion):
+ """The user moved the text input cursor while extending the
+ selection.
+
+ Typically this is called after :py:meth:`~pyglet.window.Window.on_key_press` and before
+ :py:meth:`~pyglet.window.Window.on_key_release`, but may also be called multiple times if the key
+ is help down (key repeating).
+
+ You should always use this method for responding to text selection
+ events rather than the raw :py:meth:`~pyglet.window.Window.on_key_press`, as different platforms
+ have different default keyboard mappings, and key repeats are
+ handled correctly.
+
+ The values that `motion` can take are defined in :py:mod:`pyglet.window.key`:
+
+ * MOTION_UP
+ * MOTION_RIGHT
+ * MOTION_DOWN
+ * MOTION_LEFT
+ * MOTION_NEXT_WORD
+ * MOTION_PREVIOUS_WORD
+ * MOTION_BEGINNING_OF_LINE
+ * MOTION_END_OF_LINE
+ * MOTION_NEXT_PAGE
+ * MOTION_PREVIOUS_PAGE
+ * MOTION_BEGINNING_OF_FILE
+ * MOTION_END_OF_FILE
+
+ :Parameters:
+ `motion` : int
+ The direction of selection motion; see remarks.
+
+ :event:
+ """
+
+
+BaseWindow.register_event_type('on_key_press')
+BaseWindow.register_event_type('on_key_release')
+BaseWindow.register_event_type('on_text')
+BaseWindow.register_event_type('on_text_motion')
+BaseWindow.register_event_type('on_text_motion_select')
+BaseWindow.register_event_type('on_mouse_motion')
+BaseWindow.register_event_type('on_mouse_drag')
+BaseWindow.register_event_type('on_mouse_press')
+BaseWindow.register_event_type('on_mouse_release')
+BaseWindow.register_event_type('on_mouse_scroll')
+BaseWindow.register_event_type('on_mouse_enter')
+BaseWindow.register_event_type('on_mouse_leave')
+BaseWindow.register_event_type('on_close')
+BaseWindow.register_event_type('on_expose')
+BaseWindow.register_event_type('on_resize')
+BaseWindow.register_event_type('on_move')
+BaseWindow.register_event_type('on_activate')
+BaseWindow.register_event_type('on_deactivate')
+BaseWindow.register_event_type('on_show')
+BaseWindow.register_event_type('on_hide')
+BaseWindow.register_event_type('on_context_lost')
+BaseWindow.register_event_type('on_context_state_lost')
+BaseWindow.register_event_type('on_file_drop')
+BaseWindow.register_event_type('on_draw')
+BaseWindow.register_event_type('on_refresh')
+
+
+class FPSDisplay:
+ """Display of a window's framerate.
+
+ This is a convenience class to aid in profiling and debugging. Typical
+ usage is to create an `FPSDisplay` for each window, and draw the display
+ at the end of the windows' :py:meth:`~pyglet.window.Window.on_draw` event handler::
+
+ window = pyglet.window.Window()
+ fps_display = FPSDisplay(window)
+
+ @window.event
+ def on_draw():
+ # ... perform ordinary window drawing operations ...
+
+ fps_display.draw()
+
+ The style and position of the display can be modified via the :py:func:`~pyglet.text.Label`
+ attribute. Different text can be substituted by overriding the
+ `set_fps` method. The display can be set to update more or less often
+ by setting the `update_period` attribute. Note: setting the `update_period`
+ to a value smaller than your Window refresh rate will cause inaccurate readings.
+
+ :Ivariables:
+ `label` : Label
+ The text label displaying the framerate.
+
+ """
+
+ #: Time in seconds between updates.
+ #:
+ #: :type: float
+ update_period = 0.25
+
+ def __init__(self, window, color=(127, 127, 127, 127), samples=240):
+ from time import time
+ from statistics import mean
+ from collections import deque
+ from pyglet.text import Label
+ self._time = time
+ self._mean = mean
+
+ # Hook into the Window.flip method:
+ self._window_flip, window.flip = window.flip, self._hook_flip
+ self.label = Label('', x=10, y=10, font_size=24, bold=True, color=color)
+
+ self._elapsed = 0.0
+ self._last_time = time()
+ self._delta_times = deque(maxlen=samples)
+
+ def update(self):
+ """Records a new data point at the current time. This method
+ is called automatically when the window buffer is flipped.
+ """
+ t = self._time()
+ delta = t - self._last_time
+ self._elapsed += delta
+ self._delta_times.append(delta)
+ self._last_time = t
+
+ if self._elapsed >= self.update_period:
+ self._elapsed = 0
+ self.label.text = f"{1 / self._mean(self._delta_times):.2f}"
+
+ def draw(self):
+ """Draw the label."""
+ self.label.draw()
+
+ def _hook_flip(self):
+ self.update()
+ self._window_flip()
+
+
+if _is_pyglet_doc_run:
+ # We are building documentation
+ Window = BaseWindow
+ Window.__name__ = 'Window'
+ del BaseWindow
+
+else:
+ # Try to determine which platform to use.
+ if pyglet.options['headless']:
+ from pyglet.window.headless import HeadlessWindow as Window
+ elif pyglet.compat_platform == 'darwin':
+ from pyglet.window.cocoa import CocoaWindow as Window
+ elif pyglet.compat_platform in ('win32', 'cygwin'):
+ from pyglet.window.win32 import Win32Window as Window
+ else:
+ from pyglet.window.xlib import XlibWindow as Window
+
+# Create shadow window. (trickery is for circular import)
+if not _is_pyglet_doc_run:
+ pyglet.window = sys.modules[__name__]
+ gl._create_shadow_window()
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..5dfed13db20f1f18dca01192e0c0b1661d8d0259
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/__init__.py
@@ -0,0 +1,573 @@
+from ctypes import *
+
+import pyglet
+from pyglet.window import BaseWindow
+from pyglet.window import MouseCursor, DefaultMouseCursor
+from pyglet.window import WindowException
+from pyglet.event import EventDispatcher
+
+from pyglet.canvas.cocoa import CocoaCanvas
+
+from pyglet.libs.darwin import cocoapy, CGPoint
+
+from .systemcursor import SystemCursor
+from .pyglet_delegate import PygletDelegate
+from .pyglet_window import PygletWindow, PygletToolWindow
+from .pyglet_view import PygletView
+
+NSApplication = cocoapy.ObjCClass('NSApplication')
+NSCursor = cocoapy.ObjCClass('NSCursor')
+NSAutoreleasePool = cocoapy.ObjCClass('NSAutoreleasePool')
+NSColor = cocoapy.ObjCClass('NSColor')
+NSEvent = cocoapy.ObjCClass('NSEvent')
+NSImage = cocoapy.ObjCClass('NSImage')
+
+quartz = cocoapy.quartz
+cf = cocoapy.cf
+
+
+class CocoaMouseCursor(MouseCursor):
+ gl_drawable = False
+
+ def __init__(self, cursorName):
+ # cursorName is a string identifying one of the named default NSCursors
+ # e.g. 'pointingHandCursor', and can be sent as message to NSCursor class.
+ self.cursorName = cursorName
+
+ def set(self):
+ cursor = getattr(NSCursor, self.cursorName)()
+ cursor.set()
+
+
+class CocoaWindow(BaseWindow):
+
+ # NSWindow instance.
+ _nswindow = None
+
+ # Delegate object.
+ _delegate = None
+
+ # Window properties
+ _mouse_platform_visible = True
+ _mouse_ignore_motion = False
+
+ # Flag set during close() method.
+ _was_closed = False
+
+ # NSWindow style masks.
+ _style_masks = {
+ BaseWindow.WINDOW_STYLE_DEFAULT: cocoapy.NSTitledWindowMask |
+ cocoapy.NSClosableWindowMask |
+ cocoapy.NSMiniaturizableWindowMask,
+ BaseWindow.WINDOW_STYLE_DIALOG: cocoapy.NSTitledWindowMask |
+ cocoapy.NSClosableWindowMask,
+ BaseWindow.WINDOW_STYLE_TOOL: cocoapy.NSTitledWindowMask |
+ cocoapy.NSClosableWindowMask |
+ cocoapy.NSUtilityWindowMask,
+ BaseWindow.WINDOW_STYLE_BORDERLESS: cocoapy.NSBorderlessWindowMask,
+ }
+
+ def _recreate(self, changes):
+ if 'context' in changes:
+ self.context.set_current()
+
+ if 'fullscreen' in changes:
+ if not self._fullscreen: # leaving fullscreen
+ self.screen.release_display()
+
+ self._create()
+
+ def _create(self):
+ # Create a temporary autorelease pool for this method.
+ pool = NSAutoreleasePool.alloc().init()
+
+ if self._nswindow:
+ # The window is about the be recreated so destroy everything
+ # associated with the old window, then destroy the window itself.
+ nsview = self.canvas.nsview
+ self.canvas = None
+ self._nswindow.orderOut_(None)
+ self._nswindow.close()
+ self.context.detach()
+ self._nswindow.release()
+ self._nswindow = None
+ nsview.release()
+ self._delegate.release()
+ self._delegate = None
+
+ # Determine window parameters.
+ content_rect = cocoapy.NSMakeRect(0, 0, self._width, self._height)
+ WindowClass = PygletWindow
+ if self._fullscreen:
+ style_mask = cocoapy.NSBorderlessWindowMask
+ else:
+ if self._style not in self._style_masks:
+ self._style = self.WINDOW_STYLE_DEFAULT
+ style_mask = self._style_masks[self._style]
+ if self._resizable:
+ style_mask |= cocoapy.NSResizableWindowMask
+ if self._style == BaseWindow.WINDOW_STYLE_TOOL:
+ WindowClass = PygletToolWindow
+
+ # First create an instance of our NSWindow subclass.
+
+ # FIX ME:
+ # Need to use this initializer to have any hope of multi-monitor support.
+ # But currently causes problems on Mac OS X Lion. So for now, we initialize the
+ # window without including screen information.
+ #
+ # self._nswindow = WindowClass.alloc().initWithContentRect_styleMask_backing_defer_screen_(
+ # content_rect, # contentRect
+ # style_mask, # styleMask
+ # NSBackingStoreBuffered, # backing
+ # False, # defer
+ # self.screen.get_nsscreen()) # screen
+
+ self._nswindow = WindowClass.alloc().initWithContentRect_styleMask_backing_defer_(
+ content_rect, # contentRect
+ style_mask, # styleMask
+ cocoapy.NSBackingStoreBuffered, # backing
+ False) # defer
+
+ if self._fullscreen:
+ # BUG: I suspect that this doesn't do the right thing when using
+ # multiple monitors (which would be to go fullscreen on the monitor
+ # where the window is located). However I've no way to test.
+ blackColor = NSColor.blackColor()
+ self._nswindow.setBackgroundColor_(blackColor)
+ self._nswindow.setOpaque_(True)
+ self.screen.capture_display()
+ self._nswindow.setLevel_(quartz.CGShieldingWindowLevel())
+ self.context.set_full_screen()
+ self._center_window()
+ self._mouse_in_window = True
+ else:
+ self._set_nice_window_location()
+ self._mouse_in_window = self._mouse_in_content_rect()
+
+ # Then create a view and set it as our NSWindow's content view.
+ self._nsview = PygletView.alloc().initWithFrame_cocoaWindow_(content_rect, self)
+ self._nswindow.setContentView_(self._nsview)
+ self._nswindow.makeFirstResponder_(self._nsview)
+
+ # Create a canvas with the view as its drawable and attach context to it.
+ self.canvas = CocoaCanvas(self.display, self.screen, self._nsview)
+ self.context.attach(self.canvas)
+
+ # Configure the window.
+ self._nswindow.setAcceptsMouseMovedEvents_(True)
+ self._nswindow.setReleasedWhenClosed_(False)
+ self._nswindow.useOptimizedDrawing_(True)
+ self._nswindow.setPreservesContentDuringLiveResize_(False)
+
+ # Set the delegate.
+ self._delegate = PygletDelegate.alloc().initWithWindow_(self)
+
+ # Configure CocoaWindow.
+ self.set_caption(self._caption)
+ if self._minimum_size is not None:
+ self.set_minimum_size(*self._minimum_size)
+ if self._maximum_size is not None:
+ self.set_maximum_size(*self._maximum_size)
+
+ # TODO: Add support for file drops.
+ if self._file_drops:
+ raise NotImplementedError("File drops are not implemented on MacOS")
+
+ self.context.update_geometry()
+ self.switch_to()
+ self.set_vsync(self._vsync)
+ self.set_visible(self._visible)
+
+ pool.drain()
+
+ def _set_nice_window_location(self):
+ # Construct a list of all visible windows that aren't us.
+ visible_windows = [win for win in pyglet.app.windows if
+ win is not self and
+ win._nswindow and
+ win._nswindow.isVisible()]
+ # If there aren't any visible windows, then center this window.
+ if not visible_windows:
+ self._center_window()
+ # Otherwise, cascade from last window in list.
+ else:
+ point = visible_windows[-1]._nswindow.cascadeTopLeftFromPoint_(cocoapy.NSZeroPoint)
+ self._nswindow.cascadeTopLeftFromPoint_(point)
+
+ def _center_window(self):
+ # [NSWindow center] does not move the window to a true center position
+ # and also always moves the window to the main display.
+ x = self.screen.x + int((self.screen.width - self._width) // 2)
+ y = self.screen.y + int((self.screen.height - self._height) // 2)
+ self._nswindow.setFrameOrigin_(cocoapy.NSPoint(x, y))
+
+ def close(self):
+ # If we've already gone through this once, don't do it again.
+ if self._was_closed:
+ return
+
+ # Create a temporary autorelease pool for this method.
+ pool = NSAutoreleasePool.new()
+
+ # Restore cursor visibility
+ self.set_mouse_platform_visible(True)
+ self.set_exclusive_mouse(False)
+ self.set_exclusive_keyboard(False)
+
+ # Remove the delegate object
+ if self._delegate:
+ self._nswindow.setDelegate_(None)
+ self._delegate.release()
+ self._delegate = None
+
+ # Remove window from display and remove its view.
+ if self._nswindow:
+ self._nswindow.orderOut_(None)
+ self._nswindow.setContentView_(None)
+ self._nswindow.close()
+
+ # Restore screen mode. This also releases the display
+ # if it was captured for fullscreen mode.
+ self.screen.restore_mode()
+
+ # Remove view from canvas and then remove canvas.
+ if self.canvas:
+ self.canvas.nsview.release()
+ self.canvas.nsview = None
+ self.canvas = None
+
+ # Do this last, so that we don't see white flash
+ # when exiting application from fullscreen mode.
+ super(CocoaWindow, self).close()
+
+ self._was_closed = True
+ pool.drain()
+
+ def switch_to(self):
+ if self.context:
+ self.context.set_current()
+
+ def flip(self):
+ self.draw_mouse_cursor()
+ if self.context:
+ self.context.flip()
+
+ def dispatch_events(self):
+ self._allow_dispatch_event = True
+ # Process all pyglet events.
+ self.dispatch_pending_events()
+ event = True
+
+ # Dequeue and process all of the pending Cocoa events.
+ pool = NSAutoreleasePool.new()
+ NSApp = NSApplication.sharedApplication()
+ while event and self._nswindow and self._context:
+ event = NSApp.nextEventMatchingMask_untilDate_inMode_dequeue_(
+ cocoapy.NSAnyEventMask, None, cocoapy.NSEventTrackingRunLoopMode, True)
+
+ if event:
+ event_type = event.type()
+ # Pass on all events.
+ NSApp.sendEvent_(event)
+ # And resend key events to special handlers.
+ if event_type == cocoapy.NSKeyDown and not event.isARepeat():
+ NSApp.sendAction_to_from_(cocoapy.get_selector('pygletKeyDown:'), None, event)
+ elif event_type == cocoapy.NSKeyUp:
+ NSApp.sendAction_to_from_(cocoapy.get_selector('pygletKeyUp:'), None, event)
+ elif event_type == cocoapy.NSFlagsChanged:
+ NSApp.sendAction_to_from_(cocoapy.get_selector('pygletFlagsChanged:'), None, event)
+ NSApp.updateWindows()
+
+ pool.drain()
+
+ self._allow_dispatch_event = False
+
+ def dispatch_pending_events(self):
+ while self._event_queue:
+ event = self._event_queue.pop(0)
+ EventDispatcher.dispatch_event(self, *event)
+
+ def set_caption(self, caption):
+ self._caption = caption
+ if self._nswindow is not None:
+ self._nswindow.setTitle_(cocoapy.get_NSString(caption))
+
+ def set_icon(self, *images):
+ # Only use the biggest image from the list.
+ max_image = images[0]
+ for img in images:
+ if img.width > max_image.width and img.height > max_image.height:
+ max_image = img
+
+ # Grab image data from pyglet image.
+ image = max_image.get_image_data()
+ format = 'ARGB'
+ bytesPerRow = len(format) * image.width
+ data = image.get_data(format, -bytesPerRow)
+
+ # Use image data to create a data provider.
+ # Using CGDataProviderCreateWithData crashes PyObjC 2.2b3, so we create
+ # a CFDataRef object first and use it to create the data provider.
+ cfdata = c_void_p(cf.CFDataCreate(None, data, len(data)))
+ provider = c_void_p(quartz.CGDataProviderCreateWithCFData(cfdata))
+
+ colorSpace = c_void_p(quartz.CGColorSpaceCreateDeviceRGB())
+
+ # Then create a CGImage from the provider.
+ cgimage = c_void_p(quartz.CGImageCreate(
+ image.width, image.height, 8, 32, bytesPerRow,
+ colorSpace,
+ cocoapy.kCGImageAlphaFirst,
+ provider,
+ None,
+ True,
+ cocoapy.kCGRenderingIntentDefault))
+
+ if not cgimage:
+ return
+
+ cf.CFRelease(cfdata)
+ quartz.CGDataProviderRelease(provider)
+ quartz.CGColorSpaceRelease(colorSpace)
+
+ # Turn the CGImage into an NSImage.
+ size = cocoapy.NSMakeSize(image.width, image.height)
+ nsimage = NSImage.alloc().initWithCGImage_size_(cgimage, size)
+ if not nsimage:
+ return
+
+ # And finally set the app icon.
+ NSApp = NSApplication.sharedApplication()
+ NSApp.setApplicationIconImage_(nsimage)
+ nsimage.release()
+
+ def get_location(self):
+ window_frame = self._nswindow.frame()
+ rect = self._nswindow.contentRectForFrameRect_(window_frame)
+ screen_frame = self._nswindow.screen().frame()
+ screen_width = int(screen_frame.size.width)
+ screen_height = int(screen_frame.size.height)
+ return int(rect.origin.x), int(screen_height - rect.origin.y - rect.size.height)
+
+ def set_location(self, x, y):
+ window_frame = self._nswindow.frame()
+ rect = self._nswindow.contentRectForFrameRect_(window_frame)
+ screen_frame = self._nswindow.screen().frame()
+ screen_width = int(screen_frame.size.width)
+ screen_height = int(screen_frame.size.height)
+ origin = cocoapy.NSPoint(x, screen_height - y - rect.size.height)
+ self._nswindow.setFrameOrigin_(origin)
+
+ def get_framebuffer_size(self):
+ view = self.context._nscontext.view()
+ bounds = view.convertRectToBacking_(view.bounds()).size
+ return int(bounds.width), int(bounds.height)
+
+ def set_size(self, width: int, height: int) -> None:
+ super().set_size(width, height)
+ # Move frame origin down so that top-left corner of window doesn't move.
+ window_frame = self._nswindow.frame()
+ rect = self._nswindow.contentRectForFrameRect_(window_frame)
+ rect.origin.y += rect.size.height - height
+ rect.size.width = width
+ rect.size.height = height
+ new_frame = self._nswindow.frameRectForContentRect_(rect)
+ # The window background flashes when the frame size changes unless it's
+ # animated, but we can set the window's animationResizeTime to zero.
+ is_visible = self._nswindow.isVisible()
+ self._nswindow.setFrame_display_animate_(new_frame, True, is_visible)
+ self.dispatch_event('on_resize', width, height)
+
+ def set_minimum_size(self, width: int, height: int) -> None:
+ super().set_minimum_size(width, height)
+
+ if self._nswindow is not None:
+ ns_minimum_size = cocoapy.NSSize(*self._minimum_size)
+ self._nswindow.setContentMinSize_(ns_minimum_size)
+
+ def set_maximum_size(self, width: int, height: int) -> None:
+ super().set_maximum_size(width, height)
+
+ if self._nswindow is not None:
+ ns_maximum_size = cocoapy.NSSize(*self._maximum_size)
+ self._nswindow.setContentMaxSize_(ns_maximum_size)
+
+ def activate(self):
+ if self._nswindow is not None:
+ NSApp = NSApplication.sharedApplication()
+ NSApp.activateIgnoringOtherApps_(True)
+ self._nswindow.makeKeyAndOrderFront_(None)
+
+ def set_visible(self, visible: bool = True) -> None:
+ super().set_visible(visible)
+
+ if self._nswindow is not None:
+ if visible:
+ self.dispatch_event('on_resize', self._width, self._height)
+ self.dispatch_event('on_show')
+ self.dispatch_event('on_expose')
+ self._nswindow.makeKeyAndOrderFront_(None)
+ else:
+ self._nswindow.orderOut_(None)
+
+ def minimize(self):
+ self._mouse_in_window = False
+ if self._nswindow is not None:
+ self._nswindow.miniaturize_(None)
+
+ def maximize(self):
+ if self._nswindow is not None:
+ self._nswindow.zoom_(None)
+
+ def set_vsync(self, vsync: bool) -> None:
+ if pyglet.options['vsync'] is not None:
+ vsync = pyglet.options['vsync']
+
+ super().set_vsync(vsync)
+ self.context.set_vsync(vsync)
+
+ def _mouse_in_content_rect(self):
+ # Returns true if mouse is inside the window's content rectangle.
+ # Better to use this method to check manually rather than relying
+ # on instance variables that may not be set correctly.
+ point = NSEvent.mouseLocation()
+ window_frame = self._nswindow.frame()
+ rect = self._nswindow.contentRectForFrameRect_(window_frame)
+ return cocoapy.foundation.NSMouseInRect(point, rect, False)
+
+ def set_mouse_platform_visible(self, platform_visible=None):
+ # When the platform_visible argument is supplied with a boolean, then this
+ # method simply sets whether or not the platform mouse cursor is visible.
+ if platform_visible is not None:
+ if platform_visible:
+ SystemCursor.unhide()
+ else:
+ SystemCursor.hide()
+ # But if it has been called without an argument, it turns into
+ # a completely different function. Now we are trying to figure out
+ # whether or not the mouse *should* be visible, and if so, what it should
+ # look like.
+ else:
+ # If we are in mouse exclusive mode, then hide the mouse cursor.
+ if self._mouse_exclusive:
+ SystemCursor.hide()
+ # If we aren't inside the window, then always show the mouse
+ # and make sure that it is the default cursor.
+ elif not self._mouse_in_content_rect():
+ NSCursor.arrowCursor().set()
+ SystemCursor.unhide()
+ # If we are in the window, then what we do depends on both
+ # the current pyglet-set visibility setting for the mouse and
+ # the type of the mouse cursor. If the cursor has been hidden
+ # in the window with set_mouse_visible() then don't show it.
+ elif not self._mouse_visible:
+ SystemCursor.hide()
+ # If the mouse is set as a system-defined cursor, then we
+ # need to set the cursor and show the mouse.
+ # *** FIX ME ***
+ elif isinstance(self._mouse_cursor, CocoaMouseCursor):
+ self._mouse_cursor.set()
+ SystemCursor.unhide()
+ # If the mouse cursor is OpenGL drawable, then it we need to hide
+ # the system mouse cursor, so that the cursor can draw itself.
+ elif self._mouse_cursor.gl_drawable:
+ SystemCursor.hide()
+ # Otherwise, show the default cursor.
+ else:
+ NSCursor.arrowCursor().set()
+ SystemCursor.unhide()
+
+ def get_system_mouse_cursor(self, name):
+ # It would make a lot more sense for most of this code to be
+ # inside the CocoaMouseCursor class, but all of the CURSOR_xxx
+ # constants are defined as properties of BaseWindow.
+ if name == self.CURSOR_DEFAULT:
+ return DefaultMouseCursor()
+ cursors = {
+ self.CURSOR_CROSSHAIR: 'crosshairCursor',
+ self.CURSOR_HAND: 'pointingHandCursor',
+ self.CURSOR_HELP: 'arrowCursor',
+ self.CURSOR_NO: 'operationNotAllowedCursor', # Mac OS 10.6
+ self.CURSOR_SIZE: 'arrowCursor',
+ self.CURSOR_SIZE_UP: 'resizeUpCursor',
+ self.CURSOR_SIZE_UP_RIGHT: 'arrowCursor',
+ self.CURSOR_SIZE_RIGHT: 'resizeRightCursor',
+ self.CURSOR_SIZE_DOWN_RIGHT: 'arrowCursor',
+ self.CURSOR_SIZE_DOWN: 'resizeDownCursor',
+ self.CURSOR_SIZE_DOWN_LEFT: 'arrowCursor',
+ self.CURSOR_SIZE_LEFT: 'resizeLeftCursor',
+ self.CURSOR_SIZE_UP_LEFT: 'arrowCursor',
+ self.CURSOR_SIZE_UP_DOWN: 'resizeUpDownCursor',
+ self.CURSOR_SIZE_LEFT_RIGHT: 'resizeLeftRightCursor',
+ self.CURSOR_TEXT: 'IBeamCursor',
+ self.CURSOR_WAIT: 'arrowCursor', # No wristwatch cursor in Cocoa
+ self.CURSOR_WAIT_ARROW: 'arrowCursor', # No wristwatch cursor in Cocoa
+ }
+ if name not in cursors:
+ raise RuntimeError('Unknown cursor name "%s"' % name)
+ return CocoaMouseCursor(cursors[name])
+
+ def set_mouse_position(self, x, y, absolute=False):
+ if absolute:
+ # If absolute, then x, y is given in global display coordinates
+ # which sets (0,0) at top left corner of main display. It is possible
+ # to warp the mouse position to a point inside of another display.
+ quartz.CGWarpMouseCursorPosition(CGPoint(x,y))
+ else:
+ # Window-relative coordinates: (x, y) are given in window coords
+ # with (0,0) at bottom-left corner of window and y up. We find
+ # which display the window is in and then convert x, y into local
+ # display coords where (0,0) is now top-left of display and y down.
+ screenInfo = self._nswindow.screen().deviceDescription()
+ displayID = screenInfo.objectForKey_(cocoapy.get_NSString('NSScreenNumber'))
+ displayID = displayID.intValue()
+ displayBounds = quartz.CGDisplayBounds(displayID)
+ frame = self._nswindow.frame()
+ windowOrigin = frame.origin
+ x += windowOrigin.x
+ y = displayBounds.size.height - windowOrigin.y - y
+ quartz.CGDisplayMoveCursorToPoint(displayID, cocoapy.NSPoint(x, y))
+
+ def set_exclusive_mouse(self, exclusive=True):
+ super().set_exclusive_mouse(exclusive)
+ if exclusive:
+ # Skip the next motion event, which would return a large delta.
+ self._mouse_ignore_motion = True
+ # Move mouse to center of window.
+ frame = self._nswindow.frame()
+ width, height = frame.size.width, frame.size.height
+ self.set_mouse_position(width/2, height/2)
+ quartz.CGAssociateMouseAndMouseCursorPosition(False)
+ else:
+ quartz.CGAssociateMouseAndMouseCursorPosition(True)
+
+ # Update visibility of mouse cursor.
+ self.set_mouse_platform_visible()
+
+ def set_exclusive_keyboard(self, exclusive=True):
+ # http://developer.apple.com/mac/library/technotes/tn2002/tn2062.html
+ # http://developer.apple.com/library/mac/#technotes/KioskMode/
+
+ # BUG: System keys like F9 or command-tab are disabled, however
+ # pyglet also does not receive key press events for them.
+
+ # This flag is queried by window delegate to determine whether
+ # the quit menu item is active.
+ super().set_exclusive_keyboard(exclusive)
+
+ if exclusive:
+ # "Be nice! Don't disable force-quit!"
+ # -- Patrick Swayze, Road House (1989)
+ options = cocoapy.NSApplicationPresentationHideDock | \
+ cocoapy.NSApplicationPresentationHideMenuBar | \
+ cocoapy.NSApplicationPresentationDisableProcessSwitching | \
+ cocoapy.NSApplicationPresentationDisableHideApplication
+ else:
+ options = cocoapy.NSApplicationPresentationDefault
+
+ NSApp = NSApplication.sharedApplication()
+ NSApp.setPresentationOptions_(options)
+
+
+__all__ = ["CocoaWindow"]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/pyglet_delegate.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/pyglet_delegate.py
new file mode 100644
index 0000000000000000000000000000000000000000..42803a2e9e4531163d15bf56ad21995fb60cec26
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/pyglet_delegate.py
@@ -0,0 +1,132 @@
+from pyglet.libs.darwin.cocoapy import ObjCClass, ObjCSubclass, ObjCInstance
+from pyglet.libs.darwin.cocoapy import NSApplicationDidHideNotification
+from pyglet.libs.darwin.cocoapy import NSApplicationDidUnhideNotification
+from pyglet.libs.darwin.cocoapy import send_super, get_selector
+from pyglet.libs.darwin.cocoapy import PyObjectEncoding
+from pyglet.libs.darwin.cocoapy import quartz
+from .systemcursor import SystemCursor
+
+NSNotificationCenter = ObjCClass('NSNotificationCenter')
+NSApplication = ObjCClass('NSApplication')
+
+
+class PygletDelegate_Implementation:
+ PygletDelegate = ObjCSubclass('NSObject', 'PygletDelegate')
+
+ @PygletDelegate.method(b'@'+PyObjectEncoding)
+ def initWithWindow_(self, window):
+ self = ObjCInstance(send_super(self, 'init'))
+
+ if not self:
+ return None
+
+ # CocoaWindow object.
+ self._window = window
+ window._nswindow.setDelegate_(self)
+
+ # Register delegate for hide and unhide notifications so that we
+ # can dispatch the corresponding pyglet events.
+ notificationCenter = NSNotificationCenter.defaultCenter()
+
+ notificationCenter.addObserver_selector_name_object_(
+ self, get_selector('applicationDidHide:'),
+ NSApplicationDidHideNotification, None)
+
+ notificationCenter.addObserver_selector_name_object_(
+ self, get_selector('applicationDidUnhide:'),
+ NSApplicationDidUnhideNotification, None)
+
+ # Flag set when we pause exclusive mouse mode if window loses key status.
+ self.did_pause_exclusive_mouse = False
+ return self
+
+ @PygletDelegate.method('v')
+ def dealloc(self):
+ # Unregister delegate from notification center.
+ notificationCenter = NSNotificationCenter.defaultCenter()
+ notificationCenter.removeObserver_(self)
+ self._window = None
+ send_super(self, 'dealloc')
+
+ @PygletDelegate.method('v@')
+ def applicationDidHide_(self, notification):
+ self._window.dispatch_event("on_hide")
+
+ @PygletDelegate.method('v@')
+ def applicationDidUnhide_(self, notification):
+ if self._window._mouse_exclusive and quartz.CGCursorIsVisible():
+ # The cursor should be hidden, but for some reason it's not;
+ # try to force the cursor to hide (without over-hiding).
+ SystemCursor.unhide()
+ SystemCursor.hide()
+ pass
+ self._window.dispatch_event("on_show")
+
+ @PygletDelegate.method('B@')
+ def windowShouldClose_(self, notification):
+ # The method is not called if [NSWindow close] was used.
+ self._window.dispatch_event("on_close")
+ return False
+
+ @PygletDelegate.method('v@')
+ def windowDidMove_(self, notification):
+ x, y = self._window.get_location()
+ self._window.dispatch_event("on_move", x, y)
+
+ @PygletDelegate.method('v@')
+ def windowDidBecomeKey_(self, notification):
+ # Restore exclusive mouse mode if it was active before we lost key status.
+ if self.did_pause_exclusive_mouse:
+ self._window.set_exclusive_mouse(True)
+ self.did_pause_exclusive_mouse = False
+ self._window._nswindow.setMovable_(True) # Mac OS 10.6
+ # Restore previous mouse visibility settings.
+ self._window.set_mouse_platform_visible()
+ self._window.dispatch_event("on_activate")
+
+ @PygletDelegate.method('v@')
+ def windowDidResignKey_(self, notification):
+ # Pause exclusive mouse mode if it is active.
+ if self._window._mouse_exclusive:
+ self._window.set_exclusive_mouse(False)
+ self.did_pause_exclusive_mouse = True
+ # We need to prevent the window from being unintentionally dragged
+ # (by the call to set_mouse_position in set_exclusive_mouse) when
+ # the window is reactivated by clicking on its title bar.
+ self._window._nswindow.setMovable_(False) # Mac OS X 10.6
+ # Make sure that cursor is visible.
+ self._window.set_mouse_platform_visible(True)
+ self._window.dispatch_event("on_deactivate")
+
+ @PygletDelegate.method('v@')
+ def windowDidMiniaturize_(self, notification):
+ self._window.dispatch_event("on_hide")
+
+ @PygletDelegate.method('v@')
+ def windowDidDeminiaturize_(self, notification):
+ if self._window._mouse_exclusive and quartz.CGCursorIsVisible():
+ # The cursor should be hidden, but for some reason it's not;
+ # try to force the cursor to hide (without over-hiding).
+ SystemCursor.unhide()
+ SystemCursor.hide()
+ pass
+ self._window.dispatch_event("on_show")
+
+ @PygletDelegate.method('v@')
+ def windowDidExpose_(self, notification):
+ self._window.dispatch_event("on_expose")
+
+ @PygletDelegate.method('v@')
+ def terminate_(self, sender):
+ NSApp = NSApplication.sharedApplication()
+ NSApp.terminate_(self)
+
+ @PygletDelegate.method('B@')
+ def validateMenuItem_(self, menuitem):
+ # Disable quitting with command-q when in keyboard exclusive mode.
+ if menuitem.action() == get_selector('terminate:'):
+ return not self._window._keyboard_exclusive
+ return True
+
+
+PygletDelegate = ObjCClass('PygletDelegate')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/pyglet_textview.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/pyglet_textview.py
new file mode 100644
index 0000000000000000000000000000000000000000..58644bf0f42c717d78e11557357df23042cfcea5
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/pyglet_textview.py
@@ -0,0 +1,160 @@
+import unicodedata
+
+from pyglet.window import key
+
+from pyglet.libs.darwin.cocoapy import ObjCClass, ObjCSubclass, ObjCInstance
+from pyglet.libs.darwin.cocoapy import PyObjectEncoding, send_super
+from pyglet.libs.darwin.cocoapy import CFSTR, cfstring_to_string
+
+NSArray = ObjCClass('NSArray')
+NSApplication = ObjCClass('NSApplication')
+
+# This custom NSTextView subclass is used for capturing all of the
+# on_text, on_text_motion, and on_text_motion_select events.
+class PygletTextView_Implementation:
+ PygletTextView = ObjCSubclass('NSTextView', 'PygletTextView')
+
+ @PygletTextView.method(b'@'+PyObjectEncoding)
+ def initWithCocoaWindow_(self, window):
+ self = ObjCInstance(send_super(self, 'init'))
+ if not self:
+ return None
+ self._window = window
+ # Interpret tab and return as raw characters
+ self.setFieldEditor_(False)
+ self.empty_string = CFSTR("")
+ return self
+
+ @PygletTextView.method('v')
+ def dealloc(self):
+ self.empty_string.release()
+
+ @PygletTextView.method('v@')
+ def keyDown_(self, nsevent):
+ array = NSArray.arrayWithObject_(nsevent)
+ self.interpretKeyEvents_(array)
+
+ @PygletTextView.method('v@')
+ def insertText_(self, text):
+ text = cfstring_to_string(text)
+ self.setString_(self.empty_string)
+ # Don't send control characters (tab, newline) as on_text events.
+ if unicodedata.category(text[0]) != 'Cc':
+ self._window.dispatch_event("on_text", text)
+
+ @PygletTextView.method('v@')
+ def insertNewline_(self, sender):
+ # Distinguish between carriage return (u'\r') and enter (u'\x03').
+ # Only the return key press gets sent as an on_text event.
+ event = NSApplication.sharedApplication().currentEvent()
+ chars = event.charactersIgnoringModifiers()
+ ch = chr(chars.characterAtIndex_(0))
+ if ch == u'\r':
+ self._window.dispatch_event("on_text", u'\r')
+
+ @PygletTextView.method('v@')
+ def moveUp_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_UP)
+
+ @PygletTextView.method('v@')
+ def moveDown_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_DOWN)
+
+ @PygletTextView.method('v@')
+ def moveLeft_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_LEFT)
+
+ @PygletTextView.method('v@')
+ def moveRight_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_RIGHT)
+
+ @PygletTextView.method('v@')
+ def moveWordLeft_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_PREVIOUS_WORD)
+
+ @PygletTextView.method('v@')
+ def moveWordRight_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_NEXT_WORD)
+
+ @PygletTextView.method('v@')
+ def moveToBeginningOfLine_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_BEGINNING_OF_LINE)
+
+ @PygletTextView.method('v@')
+ def moveToEndOfLine_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_END_OF_LINE)
+
+ @PygletTextView.method('v@')
+ def scrollPageUp_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_PREVIOUS_PAGE)
+
+ @PygletTextView.method('v@')
+ def scrollPageDown_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_NEXT_PAGE)
+
+ @PygletTextView.method('v@')
+ def scrollToBeginningOfDocument_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion", key.MOTION_BEGINNING_OF_FILE)
+
+ @PygletTextView.method('v@')
+ def scrollToEndOfDocument_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion", key.MOTION_END_OF_FILE)
+
+ @PygletTextView.method('v@')
+ def deleteBackward_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_BACKSPACE)
+
+ @PygletTextView.method('v@')
+ def deleteForward_(self, sender):
+ self._window.dispatch_event("on_text_motion", key.MOTION_DELETE)
+
+ @PygletTextView.method('v@')
+ def moveUpAndModifySelection_(self, sender):
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_UP)
+
+ @PygletTextView.method('v@')
+ def moveDownAndModifySelection_(self, sender):
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_DOWN)
+
+ @PygletTextView.method('v@')
+ def moveLeftAndModifySelection_(self, sender):
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_LEFT)
+
+ @PygletTextView.method('v@')
+ def moveRightAndModifySelection_(self, sender):
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_RIGHT)
+
+ @PygletTextView.method('v@')
+ def moveWordLeftAndModifySelection_(self, sender):
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_PREVIOUS_WORD)
+
+ @PygletTextView.method('v@')
+ def moveWordRightAndModifySelection_(self, sender):
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_NEXT_WORD)
+
+ @PygletTextView.method('v@')
+ def moveToBeginningOfLineAndModifySelection_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_BEGINNING_OF_LINE)
+
+ @PygletTextView.method('v@')
+ def moveToEndOfLineAndModifySelection_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_END_OF_LINE)
+
+ @PygletTextView.method('v@')
+ def pageUpAndModifySelection_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_PREVIOUS_PAGE)
+
+ @PygletTextView.method('v@')
+ def pageDownAndModifySelection_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_NEXT_PAGE)
+
+ @PygletTextView.method('v@')
+ def moveToBeginningOfDocumentAndModifySelection_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_BEGINNING_OF_FILE)
+
+ @PygletTextView.method('v@')
+ def moveToEndOfDocumentAndModifySelection_(self, sender): # Mac OS X 10.6
+ self._window.dispatch_event("on_text_motion_select", key.MOTION_END_OF_FILE)
+
+
+PygletTextView = ObjCClass('PygletTextView')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/pyglet_view.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/pyglet_view.py
new file mode 100644
index 0000000000000000000000000000000000000000..13c96c0b65c1c184094c3b4583f0c21f11543b70
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/pyglet_view.py
@@ -0,0 +1,351 @@
+from pyglet.window import key, mouse
+from pyglet.libs.darwin.quartzkey import keymap, charmap
+
+from pyglet.libs.darwin import cocoapy
+from .pyglet_textview import PygletTextView
+
+
+NSTrackingArea = cocoapy.ObjCClass('NSTrackingArea')
+
+# Event data helper functions.
+
+
+def getMouseDelta(nsevent):
+ dx = nsevent.deltaX()
+ dy = -nsevent.deltaY()
+ return dx, dy
+
+
+def getMousePosition(self, nsevent):
+ in_window = nsevent.locationInWindow()
+ in_window = self.convertPoint_fromView_(in_window, None)
+ x = int(in_window.x)
+ y = int(in_window.y)
+ # Must record mouse position for BaseWindow.draw_mouse_cursor to work.
+ self._window._mouse_x = x
+ self._window._mouse_y = y
+ return x, y
+
+
+def getModifiers(nsevent):
+ modifiers = 0
+ modifierFlags = nsevent.modifierFlags()
+ if modifierFlags & cocoapy.NSAlphaShiftKeyMask:
+ modifiers |= key.MOD_CAPSLOCK
+ if modifierFlags & cocoapy.NSShiftKeyMask:
+ modifiers |= key.MOD_SHIFT
+ if modifierFlags & cocoapy.NSControlKeyMask:
+ modifiers |= key.MOD_CTRL
+ if modifierFlags & cocoapy.NSAlternateKeyMask:
+ modifiers |= key.MOD_ALT
+ modifiers |= key.MOD_OPTION
+ if modifierFlags & cocoapy.NSCommandKeyMask:
+ modifiers |= key.MOD_COMMAND
+ if modifierFlags & cocoapy.NSFunctionKeyMask:
+ modifiers |= key.MOD_FUNCTION
+ return modifiers
+
+
+def getSymbol(nsevent):
+ symbol = keymap.get(nsevent.keyCode(), None)
+ if symbol is not None:
+ return symbol
+
+ chars = cocoapy.cfstring_to_string(nsevent.charactersIgnoringModifiers())
+ if chars:
+ return charmap.get(chars[0].upper(), None)
+
+ return None
+
+
+class PygletView_Implementation:
+ PygletView = cocoapy.ObjCSubclass('NSView', 'PygletView')
+
+ @PygletView.method(b'@'+cocoapy.NSRectEncoding+cocoapy.PyObjectEncoding)
+ def initWithFrame_cocoaWindow_(self, frame, window):
+
+ # The tracking area is used to get mouseEntered, mouseExited, and cursorUpdate
+ # events so that we can custom set the mouse cursor within the view.
+ self._tracking_area = None
+
+ self = cocoapy.ObjCInstance(cocoapy.send_super(self, 'initWithFrame:', frame, argtypes=[cocoapy.NSRect]))
+
+ if not self:
+ return None
+
+ # CocoaWindow object.
+ self._window = window
+ self.updateTrackingAreas()
+
+ # Create an instance of PygletTextView to handle text events.
+ # We must do this because NSOpenGLView doesn't conform to the
+ # NSTextInputClient protocol by default, and the insertText: method will
+ # not do the right thing with respect to translating key sequences like
+ # "Option-e", "e" if the protocol isn't implemented. So the easiest
+ # thing to do is to subclass NSTextView which *does* implement the
+ # protocol and let it handle text input.
+ self._textview = PygletTextView.alloc().initWithCocoaWindow_(window)
+ # Add text view to the responder chain.
+ self.addSubview_(self._textview)
+ return self
+
+ @PygletView.method('v')
+ def dealloc(self):
+ self._window = None
+ # cocoapy.end_message(self.objc_self, 'removeFromSuperviewWithoutNeedingDisplay')
+ self._textview.release()
+ self._textview = None
+ self._tracking_area.release()
+ self._tracking_area = None
+ cocoapy.send_super(self, 'dealloc')
+
+ @PygletView.method('v')
+ def updateTrackingAreas(self):
+ # This method is called automatically whenever the tracking areas need to be
+ # recreated, for example when window resizes.
+ if self._tracking_area:
+ self.removeTrackingArea_(self._tracking_area)
+ self._tracking_area.release()
+ self._tracking_area = None
+
+ tracking_options = cocoapy.NSTrackingMouseEnteredAndExited | cocoapy.NSTrackingActiveInActiveApp | cocoapy.NSTrackingCursorUpdate
+ frame = self.frame()
+
+ self._tracking_area = NSTrackingArea.alloc().initWithRect_options_owner_userInfo_(
+ frame, # rect
+ tracking_options, # options
+ self, # owner
+ None) # userInfo
+
+ self.addTrackingArea_(self._tracking_area)
+
+ @PygletView.method('B')
+ def canBecomeKeyView(self):
+ return True
+
+ @PygletView.method('B')
+ def isOpaque(self):
+ return True
+
+ ## Event responders.
+
+ # This method is called whenever the view changes size.
+ @PygletView.method(b'v'+cocoapy.NSSizeEncoding)
+ def setFrameSize_(self, size):
+ cocoapy.send_super(self, 'setFrameSize:', size,
+ superclass_name='NSView',
+ argtypes=[cocoapy.NSSize])
+
+ # This method is called when view is first installed as the
+ # contentView of window. Don't do anything on first call.
+ # This also helps ensure correct window creation event ordering.
+ if not self._window.context.canvas:
+ return
+
+ width, height = int(size.width), int(size.height)
+ self._window.switch_to()
+ self._window.context.update_geometry()
+ self._window._width, self._window._height = width, height
+ self._window.dispatch_event("on_resize", width, height)
+ self._window.dispatch_event("on_expose")
+ # Can't get app.event_loop.enter_blocking() working with Cocoa, because
+ # when mouse clicks on the window's resize control, Cocoa enters into a
+ # mini-event loop that only responds to mouseDragged and mouseUp events.
+ # This means that using NSTimer to call idle() won't work. Our kludge
+ # is to override NSWindow's nextEventMatchingMask_etc method and call
+ # idle() from there.
+ if self.inLiveResize():
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.idle()
+
+ @PygletView.method('v@')
+ def pygletKeyDown_(self, nsevent):
+ symbol = getSymbol(nsevent)
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_key_press', symbol, modifiers)
+
+ @PygletView.method('v@')
+ def pygletKeyUp_(self, nsevent):
+ symbol = getSymbol(nsevent)
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_key_release', symbol, modifiers)
+
+ @PygletView.method('v@')
+ def pygletFlagsChanged_(self, nsevent):
+ # Handles on_key_press and on_key_release events for modifier keys.
+ # Note that capslock is handled differently than other keys; it acts
+ # as a toggle, so on_key_release is only sent when it's turned off.
+
+ # TODO: Move these constants somewhere else.
+ # Undocumented left/right modifier masks found by experimentation:
+ NSLeftShiftKeyMask = 1 << 1
+ NSRightShiftKeyMask = 1 << 2
+ NSLeftControlKeyMask = 1 << 0
+ NSRightControlKeyMask = 1 << 13
+ NSLeftAlternateKeyMask = 1 << 5
+ NSRightAlternateKeyMask = 1 << 6
+ NSLeftCommandKeyMask = 1 << 3
+ NSRightCommandKeyMask = 1 << 4
+
+ maskForKey = {key.LSHIFT: NSLeftShiftKeyMask,
+ key.RSHIFT: NSRightShiftKeyMask,
+ key.LCTRL: NSLeftControlKeyMask,
+ key.RCTRL: NSRightControlKeyMask,
+ key.LOPTION: NSLeftAlternateKeyMask,
+ key.ROPTION: NSRightAlternateKeyMask,
+ key.LCOMMAND: NSLeftCommandKeyMask,
+ key.RCOMMAND: NSRightCommandKeyMask,
+ key.CAPSLOCK: cocoapy.NSAlphaShiftKeyMask,
+ key.FUNCTION: cocoapy.NSFunctionKeyMask}
+
+ symbol = keymap.get(nsevent.keyCode(), None)
+
+ # Ignore this event if symbol is not a modifier key. We must check this
+ # because e.g., we receive a flagsChanged message when using CMD-tab to
+ # switch applications, with symbol == "a" when command key is released.
+ if symbol is None or symbol not in maskForKey:
+ return
+
+ modifiers = getModifiers(nsevent)
+ modifierFlags = nsevent.modifierFlags()
+
+ if symbol and modifierFlags & maskForKey[symbol]:
+ self._window.dispatch_event('on_key_press', symbol, modifiers)
+ else:
+ self._window.dispatch_event('on_key_release', symbol, modifiers)
+
+ # Overriding this method helps prevent system beeps for unhandled events.
+ @PygletView.method('B@')
+ def performKeyEquivalent_(self, nsevent):
+ # Let arrow keys and certain function keys pass through the responder
+ # chain so that the textview can handle on_text_motion events.
+ modifierFlags = nsevent.modifierFlags()
+ if modifierFlags & cocoapy.NSNumericPadKeyMask:
+ return False
+ if modifierFlags & cocoapy.NSFunctionKeyMask:
+ ch = cocoapy.cfstring_to_string(nsevent.charactersIgnoringModifiers())
+ if ch in (cocoapy.NSHomeFunctionKey, cocoapy.NSEndFunctionKey,
+ cocoapy.NSPageUpFunctionKey, cocoapy.NSPageDownFunctionKey):
+ return False
+ # Send the key equivalent to the main menu to perform menu items.
+ NSApp = cocoapy.ObjCClass('NSApplication').sharedApplication()
+ NSApp.mainMenu().performKeyEquivalent_(nsevent)
+ # Indicate that we've handled the event so system won't beep.
+ return True
+
+ @PygletView.method('v@')
+ def mouseMoved_(self, nsevent):
+ if self._window._mouse_ignore_motion:
+ self._window._mouse_ignore_motion = False
+ return
+ # Don't send on_mouse_motion events if we're not inside the content rectangle.
+ if not self._window._mouse_in_window:
+ return
+ x, y = getMousePosition(self, nsevent)
+ dx, dy = getMouseDelta(nsevent)
+ self._window.dispatch_event('on_mouse_motion', x, y, dx, dy)
+
+ @PygletView.method('v@')
+ def scrollWheel_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ scroll_x, scroll_y = getMouseDelta(nsevent)
+ self._window.dispatch_event('on_mouse_scroll', x, y, scroll_x, scroll_y)
+
+ @PygletView.method('v@')
+ def mouseDown_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ buttons = mouse.LEFT
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_press', x, y, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def mouseDragged_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ dx, dy = getMouseDelta(nsevent)
+ buttons = mouse.LEFT
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_drag', x, y, dx, dy, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def mouseUp_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ buttons = mouse.LEFT
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_release', x, y, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def rightMouseDown_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ buttons = mouse.RIGHT
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_press', x, y, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def rightMouseDragged_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ dx, dy = getMouseDelta(nsevent)
+ buttons = mouse.RIGHT
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_drag', x, y, dx, dy, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def rightMouseUp_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ buttons = mouse.RIGHT
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_release', x, y, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def otherMouseDown_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ buttons = mouse.MIDDLE
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_press', x, y, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def otherMouseDragged_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ dx, dy = getMouseDelta(nsevent)
+ buttons = mouse.MIDDLE
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_drag', x, y, dx, dy, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def otherMouseUp_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ buttons = mouse.MIDDLE
+ modifiers = getModifiers(nsevent)
+ self._window.dispatch_event('on_mouse_release', x, y, buttons, modifiers)
+
+ @PygletView.method('v@')
+ def mouseEntered_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ self._window._mouse_in_window = True
+ # Don't call self._window.set_mouse_platform_visible() from here.
+ # Better to do it from cursorUpdate:
+ self._window.dispatch_event('on_mouse_enter', x, y)
+
+ @PygletView.method('v@')
+ def mouseExited_(self, nsevent):
+ x, y = getMousePosition(self, nsevent)
+ self._window._mouse_in_window = False
+ if not self._window._mouse_exclusive:
+ self._window.set_mouse_platform_visible()
+ self._window.dispatch_event('on_mouse_leave', x, y)
+
+ @PygletView.method('v@')
+ def cursorUpdate_(self, nsevent):
+ # Called when mouse cursor enters view. Unlike mouseEntered:,
+ # this method will be called if the view appears underneath a
+ # motionless mouse cursor, as can happen during window creation,
+ # or when switching into fullscreen mode.
+ # BUG: If the mouse enters the window via the resize control at the
+ # the bottom right corner, the resize control will set the cursor
+ # to the default arrow and screw up our cursor tracking.
+ self._window._mouse_in_window = True
+ if not self._window._mouse_exclusive:
+ self._window.set_mouse_platform_visible()
+
+
+PygletView = cocoapy.ObjCClass('PygletView')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/pyglet_window.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/pyglet_window.py
new file mode 100644
index 0000000000000000000000000000000000000000..f18d8a03e992d216b4b67786e10e1057c1bad2e3
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/pyglet_window.py
@@ -0,0 +1,77 @@
+from ctypes import c_void_p, c_bool
+
+from pyglet.libs.darwin.cocoapy import ObjCClass, ObjCSubclass, send_super
+from pyglet.libs.darwin.cocoapy import NSUInteger, NSUIntegerEncoding
+from pyglet.libs.darwin.cocoapy import NSRectEncoding
+
+
+class PygletWindow_Implementation:
+ PygletWindow = ObjCSubclass('NSWindow', 'PygletWindow')
+
+ @PygletWindow.method('B')
+ def canBecomeKeyWindow(self):
+ return True
+
+ # When the window is being resized, it enters into a mini event loop that
+ # only looks at mouseDragged and mouseUp events, blocking everything else.
+ # Among other things, this makes it impossible to run an NSTimer to call the
+ # idle() function in order to update the view during the resize. So we
+ # override this method, called by the resizing event loop, and call the
+ # idle() function from here. This *almost* works. I can't figure out what
+ # is happening at the very beginning of a resize event. The NSView's
+ # viewWillStartLiveResize method is called and then nothing happens until
+ # the mouse is dragged. I think NSApplication's nextEventMatchingMask_etc
+ # method is being called instead of this one. I don't really feel like
+ # subclassing NSApplication just to fix this. Also, to prevent white flashes
+ # while resizing, we must also call idle() from the view's reshape method.
+ @PygletWindow.method(b'@'+NSUIntegerEncoding+b'@@B')
+ def nextEventMatchingMask_untilDate_inMode_dequeue_(self, mask, date, mode, dequeue):
+ if self.inLiveResize():
+ # Call the idle() method while we're stuck in a live resize event.
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.idle()
+
+ event = send_super(self, 'nextEventMatchingMask:untilDate:inMode:dequeue:',
+ mask, date, mode, dequeue,
+ superclass_name='NSWindow',
+ argtypes=[NSUInteger, c_void_p, c_void_p, c_bool])
+
+ if event.value is None:
+ return 0
+ else:
+ return event.value
+
+ # Need this for set_size to not flash.
+ @PygletWindow.method(b'd'+NSRectEncoding)
+ def animationResizeTime_(self, newFrame):
+ return 0.0
+
+
+class PygletToolWindow_Implementation:
+ PygletToolWindow = ObjCSubclass('NSPanel', 'PygletToolWindow')
+
+ @PygletToolWindow.method(b'@'+NSUIntegerEncoding+b'@@B')
+ def nextEventMatchingMask_untilDate_inMode_dequeue_(self, mask, date, mode, dequeue):
+ if self.inLiveResize():
+ # Call the idle() method while we're stuck in a live resize event.
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.idle()
+
+ event = send_super(self, 'nextEventMatchingMask:untilDate:inMode:dequeue:',
+ mask, date, mode, dequeue, argtypes=[NSUInteger, c_void_p, c_void_p, c_bool])
+
+ if event.value == None:
+ return 0
+ else:
+ return event.value
+
+ # Need this for set_size to not flash.
+ @PygletToolWindow.method(b'd'+NSRectEncoding)
+ def animationResizeTime_(self, newFrame):
+ return 0.0
+
+
+PygletWindow = ObjCClass('PygletWindow')
+PygletToolWindow = ObjCClass('PygletToolWindow')
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/systemcursor.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/systemcursor.py
new file mode 100644
index 0000000000000000000000000000000000000000..a615792f51d6ee4c294d14b10a46478ccede456d
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/cocoa/systemcursor.py
@@ -0,0 +1,21 @@
+from pyglet.libs.darwin import cocoapy
+
+
+# This class is a wrapper around NSCursor which prevents us from
+# sending too many hide or unhide messages in a row. Apparently
+# NSCursor treats them like retain/release messages, which can be
+# problematic when we are e.g. switching between window & fullscreen.
+class SystemCursor:
+ cursor_is_hidden = False
+
+ @classmethod
+ def hide(cls):
+ if not cls.cursor_is_hidden:
+ cocoapy.send_message('NSCursor', 'hide')
+ cls.cursor_is_hidden = True
+
+ @classmethod
+ def unhide(cls):
+ if cls.cursor_is_hidden:
+ cocoapy.send_message('NSCursor', 'unhide')
+ cls.cursor_is_hidden = False
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/event.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/event.py
new file mode 100644
index 0000000000000000000000000000000000000000..b5e6acea5fbaddf43f5aa74b1dc338ffbb8469ab
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/event.py
@@ -0,0 +1,115 @@
+"""Events for :py:mod:`pyglet.window`.
+
+See :py:class:`~pyglet.window.Window` for a description of the window event types.
+"""
+
+import sys
+
+from pyglet.window import key
+from pyglet.window import mouse
+
+
+class WindowEventLogger:
+ """Print all events to a file.
+
+ When this event handler is added to a window it prints out all events
+ and their parameters; useful for debugging or discovering which events
+ you need to handle.
+
+ Example::
+
+ win = window.Window()
+ event_logger = WindowEventLogger()
+ win.push_handlers(event_logger)
+
+ """
+ def __init__(self, logfile=None):
+ """Create a `WindowEventLogger` which writes to `logfile`.
+
+ :Parameters:
+ `logfile` : file-like object
+ The file to write to. If unspecified, stdout will be used.
+
+ """
+ if logfile is None:
+ logfile = sys.stdout
+ self.file = logfile
+
+ def on_key_press(self, symbol, modifiers):
+ print('on_key_press(symbol=%s, modifiers=%s)' % (
+ key.symbol_string(symbol), key.modifiers_string(modifiers)), file=self.file)
+
+ def on_key_release(self, symbol, modifiers):
+ print('on_key_release(symbol=%s, modifiers=%s)' % (
+ key.symbol_string(symbol), key.modifiers_string(modifiers)), file=self.file)
+
+ def on_text(self, text):
+ print('on_text(text=%r)' % text, file=self.file)
+
+ def on_text_motion(self, motion):
+ print('on_text_motion(motion=%s)' % (
+ key.motion_string(motion)), file=self.file)
+
+ def on_text_motion_select(self, motion):
+ print('on_text_motion_select(motion=%s)' % (
+ key.motion_string(motion)), file=self.file)
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ print('on_mouse_motion(x=%d, y=%d, dx=%d, dy=%d)' % (
+ x, y, dx, dy), file=self.file)
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ print('on_mouse_drag(x=%d, y=%d, dx=%d, dy=%d, buttons=%s, modifiers=%s)' % (
+ x, y, dx, dy, mouse.buttons_string(buttons), key.modifiers_string(modifiers)),
+ file=self.file)
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ print('on_mouse_press(x=%d, y=%d, button=%r, modifiers=%s)' % (
+ x, y, mouse.buttons_string(button), key.modifiers_string(modifiers)), file=self.file)
+
+ def on_mouse_release(self, x, y, button, modifiers):
+ print('on_mouse_release(x=%d, y=%d, button=%r, modifiers=%s)' % (
+ x, y, mouse.buttons_string(button), key.modifiers_string(modifiers)), file=self.file)
+
+ def on_mouse_scroll(self, x, y, dx, dy):
+ print('on_mouse_scroll(x=%f, y=%f, dx=%f, dy=%f)' % (
+ x, y, dx, dy), file=self.file)
+
+ def on_close(self):
+ print('on_close()', file=self.file)
+
+ def on_mouse_enter(self, x, y):
+ print('on_mouse_enter(x=%d, y=%d)' % (x, y), file=self.file)
+
+ def on_mouse_leave(self, x, y):
+ print('on_mouse_leave(x=%d, y=%d)' % (x, y), file=self.file)
+
+ def on_expose(self):
+ print('on_expose()', file=self.file)
+
+ def on_resize(self, width, height):
+ print('on_resize(width=%d, height=%d)' % (width, height), file=self.file)
+
+ def on_move(self, x, y):
+ print('on_move(x=%d, y=%d)' % (x, y), file=self.file)
+
+ def on_activate(self):
+ print('on_activate()', file=self.file)
+
+ def on_deactivate(self):
+ print('on_deactivate()', file=self.file)
+
+ def on_show(self):
+ print('on_show()', file=self.file)
+
+ def on_hide(self):
+ print('on_hide()', file=self.file)
+
+ def on_context_lost(self):
+ print('on_context_lost()', file=self.file)
+
+ def on_context_state_lost(self):
+ print('on_context_state_lost()', file=self.file)
+
+ def on_draw(self):
+ print('on_draw()', file=self.file)
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/headless/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/headless/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..b8e859672afdb6035983f02ab7cea46271043a2e
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/headless/__init__.py
@@ -0,0 +1,107 @@
+from pyglet.window import BaseWindow, _PlatformEventHandler, _ViewEventHandler
+from pyglet.window import WindowException, NoSuchDisplayException, MouseCursorException
+from pyglet.window import MouseCursor, DefaultMouseCursor, ImageMouseCursor
+
+
+from pyglet.libs.egl import egl
+
+
+from pyglet.canvas.headless import HeadlessCanvas
+
+# from pyglet.window import key
+# from pyglet.window import mouse
+from pyglet.event import EventDispatcher
+
+# Platform event data is single item, so use platform event handler directly.
+HeadlessEventHandler = _PlatformEventHandler
+ViewEventHandler = _ViewEventHandler
+
+
+class HeadlessWindow(BaseWindow):
+ _egl_display_connection = None
+ _egl_surface = None
+
+ def _recreate(self, changes):
+ pass
+
+ def flip(self):
+ if self.context:
+ self.context.flip()
+
+ def switch_to(self):
+ if self.context:
+ self.context.set_current()
+
+ def set_caption(self, caption):
+ pass
+
+ def set_minimum_size(self, width, height):
+ pass
+
+ def set_maximum_size(self, width, height):
+ pass
+
+ def set_size(self, width, height):
+ pass
+
+ def get_size(self):
+ return self._width, self._height
+
+ def set_location(self, x, y):
+ pass
+
+ def get_location(self):
+ pass
+
+ def activate(self):
+ pass
+
+ def set_visible(self, visible=True):
+ pass
+
+ def minimize(self):
+ pass
+
+ def maximize(self):
+ pass
+
+ def set_vsync(self, vsync):
+ pass
+
+ def set_mouse_platform_visible(self, platform_visible=None):
+ pass
+
+ def set_exclusive_mouse(self, exclusive=True):
+ pass
+
+ def set_exclusive_keyboard(self, exclusive=True):
+ pass
+
+ def get_system_mouse_cursor(self, name):
+ pass
+
+ def dispatch_events(self):
+ while self._event_queue:
+ EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))
+
+ def dispatch_pending_events(self):
+ pass
+
+ def _create(self):
+ self._egl_display_connection = self.display._display_connection
+
+ if not self._egl_surface:
+ pbuffer_attribs = (egl.EGL_WIDTH, self._width, egl.EGL_HEIGHT, self._height, egl.EGL_NONE)
+ pbuffer_attrib_array = (egl.EGLint * len(pbuffer_attribs))(*pbuffer_attribs)
+ self._egl_surface = egl.eglCreatePbufferSurface(self._egl_display_connection,
+ self.config._egl_config,
+ pbuffer_attrib_array)
+
+ self.canvas = HeadlessCanvas(self.display, self._egl_surface)
+
+ self.context.attach(self.canvas)
+
+ self.dispatch_event('on_resize', self._width, self._height)
+
+
+__all__ = ["HeadlessWindow"]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/key.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/key.py
new file mode 100644
index 0000000000000000000000000000000000000000..570e1f82c57d3d856373f2f8446269f03b7fd231
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/key.py
@@ -0,0 +1,399 @@
+"""Key constants and utilities for pyglet.window.
+
+Usage::
+
+ from pyglet.window import Window
+ from pyglet.window import key
+
+ window = Window()
+
+ @window.event
+ def on_key_press(symbol, modifiers):
+ # Symbolic names:
+ if symbol == key.RETURN:
+
+ # Alphabet keys:
+ elif symbol == key.Z:
+
+ # Number keys:
+ elif symbol == key._1:
+
+ # Number keypad keys:
+ elif symbol == key.NUM_1:
+
+ # Modifiers:
+ if modifiers & key.MOD_CTRL:
+
+"""
+
+from pyglet import compat_platform
+
+
+class KeyStateHandler:
+ """Simple handler that tracks the state of keys on the keyboard. If a
+ key is pressed then this handler holds a True value for it.
+ If the window loses focus, all keys will be reset to False to avoid a
+ "sticky" key state.
+
+ For example::
+
+ >>> win = window.Window
+ >>> keyboard = key.KeyStateHandler()
+ >>> win.push_handlers(keyboard)
+
+ # Hold down the "up" arrow...
+
+ >>> keyboard[key.UP]
+ True
+ >>> keyboard[key.DOWN]
+ False
+
+ """
+ def __init__(self):
+ self.data = {}
+
+ def on_key_press(self, symbol, modifiers):
+ self.data[symbol] = True
+
+ def on_key_release(self, symbol, modifiers):
+ self.data[symbol] = False
+
+ def on_deactivate(self):
+ self.data.clear()
+
+ def __getitem__(self, key):
+ return self.data.get(key, False)
+
+
+def modifiers_string(modifiers):
+ """Return a string describing a set of modifiers.
+
+ Example::
+
+ >>> modifiers_string(MOD_SHIFT | MOD_CTRL)
+ 'MOD_SHIFT|MOD_CTRL'
+
+ :Parameters:
+ `modifiers` : int
+ Bitwise combination of modifier constants.
+
+ :rtype: str
+ """
+ mod_names = []
+ if modifiers & MOD_SHIFT:
+ mod_names.append('MOD_SHIFT')
+ if modifiers & MOD_CTRL:
+ mod_names.append('MOD_CTRL')
+ if modifiers & MOD_ALT:
+ mod_names.append('MOD_ALT')
+ if modifiers & MOD_CAPSLOCK:
+ mod_names.append('MOD_CAPSLOCK')
+ if modifiers & MOD_NUMLOCK:
+ mod_names.append('MOD_NUMLOCK')
+ if modifiers & MOD_SCROLLLOCK:
+ mod_names.append('MOD_SCROLLLOCK')
+ if modifiers & MOD_COMMAND:
+ mod_names.append('MOD_COMMAND')
+ if modifiers & MOD_OPTION:
+ mod_names.append('MOD_OPTION')
+ if modifiers & MOD_FUNCTION:
+ mod_names.append('MOD_FUNCTION')
+ return '|'.join(mod_names)
+
+
+def symbol_string(symbol):
+ """Return a string describing a key symbol.
+
+ Example::
+
+ >>> symbol_string(BACKSPACE)
+ 'BACKSPACE'
+
+ :Parameters:
+ `symbol` : int
+ Symbolic key constant.
+
+ :rtype: str
+ """
+ if symbol < 1 << 32:
+ return _key_names.get(symbol, str(symbol))
+ else:
+ return 'user_key(%x)' % (symbol >> 32)
+
+
+def motion_string(motion):
+ """Return a string describing a text motion.
+
+ Example::
+
+ >>> motion_string(MOTION_NEXT_WORD)
+ 'MOTION_NEXT_WORD'
+
+ :Parameters:
+ `motion` : int
+ Text motion constant.
+
+ :rtype: str
+ """
+ return _motion_names.get(motion, str(motion))
+
+
+def user_key(scancode):
+ """Return a key symbol for a key not supported by pyglet.
+
+ This can be used to map virtual keys or scancodes from unsupported
+ keyboard layouts into a machine-specific symbol. The symbol will
+ be meaningless on any other machine, or under a different keyboard layout.
+
+ Applications should use user-keys only when user explicitly binds them
+ (for example, mapping keys to actions in a game options screen).
+ """
+ assert scancode > 0
+ return scancode << 32
+
+# Modifier mask constants
+MOD_SHIFT = 1 << 0
+MOD_CTRL = 1 << 1
+MOD_ALT = 1 << 2
+MOD_CAPSLOCK = 1 << 3
+MOD_NUMLOCK = 1 << 4
+MOD_WINDOWS = 1 << 5
+MOD_COMMAND = 1 << 6
+MOD_OPTION = 1 << 7
+MOD_SCROLLLOCK = 1 << 8
+MOD_FUNCTION = 1 << 9
+
+#: Accelerator modifier. On Windows and Linux, this is ``MOD_CTRL``, on
+#: Mac OS X it's ``MOD_COMMAND``.
+MOD_ACCEL = MOD_CTRL
+if compat_platform == 'darwin':
+ MOD_ACCEL = MOD_COMMAND
+
+
+# Key symbol constants
+
+# ASCII commands
+BACKSPACE = 0xff08
+TAB = 0xff09
+LINEFEED = 0xff0a
+CLEAR = 0xff0b
+RETURN = 0xff0d
+ENTER = 0xff0d # synonym
+PAUSE = 0xff13
+SCROLLLOCK = 0xff14
+SYSREQ = 0xff15
+ESCAPE = 0xff1b
+SPACE = 0xff20
+
+# Cursor control and motion
+HOME = 0xff50
+LEFT = 0xff51
+UP = 0xff52
+RIGHT = 0xff53
+DOWN = 0xff54
+PAGEUP = 0xff55
+PAGEDOWN = 0xff56
+END = 0xff57
+BEGIN = 0xff58
+
+# Misc functions
+DELETE = 0xffff
+SELECT = 0xff60
+PRINT = 0xff61
+EXECUTE = 0xff62
+INSERT = 0xff63
+UNDO = 0xff65
+REDO = 0xff66
+MENU = 0xff67
+FIND = 0xff68
+CANCEL = 0xff69
+HELP = 0xff6a
+BREAK = 0xff6b
+MODESWITCH = 0xff7e
+SCRIPTSWITCH = 0xff7e
+FUNCTION = 0xffd2
+
+# Text motion constants: these are allowed to clash with key constants
+MOTION_UP = UP
+MOTION_RIGHT = RIGHT
+MOTION_DOWN = DOWN
+MOTION_LEFT = LEFT
+MOTION_NEXT_WORD = 1
+MOTION_PREVIOUS_WORD = 2
+MOTION_BEGINNING_OF_LINE = 3
+MOTION_END_OF_LINE = 4
+MOTION_NEXT_PAGE = PAGEDOWN
+MOTION_PREVIOUS_PAGE = PAGEUP
+MOTION_BEGINNING_OF_FILE = 5
+MOTION_END_OF_FILE = 6
+MOTION_BACKSPACE = BACKSPACE
+MOTION_DELETE = DELETE
+MOTION_COPY = 7
+MOTION_PASTE = 8
+
+# Number pad
+NUMLOCK = 0xff7f
+NUM_SPACE = 0xff80
+NUM_TAB = 0xff89
+NUM_ENTER = 0xff8d
+NUM_F1 = 0xff91
+NUM_F2 = 0xff92
+NUM_F3 = 0xff93
+NUM_F4 = 0xff94
+NUM_HOME = 0xff95
+NUM_LEFT = 0xff96
+NUM_UP = 0xff97
+NUM_RIGHT = 0xff98
+NUM_DOWN = 0xff99
+NUM_PRIOR = 0xff9a
+NUM_PAGE_UP = 0xff9a
+NUM_NEXT = 0xff9b
+NUM_PAGE_DOWN = 0xff9b
+NUM_END = 0xff9c
+NUM_BEGIN = 0xff9d
+NUM_INSERT = 0xff9e
+NUM_DELETE = 0xff9f
+NUM_EQUAL = 0xffbd
+NUM_MULTIPLY = 0xffaa
+NUM_ADD = 0xffab
+NUM_SEPARATOR = 0xffac
+NUM_SUBTRACT = 0xffad
+NUM_DECIMAL = 0xffae
+NUM_DIVIDE = 0xffaf
+
+NUM_0 = 0xffb0
+NUM_1 = 0xffb1
+NUM_2 = 0xffb2
+NUM_3 = 0xffb3
+NUM_4 = 0xffb4
+NUM_5 = 0xffb5
+NUM_6 = 0xffb6
+NUM_7 = 0xffb7
+NUM_8 = 0xffb8
+NUM_9 = 0xffb9
+
+# Function keys
+F1 = 0xffbe
+F2 = 0xffbf
+F3 = 0xffc0
+F4 = 0xffc1
+F5 = 0xffc2
+F6 = 0xffc3
+F7 = 0xffc4
+F8 = 0xffc5
+F9 = 0xffc6
+F10 = 0xffc7
+F11 = 0xffc8
+F12 = 0xffc9
+F13 = 0xffca
+F14 = 0xffcb
+F15 = 0xffcc
+F16 = 0xffcd
+F17 = 0xffce
+F18 = 0xffcf
+F19 = 0xffd0
+F20 = 0xffd1
+F21 = 0xffd2
+F22 = 0xffd3
+F23 = 0xffd4
+F24 = 0xffd5
+# Modifiers
+LSHIFT = 0xffe1
+RSHIFT = 0xffe2
+LCTRL = 0xffe3
+RCTRL = 0xffe4
+CAPSLOCK = 0xffe5
+LMETA = 0xffe7
+RMETA = 0xffe8
+LALT = 0xffe9
+RALT = 0xffea
+LWINDOWS = 0xffeb
+RWINDOWS = 0xffec
+LCOMMAND = 0xffed
+RCOMMAND = 0xffee
+LOPTION = 0xffef
+ROPTION = 0xfff0
+
+# Latin-1
+SPACE = 0x020
+EXCLAMATION = 0x021
+DOUBLEQUOTE = 0x022
+HASH = 0x023
+POUND = 0x023 # synonym
+DOLLAR = 0x024
+PERCENT = 0x025
+AMPERSAND = 0x026
+APOSTROPHE = 0x027
+PARENLEFT = 0x028
+PARENRIGHT = 0x029
+ASTERISK = 0x02a
+PLUS = 0x02b
+COMMA = 0x02c
+MINUS = 0x02d
+PERIOD = 0x02e
+SLASH = 0x02f
+_0 = 0x030
+_1 = 0x031
+_2 = 0x032
+_3 = 0x033
+_4 = 0x034
+_5 = 0x035
+_6 = 0x036
+_7 = 0x037
+_8 = 0x038
+_9 = 0x039
+COLON = 0x03a
+SEMICOLON = 0x03b
+LESS = 0x03c
+EQUAL = 0x03d
+GREATER = 0x03e
+QUESTION = 0x03f
+AT = 0x040
+BRACKETLEFT = 0x05b
+BACKSLASH = 0x05c
+BRACKETRIGHT = 0x05d
+ASCIICIRCUM = 0x05e
+UNDERSCORE = 0x05f
+GRAVE = 0x060
+QUOTELEFT = 0x060
+A = 0x061
+B = 0x062
+C = 0x063
+D = 0x064
+E = 0x065
+F = 0x066
+G = 0x067
+H = 0x068
+I = 0x069
+J = 0x06a
+K = 0x06b
+L = 0x06c
+M = 0x06d
+N = 0x06e
+O = 0x06f
+P = 0x070
+Q = 0x071
+R = 0x072
+S = 0x073
+T = 0x074
+U = 0x075
+V = 0x076
+W = 0x077
+X = 0x078
+Y = 0x079
+Z = 0x07a
+BRACELEFT = 0x07b
+BAR = 0x07c
+BRACERIGHT = 0x07d
+ASCIITILDE = 0x07e
+
+_key_names = {}
+_motion_names = {}
+for _name, _value in locals().copy().items():
+ if _name[:2] != '__' and _name.upper() == _name and \
+ not _name.startswith('MOD_'):
+ if _name.startswith('MOTION_'):
+ _motion_names[_value] = _name
+ else:
+ _key_names[_value] = _name
+
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/mouse.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/mouse.py
new file mode 100644
index 0000000000000000000000000000000000000000..c57a6be3933fa1e1b9e3ea555c51c53aff16ab73
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/mouse.py
@@ -0,0 +1,100 @@
+"""Mouse constants and utilities for pyglet.window.
+"""
+
+
+class MouseStateHandler:
+ """Simple handler that tracks the state of buttons from the mouse. If a
+ button is pressed then this handler holds a True value for it.
+ If the window loses focus, all buttons will be reset to False in order
+ to avoid a "sticky" button state.
+
+ For example::
+
+ >>> win = window.Window()
+ >>> mousebuttons = mouse.MouseStateHandler()
+ >>> win.push_handlers(mousebuttons)
+
+ # Hold down the "left" button...
+
+ >>> mousebuttons[mouse.LEFT]
+ True
+ >>> mousebuttons[mouse.RIGHT]
+ False
+
+ """
+
+ def __init__(self):
+ self.data = {
+ "x": 0,
+ "y": 0,
+ }
+
+ def on_mouse_press(self, x, y, button, modifiers):
+ self.data[button] = True
+
+ def on_mouse_release(self, x, y, button, modifiers):
+ self.data[button] = False
+
+ def on_deactivate(self):
+ self.data.clear()
+
+ def on_mouse_motion(self, x, y, dx, dy):
+ self.data["x"] = x
+ self.data["y"] = y
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ self.data["x"] = x
+ self.data["y"] = y
+
+ def __getitem__(self, key):
+ return self.data.get(key, False)
+
+
+def buttons_string(buttons):
+ """Return a string describing a set of active mouse buttons.
+
+ Example::
+
+ >>> buttons_string(LEFT | RIGHT)
+ 'LEFT|RIGHT'
+
+ :Parameters:
+ `buttons` : int
+ Bitwise combination of mouse button constants.
+
+ :rtype: str
+ """
+ button_names = []
+ if buttons & LEFT:
+ button_names.append("LEFT")
+ if buttons & MIDDLE:
+ button_names.append("MIDDLE")
+ if buttons & RIGHT:
+ button_names.append("RIGHT")
+ if buttons & MOUSE4:
+ button_names.append("MOUSE4")
+ if buttons & MOUSE5:
+ button_names.append("MOUSE5")
+ return "|".join(button_names)
+
+
+#: Constant for the left mouse button.
+#:
+#: :meta hide-value:
+LEFT = 1 << 0
+#: Constant for the middle mouse button.
+#:
+#: :meta hide-value:
+MIDDLE = 1 << 1
+#: Constant for the right mouse button.
+#:
+#: :meta hide-value:
+RIGHT = 1 << 2
+#: Constant for the mouse4 button.
+#:
+#: :meta hide-value:
+MOUSE4 = 1 << 3
+#: Constant for the mouse5 button.
+#:
+#: :meta hide-value:
+MOUSE5 = 1 << 4
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/win32/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/win32/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..aa7145672e479cd60a94f18761b91882b293732f
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/win32/__init__.py
@@ -0,0 +1,1228 @@
+from ctypes import *
+from functools import lru_cache
+import unicodedata
+
+from pyglet import compat_platform
+
+if compat_platform not in ('cygwin', 'win32'):
+ raise ImportError('Not a win32 platform.')
+
+import pyglet
+from pyglet.window import BaseWindow, WindowException, MouseCursor
+from pyglet.window import DefaultMouseCursor, _PlatformEventHandler, _ViewEventHandler
+from pyglet.event import EventDispatcher
+from pyglet.window import key, mouse
+
+from pyglet.canvas.win32 import Win32Canvas
+
+from pyglet.libs.win32 import _user32, _kernel32, _gdi32, _dwmapi, _shell32
+from pyglet.libs.win32.constants import *
+from pyglet.libs.win32.winkey import *
+from pyglet.libs.win32.types import *
+
+# symbol,ctrl -> motion mapping
+_motion_map = {
+ (key.UP, False): key.MOTION_UP,
+ (key.RIGHT, False): key.MOTION_RIGHT,
+ (key.DOWN, False): key.MOTION_DOWN,
+ (key.LEFT, False): key.MOTION_LEFT,
+ (key.RIGHT, True): key.MOTION_NEXT_WORD,
+ (key.LEFT, True): key.MOTION_PREVIOUS_WORD,
+ (key.HOME, False): key.MOTION_BEGINNING_OF_LINE,
+ (key.END, False): key.MOTION_END_OF_LINE,
+ (key.PAGEUP, False): key.MOTION_PREVIOUS_PAGE,
+ (key.PAGEDOWN, False): key.MOTION_NEXT_PAGE,
+ (key.HOME, True): key.MOTION_BEGINNING_OF_FILE,
+ (key.END, True): key.MOTION_END_OF_FILE,
+ (key.BACKSPACE, False): key.MOTION_BACKSPACE,
+ (key.DELETE, False): key.MOTION_DELETE,
+ (key.C, True): key.MOTION_COPY,
+ (key.V, True): key.MOTION_PASTE
+}
+
+
+class Win32MouseCursor(MouseCursor):
+ gl_drawable = False
+ hw_drawable = True
+
+ def __init__(self, cursor):
+ self.cursor = cursor
+
+
+# This is global state, we have to be careful not to set the same state twice,
+# which will throw off the ShowCursor counter.
+_win32_cursor_visible = True
+
+Win32EventHandler = _PlatformEventHandler
+ViewEventHandler = _ViewEventHandler
+
+
+class Win32Window(BaseWindow):
+ _window_class = None
+ _hwnd = None
+ _dc = None
+ _wgl_context = None
+ _tracking = False
+ _hidden = False
+ _has_focus = False
+
+ _exclusive_keyboard = False
+ _exclusive_keyboard_focus = True
+ _exclusive_mouse = False
+ _exclusive_mouse_focus = True
+ _exclusive_mouse_screen = None
+ _exclusive_mouse_lpos = None
+ _exclusive_mouse_buttons = 0
+ _mouse_platform_visible = True
+ _pending_click = False
+ _in_title_bar = False
+
+ _keyboard_state = {0x02A: False, 0x036: False} # For shift keys.
+
+ _ws_style = 0
+ _ex_ws_style = 0
+ _minimum_size = None
+ _maximum_size = None
+
+ def __init__(self, *args, **kwargs):
+ # Bind event handlers
+ self._event_handlers = {}
+ self._view_event_handlers = {}
+ for func_name in self._platform_event_names:
+ if not hasattr(self, func_name):
+ continue
+ func = getattr(self, func_name)
+ for message in func._platform_event_data:
+ if hasattr(func, '_view'):
+ self._view_event_handlers[message] = func
+ else:
+ self._event_handlers[message] = func
+
+ self._always_dwm = sys.getwindowsversion() >= (6, 2)
+ self._interval = 0
+
+ super(Win32Window, self).__init__(*args, **kwargs)
+
+ def _recreate(self, changes):
+ if 'context' in changes:
+ self._wgl_context = None
+
+ self._create()
+
+ def _create(self):
+ # Ensure style is set before determining width/height.
+ if self._fullscreen:
+ self._ws_style = WS_POPUP
+ self._ex_ws_style = 0 # WS_EX_TOPMOST
+ else:
+ styles = {
+ self.WINDOW_STYLE_DEFAULT: (WS_OVERLAPPEDWINDOW, 0),
+ self.WINDOW_STYLE_DIALOG: (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
+ WS_EX_DLGMODALFRAME),
+ self.WINDOW_STYLE_TOOL: (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
+ WS_EX_TOOLWINDOW),
+ self.WINDOW_STYLE_BORDERLESS: (WS_POPUP, 0),
+ self.WINDOW_STYLE_TRANSPARENT: (WS_OVERLAPPEDWINDOW,
+ WS_EX_LAYERED),
+ self.WINDOW_STYLE_OVERLAY: (WS_POPUP,
+ WS_EX_LAYERED | WS_EX_TRANSPARENT)
+ }
+ self._ws_style, self._ex_ws_style = styles[self._style]
+
+ if self._resizable and not self._fullscreen:
+ self._ws_style |= WS_THICKFRAME
+ else:
+ self._ws_style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX)
+
+ if self._fullscreen:
+ width = self.screen.width
+ height = self.screen.height
+ else:
+ width, height = \
+ self._client_to_window_size(self._width, self._height)
+
+ if not self._window_class:
+ module = _kernel32.GetModuleHandleW(None)
+ white = _gdi32.GetStockObject(WHITE_BRUSH)
+ black = _gdi32.GetStockObject(BLACK_BRUSH)
+ self._window_class = WNDCLASS()
+ self._window_class.lpszClassName = u'GenericAppClass%d' % id(self)
+ self._window_class.lpfnWndProc = WNDPROC(
+ self._get_window_proc(self._event_handlers))
+ self._window_class.style = CS_VREDRAW | CS_HREDRAW | CS_OWNDC
+ self._window_class.hInstance = 0
+ self._window_class.hIcon = _user32.LoadImageW(module, MAKEINTRESOURCE(1), IMAGE_ICON,
+ 0, 0, LR_DEFAULTSIZE | LR_SHARED)
+ self._window_class.hbrBackground = black
+ self._window_class.lpszMenuName = None
+ self._window_class.cbClsExtra = 0
+ self._window_class.cbWndExtra = 0
+ _user32.RegisterClassW(byref(self._window_class))
+
+ self._view_window_class = WNDCLASS()
+ self._view_window_class.lpszClassName = \
+ u'GenericViewClass%d' % id(self)
+ self._view_window_class.lpfnWndProc = WNDPROC(
+ self._get_window_proc(self._view_event_handlers))
+ self._view_window_class.style = 0
+ self._view_window_class.hInstance = 0
+ self._view_window_class.hIcon = 0
+ self._view_window_class.hbrBackground = white
+ self._view_window_class.lpszMenuName = None
+ self._view_window_class.cbClsExtra = 0
+ self._view_window_class.cbWndExtra = 0
+ _user32.RegisterClassW(byref(self._view_window_class))
+
+ if not self._hwnd:
+ self._hwnd = _user32.CreateWindowExW(
+ self._ex_ws_style,
+ self._window_class.lpszClassName,
+ u'',
+ self._ws_style,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ width,
+ height,
+ 0,
+ 0,
+ self._window_class.hInstance,
+ 0)
+
+ # View Hwnd is for the client area so certain events (mouse events) don't trigger outside of area.
+ self._view_hwnd = _user32.CreateWindowExW(
+ 0,
+ self._view_window_class.lpszClassName,
+ u'',
+ WS_CHILD | WS_VISIBLE,
+ 0, 0, 0, 0,
+ self._hwnd,
+ 0,
+ self._view_window_class.hInstance,
+ 0)
+
+ self._dc = _user32.GetDC(self._view_hwnd)
+
+ # Only allow files being dropped if specified.
+ if self._file_drops:
+ # Allows UAC to not block the drop files request if low permissions. All 3 must be set.
+ if WINDOWS_7_OR_GREATER:
+ _user32.ChangeWindowMessageFilterEx(self._hwnd, WM_DROPFILES, MSGFLT_ALLOW, None)
+ _user32.ChangeWindowMessageFilterEx(self._hwnd, WM_COPYDATA, MSGFLT_ALLOW, None)
+ _user32.ChangeWindowMessageFilterEx(self._hwnd, WM_COPYGLOBALDATA, MSGFLT_ALLOW, None)
+
+ _shell32.DragAcceptFiles(self._hwnd, True)
+
+ # Set the raw keyboard to handle shift state. This is required as legacy events cannot handle shift states
+ # when both keys are used together. View Hwnd as none changes focus to follow keyboard.
+ raw_keyboard = RAWINPUTDEVICE(0x01, 0x06, 0, None)
+ if not _user32.RegisterRawInputDevices(
+ byref(raw_keyboard), 1, sizeof(RAWINPUTDEVICE)):
+ print("Warning: Failed to unregister raw input keyboard.")
+ else:
+ # Window already exists, update it with new style
+
+ # We need to hide window here, otherwise Windows forgets
+ # to redraw the whole screen after leaving fullscreen.
+ _user32.ShowWindow(self._hwnd, SW_HIDE)
+
+ _user32.SetWindowLongW(self._hwnd,
+ GWL_STYLE,
+ self._ws_style)
+ _user32.SetWindowLongW(self._hwnd,
+ GWL_EXSTYLE,
+ self._ex_ws_style)
+
+ # Position and size window
+ if self._fullscreen:
+ hwnd_after = HWND_TOPMOST if self.style == "overlay" else HWND_NOTOPMOST
+ _user32.SetWindowPos(self._hwnd, hwnd_after,
+ self._screen.x, self._screen.y, width, height, SWP_FRAMECHANGED)
+ elif False: # TODO location not in pyglet API
+ x, y = self._client_to_window_pos(*factory.get_location())
+ _user32.SetWindowPos(self._hwnd, HWND_NOTOPMOST,
+ x, y, width, height, SWP_FRAMECHANGED)
+ elif self.style == 'transparent' or self.style == "overlay":
+ _user32.SetLayeredWindowAttributes(self._hwnd, 0, 254, LWA_ALPHA)
+ if self.style == "overlay":
+ _user32.SetWindowPos(self._hwnd, HWND_TOPMOST, 0,
+ 0, width, height, SWP_NOMOVE | SWP_NOSIZE)
+ else:
+ _user32.SetWindowPos(self._hwnd, HWND_NOTOPMOST,
+ 0, 0, width, height, SWP_NOMOVE | SWP_FRAMECHANGED)
+
+ self._update_view_location(self._width, self._height)
+
+ # Context must be created after window is created.
+ if not self._wgl_context:
+ self.canvas = Win32Canvas(self.display, self._view_hwnd, self._dc)
+ self.context.attach(self.canvas)
+ self._wgl_context = self.context._context
+
+ self.switch_to()
+
+ self.set_caption(self._caption)
+ self.set_vsync(self._vsync)
+
+ if self._visible:
+ self.set_visible()
+ # Might need resize event if going from fullscreen to fullscreen
+ self.dispatch_event('on_resize', self._width, self._height)
+ self.dispatch_event('on_expose')
+
+ def _update_view_location(self, width, height):
+ if self._fullscreen:
+ x = (self.screen.width - width) // 2
+ y = (self.screen.height - height) // 2
+ else:
+ x = y = 0
+ _user32.SetWindowPos(self._view_hwnd, 0,
+ x, y, width, height, SWP_NOZORDER | SWP_NOOWNERZORDER)
+
+ def close(self):
+ if not self._hwnd:
+ super(Win32Window, self).close()
+ return
+
+ self.set_mouse_platform_visible(True)
+
+ _user32.DestroyWindow(self._hwnd)
+ _user32.UnregisterClassW(self._view_window_class.lpszClassName, 0)
+ _user32.UnregisterClassW(self._window_class.lpszClassName, 0)
+
+ self._window_class = None
+ self._view_window_class = None
+ self._view_event_handlers.clear()
+ self._event_handlers.clear()
+ self._hwnd = None
+ self._dc = None
+ self._wgl_context = None
+ super(Win32Window, self).close()
+
+ def _dwm_composition_enabled(self):
+ """ Checks if Windows DWM is enabled (Windows Vista+)
+ Note: Always on for Windows 8+
+ """
+ is_enabled = c_int()
+ _dwmapi.DwmIsCompositionEnabled(byref(is_enabled))
+ return is_enabled.value
+
+ def _get_vsync(self):
+ return bool(self._interval)
+
+ vsync = property(_get_vsync) # overrides BaseWindow property
+
+ def set_vsync(self, vsync):
+ if pyglet.options['vsync'] is not None:
+ vsync = pyglet.options['vsync']
+
+ self._interval = vsync
+
+ if not self._fullscreen:
+ # Disable interval if composition is enabled to avoid conflict with DWM.
+ if self._always_dwm or self._dwm_composition_enabled():
+ vsync = 0
+
+ self.context.set_vsync(vsync)
+
+ def switch_to(self):
+ self.context.set_current()
+
+ def update_transparency(self):
+ region = _gdi32.CreateRectRgn(0, 0, -1, -1)
+ bb = DWM_BLURBEHIND()
+ bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION
+ bb.hRgnBlur = region
+ bb.fEnable = True
+
+ _dwmapi.DwmEnableBlurBehindWindow(self._hwnd, ctypes.byref(bb))
+ _gdi32.DeleteObject(region)
+
+ def flip(self):
+ self.draw_mouse_cursor()
+
+ if not self._fullscreen:
+ if self._always_dwm or self._dwm_composition_enabled():
+ if self._interval:
+ _dwmapi.DwmFlush()
+
+ if self.style in ('overlay', 'transparent'):
+ self.update_transparency()
+
+ self.context.flip()
+
+ def set_location(self, x, y):
+ x, y = self._client_to_window_pos(x, y)
+ _user32.SetWindowPos(self._hwnd, 0, x, y, 0, 0,
+ (SWP_NOZORDER |
+ SWP_NOSIZE |
+ SWP_NOOWNERZORDER))
+
+ def get_location(self):
+ rect = RECT()
+ _user32.GetClientRect(self._hwnd, byref(rect))
+ point = POINT()
+ point.x = rect.left
+ point.y = rect.top
+ _user32.ClientToScreen(self._hwnd, byref(point))
+ return point.x, point.y
+
+ def set_size(self, width, height):
+ super().set_size(width, height)
+ width, height = self._client_to_window_size(width, height)
+ _user32.SetWindowPos(self._hwnd, 0, 0, 0, width, height,
+ (SWP_NOZORDER | SWP_NOMOVE | SWP_NOOWNERZORDER))
+ self.dispatch_event('on_resize', width, height)
+
+ def get_size(self):
+ # rect = RECT()
+ # _user32.GetClientRect(self._hwnd, byref(rect))
+ # return rect.right - rect.left, rect.bottom - rect.top
+ return self._width, self._height
+
+ def set_minimum_size(self, width, height):
+ self._minimum_size = width, height
+
+ def set_maximum_size(self, width, height):
+ self._maximum_size = width, height
+
+ def activate(self):
+ _user32.SetForegroundWindow(self._hwnd)
+
+ def set_visible(self, visible=True):
+ if visible:
+ insertAfter = HWND_TOP
+ _user32.SetWindowPos(self._hwnd, insertAfter, 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)
+ self.dispatch_event('on_resize', self._width, self._height)
+ self.activate()
+ self.dispatch_event('on_show')
+ else:
+ _user32.ShowWindow(self._hwnd, SW_HIDE)
+ self.dispatch_event('on_hide')
+ self._visible = visible
+ self.set_mouse_platform_visible()
+
+ def minimize(self):
+ _user32.ShowWindow(self._hwnd, SW_MINIMIZE)
+
+ def maximize(self):
+ _user32.ShowWindow(self._hwnd, SW_MAXIMIZE)
+
+ def set_caption(self, caption):
+ self._caption = caption
+ _user32.SetWindowTextW(self._hwnd, c_wchar_p(caption))
+
+ def set_mouse_platform_visible(self, platform_visible=None):
+ if platform_visible is None:
+ platform_visible = (self._mouse_visible and
+ not self._exclusive_mouse and
+ (not self._mouse_cursor.gl_drawable or self._mouse_cursor.hw_drawable)) or \
+ (not self._mouse_in_window or
+ not self._has_focus)
+
+ if platform_visible and self._mouse_cursor.hw_drawable:
+ if isinstance(self._mouse_cursor, Win32MouseCursor):
+ cursor = self._mouse_cursor.cursor
+ elif isinstance(self._mouse_cursor, DefaultMouseCursor):
+ cursor = _user32.LoadCursorW(None, MAKEINTRESOURCE(IDC_ARROW))
+ else:
+ cursor = self._create_cursor_from_image(self._mouse_cursor)
+
+ _user32.SetClassLongPtrW(self._view_hwnd, GCL_HCURSOR, cursor)
+ _user32.SetCursor(cursor)
+
+ if platform_visible == self._mouse_platform_visible:
+ return
+
+ self._set_cursor_visibility(platform_visible)
+
+ self._mouse_platform_visible = platform_visible
+
+ def _set_cursor_visibility(self, platform_visible):
+ # Avoid calling ShowCursor with the current visibility (which would
+ # push the counter too far away from zero).
+ global _win32_cursor_visible
+ if _win32_cursor_visible != platform_visible:
+ _user32.ShowCursor(platform_visible)
+ _win32_cursor_visible = platform_visible
+
+ def _update_clipped_cursor(self):
+ # Clip to client area, to prevent large mouse movements taking
+ # it outside the client area.
+ if self._in_title_bar or self._pending_click:
+ return
+
+ rect = RECT()
+ _user32.GetClientRect(self._view_hwnd, byref(rect))
+ _user32.MapWindowPoints(self._view_hwnd, HWND_DESKTOP,
+ byref(rect), 2)
+
+ # For some reason borders can be off 1 pixel, allowing cursor into frame/minimize/exit buttons?
+ rect.top += 1
+ rect.left += 1
+ rect.right -= 1
+ rect.bottom -= 1
+
+ _user32.ClipCursor(byref(rect))
+
+ def set_exclusive_mouse(self, exclusive=True):
+ if self._exclusive_mouse == exclusive and \
+ self._exclusive_mouse_focus == self._has_focus:
+ return
+
+ # Mouse: UsagePage = 1, Usage = 2
+ raw_mouse = RAWINPUTDEVICE(0x01, 0x02, 0, None)
+ if not exclusive:
+ raw_mouse.dwFlags = RIDEV_REMOVE
+ raw_mouse.hwndTarget = None
+
+ if not _user32.RegisterRawInputDevices(
+ byref(raw_mouse), 1, sizeof(RAWINPUTDEVICE)):
+ if exclusive:
+ raise WindowException("Cannot enter mouse exclusive mode.")
+
+ self._exclusive_mouse_buttons = 0
+ if exclusive and self._has_focus:
+ self._update_clipped_cursor()
+ else:
+ # Release clip
+ _user32.ClipCursor(None)
+
+ self._exclusive_mouse = exclusive
+ self._exclusive_mouse_focus = self._has_focus
+ self.set_mouse_platform_visible(not exclusive)
+
+ def set_mouse_position(self, x, y, absolute=False):
+ if not absolute:
+ rect = RECT()
+ _user32.GetClientRect(self._view_hwnd, byref(rect))
+ _user32.MapWindowPoints(self._view_hwnd, HWND_DESKTOP, byref(rect), 2)
+
+ x = x + rect.left
+ y = rect.top + (rect.bottom - rect.top) - y
+
+ _user32.SetCursorPos(x, y)
+
+ def set_exclusive_keyboard(self, exclusive=True):
+ if self._exclusive_keyboard == exclusive and \
+ self._exclusive_keyboard_focus == self._has_focus:
+ return
+
+ if exclusive and self._has_focus:
+ _user32.RegisterHotKey(self._hwnd, 0, WIN32_MOD_ALT, VK_TAB)
+ elif self._exclusive_keyboard and not exclusive:
+ _user32.UnregisterHotKey(self._hwnd, 0)
+
+ self._exclusive_keyboard = exclusive
+ self._exclusive_keyboard_focus = self._has_focus
+
+ def get_system_mouse_cursor(self, name):
+ if name == self.CURSOR_DEFAULT:
+ return DefaultMouseCursor()
+
+ names = {
+ self.CURSOR_CROSSHAIR: IDC_CROSS,
+ self.CURSOR_HAND: IDC_HAND,
+ self.CURSOR_HELP: IDC_HELP,
+ self.CURSOR_NO: IDC_NO,
+ self.CURSOR_SIZE: IDC_SIZEALL,
+ self.CURSOR_SIZE_UP: IDC_SIZENS,
+ self.CURSOR_SIZE_UP_RIGHT: IDC_SIZENESW,
+ self.CURSOR_SIZE_RIGHT: IDC_SIZEWE,
+ self.CURSOR_SIZE_DOWN_RIGHT: IDC_SIZENWSE,
+ self.CURSOR_SIZE_DOWN: IDC_SIZENS,
+ self.CURSOR_SIZE_DOWN_LEFT: IDC_SIZENESW,
+ self.CURSOR_SIZE_LEFT: IDC_SIZEWE,
+ self.CURSOR_SIZE_UP_LEFT: IDC_SIZENWSE,
+ self.CURSOR_SIZE_UP_DOWN: IDC_SIZENS,
+ self.CURSOR_SIZE_LEFT_RIGHT: IDC_SIZEWE,
+ self.CURSOR_TEXT: IDC_IBEAM,
+ self.CURSOR_WAIT: IDC_WAIT,
+ self.CURSOR_WAIT_ARROW: IDC_APPSTARTING,
+ }
+ if name not in names:
+ raise RuntimeError('Unknown cursor name "%s"' % name)
+ cursor = _user32.LoadCursorW(None, MAKEINTRESOURCE(names[name]))
+ return Win32MouseCursor(cursor)
+
+ def set_icon(self, *images):
+ # XXX Undocumented AFAICT, but XP seems happy to resize an image
+ # of any size, so no scaling necessary.
+
+ def best_image(width, height):
+ # A heuristic for finding closest sized image to required size.
+ image = images[0]
+ for img in images:
+ if img.width == width and img.height == height:
+ # Exact match always used
+ return img
+ elif img.width >= width and \
+ img.width * img.height > image.width * image.height:
+ # At least wide enough, and largest area
+ image = img
+ return image
+
+ def get_icon(image):
+ # Alpha-blended icon: see http://support.microsoft.com/kb/318876
+ format = 'BGRA'
+ pitch = len(format) * image.width
+
+ header = BITMAPV5HEADER()
+ header.bV5Size = sizeof(header)
+ header.bV5Width = image.width
+ header.bV5Height = image.height
+ header.bV5Planes = 1
+ header.bV5BitCount = 32
+ header.bV5Compression = BI_BITFIELDS
+ header.bV5RedMask = 0x00ff0000
+ header.bV5GreenMask = 0x0000ff00
+ header.bV5BlueMask = 0x000000ff
+ header.bV5AlphaMask = 0xff000000
+
+ hdc = _user32.GetDC(None)
+ dataptr = c_void_p()
+ bitmap = _gdi32.CreateDIBSection(hdc, byref(header), DIB_RGB_COLORS,
+ byref(dataptr), None, 0)
+ _user32.ReleaseDC(None, hdc)
+
+ image = image.get_image_data()
+ data = image.get_data(format, pitch)
+ memmove(dataptr, data, len(data))
+
+ mask = _gdi32.CreateBitmap(image.width, image.height, 1, 1, None)
+
+ iconinfo = ICONINFO()
+ iconinfo.fIcon = True
+ iconinfo.hbmMask = mask
+ iconinfo.hbmColor = bitmap
+ icon = _user32.CreateIconIndirect(byref(iconinfo))
+
+ _gdi32.DeleteObject(mask)
+ _gdi32.DeleteObject(bitmap)
+
+ return icon
+
+ # Set large icon
+ image = best_image(_user32.GetSystemMetrics(SM_CXICON),
+ _user32.GetSystemMetrics(SM_CYICON))
+ icon = get_icon(image)
+ _user32.SetClassLongPtrW(self._hwnd, GCL_HICON, icon)
+
+ # Set small icon
+ image = best_image(_user32.GetSystemMetrics(SM_CXSMICON),
+ _user32.GetSystemMetrics(SM_CYSMICON))
+ icon = get_icon(image)
+ _user32.SetClassLongPtrW(self._hwnd, GCL_HICONSM, icon)
+
+ @lru_cache()
+ def _create_cursor_from_image(self, cursor):
+ """Creates platform cursor from an ImageCursor instance."""
+ fmt = 'BGRA'
+ image = cursor.texture
+ pitch = len(fmt) * image.width
+
+ header = BITMAPINFOHEADER()
+ header.biSize = sizeof(header)
+ header.biWidth = image.width
+ header.biHeight = image.height
+ header.biPlanes = 1
+ header.biBitCount = 32
+
+ hdc = _user32.GetDC(None)
+ dataptr = c_void_p()
+ bitmap = _gdi32.CreateDIBSection(hdc, byref(header), DIB_RGB_COLORS,
+ byref(dataptr), None, 0)
+ _user32.ReleaseDC(None, hdc)
+
+ image = image.get_image_data()
+ data = image.get_data(fmt, pitch)
+ memmove(dataptr, data, len(data))
+
+ mask = _gdi32.CreateBitmap(image.width, image.height, 1, 1, None)
+
+ iconinfo = ICONINFO()
+ iconinfo.fIcon = False
+ iconinfo.hbmMask = mask
+ iconinfo.hbmColor = bitmap
+ iconinfo.xHotspot = int(cursor.hot_x)
+ iconinfo.yHotspot = int(image.height - cursor.hot_y)
+ icon = _user32.CreateIconIndirect(byref(iconinfo))
+
+ _gdi32.DeleteObject(mask)
+ _gdi32.DeleteObject(bitmap)
+
+ return icon
+
+ # Private util
+
+ def _client_to_window_size(self, width, height):
+ rect = RECT()
+ rect.left = 0
+ rect.top = 0
+ rect.right = width
+ rect.bottom = height
+ _user32.AdjustWindowRectEx(byref(rect),
+ self._ws_style, False, self._ex_ws_style)
+ return rect.right - rect.left, rect.bottom - rect.top
+
+ def _client_to_window_pos(self, x, y):
+ rect = RECT()
+ rect.left = x
+ rect.top = y
+ _user32.AdjustWindowRectEx(byref(rect),
+ self._ws_style, False, self._ex_ws_style)
+ return rect.left, rect.top
+
+ # Event dispatching
+
+ def dispatch_events(self):
+ """Legacy or manual dispatch."""
+ from pyglet import app
+ app.platform_event_loop.start()
+ self._allow_dispatch_event = True
+ self.dispatch_pending_events()
+
+ msg = MSG()
+ while _user32.PeekMessageW(byref(msg), 0, 0, 0, PM_REMOVE):
+ _user32.TranslateMessage(byref(msg))
+ _user32.DispatchMessageW(byref(msg))
+ self._allow_dispatch_event = False
+
+ def dispatch_pending_events(self):
+ """Legacy or manual dispatch."""
+ while self._event_queue:
+ event = self._event_queue.pop(0)
+ if type(event[0]) is str:
+ # pyglet event
+ EventDispatcher.dispatch_event(self, *event)
+ else:
+ # win32 event
+ event[0](*event[1:])
+
+ def _get_window_proc(self, event_handlers):
+ def f(hwnd, msg, wParam, lParam):
+ event_handler = event_handlers.get(msg, None)
+ result = None
+ if event_handler:
+ if self._allow_dispatch_event or not self._enable_event_queue:
+ result = event_handler(msg, wParam, lParam)
+ else:
+ result = 0
+ self._event_queue.append((event_handler, msg,
+ wParam, lParam))
+ if result is None:
+ result = _user32.DefWindowProcW(hwnd, msg, wParam, lParam)
+ return result
+
+ return f
+
+ # Event handlers
+
+ def _get_modifiers(self, key_lParam=0):
+ modifiers = 0
+ if self._keyboard_state[0x036] or self._keyboard_state[0x02A]:
+ modifiers |= key.MOD_SHIFT
+ if _user32.GetKeyState(VK_CONTROL) & 0xff00:
+ modifiers |= key.MOD_CTRL
+ if _user32.GetKeyState(VK_LWIN) & 0xff00:
+ modifiers |= key.MOD_WINDOWS
+ if _user32.GetKeyState(VK_CAPITAL) & 0x00ff: # toggle
+ modifiers |= key.MOD_CAPSLOCK
+ if _user32.GetKeyState(VK_NUMLOCK) & 0x00ff: # toggle
+ modifiers |= key.MOD_NUMLOCK
+ if _user32.GetKeyState(VK_SCROLL) & 0x00ff: # toggle
+ modifiers |= key.MOD_SCROLLLOCK
+
+ if key_lParam:
+ if key_lParam & (1 << 29):
+ modifiers |= key.MOD_ALT
+ elif _user32.GetKeyState(VK_MENU) < 0:
+ modifiers |= key.MOD_ALT
+ return modifiers
+
+ @staticmethod
+ def _get_location(lParam):
+ x = c_int16(lParam & 0xffff).value
+ y = c_int16(lParam >> 16).value
+ return x, y
+
+ @Win32EventHandler(WM_KEYDOWN)
+ @Win32EventHandler(WM_KEYUP)
+ @Win32EventHandler(WM_SYSKEYDOWN)
+ @Win32EventHandler(WM_SYSKEYUP)
+ def _event_key(self, msg, wParam, lParam):
+ repeat = False
+ if lParam & (1 << 30):
+ if msg not in (WM_KEYUP, WM_SYSKEYUP):
+ repeat = True
+ ev = 'on_key_release'
+ else:
+ ev = 'on_key_press'
+
+ symbol = keymap.get(wParam, None)
+ if symbol is None:
+ ch = _user32.MapVirtualKeyW(wParam, MAPVK_VK_TO_CHAR)
+ symbol = chmap.get(ch)
+
+ if symbol is None:
+ symbol = key.user_key(wParam)
+ elif symbol == key.LCTRL and lParam & (1 << 24):
+ symbol = key.RCTRL
+ elif symbol == key.LALT and lParam & (1 << 24):
+ symbol = key.RALT
+
+ if wParam == VK_SHIFT:
+ return # Let raw input handle this instead.
+
+ modifiers = self._get_modifiers(lParam)
+
+ if not repeat:
+ self.dispatch_event(ev, symbol, modifiers)
+
+ ctrl = modifiers & key.MOD_CTRL != 0
+ if (symbol, ctrl) in _motion_map and msg not in (WM_KEYUP, WM_SYSKEYUP):
+ motion = _motion_map[symbol, ctrl]
+ if modifiers & key.MOD_SHIFT:
+ self.dispatch_event('on_text_motion_select', motion)
+ else:
+ self.dispatch_event('on_text_motion', motion)
+
+ # Send on to DefWindowProc if not exclusive.
+ if self._exclusive_keyboard:
+ return 0
+ else:
+ return None
+
+ @Win32EventHandler(WM_NCLBUTTONDOWN)
+ def _event_ncl_button_down(self, msg, wParam, lParam):
+ self._in_title_bar = True
+
+ @Win32EventHandler(WM_CAPTURECHANGED)
+ def _event_capture_changed(self, msg, wParam, lParam):
+ self._in_title_bar = False
+
+ if self._exclusive_mouse:
+ state = _user32.GetAsyncKeyState(VK_LBUTTON)
+ if not state & 0x8000: # released
+ if self._pending_click:
+ self._pending_click = False
+
+ if self._has_focus or not self._hidden:
+ self._update_clipped_cursor()
+
+ @Win32EventHandler(WM_CHAR)
+ def _event_char(self, msg, wParam, lParam):
+ text = chr(wParam)
+ if unicodedata.category(text) != 'Cc' or text == '\r':
+ self.dispatch_event('on_text', text)
+ return 0
+
+ @Win32EventHandler(WM_INPUT)
+ def _event_raw_input(self, msg, wParam, lParam):
+ hRawInput = cast(lParam, HRAWINPUT)
+ inp = RAWINPUT()
+ size = UINT(sizeof(inp))
+ _user32.GetRawInputData(hRawInput, RID_INPUT, byref(inp),
+ byref(size), sizeof(RAWINPUTHEADER))
+
+ if inp.header.dwType == RIM_TYPEMOUSE:
+ if not self._exclusive_mouse:
+ return 0
+
+ rmouse = inp.data.mouse
+
+ if rmouse.usFlags & 0x01 == MOUSE_MOVE_RELATIVE:
+ if rmouse.lLastX != 0 or rmouse.lLastY != 0:
+ # Motion event
+ # In relative motion, Y axis is positive for below.
+ # We invert it for Pyglet so positive is motion up.
+ if self._exclusive_mouse_buttons:
+ self.dispatch_event('on_mouse_drag', 0, 0,
+ rmouse.lLastX, -rmouse.lLastY,
+ self._exclusive_mouse_buttons,
+ self._get_modifiers())
+ else:
+ self.dispatch_event('on_mouse_motion', 0, 0,
+ rmouse.lLastX, -rmouse.lLastY)
+ else:
+ if self._exclusive_mouse_lpos is None:
+ self._exclusive_mouse_lpos = rmouse.lLastX, rmouse.lLastY
+ last_x, last_y = self._exclusive_mouse_lpos
+ rel_x = rmouse.lLastX - last_x
+ rel_y = rmouse.lLastY - last_y
+ if rel_x != 0 or rel_y != 0.0:
+ # Motion event
+ if self._exclusive_mouse_buttons:
+ self.dispatch_event('on_mouse_drag', 0, 0,
+ rmouse.lLastX, -rmouse.lLastY,
+ self._exclusive_mouse_buttons,
+ self._get_modifiers())
+ else:
+ self.dispatch_event('on_mouse_motion', 0, 0,
+ rel_x, rel_y)
+ self._exclusive_mouse_lpos = rmouse.lLastX, rmouse.lLastY
+
+ elif inp.header.dwType == RIM_TYPEKEYBOARD:
+ if inp.data.keyboard.VKey == 255:
+ return 0
+
+ key_up = inp.data.keyboard.Flags & RI_KEY_BREAK
+
+ if inp.data.keyboard.MakeCode == 0x02A: # LEFT_SHIFT
+ if not key_up and not self._keyboard_state[0x02A]:
+ self._keyboard_state[0x02A] = True
+ self.dispatch_event('on_key_press', key.LSHIFT, self._get_modifiers())
+
+ elif key_up and self._keyboard_state[0x02A]:
+ self._keyboard_state[0x02A] = False
+ self.dispatch_event('on_key_release', key.LSHIFT, self._get_modifiers())
+
+ elif inp.data.keyboard.MakeCode == 0x036: # RIGHT SHIFT
+ if not key_up and not self._keyboard_state[0x036]:
+ self._keyboard_state[0x036] = True
+ self.dispatch_event('on_key_press', key.RSHIFT, self._get_modifiers())
+
+ elif key_up and self._keyboard_state[0x036]:
+ self._keyboard_state[0x036] = False
+ self.dispatch_event('on_key_release', key.RSHIFT, self._get_modifiers())
+
+ return 0
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_MOUSEMOVE)
+ def _event_mousemove(self, msg, wParam, lParam):
+ if self._exclusive_mouse and self._has_focus:
+ return 0
+
+ x, y = self._get_location(lParam)
+ y = self._height - y
+
+ dx = x - self._mouse_x
+ dy = y - self._mouse_y
+
+ if not self._tracking:
+ # There is no WM_MOUSEENTER message (!), so fake it from the
+ # first WM_MOUSEMOVE event after leaving. Use self._tracking
+ # to determine when to recreate the tracking structure after
+ # re-entering (to track the next WM_MOUSELEAVE).
+ self._mouse_in_window = True
+ self.set_mouse_platform_visible()
+ self.dispatch_event('on_mouse_enter', x, y)
+ self._tracking = True
+ track = TRACKMOUSEEVENT()
+ track.cbSize = sizeof(track)
+ track.dwFlags = TME_LEAVE
+ track.hwndTrack = self._view_hwnd
+ _user32.TrackMouseEvent(byref(track))
+
+ # Don't generate motion/drag events when mouse hasn't moved. (Issue
+ # 305)
+ if self._mouse_x == x and self._mouse_y == y:
+ return 0
+
+ self._mouse_x = x
+ self._mouse_y = y
+
+ buttons = 0
+ if wParam & MK_LBUTTON:
+ buttons |= mouse.LEFT
+ if wParam & MK_MBUTTON:
+ buttons |= mouse.MIDDLE
+ if wParam & MK_RBUTTON:
+ buttons |= mouse.RIGHT
+ if wParam & MK_XBUTTON1:
+ buttons |= mouse.MOUSE4
+ if wParam & MK_XBUTTON2:
+ buttons |= mouse.MOUSE5
+
+ if buttons:
+ # Drag event
+ modifiers = self._get_modifiers()
+ self.dispatch_event('on_mouse_drag',
+ x, y, dx, dy, buttons, modifiers)
+ else:
+ # Motion event
+ self.dispatch_event('on_mouse_motion', x, y, dx, dy)
+ return 0
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_MOUSELEAVE)
+ def _event_mouseleave(self, msg, wParam, lParam):
+ point = POINT()
+ _user32.GetCursorPos(byref(point))
+ _user32.ScreenToClient(self._view_hwnd, byref(point))
+ x = point.x
+ y = self._height - point.y
+ self._tracking = False
+ self._mouse_in_window = False
+ self.set_mouse_platform_visible()
+ self.dispatch_event('on_mouse_leave', x, y)
+ return 0
+
+ def _event_mousebutton(self, ev, button, lParam):
+ if ev == 'on_mouse_press':
+ _user32.SetCapture(self._view_hwnd)
+ else:
+ _user32.ReleaseCapture()
+ x, y = self._get_location(lParam)
+ y = self._height - y
+ self.dispatch_event(ev, x, y, button, self._get_modifiers())
+ return 0
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_LBUTTONDOWN)
+ def _event_lbuttondown(self, msg, wParam, lParam):
+ return self._event_mousebutton(
+ 'on_mouse_press', mouse.LEFT, lParam)
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_LBUTTONUP)
+ def _event_lbuttonup(self, msg, wParam, lParam):
+ return self._event_mousebutton(
+ 'on_mouse_release', mouse.LEFT, lParam)
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_MBUTTONDOWN)
+ def _event_mbuttondown(self, msg, wParam, lParam):
+ return self._event_mousebutton(
+ 'on_mouse_press', mouse.MIDDLE, lParam)
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_MBUTTONUP)
+ def _event_mbuttonup(self, msg, wParam, lParam):
+ return self._event_mousebutton(
+ 'on_mouse_release', mouse.MIDDLE, lParam)
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_RBUTTONDOWN)
+ def _event_rbuttondown(self, msg, wParam, lParam):
+ return self._event_mousebutton(
+ 'on_mouse_press', mouse.RIGHT, lParam)
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_RBUTTONUP)
+ def _event_rbuttonup(self, msg, wParam, lParam):
+ return self._event_mousebutton(
+ 'on_mouse_release', mouse.RIGHT, lParam)
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_XBUTTONDOWN)
+ def _event_xbuttondown(self, msg, wParam, lParam):
+ if c_short(wParam >> 16).value == 1:
+ button = mouse.MOUSE4
+ if c_short(wParam >> 16).value == 2:
+ button = mouse.MOUSE5
+ return self._event_mousebutton(
+ 'on_mouse_press', button, lParam)
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_XBUTTONUP)
+ def _event_xbuttonup(self, msg, wParam, lParam):
+ if c_short(wParam >> 16).value == 1:
+ button = mouse.MOUSE4
+ if c_short(wParam >> 16).value == 2:
+ button = mouse.MOUSE5
+ return self._event_mousebutton(
+ 'on_mouse_release', button, lParam)
+
+ @Win32EventHandler(WM_MOUSEWHEEL)
+ def _event_mousewheel(self, msg, wParam, lParam):
+ delta = c_short(wParam >> 16).value
+ self.dispatch_event('on_mouse_scroll',
+ self._mouse_x, self._mouse_y, 0, delta / float(WHEEL_DELTA))
+ return 0
+
+ @Win32EventHandler(WM_CLOSE)
+ def _event_close(self, msg, wParam, lParam):
+ self.dispatch_event('on_close')
+ return 0
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_PAINT)
+ def _event_paint(self, msg, wParam, lParam):
+ self.dispatch_event('on_expose')
+
+ # Validating the window using ValidateRect or ValidateRgn
+ # doesn't clear the paint message when more than one window
+ # is open [why?]; defer to DefWindowProc instead.
+ return None
+
+ @Win32EventHandler(WM_SIZING)
+ def _event_sizing(self, msg, wParam, lParam):
+ # rect = cast(lParam, POINTER(RECT)).contents
+ # width, height = self.get_size()
+
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.enter_blocking()
+ return 1
+
+ @Win32EventHandler(WM_SIZE)
+ def _event_size(self, msg, wParam, lParam):
+ if not self._dc:
+ # Ignore window creation size event (appears for fullscreen
+ # only) -- we haven't got DC or HWND yet.
+ return None
+
+ if wParam == SIZE_MINIMIZED:
+ # Minimized, not resized.
+ self._hidden = True
+ self.dispatch_event('on_hide')
+ return 0
+ if self._hidden:
+ # Restored
+ self._hidden = False
+ self.dispatch_event('on_show')
+ w, h = self._get_location(lParam)
+ if not self._fullscreen:
+ self._width, self._height = w, h
+ self._update_view_location(self._width, self._height)
+
+ if self._exclusive_mouse:
+ self._update_clipped_cursor()
+
+ self.switch_to()
+ self.dispatch_event('on_resize', self._width, self._height)
+ return 0
+
+ @Win32EventHandler(WM_SYSCOMMAND)
+ def _event_syscommand(self, msg, wParam, lParam):
+ # check for ALT key to prevent app from hanging because there is
+ # no windows menu bar
+ if wParam == SC_KEYMENU and lParam & (1 >> 16) <= 0:
+ return 0
+
+ if wParam & 0xfff0 in (SC_MOVE, SC_SIZE):
+ # Should be in WM_ENTERSIZEMOVE, but we never get that message.
+ from pyglet import app
+
+ if app.event_loop is not None:
+ app.event_loop.enter_blocking()
+
+ @Win32EventHandler(WM_MOVE)
+ def _event_move(self, msg, wParam, lParam):
+ x, y = self._get_location(lParam)
+ self.dispatch_event('on_move', x, y)
+ return 0
+
+ @Win32EventHandler(WM_SETCURSOR)
+ def _event_setcursor(self, msg, wParam, lParam):
+ if self._exclusive_mouse and not self._mouse_platform_visible:
+ lo, hi = self._get_location(lParam)
+ if lo == HTCLIENT: # In frame
+ self._set_cursor_visibility(False)
+ return 1
+ elif lo in (HTCAPTION, HTCLOSE, HTMAXBUTTON, HTMINBUTTON): # Allow in
+ self._set_cursor_visibility(True)
+ return 1
+
+ @Win32EventHandler(WM_ENTERSIZEMOVE)
+ def _event_entersizemove(self, msg, wParam, lParam):
+ self._moving = True
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.exit_blocking()
+
+ @Win32EventHandler(WM_EXITSIZEMOVE)
+ def _event_exitsizemove(self, msg, wParam, lParam):
+ self._moving = False
+ from pyglet import app
+ if app.event_loop is not None:
+ app.event_loop.exit_blocking()
+
+ if self._exclusive_mouse:
+ self._update_clipped_cursor()
+
+ @Win32EventHandler(WM_SETFOCUS)
+ def _event_setfocus(self, msg, wParam, lParam):
+ self.dispatch_event('on_activate')
+ self._has_focus = True
+
+ if self._exclusive_mouse:
+ if _user32.GetAsyncKeyState(VK_LBUTTON):
+ self._pending_click = True
+
+ self.set_exclusive_keyboard(self._exclusive_keyboard)
+ self.set_exclusive_mouse(self._exclusive_mouse)
+
+ return 0
+
+ @Win32EventHandler(WM_KILLFOCUS)
+ def _event_killfocus(self, msg, wParam, lParam):
+ self.dispatch_event('on_deactivate')
+ self._has_focus = False
+
+ exclusive_keyboard = self._exclusive_keyboard
+ exclusive_mouse = self._exclusive_mouse
+ # Disable both exclusive keyboard and mouse
+ self.set_exclusive_keyboard(False)
+ self.set_exclusive_mouse(False)
+
+ # Reset shift state on Window focus loss.
+ for symbol in self._keyboard_state:
+ self._keyboard_state[symbol] = False
+
+ # But save desired state and note that we lost focus
+ # This will allow to reset the correct mode once we regain focus
+ self._exclusive_keyboard = exclusive_keyboard
+ self._exclusive_keyboard_focus = False
+ self._exclusive_mouse = exclusive_mouse
+ self._exclusive_mouse_focus = False
+ return 0
+
+ @Win32EventHandler(WM_GETMINMAXINFO)
+ def _event_getminmaxinfo(self, msg, wParam, lParam):
+ info = MINMAXINFO.from_address(lParam)
+
+ if self._minimum_size:
+ info.ptMinTrackSize.x, info.ptMinTrackSize.y = \
+ self._client_to_window_size(*self._minimum_size)
+ if self._maximum_size:
+ info.ptMaxTrackSize.x, info.ptMaxTrackSize.y = \
+ self._client_to_window_size(*self._maximum_size)
+
+ return 0
+
+ @Win32EventHandler(WM_ERASEBKGND)
+ def _event_erasebkgnd(self, msg, wParam, lParam):
+ # Prevent flicker during resize; but erase bkgnd if we're fullscreen.
+ if self._fullscreen:
+ return 0
+ else:
+ return 1
+
+ @ViewEventHandler
+ @Win32EventHandler(WM_ERASEBKGND)
+ def _event_erasebkgnd_view(self, msg, wParam, lParam):
+ # Prevent flicker during resize.
+ return 1
+
+ @Win32EventHandler(WM_DROPFILES)
+ def _event_drop_files(self, msg, wParam, lParam):
+ drop = wParam
+
+ # Get the count so we can handle multiple files.
+ file_count = _shell32.DragQueryFileW(drop, 0xFFFFFFFF, None, 0)
+
+ # Get where drop point was.
+ point = POINT()
+ _shell32.DragQueryPoint(drop, ctypes.byref(point))
+
+ paths = []
+ for i in range(file_count):
+ length = _shell32.DragQueryFileW(drop, i, None, 0) # Length of string.
+
+ buffer = create_unicode_buffer(length+1)
+
+ _shell32.DragQueryFileW(drop, i, buffer, length + 1)
+
+ paths.append(buffer.value)
+
+ _shell32.DragFinish(drop)
+
+ # Reverse Y and call event.
+ self.dispatch_event('on_file_drop', point.x, self._height - point.y, paths)
+ return 0
+
+
+__all__ = ["Win32EventHandler", "Win32Window"]
diff --git a/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/xlib/__init__.py b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/xlib/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..c1de9d7c90b48e7d34ef25b3ae7182ddc76386ff
--- /dev/null
+++ b/generate_human_motion/pyrender/.eggs/pyglet-2.0.5-py3.10.egg/pyglet/window/xlib/__init__.py
@@ -0,0 +1,1516 @@
+import unicodedata
+import urllib.parse
+from ctypes import *
+from functools import lru_cache
+
+import pyglet
+from pyglet.window import WindowException, MouseCursorException
+from pyglet.window import MouseCursor, DefaultMouseCursor, ImageMouseCursor
+from pyglet.window import BaseWindow, _PlatformEventHandler, _ViewEventHandler
+
+from pyglet.window import key
+from pyglet.window import mouse
+from pyglet.event import EventDispatcher
+
+from pyglet.canvas.xlib import XlibCanvas
+
+from pyglet.libs.x11 import xlib
+from pyglet.libs.x11 import cursorfont
+
+from pyglet.util import asbytes
+
+try:
+ from pyglet.libs.x11 import xsync
+ _have_xsync = True
+except ImportError:
+ _have_xsync = False
+
+
+class mwmhints_t(Structure):
+ _fields_ = [
+ ('flags', c_uint32),
+ ('functions', c_uint32),
+ ('decorations', c_uint32),
+ ('input_mode', c_int32),
+ ('status', c_uint32)
+ ]
+
+
+# XXX: wraptypes can't parse the header this function is in yet
+XkbSetDetectableAutoRepeat = xlib._lib.XkbSetDetectableAutoRepeat
+XkbSetDetectableAutoRepeat.restype = c_int
+XkbSetDetectableAutoRepeat.argtypes = [POINTER(xlib.Display), c_int, POINTER(c_int)]
+_can_detect_autorepeat = None
+
+XA_CARDINAL = 6 # Xatom.h:14
+XA_ATOM = 4
+
+XDND_VERSION = 5
+
+# Do we have the November 2000 UTF8 extension?
+_have_utf8 = hasattr(xlib._lib, 'Xutf8TextListToTextProperty')
+
+# symbol,ctrl -> motion mapping
+_motion_map = {
+ (key.UP, False): key.MOTION_UP,
+ (key.RIGHT, False): key.MOTION_RIGHT,
+ (key.DOWN, False): key.MOTION_DOWN,
+ (key.LEFT, False): key.MOTION_LEFT,
+ (key.RIGHT, True): key.MOTION_NEXT_WORD,
+ (key.LEFT, True): key.MOTION_PREVIOUS_WORD,
+ (key.HOME, False): key.MOTION_BEGINNING_OF_LINE,
+ (key.END, False): key.MOTION_END_OF_LINE,
+ (key.PAGEUP, False): key.MOTION_PREVIOUS_PAGE,
+ (key.PAGEDOWN, False): key.MOTION_NEXT_PAGE,
+ (key.HOME, True): key.MOTION_BEGINNING_OF_FILE,
+ (key.END, True): key.MOTION_END_OF_FILE,
+ (key.BACKSPACE, False): key.MOTION_BACKSPACE,
+ (key.DELETE, False): key.MOTION_DELETE,
+ (key.C, True): key.MOTION_COPY,
+ (key.V, True): key.MOTION_PASTE
+}
+
+
+class XlibException(WindowException):
+ """An X11-specific exception. This exception is probably a programming
+ error in pyglet."""
+ pass
+
+
+class XlibMouseCursor(MouseCursor):
+ gl_drawable = False
+ hw_drawable = True
+
+ def __init__(self, cursor):
+ self.cursor = cursor
+
+
+# Platform event data is single item, so use platform event handler directly.
+XlibEventHandler = _PlatformEventHandler
+ViewEventHandler = _ViewEventHandler
+
+
+class XlibWindow(BaseWindow):
+ _x_display = None # X display connection
+ _x_screen_id = None # X screen index
+ _x_ic = None # X input context
+ _window = None # Xlib window handle
+ _override_redirect = False
+
+ _x = 0
+ _y = 0 # Last known window position
+ _mouse_exclusive_client = None # x,y of "real" mouse during exclusive
+ _mouse_buttons = [False] * 6 # State of each xlib button
+ _active = True
+ _applied_mouse_exclusive = False
+ _applied_keyboard_exclusive = False
+ _mapped = False
+ _lost_context = False
+ _lost_context_state = False
+
+ _enable_xsync = False
+ _current_sync_value = None
+ _current_sync_valid = False
+
+ _default_event_mask = (0x1ffffff & ~xlib.PointerMotionHintMask
+ & ~xlib.ResizeRedirectMask
+ & ~xlib.SubstructureNotifyMask)
+
+ def __init__(self, *args, **kwargs):
+ # Bind event handlers
+ self._event_handlers = {}
+ self._view_event_handlers = {}
+ for name in self._platform_event_names:
+ if not hasattr(self, name):
+ continue
+ func = getattr(self, name)
+ for message in func._platform_event_data:
+ if hasattr(func, '_view'):
+ self._view_event_handlers[message] = func
+ else:
+ self._event_handlers[message] = func
+
+ super(XlibWindow, self).__init__(*args, **kwargs)
+
+ global _can_detect_autorepeat
+ if _can_detect_autorepeat is None:
+ supported_rtrn = c_int()
+ _can_detect_autorepeat = XkbSetDetectableAutoRepeat(self.display._display, c_int(1),
+ byref(supported_rtrn))
+ if _can_detect_autorepeat:
+ self.pressed_keys = set()
+
+ def _recreate(self, changes):
+ # If flipping to/from fullscreen, need to recreate the window. (This
+ # is the case with both override_redirect method and
+ # _NET_WM_STATE_FULLSCREEN).
+ #
+ # A possible improvement could be to just hide the top window,
+ # destroy the GLX window, and reshow it again when leaving fullscreen.
+ # This would prevent the floating window from being moved by the
+ # WM.
+ if 'fullscreen' in changes or 'resizable' in changes:
+ # clear out the GLX context
+ self.context.detach()
+ xlib.XDestroyWindow(self._x_display, self._window)
+ del self.display._window_map[self._window]
+ del self.display._window_map[self._view]
+ self._window = None
+ self._mapped = False
+
+ # TODO: detect state loss only by examining context share.
+ if 'context' in changes:
+ self._lost_context = True
+ self._lost_context_state = True
+
+ self._create()
+
+ def _create_xdnd_atoms(self, display):
+ self._xdnd_atoms = {
+ 'XdndAware' : xlib.XInternAtom(display, asbytes('XdndAware'), False),
+ 'XdndEnter' : xlib.XInternAtom(display, asbytes('XdndEnter'), False),
+ 'XdndTypeList' : xlib.XInternAtom(display, asbytes('XdndTypeList'), False),
+ 'XdndDrop' : xlib.XInternAtom(display, asbytes('XdndDrop'), False),
+ 'XdndFinished' : xlib.XInternAtom(display, asbytes('XdndFinished'), False),
+ 'XdndSelection' : xlib.XInternAtom(display, asbytes('XdndSelection'), False),
+ 'XdndPosition' : xlib.XInternAtom(display, asbytes('XdndPosition'), False),
+ 'XdndStatus' : xlib.XInternAtom(display, asbytes('XdndStatus'), False),
+ 'XdndActionCopy' : xlib.XInternAtom(display, asbytes('XdndActionCopy'), False),
+ 'text/uri-list' : xlib.XInternAtom(display, asbytes("text/uri-list"), False)
+ }
+
+ def _create(self):
+ # Unmap existing window if necessary while we fiddle with it.
+ if self._window and self._mapped:
+ self._unmap()
+
+ self._x_display = self.display._display
+ self._x_screen_id = self.display.x_screen
+
+ # Create X window if not already existing.
+ if not self._window:
+ root = xlib.XRootWindow(self._x_display, self._x_screen_id)
+
+ visual_info = self.config.get_visual_info()
+ if self.style in ('transparent', 'overlay'):
+ xlib.XMatchVisualInfo(self._x_display, self._x_screen_id, 32, xlib.TrueColor, visual_info)
+
+ visual = visual_info.visual
+ visual_id = xlib.XVisualIDFromVisual(visual)
+ default_visual = xlib.XDefaultVisual(self._x_display, self._x_screen_id)
+ default_visual_id = xlib.XVisualIDFromVisual(default_visual)
+ window_attributes = xlib.XSetWindowAttributes()
+ if visual_id != default_visual_id:
+ window_attributes.colormap = xlib.XCreateColormap(self._x_display, root,
+ visual, xlib.AllocNone)
+ else:
+ window_attributes.colormap = xlib.XDefaultColormap(self._x_display,
+ self._x_screen_id)
+ window_attributes.bit_gravity = xlib.StaticGravity
+
+ # Issue 287: Compiz on Intel/Mesa doesn't draw window decoration
+ # unless CWBackPixel is given in mask. Should have
+ # no effect on other systems, so it's set
+ # unconditionally.
+ mask = xlib.CWColormap | xlib.CWBitGravity | xlib.CWBackPixel
+
+ if self.style in ('transparent', 'overlay'):
+ mask |= xlib.CWBorderPixel
+ window_attributes.border_pixel = 0
+ window_attributes.background_pixel = 0
+
+ if self._fullscreen:
+ width, height = self.screen.width, self.screen.height
+ self._view_x = (width - self._width) // 2
+ self._view_y = (height - self._height) // 2
+ else:
+ width, height = self._width, self._height
+ self._view_x = self._view_y = 0
+
+ self._window = xlib.XCreateWindow(self._x_display, root,
+ 0, 0, width, height, 0, visual_info.depth,
+ xlib.InputOutput, visual, mask,
+ byref(window_attributes))
+ self._view = xlib.XCreateWindow(self._x_display,
+ self._window, self._view_x, self._view_y,
+ self._width, self._height, 0, visual_info.depth,
+ xlib.InputOutput, visual, mask,
+ byref(window_attributes))
+ xlib.XMapWindow(self._x_display, self._view)
+ xlib.XSelectInput(self._x_display, self._view, self._default_event_mask)
+
+ self.display._window_map[self._window] = self.dispatch_platform_event
+ self.display._window_map[self._view] = self.dispatch_platform_event_view
+
+ self.canvas = XlibCanvas(self.display, self._view)
+
+ self.context.attach(self.canvas)
+ self.context.set_vsync(self._vsync) # XXX ?
+
+ # Setting null background pixmap disables drawing the background,
+ # preventing flicker while resizing (in theory).
+ #
+ # Issue 287: Compiz on Intel/Mesa doesn't draw window decoration if
+ # this is called. As it doesn't seem to have any
+ # effect anyway, it's just commented out.
+ # xlib.XSetWindowBackgroundPixmap(self._x_display, self._window, 0)
+
+ self._enable_xsync = (pyglet.options['xsync'] and
+ self.display._enable_xsync and
+ self.config.double_buffer)
+
+ # Set supported protocols
+ protocols = []
+ protocols.append(xlib.XInternAtom(self._x_display, asbytes('WM_DELETE_WINDOW'), False))
+ if self._enable_xsync:
+ protocols.append(xlib.XInternAtom(self._x_display,
+ asbytes('_NET_WM_SYNC_REQUEST'),
+ False))
+ protocols = (c_ulong * len(protocols))(*protocols)
+ xlib.XSetWMProtocols(self._x_display, self._window, protocols, len(protocols))
+
+ # Create window resize sync counter
+ if self._enable_xsync:
+ value = xsync.XSyncValue()
+ self._sync_counter = xlib.XID(xsync.XSyncCreateCounter(self._x_display, value))
+ atom = xlib.XInternAtom(self._x_display,
+ asbytes('_NET_WM_SYNC_REQUEST_COUNTER'), False)
+ ptr = pointer(self._sync_counter)
+
+ xlib.XChangeProperty(self._x_display, self._window,
+ atom, XA_CARDINAL, 32,
+ xlib.PropModeReplace,
+ cast(ptr, POINTER(c_ubyte)), 1)
+
+ # Atoms required for Xdnd
+ self._create_xdnd_atoms(self._x_display)
+
+ # Support for drag and dropping files needs to be enabled.
+ if self._file_drops:
+ # Some variables set because there are 4 different drop events that need shared data.
+ self._xdnd_source = None
+ self._xdnd_version = None
+ self._xdnd_format = None
+ self._xdnd_position = (0, 0) # For position callback.
+
+ VERSION = c_ulong(int(XDND_VERSION))
+ ptr = pointer(VERSION)
+
+ xlib.XChangeProperty(self._x_display, self._window,
+ self._xdnd_atoms['XdndAware'], XA_ATOM, 32,
+ xlib.PropModeReplace,
+ cast(ptr, POINTER(c_ubyte)), 1)
+
+ # Set window attributes
+ attributes = xlib.XSetWindowAttributes()
+ attributes_mask = 0
+
+ self._override_redirect = False
+ if self._fullscreen:
+ if pyglet.options['xlib_fullscreen_override_redirect']:
+ # Try not to use this any more, it causes problems; disabled
+ # by default in favour of _NET_WM_STATE_FULLSCREEN.
+ attributes.override_redirect = self._fullscreen
+ attributes_mask |= xlib.CWOverrideRedirect
+ self._override_redirect = True
+ else:
+ self._set_wm_state('_NET_WM_STATE_FULLSCREEN')
+
+ if self._fullscreen:
+ xlib.XMoveResizeWindow(self._x_display, self._window,
+ self.screen.x, self.screen.y,
+ self.screen.width, self.screen.height)
+ else:
+ xlib.XResizeWindow(self._x_display, self._window, self._width, self._height)
+
+ xlib.XChangeWindowAttributes(self._x_display, self._window,
+ attributes_mask, byref(attributes))
+
+ # Set style
+ styles = {
+ self.WINDOW_STYLE_DEFAULT: '_NET_WM_WINDOW_TYPE_NORMAL',
+ self.WINDOW_STYLE_DIALOG: '_NET_WM_WINDOW_TYPE_DIALOG',
+ self.WINDOW_STYLE_TOOL: '_NET_WM_WINDOW_TYPE_UTILITY',
+ }
+ if self._style in styles:
+ self._set_atoms_property('_NET_WM_WINDOW_TYPE', (styles[self._style],))
+ elif self._style in (self.WINDOW_STYLE_BORDERLESS, self.WINDOW_STYLE_OVERLAY):
+ MWM_HINTS_DECORATIONS = 1 << 1
+ PROP_MWM_HINTS_ELEMENTS = 5
+ mwmhints = mwmhints_t()
+ mwmhints.flags = MWM_HINTS_DECORATIONS
+ mwmhints.decorations = 0
+ name = xlib.XInternAtom(self._x_display, asbytes('_MOTIF_WM_HINTS'), False)
+ xlib.XChangeProperty(self._x_display, self._window,
+ name, name, 32, xlib.PropModeReplace,
+ cast(pointer(mwmhints), POINTER(c_ubyte)),
+ PROP_MWM_HINTS_ELEMENTS)
+
+ # Set resizeable
+ if not self._resizable and not self._fullscreen:
+ self.set_minimum_size(self._width, self._height)
+ self.set_maximum_size(self._width, self._height)
+
+ # Set caption
+ self.set_caption(self._caption)
+
+ # Set WM_CLASS for modern desktop environments
+ self.set_wm_class(self._caption)
+
+ # this is supported by some compositors (ie gnome-shell), and more to come
+ # see: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idp6357888
+ _NET_WM_BYPASS_COMPOSITOR_HINT_ON = c_ulong(int(self._fullscreen))
+ name = xlib.XInternAtom(self._x_display, asbytes('_NET_WM_BYPASS_COMPOSITOR'), False)
+ ptr = pointer(_NET_WM_BYPASS_COMPOSITOR_HINT_ON)
+
+ xlib.XChangeProperty(self._x_display, self._window,
+ name, XA_CARDINAL, 32,
+ xlib.PropModeReplace,
+ cast(ptr, POINTER(c_ubyte)), 1)
+
+ # Create input context. A good but very outdated reference for this
+ # is http://www.sbin.org/doc/Xlib/chapt_11.html
+ if _have_utf8 and not self._x_ic:
+ if not self.display._x_im:
+ xlib.XSetLocaleModifiers(asbytes('@im=none'))
+ self.display._x_im = xlib.XOpenIM(self._x_display, None, None, None)
+
+ xlib.XFlush(self._x_display)
+
+ # Need to set argtypes on this function because its vararg,
+ # and ctypes guesses wrong.
+ xlib.XCreateIC.argtypes = [xlib.XIM,
+ c_char_p, c_int,
+ c_char_p, xlib.Window,
+ c_char_p, xlib.Window,
+ c_void_p]
+ self._x_ic = xlib.XCreateIC(self.display._x_im,
+ asbytes('inputStyle'),
+ xlib.XIMPreeditNothing | xlib.XIMStatusNothing,
+ asbytes('clientWindow'), self._window,
+ asbytes('focusWindow'), self._window,
+ None)
+
+ filter_events = c_ulong()
+ xlib.XGetICValues(self._x_ic, 'filterEvents', byref(filter_events), None)
+ self._default_event_mask |= filter_events.value
+ xlib.XSetICFocus(self._x_ic)
+
+ self.switch_to()
+ if self._visible:
+ self.set_visible(True)
+
+ self.set_mouse_platform_visible()
+ self._applied_mouse_exclusive = None
+ self._update_exclusivity()
+
+ def _map(self):
+ if self._mapped:
+ return
+
+ # Map the window, wait for map event before continuing.
+ xlib.XSelectInput(self._x_display, self._window, xlib.StructureNotifyMask)
+ xlib.XMapRaised(self._x_display, self._window)
+ e = xlib.XEvent()
+ while True:
+ xlib.XNextEvent(self._x_display, e)
+ if e.type == xlib.ConfigureNotify:
+ self._width = e.xconfigure.width
+ self._height = e.xconfigure.height
+ elif e.type == xlib.MapNotify:
+ break
+ xlib.XSelectInput(self._x_display, self._window, self._default_event_mask)
+ self._mapped = True
+
+ if self._override_redirect:
+ # Possibly an override_redirect issue.
+ self.activate()
+
+ self._update_view_size()
+
+ self.dispatch_event('on_resize', self._width, self._height)
+ self.dispatch_event('on_show')
+ self.dispatch_event('on_expose')
+
+ def _unmap(self):
+ if not self._mapped:
+ return
+
+ xlib.XSelectInput(self._x_display, self._window, xlib.StructureNotifyMask)
+ xlib.XUnmapWindow(self._x_display, self._window)
+ e = xlib.XEvent()
+ while True:
+ xlib.XNextEvent(self._x_display, e)
+ if e.type == xlib.UnmapNotify:
+ break
+
+ xlib.XSelectInput(self._x_display, self._window, self._default_event_mask)
+ self._mapped = False
+
+ def _get_root(self):
+ attributes = xlib.XWindowAttributes()
+ xlib.XGetWindowAttributes(self._x_display, self._window, byref(attributes))
+ return attributes.root
+
+ def _is_reparented(self):
+ root = c_ulong()
+ parent = c_ulong()
+ children = pointer(c_ulong())
+ n_children = c_uint()
+
+ xlib.XQueryTree(self._x_display, self._window,
+ byref(root), byref(parent), byref(children),
+ byref(n_children))
+
+ return root.value != parent.value
+
+ def close(self):
+ if not self._window:
+ return
+
+ self.context.destroy()
+ self._unmap()
+ if self._window:
+ xlib.XDestroyWindow(self._x_display, self._window)
+
+ del self.display._window_map[self._window]
+ del self.display._window_map[self._view]
+ self._window = None
+
+ self._view_event_handlers.clear()
+ self._event_handlers.clear()
+
+ if _have_utf8:
+ xlib.XDestroyIC(self._x_ic)
+ self._x_ic = None
+
+ super(XlibWindow, self).close()
+
+ def switch_to(self):
+ if self.context:
+ self.context.set_current()
+
+ def flip(self):
+ self.draw_mouse_cursor()
+
+ # TODO canvas.flip?
+ if self.context:
+ self.context.flip()
+
+ self._sync_resize()
+
+ def set_vsync(self, vsync: bool) -> None:
+ if pyglet.options['vsync'] is not None:
+ vsync = pyglet.options['vsync']
+
+ super().set_vsync(vsync)
+ self.context.set_vsync(vsync)
+
+ def set_caption(self, caption):
+ if caption is None:
+ caption = ''
+ self._caption = caption
+ self._set_text_property('WM_NAME', caption, allow_utf8=False)
+ self._set_text_property('WM_ICON_NAME', caption, allow_utf8=False)
+ self._set_text_property('_NET_WM_NAME', caption)
+ self._set_text_property('_NET_WM_ICON_NAME', caption)
+
+ def set_wm_class(self, name):
+ # WM_CLASS can only contain Ascii characters
+ try:
+ name = name.encode('ascii')
+ except UnicodeEncodeError:
+ name = "pyglet"
+
+ hint = xlib.XAllocClassHint()
+ hint.contents.res_class = asbytes(name)
+ hint.contents.res_name = asbytes(name.lower())
+ xlib.XSetClassHint(self._x_display, self._window, hint.contents)
+ xlib.XFree(hint)
+
+ def get_caption(self):
+ return self._caption
+
+ def set_size(self, width: int, height: int) -> None:
+ super().set_size(width, height)
+ if not self._resizable:
+ self.set_minimum_size(width, height)
+ self.set_maximum_size(width, height)
+ xlib.XResizeWindow(self._x_display, self._window, width, height)
+ self._update_view_size()
+ self.dispatch_event('on_resize', width, height)
+
+ def _update_view_size(self):
+ xlib.XResizeWindow(self._x_display, self._view, self._width, self._height)
+
+ def set_location(self, x, y):
+ if self._is_reparented():
+ # Assume the window manager has reparented our top-level window
+ # only once, in which case attributes.x/y give the offset from
+ # the frame to the content window. Better solution would be
+ # to use _NET_FRAME_EXTENTS, where supported.
+ attributes = xlib.XWindowAttributes()
+ xlib.XGetWindowAttributes(self._x_display, self._window, byref(attributes))
+ # XXX at least under KDE's WM these attrs are both 0
+ x -= attributes.x
+ y -= attributes.y
+ xlib.XMoveWindow(self._x_display, self._window, x, y)
+
+ def get_location(self):
+ child = xlib.Window()
+ x = c_int()
+ y = c_int()
+ xlib.XTranslateCoordinates(self._x_display,
+ self._window,
+ self._get_root(),
+ 0, 0,
+ byref(x),
+ byref(y),
+ byref(child))
+ return x.value, y.value
+
+ def activate(self):
+ # Issue 218
+ if self._x_display and self._window:
+ xlib.XSetInputFocus(self._x_display, self._window, xlib.RevertToParent, xlib.CurrentTime)
+
+ def set_visible(self, visible: bool = True) -> None:
+ super().set_visible(visible)
+
+ if visible:
+ self._map()
+ else:
+ self._unmap()
+
+ def set_minimum_size(self, width: int, height: int) -> None:
+ super().set_minimum_size(width, height)
+ self._set_wm_normal_hints()
+
+ def set_maximum_size(self, width: int, height: int) -> None:
+ super().set_maximum_size(width, height)
+ self._set_wm_normal_hints()
+
+ def minimize(self):
+ xlib.XIconifyWindow(self._x_display, self._window, self._x_screen_id)
+
+ def maximize(self):
+ self._set_wm_state('_NET_WM_STATE_MAXIMIZED_HORZ',
+ '_NET_WM_STATE_MAXIMIZED_VERT')
+
+ @staticmethod
+ def _downsample_1bit(pixelarray):
+ byte_list = []
+ value = 0
+
+ for i, pixel in enumerate(pixelarray):
+ index = i % 8
+ if pixel:
+ value |= 1 << index
+ if index == 7:
+ byte_list.append(value)
+ value = 0
+
+ return bytes(byte_list)
+
+ @lru_cache()
+ def _create_cursor_from_image(self, cursor):
+ """Creates platform cursor from an ImageCursor instance."""
+ texture = cursor.texture
+ width = texture.width
+ height = texture.height
+
+ alpha_luma_bytes = texture.get_image_data().get_data('AL', -width * 2)
+ mask_data = self._downsample_1bit(alpha_luma_bytes[0::2])
+ bmp_data = self._downsample_1bit(alpha_luma_bytes[1::2])
+
+ bitmap = xlib.XCreateBitmapFromData(self._x_display, self._window, bmp_data, width, height)
+ mask = xlib.XCreateBitmapFromData(self._x_display, self._window, mask_data, width, height)
+ white = xlib.XColor(red=65535, green=65535, blue=65535) # background color
+ black = xlib.XColor() # foreground color
+
+ # hot_x/y must be within the image dimension, or the cursor will not display:
+ hot_x = min(max(0, int(self._mouse_cursor.hot_x)), width)
+ hot_y = min(max(0, int(height - self._mouse_cursor.hot_y)), height)
+ cursor = xlib.XCreatePixmapCursor(self._x_display, bitmap, mask, white, black, hot_x, hot_y)
+ xlib.XFreePixmap(self._x_display, bitmap)
+ xlib.XFreePixmap(self._x_display, mask)
+
+ return cursor
+
+ def set_mouse_platform_visible(self, platform_visible=None):
+ if not self._window:
+ return
+ if platform_visible is None:
+ platform_visible = self._mouse_visible and not self._mouse_cursor.gl_drawable
+
+ if platform_visible is False:
+ # Hide pointer by creating an empty cursor:
+ black = xlib.XColor()
+ bitmap = xlib.XCreateBitmapFromData(self._x_display, self._window, bytes(8), 8, 8)
+ cursor = xlib.XCreatePixmapCursor(self._x_display, bitmap, bitmap, black, black, 0, 0)
+ xlib.XDefineCursor(self._x_display, self._window, cursor)
+ xlib.XFreeCursor(self._x_display, cursor)
+ xlib.XFreePixmap(self._x_display, bitmap)
+ elif isinstance(self._mouse_cursor, ImageMouseCursor) and self._mouse_cursor.hw_drawable:
+ # Create a custom hardware cursor:
+ cursor = self._create_cursor_from_image(self._mouse_cursor)
+ xlib.XDefineCursor(self._x_display, self._window, cursor)
+ else:
+ # Restore standard hardware cursor:
+ if isinstance(self._mouse_cursor, XlibMouseCursor):
+ xlib.XDefineCursor(self._x_display, self._window, self._mouse_cursor.cursor)
+ else:
+ xlib.XUndefineCursor(self._x_display, self._window)
+
+ def set_mouse_position(self, x, y):
+ xlib.XWarpPointer(self._x_display,
+ 0, # src window
+ self._window, # dst window
+ 0, 0, # src x, y
+ 0, 0, # src w, h
+ x, self._height - y)
+
+ def _update_exclusivity(self):
+ mouse_exclusive = self._active and self._mouse_exclusive
+ keyboard_exclusive = self._active and self._keyboard_exclusive
+
+ if mouse_exclusive != self._applied_mouse_exclusive:
+ if mouse_exclusive:
+ self.set_mouse_platform_visible(False)
+
+ # Restrict to client area
+ xlib.XGrabPointer(self._x_display, self._window,
+ True,
+ 0,
+ xlib.GrabModeAsync,
+ xlib.GrabModeAsync,
+ self._window,
+ 0,
+ xlib.CurrentTime)
+
+ # Move pointer to center of window
+ x = self._width // 2
+ y = self._height // 2
+ self._mouse_exclusive_client = x, y
+ self.set_mouse_position(x, y)
+ elif self._fullscreen and not self.screen._xinerama:
+ # Restrict to fullscreen area (prevent viewport scrolling)
+ self.set_mouse_position(0, 0)
+ r = xlib.XGrabPointer(self._x_display, self._view,
+ True, 0,
+ xlib.GrabModeAsync,
+ xlib.GrabModeAsync,
+ self._view,
+ 0,
+ xlib.CurrentTime)
+ if r:
+ # Failed to grab, try again later
+ self._applied_mouse_exclusive = None
+ return
+ self.set_mouse_platform_visible()
+ else:
+ # Unclip
+ xlib.XUngrabPointer(self._x_display, xlib.CurrentTime)
+ self.set_mouse_platform_visible()
+
+ self._applied_mouse_exclusive = mouse_exclusive
+
+ if keyboard_exclusive != self._applied_keyboard_exclusive:
+ if keyboard_exclusive:
+ xlib.XGrabKeyboard(self._x_display,
+ self._window,
+ False,
+ xlib.GrabModeAsync,
+ xlib.GrabModeAsync,
+ xlib.CurrentTime)
+ else:
+ xlib.XUngrabKeyboard(self._x_display, xlib.CurrentTime)
+ self._applied_keyboard_exclusive = keyboard_exclusive
+
+ def set_exclusive_mouse(self, exclusive=True):
+ if exclusive == self._mouse_exclusive:
+ return
+
+ super().set_exclusive_mouse(exclusive)
+ self._update_exclusivity()
+
+ def set_exclusive_keyboard(self, exclusive=True):
+ if exclusive == self._keyboard_exclusive:
+ return
+
+ super().set_exclusive_keyboard(exclusive)
+ self._update_exclusivity()
+
+ def get_system_mouse_cursor(self, name):
+ if name == self.CURSOR_DEFAULT:
+ return DefaultMouseCursor()
+
+ # NQR means default shape is not pretty... surely there is another
+ # cursor font?
+ cursor_shapes = {
+ self.CURSOR_CROSSHAIR: cursorfont.XC_crosshair,
+ self.CURSOR_HAND: cursorfont.XC_hand2,
+ self.CURSOR_HELP: cursorfont.XC_question_arrow, # NQR
+ self.CURSOR_NO: cursorfont.XC_pirate, # NQR
+ self.CURSOR_SIZE: cursorfont.XC_fleur,
+ self.CURSOR_SIZE_UP: cursorfont.XC_top_side,
+ self.CURSOR_SIZE_UP_RIGHT: cursorfont.XC_top_right_corner,
+ self.CURSOR_SIZE_RIGHT: cursorfont.XC_right_side,
+ self.CURSOR_SIZE_DOWN_RIGHT: cursorfont.XC_bottom_right_corner,
+ self.CURSOR_SIZE_DOWN: cursorfont.XC_bottom_side,
+ self.CURSOR_SIZE_DOWN_LEFT: cursorfont.XC_bottom_left_corner,
+ self.CURSOR_SIZE_LEFT: cursorfont.XC_left_side,
+ self.CURSOR_SIZE_UP_LEFT: cursorfont.XC_top_left_corner,
+ self.CURSOR_SIZE_UP_DOWN: cursorfont.XC_sb_v_double_arrow,
+ self.CURSOR_SIZE_LEFT_RIGHT: cursorfont.XC_sb_h_double_arrow,
+ self.CURSOR_TEXT: cursorfont.XC_xterm,
+ self.CURSOR_WAIT: cursorfont.XC_watch,
+ self.CURSOR_WAIT_ARROW: cursorfont.XC_watch, # NQR
+ }
+ if name not in cursor_shapes:
+ raise MouseCursorException('Unknown cursor name "%s"' % name)
+ cursor = xlib.XCreateFontCursor(self._x_display, cursor_shapes[name])
+ return XlibMouseCursor(cursor)
+
+ def set_icon(self, *images):
+ # Careful! XChangeProperty takes an array of long when data type
+ # is 32-bit (but long can be 64 bit!), so pad high bytes of format if
+ # necessary.
+
+ import sys
+ fmt = {('little', 4): 'BGRA',
+ ('little', 8): 'BGRAAAAA',
+ ('big', 4): 'ARGB',
+ ('big', 8): 'AAAAARGB'}[(sys.byteorder, sizeof(c_ulong))]
+
+ data = asbytes('')
+ for image in images:
+ image = image.get_image_data()
+ pitch = -(image.width * len(fmt))
+ s = c_buffer(sizeof(c_ulong) * 2)
+ memmove(s, cast((c_ulong * 2)(image.width, image.height), POINTER(c_ubyte)), len(s))
+ data += s.raw + image.get_data(fmt, pitch)
+ buffer = (c_ubyte * len(data))()
+ memmove(buffer, data, len(data))
+ atom = xlib.XInternAtom(self._x_display, asbytes('_NET_WM_ICON'), False)
+ xlib.XChangeProperty(self._x_display, self._window, atom, XA_CARDINAL,
+ 32, xlib.PropModeReplace, buffer, len(data)//sizeof(c_ulong))
+
+ # Private utility
+
+ def _set_wm_normal_hints(self):
+ hints = xlib.XAllocSizeHints().contents
+ if self._minimum_size:
+ hints.flags |= xlib.PMinSize
+ hints.min_width, hints.min_height = self._minimum_size
+ if self._maximum_size:
+ hints.flags |= xlib.PMaxSize
+ hints.max_width, hints.max_height = self._maximum_size
+ xlib.XSetWMNormalHints(self._x_display, self._window, byref(hints))
+
+ def _set_text_property(self, name, value, allow_utf8=True):
+ atom = xlib.XInternAtom(self._x_display, asbytes(name), False)
+ if not atom:
+ raise XlibException('Undefined atom "%s"' % name)
+ text_property = xlib.XTextProperty()
+ if _have_utf8 and allow_utf8:
+ buf = create_string_buffer(value.encode('utf8'))
+ result = xlib.Xutf8TextListToTextProperty(self._x_display,
+ cast(pointer(buf), c_char_p),
+ 1, xlib.XUTF8StringStyle,
+ byref(text_property))
+ if result < 0:
+ raise XlibException('Could not create UTF8 text property')
+ else:
+ buf = create_string_buffer(value.encode('ascii', 'ignore'))
+ result = xlib.XStringListToTextProperty(
+ cast(pointer(buf), c_char_p), 1, byref(text_property))
+ if result < 0:
+ raise XlibException('Could not create text property')
+ xlib.XSetTextProperty(self._x_display, self._window, byref(text_property), atom)
+ # XXX Xlib doesn't like us freeing this
+ # xlib.XFree(text_property.value)
+
+ def _set_atoms_property(self, name, values, mode=xlib.PropModeReplace):
+ name_atom = xlib.XInternAtom(self._x_display, asbytes(name), False)
+ atoms = []
+ for value in values:
+ atoms.append(xlib.XInternAtom(self._x_display, asbytes(value), False))
+ atom_type = xlib.XInternAtom(self._x_display, asbytes('ATOM'), False)
+ if len(atoms):
+ atoms_ar = (xlib.Atom * len(atoms))(*atoms)
+ xlib.XChangeProperty(self._x_display, self._window,
+ name_atom, atom_type, 32, mode,
+ cast(pointer(atoms_ar), POINTER(c_ubyte)), len(atoms))
+ else:
+ net_wm_state = xlib.XInternAtom(self._x_display, asbytes('_NET_WM_STATE'), False)
+ if net_wm_state:
+ xlib.XDeleteProperty(self._x_display, self._window, net_wm_state)
+
+ def _set_wm_state(self, *states):
+ # Set property
+ net_wm_state = xlib.XInternAtom(self._x_display, asbytes('_NET_WM_STATE'), False)
+ atoms = []
+ for state in states:
+ atoms.append(xlib.XInternAtom(self._x_display, asbytes(state), False))
+ atom_type = xlib.XInternAtom(self._x_display, asbytes('ATOM'), False)
+ if len(atoms):
+ atoms_ar = (xlib.Atom * len(atoms))(*atoms)
+ xlib.XChangeProperty(self._x_display, self._window,
+ net_wm_state, atom_type, 32, xlib.PropModePrepend,
+ cast(pointer(atoms_ar), POINTER(c_ubyte)), len(atoms))
+ else:
+ xlib.XDeleteProperty(self._x_display, self._window, net_wm_state)
+
+ # Nudge the WM
+ e = xlib.XEvent()
+ e.xclient.type = xlib.ClientMessage
+ e.xclient.message_type = net_wm_state
+ e.xclient.display = cast(self._x_display, POINTER(xlib.Display))
+ e.xclient.window = self._window
+ e.xclient.format = 32
+ e.xclient.data.l[0] = xlib.PropModePrepend
+ for i, atom in enumerate(atoms):
+ e.xclient.data.l[i + 1] = atom
+ xlib.XSendEvent(self._x_display, self._get_root(),
+ False, xlib.SubstructureRedirectMask, byref(e))
+
+ # Event handling
+
+ def dispatch_events(self):
+ self.dispatch_pending_events()
+
+ self._allow_dispatch_event = True
+
+ e = xlib.XEvent()
+
+ # Cache these in case window is closed from an event handler
+ _x_display = self._x_display
+ _window = self._window
+ _view = self._view
+
+ # Check for the events specific to this window
+ while xlib.XCheckWindowEvent(_x_display, _window, 0x1ffffff, byref(e)):
+ # Key events are filtered by the xlib window event
+ # handler so they get a shot at the prefiltered event.
+ if e.xany.type not in (xlib.KeyPress, xlib.KeyRelease):
+ if xlib.XFilterEvent(e, 0):
+ continue
+ self.dispatch_platform_event(e)
+
+ # Check for the events specific to this view
+ while xlib.XCheckWindowEvent(_x_display, _view, 0x1ffffff, byref(e)):
+ # Key events are filtered by the xlib window event
+ # handler so they get a shot at the prefiltered event.
+ if e.xany.type not in (xlib.KeyPress, xlib.KeyRelease):
+ if xlib.XFilterEvent(e, 0):
+ continue
+ self.dispatch_platform_event_view(e)
+
+ # Generic events for this window (the window close event).
+ while xlib.XCheckTypedWindowEvent(_x_display, _window, xlib.ClientMessage, byref(e)):
+ self.dispatch_platform_event(e)
+
+ self._allow_dispatch_event = False
+
+ def dispatch_pending_events(self):
+ while self._event_queue:
+ EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))
+
+ # Dispatch any context-related events
+ if self._lost_context:
+ self._lost_context = False
+ EventDispatcher.dispatch_event(self, 'on_context_lost')
+ if self._lost_context_state:
+ self._lost_context_state = False
+ EventDispatcher.dispatch_event(self, 'on_context_state_lost')
+
+ def dispatch_platform_event(self, e):
+ if self._applied_mouse_exclusive is None:
+ self._update_exclusivity()
+ event_handler = self._event_handlers.get(e.type)
+ if event_handler:
+ event_handler(e)
+
+ def dispatch_platform_event_view(self, e):
+ event_handler = self._view_event_handlers.get(e.type)
+ if event_handler:
+ event_handler(e)
+
+ @staticmethod
+ def _translate_modifiers(state):
+ modifiers = 0
+ if state & xlib.ShiftMask:
+ modifiers |= key.MOD_SHIFT
+ if state & xlib.ControlMask:
+ modifiers |= key.MOD_CTRL
+ if state & xlib.LockMask:
+ modifiers |= key.MOD_CAPSLOCK
+ if state & xlib.Mod1Mask:
+ modifiers |= key.MOD_ALT
+ if state & xlib.Mod2Mask:
+ modifiers |= key.MOD_NUMLOCK
+ if state & xlib.Mod4Mask:
+ modifiers |= key.MOD_WINDOWS
+ if state & xlib.Mod5Mask:
+ modifiers |= key.MOD_SCROLLLOCK
+ return modifiers
+
+ # Event handlers
+ """
+ def _event_symbol(self, event):
+ # pyglet.self.key keysymbols are identical to X11 keysymbols, no
+ # need to map the keysymbol.
+ symbol = xlib.XKeycodeToKeysym(self._x_display, event.xkey.keycode, 0)
+ if symbol == 0:
+ # XIM event
+ return None
+ elif symbol not in key._key_names.keys():
+ symbol = key.user_key(event.xkey.keycode)
+ return symbol
+ """
+
+ def _event_text_symbol(self, ev):
+ text = None
+ symbol = xlib.KeySym()
+ buffer = create_string_buffer(128)
+
+ # Look up raw keysym before XIM filters it (default for keypress and
+ # keyrelease)
+ count = xlib.XLookupString(ev.xkey, buffer, len(buffer) - 1, byref(symbol), None)
+
+ # Give XIM a shot
+ filtered = xlib.XFilterEvent(ev, ev.xany.window)
+
+ if ev.type == xlib.KeyPress and not filtered:
+ status = c_int()
+ if _have_utf8:
+ encoding = 'utf8'
+ count = xlib.Xutf8LookupString(self._x_ic,
+ ev.xkey,
+ buffer, len(buffer) - 1,
+ byref(symbol), byref(status))
+ if status.value == xlib.XBufferOverflow:
+ raise NotImplementedError('TODO: XIM buffer resize')
+
+ else:
+ encoding = 'ascii'
+ count = xlib.XLookupString(ev.xkey, buffer, len(buffer) - 1, byref(symbol), None)
+ if count:
+ status.value = xlib.XLookupBoth
+
+ if status.value & (xlib.XLookupChars | xlib.XLookupBoth):
+ text = buffer.value[:count].decode(encoding)
+
+ # Don't treat Unicode command codepoints as text, except Return.
+ if text and unicodedata.category(text) == 'Cc' and text != '\r':
+ text = None
+
+ symbol = symbol.value
+
+ # If the event is a XIM filtered event, the keysym will be virtual
+ # (e.g., aacute instead of A after a dead key). Drop it, we don't
+ # want these kind of key events.
+ if ev.xkey.keycode == 0 and not filtered:
+ symbol = None
+
+ # pyglet.self.key keysymbols are identical to X11 keysymbols, no
+ # need to map the keysymbol. For keysyms outside the pyglet set, map
+ # raw key code to a user key.
+ if symbol and symbol not in key._key_names and ev.xkey.keycode:
+ # Issue 353: Symbol is uppercase when shift key held down.
+ try:
+ symbol = ord(chr(symbol).lower())
+ except ValueError:
+ # Not a valid unichr, use the keycode
+ symbol = key.user_key(ev.xkey.keycode)
+ else:
+ # If still not recognised, use the keycode
+ if symbol not in key._key_names:
+ symbol = key.user_key(ev.xkey.keycode)
+
+ if filtered:
+ # The event was filtered, text must be ignored, but the symbol is
+ # still good.
+ return None, symbol
+
+ return text, symbol
+
+ @staticmethod
+ def _event_text_motion(symbol, modifiers):
+ if modifiers & key.MOD_ALT:
+ return None
+ ctrl = modifiers & key.MOD_CTRL != 0
+ return _motion_map.get((symbol, ctrl), None)
+
+ @ViewEventHandler
+ @XlibEventHandler(xlib.KeyPress)
+ @XlibEventHandler(xlib.KeyRelease)
+ def _event_key_view(self, ev):
+ # Try to detect autorepeat ourselves if the server doesn't support it
+ # XXX: Doesn't always work, better off letting the server do it
+ global _can_detect_autorepeat
+ if not _can_detect_autorepeat and ev.type == xlib.KeyRelease:
+ # Look in the queue for a matching KeyPress with same timestamp,
+ # indicating an auto-repeat rather than actual key event.
+ saved = []
+ while True:
+ auto_event = xlib.XEvent()
+ result = xlib.XCheckWindowEvent(self._x_display,
+ self._window, xlib.KeyPress|xlib.KeyRelease,
+ byref(auto_event))
+ if not result:
+ break
+ saved.append(auto_event)
+ if auto_event.type == xlib.KeyRelease:
+ # just save this off for restoration back to the queue
+ continue
+ if ev.xkey.keycode == auto_event.xkey.keycode:
+ # Found a key repeat: dispatch EVENT_TEXT* event
+ text, symbol = self._event_text_symbol(auto_event)
+ modifiers = self._translate_modifiers(ev.xkey.state)
+ modifiers_ctrl = modifiers & (key.MOD_CTRL | key.MOD_ALT)
+ motion = self._event_text_motion(symbol, modifiers)
+ if motion:
+ if modifiers & key.MOD_SHIFT:
+ self.dispatch_event('on_text_motion_select', motion)
+ else:
+ self.dispatch_event('on_text_motion', motion)
+ elif text and not modifiers_ctrl:
+ self.dispatch_event('on_text', text)
+
+ ditched = saved.pop()
+ for auto_event in reversed(saved):
+ xlib.XPutBackEvent(self._x_display, byref(auto_event))
+ return
+ else:
+ # Key code of press did not match, therefore no repeating
+ # is going on, stop searching.
+ break
+ # Whoops, put the events back, it's for real.
+ for auto_event in reversed(saved):
+ xlib.XPutBackEvent(self._x_display, byref(auto_event))
+
+ text, symbol = self._event_text_symbol(ev)
+ modifiers = self._translate_modifiers(ev.xkey.state)
+ modifiers_ctrl = modifiers & (key.MOD_CTRL | key.MOD_ALT)
+ motion = self._event_text_motion(symbol, modifiers)
+
+ if ev.type == xlib.KeyPress:
+ if symbol and (not _can_detect_autorepeat or symbol not in self.pressed_keys):
+ self.dispatch_event('on_key_press', symbol, modifiers)
+ if _can_detect_autorepeat:
+ self.pressed_keys.add(symbol)
+ if motion:
+ if modifiers & key.MOD_SHIFT:
+ self.dispatch_event('on_text_motion_select', motion)
+ else:
+ self.dispatch_event('on_text_motion', motion)
+ elif text and not modifiers_ctrl:
+ self.dispatch_event('on_text', text)
+ elif ev.type == xlib.KeyRelease:
+ if symbol:
+ self.dispatch_event('on_key_release', symbol, modifiers)
+ if _can_detect_autorepeat and symbol in self.pressed_keys:
+ self.pressed_keys.remove(symbol)
+
+ @XlibEventHandler(xlib.KeyPress)
+ @XlibEventHandler(xlib.KeyRelease)
+ def _event_key(self, ev):
+ return self._event_key_view(ev)
+
+ @ViewEventHandler
+ @XlibEventHandler(xlib.MotionNotify)
+ def _event_motionnotify_view(self, ev):
+ x = ev.xmotion.x
+ y = self.height - ev.xmotion.y - 1
+
+ if self._mouse_in_window:
+ dx = x - self._mouse_x
+ dy = y - self._mouse_y
+ else:
+ dx = dy = 0
+
+ if self._applied_mouse_exclusive and (ev.xmotion.x, ev.xmotion.y) == self._mouse_exclusive_client:
+ # Ignore events caused by XWarpPointer
+ self._mouse_x = x
+ self._mouse_y = y
+ return
+
+ if self._applied_mouse_exclusive:
+ # Reset pointer position
+ ex, ey = self._mouse_exclusive_client
+ xlib.XWarpPointer(self._x_display,
+ 0,
+ self._window,
+ 0, 0,
+ 0, 0,
+ ex, ey)
+
+ self._mouse_x = x
+ self._mouse_y = y
+ self._mouse_in_window = True
+
+ buttons = 0
+ if ev.xmotion.state & xlib.Button1MotionMask:
+ buttons |= mouse.LEFT
+ if ev.xmotion.state & xlib.Button2MotionMask:
+ buttons |= mouse.MIDDLE
+ if ev.xmotion.state & xlib.Button3MotionMask:
+ buttons |= mouse.RIGHT
+ # TODO: Determine how to implement drag support for mouse 4 and 5
+
+ if buttons:
+ # Drag event
+ modifiers = self._translate_modifiers(ev.xmotion.state)
+ self.dispatch_event('on_mouse_drag', x, y, dx, dy, buttons, modifiers)
+ else:
+ # Motion event
+ self.dispatch_event('on_mouse_motion', x, y, dx, dy)
+
+ @XlibEventHandler(xlib.MotionNotify)
+ def _event_motionnotify(self, ev):
+ # Window motion looks for drags that are outside the view but within
+ # the window.
+ buttons = 0
+ if ev.xmotion.state & xlib.Button1MotionMask:
+ buttons |= mouse.LEFT
+ if ev.xmotion.state & xlib.Button2MotionMask:
+ buttons |= mouse.MIDDLE
+ if ev.xmotion.state & xlib.Button3MotionMask:
+ buttons |= mouse.RIGHT
+ # TODO: Determine how to implement drag support for mouse 4 and 5
+
+ if buttons:
+ # Drag event
+ x = ev.xmotion.x - self._view_x
+ y = self._height - (ev.xmotion.y - self._view_y - 1)
+
+ if self._mouse_in_window:
+ dx = x - self._mouse_x
+ dy = y - self._mouse_y
+ else:
+ dx = dy = 0
+ self._mouse_x = x
+ self._mouse_y = y
+
+ modifiers = self._translate_modifiers(ev.xmotion.state)
+ self.dispatch_event('on_mouse_drag', x, y, dx, dy, buttons, modifiers)
+
+ @XlibEventHandler(xlib.ClientMessage)
+ def _event_clientmessage(self, ev):
+ atom = ev.xclient.data.l[0]
+ if atom == xlib.XInternAtom(ev.xclient.display, asbytes('WM_DELETE_WINDOW'), False):
+ self.dispatch_event('on_close')
+ elif (self._enable_xsync and
+ atom == xlib.XInternAtom(ev.xclient.display,
+ asbytes('_NET_WM_SYNC_REQUEST'), False)):
+ lo = ev.xclient.data.l[2]
+ hi = ev.xclient.data.l[3]
+ self._current_sync_value = xsync.XSyncValue(hi, lo)
+
+ elif ev.xclient.message_type == self._xdnd_atoms['XdndPosition']:
+ self._event_drag_position(ev)
+
+ elif ev.xclient.message_type == self._xdnd_atoms['XdndDrop']:
+ self._event_drag_drop(ev)
+
+ elif ev.xclient.message_type == self._xdnd_atoms['XdndEnter']:
+ self._event_drag_enter(ev)
+
+ def _event_drag_drop(self, ev):
+ if self._xdnd_version > XDND_VERSION:
+ return
+
+ time = xlib.CurrentTime
+
+ if self._xdnd_format:
+ if self._xdnd_version >= 1:
+ time = ev.xclient.data.l[2]
+
+ # Convert to selection notification.
+ xlib.XConvertSelection(self._x_display,
+ self._xdnd_atoms['XdndSelection'],
+ self._xdnd_format,
+ self._xdnd_atoms['XdndSelection'],
+ self._window,
+ time)
+
+ xlib.XFlush(self._x_display)
+
+ elif self._xdnd_version >= 2:
+ # If no format send finished with no data.
+ e = xlib.XEvent()
+ e.xclient.type = xlib.ClientMessage
+ e.xclient.message_type = self._xdnd_atoms['XdndFinished']
+ e.xclient.display = cast(self._x_display, POINTER(xlib.Display))
+ e.xclient.window = self._window
+ e.xclient.format = 32
+ e.xclient.data.l[0] = self._window
+ e.xclient.data.l[1] = 0
+ e.xclient.data.l[2] = None
+
+ xlib.XSendEvent(self._x_display, self._xdnd_source,
+ False, xlib.NoEventMask, byref(e))
+
+ xlib.XFlush(self._x_display)
+
+ def _event_drag_position(self, ev):
+ if self._xdnd_version > XDND_VERSION:
+ return
+
+ xoff = (ev.xclient.data.l[2] >> 16) & 0xffff
+ yoff = (ev.xclient.data.l[2]) & 0xffff
+
+ # Need to convert the position to actual window coordinates with the screen offset
+ child = xlib.Window()
+ x = c_int()
+ y = c_int()
+ xlib.XTranslateCoordinates(self._x_display,
+ self._get_root(),
+ self._window,
+ xoff, yoff,
+ byref(x),
+ byref(y),
+ byref(child))
+
+ self._xdnd_position = (x.value, y.value)
+
+ e = xlib.XEvent()
+ e.xclient.type = xlib.ClientMessage
+ e.xclient.message_type = self._xdnd_atoms['XdndStatus']
+ e.xclient.display = cast(self._x_display, POINTER(xlib.Display))
+ e.xclient.window = ev.xclient.data.l[0]
+ e.xclient.format = 32
+ e.xclient.data.l[0] = self._window
+ e.xclient.data.l[2] = 0
+ e.xclient.data.l[3] = 0
+
+ if self._xdnd_format:
+ e.xclient.data.l[1] = 1
+ if self._xdnd_version >= 2:
+ e.xclient.data.l[4] = self._xdnd_atoms['XdndActionCopy']
+
+ xlib.XSendEvent(self._x_display, self._xdnd_source,
+ False, xlib.NoEventMask, byref(e))
+
+ xlib.XFlush(self._x_display)
+
+ def _event_drag_enter(self, ev):
+ self._xdnd_source = ev.xclient.data.l[0]
+ self._xdnd_version = ev.xclient.data.l[1] >> 24
+ self._xdnd_format = None
+
+ if self._xdnd_version > XDND_VERSION:
+ return
+
+ three_or_more = ev.xclient.data.l[1] & 1
+
+ # Search all of them (usually 8)
+ if three_or_more:
+ data, count = self.get_single_property(self._xdnd_source, self._xdnd_atoms['XdndTypeList'], XA_ATOM)
+
+ data = cast(data, POINTER(xlib.Atom))
+ else:
+ # Some old versions may only have 3? Needs testing.
+ count = 3
+ data = ev.xclient.data.l + 2
+
+ # Check all of the properties we received from the dropped item and verify it support URI.
+ for i in range(count):
+ if data[i] == self._xdnd_atoms['text/uri-list']:
+ self._xdnd_format = self._xdnd_atoms['text/uri-list']
+ break
+
+ if data:
+ xlib.XFree(data)
+
+ def get_single_property(self, window, atom_property, atom_type):
+ """ Returns the length and data of a window property. """
+ actualAtom = xlib.Atom()
+ actualFormat = c_int()
+ itemCount = c_ulong()
+ bytesAfter = c_ulong()
+ data = POINTER(c_ubyte)()
+
+ xlib.XGetWindowProperty(self._x_display, window,
+ atom_property, 0, 2147483647, False, atom_type,
+ byref(actualAtom),
+ byref(actualFormat),
+ byref(itemCount),
+ byref(bytesAfter),
+ data)
+
+ return data, itemCount.value
+
+ @XlibEventHandler(xlib.SelectionNotify)
+ def _event_selection_notification(self, ev):
+ if ev.xselection.property != 0 and ev.xselection.selection == self._xdnd_atoms['XdndSelection']:
+ if self._xdnd_format:
+ # This will get the data
+ data, count = self.get_single_property(ev.xselection.requestor,
+ ev.xselection.property,
+ ev.xselection.target)
+
+ buffer = create_string_buffer(count)
+ memmove(buffer, data, count)
+
+ formatted_paths = self.parse_filenames(buffer.value.decode())
+
+ e = xlib.XEvent()
+ e.xclient.type = xlib.ClientMessage
+ e.xclient.message_type = self._xdnd_atoms['XdndFinished']
+ e.xclient.display = cast(self._x_display, POINTER(xlib.Display))
+ e.xclient.window = self._window
+ e.xclient.format = 32
+ e.xclient.data.l[0] = self._xdnd_source
+ e.xclient.data.l[1] = 1
+ e.xclient.data.l[2] = self._xdnd_atoms['XdndActionCopy']
+
+ xlib.XSendEvent(self._x_display, self._get_root(),
+ False, xlib.NoEventMask, byref(e))
+
+ xlib.XFlush(self._x_display)
+
+ xlib.XFree(data)
+
+ self.dispatch_event('on_file_drop', self._xdnd_position[0], self._height - self._xdnd_position[1], formatted_paths)
+
+ @staticmethod
+ def parse_filenames(decoded_string):
+ """All of the filenames from file drops come as one big string with
+ some special characters (%20), this will parse them out.
+ """
+ import sys
+
+ different_files = decoded_string.splitlines()
+
+ parsed = []
+ for filename in different_files:
+ if filename:
+ filename = urllib.parse.urlsplit(filename).path
+ encoding = sys.getfilesystemencoding()
+ parsed.append(urllib.parse.unquote(filename, encoding))
+
+ return parsed
+
+ def _sync_resize(self):
+ if self._enable_xsync and self._current_sync_valid:
+ if xsync.XSyncValueIsZero(self._current_sync_value):
+ self._current_sync_valid = False
+ return
+ xsync.XSyncSetCounter(self._x_display,
+ self._sync_counter,
+ self._current_sync_value)
+ self._current_sync_value = None
+ self._current_sync_valid = False
+
+ @ViewEventHandler
+ @XlibEventHandler(xlib.ButtonPress)
+ @XlibEventHandler(xlib.ButtonRelease)
+ def _event_button(self, ev):
+ x = ev.xbutton.x
+ y = self.height - ev.xbutton.y
+
+ button = ev.xbutton.button - 1
+ if button == 7 or button == 8:
+ button -= 4
+
+ modifiers = self._translate_modifiers(ev.xbutton.state)
+ if ev.type == xlib.ButtonPress:
+ # override_redirect issue: manually activate this window if
+ # fullscreen.
+ if self._override_redirect and not self._active:
+ self.activate()
+
+ if ev.xbutton.button == 4:
+ self.dispatch_event('on_mouse_scroll', x, y, 0, 1)
+ elif ev.xbutton.button == 5:
+ self.dispatch_event('on_mouse_scroll', x, y, 0, -1)
+ elif ev.xbutton.button == 6:
+ self.dispatch_event('on_mouse_scroll', x, y, -1, 0)
+ elif ev.xbutton.button == 7:
+ self.dispatch_event('on_mouse_scroll', x, y, 1, 0)
+ elif button < 5:
+ self.dispatch_event('on_mouse_press', x, y, 1 << button, modifiers)
+ elif button < 5:
+ self.dispatch_event('on_mouse_release', x, y, 1 << button, modifiers)
+
+ @ViewEventHandler
+ @XlibEventHandler(xlib.Expose)
+ def _event_expose(self, ev):
+ # Ignore all expose events except the last one. We could be told
+ # about exposure rects - but I don't see the point since we're
+ # working with OpenGL and we'll just redraw the whole scene.
+ if ev.xexpose.count > 0:
+ return
+ self.dispatch_event('on_expose')
+
+ @ViewEventHandler
+ @XlibEventHandler(xlib.EnterNotify)
+ def _event_enternotify(self, ev):
+ # mouse position
+ x = self._mouse_x = ev.xcrossing.x
+ y = self._mouse_y = self.height - ev.xcrossing.y
+ self._mouse_in_window = True
+
+ # XXX there may be more we could do here
+ self.dispatch_event('on_mouse_enter', x, y)
+
+ @ViewEventHandler
+ @XlibEventHandler(xlib.LeaveNotify)
+ def _event_leavenotify(self, ev):
+ x = self._mouse_x = ev.xcrossing.x
+ y = self._mouse_y = self.height - ev.xcrossing.y
+ self._mouse_in_window = False
+ self.dispatch_event('on_mouse_leave', x, y)
+
+ @XlibEventHandler(xlib.ConfigureNotify)
+ def _event_configurenotify(self, ev):
+ if self._enable_xsync and self._current_sync_value:
+ self._current_sync_valid = True
+
+ if self._fullscreen:
+ return
+
+ self.switch_to()
+
+ w, h = ev.xconfigure.width, ev.xconfigure.height
+ x, y = ev.xconfigure.x, ev.xconfigure.y
+ if self._width != w or self._height != h:
+ self._width = w
+ self._height = h
+ self._update_view_size()
+ self.dispatch_event('on_resize', self._width, self._height)
+ if self._x != x or self._y != y:
+ self.dispatch_event('on_move', x, y)
+ self._x = x
+ self._y = y
+
+ @XlibEventHandler(xlib.FocusIn)
+ def _event_focusin(self, ev):
+ self._active = True
+ self._update_exclusivity()
+ self.dispatch_event('on_activate')
+ xlib.XSetICFocus(self._x_ic)
+
+ @XlibEventHandler(xlib.FocusOut)
+ def _event_focusout(self, ev):
+ self._active = False
+ self._update_exclusivity()
+ self.dispatch_event('on_deactivate')
+ xlib.XUnsetICFocus(self._x_ic)
+
+ @XlibEventHandler(xlib.MapNotify)
+ def _event_mapnotify(self, ev):
+ self._mapped = True
+ self.dispatch_event('on_show')
+ self._update_exclusivity()
+
+ @XlibEventHandler(xlib.UnmapNotify)
+ def _event_unmapnotify(self, ev):
+ self._mapped = False
+ self.dispatch_event('on_hide')
+
+
+__all__ = ["XlibEventHandler", "XlibWindow"]
diff --git a/generate_human_motion/pyrender/.flake8 b/generate_human_motion/pyrender/.flake8
new file mode 100644
index 0000000000000000000000000000000000000000..fec4bcfc3ba774b53a866d839ea15bae6ebdb4a6
--- /dev/null
+++ b/generate_human_motion/pyrender/.flake8
@@ -0,0 +1,8 @@
+[flake8]
+ignore = E231,W504,F405,F403
+max-line-length = 79
+select = B,C,E,F,W,T4,B9
+exclude =
+ docs/source/conf.py,
+ __pycache__,
+ examples/*
diff --git a/generate_human_motion/pyrender/.gitignore b/generate_human_motion/pyrender/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..ae59dec631f71a23d4255aaf9c0274a699f4ba25
--- /dev/null
+++ b/generate_human_motion/pyrender/.gitignore
@@ -0,0 +1,106 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+docs/**/generated/**
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+.hypothesis/
+.pytest_cache/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# pyenv
+.python-version
+
+# celery beat schedule file
+celerybeat-schedule
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
diff --git a/generate_human_motion/pyrender/.pre-commit-config.yaml b/generate_human_motion/pyrender/.pre-commit-config.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..1817eb39bf409aff80c7d2cc79a3bc3856c70dbd
--- /dev/null
+++ b/generate_human_motion/pyrender/.pre-commit-config.yaml
@@ -0,0 +1,6 @@
+repos:
+- repo: https://gitlab.com/pycqa/flake8
+ rev: 3.7.1
+ hooks:
+ - id: flake8
+ exclude: ^setup.py
diff --git a/generate_human_motion/pyrender/.travis.yml b/generate_human_motion/pyrender/.travis.yml
new file mode 100644
index 0000000000000000000000000000000000000000..1ad289ae1513eaf8fda74f8d5ab7840be3ef56cb
--- /dev/null
+++ b/generate_human_motion/pyrender/.travis.yml
@@ -0,0 +1,43 @@
+language: python
+sudo: required
+dist: xenial
+
+python:
+- '3.6'
+- '3.7'
+
+before_install:
+ # Pre-install osmesa
+ - sudo apt update
+ - sudo wget https://github.com/mmatl/travis_debs/raw/master/xenial/mesa_18.3.3-0.deb
+ - sudo dpkg -i ./mesa_18.3.3-0.deb || true
+ - sudo apt install -f
+ - git clone https://github.com/mmatl/pyopengl.git
+ - cd pyopengl
+ - pip install .
+ - cd ..
+
+install:
+ - pip install .
+ # - pip install -q pytest pytest-cov coveralls
+ - pip install pytest pytest-cov coveralls
+ - pip install ./pyopengl
+
+script:
+ - PYOPENGL_PLATFORM=osmesa pytest --cov=pyrender tests
+
+after_success:
+- coveralls || true
+
+deploy:
+ provider: pypi
+ skip_existing: true
+ user: mmatl
+ on:
+ tags: true
+ branch: master
+ password:
+ secure: O4WWMbTYb2eVYIO4mMOVa6/xyhX7mPvJpd96cxfNvJdyuqho8VapOhzqsI5kahMB1hFjWWr61yR4+Ru5hoDYf3XA6BQVk8eCY9+0H7qRfvoxex71lahKAqfHLMoE1xNdiVTgl+QN9hYjOnopLod24rx8I8eXfpHu/mfCpuTYGyLlNcDP5St3bXpXLPB5wg8Jo1YRRv6W/7fKoXyuWjewk9cJAS0KrEgnDnSkdwm6Pb+80B2tcbgdGvpGaByw5frndwKiMUMgVUownepDU5POQq2p29wwn9lCvRucULxjEgO+63jdbZRj5fNutLarFa2nISfYnrd72LOyDfbJubwAzzAIsy2JbFORyeHvCgloiuE9oE7a9oOQt/1QHBoIV0seiawMWn55Yp70wQ7HlJs4xSGJWCGa5+9883QRNsvj420atkb3cgO8P+PXwiwTi78Dq7Z/xHqccsU0b8poqBneQoA+pUGgNnF6V7Z8e9RsCcse2gAWSZWuOK3ua+9xCgH7I7MeL3afykr2aJ+yFCoYJMFrUjJeodMX2RbL0q+3FzIPZeGW3WdhTEAL9TSKRcJBSQTskaQlZx/OcpobxS7t3d2S68CCLG9uMTqOTYws55WZ1etalA75sRk9K2MR7ZGjZW3jdtvMViISc/t6Rrjea1GE8ZHGJC6/IeLIWA2c7nc=
+ distributions: sdist bdist_wheel
+notifications:
+ email: false
diff --git a/generate_human_motion/pyrender/LICENSE b/generate_human_motion/pyrender/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4276f7d204e4d85104246df637e0e36adbef14a7
--- /dev/null
+++ b/generate_human_motion/pyrender/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 Matthew Matl
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/generate_human_motion/pyrender/MANIFEST.in b/generate_human_motion/pyrender/MANIFEST.in
new file mode 100644
index 0000000000000000000000000000000000000000..097bcca3b4fccdc39ddd63c10f710ad524898e95
--- /dev/null
+++ b/generate_human_motion/pyrender/MANIFEST.in
@@ -0,0 +1,5 @@
+# Include the license
+include LICENSE
+include README.rst
+include pyrender/fonts/*
+include pyrender/shaders/*
diff --git a/generate_human_motion/pyrender/README.md b/generate_human_motion/pyrender/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..ae88ed1c5e78f247e38291ed83cf4c81230bf976
--- /dev/null
+++ b/generate_human_motion/pyrender/README.md
@@ -0,0 +1,92 @@
+# Pyrender
+
+[](https://travis-ci.org/mmatl/pyrender)
+[](https://pyrender.readthedocs.io/en/latest/?badge=latest)
+[](https://coveralls.io/github/mmatl/pyrender?branch=master)
+[](https://badge.fury.io/py/pyrender)
+[](https://pepy.tech/project/pyrender)
+
+Pyrender is a pure Python (2.7, 3.4, 3.5, 3.6) library for physically-based
+rendering and visualization.
+It is designed to meet the [glTF 2.0 specification from Khronos](https://www.khronos.org/gltf/).
+
+Pyrender is lightweight, easy to install, and simple to use.
+It comes packaged with both an intuitive scene viewer and a headache-free
+offscreen renderer with support for GPU-accelerated rendering on headless
+servers, which makes it perfect for machine learning applications.
+
+Extensive documentation, including a quickstart guide, is provided [here](https://pyrender.readthedocs.io/en/latest/).
+
+For a minimal working example of GPU-accelerated offscreen rendering using EGL,
+check out the [EGL Google CoLab Notebook](https://colab.research.google.com/drive/1pcndwqeY8vker3bLKQNJKr3B-7-SYenE?usp=sharing).
+
+
+
+
+
+
+
+## Installation
+You can install pyrender directly from pip.
+
+```bash
+pip install pyrender
+```
+
+## Features
+
+Despite being lightweight, pyrender has lots of features, including:
+
+* Simple interoperation with the amazing [trimesh](https://github.com/mikedh/trimesh) project,
+which enables out-of-the-box support for dozens of mesh types, including OBJ,
+STL, DAE, OFF, PLY, and GLB.
+* An easy-to-use scene viewer with support for animation, showing face and vertex
+normals, toggling lighting conditions, and saving images and GIFs.
+* An offscreen rendering module that supports OSMesa and EGL backends.
+* Shadow mapping for directional and spot lights.
+* Metallic-roughness materials for physically-based rendering, including several
+types of texture and normal mapping.
+* Transparency.
+* Depth and color image generation.
+
+## Sample Usage
+
+For sample usage, check out the [quickstart
+guide](https://pyrender.readthedocs.io/en/latest/examples/index.html) or one of
+the Google CoLab Notebooks:
+
+* [EGL Google CoLab Notebook](https://colab.research.google.com/drive/1pcndwqeY8vker3bLKQNJKr3B-7-SYenE?usp=sharing)
+
+## Viewer Keyboard and Mouse Controls
+
+When using the viewer, the basic controls for moving about the scene are as follows:
+
+* To rotate the camera about the center of the scene, hold the left mouse button and drag the cursor.
+* To rotate the camera about its viewing axis, hold `CTRL` left mouse button and drag the cursor.
+* To pan the camera, do one of the following:
+ * Hold `SHIFT`, then hold the left mouse button and drag the cursor.
+ * Hold the middle mouse button and drag the cursor.
+* To zoom the camera in or out, do one of the following:
+ * Scroll the mouse wheel.
+ * Hold the right mouse button and drag the cursor.
+
+The available keyboard commands are as follows:
+
+* `a`: Toggles rotational animation mode.
+* `c`: Toggles backface culling.
+* `f`: Toggles fullscreen mode.
+* `h`: Toggles shadow rendering.
+* `i`: Toggles axis display mode (no axes, world axis, mesh axes, all axes).
+* `l`: Toggles lighting mode (scene lighting, Raymond lighting, or direct lighting).
+* `m`: Toggles face normal visualization.
+* `n`: Toggles vertex normal visualization.
+* `o`: Toggles orthographic camera mode.
+* `q`: Quits the viewer.
+* `r`: Starts recording a GIF, and pressing again stops recording and opens a file dialog.
+* `s`: Opens a file dialog to save the current view as an image.
+* `w`: Toggles wireframe mode (scene default, flip wireframes, all wireframe, or all solid).
+* `z`: Resets the camera to the default view.
+
+As a note, displaying shadows significantly slows down rendering, so if you're
+experiencing low framerates, just kill shadows or reduce the number of lights in
+your scene.
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/__init__.py b/generate_human_motion/pyrender/build/lib/pyrender/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..ee3709846823b7c4b71b22da0e24d63d805528a8
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/__init__.py
@@ -0,0 +1,24 @@
+from .camera import (Camera, PerspectiveCamera, OrthographicCamera,
+ IntrinsicsCamera)
+from .light import Light, PointLight, DirectionalLight, SpotLight
+from .sampler import Sampler
+from .texture import Texture
+from .material import Material, MetallicRoughnessMaterial
+from .primitive import Primitive
+from .mesh import Mesh
+from .node import Node
+from .scene import Scene
+from .renderer import Renderer
+from .viewer import Viewer
+from .offscreen import OffscreenRenderer
+from .version import __version__
+from .constants import RenderFlags, TextAlign, GLTF
+
+__all__ = [
+ 'Camera', 'PerspectiveCamera', 'OrthographicCamera', 'IntrinsicsCamera',
+ 'Light', 'PointLight', 'DirectionalLight', 'SpotLight',
+ 'Sampler', 'Texture', 'Material', 'MetallicRoughnessMaterial',
+ 'Primitive', 'Mesh', 'Node', 'Scene', 'Renderer', 'Viewer',
+ 'OffscreenRenderer', '__version__', 'RenderFlags', 'TextAlign',
+ 'GLTF'
+]
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/camera.py b/generate_human_motion/pyrender/build/lib/pyrender/camera.py
new file mode 100644
index 0000000000000000000000000000000000000000..e019358039033c3a372c990ebad3151258c3651d
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/camera.py
@@ -0,0 +1,437 @@
+"""Virtual cameras compliant with the glTF 2.0 specification as described at
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-camera
+
+Author: Matthew Matl
+"""
+import abc
+import numpy as np
+import six
+import sys
+
+from .constants import DEFAULT_Z_NEAR, DEFAULT_Z_FAR
+
+
+@six.add_metaclass(abc.ABCMeta)
+class Camera(object):
+ """Abstract base class for all cameras.
+
+ Note
+ ----
+ Camera poses are specified in the OpenGL format,
+ where the z axis points away from the view direction and the
+ x and y axes point to the right and up in the image plane, respectively.
+
+ Parameters
+ ----------
+ znear : float
+ The floating-point distance to the near clipping plane.
+ zfar : float
+ The floating-point distance to the far clipping plane.
+ ``zfar`` must be greater than ``znear``.
+ name : str, optional
+ The user-defined name of this object.
+ """
+
+ def __init__(self,
+ znear=DEFAULT_Z_NEAR,
+ zfar=DEFAULT_Z_FAR,
+ name=None):
+ self.name = name
+ self.znear = znear
+ self.zfar = zfar
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def znear(self):
+ """float : The distance to the near clipping plane.
+ """
+ return self._znear
+
+ @znear.setter
+ def znear(self, value):
+ value = float(value)
+ if value < 0:
+ raise ValueError('z-near must be >= 0.0')
+ self._znear = value
+
+ @property
+ def zfar(self):
+ """float : The distance to the far clipping plane.
+ """
+ return self._zfar
+
+ @zfar.setter
+ def zfar(self, value):
+ value = float(value)
+ if value <= 0 or value <= self.znear:
+ raise ValueError('zfar must be >0 and >znear')
+ self._zfar = value
+
+ @abc.abstractmethod
+ def get_projection_matrix(self, width=None, height=None):
+ """Return the OpenGL projection matrix for this camera.
+
+ Parameters
+ ----------
+ width : int
+ Width of the current viewport, in pixels.
+ height : int
+ Height of the current viewport, in pixels.
+ """
+ pass
+
+
+class PerspectiveCamera(Camera):
+
+ """A perspective camera for perspective projection.
+
+ Parameters
+ ----------
+ yfov : float
+ The floating-point vertical field of view in radians.
+ znear : float
+ The floating-point distance to the near clipping plane.
+ If not specified, defaults to 0.05.
+ zfar : float, optional
+ The floating-point distance to the far clipping plane.
+ ``zfar`` must be greater than ``znear``.
+ If None, the camera uses an infinite projection matrix.
+ aspectRatio : float, optional
+ The floating-point aspect ratio of the field of view.
+ If not specified, the camera uses the viewport's aspect ratio.
+ name : str, optional
+ The user-defined name of this object.
+ """
+
+ def __init__(self,
+ yfov,
+ znear=DEFAULT_Z_NEAR,
+ zfar=None,
+ aspectRatio=None,
+ name=None):
+ super(PerspectiveCamera, self).__init__(
+ znear=znear,
+ zfar=zfar,
+ name=name,
+ )
+
+ self.yfov = yfov
+ self.aspectRatio = aspectRatio
+
+ @property
+ def yfov(self):
+ """float : The vertical field of view in radians.
+ """
+ return self._yfov
+
+ @yfov.setter
+ def yfov(self, value):
+ value = float(value)
+ if value <= 0.0:
+ raise ValueError('Field of view must be positive')
+ self._yfov = value
+
+ @property
+ def zfar(self):
+ """float : The distance to the far clipping plane.
+ """
+ return self._zfar
+
+ @zfar.setter
+ def zfar(self, value):
+ if value is not None:
+ value = float(value)
+ if value <= 0 or value <= self.znear:
+ raise ValueError('zfar must be >0 and >znear')
+ self._zfar = value
+
+ @property
+ def aspectRatio(self):
+ """float : The ratio of the width to the height of the field of view.
+ """
+ return self._aspectRatio
+
+ @aspectRatio.setter
+ def aspectRatio(self, value):
+ if value is not None:
+ value = float(value)
+ if value <= 0.0:
+ raise ValueError('Aspect ratio must be positive')
+ self._aspectRatio = value
+
+ def get_projection_matrix(self, width=None, height=None):
+ """Return the OpenGL projection matrix for this camera.
+
+ Parameters
+ ----------
+ width : int
+ Width of the current viewport, in pixels.
+ height : int
+ Height of the current viewport, in pixels.
+ """
+ aspect_ratio = self.aspectRatio
+ if aspect_ratio is None:
+ if width is None or height is None:
+ raise ValueError('Aspect ratio of camera must be defined')
+ aspect_ratio = float(width) / float(height)
+
+ a = aspect_ratio
+ t = np.tan(self.yfov / 2.0)
+ n = self.znear
+ f = self.zfar
+
+ P = np.zeros((4,4))
+ P[0][0] = 1.0 / (a * t)
+ P[1][1] = 1.0 / t
+ P[3][2] = -1.0
+
+ if f is None:
+ P[2][2] = -1.0
+ P[2][3] = -2.0 * n
+ else:
+ P[2][2] = (f + n) / (n - f)
+ P[2][3] = (2 * f * n) / (n - f)
+
+ return P
+
+
+class OrthographicCamera(Camera):
+ """An orthographic camera for orthographic projection.
+
+ Parameters
+ ----------
+ xmag : float
+ The floating-point horizontal magnification of the view.
+ ymag : float
+ The floating-point vertical magnification of the view.
+ znear : float
+ The floating-point distance to the near clipping plane.
+ If not specified, defaults to 0.05.
+ zfar : float
+ The floating-point distance to the far clipping plane.
+ ``zfar`` must be greater than ``znear``.
+ If not specified, defaults to 100.0.
+ name : str, optional
+ The user-defined name of this object.
+ """
+
+ def __init__(self,
+ xmag,
+ ymag,
+ znear=DEFAULT_Z_NEAR,
+ zfar=DEFAULT_Z_FAR,
+ name=None):
+ super(OrthographicCamera, self).__init__(
+ znear=znear,
+ zfar=zfar,
+ name=name,
+ )
+
+ self.xmag = xmag
+ self.ymag = ymag
+
+ @property
+ def xmag(self):
+ """float : The horizontal magnification of the view.
+ """
+ return self._xmag
+
+ @xmag.setter
+ def xmag(self, value):
+ value = float(value)
+ if value <= 0.0:
+ raise ValueError('X magnification must be positive')
+ self._xmag = value
+
+ @property
+ def ymag(self):
+ """float : The vertical magnification of the view.
+ """
+ return self._ymag
+
+ @ymag.setter
+ def ymag(self, value):
+ value = float(value)
+ if value <= 0.0:
+ raise ValueError('Y magnification must be positive')
+ self._ymag = value
+
+ @property
+ def znear(self):
+ """float : The distance to the near clipping plane.
+ """
+ return self._znear
+
+ @znear.setter
+ def znear(self, value):
+ value = float(value)
+ if value <= 0:
+ raise ValueError('z-near must be > 0.0')
+ self._znear = value
+
+ def get_projection_matrix(self, width=None, height=None):
+ """Return the OpenGL projection matrix for this camera.
+
+ Parameters
+ ----------
+ width : int
+ Width of the current viewport, in pixels.
+ Unused in this function.
+ height : int
+ Height of the current viewport, in pixels.
+ Unused in this function.
+ """
+ xmag = self.xmag
+ ymag = self.ymag
+
+ # If screen width/height defined, rescale xmag
+ if width is not None and height is not None:
+ xmag = width / height * ymag
+
+ n = self.znear
+ f = self.zfar
+ P = np.zeros((4,4))
+ P[0][0] = 1.0 / xmag
+ P[1][1] = 1.0 / ymag
+ P[2][2] = 2.0 / (n - f)
+ P[2][3] = (f + n) / (n - f)
+ P[3][3] = 1.0
+ return P
+
+
+class IntrinsicsCamera(Camera):
+ """A perspective camera with custom intrinsics.
+
+ Parameters
+ ----------
+ fx : float
+ X-axis focal length in pixels.
+ fy : float
+ Y-axis focal length in pixels.
+ cx : float
+ X-axis optical center in pixels.
+ cy : float
+ Y-axis optical center in pixels.
+ znear : float
+ The floating-point distance to the near clipping plane.
+ If not specified, defaults to 0.05.
+ zfar : float
+ The floating-point distance to the far clipping plane.
+ ``zfar`` must be greater than ``znear``.
+ If not specified, defaults to 100.0.
+ name : str, optional
+ The user-defined name of this object.
+ """
+
+ def __init__(self,
+ fx,
+ fy,
+ cx,
+ cy,
+ znear=DEFAULT_Z_NEAR,
+ zfar=DEFAULT_Z_FAR,
+ name=None):
+ super(IntrinsicsCamera, self).__init__(
+ znear=znear,
+ zfar=zfar,
+ name=name,
+ )
+
+ self.fx = fx
+ self.fy = fy
+ self.cx = cx
+ self.cy = cy
+
+ @property
+ def fx(self):
+ """float : X-axis focal length in meters.
+ """
+ return self._fx
+
+ @fx.setter
+ def fx(self, value):
+ self._fx = float(value)
+
+ @property
+ def fy(self):
+ """float : Y-axis focal length in meters.
+ """
+ return self._fy
+
+ @fy.setter
+ def fy(self, value):
+ self._fy = float(value)
+
+ @property
+ def cx(self):
+ """float : X-axis optical center in pixels.
+ """
+ return self._cx
+
+ @cx.setter
+ def cx(self, value):
+ self._cx = float(value)
+
+ @property
+ def cy(self):
+ """float : Y-axis optical center in pixels.
+ """
+ return self._cy
+
+ @cy.setter
+ def cy(self, value):
+ self._cy = float(value)
+
+ def get_projection_matrix(self, width, height):
+ """Return the OpenGL projection matrix for this camera.
+
+ Parameters
+ ----------
+ width : int
+ Width of the current viewport, in pixels.
+ height : int
+ Height of the current viewport, in pixels.
+ """
+ width = float(width)
+ height = float(height)
+
+ cx, cy = self.cx, self.cy
+ fx, fy = self.fx, self.fy
+ if sys.platform == 'darwin':
+ cx = self.cx * 2.0
+ cy = self.cy * 2.0
+ fx = self.fx * 2.0
+ fy = self.fy * 2.0
+
+ P = np.zeros((4,4))
+ P[0][0] = 2.0 * fx / width
+ P[1][1] = 2.0 * fy / height
+ P[0][2] = 1.0 - 2.0 * cx / width
+ P[1][2] = 2.0 * cy / height - 1.0
+ P[3][2] = -1.0
+
+ n = self.znear
+ f = self.zfar
+ if f is None:
+ P[2][2] = -1.0
+ P[2][3] = -2.0 * n
+ else:
+ P[2][2] = (f + n) / (n - f)
+ P[2][3] = (2 * f * n) / (n - f)
+
+ return P
+
+
+__all__ = ['Camera', 'PerspectiveCamera', 'OrthographicCamera',
+ 'IntrinsicsCamera']
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/constants.py b/generate_human_motion/pyrender/build/lib/pyrender/constants.py
new file mode 100644
index 0000000000000000000000000000000000000000..8a5785b6fdb21910a174252c5af2f05b40ece4a5
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/constants.py
@@ -0,0 +1,149 @@
+DEFAULT_Z_NEAR = 0.05 # Near clipping plane, in meters
+DEFAULT_Z_FAR = 100.0 # Far clipping plane, in meters
+DEFAULT_SCENE_SCALE = 2.0 # Default scene scale
+MAX_N_LIGHTS = 4 # Maximum number of lights of each type allowed
+TARGET_OPEN_GL_MAJOR = 4 # Target OpenGL Major Version
+TARGET_OPEN_GL_MINOR = 1 # Target OpenGL Minor Version
+MIN_OPEN_GL_MAJOR = 3 # Minimum OpenGL Major Version
+MIN_OPEN_GL_MINOR = 3 # Minimum OpenGL Minor Version
+FLOAT_SZ = 4 # Byte size of GL float32
+UINT_SZ = 4 # Byte size of GL uint32
+SHADOW_TEX_SZ = 2048 # Width and Height of Shadow Textures
+TEXT_PADDING = 20 # Width of padding for rendering text (px)
+
+
+# Flags for render type
+class RenderFlags(object):
+ """Flags for rendering in the scene.
+
+ Combine them with the bitwise or. For example,
+
+ >>> flags = OFFSCREEN | SHADOWS_DIRECTIONAL | VERTEX_NORMALS
+
+ would result in an offscreen render with directional shadows and
+ vertex normals enabled.
+ """
+ NONE = 0
+ """Normal PBR Render."""
+ DEPTH_ONLY = 1
+ """Only render the depth buffer."""
+ OFFSCREEN = 2
+ """Render offscreen and return the depth and (optionally) color buffers."""
+ FLIP_WIREFRAME = 4
+ """Invert the status of wireframe rendering for each mesh."""
+ ALL_WIREFRAME = 8
+ """Render all meshes as wireframes."""
+ ALL_SOLID = 16
+ """Render all meshes as solids."""
+ SHADOWS_DIRECTIONAL = 32
+ """Render shadows for directional lights."""
+ SHADOWS_POINT = 64
+ """Render shadows for point lights."""
+ SHADOWS_SPOT = 128
+ """Render shadows for spot lights."""
+ SHADOWS_ALL = 32 | 64 | 128
+ """Render shadows for all lights."""
+ VERTEX_NORMALS = 256
+ """Render vertex normals."""
+ FACE_NORMALS = 512
+ """Render face normals."""
+ SKIP_CULL_FACES = 1024
+ """Do not cull back faces."""
+ RGBA = 2048
+ """Render the color buffer with the alpha channel enabled."""
+ FLAT = 4096
+ """Render the color buffer flat, with no lighting computations."""
+ SEG = 8192
+
+
+class TextAlign:
+ """Text alignment options for captions.
+
+ Only use one at a time.
+ """
+ CENTER = 0
+ """Center the text by width and height."""
+ CENTER_LEFT = 1
+ """Center the text by height and left-align it."""
+ CENTER_RIGHT = 2
+ """Center the text by height and right-align it."""
+ BOTTOM_LEFT = 3
+ """Put the text in the bottom-left corner."""
+ BOTTOM_RIGHT = 4
+ """Put the text in the bottom-right corner."""
+ BOTTOM_CENTER = 5
+ """Center the text by width and fix it to the bottom."""
+ TOP_LEFT = 6
+ """Put the text in the top-left corner."""
+ TOP_RIGHT = 7
+ """Put the text in the top-right corner."""
+ TOP_CENTER = 8
+ """Center the text by width and fix it to the top."""
+
+
+class GLTF(object):
+ """Options for GL objects."""
+ NEAREST = 9728
+ """Nearest neighbor interpolation."""
+ LINEAR = 9729
+ """Linear interpolation."""
+ NEAREST_MIPMAP_NEAREST = 9984
+ """Nearest mipmapping."""
+ LINEAR_MIPMAP_NEAREST = 9985
+ """Linear mipmapping."""
+ NEAREST_MIPMAP_LINEAR = 9986
+ """Nearest mipmapping."""
+ LINEAR_MIPMAP_LINEAR = 9987
+ """Linear mipmapping."""
+ CLAMP_TO_EDGE = 33071
+ """Clamp to the edge of the texture."""
+ MIRRORED_REPEAT = 33648
+ """Mirror the texture."""
+ REPEAT = 10497
+ """Repeat the texture."""
+ POINTS = 0
+ """Render as points."""
+ LINES = 1
+ """Render as lines."""
+ LINE_LOOP = 2
+ """Render as a line loop."""
+ LINE_STRIP = 3
+ """Render as a line strip."""
+ TRIANGLES = 4
+ """Render as triangles."""
+ TRIANGLE_STRIP = 5
+ """Render as a triangle strip."""
+ TRIANGLE_FAN = 6
+ """Render as a triangle fan."""
+
+
+class BufFlags(object):
+ POSITION = 0
+ NORMAL = 1
+ TANGENT = 2
+ TEXCOORD_0 = 4
+ TEXCOORD_1 = 8
+ COLOR_0 = 16
+ JOINTS_0 = 32
+ WEIGHTS_0 = 64
+
+
+class TexFlags(object):
+ NONE = 0
+ NORMAL = 1
+ OCCLUSION = 2
+ EMISSIVE = 4
+ BASE_COLOR = 8
+ METALLIC_ROUGHNESS = 16
+ DIFFUSE = 32
+ SPECULAR_GLOSSINESS = 64
+
+
+class ProgramFlags:
+ NONE = 0
+ USE_MATERIAL = 1
+ VERTEX_NORMALS = 2
+ FACE_NORMALS = 4
+
+
+__all__ = ['RenderFlags', 'TextAlign', 'GLTF']
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/font.py b/generate_human_motion/pyrender/build/lib/pyrender/font.py
new file mode 100644
index 0000000000000000000000000000000000000000..5ac530d7b949f50314a0d9cf5d744bedcace0571
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/font.py
@@ -0,0 +1,272 @@
+"""Font texture loader and processor.
+
+Author: Matthew Matl
+"""
+import freetype
+import numpy as np
+import os
+
+import OpenGL
+from OpenGL.GL import *
+
+from .constants import TextAlign, FLOAT_SZ
+from .texture import Texture
+from .sampler import Sampler
+
+
+class FontCache(object):
+ """A cache for fonts.
+ """
+
+ def __init__(self, font_dir=None):
+ self._font_cache = {}
+ self.font_dir = font_dir
+ if self.font_dir is None:
+ base_dir, _ = os.path.split(os.path.realpath(__file__))
+ self.font_dir = os.path.join(base_dir, 'fonts')
+
+ def get_font(self, font_name, font_pt):
+ # If it's a file, load it directly, else, try to load from font dir.
+ if os.path.isfile(font_name):
+ font_filename = font_name
+ _, font_name = os.path.split(font_name)
+ font_name, _ = os.path.split(font_name)
+ else:
+ font_filename = os.path.join(self.font_dir, font_name) + '.ttf'
+
+ cid = OpenGL.contextdata.getContext()
+ key = (cid, font_name, int(font_pt))
+
+ if key not in self._font_cache:
+ self._font_cache[key] = Font(font_filename, font_pt)
+ return self._font_cache[key]
+
+ def clear(self):
+ for key in self._font_cache:
+ self._font_cache[key].delete()
+ self._font_cache = {}
+
+
+class Character(object):
+ """A single character, with its texture and attributes.
+ """
+
+ def __init__(self, texture, size, bearing, advance):
+ self.texture = texture
+ self.size = size
+ self.bearing = bearing
+ self.advance = advance
+
+
+class Font(object):
+ """A font object.
+
+ Parameters
+ ----------
+ font_file : str
+ The file to load the font from.
+ font_pt : int
+ The height of the font in pixels.
+ """
+
+ def __init__(self, font_file, font_pt=40):
+ self.font_file = font_file
+ self.font_pt = int(font_pt)
+ self._face = freetype.Face(font_file)
+ self._face.set_pixel_sizes(0, font_pt)
+ self._character_map = {}
+
+ for i in range(0, 128):
+
+ # Generate texture
+ face = self._face
+ face.load_char(chr(i))
+ buf = face.glyph.bitmap.buffer
+ src = (np.array(buf) / 255.0).astype(np.float32)
+ src = src.reshape((face.glyph.bitmap.rows,
+ face.glyph.bitmap.width))
+ tex = Texture(
+ sampler=Sampler(
+ magFilter=GL_LINEAR,
+ minFilter=GL_LINEAR,
+ wrapS=GL_CLAMP_TO_EDGE,
+ wrapT=GL_CLAMP_TO_EDGE
+ ),
+ source=src,
+ source_channels='R',
+ )
+ character = Character(
+ texture=tex,
+ size=np.array([face.glyph.bitmap.width,
+ face.glyph.bitmap.rows]),
+ bearing=np.array([face.glyph.bitmap_left,
+ face.glyph.bitmap_top]),
+ advance=face.glyph.advance.x
+ )
+ self._character_map[chr(i)] = character
+
+ self._vbo = None
+ self._vao = None
+
+ @property
+ def font_file(self):
+ """str : The file the font was loaded from.
+ """
+ return self._font_file
+
+ @font_file.setter
+ def font_file(self, value):
+ self._font_file = value
+
+ @property
+ def font_pt(self):
+ """int : The height of the font in pixels.
+ """
+ return self._font_pt
+
+ @font_pt.setter
+ def font_pt(self, value):
+ self._font_pt = int(value)
+
+ def _add_to_context(self):
+
+ self._vao = glGenVertexArrays(1)
+ glBindVertexArray(self._vao)
+ self._vbo = glGenBuffers(1)
+ glBindBuffer(GL_ARRAY_BUFFER, self._vbo)
+ glBufferData(GL_ARRAY_BUFFER, FLOAT_SZ * 6 * 4, None, GL_DYNAMIC_DRAW)
+ glEnableVertexAttribArray(0)
+ glVertexAttribPointer(
+ 0, 4, GL_FLOAT, GL_FALSE, 4 * FLOAT_SZ, ctypes.c_void_p(0)
+ )
+ glBindVertexArray(0)
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
+ for c in self._character_map:
+ ch = self._character_map[c]
+ if not ch.texture._in_context():
+ ch.texture._add_to_context()
+
+ def _remove_from_context(self):
+ for c in self._character_map:
+ ch = self._character_map[c]
+ ch.texture.delete()
+ if self._vao is not None:
+ glDeleteVertexArrays(1, [self._vao])
+ glDeleteBuffers(1, [self._vbo])
+ self._vao = None
+ self._vbo = None
+
+ def _in_context(self):
+ return self._vao is not None
+
+ def _bind(self):
+ glBindVertexArray(self._vao)
+
+ def _unbind(self):
+ glBindVertexArray(0)
+
+ def delete(self):
+ self._unbind()
+ self._remove_from_context()
+
+ def render_string(self, text, x, y, scale=1.0,
+ align=TextAlign.BOTTOM_LEFT):
+ """Render a string to the current view buffer.
+
+ Note
+ ----
+ Assumes correct shader program already bound w/ uniforms set.
+
+ Parameters
+ ----------
+ text : str
+ The text to render.
+ x : int
+ Horizontal pixel location of text.
+ y : int
+ Vertical pixel location of text.
+ scale : int
+ Scaling factor for text.
+ align : int
+ One of the TextAlign options which specifies where the ``x``
+ and ``y`` parameters lie on the text. For example,
+ :attr:`.TextAlign.BOTTOM_LEFT` means that ``x`` and ``y`` indicate
+ the position of the bottom-left corner of the textbox.
+ """
+ glActiveTexture(GL_TEXTURE0)
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+ glDisable(GL_DEPTH_TEST)
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
+ self._bind()
+
+ # Determine width and height of text relative to x, y
+ width = 0.0
+ height = 0.0
+ for c in text:
+ ch = self._character_map[c]
+ height = max(height, ch.bearing[1] * scale)
+ width += (ch.advance >> 6) * scale
+
+ # Determine offsets based on alignments
+ xoff = 0
+ yoff = 0
+ if align == TextAlign.BOTTOM_RIGHT:
+ xoff = -width
+ elif align == TextAlign.BOTTOM_CENTER:
+ xoff = -width / 2.0
+ elif align == TextAlign.TOP_LEFT:
+ yoff = -height
+ elif align == TextAlign.TOP_RIGHT:
+ yoff = -height
+ xoff = -width
+ elif align == TextAlign.TOP_CENTER:
+ yoff = -height
+ xoff = -width / 2.0
+ elif align == TextAlign.CENTER:
+ xoff = -width / 2.0
+ yoff = -height / 2.0
+ elif align == TextAlign.CENTER_LEFT:
+ yoff = -height / 2.0
+ elif align == TextAlign.CENTER_RIGHT:
+ xoff = -width
+ yoff = -height / 2.0
+
+ x += xoff
+ y += yoff
+
+ ch = None
+ for c in text:
+ ch = self._character_map[c]
+ xpos = x + ch.bearing[0] * scale
+ ypos = y - (ch.size[1] - ch.bearing[1]) * scale
+ w = ch.size[0] * scale
+ h = ch.size[1] * scale
+
+ vertices = np.array([
+ [xpos, ypos, 0.0, 0.0],
+ [xpos + w, ypos, 1.0, 0.0],
+ [xpos + w, ypos + h, 1.0, 1.0],
+ [xpos + w, ypos + h, 1.0, 1.0],
+ [xpos, ypos + h, 0.0, 1.0],
+ [xpos, ypos, 0.0, 0.0],
+ ], dtype=np.float32)
+
+ ch.texture._bind()
+
+ glBindBuffer(GL_ARRAY_BUFFER, self._vbo)
+ glBufferData(
+ GL_ARRAY_BUFFER, FLOAT_SZ * 6 * 4, vertices, GL_DYNAMIC_DRAW
+ )
+ # TODO MAKE THIS MORE EFFICIENT, lgBufferSubData is broken
+ # glBufferSubData(
+ # GL_ARRAY_BUFFER, 0, 6 * 4 * FLOAT_SZ,
+ # np.ascontiguousarray(vertices.flatten)
+ # )
+ glDrawArrays(GL_TRIANGLES, 0, 6)
+ x += (ch.advance >> 6) * scale
+
+ self._unbind()
+ if ch:
+ ch.texture._unbind()
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Bold.ttf b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Bold.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..fd79d43bea0293ac1b20e8aca1142627983d2c07
Binary files /dev/null and b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Bold.ttf differ
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-BoldItalic.ttf b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-BoldItalic.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..9bc800958a421d937fc392e00beaef4eea76dc71
Binary files /dev/null and b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-BoldItalic.ttf differ
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-ExtraBold.ttf b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-ExtraBold.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..21f6f84a0799946fc4ae02c52b27e61c3762c745
Binary files /dev/null and b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-ExtraBold.ttf differ
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-ExtraBoldItalic.ttf b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-ExtraBoldItalic.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..31cb688340eff462dddf47efbb4dfef66cb7fbed
Binary files /dev/null and b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-ExtraBoldItalic.ttf differ
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Italic.ttf b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Italic.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..c90da48ff3b8ad6167236d70c48df4d7b5de3bbb
Binary files /dev/null and b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Italic.ttf differ
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Light.ttf b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Light.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..0d381897da20345fa63112f19042561f44ee3aa0
Binary files /dev/null and b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Light.ttf differ
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-LightItalic.ttf b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-LightItalic.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..68299c4bc6b5b7adfff2c9aee4aed7c1547100ef
Binary files /dev/null and b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-LightItalic.ttf differ
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Regular.ttf b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Regular.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..db433349b7047f72f40072630c1bc110620bf09e
Binary files /dev/null and b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Regular.ttf differ
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Semibold.ttf b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Semibold.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..1a7679e3949fb045f152f456bc4adad31e8b9f55
Binary files /dev/null and b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-Semibold.ttf differ
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-SemiboldItalic.ttf b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-SemiboldItalic.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..59b6d16b065f6baa6f70ddbd4322a4f44bb9636a
Binary files /dev/null and b/generate_human_motion/pyrender/build/lib/pyrender/fonts/OpenSans-SemiboldItalic.ttf differ
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/light.py b/generate_human_motion/pyrender/build/lib/pyrender/light.py
new file mode 100644
index 0000000000000000000000000000000000000000..333d9e4e553a245c259251a89b69cb46b73b1278
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/light.py
@@ -0,0 +1,385 @@
+"""Punctual light sources as defined by the glTF 2.0 KHR extension at
+https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual
+
+Author: Matthew Matl
+"""
+import abc
+import numpy as np
+import six
+
+from OpenGL.GL import *
+
+from .utils import format_color_vector
+from .texture import Texture
+from .constants import SHADOW_TEX_SZ
+from .camera import OrthographicCamera, PerspectiveCamera
+
+
+
+@six.add_metaclass(abc.ABCMeta)
+class Light(object):
+ """Base class for all light objects.
+
+ Parameters
+ ----------
+ color : (3,) float
+ RGB value for the light's color in linear space.
+ intensity : float
+ Brightness of light. The units that this is defined in depend on the
+ type of light. Point and spot lights use luminous intensity in candela
+ (lm/sr), while directional lights use illuminance in lux (lm/m2).
+ name : str, optional
+ Name of the light.
+ """
+ def __init__(self,
+ color=None,
+ intensity=None,
+ name=None):
+
+ if color is None:
+ color = np.ones(3)
+ if intensity is None:
+ intensity = 1.0
+
+ self.name = name
+ self.color = color
+ self.intensity = intensity
+ self._shadow_camera = None
+ self._shadow_texture = None
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def color(self):
+ """(3,) float : The light's color.
+ """
+ return self._color
+
+ @color.setter
+ def color(self, value):
+ self._color = format_color_vector(value, 3)
+
+ @property
+ def intensity(self):
+ """float : The light's intensity in candela or lux.
+ """
+ return self._intensity
+
+ @intensity.setter
+ def intensity(self, value):
+ self._intensity = float(value)
+
+ @property
+ def shadow_texture(self):
+ """:class:`.Texture` : A texture used to hold shadow maps for this light.
+ """
+ return self._shadow_texture
+
+ @shadow_texture.setter
+ def shadow_texture(self, value):
+ if self._shadow_texture is not None:
+ if self._shadow_texture._in_context():
+ self._shadow_texture.delete()
+ self._shadow_texture = value
+
+ @abc.abstractmethod
+ def _generate_shadow_texture(self, size=None):
+ """Generate a shadow texture for this light.
+
+ Parameters
+ ----------
+ size : int, optional
+ Size of texture map. Must be a positive power of two.
+ """
+ pass
+
+ @abc.abstractmethod
+ def _get_shadow_camera(self, scene_scale):
+ """Generate and return a shadow mapping camera for this light.
+
+ Parameters
+ ----------
+ scene_scale : float
+ Length of scene's bounding box diagonal.
+
+ Returns
+ -------
+ camera : :class:`.Camera`
+ The camera used to render shadowmaps for this light.
+ """
+ pass
+
+
+class DirectionalLight(Light):
+ """Directional lights are light sources that act as though they are
+ infinitely far away and emit light in the direction of the local -z axis.
+ This light type inherits the orientation of the node that it belongs to;
+ position and scale are ignored except for their effect on the inherited
+ node orientation. Because it is at an infinite distance, the light is
+ not attenuated. Its intensity is defined in lumens per metre squared,
+ or lux (lm/m2).
+
+ Parameters
+ ----------
+ color : (3,) float, optional
+ RGB value for the light's color in linear space. Defaults to white
+ (i.e. [1.0, 1.0, 1.0]).
+ intensity : float, optional
+ Brightness of light, in lux (lm/m^2). Defaults to 1.0
+ name : str, optional
+ Name of the light.
+ """
+
+ def __init__(self,
+ color=None,
+ intensity=None,
+ name=None):
+ super(DirectionalLight, self).__init__(
+ color=color,
+ intensity=intensity,
+ name=name,
+ )
+
+ def _generate_shadow_texture(self, size=None):
+ """Generate a shadow texture for this light.
+
+ Parameters
+ ----------
+ size : int, optional
+ Size of texture map. Must be a positive power of two.
+ """
+ if size is None:
+ size = SHADOW_TEX_SZ
+ self.shadow_texture = Texture(width=size, height=size,
+ source_channels='D', data_format=GL_FLOAT)
+
+ def _get_shadow_camera(self, scene_scale):
+ """Generate and return a shadow mapping camera for this light.
+
+ Parameters
+ ----------
+ scene_scale : float
+ Length of scene's bounding box diagonal.
+
+ Returns
+ -------
+ camera : :class:`.Camera`
+ The camera used to render shadowmaps for this light.
+ """
+ return OrthographicCamera(
+ znear=0.01 * scene_scale,
+ zfar=10 * scene_scale,
+ xmag=scene_scale,
+ ymag=scene_scale
+ )
+
+
+class PointLight(Light):
+ """Point lights emit light in all directions from their position in space;
+ rotation and scale are ignored except for their effect on the inherited
+ node position. The brightness of the light attenuates in a physically
+ correct manner as distance increases from the light's position (i.e.
+ brightness goes like the inverse square of the distance). Point light
+ intensity is defined in candela, which is lumens per square radian (lm/sr).
+
+ Parameters
+ ----------
+ color : (3,) float
+ RGB value for the light's color in linear space.
+ intensity : float
+ Brightness of light in candela (lm/sr).
+ range : float
+ Cutoff distance at which light's intensity may be considered to
+ have reached zero. If None, the range is assumed to be infinite.
+ name : str, optional
+ Name of the light.
+ """
+
+ def __init__(self,
+ color=None,
+ intensity=None,
+ range=None,
+ name=None):
+ super(PointLight, self).__init__(
+ color=color,
+ intensity=intensity,
+ name=name,
+ )
+ self.range = range
+
+ @property
+ def range(self):
+ """float : The cutoff distance for the light.
+ """
+ return self._range
+
+ @range.setter
+ def range(self, value):
+ if value is not None:
+ value = float(value)
+ if value <= 0:
+ raise ValueError('Range must be > 0')
+ self._range = value
+ self._range = value
+
+ def _generate_shadow_texture(self, size=None):
+ """Generate a shadow texture for this light.
+
+ Parameters
+ ----------
+ size : int, optional
+ Size of texture map. Must be a positive power of two.
+ """
+ raise NotImplementedError('Shadows not implemented for point lights')
+
+ def _get_shadow_camera(self, scene_scale):
+ """Generate and return a shadow mapping camera for this light.
+
+ Parameters
+ ----------
+ scene_scale : float
+ Length of scene's bounding box diagonal.
+
+ Returns
+ -------
+ camera : :class:`.Camera`
+ The camera used to render shadowmaps for this light.
+ """
+ raise NotImplementedError('Shadows not implemented for point lights')
+
+
+class SpotLight(Light):
+ """Spot lights emit light in a cone in the direction of the local -z axis.
+ The angle and falloff of the cone is defined using two numbers, the
+ ``innerConeAngle`` and ``outerConeAngle``.
+ As with point lights, the brightness
+ also attenuates in a physically correct manner as distance increases from
+ the light's position (i.e. brightness goes like the inverse square of the
+ distance). Spot light intensity refers to the brightness inside the
+ ``innerConeAngle`` (and at the location of the light) and is defined in
+ candela, which is lumens per square radian (lm/sr). A spot light's position
+ and orientation are inherited from its node transform. Inherited scale does
+ not affect cone shape, and is ignored except for its effect on position
+ and orientation.
+
+ Parameters
+ ----------
+ color : (3,) float
+ RGB value for the light's color in linear space.
+ intensity : float
+ Brightness of light in candela (lm/sr).
+ range : float
+ Cutoff distance at which light's intensity may be considered to
+ have reached zero. If None, the range is assumed to be infinite.
+ innerConeAngle : float
+ Angle, in radians, from centre of spotlight where falloff begins.
+ Must be greater than or equal to ``0`` and less
+ than ``outerConeAngle``. Defaults to ``0``.
+ outerConeAngle : float
+ Angle, in radians, from centre of spotlight where falloff ends.
+ Must be greater than ``innerConeAngle`` and less than or equal to
+ ``PI / 2.0``. Defaults to ``PI / 4.0``.
+ name : str, optional
+ Name of the light.
+ """
+
+ def __init__(self,
+ color=None,
+ intensity=None,
+ range=None,
+ innerConeAngle=0.0,
+ outerConeAngle=(np.pi / 4.0),
+ name=None):
+ super(SpotLight, self).__init__(
+ name=name,
+ color=color,
+ intensity=intensity,
+ )
+ self.outerConeAngle = outerConeAngle
+ self.innerConeAngle = innerConeAngle
+ self.range = range
+
+ @property
+ def innerConeAngle(self):
+ """float : The inner cone angle in radians.
+ """
+ return self._innerConeAngle
+
+ @innerConeAngle.setter
+ def innerConeAngle(self, value):
+ if value < 0.0 or value > self.outerConeAngle:
+ raise ValueError('Invalid value for inner cone angle')
+ self._innerConeAngle = float(value)
+
+ @property
+ def outerConeAngle(self):
+ """float : The outer cone angle in radians.
+ """
+ return self._outerConeAngle
+
+ @outerConeAngle.setter
+ def outerConeAngle(self, value):
+ if value < 0.0 or value > np.pi / 2.0 + 1e-9:
+ raise ValueError('Invalid value for outer cone angle')
+ self._outerConeAngle = float(value)
+
+ @property
+ def range(self):
+ """float : The cutoff distance for the light.
+ """
+ return self._range
+
+ @range.setter
+ def range(self, value):
+ if value is not None:
+ value = float(value)
+ if value <= 0:
+ raise ValueError('Range must be > 0')
+ self._range = value
+ self._range = value
+
+ def _generate_shadow_texture(self, size=None):
+ """Generate a shadow texture for this light.
+
+ Parameters
+ ----------
+ size : int, optional
+ Size of texture map. Must be a positive power of two.
+ """
+ if size is None:
+ size = SHADOW_TEX_SZ
+ self.shadow_texture = Texture(width=size, height=size,
+ source_channels='D', data_format=GL_FLOAT)
+
+ def _get_shadow_camera(self, scene_scale):
+ """Generate and return a shadow mapping camera for this light.
+
+ Parameters
+ ----------
+ scene_scale : float
+ Length of scene's bounding box diagonal.
+
+ Returns
+ -------
+ camera : :class:`.Camera`
+ The camera used to render shadowmaps for this light.
+ """
+ return PerspectiveCamera(
+ znear=0.01 * scene_scale,
+ zfar=10 * scene_scale,
+ yfov=np.clip(2 * self.outerConeAngle + np.pi / 16.0, 0.0, np.pi),
+ aspectRatio=1.0
+ )
+
+
+__all__ = ['Light', 'DirectionalLight', 'SpotLight', 'PointLight']
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/material.py b/generate_human_motion/pyrender/build/lib/pyrender/material.py
new file mode 100644
index 0000000000000000000000000000000000000000..3ce9c2d184ed213c84b015e36bea558cd1efc6b7
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/material.py
@@ -0,0 +1,707 @@
+"""Material properties, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-material
+and
+https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness
+
+Author: Matthew Matl
+"""
+import abc
+import numpy as np
+import six
+
+from .constants import TexFlags
+from .utils import format_color_vector, format_texture_source
+from .texture import Texture
+
+
+@six.add_metaclass(abc.ABCMeta)
+class Material(object):
+ """Base for standard glTF 2.0 materials.
+
+ Parameters
+ ----------
+ name : str, optional
+ The user-defined name of this object.
+ normalTexture : (n,n,3) float or :class:`Texture`, optional
+ A tangent space normal map. The texture contains RGB components in
+ linear space. Each texel represents the XYZ components of a normal
+ vector in tangent space. Red [0 to 255] maps to X [-1 to 1]. Green
+ [0 to 255] maps to Y [-1 to 1]. Blue [128 to 255] maps to Z
+ [1/255 to 1]. The normal vectors use OpenGL conventions where +X is
+ right and +Y is up. +Z points toward the viewer.
+ occlusionTexture : (n,n,1) float or :class:`Texture`, optional
+ The occlusion map texture. The occlusion values are sampled from the R
+ channel. Higher values indicate areas that should receive full indirect
+ lighting and lower values indicate no indirect lighting. These values
+ are linear. If other channels are present (GBA), they are ignored for
+ occlusion calculations.
+ emissiveTexture : (n,n,3) float or :class:`Texture`, optional
+ The emissive map controls the color and intensity of the light being
+ emitted by the material. This texture contains RGB components in sRGB
+ color space. If a fourth component (A) is present, it is ignored.
+ emissiveFactor : (3,) float, optional
+ The RGB components of the emissive color of the material. These values
+ are linear. If an emissiveTexture is specified, this value is
+ multiplied with the texel values.
+ alphaMode : str, optional
+ The material's alpha rendering mode enumeration specifying the
+ interpretation of the alpha value of the main factor and texture.
+ Allowed Values:
+
+ - `"OPAQUE"` The alpha value is ignored and the rendered output is
+ fully opaque.
+ - `"MASK"` The rendered output is either fully opaque or fully
+ transparent depending on the alpha value and the specified alpha
+ cutoff value.
+ - `"BLEND"` The alpha value is used to composite the source and
+ destination areas. The rendered output is combined with the
+ background using the normal painting operation (i.e. the Porter
+ and Duff over operator).
+
+ alphaCutoff : float, optional
+ Specifies the cutoff threshold when in MASK mode. If the alpha value is
+ greater than or equal to this value then it is rendered as fully
+ opaque, otherwise, it is rendered as fully transparent.
+ A value greater than 1.0 will render the entire material as fully
+ transparent. This value is ignored for other modes.
+ doubleSided : bool, optional
+ Specifies whether the material is double sided. When this value is
+ false, back-face culling is enabled. When this value is true,
+ back-face culling is disabled and double sided lighting is enabled.
+ smooth : bool, optional
+ If True, the material is rendered smoothly by using only one normal
+ per vertex and face indexing.
+ wireframe : bool, optional
+ If True, the material is rendered in wireframe mode.
+ """
+
+ def __init__(self,
+ name=None,
+ normalTexture=None,
+ occlusionTexture=None,
+ emissiveTexture=None,
+ emissiveFactor=None,
+ alphaMode=None,
+ alphaCutoff=None,
+ doubleSided=False,
+ smooth=True,
+ wireframe=False):
+
+ # Set defaults
+ if alphaMode is None:
+ alphaMode = 'OPAQUE'
+
+ if alphaCutoff is None:
+ alphaCutoff = 0.5
+
+ if emissiveFactor is None:
+ emissiveFactor = np.zeros(3).astype(np.float32)
+
+ self.name = name
+ self.normalTexture = normalTexture
+ self.occlusionTexture = occlusionTexture
+ self.emissiveTexture = emissiveTexture
+ self.emissiveFactor = emissiveFactor
+ self.alphaMode = alphaMode
+ self.alphaCutoff = alphaCutoff
+ self.doubleSided = doubleSided
+ self.smooth = smooth
+ self.wireframe = wireframe
+
+ self._tex_flags = None
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def normalTexture(self):
+ """(n,n,3) float or :class:`Texture` : The tangent-space normal map.
+ """
+ return self._normalTexture
+
+ @normalTexture.setter
+ def normalTexture(self, value):
+ # TODO TMP
+ self._normalTexture = self._format_texture(value, 'RGB')
+ self._tex_flags = None
+
+ @property
+ def occlusionTexture(self):
+ """(n,n,1) float or :class:`Texture` : The ambient occlusion map.
+ """
+ return self._occlusionTexture
+
+ @occlusionTexture.setter
+ def occlusionTexture(self, value):
+ self._occlusionTexture = self._format_texture(value, 'R')
+ self._tex_flags = None
+
+ @property
+ def emissiveTexture(self):
+ """(n,n,3) float or :class:`Texture` : The emission map.
+ """
+ return self._emissiveTexture
+
+ @emissiveTexture.setter
+ def emissiveTexture(self, value):
+ self._emissiveTexture = self._format_texture(value, 'RGB')
+ self._tex_flags = None
+
+ @property
+ def emissiveFactor(self):
+ """(3,) float : Base multiplier for emission colors.
+ """
+ return self._emissiveFactor
+
+ @emissiveFactor.setter
+ def emissiveFactor(self, value):
+ if value is None:
+ value = np.zeros(3)
+ self._emissiveFactor = format_color_vector(value, 3)
+
+ @property
+ def alphaMode(self):
+ """str : The mode for blending.
+ """
+ return self._alphaMode
+
+ @alphaMode.setter
+ def alphaMode(self, value):
+ if value not in set(['OPAQUE', 'MASK', 'BLEND']):
+ raise ValueError('Invalid alpha mode {}'.format(value))
+ self._alphaMode = value
+
+ @property
+ def alphaCutoff(self):
+ """float : The cutoff threshold in MASK mode.
+ """
+ return self._alphaCutoff
+
+ @alphaCutoff.setter
+ def alphaCutoff(self, value):
+ if value < 0 or value > 1:
+ raise ValueError('Alpha cutoff must be in range [0,1]')
+ self._alphaCutoff = float(value)
+
+ @property
+ def doubleSided(self):
+ """bool : Whether the material is double-sided.
+ """
+ return self._doubleSided
+
+ @doubleSided.setter
+ def doubleSided(self, value):
+ if not isinstance(value, bool):
+ raise TypeError('Double sided must be a boolean value')
+ self._doubleSided = value
+
+ @property
+ def smooth(self):
+ """bool : Whether to render the mesh smoothly by
+ interpolating vertex normals.
+ """
+ return self._smooth
+
+ @smooth.setter
+ def smooth(self, value):
+ if not isinstance(value, bool):
+ raise TypeError('Double sided must be a boolean value')
+ self._smooth = value
+
+ @property
+ def wireframe(self):
+ """bool : Whether to render the mesh in wireframe mode.
+ """
+ return self._wireframe
+
+ @wireframe.setter
+ def wireframe(self, value):
+ if not isinstance(value, bool):
+ raise TypeError('Wireframe must be a boolean value')
+ self._wireframe = value
+
+ @property
+ def is_transparent(self):
+ """bool : If True, the object is partially transparent.
+ """
+ return self._compute_transparency()
+
+ @property
+ def tex_flags(self):
+ """int : Texture availability flags.
+ """
+ if self._tex_flags is None:
+ self._tex_flags = self._compute_tex_flags()
+ return self._tex_flags
+
+ @property
+ def textures(self):
+ """list of :class:`Texture` : The textures associated with this
+ material.
+ """
+ return self._compute_textures()
+
+ def _compute_transparency(self):
+ return False
+
+ def _compute_tex_flags(self):
+ tex_flags = TexFlags.NONE
+ if self.normalTexture is not None:
+ tex_flags |= TexFlags.NORMAL
+ if self.occlusionTexture is not None:
+ tex_flags |= TexFlags.OCCLUSION
+ if self.emissiveTexture is not None:
+ tex_flags |= TexFlags.EMISSIVE
+ return tex_flags
+
+ def _compute_textures(self):
+ all_textures = [
+ self.normalTexture, self.occlusionTexture, self.emissiveTexture
+ ]
+ textures = set([t for t in all_textures if t is not None])
+ return textures
+
+ def _format_texture(self, texture, target_channels='RGB'):
+ """Format a texture as a float32 np array.
+ """
+ if isinstance(texture, Texture) or texture is None:
+ return texture
+ else:
+ source = format_texture_source(texture, target_channels)
+ return Texture(source=source, source_channels=target_channels)
+
+
+class MetallicRoughnessMaterial(Material):
+ """A material based on the metallic-roughness material model from
+ Physically-Based Rendering (PBR) methodology.
+
+ Parameters
+ ----------
+ name : str, optional
+ The user-defined name of this object.
+ normalTexture : (n,n,3) float or :class:`Texture`, optional
+ A tangent space normal map. The texture contains RGB components in
+ linear space. Each texel represents the XYZ components of a normal
+ vector in tangent space. Red [0 to 255] maps to X [-1 to 1]. Green
+ [0 to 255] maps to Y [-1 to 1]. Blue [128 to 255] maps to Z
+ [1/255 to 1]. The normal vectors use OpenGL conventions where +X is
+ right and +Y is up. +Z points toward the viewer.
+ occlusionTexture : (n,n,1) float or :class:`Texture`, optional
+ The occlusion map texture. The occlusion values are sampled from the R
+ channel. Higher values indicate areas that should receive full indirect
+ lighting and lower values indicate no indirect lighting. These values
+ are linear. If other channels are present (GBA), they are ignored for
+ occlusion calculations.
+ emissiveTexture : (n,n,3) float or :class:`Texture`, optional
+ The emissive map controls the color and intensity of the light being
+ emitted by the material. This texture contains RGB components in sRGB
+ color space. If a fourth component (A) is present, it is ignored.
+ emissiveFactor : (3,) float, optional
+ The RGB components of the emissive color of the material. These values
+ are linear. If an emissiveTexture is specified, this value is
+ multiplied with the texel values.
+ alphaMode : str, optional
+ The material's alpha rendering mode enumeration specifying the
+ interpretation of the alpha value of the main factor and texture.
+ Allowed Values:
+
+ - `"OPAQUE"` The alpha value is ignored and the rendered output is
+ fully opaque.
+ - `"MASK"` The rendered output is either fully opaque or fully
+ transparent depending on the alpha value and the specified alpha
+ cutoff value.
+ - `"BLEND"` The alpha value is used to composite the source and
+ destination areas. The rendered output is combined with the
+ background using the normal painting operation (i.e. the Porter
+ and Duff over operator).
+
+ alphaCutoff : float, optional
+ Specifies the cutoff threshold when in MASK mode. If the alpha value is
+ greater than or equal to this value then it is rendered as fully
+ opaque, otherwise, it is rendered as fully transparent.
+ A value greater than 1.0 will render the entire material as fully
+ transparent. This value is ignored for other modes.
+ doubleSided : bool, optional
+ Specifies whether the material is double sided. When this value is
+ false, back-face culling is enabled. When this value is true,
+ back-face culling is disabled and double sided lighting is enabled.
+ smooth : bool, optional
+ If True, the material is rendered smoothly by using only one normal
+ per vertex and face indexing.
+ wireframe : bool, optional
+ If True, the material is rendered in wireframe mode.
+ baseColorFactor : (4,) float, optional
+ The RGBA components of the base color of the material. The fourth
+ component (A) is the alpha coverage of the material. The alphaMode
+ property specifies how alpha is interpreted. These values are linear.
+ If a baseColorTexture is specified, this value is multiplied with the
+ texel values.
+ baseColorTexture : (n,n,4) float or :class:`Texture`, optional
+ The base color texture. This texture contains RGB(A) components in sRGB
+ color space. The first three components (RGB) specify the base color of
+ the material. If the fourth component (A) is present, it represents the
+ alpha coverage of the material. Otherwise, an alpha of 1.0 is assumed.
+ The alphaMode property specifies how alpha is interpreted.
+ The stored texels must not be premultiplied.
+ metallicFactor : float
+ The metalness of the material. A value of 1.0 means the material is a
+ metal. A value of 0.0 means the material is a dielectric. Values in
+ between are for blending between metals and dielectrics such as dirty
+ metallic surfaces. This value is linear. If a metallicRoughnessTexture
+ is specified, this value is multiplied with the metallic texel values.
+ roughnessFactor : float
+ The roughness of the material. A value of 1.0 means the material is
+ completely rough. A value of 0.0 means the material is completely
+ smooth. This value is linear. If a metallicRoughnessTexture is
+ specified, this value is multiplied with the roughness texel values.
+ metallicRoughnessTexture : (n,n,2) float or :class:`Texture`, optional
+ The metallic-roughness texture. The metalness values are sampled from
+ the B channel. The roughness values are sampled from the G channel.
+ These values are linear. If other channels are present (R or A), they
+ are ignored for metallic-roughness calculations.
+ """
+
+ def __init__(self,
+ name=None,
+ normalTexture=None,
+ occlusionTexture=None,
+ emissiveTexture=None,
+ emissiveFactor=None,
+ alphaMode=None,
+ alphaCutoff=None,
+ doubleSided=False,
+ smooth=True,
+ wireframe=False,
+ baseColorFactor=None,
+ baseColorTexture=None,
+ metallicFactor=1.0,
+ roughnessFactor=1.0,
+ metallicRoughnessTexture=None):
+ super(MetallicRoughnessMaterial, self).__init__(
+ name=name,
+ normalTexture=normalTexture,
+ occlusionTexture=occlusionTexture,
+ emissiveTexture=emissiveTexture,
+ emissiveFactor=emissiveFactor,
+ alphaMode=alphaMode,
+ alphaCutoff=alphaCutoff,
+ doubleSided=doubleSided,
+ smooth=smooth,
+ wireframe=wireframe
+ )
+
+ # Set defaults
+ if baseColorFactor is None:
+ baseColorFactor = np.ones(4).astype(np.float32)
+
+ self.baseColorFactor = baseColorFactor
+ self.baseColorTexture = baseColorTexture
+ self.metallicFactor = metallicFactor
+ self.roughnessFactor = roughnessFactor
+ self.metallicRoughnessTexture = metallicRoughnessTexture
+
+ @property
+ def baseColorFactor(self):
+ """(4,) float or :class:`Texture` : The RGBA base color multiplier.
+ """
+ return self._baseColorFactor
+
+ @baseColorFactor.setter
+ def baseColorFactor(self, value):
+ if value is None:
+ value = np.ones(4)
+ self._baseColorFactor = format_color_vector(value, 4)
+
+ @property
+ def baseColorTexture(self):
+ """(n,n,4) float or :class:`Texture` : The diffuse texture.
+ """
+ return self._baseColorTexture
+
+ @baseColorTexture.setter
+ def baseColorTexture(self, value):
+ self._baseColorTexture = self._format_texture(value, 'RGBA')
+ self._tex_flags = None
+
+ @property
+ def metallicFactor(self):
+ """float : The metalness of the material.
+ """
+ return self._metallicFactor
+
+ @metallicFactor.setter
+ def metallicFactor(self, value):
+ if value is None:
+ value = 1.0
+ if value < 0 or value > 1:
+ raise ValueError('Metallic factor must be in range [0,1]')
+ self._metallicFactor = float(value)
+
+ @property
+ def roughnessFactor(self):
+ """float : The roughness of the material.
+ """
+ return self.RoughnessFactor
+
+ @roughnessFactor.setter
+ def roughnessFactor(self, value):
+ if value is None:
+ value = 1.0
+ if value < 0 or value > 1:
+ raise ValueError('Roughness factor must be in range [0,1]')
+ self.RoughnessFactor = float(value)
+
+ @property
+ def metallicRoughnessTexture(self):
+ """(n,n,2) float or :class:`Texture` : The metallic-roughness texture.
+ """
+ return self._metallicRoughnessTexture
+
+ @metallicRoughnessTexture.setter
+ def metallicRoughnessTexture(self, value):
+ self._metallicRoughnessTexture = self._format_texture(value, 'GB')
+ self._tex_flags = None
+
+ def _compute_tex_flags(self):
+ tex_flags = super(MetallicRoughnessMaterial, self)._compute_tex_flags()
+ if self.baseColorTexture is not None:
+ tex_flags |= TexFlags.BASE_COLOR
+ if self.metallicRoughnessTexture is not None:
+ tex_flags |= TexFlags.METALLIC_ROUGHNESS
+ return tex_flags
+
+ def _compute_transparency(self):
+ if self.alphaMode == 'OPAQUE':
+ return False
+ cutoff = self.alphaCutoff
+ if self.alphaMode == 'BLEND':
+ cutoff = 1.0
+ if self.baseColorFactor[3] < cutoff:
+ return True
+ if (self.baseColorTexture is not None and
+ self.baseColorTexture.is_transparent(cutoff)):
+ return True
+ return False
+
+ def _compute_textures(self):
+ textures = super(MetallicRoughnessMaterial, self)._compute_textures()
+ all_textures = [self.baseColorTexture, self.metallicRoughnessTexture]
+ all_textures = {t for t in all_textures if t is not None}
+ textures |= all_textures
+ return textures
+
+
+class SpecularGlossinessMaterial(Material):
+ """A material based on the specular-glossiness material model from
+ Physically-Based Rendering (PBR) methodology.
+
+ Parameters
+ ----------
+ name : str, optional
+ The user-defined name of this object.
+ normalTexture : (n,n,3) float or :class:`Texture`, optional
+ A tangent space normal map. The texture contains RGB components in
+ linear space. Each texel represents the XYZ components of a normal
+ vector in tangent space. Red [0 to 255] maps to X [-1 to 1]. Green
+ [0 to 255] maps to Y [-1 to 1]. Blue [128 to 255] maps to Z
+ [1/255 to 1]. The normal vectors use OpenGL conventions where +X is
+ right and +Y is up. +Z points toward the viewer.
+ occlusionTexture : (n,n,1) float or :class:`Texture`, optional
+ The occlusion map texture. The occlusion values are sampled from the R
+ channel. Higher values indicate areas that should receive full indirect
+ lighting and lower values indicate no indirect lighting. These values
+ are linear. If other channels are present (GBA), they are ignored for
+ occlusion calculations.
+ emissiveTexture : (n,n,3) float or :class:`Texture`, optional
+ The emissive map controls the color and intensity of the light being
+ emitted by the material. This texture contains RGB components in sRGB
+ color space. If a fourth component (A) is present, it is ignored.
+ emissiveFactor : (3,) float, optional
+ The RGB components of the emissive color of the material. These values
+ are linear. If an emissiveTexture is specified, this value is
+ multiplied with the texel values.
+ alphaMode : str, optional
+ The material's alpha rendering mode enumeration specifying the
+ interpretation of the alpha value of the main factor and texture.
+ Allowed Values:
+
+ - `"OPAQUE"` The alpha value is ignored and the rendered output is
+ fully opaque.
+ - `"MASK"` The rendered output is either fully opaque or fully
+ transparent depending on the alpha value and the specified alpha
+ cutoff value.
+ - `"BLEND"` The alpha value is used to composite the source and
+ destination areas. The rendered output is combined with the
+ background using the normal painting operation (i.e. the Porter
+ and Duff over operator).
+
+ alphaCutoff : float, optional
+ Specifies the cutoff threshold when in MASK mode. If the alpha value is
+ greater than or equal to this value then it is rendered as fully
+ opaque, otherwise, it is rendered as fully transparent.
+ A value greater than 1.0 will render the entire material as fully
+ transparent. This value is ignored for other modes.
+ doubleSided : bool, optional
+ Specifies whether the material is double sided. When this value is
+ false, back-face culling is enabled. When this value is true,
+ back-face culling is disabled and double sided lighting is enabled.
+ smooth : bool, optional
+ If True, the material is rendered smoothly by using only one normal
+ per vertex and face indexing.
+ wireframe : bool, optional
+ If True, the material is rendered in wireframe mode.
+ diffuseFactor : (4,) float
+ The RGBA components of the reflected diffuse color of the material.
+ Metals have a diffuse value of [0.0, 0.0, 0.0]. The fourth component
+ (A) is the opacity of the material. The values are linear.
+ diffuseTexture : (n,n,4) float or :class:`Texture`, optional
+ The diffuse texture. This texture contains RGB(A) components of the
+ reflected diffuse color of the material in sRGB color space. If the
+ fourth component (A) is present, it represents the alpha coverage of
+ the material. Otherwise, an alpha of 1.0 is assumed.
+ The alphaMode property specifies how alpha is interpreted.
+ The stored texels must not be premultiplied.
+ specularFactor : (3,) float
+ The specular RGB color of the material. This value is linear.
+ glossinessFactor : float
+ The glossiness or smoothness of the material. A value of 1.0 means the
+ material has full glossiness or is perfectly smooth. A value of 0.0
+ means the material has no glossiness or is perfectly rough. This value
+ is linear.
+ specularGlossinessTexture : (n,n,4) or :class:`Texture`, optional
+ The specular-glossiness texture is a RGBA texture, containing the
+ specular color (RGB) in sRGB space and the glossiness value (A) in
+ linear space.
+ """
+
+ def __init__(self,
+ name=None,
+ normalTexture=None,
+ occlusionTexture=None,
+ emissiveTexture=None,
+ emissiveFactor=None,
+ alphaMode=None,
+ alphaCutoff=None,
+ doubleSided=False,
+ smooth=True,
+ wireframe=False,
+ diffuseFactor=None,
+ diffuseTexture=None,
+ specularFactor=None,
+ glossinessFactor=1.0,
+ specularGlossinessTexture=None):
+ super(SpecularGlossinessMaterial, self).__init__(
+ name=name,
+ normalTexture=normalTexture,
+ occlusionTexture=occlusionTexture,
+ emissiveTexture=emissiveTexture,
+ emissiveFactor=emissiveFactor,
+ alphaMode=alphaMode,
+ alphaCutoff=alphaCutoff,
+ doubleSided=doubleSided,
+ smooth=smooth,
+ wireframe=wireframe
+ )
+
+ # Set defaults
+ if diffuseFactor is None:
+ diffuseFactor = np.ones(4).astype(np.float32)
+ if specularFactor is None:
+ specularFactor = np.ones(3).astype(np.float32)
+
+ self.diffuseFactor = diffuseFactor
+ self.diffuseTexture = diffuseTexture
+ self.specularFactor = specularFactor
+ self.glossinessFactor = glossinessFactor
+ self.specularGlossinessTexture = specularGlossinessTexture
+
+ @property
+ def diffuseFactor(self):
+ """(4,) float : The diffuse base color.
+ """
+ return self._diffuseFactor
+
+ @diffuseFactor.setter
+ def diffuseFactor(self, value):
+ self._diffuseFactor = format_color_vector(value, 4)
+
+ @property
+ def diffuseTexture(self):
+ """(n,n,4) float or :class:`Texture` : The diffuse map.
+ """
+ return self._diffuseTexture
+
+ @diffuseTexture.setter
+ def diffuseTexture(self, value):
+ self._diffuseTexture = self._format_texture(value, 'RGBA')
+ self._tex_flags = None
+
+ @property
+ def specularFactor(self):
+ """(3,) float : The specular color of the material.
+ """
+ return self._specularFactor
+
+ @specularFactor.setter
+ def specularFactor(self, value):
+ self._specularFactor = format_color_vector(value, 3)
+
+ @property
+ def glossinessFactor(self):
+ """float : The glossiness of the material.
+ """
+ return self.glossinessFactor
+
+ @glossinessFactor.setter
+ def glossinessFactor(self, value):
+ if value < 0 or value > 1:
+ raise ValueError('glossiness factor must be in range [0,1]')
+ self._glossinessFactor = float(value)
+
+ @property
+ def specularGlossinessTexture(self):
+ """(n,n,4) or :class:`Texture` : The specular-glossiness texture.
+ """
+ return self._specularGlossinessTexture
+
+ @specularGlossinessTexture.setter
+ def specularGlossinessTexture(self, value):
+ self._specularGlossinessTexture = self._format_texture(value, 'GB')
+ self._tex_flags = None
+
+ def _compute_tex_flags(self):
+ flags = super(SpecularGlossinessMaterial, self)._compute_tex_flags()
+ if self.diffuseTexture is not None:
+ flags |= TexFlags.DIFFUSE
+ if self.specularGlossinessTexture is not None:
+ flags |= TexFlags.SPECULAR_GLOSSINESS
+ return flags
+
+ def _compute_transparency(self):
+ if self.alphaMode == 'OPAQUE':
+ return False
+ cutoff = self.alphaCutoff
+ if self.alphaMode == 'BLEND':
+ cutoff = 1.0
+ if self.diffuseFactor[3] < cutoff:
+ return True
+ if (self.diffuseTexture is not None and
+ self.diffuseTexture.is_transparent(cutoff)):
+ return True
+ return False
+
+ def _compute_textures(self):
+ textures = super(SpecularGlossinessMaterial, self)._compute_textures()
+ all_textures = [self.diffuseTexture, self.specularGlossinessTexture]
+ all_textures = {t for t in all_textures if t is not None}
+ textures |= all_textures
+ return textures
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/mesh.py b/generate_human_motion/pyrender/build/lib/pyrender/mesh.py
new file mode 100644
index 0000000000000000000000000000000000000000..36833ea3dfa6c095a18fc745ff34cf106e83c95d
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/mesh.py
@@ -0,0 +1,328 @@
+"""Meshes, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-mesh
+
+Author: Matthew Matl
+"""
+import copy
+
+import numpy as np
+import trimesh
+
+from .primitive import Primitive
+from .constants import GLTF
+from .material import MetallicRoughnessMaterial
+
+
+class Mesh(object):
+ """A set of primitives to be rendered.
+
+ Parameters
+ ----------
+ name : str
+ The user-defined name of this object.
+ primitives : list of :class:`Primitive`
+ The primitives associated with this mesh.
+ weights : (k,) float
+ Array of weights to be applied to the Morph Targets.
+ is_visible : bool
+ If False, the mesh will not be rendered.
+ """
+
+ def __init__(self, primitives, name=None, weights=None, is_visible=True):
+ self.primitives = primitives
+ self.name = name
+ self.weights = weights
+ self.is_visible = is_visible
+
+ self._bounds = None
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def primitives(self):
+ """list of :class:`Primitive` : The primitives associated
+ with this mesh.
+ """
+ return self._primitives
+
+ @primitives.setter
+ def primitives(self, value):
+ self._primitives = value
+
+ @property
+ def weights(self):
+ """(k,) float : Weights to be applied to morph targets.
+ """
+ return self._weights
+
+ @weights.setter
+ def weights(self, value):
+ self._weights = value
+
+ @property
+ def is_visible(self):
+ """bool : Whether the mesh is visible.
+ """
+ return self._is_visible
+
+ @is_visible.setter
+ def is_visible(self, value):
+ self._is_visible = value
+
+ @property
+ def bounds(self):
+ """(2,3) float : The axis-aligned bounds of the mesh.
+ """
+ if self._bounds is None:
+ bounds = np.array([[np.infty, np.infty, np.infty],
+ [-np.infty, -np.infty, -np.infty]])
+ for p in self.primitives:
+ bounds[0] = np.minimum(bounds[0], p.bounds[0])
+ bounds[1] = np.maximum(bounds[1], p.bounds[1])
+ self._bounds = bounds
+ return self._bounds
+
+ @property
+ def centroid(self):
+ """(3,) float : The centroid of the mesh's axis-aligned bounding box
+ (AABB).
+ """
+ return np.mean(self.bounds, axis=0)
+
+ @property
+ def extents(self):
+ """(3,) float : The lengths of the axes of the mesh's AABB.
+ """
+ return np.diff(self.bounds, axis=0).reshape(-1)
+
+ @property
+ def scale(self):
+ """(3,) float : The length of the diagonal of the mesh's AABB.
+ """
+ return np.linalg.norm(self.extents)
+
+ @property
+ def is_transparent(self):
+ """bool : If True, the mesh is partially-transparent.
+ """
+ for p in self.primitives:
+ if p.is_transparent:
+ return True
+ return False
+
+ @staticmethod
+ def from_points(points, colors=None, normals=None,
+ is_visible=True, poses=None):
+ """Create a Mesh from a set of points.
+
+ Parameters
+ ----------
+ points : (n,3) float
+ The point positions.
+ colors : (n,3) or (n,4) float, optional
+ RGB or RGBA colors for each point.
+ normals : (n,3) float, optionals
+ The normal vectors for each point.
+ is_visible : bool
+ If False, the points will not be rendered.
+ poses : (x,4,4)
+ Array of 4x4 transformation matrices for instancing this object.
+
+ Returns
+ -------
+ mesh : :class:`Mesh`
+ The created mesh.
+ """
+ primitive = Primitive(
+ positions=points,
+ normals=normals,
+ color_0=colors,
+ mode=GLTF.POINTS,
+ poses=poses
+ )
+ mesh = Mesh(primitives=[primitive], is_visible=is_visible)
+ return mesh
+
+ @staticmethod
+ def from_trimesh(mesh, material=None, is_visible=True,
+ poses=None, wireframe=False, smooth=True):
+ """Create a Mesh from a :class:`~trimesh.base.Trimesh`.
+
+ Parameters
+ ----------
+ mesh : :class:`~trimesh.base.Trimesh` or list of them
+ A triangular mesh or a list of meshes.
+ material : :class:`Material`
+ The material of the object. Overrides any mesh material.
+ If not specified and the mesh has no material, a default material
+ will be used.
+ is_visible : bool
+ If False, the mesh will not be rendered.
+ poses : (n,4,4) float
+ Array of 4x4 transformation matrices for instancing this object.
+ wireframe : bool
+ If `True`, the mesh will be rendered as a wireframe object
+ smooth : bool
+ If `True`, the mesh will be rendered with interpolated vertex
+ normals. Otherwise, the mesh edges will stay sharp.
+
+ Returns
+ -------
+ mesh : :class:`Mesh`
+ The created mesh.
+ """
+
+ if isinstance(mesh, (list, tuple, set, np.ndarray)):
+ meshes = list(mesh)
+ elif isinstance(mesh, trimesh.Trimesh):
+ meshes = [mesh]
+ else:
+ raise TypeError('Expected a Trimesh or a list, got a {}'
+ .format(type(mesh)))
+
+ primitives = []
+ for m in meshes:
+ positions = None
+ normals = None
+ indices = None
+
+ # Compute positions, normals, and indices
+ if smooth:
+ positions = m.vertices.copy()
+ normals = m.vertex_normals.copy()
+ indices = m.faces.copy()
+ else:
+ positions = m.vertices[m.faces].reshape((3 * len(m.faces), 3))
+ normals = np.repeat(m.face_normals, 3, axis=0)
+
+ # Compute colors, texture coords, and material properties
+ color_0, texcoord_0, primitive_material = Mesh._get_trimesh_props(m, smooth=smooth, material=material)
+
+ # Override if material is given.
+ if material is not None:
+ #primitive_material = copy.copy(material)
+ primitive_material = copy.deepcopy(material) # TODO
+
+ if primitive_material is None:
+ # Replace material with default if needed
+ primitive_material = MetallicRoughnessMaterial(
+ alphaMode='BLEND',
+ baseColorFactor=[0.3, 0.3, 0.3, 1.0],
+ metallicFactor=0.2,
+ roughnessFactor=0.8
+ )
+
+ primitive_material.wireframe = wireframe
+
+ # Create the primitive
+ primitives.append(Primitive(
+ positions=positions,
+ normals=normals,
+ texcoord_0=texcoord_0,
+ color_0=color_0,
+ indices=indices,
+ material=primitive_material,
+ mode=GLTF.TRIANGLES,
+ poses=poses
+ ))
+
+ return Mesh(primitives=primitives, is_visible=is_visible)
+
+ @staticmethod
+ def _get_trimesh_props(mesh, smooth=False, material=None):
+ """Gets the vertex colors, texture coordinates, and material properties
+ from a :class:`~trimesh.base.Trimesh`.
+ """
+ colors = None
+ texcoords = None
+
+ # If the trimesh visual is undefined, return none for both
+ if not mesh.visual.defined:
+ return colors, texcoords, material
+
+ # Process vertex colors
+ if material is None:
+ if mesh.visual.kind == 'vertex':
+ vc = mesh.visual.vertex_colors.copy()
+ if smooth:
+ colors = vc
+ else:
+ colors = vc[mesh.faces].reshape(
+ (3 * len(mesh.faces), vc.shape[1])
+ )
+ material = MetallicRoughnessMaterial(
+ alphaMode='BLEND',
+ baseColorFactor=[1.0, 1.0, 1.0, 1.0],
+ metallicFactor=0.2,
+ roughnessFactor=0.8
+ )
+ # Process face colors
+ elif mesh.visual.kind == 'face':
+ if smooth:
+ raise ValueError('Cannot use face colors with a smooth mesh')
+ else:
+ colors = np.repeat(mesh.visual.face_colors, 3, axis=0)
+
+ material = MetallicRoughnessMaterial(
+ alphaMode='BLEND',
+ baseColorFactor=[1.0, 1.0, 1.0, 1.0],
+ metallicFactor=0.2,
+ roughnessFactor=0.8
+ )
+
+ # Process texture colors
+ if mesh.visual.kind == 'texture':
+ # Configure UV coordinates
+ if mesh.visual.uv is not None and len(mesh.visual.uv) != 0:
+ uv = mesh.visual.uv.copy()
+ if smooth:
+ texcoords = uv
+ else:
+ texcoords = uv[mesh.faces].reshape(
+ (3 * len(mesh.faces), uv.shape[1])
+ )
+
+ if material is None:
+ # Configure mesh material
+ mat = mesh.visual.material
+
+ if isinstance(mat, trimesh.visual.texture.PBRMaterial):
+ material = MetallicRoughnessMaterial(
+ normalTexture=mat.normalTexture,
+ occlusionTexture=mat.occlusionTexture,
+ emissiveTexture=mat.emissiveTexture,
+ emissiveFactor=mat.emissiveFactor,
+ alphaMode='BLEND',
+ baseColorFactor=mat.baseColorFactor,
+ baseColorTexture=mat.baseColorTexture,
+ metallicFactor=mat.metallicFactor,
+ roughnessFactor=mat.roughnessFactor,
+ metallicRoughnessTexture=mat.metallicRoughnessTexture,
+ doubleSided=mat.doubleSided,
+ alphaCutoff=mat.alphaCutoff
+ )
+ elif isinstance(mat, trimesh.visual.texture.SimpleMaterial):
+ glossiness = mat.kwargs.get('Ns', 1.0)
+ if isinstance(glossiness, list):
+ glossiness = float(glossiness[0])
+ roughness = (2 / (glossiness + 2)) ** (1.0 / 4.0)
+ material = MetallicRoughnessMaterial(
+ alphaMode='BLEND',
+ roughnessFactor=roughness,
+ baseColorFactor=mat.diffuse,
+ baseColorTexture=mat.image,
+ )
+ elif isinstance(mat, MetallicRoughnessMaterial):
+ material = mat
+
+ return colors, texcoords, material
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/node.py b/generate_human_motion/pyrender/build/lib/pyrender/node.py
new file mode 100644
index 0000000000000000000000000000000000000000..1f37f7856cc732a37dc58253022a7c331489493e
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/node.py
@@ -0,0 +1,263 @@
+"""Nodes, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-node
+
+Author: Matthew Matl
+"""
+import numpy as np
+
+import trimesh.transformations as transformations
+
+from .camera import Camera
+from .mesh import Mesh
+from .light import Light
+
+
+class Node(object):
+ """A node in the node hierarchy.
+
+ Parameters
+ ----------
+ name : str, optional
+ The user-defined name of this object.
+ camera : :class:`Camera`, optional
+ The camera in this node.
+ children : list of :class:`Node`
+ The children of this node.
+ skin : int, optional
+ The index of the skin referenced by this node.
+ matrix : (4,4) float, optional
+ A floating-point 4x4 transformation matrix.
+ mesh : :class:`Mesh`, optional
+ The mesh in this node.
+ rotation : (4,) float, optional
+ The node's unit quaternion in the order (x, y, z, w), where
+ w is the scalar.
+ scale : (3,) float, optional
+ The node's non-uniform scale, given as the scaling factors along the x,
+ y, and z axes.
+ translation : (3,) float, optional
+ The node's translation along the x, y, and z axes.
+ weights : (n,) float
+ The weights of the instantiated Morph Target. Number of elements must
+ match number of Morph Targets of used mesh.
+ light : :class:`Light`, optional
+ The light in this node.
+ """
+
+ def __init__(self,
+ name=None,
+ camera=None,
+ children=None,
+ skin=None,
+ matrix=None,
+ mesh=None,
+ rotation=None,
+ scale=None,
+ translation=None,
+ weights=None,
+ light=None):
+ # Set defaults
+ if children is None:
+ children = []
+
+ self._matrix = None
+ self._scale = None
+ self._rotation = None
+ self._translation = None
+ if matrix is None:
+ if rotation is None:
+ rotation = np.array([0.0, 0.0, 0.0, 1.0])
+ if translation is None:
+ translation = np.zeros(3)
+ if scale is None:
+ scale = np.ones(3)
+ self.rotation = rotation
+ self.translation = translation
+ self.scale = scale
+ else:
+ self.matrix = matrix
+
+ self.name = name
+ self.camera = camera
+ self.children = children
+ self.skin = skin
+ self.mesh = mesh
+ self.weights = weights
+ self.light = light
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def camera(self):
+ """:class:`Camera` : The camera in this node.
+ """
+ return self._camera
+
+ @camera.setter
+ def camera(self, value):
+ if value is not None and not isinstance(value, Camera):
+ raise TypeError('Value must be a camera')
+ self._camera = value
+
+ @property
+ def children(self):
+ """list of :class:`Node` : The children of this node.
+ """
+ return self._children
+
+ @children.setter
+ def children(self, value):
+ self._children = value
+
+ @property
+ def skin(self):
+ """int : The skin index for this node.
+ """
+ return self._skin
+
+ @skin.setter
+ def skin(self, value):
+ self._skin = value
+
+ @property
+ def mesh(self):
+ """:class:`Mesh` : The mesh in this node.
+ """
+ return self._mesh
+
+ @mesh.setter
+ def mesh(self, value):
+ if value is not None and not isinstance(value, Mesh):
+ raise TypeError('Value must be a mesh')
+ self._mesh = value
+
+ @property
+ def light(self):
+ """:class:`Light` : The light in this node.
+ """
+ return self._light
+
+ @light.setter
+ def light(self, value):
+ if value is not None and not isinstance(value, Light):
+ raise TypeError('Value must be a light')
+ self._light = value
+
+ @property
+ def rotation(self):
+ """(4,) float : The xyzw quaternion for this node.
+ """
+ return self._rotation
+
+ @rotation.setter
+ def rotation(self, value):
+ value = np.asanyarray(value)
+ if value.shape != (4,):
+ raise ValueError('Quaternion must be a (4,) vector')
+ if np.abs(np.linalg.norm(value) - 1.0) > 1e-3:
+ raise ValueError('Quaternion must have norm == 1.0')
+ self._rotation = value
+ self._matrix = None
+
+ @property
+ def translation(self):
+ """(3,) float : The translation for this node.
+ """
+ return self._translation
+
+ @translation.setter
+ def translation(self, value):
+ value = np.asanyarray(value)
+ if value.shape != (3,):
+ raise ValueError('Translation must be a (3,) vector')
+ self._translation = value
+ self._matrix = None
+
+ @property
+ def scale(self):
+ """(3,) float : The scale for this node.
+ """
+ return self._scale
+
+ @scale.setter
+ def scale(self, value):
+ value = np.asanyarray(value)
+ if value.shape != (3,):
+ raise ValueError('Scale must be a (3,) vector')
+ self._scale = value
+ self._matrix = None
+
+ @property
+ def matrix(self):
+ """(4,4) float : The homogenous transform matrix for this node.
+
+ Note that this matrix's elements are not settable,
+ it's just a copy of the internal matrix. You can set the whole
+ matrix, but not an individual element.
+ """
+ if self._matrix is None:
+ self._matrix = self._m_from_tqs(
+ self.translation, self.rotation, self.scale
+ )
+ return self._matrix.copy()
+
+ @matrix.setter
+ def matrix(self, value):
+ value = np.asanyarray(value)
+ if value.shape != (4,4):
+ raise ValueError('Matrix must be a 4x4 numpy ndarray')
+ if not np.allclose(value[3,:], np.array([0.0, 0.0, 0.0, 1.0])):
+ raise ValueError('Bottom row of matrix must be [0,0,0,1]')
+ self.rotation = Node._q_from_m(value)
+ self.scale = Node._s_from_m(value)
+ self.translation = Node._t_from_m(value)
+ self._matrix = value
+
+ @staticmethod
+ def _t_from_m(m):
+ return m[:3,3]
+
+ @staticmethod
+ def _r_from_m(m):
+ U = m[:3,:3]
+ norms = np.linalg.norm(U.T, axis=1)
+ return U / norms
+
+ @staticmethod
+ def _q_from_m(m):
+ M = np.eye(4)
+ M[:3,:3] = Node._r_from_m(m)
+ q_wxyz = transformations.quaternion_from_matrix(M)
+ return np.roll(q_wxyz, -1)
+
+ @staticmethod
+ def _s_from_m(m):
+ return np.linalg.norm(m[:3,:3].T, axis=1)
+
+ @staticmethod
+ def _r_from_q(q):
+ q_wxyz = np.roll(q, 1)
+ return transformations.quaternion_matrix(q_wxyz)[:3,:3]
+
+ @staticmethod
+ def _m_from_tqs(t, q, s):
+ S = np.eye(4)
+ S[:3,:3] = np.diag(s)
+
+ R = np.eye(4)
+ R[:3,:3] = Node._r_from_q(q)
+
+ T = np.eye(4)
+ T[:3,3] = t
+
+ return T.dot(R.dot(S))
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/offscreen.py b/generate_human_motion/pyrender/build/lib/pyrender/offscreen.py
new file mode 100644
index 0000000000000000000000000000000000000000..340142983006cdc6f51b6d114e9b2b294aa4a919
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/offscreen.py
@@ -0,0 +1,160 @@
+"""Wrapper for offscreen rendering.
+
+Author: Matthew Matl
+"""
+import os
+
+from .renderer import Renderer
+from .constants import RenderFlags
+
+
+class OffscreenRenderer(object):
+ """A wrapper for offscreen rendering.
+
+ Parameters
+ ----------
+ viewport_width : int
+ The width of the main viewport, in pixels.
+ viewport_height : int
+ The height of the main viewport, in pixels.
+ point_size : float
+ The size of screen-space points in pixels.
+ """
+
+ def __init__(self, viewport_width, viewport_height, point_size=1.0):
+ self.viewport_width = viewport_width
+ self.viewport_height = viewport_height
+ self.point_size = point_size
+
+ self._platform = None
+ self._renderer = None
+ self._create()
+
+ @property
+ def viewport_width(self):
+ """int : The width of the main viewport, in pixels.
+ """
+ return self._viewport_width
+
+ @viewport_width.setter
+ def viewport_width(self, value):
+ self._viewport_width = int(value)
+
+ @property
+ def viewport_height(self):
+ """int : The height of the main viewport, in pixels.
+ """
+ return self._viewport_height
+
+ @viewport_height.setter
+ def viewport_height(self, value):
+ self._viewport_height = int(value)
+
+ @property
+ def point_size(self):
+ """float : The pixel size of points in point clouds.
+ """
+ return self._point_size
+
+ @point_size.setter
+ def point_size(self, value):
+ self._point_size = float(value)
+
+ def render(self, scene, flags=RenderFlags.NONE, seg_node_map=None):
+ """Render a scene with the given set of flags.
+
+ Parameters
+ ----------
+ scene : :class:`Scene`
+ A scene to render.
+ flags : int
+ A bitwise or of one or more flags from :class:`.RenderFlags`.
+ seg_node_map : dict
+ A map from :class:`.Node` objects to (3,) colors for each.
+ If specified along with flags set to :attr:`.RenderFlags.SEG`,
+ the color image will be a segmentation image.
+
+ Returns
+ -------
+ color_im : (h, w, 3) uint8 or (h, w, 4) uint8
+ The color buffer in RGB format, or in RGBA format if
+ :attr:`.RenderFlags.RGBA` is set.
+ Not returned if flags includes :attr:`.RenderFlags.DEPTH_ONLY`.
+ depth_im : (h, w) float32
+ The depth buffer in linear units.
+ """
+ self._platform.make_current()
+ # If platform does not support dynamically-resizing framebuffers,
+ # destroy it and restart it
+ if (self._platform.viewport_height != self.viewport_height or
+ self._platform.viewport_width != self.viewport_width):
+ if not self._platform.supports_framebuffers():
+ self.delete()
+ self._create()
+
+ self._platform.make_current()
+ self._renderer.viewport_width = self.viewport_width
+ self._renderer.viewport_height = self.viewport_height
+ self._renderer.point_size = self.point_size
+
+ if self._platform.supports_framebuffers():
+ flags |= RenderFlags.OFFSCREEN
+ retval = self._renderer.render(scene, flags, seg_node_map)
+ else:
+ self._renderer.render(scene, flags, seg_node_map)
+ depth = self._renderer.read_depth_buf()
+ if flags & RenderFlags.DEPTH_ONLY:
+ retval = depth
+ else:
+ color = self._renderer.read_color_buf()
+ retval = color, depth
+
+ # Make the platform not current
+ self._platform.make_uncurrent()
+ return retval
+
+ def delete(self):
+ """Free all OpenGL resources.
+ """
+ self._platform.make_current()
+ self._renderer.delete()
+ self._platform.delete_context()
+ del self._renderer
+ del self._platform
+ self._renderer = None
+ self._platform = None
+ import gc
+ gc.collect()
+
+ def _create(self):
+ if 'PYOPENGL_PLATFORM' not in os.environ:
+ from pyrender.platforms.pyglet_platform import PygletPlatform
+ self._platform = PygletPlatform(self.viewport_width,
+ self.viewport_height)
+ elif os.environ['PYOPENGL_PLATFORM'] == 'egl':
+ from pyrender.platforms import egl
+ device_id = int(os.environ.get('EGL_DEVICE_ID', '0'))
+ egl_device = egl.get_device_by_index(device_id)
+ self._platform = egl.EGLPlatform(self.viewport_width,
+ self.viewport_height,
+ device=egl_device)
+ elif os.environ['PYOPENGL_PLATFORM'] == 'osmesa':
+ from pyrender.platforms.osmesa import OSMesaPlatform
+ self._platform = OSMesaPlatform(self.viewport_width,
+ self.viewport_height)
+ else:
+ raise ValueError('Unsupported PyOpenGL platform: {}'.format(
+ os.environ['PYOPENGL_PLATFORM']
+ ))
+ self._platform.init_context()
+ self._platform.make_current()
+ self._renderer = Renderer(self.viewport_width, self.viewport_height)
+
+ def __del__(self):
+ try:
+ self.delete()
+ except Exception:
+ pass
+
+
+__all__ = ['OffscreenRenderer']
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/platforms/__init__.py b/generate_human_motion/pyrender/build/lib/pyrender/platforms/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..7837fd5fdeccab5e48c85e41d20b238ea7396599
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/platforms/__init__.py
@@ -0,0 +1,6 @@
+"""Platforms for generating offscreen OpenGL contexts for rendering.
+
+Author: Matthew Matl
+"""
+
+from .base import Platform
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/platforms/base.py b/generate_human_motion/pyrender/build/lib/pyrender/platforms/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..c9ecda906145e239737901809aa59db8d3e231c6
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/platforms/base.py
@@ -0,0 +1,76 @@
+import abc
+
+import six
+
+
+@six.add_metaclass(abc.ABCMeta)
+class Platform(object):
+ """Base class for all OpenGL platforms.
+
+ Parameters
+ ----------
+ viewport_width : int
+ The width of the main viewport, in pixels.
+ viewport_height : int
+ The height of the main viewport, in pixels
+ """
+
+ def __init__(self, viewport_width, viewport_height):
+ self.viewport_width = viewport_width
+ self.viewport_height = viewport_height
+
+ @property
+ def viewport_width(self):
+ """int : The width of the main viewport, in pixels.
+ """
+ return self._viewport_width
+
+ @viewport_width.setter
+ def viewport_width(self, value):
+ self._viewport_width = value
+
+ @property
+ def viewport_height(self):
+ """int : The height of the main viewport, in pixels.
+ """
+ return self._viewport_height
+
+ @viewport_height.setter
+ def viewport_height(self, value):
+ self._viewport_height = value
+
+ @abc.abstractmethod
+ def init_context(self):
+ """Create an OpenGL context.
+ """
+ pass
+
+ @abc.abstractmethod
+ def make_current(self):
+ """Make the OpenGL context current.
+ """
+ pass
+
+ @abc.abstractmethod
+ def make_uncurrent(self):
+ """Make the OpenGL context uncurrent.
+ """
+ pass
+
+ @abc.abstractmethod
+ def delete_context(self):
+ """Delete the OpenGL context.
+ """
+ pass
+
+ @abc.abstractmethod
+ def supports_framebuffers(self):
+ """Returns True if the method supports framebuffer rendering.
+ """
+ pass
+
+ def __del__(self):
+ try:
+ self.delete_context()
+ except Exception:
+ pass
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/platforms/egl.py b/generate_human_motion/pyrender/build/lib/pyrender/platforms/egl.py
new file mode 100644
index 0000000000000000000000000000000000000000..ae2478d29c9a538c53ad83fa31f8e2277cd897c8
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/platforms/egl.py
@@ -0,0 +1,219 @@
+import ctypes
+import os
+
+import OpenGL.platform
+
+from .base import Platform
+
+EGL_PLATFORM_DEVICE_EXT = 0x313F
+EGL_DRM_DEVICE_FILE_EXT = 0x3233
+
+
+def _ensure_egl_loaded():
+ plugin = OpenGL.platform.PlatformPlugin.by_name('egl')
+ if plugin is None:
+ raise RuntimeError("EGL platform plugin is not available.")
+
+ plugin_class = plugin.load()
+ plugin.loaded = True
+ # create instance of this platform implementation
+ plugin = plugin_class()
+
+ plugin.install(vars(OpenGL.platform))
+
+
+_ensure_egl_loaded()
+from OpenGL import EGL as egl
+
+
+def _get_egl_func(func_name, res_type, *arg_types):
+ address = egl.eglGetProcAddress(func_name)
+ if address is None:
+ return None
+
+ proto = ctypes.CFUNCTYPE(res_type)
+ proto.argtypes = arg_types
+ func = proto(address)
+ return func
+
+
+def _get_egl_struct(struct_name):
+ from OpenGL._opaque import opaque_pointer_cls
+ return opaque_pointer_cls(struct_name)
+
+
+# These are not defined in PyOpenGL by default.
+_EGLDeviceEXT = _get_egl_struct('EGLDeviceEXT')
+_eglGetPlatformDisplayEXT = _get_egl_func('eglGetPlatformDisplayEXT', egl.EGLDisplay)
+_eglQueryDevicesEXT = _get_egl_func('eglQueryDevicesEXT', egl.EGLBoolean)
+_eglQueryDeviceStringEXT = _get_egl_func('eglQueryDeviceStringEXT', ctypes.c_char_p)
+
+
+def query_devices():
+ if _eglQueryDevicesEXT is None:
+ raise RuntimeError("EGL query extension is not loaded or is not supported.")
+
+ num_devices = egl.EGLint()
+ success = _eglQueryDevicesEXT(0, None, ctypes.pointer(num_devices))
+ if not success or num_devices.value < 1:
+ return []
+
+ devices = (_EGLDeviceEXT * num_devices.value)() # array of size num_devices
+ success = _eglQueryDevicesEXT(num_devices.value, devices, ctypes.pointer(num_devices))
+ if not success or num_devices.value < 1:
+ return []
+
+ return [EGLDevice(devices[i]) for i in range(num_devices.value)]
+
+
+def get_default_device():
+ # Fall back to not using query extension.
+ if _eglQueryDevicesEXT is None:
+ return EGLDevice(None)
+
+ return query_devices()[0]
+
+
+def get_device_by_index(device_id):
+ if _eglQueryDevicesEXT is None and device_id == 0:
+ return get_default_device()
+
+ devices = query_devices()
+ if device_id >= len(devices):
+ raise ValueError('Invalid device ID ({})'.format(device_id, len(devices)))
+ return devices[device_id]
+
+
+class EGLDevice:
+
+ def __init__(self, display=None):
+ self._display = display
+
+ def get_display(self):
+ if self._display is None:
+ return egl.eglGetDisplay(egl.EGL_DEFAULT_DISPLAY)
+
+ return _eglGetPlatformDisplayEXT(EGL_PLATFORM_DEVICE_EXT, self._display, None)
+
+ @property
+ def name(self):
+ if self._display is None:
+ return 'default'
+
+ name = _eglQueryDeviceStringEXT(self._display, EGL_DRM_DEVICE_FILE_EXT)
+ if name is None:
+ return None
+
+ return name.decode('ascii')
+
+ def __repr__(self):
+ return "".format(self.name)
+
+
+class EGLPlatform(Platform):
+ """Renders using EGL.
+ """
+
+ def __init__(self, viewport_width, viewport_height, device: EGLDevice = None):
+ super(EGLPlatform, self).__init__(viewport_width, viewport_height)
+ if device is None:
+ device = get_default_device()
+
+ self._egl_device = device
+ self._egl_display = None
+ self._egl_context = None
+
+ def init_context(self):
+ _ensure_egl_loaded()
+
+ from OpenGL.EGL import (
+ EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, EGL_BLUE_SIZE,
+ EGL_RED_SIZE, EGL_GREEN_SIZE, EGL_DEPTH_SIZE,
+ EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_CONFORMANT,
+ EGL_NONE, EGL_DEFAULT_DISPLAY, EGL_NO_CONTEXT,
+ EGL_OPENGL_API, EGL_CONTEXT_MAJOR_VERSION,
+ EGL_CONTEXT_MINOR_VERSION,
+ EGL_CONTEXT_OPENGL_PROFILE_MASK,
+ EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
+ eglGetDisplay, eglInitialize, eglChooseConfig,
+ eglBindAPI, eglCreateContext, EGLConfig
+ )
+ from OpenGL import arrays
+
+ config_attributes = arrays.GLintArray.asArray([
+ EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
+ EGL_BLUE_SIZE, 8,
+ EGL_RED_SIZE, 8,
+ EGL_GREEN_SIZE, 8,
+ EGL_DEPTH_SIZE, 24,
+ EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
+ EGL_CONFORMANT, EGL_OPENGL_BIT,
+ EGL_NONE
+ ])
+ context_attributes = arrays.GLintArray.asArray([
+ EGL_CONTEXT_MAJOR_VERSION, 4,
+ EGL_CONTEXT_MINOR_VERSION, 1,
+ EGL_CONTEXT_OPENGL_PROFILE_MASK,
+ EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
+ EGL_NONE
+ ])
+ major, minor = ctypes.c_long(), ctypes.c_long()
+ num_configs = ctypes.c_long()
+ configs = (EGLConfig * 1)()
+
+ # Cache DISPLAY if necessary and get an off-screen EGL display
+ orig_dpy = None
+ if 'DISPLAY' in os.environ:
+ orig_dpy = os.environ['DISPLAY']
+ del os.environ['DISPLAY']
+
+ self._egl_display = self._egl_device.get_display()
+ if orig_dpy is not None:
+ os.environ['DISPLAY'] = orig_dpy
+
+ # Initialize EGL
+ assert eglInitialize(self._egl_display, major, minor)
+ assert eglChooseConfig(
+ self._egl_display, config_attributes, configs, 1, num_configs
+ )
+
+ # Bind EGL to the OpenGL API
+ assert eglBindAPI(EGL_OPENGL_API)
+
+ # Create an EGL context
+ self._egl_context = eglCreateContext(
+ self._egl_display, configs[0],
+ EGL_NO_CONTEXT, context_attributes
+ )
+
+ # Make it current
+ self.make_current()
+
+ def make_current(self):
+ from OpenGL.EGL import eglMakeCurrent, EGL_NO_SURFACE
+ assert eglMakeCurrent(
+ self._egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
+ self._egl_context
+ )
+
+ def make_uncurrent(self):
+ """Make the OpenGL context uncurrent.
+ """
+ pass
+
+ def delete_context(self):
+ from OpenGL.EGL import eglDestroyContext, eglTerminate
+ if self._egl_display is not None:
+ if self._egl_context is not None:
+ eglDestroyContext(self._egl_display, self._egl_context)
+ self._egl_context = None
+ eglTerminate(self._egl_display)
+ self._egl_display = None
+
+ def supports_framebuffers(self):
+ return True
+
+
+__all__ = ['EGLPlatform']
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/platforms/osmesa.py b/generate_human_motion/pyrender/build/lib/pyrender/platforms/osmesa.py
new file mode 100644
index 0000000000000000000000000000000000000000..deaa5ff44031a107883913ae9a18fc425d650f3d
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/platforms/osmesa.py
@@ -0,0 +1,59 @@
+from .base import Platform
+
+
+__all__ = ['OSMesaPlatform']
+
+
+class OSMesaPlatform(Platform):
+ """Renders into a software buffer using OSMesa. Requires special versions
+ of OSMesa to be installed, plus PyOpenGL upgrade.
+ """
+
+ def __init__(self, viewport_width, viewport_height):
+ super(OSMesaPlatform, self).__init__(viewport_width, viewport_height)
+ self._context = None
+ self._buffer = None
+
+ def init_context(self):
+ from OpenGL import arrays
+ from OpenGL.osmesa import (
+ OSMesaCreateContextAttribs, OSMESA_FORMAT,
+ OSMESA_RGBA, OSMESA_PROFILE, OSMESA_CORE_PROFILE,
+ OSMESA_CONTEXT_MAJOR_VERSION, OSMESA_CONTEXT_MINOR_VERSION,
+ OSMESA_DEPTH_BITS
+ )
+
+ attrs = arrays.GLintArray.asArray([
+ OSMESA_FORMAT, OSMESA_RGBA,
+ OSMESA_DEPTH_BITS, 24,
+ OSMESA_PROFILE, OSMESA_CORE_PROFILE,
+ OSMESA_CONTEXT_MAJOR_VERSION, 3,
+ OSMESA_CONTEXT_MINOR_VERSION, 3,
+ 0
+ ])
+ self._context = OSMesaCreateContextAttribs(attrs, None)
+ self._buffer = arrays.GLubyteArray.zeros(
+ (self.viewport_height, self.viewport_width, 4)
+ )
+
+ def make_current(self):
+ from OpenGL import GL as gl
+ from OpenGL.osmesa import OSMesaMakeCurrent
+ assert(OSMesaMakeCurrent(
+ self._context, self._buffer, gl.GL_UNSIGNED_BYTE,
+ self.viewport_width, self.viewport_height
+ ))
+
+ def make_uncurrent(self):
+ """Make the OpenGL context uncurrent.
+ """
+ pass
+
+ def delete_context(self):
+ from OpenGL.osmesa import OSMesaDestroyContext
+ OSMesaDestroyContext(self._context)
+ self._context = None
+ self._buffer = None
+
+ def supports_framebuffers(self):
+ return False
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/platforms/pyglet_platform.py b/generate_human_motion/pyrender/build/lib/pyrender/platforms/pyglet_platform.py
new file mode 100644
index 0000000000000000000000000000000000000000..a70cf7b659bc85a92f6c9c8ebcc360662a068507
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/platforms/pyglet_platform.py
@@ -0,0 +1,90 @@
+from pyrender.constants import (TARGET_OPEN_GL_MAJOR, TARGET_OPEN_GL_MINOR,
+ MIN_OPEN_GL_MAJOR, MIN_OPEN_GL_MINOR)
+from .base import Platform
+
+import OpenGL
+
+
+__all__ = ['PygletPlatform']
+
+
+class PygletPlatform(Platform):
+ """Renders on-screen using a 1x1 hidden Pyglet window for getting
+ an OpenGL context.
+ """
+
+ def __init__(self, viewport_width, viewport_height):
+ super(PygletPlatform, self).__init__(viewport_width, viewport_height)
+ self._window = None
+
+ def init_context(self):
+ import pyglet
+ pyglet.options['shadow_window'] = False
+
+ try:
+ pyglet.lib.x11.xlib.XInitThreads()
+ except Exception:
+ pass
+
+ self._window = None
+ confs = [pyglet.gl.Config(sample_buffers=1, samples=4,
+ depth_size=24,
+ double_buffer=True,
+ major_version=TARGET_OPEN_GL_MAJOR,
+ minor_version=TARGET_OPEN_GL_MINOR),
+ pyglet.gl.Config(depth_size=24,
+ double_buffer=True,
+ major_version=TARGET_OPEN_GL_MAJOR,
+ minor_version=TARGET_OPEN_GL_MINOR),
+ pyglet.gl.Config(sample_buffers=1, samples=4,
+ depth_size=24,
+ double_buffer=True,
+ major_version=MIN_OPEN_GL_MAJOR,
+ minor_version=MIN_OPEN_GL_MINOR),
+ pyglet.gl.Config(depth_size=24,
+ double_buffer=True,
+ major_version=MIN_OPEN_GL_MAJOR,
+ minor_version=MIN_OPEN_GL_MINOR)]
+ for conf in confs:
+ try:
+ self._window = pyglet.window.Window(config=conf, visible=False,
+ resizable=False,
+ width=1, height=1)
+ break
+ except pyglet.window.NoSuchConfigException as e:
+ pass
+
+ if not self._window:
+ raise ValueError(
+ 'Failed to initialize Pyglet window with an OpenGL >= 3+ '
+ 'context. If you\'re logged in via SSH, ensure that you\'re '
+ 'running your script with vglrun (i.e. VirtualGL). The '
+ 'internal error message was "{}"'.format(e)
+ )
+
+ def make_current(self):
+ if self._window:
+ self._window.switch_to()
+
+ def make_uncurrent(self):
+ try:
+ import pyglet
+ pyglet.gl.xlib.glx.glXMakeContextCurrent(self._window.context.x_display, 0, 0, None)
+ except Exception:
+ pass
+
+ def delete_context(self):
+ if self._window is not None:
+ self.make_current()
+ cid = OpenGL.contextdata.getContext()
+ try:
+ self._window.context.destroy()
+ self._window.close()
+ except Exception:
+ pass
+ self._window = None
+ OpenGL.contextdata.cleanupContext(cid)
+ del cid
+
+ def supports_framebuffers(self):
+ return True
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/primitive.py b/generate_human_motion/pyrender/build/lib/pyrender/primitive.py
new file mode 100644
index 0000000000000000000000000000000000000000..7f83f46f532b126a4573e715dd03d079fef755ca
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/primitive.py
@@ -0,0 +1,489 @@
+"""Primitives, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-primitive
+
+Author: Matthew Matl
+"""
+import numpy as np
+
+from OpenGL.GL import *
+
+from .material import Material, MetallicRoughnessMaterial
+from .constants import FLOAT_SZ, UINT_SZ, BufFlags, GLTF
+from .utils import format_color_array
+
+
+class Primitive(object):
+ """A primitive object which can be rendered.
+
+ Parameters
+ ----------
+ positions : (n, 3) float
+ XYZ vertex positions.
+ normals : (n, 3) float
+ Normalized XYZ vertex normals.
+ tangents : (n, 4) float
+ XYZW vertex tangents where the w component is a sign value
+ (either +1 or -1) indicating the handedness of the tangent basis.
+ texcoord_0 : (n, 2) float
+ The first set of UV texture coordinates.
+ texcoord_1 : (n, 2) float
+ The second set of UV texture coordinates.
+ color_0 : (n, 4) float
+ RGBA vertex colors.
+ joints_0 : (n, 4) float
+ Joint information.
+ weights_0 : (n, 4) float
+ Weight information for morphing.
+ indices : (m, 3) int
+ Face indices for triangle meshes or fans.
+ material : :class:`Material`
+ The material to apply to this primitive when rendering.
+ mode : int
+ The type of primitives to render, one of the following:
+
+ - ``0``: POINTS
+ - ``1``: LINES
+ - ``2``: LINE_LOOP
+ - ``3``: LINE_STRIP
+ - ``4``: TRIANGLES
+ - ``5``: TRIANGLES_STRIP
+ - ``6``: TRIANGLES_FAN
+ targets : (k,) int
+ Morph target indices.
+ poses : (x,4,4), float
+ Array of 4x4 transformation matrices for instancing this object.
+ """
+
+ def __init__(self,
+ positions,
+ normals=None,
+ tangents=None,
+ texcoord_0=None,
+ texcoord_1=None,
+ color_0=None,
+ joints_0=None,
+ weights_0=None,
+ indices=None,
+ material=None,
+ mode=None,
+ targets=None,
+ poses=None):
+
+ if mode is None:
+ mode = GLTF.TRIANGLES
+
+ self.positions = positions
+ self.normals = normals
+ self.tangents = tangents
+ self.texcoord_0 = texcoord_0
+ self.texcoord_1 = texcoord_1
+ self.color_0 = color_0
+ self.joints_0 = joints_0
+ self.weights_0 = weights_0
+ self.indices = indices
+ self.material = material
+ self.mode = mode
+ self.targets = targets
+ self.poses = poses
+
+ self._bounds = None
+ self._vaid = None
+ self._buffers = []
+ self._is_transparent = None
+ self._buf_flags = None
+
+ @property
+ def positions(self):
+ """(n,3) float : XYZ vertex positions.
+ """
+ return self._positions
+
+ @positions.setter
+ def positions(self, value):
+ value = np.asanyarray(value, dtype=np.float32)
+ self._positions = np.ascontiguousarray(value)
+ self._bounds = None
+
+ @property
+ def normals(self):
+ """(n,3) float : Normalized XYZ vertex normals.
+ """
+ return self._normals
+
+ @normals.setter
+ def normals(self, value):
+ if value is not None:
+ value = np.asanyarray(value, dtype=np.float32)
+ value = np.ascontiguousarray(value)
+ if value.shape != self.positions.shape:
+ raise ValueError('Incorrect normals shape')
+ self._normals = value
+
+ @property
+ def tangents(self):
+ """(n,4) float : XYZW vertex tangents.
+ """
+ return self._tangents
+
+ @tangents.setter
+ def tangents(self, value):
+ if value is not None:
+ value = np.asanyarray(value, dtype=np.float32)
+ value = np.ascontiguousarray(value)
+ if value.shape != (self.positions.shape[0], 4):
+ raise ValueError('Incorrect tangent shape')
+ self._tangents = value
+
+ @property
+ def texcoord_0(self):
+ """(n,2) float : The first set of UV texture coordinates.
+ """
+ return self._texcoord_0
+
+ @texcoord_0.setter
+ def texcoord_0(self, value):
+ if value is not None:
+ value = np.asanyarray(value, dtype=np.float32)
+ value = np.ascontiguousarray(value)
+ if (value.ndim != 2 or value.shape[0] != self.positions.shape[0] or
+ value.shape[1] < 2):
+ raise ValueError('Incorrect texture coordinate shape')
+ if value.shape[1] > 2:
+ value = value[:,:2]
+ self._texcoord_0 = value
+
+ @property
+ def texcoord_1(self):
+ """(n,2) float : The second set of UV texture coordinates.
+ """
+ return self._texcoord_1
+
+ @texcoord_1.setter
+ def texcoord_1(self, value):
+ if value is not None:
+ value = np.asanyarray(value, dtype=np.float32)
+ value = np.ascontiguousarray(value)
+ if (value.ndim != 2 or value.shape[0] != self.positions.shape[0] or
+ value.shape[1] != 2):
+ raise ValueError('Incorrect texture coordinate shape')
+ self._texcoord_1 = value
+
+ @property
+ def color_0(self):
+ """(n,4) float : RGBA vertex colors.
+ """
+ return self._color_0
+
+ @color_0.setter
+ def color_0(self, value):
+ if value is not None:
+ value = np.ascontiguousarray(
+ format_color_array(value, shape=(len(self.positions), 4))
+ )
+ self._is_transparent = None
+ self._color_0 = value
+
+ @property
+ def joints_0(self):
+ """(n,4) float : Joint information.
+ """
+ return self._joints_0
+
+ @joints_0.setter
+ def joints_0(self, value):
+ self._joints_0 = value
+
+ @property
+ def weights_0(self):
+ """(n,4) float : Weight information for morphing.
+ """
+ return self._weights_0
+
+ @weights_0.setter
+ def weights_0(self, value):
+ self._weights_0 = value
+
+ @property
+ def indices(self):
+ """(m,3) int : Face indices for triangle meshes or fans.
+ """
+ return self._indices
+
+ @indices.setter
+ def indices(self, value):
+ if value is not None:
+ value = np.asanyarray(value, dtype=np.float32)
+ value = np.ascontiguousarray(value)
+ self._indices = value
+
+ @property
+ def material(self):
+ """:class:`Material` : The material for this primitive.
+ """
+ return self._material
+
+ @material.setter
+ def material(self, value):
+ # Create default material
+ if value is None:
+ value = MetallicRoughnessMaterial()
+ else:
+ if not isinstance(value, Material):
+ raise TypeError('Object material must be of type Material')
+ self._material = value
+
+ @property
+ def mode(self):
+ """int : The type of primitive to render.
+ """
+ return self._mode
+
+ @mode.setter
+ def mode(self, value):
+ value = int(value)
+ if value < GLTF.POINTS or value > GLTF.TRIANGLE_FAN:
+ raise ValueError('Invalid mode')
+ self._mode = value
+
+ @property
+ def targets(self):
+ """(k,) int : Morph target indices.
+ """
+ return self._targets
+
+ @targets.setter
+ def targets(self, value):
+ self._targets = value
+
+ @property
+ def poses(self):
+ """(x,4,4) float : Homogenous transforms for instancing this primitive.
+ """
+ return self._poses
+
+ @poses.setter
+ def poses(self, value):
+ if value is not None:
+ value = np.asanyarray(value, dtype=np.float32)
+ value = np.ascontiguousarray(value)
+ if value.ndim == 2:
+ value = value[np.newaxis,:,:]
+ if value.shape[1] != 4 or value.shape[2] != 4:
+ raise ValueError('Pose matrices must be of shape (n,4,4), '
+ 'got {}'.format(value.shape))
+ self._poses = value
+ self._bounds = None
+
+ @property
+ def bounds(self):
+ if self._bounds is None:
+ self._bounds = self._compute_bounds()
+ return self._bounds
+
+ @property
+ def centroid(self):
+ """(3,) float : The centroid of the primitive's AABB.
+ """
+ return np.mean(self.bounds, axis=0)
+
+ @property
+ def extents(self):
+ """(3,) float : The lengths of the axes of the primitive's AABB.
+ """
+ return np.diff(self.bounds, axis=0).reshape(-1)
+
+ @property
+ def scale(self):
+ """(3,) float : The length of the diagonal of the primitive's AABB.
+ """
+ return np.linalg.norm(self.extents)
+
+ @property
+ def buf_flags(self):
+ """int : The flags for the render buffer.
+ """
+ if self._buf_flags is None:
+ self._buf_flags = self._compute_buf_flags()
+ return self._buf_flags
+
+ def delete(self):
+ self._unbind()
+ self._remove_from_context()
+
+ @property
+ def is_transparent(self):
+ """bool : If True, the mesh is partially-transparent.
+ """
+ return self._compute_transparency()
+
+ def _add_to_context(self):
+ if self._vaid is not None:
+ raise ValueError('Mesh is already bound to a context')
+
+ # Generate and bind VAO
+ self._vaid = glGenVertexArrays(1)
+ glBindVertexArray(self._vaid)
+
+ #######################################################################
+ # Fill vertex buffer
+ #######################################################################
+
+ # Generate and bind vertex buffer
+ vertexbuffer = glGenBuffers(1)
+ self._buffers.append(vertexbuffer)
+ glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer)
+
+ # positions
+ vertex_data = self.positions
+ attr_sizes = [3]
+
+ # Normals
+ if self.normals is not None:
+ vertex_data = np.hstack((vertex_data, self.normals))
+ attr_sizes.append(3)
+
+ # Tangents
+ if self.tangents is not None:
+ vertex_data = np.hstack((vertex_data, self.tangents))
+ attr_sizes.append(4)
+
+ # Texture Coordinates
+ if self.texcoord_0 is not None:
+ vertex_data = np.hstack((vertex_data, self.texcoord_0))
+ attr_sizes.append(2)
+ if self.texcoord_1 is not None:
+ vertex_data = np.hstack((vertex_data, self.texcoord_1))
+ attr_sizes.append(2)
+
+ # Color
+ if self.color_0 is not None:
+ vertex_data = np.hstack((vertex_data, self.color_0))
+ attr_sizes.append(4)
+
+ # TODO JOINTS AND WEIGHTS
+ # PASS
+
+ # Copy data to buffer
+ vertex_data = np.ascontiguousarray(
+ vertex_data.flatten().astype(np.float32)
+ )
+ glBufferData(
+ GL_ARRAY_BUFFER, FLOAT_SZ * len(vertex_data),
+ vertex_data, GL_STATIC_DRAW
+ )
+ total_sz = sum(attr_sizes)
+ offset = 0
+ for i, sz in enumerate(attr_sizes):
+ glVertexAttribPointer(
+ i, sz, GL_FLOAT, GL_FALSE, FLOAT_SZ * total_sz,
+ ctypes.c_void_p(FLOAT_SZ * offset)
+ )
+ glEnableVertexAttribArray(i)
+ offset += sz
+
+ #######################################################################
+ # Fill model matrix buffer
+ #######################################################################
+
+ if self.poses is not None:
+ pose_data = np.ascontiguousarray(
+ np.transpose(self.poses, [0,2,1]).flatten().astype(np.float32)
+ )
+ else:
+ pose_data = np.ascontiguousarray(
+ np.eye(4).flatten().astype(np.float32)
+ )
+
+ modelbuffer = glGenBuffers(1)
+ self._buffers.append(modelbuffer)
+ glBindBuffer(GL_ARRAY_BUFFER, modelbuffer)
+ glBufferData(
+ GL_ARRAY_BUFFER, FLOAT_SZ * len(pose_data),
+ pose_data, GL_STATIC_DRAW
+ )
+
+ for i in range(0, 4):
+ idx = i + len(attr_sizes)
+ glEnableVertexAttribArray(idx)
+ glVertexAttribPointer(
+ idx, 4, GL_FLOAT, GL_FALSE, FLOAT_SZ * 4 * 4,
+ ctypes.c_void_p(4 * FLOAT_SZ * i)
+ )
+ glVertexAttribDivisor(idx, 1)
+
+ #######################################################################
+ # Fill element buffer
+ #######################################################################
+ if self.indices is not None:
+ elementbuffer = glGenBuffers(1)
+ self._buffers.append(elementbuffer)
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer)
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, UINT_SZ * self.indices.size,
+ self.indices.flatten().astype(np.uint32),
+ GL_STATIC_DRAW)
+
+ glBindVertexArray(0)
+
+ def _remove_from_context(self):
+ if self._vaid is not None:
+ glDeleteVertexArrays(1, [self._vaid])
+ glDeleteBuffers(len(self._buffers), self._buffers)
+ self._vaid = None
+ self._buffers = []
+
+ def _in_context(self):
+ return self._vaid is not None
+
+ def _bind(self):
+ if self._vaid is None:
+ raise ValueError('Cannot bind a Mesh that has not been added '
+ 'to a context')
+ glBindVertexArray(self._vaid)
+
+ def _unbind(self):
+ glBindVertexArray(0)
+
+ def _compute_bounds(self):
+ """Compute the bounds of this object.
+ """
+ # Compute bounds of this object
+ bounds = np.array([np.min(self.positions, axis=0),
+ np.max(self.positions, axis=0)])
+
+ # If instanced, compute translations for approximate bounds
+ if self.poses is not None:
+ bounds += np.array([np.min(self.poses[:,:3,3], axis=0),
+ np.max(self.poses[:,:3,3], axis=0)])
+ return bounds
+
+ def _compute_transparency(self):
+ """Compute whether or not this object is transparent.
+ """
+ if self.material.is_transparent:
+ return True
+ if self._is_transparent is None:
+ self._is_transparent = False
+ if self.color_0 is not None:
+ if np.any(self._color_0[:,3] != 1.0):
+ self._is_transparent = True
+ return self._is_transparent
+
+ def _compute_buf_flags(self):
+ buf_flags = BufFlags.POSITION
+
+ if self.normals is not None:
+ buf_flags |= BufFlags.NORMAL
+ if self.tangents is not None:
+ buf_flags |= BufFlags.TANGENT
+ if self.texcoord_0 is not None:
+ buf_flags |= BufFlags.TEXCOORD_0
+ if self.texcoord_1 is not None:
+ buf_flags |= BufFlags.TEXCOORD_1
+ if self.color_0 is not None:
+ buf_flags |= BufFlags.COLOR_0
+ if self.joints_0 is not None:
+ buf_flags |= BufFlags.JOINTS_0
+ if self.weights_0 is not None:
+ buf_flags |= BufFlags.WEIGHTS_0
+
+ return buf_flags
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/renderer.py b/generate_human_motion/pyrender/build/lib/pyrender/renderer.py
new file mode 100644
index 0000000000000000000000000000000000000000..5ae14c5cdb1785226a52ae6b71b08f01de069962
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/renderer.py
@@ -0,0 +1,1339 @@
+"""PBR renderer for Python.
+
+Author: Matthew Matl
+"""
+import sys
+
+import numpy as np
+import PIL
+
+from .constants import (RenderFlags, TextAlign, GLTF, BufFlags, TexFlags,
+ ProgramFlags, DEFAULT_Z_FAR, DEFAULT_Z_NEAR,
+ SHADOW_TEX_SZ, MAX_N_LIGHTS)
+from .shader_program import ShaderProgramCache
+from .material import MetallicRoughnessMaterial, SpecularGlossinessMaterial
+from .light import PointLight, SpotLight, DirectionalLight
+from .font import FontCache
+from .utils import format_color_vector
+
+from OpenGL.GL import *
+
+
+class Renderer(object):
+ """Class for handling all rendering operations on a scene.
+
+ Note
+ ----
+ This renderer relies on the existence of an OpenGL context and
+ does not create one on its own.
+
+ Parameters
+ ----------
+ viewport_width : int
+ Width of the viewport in pixels.
+ viewport_height : int
+ Width of the viewport height in pixels.
+ point_size : float, optional
+ Size of points in pixels. Defaults to 1.0.
+ """
+
+ def __init__(self, viewport_width, viewport_height, point_size=1.0):
+ self.dpscale = 1
+ # Scaling needed on retina displays
+ if sys.platform == 'darwin':
+ self.dpscale = 2
+
+ self.viewport_width = viewport_width
+ self.viewport_height = viewport_height
+ self.point_size = point_size
+
+ # Optional framebuffer for offscreen renders
+ self._main_fb = None
+ self._main_cb = None
+ self._main_db = None
+ self._main_fb_ms = None
+ self._main_cb_ms = None
+ self._main_db_ms = None
+ self._main_fb_dims = (None, None)
+ self._shadow_fb = None
+ self._latest_znear = DEFAULT_Z_NEAR
+ self._latest_zfar = DEFAULT_Z_FAR
+
+ # Shader Program Cache
+ self._program_cache = ShaderProgramCache()
+ self._font_cache = FontCache()
+ self._meshes = set()
+ self._mesh_textures = set()
+ self._shadow_textures = set()
+ self._texture_alloc_idx = 0
+
+ @property
+ def viewport_width(self):
+ """int : The width of the main viewport, in pixels.
+ """
+ return self._viewport_width
+
+ @viewport_width.setter
+ def viewport_width(self, value):
+ self._viewport_width = self.dpscale * value
+
+ @property
+ def viewport_height(self):
+ """int : The height of the main viewport, in pixels.
+ """
+ return self._viewport_height
+
+ @viewport_height.setter
+ def viewport_height(self, value):
+ self._viewport_height = self.dpscale * value
+
+ @property
+ def point_size(self):
+ """float : The size of screen-space points, in pixels.
+ """
+ return self._point_size
+
+ @point_size.setter
+ def point_size(self, value):
+ self._point_size = float(value)
+
+ def render(self, scene, flags, seg_node_map=None):
+ """Render a scene with the given set of flags.
+
+ Parameters
+ ----------
+ scene : :class:`Scene`
+ A scene to render.
+ flags : int
+ A specification from :class:`.RenderFlags`.
+ seg_node_map : dict
+ A map from :class:`.Node` objects to (3,) colors for each.
+ If specified along with flags set to :attr:`.RenderFlags.SEG`,
+ the color image will be a segmentation image.
+
+ Returns
+ -------
+ color_im : (h, w, 3) uint8 or (h, w, 4) uint8
+ If :attr:`RenderFlags.OFFSCREEN` is set, the color buffer. This is
+ normally an RGB buffer, but if :attr:`.RenderFlags.RGBA` is set,
+ the buffer will be a full RGBA buffer.
+ depth_im : (h, w) float32
+ If :attr:`RenderFlags.OFFSCREEN` is set, the depth buffer
+ in linear units.
+ """
+ # Update context with meshes and textures
+ self._update_context(scene, flags)
+
+ # Render necessary shadow maps
+ if not bool(flags & RenderFlags.DEPTH_ONLY or flags & RenderFlags.SEG):
+ for ln in scene.light_nodes:
+ take_pass = False
+ if (isinstance(ln.light, DirectionalLight) and
+ bool(flags & RenderFlags.SHADOWS_DIRECTIONAL)):
+ take_pass = True
+ elif (isinstance(ln.light, SpotLight) and
+ bool(flags & RenderFlags.SHADOWS_SPOT)):
+ take_pass = True
+ elif (isinstance(ln.light, PointLight) and
+ bool(flags & RenderFlags.SHADOWS_POINT)):
+ take_pass = True
+ if take_pass:
+ self._shadow_mapping_pass(scene, ln, flags)
+
+ # Make forward pass
+ retval = self._forward_pass(scene, flags, seg_node_map=seg_node_map)
+
+ # If necessary, make normals pass
+ if flags & (RenderFlags.VERTEX_NORMALS | RenderFlags.FACE_NORMALS):
+ self._normals_pass(scene, flags)
+
+ # Update camera settings for retrieving depth buffers
+ self._latest_znear = scene.main_camera_node.camera.znear
+ self._latest_zfar = scene.main_camera_node.camera.zfar
+
+ return retval
+
+ def render_text(self, text, x, y, font_name='OpenSans-Regular',
+ font_pt=40, color=None, scale=1.0,
+ align=TextAlign.BOTTOM_LEFT):
+ """Render text into the current viewport.
+
+ Note
+ ----
+ This cannot be done into an offscreen buffer.
+
+ Parameters
+ ----------
+ text : str
+ The text to render.
+ x : int
+ Horizontal pixel location of text.
+ y : int
+ Vertical pixel location of text.
+ font_name : str
+ Name of font, from the ``pyrender/fonts`` folder, or
+ a path to a ``.ttf`` file.
+ font_pt : int
+ Height of the text, in font points.
+ color : (4,) float
+ The color of the text. Default is black.
+ scale : int
+ Scaling factor for text.
+ align : int
+ One of the :class:`TextAlign` options which specifies where the
+ ``x`` and ``y`` parameters lie on the text. For example,
+ :attr:`TextAlign.BOTTOM_LEFT` means that ``x`` and ``y`` indicate
+ the position of the bottom-left corner of the textbox.
+ """
+ x *= self.dpscale
+ y *= self.dpscale
+ font_pt *= self.dpscale
+
+ if color is None:
+ color = np.array([0.0, 0.0, 0.0, 1.0])
+ else:
+ color = format_color_vector(color, 4)
+
+ # Set up viewport for render
+ self._configure_forward_pass_viewport(0)
+
+ # Load font
+ font = self._font_cache.get_font(font_name, font_pt)
+ if not font._in_context():
+ font._add_to_context()
+
+ # Load program
+ program = self._get_text_program()
+ program._bind()
+
+ # Set uniforms
+ p = np.eye(4)
+ p[0,0] = 2.0 / self.viewport_width
+ p[0,3] = -1.0
+ p[1,1] = 2.0 / self.viewport_height
+ p[1,3] = -1.0
+ program.set_uniform('projection', p)
+ program.set_uniform('text_color', color)
+
+ # Draw text
+ font.render_string(text, x, y, scale, align)
+
+ def read_color_buf(self):
+ """Read and return the current viewport's color buffer.
+
+ Alpha cannot be computed for an on-screen buffer.
+
+ Returns
+ -------
+ color_im : (h, w, 3) uint8
+ The color buffer in RGB byte format.
+ """
+ # Extract color image from frame buffer
+ width, height = self.viewport_width, self.viewport_height
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0)
+ glReadBuffer(GL_FRONT)
+ color_buf = glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE)
+
+ # Re-format them into numpy arrays
+ color_im = np.frombuffer(color_buf, dtype=np.uint8)
+ color_im = color_im.reshape((height, width, 3))
+ color_im = np.flip(color_im, axis=0)
+
+ # Resize for macos if needed
+ if sys.platform == 'darwin':
+ color_im = self._resize_image(color_im, True)
+
+ return color_im
+
+ def read_depth_buf(self):
+ """Read and return the current viewport's color buffer.
+
+ Returns
+ -------
+ depth_im : (h, w) float32
+ The depth buffer in linear units.
+ """
+ width, height = self.viewport_width, self.viewport_height
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0)
+ glReadBuffer(GL_FRONT)
+ depth_buf = glReadPixels(
+ 0, 0, width, height, GL_DEPTH_COMPONENT, GL_FLOAT
+ )
+
+ depth_im = np.frombuffer(depth_buf, dtype=np.float32)
+ depth_im = depth_im.reshape((height, width))
+ depth_im = np.flip(depth_im, axis=0)
+
+ inf_inds = (depth_im == 1.0)
+ depth_im = 2.0 * depth_im - 1.0
+ z_near, z_far = self._latest_znear, self._latest_zfar
+ noninf = np.logical_not(inf_inds)
+ if z_far is None:
+ depth_im[noninf] = 2 * z_near / (1.0 - depth_im[noninf])
+ else:
+ depth_im[noninf] = ((2.0 * z_near * z_far) /
+ (z_far + z_near - depth_im[noninf] *
+ (z_far - z_near)))
+ depth_im[inf_inds] = 0.0
+
+ # Resize for macos if needed
+ if sys.platform == 'darwin':
+ depth_im = self._resize_image(depth_im)
+
+ return depth_im
+
+ def delete(self):
+ """Free all allocated OpenGL resources.
+ """
+ # Free shaders
+ self._program_cache.clear()
+
+ # Free fonts
+ self._font_cache.clear()
+
+ # Free meshes
+ for mesh in self._meshes:
+ for p in mesh.primitives:
+ p.delete()
+
+ # Free textures
+ for mesh_texture in self._mesh_textures:
+ mesh_texture.delete()
+
+ for shadow_texture in self._shadow_textures:
+ shadow_texture.delete()
+
+ self._meshes = set()
+ self._mesh_textures = set()
+ self._shadow_textures = set()
+ self._texture_alloc_idx = 0
+
+ self._delete_main_framebuffer()
+ self._delete_shadow_framebuffer()
+
+ def __del__(self):
+ try:
+ self.delete()
+ except Exception:
+ pass
+
+ ###########################################################################
+ # Rendering passes
+ ###########################################################################
+
+ def _forward_pass(self, scene, flags, seg_node_map=None):
+ # Set up viewport for render
+ self._configure_forward_pass_viewport(flags)
+
+ # Clear it
+ if bool(flags & RenderFlags.SEG):
+ glClearColor(0.0, 0.0, 0.0, 1.0)
+ if seg_node_map is None:
+ seg_node_map = {}
+ else:
+ glClearColor(*scene.bg_color)
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
+
+ if not bool(flags & RenderFlags.SEG):
+ glEnable(GL_MULTISAMPLE)
+ else:
+ glDisable(GL_MULTISAMPLE)
+
+ # Set up camera matrices
+ V, P = self._get_camera_matrices(scene)
+
+ program = None
+ # Now, render each object in sorted order
+ for node in self._sorted_mesh_nodes(scene):
+ mesh = node.mesh
+
+ # Skip the mesh if it's not visible
+ if not mesh.is_visible:
+ continue
+
+ # If SEG, set color
+ if bool(flags & RenderFlags.SEG):
+ if node not in seg_node_map:
+ continue
+ color = seg_node_map[node]
+ if not isinstance(color, (list, tuple, np.ndarray)):
+ color = np.repeat(color, 3)
+ else:
+ color = np.asanyarray(color)
+ color = color / 255.0
+
+ for primitive in mesh.primitives:
+
+ # First, get and bind the appropriate program
+ program = self._get_primitive_program(
+ primitive, flags, ProgramFlags.USE_MATERIAL
+ )
+ program._bind()
+
+ # Set the camera uniforms
+ program.set_uniform('V', V)
+ program.set_uniform('P', P)
+ program.set_uniform(
+ 'cam_pos', scene.get_pose(scene.main_camera_node)[:3,3]
+ )
+ if bool(flags & RenderFlags.SEG):
+ program.set_uniform('color', color)
+
+ # Next, bind the lighting
+ if not (flags & RenderFlags.DEPTH_ONLY or flags & RenderFlags.FLAT or
+ flags & RenderFlags.SEG):
+ self._bind_lighting(scene, program, node, flags)
+
+ # Finally, bind and draw the primitive
+ self._bind_and_draw_primitive(
+ primitive=primitive,
+ pose=scene.get_pose(node),
+ program=program,
+ flags=flags
+ )
+ self._reset_active_textures()
+
+ # Unbind the shader and flush the output
+ if program is not None:
+ program._unbind()
+ glFlush()
+
+ # If doing offscreen render, copy result from framebuffer and return
+ if flags & RenderFlags.OFFSCREEN:
+ return self._read_main_framebuffer(scene, flags)
+ else:
+ return
+
+ def _shadow_mapping_pass(self, scene, light_node, flags):
+ light = light_node.light
+
+ # Set up viewport for render
+ self._configure_shadow_mapping_viewport(light, flags)
+
+ # Set up camera matrices
+ V, P = self._get_light_cam_matrices(scene, light_node, flags)
+
+ # Now, render each object in sorted order
+ for node in self._sorted_mesh_nodes(scene):
+ mesh = node.mesh
+
+ # Skip the mesh if it's not visible
+ if not mesh.is_visible:
+ continue
+
+ for primitive in mesh.primitives:
+
+ # First, get and bind the appropriate program
+ program = self._get_primitive_program(
+ primitive, flags, ProgramFlags.NONE
+ )
+ program._bind()
+
+ # Set the camera uniforms
+ program.set_uniform('V', V)
+ program.set_uniform('P', P)
+ program.set_uniform(
+ 'cam_pos', scene.get_pose(scene.main_camera_node)[:3,3]
+ )
+
+ # Finally, bind and draw the primitive
+ self._bind_and_draw_primitive(
+ primitive=primitive,
+ pose=scene.get_pose(node),
+ program=program,
+ flags=RenderFlags.DEPTH_ONLY
+ )
+ self._reset_active_textures()
+
+ # Unbind the shader and flush the output
+ if program is not None:
+ program._unbind()
+ glFlush()
+
+ def _normals_pass(self, scene, flags):
+ # Set up viewport for render
+ self._configure_forward_pass_viewport(flags)
+ program = None
+
+ # Set up camera matrices
+ V, P = self._get_camera_matrices(scene)
+
+ # Now, render each object in sorted order
+ for node in self._sorted_mesh_nodes(scene):
+ mesh = node.mesh
+
+ # Skip the mesh if it's not visible
+ if not mesh.is_visible:
+ continue
+
+ for primitive in mesh.primitives:
+
+ # Skip objects that don't have normals
+ if not primitive.buf_flags & BufFlags.NORMAL:
+ continue
+
+ # First, get and bind the appropriate program
+ pf = ProgramFlags.NONE
+ if flags & RenderFlags.VERTEX_NORMALS:
+ pf = pf | ProgramFlags.VERTEX_NORMALS
+ if flags & RenderFlags.FACE_NORMALS:
+ pf = pf | ProgramFlags.FACE_NORMALS
+ program = self._get_primitive_program(primitive, flags, pf)
+ program._bind()
+
+ # Set the camera uniforms
+ program.set_uniform('V', V)
+ program.set_uniform('P', P)
+ program.set_uniform('normal_magnitude', 0.05 * primitive.scale)
+ program.set_uniform(
+ 'normal_color', np.array([0.1, 0.1, 1.0, 1.0])
+ )
+
+ # Finally, bind and draw the primitive
+ self._bind_and_draw_primitive(
+ primitive=primitive,
+ pose=scene.get_pose(node),
+ program=program,
+ flags=RenderFlags.DEPTH_ONLY
+ )
+ self._reset_active_textures()
+
+ # Unbind the shader and flush the output
+ if program is not None:
+ program._unbind()
+ glFlush()
+
+ ###########################################################################
+ # Handlers for binding uniforms and drawing primitives
+ ###########################################################################
+
+ def _bind_and_draw_primitive(self, primitive, pose, program, flags):
+ # Set model pose matrix
+ program.set_uniform('M', pose)
+
+ # Bind mesh buffers
+ primitive._bind()
+
+ # Bind mesh material
+ if not (flags & RenderFlags.DEPTH_ONLY or flags & RenderFlags.SEG):
+ material = primitive.material
+
+ # Bind textures
+ tf = material.tex_flags
+ if tf & TexFlags.NORMAL:
+ self._bind_texture(material.normalTexture,
+ 'material.normal_texture', program)
+ if tf & TexFlags.OCCLUSION:
+ self._bind_texture(material.occlusionTexture,
+ 'material.occlusion_texture', program)
+ if tf & TexFlags.EMISSIVE:
+ self._bind_texture(material.emissiveTexture,
+ 'material.emissive_texture', program)
+ if tf & TexFlags.BASE_COLOR:
+ self._bind_texture(material.baseColorTexture,
+ 'material.base_color_texture', program)
+ if tf & TexFlags.METALLIC_ROUGHNESS:
+ self._bind_texture(material.metallicRoughnessTexture,
+ 'material.metallic_roughness_texture',
+ program)
+ if tf & TexFlags.DIFFUSE:
+ self._bind_texture(material.diffuseTexture,
+ 'material.diffuse_texture', program)
+ if tf & TexFlags.SPECULAR_GLOSSINESS:
+ self._bind_texture(material.specularGlossinessTexture,
+ 'material.specular_glossiness_texture',
+ program)
+
+ # Bind other uniforms
+ b = 'material.{}'
+ program.set_uniform(b.format('emissive_factor'),
+ material.emissiveFactor)
+ if isinstance(material, MetallicRoughnessMaterial):
+ program.set_uniform(b.format('base_color_factor'),
+ material.baseColorFactor)
+ program.set_uniform(b.format('metallic_factor'),
+ material.metallicFactor)
+ program.set_uniform(b.format('roughness_factor'),
+ material.roughnessFactor)
+ elif isinstance(material, SpecularGlossinessMaterial):
+ program.set_uniform(b.format('diffuse_factor'),
+ material.diffuseFactor)
+ program.set_uniform(b.format('specular_factor'),
+ material.specularFactor)
+ program.set_uniform(b.format('glossiness_factor'),
+ material.glossinessFactor)
+
+ # Set blending options
+ if material.alphaMode == 'BLEND':
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+ else:
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_ONE, GL_ZERO)
+
+ # Set wireframe mode
+ wf = material.wireframe
+ if flags & RenderFlags.FLIP_WIREFRAME:
+ wf = not wf
+ if (flags & RenderFlags.ALL_WIREFRAME) or wf:
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
+ else:
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
+
+ # Set culling mode
+ if material.doubleSided or flags & RenderFlags.SKIP_CULL_FACES:
+ glDisable(GL_CULL_FACE)
+ else:
+ glEnable(GL_CULL_FACE)
+ glCullFace(GL_BACK)
+ else:
+ glEnable(GL_CULL_FACE)
+ glEnable(GL_BLEND)
+ glCullFace(GL_BACK)
+ glBlendFunc(GL_ONE, GL_ZERO)
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
+
+ # Set point size if needed
+ glDisable(GL_PROGRAM_POINT_SIZE)
+ if primitive.mode == GLTF.POINTS:
+ glEnable(GL_PROGRAM_POINT_SIZE)
+ glPointSize(self.point_size)
+
+ # Render mesh
+ n_instances = 1
+ if primitive.poses is not None:
+ n_instances = len(primitive.poses)
+
+ if primitive.indices is not None:
+ glDrawElementsInstanced(
+ primitive.mode, primitive.indices.size, GL_UNSIGNED_INT,
+ ctypes.c_void_p(0), n_instances
+ )
+ else:
+ glDrawArraysInstanced(
+ primitive.mode, 0, len(primitive.positions), n_instances
+ )
+
+ # Unbind mesh buffers
+ primitive._unbind()
+
+ def _bind_lighting(self, scene, program, node, flags):
+ """Bind all lighting uniform values for a scene.
+ """
+ max_n_lights = self._compute_max_n_lights(flags)
+
+ n_d = min(len(scene.directional_light_nodes), max_n_lights[0])
+ n_s = min(len(scene.spot_light_nodes), max_n_lights[1])
+ n_p = min(len(scene.point_light_nodes), max_n_lights[2])
+ program.set_uniform('ambient_light', scene.ambient_light)
+ program.set_uniform('n_directional_lights', n_d)
+ program.set_uniform('n_spot_lights', n_s)
+ program.set_uniform('n_point_lights', n_p)
+ plc = 0
+ slc = 0
+ dlc = 0
+
+ light_nodes = scene.light_nodes
+ if (len(scene.directional_light_nodes) > max_n_lights[0] or
+ len(scene.spot_light_nodes) > max_n_lights[1] or
+ len(scene.point_light_nodes) > max_n_lights[2]):
+ light_nodes = self._sorted_nodes_by_distance(
+ scene, scene.light_nodes, node
+ )
+
+ for n in light_nodes:
+ light = n.light
+ pose = scene.get_pose(n)
+ position = pose[:3,3]
+ direction = -pose[:3,2]
+
+ if isinstance(light, PointLight):
+ if plc == max_n_lights[2]:
+ continue
+ b = 'point_lights[{}].'.format(plc)
+ plc += 1
+ shadow = bool(flags & RenderFlags.SHADOWS_POINT)
+ program.set_uniform(b + 'position', position)
+ elif isinstance(light, SpotLight):
+ if slc == max_n_lights[1]:
+ continue
+ b = 'spot_lights[{}].'.format(slc)
+ slc += 1
+ shadow = bool(flags & RenderFlags.SHADOWS_SPOT)
+ las = 1.0 / max(0.001, np.cos(light.innerConeAngle) -
+ np.cos(light.outerConeAngle))
+ lao = -np.cos(light.outerConeAngle) * las
+ program.set_uniform(b + 'direction', direction)
+ program.set_uniform(b + 'position', position)
+ program.set_uniform(b + 'light_angle_scale', las)
+ program.set_uniform(b + 'light_angle_offset', lao)
+ else:
+ if dlc == max_n_lights[0]:
+ continue
+ b = 'directional_lights[{}].'.format(dlc)
+ dlc += 1
+ shadow = bool(flags & RenderFlags.SHADOWS_DIRECTIONAL)
+ program.set_uniform(b + 'direction', direction)
+
+ program.set_uniform(b + 'color', light.color)
+ program.set_uniform(b + 'intensity', light.intensity)
+ # if light.range is not None:
+ # program.set_uniform(b + 'range', light.range)
+ # else:
+ # program.set_uniform(b + 'range', 0)
+
+ if shadow:
+ self._bind_texture(light.shadow_texture,
+ b + 'shadow_map', program)
+ if not isinstance(light, PointLight):
+ V, P = self._get_light_cam_matrices(scene, n, flags)
+ program.set_uniform(b + 'light_matrix', P.dot(V))
+ else:
+ raise NotImplementedError(
+ 'Point light shadows not implemented'
+ )
+
+ def _sorted_mesh_nodes(self, scene):
+ cam_loc = scene.get_pose(scene.main_camera_node)[:3,3]
+ solid_nodes = []
+ trans_nodes = []
+ for node in scene.mesh_nodes:
+ mesh = node.mesh
+ if mesh.is_transparent:
+ trans_nodes.append(node)
+ else:
+ solid_nodes.append(node)
+
+ # TODO BETTER SORTING METHOD
+ trans_nodes.sort(
+ key=lambda n: -np.linalg.norm(scene.get_pose(n)[:3,3] - cam_loc)
+ )
+ solid_nodes.sort(
+ key=lambda n: -np.linalg.norm(scene.get_pose(n)[:3,3] - cam_loc)
+ )
+
+ return solid_nodes + trans_nodes
+
+ def _sorted_nodes_by_distance(self, scene, nodes, compare_node):
+ nodes = list(nodes)
+ compare_posn = scene.get_pose(compare_node)[:3,3]
+ nodes.sort(key=lambda n: np.linalg.norm(
+ scene.get_pose(n)[:3,3] - compare_posn)
+ )
+ return nodes
+
+ ###########################################################################
+ # Context Management
+ ###########################################################################
+
+ def _update_context(self, scene, flags):
+
+ # Update meshes
+ scene_meshes = scene.meshes
+
+ # Add new meshes to context
+ for mesh in scene_meshes - self._meshes:
+ for p in mesh.primitives:
+ p._add_to_context()
+
+ # Remove old meshes from context
+ for mesh in self._meshes - scene_meshes:
+ for p in mesh.primitives:
+ p.delete()
+
+ self._meshes = scene_meshes.copy()
+
+ # Update mesh textures
+ mesh_textures = set()
+ for m in scene_meshes:
+ for p in m.primitives:
+ mesh_textures |= p.material.textures
+
+ # Add new textures to context
+ for texture in mesh_textures - self._mesh_textures:
+ texture._add_to_context()
+
+ # Remove old textures from context
+ for texture in self._mesh_textures - mesh_textures:
+ texture.delete()
+
+ self._mesh_textures = mesh_textures.copy()
+
+ shadow_textures = set()
+ for l in scene.lights:
+ # Create if needed
+ active = False
+ if (isinstance(l, DirectionalLight) and
+ flags & RenderFlags.SHADOWS_DIRECTIONAL):
+ active = True
+ elif (isinstance(l, PointLight) and
+ flags & RenderFlags.SHADOWS_POINT):
+ active = True
+ elif isinstance(l, SpotLight) and flags & RenderFlags.SHADOWS_SPOT:
+ active = True
+
+ if active and l.shadow_texture is None:
+ l._generate_shadow_texture()
+ if l.shadow_texture is not None:
+ shadow_textures.add(l.shadow_texture)
+
+ # Add new textures to context
+ for texture in shadow_textures - self._shadow_textures:
+ texture._add_to_context()
+
+ # Remove old textures from context
+ for texture in self._shadow_textures - shadow_textures:
+ texture.delete()
+
+ self._shadow_textures = shadow_textures.copy()
+
+ ###########################################################################
+ # Texture Management
+ ###########################################################################
+
+ def _bind_texture(self, texture, uniform_name, program):
+ """Bind a texture to an active texture unit and return
+ the texture unit index that was used.
+ """
+ tex_id = self._get_next_active_texture()
+ glActiveTexture(GL_TEXTURE0 + tex_id)
+ texture._bind()
+ program.set_uniform(uniform_name, tex_id)
+
+ def _get_next_active_texture(self):
+ val = self._texture_alloc_idx
+ self._texture_alloc_idx += 1
+ return val
+
+ def _reset_active_textures(self):
+ self._texture_alloc_idx = 0
+
+ ###########################################################################
+ # Camera Matrix Management
+ ###########################################################################
+
+ def _get_camera_matrices(self, scene):
+ main_camera_node = scene.main_camera_node
+ if main_camera_node is None:
+ raise ValueError('Cannot render scene without a camera')
+ P = main_camera_node.camera.get_projection_matrix(
+ width=self.viewport_width, height=self.viewport_height
+ )
+ pose = scene.get_pose(main_camera_node)
+ V = np.linalg.inv(pose) # V maps from world to camera
+ return V, P
+
+ def _get_light_cam_matrices(self, scene, light_node, flags):
+ light = light_node.light
+ pose = scene.get_pose(light_node).copy()
+ s = scene.scale
+ camera = light._get_shadow_camera(s)
+ P = camera.get_projection_matrix()
+ if isinstance(light, DirectionalLight):
+ direction = -pose[:3,2]
+ c = scene.centroid
+ loc = c - direction * s
+ pose[:3,3] = loc
+ V = np.linalg.inv(pose) # V maps from world to camera
+ return V, P
+
+ ###########################################################################
+ # Shader Program Management
+ ###########################################################################
+
+ def _get_text_program(self):
+ program = self._program_cache.get_program(
+ vertex_shader='text.vert',
+ fragment_shader='text.frag'
+ )
+
+ if not program._in_context():
+ program._add_to_context()
+
+ return program
+
+ def _compute_max_n_lights(self, flags):
+ max_n_lights = [MAX_N_LIGHTS, MAX_N_LIGHTS, MAX_N_LIGHTS]
+ n_tex_units = glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS)
+
+ # Reserved texture units: 6
+ # Normal Map
+ # Occlusion Map
+ # Emissive Map
+ # Base Color or Diffuse Map
+ # MR or SG Map
+ # Environment cubemap
+
+ n_reserved_textures = 6
+ n_available_textures = n_tex_units - n_reserved_textures
+
+ # Distribute textures evenly among lights with shadows, with
+ # a preference for directional lights
+ n_shadow_types = 0
+ if flags & RenderFlags.SHADOWS_DIRECTIONAL:
+ n_shadow_types += 1
+ if flags & RenderFlags.SHADOWS_SPOT:
+ n_shadow_types += 1
+ if flags & RenderFlags.SHADOWS_POINT:
+ n_shadow_types += 1
+
+ if n_shadow_types > 0:
+ tex_per_light = n_available_textures // n_shadow_types
+
+ if flags & RenderFlags.SHADOWS_DIRECTIONAL:
+ max_n_lights[0] = (
+ tex_per_light +
+ (n_available_textures - tex_per_light * n_shadow_types)
+ )
+ if flags & RenderFlags.SHADOWS_SPOT:
+ max_n_lights[1] = tex_per_light
+ if flags & RenderFlags.SHADOWS_POINT:
+ max_n_lights[2] = tex_per_light
+
+ return max_n_lights
+
+ def _get_primitive_program(self, primitive, flags, program_flags):
+ vertex_shader = None
+ fragment_shader = None
+ geometry_shader = None
+ defines = {}
+
+ if (bool(program_flags & ProgramFlags.USE_MATERIAL) and
+ not flags & RenderFlags.DEPTH_ONLY and
+ not flags & RenderFlags.FLAT and
+ not flags & RenderFlags.SEG):
+ vertex_shader = 'mesh.vert'
+ fragment_shader = 'mesh.frag'
+ elif bool(program_flags & (ProgramFlags.VERTEX_NORMALS |
+ ProgramFlags.FACE_NORMALS)):
+ vertex_shader = 'vertex_normals.vert'
+ if primitive.mode == GLTF.POINTS:
+ geometry_shader = 'vertex_normals_pc.geom'
+ else:
+ geometry_shader = 'vertex_normals.geom'
+ fragment_shader = 'vertex_normals.frag'
+ elif flags & RenderFlags.FLAT:
+ vertex_shader = 'flat.vert'
+ fragment_shader = 'flat.frag'
+ elif flags & RenderFlags.SEG:
+ vertex_shader = 'segmentation.vert'
+ fragment_shader = 'segmentation.frag'
+ else:
+ vertex_shader = 'mesh_depth.vert'
+ fragment_shader = 'mesh_depth.frag'
+
+ # Set up vertex buffer DEFINES
+ bf = primitive.buf_flags
+ buf_idx = 1
+ if bf & BufFlags.NORMAL:
+ defines['NORMAL_LOC'] = buf_idx
+ buf_idx += 1
+ if bf & BufFlags.TANGENT:
+ defines['TANGENT_LOC'] = buf_idx
+ buf_idx += 1
+ if bf & BufFlags.TEXCOORD_0:
+ defines['TEXCOORD_0_LOC'] = buf_idx
+ buf_idx += 1
+ if bf & BufFlags.TEXCOORD_1:
+ defines['TEXCOORD_1_LOC'] = buf_idx
+ buf_idx += 1
+ if bf & BufFlags.COLOR_0:
+ defines['COLOR_0_LOC'] = buf_idx
+ buf_idx += 1
+ if bf & BufFlags.JOINTS_0:
+ defines['JOINTS_0_LOC'] = buf_idx
+ buf_idx += 1
+ if bf & BufFlags.WEIGHTS_0:
+ defines['WEIGHTS_0_LOC'] = buf_idx
+ buf_idx += 1
+ defines['INST_M_LOC'] = buf_idx
+
+ # Set up shadow mapping defines
+ if flags & RenderFlags.SHADOWS_DIRECTIONAL:
+ defines['DIRECTIONAL_LIGHT_SHADOWS'] = 1
+ if flags & RenderFlags.SHADOWS_SPOT:
+ defines['SPOT_LIGHT_SHADOWS'] = 1
+ if flags & RenderFlags.SHADOWS_POINT:
+ defines['POINT_LIGHT_SHADOWS'] = 1
+ max_n_lights = self._compute_max_n_lights(flags)
+ defines['MAX_DIRECTIONAL_LIGHTS'] = max_n_lights[0]
+ defines['MAX_SPOT_LIGHTS'] = max_n_lights[1]
+ defines['MAX_POINT_LIGHTS'] = max_n_lights[2]
+
+ # Set up vertex normal defines
+ if program_flags & ProgramFlags.VERTEX_NORMALS:
+ defines['VERTEX_NORMALS'] = 1
+ if program_flags & ProgramFlags.FACE_NORMALS:
+ defines['FACE_NORMALS'] = 1
+
+ # Set up material texture defines
+ if bool(program_flags & ProgramFlags.USE_MATERIAL):
+ tf = primitive.material.tex_flags
+ if tf & TexFlags.NORMAL:
+ defines['HAS_NORMAL_TEX'] = 1
+ if tf & TexFlags.OCCLUSION:
+ defines['HAS_OCCLUSION_TEX'] = 1
+ if tf & TexFlags.EMISSIVE:
+ defines['HAS_EMISSIVE_TEX'] = 1
+ if tf & TexFlags.BASE_COLOR:
+ defines['HAS_BASE_COLOR_TEX'] = 1
+ if tf & TexFlags.METALLIC_ROUGHNESS:
+ defines['HAS_METALLIC_ROUGHNESS_TEX'] = 1
+ if tf & TexFlags.DIFFUSE:
+ defines['HAS_DIFFUSE_TEX'] = 1
+ if tf & TexFlags.SPECULAR_GLOSSINESS:
+ defines['HAS_SPECULAR_GLOSSINESS_TEX'] = 1
+ if isinstance(primitive.material, MetallicRoughnessMaterial):
+ defines['USE_METALLIC_MATERIAL'] = 1
+ elif isinstance(primitive.material, SpecularGlossinessMaterial):
+ defines['USE_GLOSSY_MATERIAL'] = 1
+
+ program = self._program_cache.get_program(
+ vertex_shader=vertex_shader,
+ fragment_shader=fragment_shader,
+ geometry_shader=geometry_shader,
+ defines=defines
+ )
+
+ if not program._in_context():
+ program._add_to_context()
+
+ return program
+
+ ###########################################################################
+ # Viewport Management
+ ###########################################################################
+
+ def _configure_forward_pass_viewport(self, flags):
+
+ # If using offscreen render, bind main framebuffer
+ if flags & RenderFlags.OFFSCREEN:
+ self._configure_main_framebuffer()
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, self._main_fb_ms)
+ else:
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0)
+
+ glViewport(0, 0, self.viewport_width, self.viewport_height)
+ glEnable(GL_DEPTH_TEST)
+ glDepthMask(GL_TRUE)
+ glDepthFunc(GL_LESS)
+ glDepthRange(0.0, 1.0)
+
+ def _configure_shadow_mapping_viewport(self, light, flags):
+ self._configure_shadow_framebuffer()
+ glBindFramebuffer(GL_FRAMEBUFFER, self._shadow_fb)
+ light.shadow_texture._bind()
+ light.shadow_texture._bind_as_depth_attachment()
+ glActiveTexture(GL_TEXTURE0)
+ light.shadow_texture._bind()
+ glDrawBuffer(GL_NONE)
+ glReadBuffer(GL_NONE)
+
+ glClear(GL_DEPTH_BUFFER_BIT)
+ glViewport(0, 0, SHADOW_TEX_SZ, SHADOW_TEX_SZ)
+ glEnable(GL_DEPTH_TEST)
+ glDepthMask(GL_TRUE)
+ glDepthFunc(GL_LESS)
+ glDepthRange(0.0, 1.0)
+ glDisable(GL_CULL_FACE)
+ glDisable(GL_BLEND)
+
+ ###########################################################################
+ # Framebuffer Management
+ ###########################################################################
+
+ def _configure_shadow_framebuffer(self):
+ if self._shadow_fb is None:
+ self._shadow_fb = glGenFramebuffers(1)
+
+ def _delete_shadow_framebuffer(self):
+ if self._shadow_fb is not None:
+ glDeleteFramebuffers(1, [self._shadow_fb])
+
+ def _configure_main_framebuffer(self):
+ # If mismatch with prior framebuffer, delete it
+ if (self._main_fb is not None and
+ self.viewport_width != self._main_fb_dims[0] or
+ self.viewport_height != self._main_fb_dims[1]):
+ self._delete_main_framebuffer()
+
+ # If framebuffer doesn't exist, create it
+ if self._main_fb is None:
+ # Generate standard buffer
+ self._main_cb, self._main_db = glGenRenderbuffers(2)
+
+ glBindRenderbuffer(GL_RENDERBUFFER, self._main_cb)
+ glRenderbufferStorage(
+ GL_RENDERBUFFER, GL_RGBA,
+ self.viewport_width, self.viewport_height
+ )
+
+ glBindRenderbuffer(GL_RENDERBUFFER, self._main_db)
+ glRenderbufferStorage(
+ GL_RENDERBUFFER, GL_DEPTH_COMPONENT24,
+ self.viewport_width, self.viewport_height
+ )
+
+ self._main_fb = glGenFramebuffers(1)
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, self._main_fb)
+ glFramebufferRenderbuffer(
+ GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, self._main_cb
+ )
+ glFramebufferRenderbuffer(
+ GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_RENDERBUFFER, self._main_db
+ )
+
+ # Generate multisample buffer
+ self._main_cb_ms, self._main_db_ms = glGenRenderbuffers(2)
+ glBindRenderbuffer(GL_RENDERBUFFER, self._main_cb_ms)
+ # glRenderbufferStorageMultisample(
+ # GL_RENDERBUFFER, 4, GL_RGBA,
+ # self.viewport_width, self.viewport_height
+ # )
+ # glBindRenderbuffer(GL_RENDERBUFFER, self._main_db_ms)
+ # glRenderbufferStorageMultisample(
+ # GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT24,
+ # self.viewport_width, self.viewport_height
+ # )
+ # 增加这一行
+ num_samples = min(glGetIntegerv(GL_MAX_SAMPLES), 4) # No more than GL_MAX_SAMPLES
+
+ # 其实就是把 4 替换成 num_samples,其余不变
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, num_samples, GL_RGBA, self.viewport_width, self.viewport_height)
+
+ glBindRenderbuffer(GL_RENDERBUFFER, self._main_db_ms) # 这行不变
+
+ # 这一行也是将 4 替换成 num_samples
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, num_samples, GL_DEPTH_COMPONENT24, self.viewport_width, self.viewport_height)
+
+ self._main_fb_ms = glGenFramebuffers(1)
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, self._main_fb_ms)
+ glFramebufferRenderbuffer(
+ GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, self._main_cb_ms
+ )
+ glFramebufferRenderbuffer(
+ GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_RENDERBUFFER, self._main_db_ms
+ )
+
+ self._main_fb_dims = (self.viewport_width, self.viewport_height)
+
+ def _delete_main_framebuffer(self):
+ if self._main_fb is not None:
+ glDeleteFramebuffers(2, [self._main_fb, self._main_fb_ms])
+ if self._main_cb is not None:
+ glDeleteRenderbuffers(2, [self._main_cb, self._main_cb_ms])
+ if self._main_db is not None:
+ glDeleteRenderbuffers(2, [self._main_db, self._main_db_ms])
+
+ self._main_fb = None
+ self._main_cb = None
+ self._main_db = None
+ self._main_fb_ms = None
+ self._main_cb_ms = None
+ self._main_db_ms = None
+ self._main_fb_dims = (None, None)
+
+ def _read_main_framebuffer(self, scene, flags):
+ width, height = self._main_fb_dims[0], self._main_fb_dims[1]
+
+ # Bind framebuffer and blit buffers
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, self._main_fb_ms)
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, self._main_fb)
+ glBlitFramebuffer(
+ 0, 0, width, height, 0, 0, width, height,
+ GL_COLOR_BUFFER_BIT, GL_LINEAR
+ )
+ glBlitFramebuffer(
+ 0, 0, width, height, 0, 0, width, height,
+ GL_DEPTH_BUFFER_BIT, GL_NEAREST
+ )
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, self._main_fb)
+
+ # Read depth
+ depth_buf = glReadPixels(
+ 0, 0, width, height, GL_DEPTH_COMPONENT, GL_FLOAT
+ )
+ depth_im = np.frombuffer(depth_buf, dtype=np.float32)
+ depth_im = depth_im.reshape((height, width))
+ depth_im = np.flip(depth_im, axis=0)
+ inf_inds = (depth_im == 1.0)
+ depth_im = 2.0 * depth_im - 1.0
+ z_near = scene.main_camera_node.camera.znear
+ z_far = scene.main_camera_node.camera.zfar
+ noninf = np.logical_not(inf_inds)
+ if z_far is None:
+ depth_im[noninf] = 2 * z_near / (1.0 - depth_im[noninf])
+ else:
+ depth_im[noninf] = ((2.0 * z_near * z_far) /
+ (z_far + z_near - depth_im[noninf] *
+ (z_far - z_near)))
+ depth_im[inf_inds] = 0.0
+
+ # Resize for macos if needed
+ if sys.platform == 'darwin':
+ depth_im = self._resize_image(depth_im)
+
+ if flags & RenderFlags.DEPTH_ONLY:
+ return depth_im
+
+ # Read color
+ if flags & RenderFlags.RGBA:
+ color_buf = glReadPixels(
+ 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE
+ )
+ color_im = np.frombuffer(color_buf, dtype=np.uint8)
+ color_im = color_im.reshape((height, width, 4))
+ else:
+ color_buf = glReadPixels(
+ 0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE
+ )
+ color_im = np.frombuffer(color_buf, dtype=np.uint8)
+ color_im = color_im.reshape((height, width, 3))
+ color_im = np.flip(color_im, axis=0)
+
+ # Resize for macos if needed
+ if sys.platform == 'darwin':
+ color_im = self._resize_image(color_im, True)
+
+ return color_im, depth_im
+
+ def _resize_image(self, value, antialias=False):
+ """If needed, rescale the render for MacOS."""
+ img = PIL.Image.fromarray(value)
+ resample = PIL.Image.NEAREST
+ if antialias:
+ resample = PIL.Image.BILINEAR
+ size = (self.viewport_width // self.dpscale,
+ self.viewport_height // self.dpscale)
+ img = img.resize(size, resample=resample)
+ return np.array(img)
+
+ ###########################################################################
+ # Shadowmap Debugging
+ ###########################################################################
+
+ def _forward_pass_no_reset(self, scene, flags):
+ # Set up camera matrices
+ V, P = self._get_camera_matrices(scene)
+
+ # Now, render each object in sorted order
+ for node in self._sorted_mesh_nodes(scene):
+ mesh = node.mesh
+
+ # Skip the mesh if it's not visible
+ if not mesh.is_visible:
+ continue
+
+ for primitive in mesh.primitives:
+
+ # First, get and bind the appropriate program
+ program = self._get_primitive_program(
+ primitive, flags, ProgramFlags.USE_MATERIAL
+ )
+ program._bind()
+
+ # Set the camera uniforms
+ program.set_uniform('V', V)
+ program.set_uniform('P', P)
+ program.set_uniform(
+ 'cam_pos', scene.get_pose(scene.main_camera_node)[:3,3]
+ )
+
+ # Next, bind the lighting
+ if not flags & RenderFlags.DEPTH_ONLY and not flags & RenderFlags.FLAT:
+ self._bind_lighting(scene, program, node, flags)
+
+ # Finally, bind and draw the primitive
+ self._bind_and_draw_primitive(
+ primitive=primitive,
+ pose=scene.get_pose(node),
+ program=program,
+ flags=flags
+ )
+ self._reset_active_textures()
+
+ # Unbind the shader and flush the output
+ if program is not None:
+ program._unbind()
+ glFlush()
+
+ def _render_light_shadowmaps(self, scene, light_nodes, flags, tile=False):
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0)
+ glClearColor(*scene.bg_color)
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
+ glEnable(GL_DEPTH_TEST)
+ glDepthMask(GL_TRUE)
+ glDepthFunc(GL_LESS)
+ glDepthRange(0.0, 1.0)
+
+ w = self.viewport_width
+ h = self.viewport_height
+
+ num_nodes = len(light_nodes)
+ viewport_dims = {
+ (0, 2): [0, h // 2, w // 2, h],
+ (1, 2): [w // 2, h // 2, w, h],
+ (0, 3): [0, h // 2, w // 2, h],
+ (1, 3): [w // 2, h // 2, w, h],
+ (2, 3): [0, 0, w // 2, h // 2],
+ (0, 4): [0, h // 2, w // 2, h],
+ (1, 4): [w // 2, h // 2, w, h],
+ (2, 4): [0, 0, w // 2, h // 2],
+ (3, 4): [w // 2, 0, w, h // 2]
+ }
+
+ if tile:
+ for i, ln in enumerate(light_nodes):
+ light = ln.light
+
+ if light.shadow_texture is None:
+ raise ValueError('Light does not have a shadow texture')
+
+ glViewport(*viewport_dims[(i, num_nodes + 1)])
+
+ program = self._get_debug_quad_program()
+ program._bind()
+ self._bind_texture(light.shadow_texture, 'depthMap', program)
+ self._render_debug_quad()
+ self._reset_active_textures()
+ glFlush()
+ i += 1
+ glViewport(*viewport_dims[(i, num_nodes + 1)])
+ self._forward_pass_no_reset(scene, flags)
+ else:
+ for i, ln in enumerate(light_nodes):
+ light = ln.light
+
+ if light.shadow_texture is None:
+ raise ValueError('Light does not have a shadow texture')
+
+ glViewport(0, 0, self.viewport_width, self.viewport_height)
+
+ program = self._get_debug_quad_program()
+ program._bind()
+ self._bind_texture(light.shadow_texture, 'depthMap', program)
+ self._render_debug_quad()
+ self._reset_active_textures()
+ glFlush()
+ return
+
+ def _get_debug_quad_program(self):
+ program = self._program_cache.get_program(
+ vertex_shader='debug_quad.vert',
+ fragment_shader='debug_quad.frag'
+ )
+ if not program._in_context():
+ program._add_to_context()
+ return program
+
+ def _render_debug_quad(self):
+ x = glGenVertexArrays(1)
+ glBindVertexArray(x)
+ glDrawArrays(GL_TRIANGLES, 0, 6)
+ glBindVertexArray(0)
+ glDeleteVertexArrays(1, [x])
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/sampler.py b/generate_human_motion/pyrender/build/lib/pyrender/sampler.py
new file mode 100644
index 0000000000000000000000000000000000000000..e4784d068f808a40a56c8e748d83175f7f4e6233
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/sampler.py
@@ -0,0 +1,102 @@
+"""Samplers, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-sampler
+
+Author: Matthew Matl
+"""
+from .constants import GLTF
+
+
+class Sampler(object):
+ """Texture sampler properties for filtering and wrapping modes.
+
+ Parameters
+ ----------
+ name : str, optional
+ The user-defined name of this object.
+ magFilter : int, optional
+ Magnification filter. Valid values:
+ - :attr:`.GLTF.NEAREST`
+ - :attr:`.GLTF.LINEAR`
+ minFilter : int, optional
+ Minification filter. Valid values:
+ - :attr:`.GLTF.NEAREST`
+ - :attr:`.GLTF.LINEAR`
+ - :attr:`.GLTF.NEAREST_MIPMAP_NEAREST`
+ - :attr:`.GLTF.LINEAR_MIPMAP_NEAREST`
+ - :attr:`.GLTF.NEAREST_MIPMAP_LINEAR`
+ - :attr:`.GLTF.LINEAR_MIPMAP_LINEAR`
+ wrapS : int, optional
+ S (U) wrapping mode. Valid values:
+ - :attr:`.GLTF.CLAMP_TO_EDGE`
+ - :attr:`.GLTF.MIRRORED_REPEAT`
+ - :attr:`.GLTF.REPEAT`
+ wrapT : int, optional
+ T (V) wrapping mode. Valid values:
+ - :attr:`.GLTF.CLAMP_TO_EDGE`
+ - :attr:`.GLTF.MIRRORED_REPEAT`
+ - :attr:`.GLTF.REPEAT`
+ """
+
+ def __init__(self,
+ name=None,
+ magFilter=None,
+ minFilter=None,
+ wrapS=GLTF.REPEAT,
+ wrapT=GLTF.REPEAT):
+ self.name = name
+ self.magFilter = magFilter
+ self.minFilter = minFilter
+ self.wrapS = wrapS
+ self.wrapT = wrapT
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def magFilter(self):
+ """int : Magnification filter type.
+ """
+ return self._magFilter
+
+ @magFilter.setter
+ def magFilter(self, value):
+ self._magFilter = value
+
+ @property
+ def minFilter(self):
+ """int : Minification filter type.
+ """
+ return self._minFilter
+
+ @minFilter.setter
+ def minFilter(self, value):
+ self._minFilter = value
+
+ @property
+ def wrapS(self):
+ """int : S (U) wrapping mode.
+ """
+ return self._wrapS
+
+ @wrapS.setter
+ def wrapS(self, value):
+ self._wrapS = value
+
+ @property
+ def wrapT(self):
+ """int : T (V) wrapping mode.
+ """
+ return self._wrapT
+
+ @wrapT.setter
+ def wrapT(self, value):
+ self._wrapT = value
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/scene.py b/generate_human_motion/pyrender/build/lib/pyrender/scene.py
new file mode 100644
index 0000000000000000000000000000000000000000..2fe057ec66f52f2dd9c1363aacf72a7c6cec4e6c
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/scene.py
@@ -0,0 +1,585 @@
+"""Scenes, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-scene
+
+Author: Matthew Matl
+"""
+import numpy as np
+import networkx as nx
+import trimesh
+
+from .mesh import Mesh
+from .camera import Camera
+from .light import Light, PointLight, DirectionalLight, SpotLight
+from .node import Node
+from .utils import format_color_vector
+
+
+class Scene(object):
+ """A hierarchical scene graph.
+
+ Parameters
+ ----------
+ nodes : list of :class:`Node`
+ The set of all nodes in the scene.
+ bg_color : (4,) float, optional
+ Background color of scene.
+ ambient_light : (3,) float, optional
+ Color of ambient light. Defaults to no ambient light.
+ name : str, optional
+ The user-defined name of this object.
+ """
+
+ def __init__(self,
+ nodes=None,
+ bg_color=None,
+ ambient_light=None,
+ name=None):
+
+ if bg_color is None:
+ bg_color = np.ones(4)
+ else:
+ bg_color = format_color_vector(bg_color, 4)
+
+ if ambient_light is None:
+ ambient_light = np.zeros(3)
+
+ if nodes is None:
+ nodes = set()
+ self._nodes = set() # Will be added at the end of this function
+
+ self.bg_color = bg_color
+ self.ambient_light = ambient_light
+ self.name = name
+
+ self._name_to_nodes = {}
+ self._obj_to_nodes = {}
+ self._obj_name_to_nodes = {}
+ self._mesh_nodes = set()
+ self._point_light_nodes = set()
+ self._spot_light_nodes = set()
+ self._directional_light_nodes = set()
+ self._camera_nodes = set()
+ self._main_camera_node = None
+ self._bounds = None
+
+ # Transform tree
+ self._digraph = nx.DiGraph()
+ self._digraph.add_node('world')
+ self._path_cache = {}
+
+ # Find root nodes and add them
+ if len(nodes) > 0:
+ node_parent_map = {n: None for n in nodes}
+ for node in nodes:
+ for child in node.children:
+ if node_parent_map[child] is not None:
+ raise ValueError('Nodes may not have more than '
+ 'one parent')
+ node_parent_map[child] = node
+ for node in node_parent_map:
+ if node_parent_map[node] is None:
+ self.add_node(node)
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def nodes(self):
+ """set of :class:`Node` : Set of nodes in the scene.
+ """
+ return self._nodes
+
+ @property
+ def bg_color(self):
+ """(3,) float : The scene background color.
+ """
+ return self._bg_color
+
+ @bg_color.setter
+ def bg_color(self, value):
+ if value is None:
+ value = np.ones(4)
+ else:
+ value = format_color_vector(value, 4)
+ self._bg_color = value
+
+ @property
+ def ambient_light(self):
+ """(3,) float : The ambient light in the scene.
+ """
+ return self._ambient_light
+
+ @ambient_light.setter
+ def ambient_light(self, value):
+ if value is None:
+ value = np.zeros(3)
+ else:
+ value = format_color_vector(value, 3)
+ self._ambient_light = value
+
+ @property
+ def meshes(self):
+ """set of :class:`Mesh` : The meshes in the scene.
+ """
+ return set([n.mesh for n in self.mesh_nodes])
+
+ @property
+ def mesh_nodes(self):
+ """set of :class:`Node` : The nodes containing meshes.
+ """
+ return self._mesh_nodes
+
+ @property
+ def lights(self):
+ """set of :class:`Light` : The lights in the scene.
+ """
+ return self.point_lights | self.spot_lights | self.directional_lights
+
+ @property
+ def light_nodes(self):
+ """set of :class:`Node` : The nodes containing lights.
+ """
+ return (self.point_light_nodes | self.spot_light_nodes |
+ self.directional_light_nodes)
+
+ @property
+ def point_lights(self):
+ """set of :class:`PointLight` : The point lights in the scene.
+ """
+ return set([n.light for n in self.point_light_nodes])
+
+ @property
+ def point_light_nodes(self):
+ """set of :class:`Node` : The nodes containing point lights.
+ """
+ return self._point_light_nodes
+
+ @property
+ def spot_lights(self):
+ """set of :class:`SpotLight` : The spot lights in the scene.
+ """
+ return set([n.light for n in self.spot_light_nodes])
+
+ @property
+ def spot_light_nodes(self):
+ """set of :class:`Node` : The nodes containing spot lights.
+ """
+ return self._spot_light_nodes
+
+ @property
+ def directional_lights(self):
+ """set of :class:`DirectionalLight` : The directional lights in
+ the scene.
+ """
+ return set([n.light for n in self.directional_light_nodes])
+
+ @property
+ def directional_light_nodes(self):
+ """set of :class:`Node` : The nodes containing directional lights.
+ """
+ return self._directional_light_nodes
+
+ @property
+ def cameras(self):
+ """set of :class:`Camera` : The cameras in the scene.
+ """
+ return set([n.camera for n in self.camera_nodes])
+
+ @property
+ def camera_nodes(self):
+ """set of :class:`Node` : The nodes containing cameras in the scene.
+ """
+ return self._camera_nodes
+
+ @property
+ def main_camera_node(self):
+ """set of :class:`Node` : The node containing the main camera in the
+ scene.
+ """
+ return self._main_camera_node
+
+ @main_camera_node.setter
+ def main_camera_node(self, value):
+ if value not in self.nodes:
+ raise ValueError('New main camera node must already be in scene')
+ self._main_camera_node = value
+
+ @property
+ def bounds(self):
+ """(2,3) float : The axis-aligned bounds of the scene.
+ """
+ if self._bounds is None:
+ # Compute corners
+ corners = []
+ for mesh_node in self.mesh_nodes:
+ mesh = mesh_node.mesh
+ pose = self.get_pose(mesh_node)
+ corners_local = trimesh.bounds.corners(mesh.bounds)
+ corners_world = pose[:3,:3].dot(corners_local.T).T + pose[:3,3]
+ corners.append(corners_world)
+ if len(corners) == 0:
+ self._bounds = np.zeros((2,3))
+ else:
+ corners = np.vstack(corners)
+ self._bounds = np.array([np.min(corners, axis=0),
+ np.max(corners, axis=0)])
+ return self._bounds
+
+ @property
+ def centroid(self):
+ """(3,) float : The centroid of the scene's axis-aligned bounding box
+ (AABB).
+ """
+ return np.mean(self.bounds, axis=0)
+
+ @property
+ def extents(self):
+ """(3,) float : The lengths of the axes of the scene's AABB.
+ """
+ return np.diff(self.bounds, axis=0).reshape(-1)
+
+ @property
+ def scale(self):
+ """(3,) float : The length of the diagonal of the scene's AABB.
+ """
+ return np.linalg.norm(self.extents)
+
+ def add(self, obj, name=None, pose=None,
+ parent_node=None, parent_name=None):
+ """Add an object (mesh, light, or camera) to the scene.
+
+ Parameters
+ ----------
+ obj : :class:`Mesh`, :class:`Light`, or :class:`Camera`
+ The object to add to the scene.
+ name : str
+ A name for the new node to be created.
+ pose : (4,4) float
+ The local pose of this node relative to its parent node.
+ parent_node : :class:`Node`
+ The parent of this Node. If None, the new node is a root node.
+ parent_name : str
+ The name of the parent node, can be specified instead of
+ `parent_node`.
+
+ Returns
+ -------
+ node : :class:`Node`
+ The newly-created and inserted node.
+ """
+ if isinstance(obj, Mesh):
+ node = Node(name=name, matrix=pose, mesh=obj)
+ elif isinstance(obj, Light):
+ node = Node(name=name, matrix=pose, light=obj)
+ elif isinstance(obj, Camera):
+ node = Node(name=name, matrix=pose, camera=obj)
+ else:
+ raise TypeError('Unrecognized object type')
+
+ if parent_node is None and parent_name is not None:
+ parent_nodes = self.get_nodes(name=parent_name)
+ if len(parent_nodes) == 0:
+ raise ValueError('No parent node with name {} found'
+ .format(parent_name))
+ elif len(parent_nodes) > 1:
+ raise ValueError('More than one parent node with name {} found'
+ .format(parent_name))
+ parent_node = list(parent_nodes)[0]
+
+ self.add_node(node, parent_node=parent_node)
+
+ return node
+
+ def get_nodes(self, node=None, name=None, obj=None, obj_name=None):
+ """Search for existing nodes. Only nodes matching all specified
+ parameters is returned, or None if no such node exists.
+
+ Parameters
+ ----------
+ node : :class:`Node`, optional
+ If present, returns this node if it is in the scene.
+ name : str
+ A name for the Node.
+ obj : :class:`Mesh`, :class:`Light`, or :class:`Camera`
+ An object that is attached to the node.
+ obj_name : str
+ The name of an object that is attached to the node.
+
+ Returns
+ -------
+ nodes : set of :class:`.Node`
+ The nodes that match all query terms.
+ """
+ if node is not None:
+ if node in self.nodes:
+ return set([node])
+ else:
+ return set()
+ nodes = set(self.nodes)
+ if name is not None:
+ matches = set()
+ if name in self._name_to_nodes:
+ matches = self._name_to_nodes[name]
+ nodes = nodes & matches
+ if obj is not None:
+ matches = set()
+ if obj in self._obj_to_nodes:
+ matches = self._obj_to_nodes[obj]
+ nodes = nodes & matches
+ if obj_name is not None:
+ matches = set()
+ if obj_name in self._obj_name_to_nodes:
+ matches = self._obj_name_to_nodes[obj_name]
+ nodes = nodes & matches
+
+ return nodes
+
+ def add_node(self, node, parent_node=None):
+ """Add a Node to the scene.
+
+ Parameters
+ ----------
+ node : :class:`Node`
+ The node to be added.
+ parent_node : :class:`Node`
+ The parent of this Node. If None, the new node is a root node.
+ """
+ if node in self.nodes:
+ raise ValueError('Node already in scene')
+ self.nodes.add(node)
+
+ # Add node to sets
+ if node.name is not None:
+ if node.name not in self._name_to_nodes:
+ self._name_to_nodes[node.name] = set()
+ self._name_to_nodes[node.name].add(node)
+ for obj in [node.mesh, node.camera, node.light]:
+ if obj is not None:
+ if obj not in self._obj_to_nodes:
+ self._obj_to_nodes[obj] = set()
+ self._obj_to_nodes[obj].add(node)
+ if obj.name is not None:
+ if obj.name not in self._obj_name_to_nodes:
+ self._obj_name_to_nodes[obj.name] = set()
+ self._obj_name_to_nodes[obj.name].add(node)
+ if node.mesh is not None:
+ self._mesh_nodes.add(node)
+ if node.light is not None:
+ if isinstance(node.light, PointLight):
+ self._point_light_nodes.add(node)
+ if isinstance(node.light, SpotLight):
+ self._spot_light_nodes.add(node)
+ if isinstance(node.light, DirectionalLight):
+ self._directional_light_nodes.add(node)
+ if node.camera is not None:
+ self._camera_nodes.add(node)
+ if self._main_camera_node is None:
+ self._main_camera_node = node
+
+ if parent_node is None:
+ parent_node = 'world'
+ elif parent_node not in self.nodes:
+ raise ValueError('Parent node must already be in scene')
+ elif node not in parent_node.children:
+ parent_node.children.append(node)
+
+ # Create node in graph
+ self._digraph.add_node(node)
+ self._digraph.add_edge(node, parent_node)
+
+ # Iterate over children
+ for child in node.children:
+ self.add_node(child, node)
+
+ self._path_cache = {}
+ self._bounds = None
+
+ def has_node(self, node):
+ """Check if a node is already in the scene.
+
+ Parameters
+ ----------
+ node : :class:`Node`
+ The node to be checked.
+
+ Returns
+ -------
+ has_node : bool
+ True if the node is already in the scene and false otherwise.
+ """
+ return node in self.nodes
+
+ def remove_node(self, node):
+ """Remove a node and all its children from the scene.
+
+ Parameters
+ ----------
+ node : :class:`Node`
+ The node to be removed.
+ """
+ # Disconnect self from parent who is staying in the graph
+ parent = list(self._digraph.neighbors(node))[0]
+ self._remove_node(node)
+ if isinstance(parent, Node):
+ parent.children.remove(node)
+ self._path_cache = {}
+ self._bounds = None
+
+ def get_pose(self, node):
+ """Get the world-frame pose of a node in the scene.
+
+ Parameters
+ ----------
+ node : :class:`Node`
+ The node to find the pose of.
+
+ Returns
+ -------
+ pose : (4,4) float
+ The transform matrix for this node.
+ """
+ if node not in self.nodes:
+ raise ValueError('Node must already be in scene')
+ if node in self._path_cache:
+ path = self._path_cache[node]
+ else:
+ # Get path from from_frame to to_frame
+ path = nx.shortest_path(self._digraph, node, 'world')
+ self._path_cache[node] = path
+
+ # Traverse from from_node to to_node
+ pose = np.eye(4)
+ for n in path[:-1]:
+ pose = np.dot(n.matrix, pose)
+
+ return pose
+
+ def set_pose(self, node, pose):
+ """Set the local-frame pose of a node in the scene.
+
+ Parameters
+ ----------
+ node : :class:`Node`
+ The node to set the pose of.
+ pose : (4,4) float
+ The pose to set the node to.
+ """
+ if node not in self.nodes:
+ raise ValueError('Node must already be in scene')
+ node._matrix = pose
+ if node.mesh is not None:
+ self._bounds = None
+
+ def clear(self):
+ """Clear out all nodes to form an empty scene.
+ """
+ self._nodes = set()
+
+ self._name_to_nodes = {}
+ self._obj_to_nodes = {}
+ self._obj_name_to_nodes = {}
+ self._mesh_nodes = set()
+ self._point_light_nodes = set()
+ self._spot_light_nodes = set()
+ self._directional_light_nodes = set()
+ self._camera_nodes = set()
+ self._main_camera_node = None
+ self._bounds = None
+
+ # Transform tree
+ self._digraph = nx.DiGraph()
+ self._digraph.add_node('world')
+ self._path_cache = {}
+
+ def _remove_node(self, node):
+ """Remove a node and all its children from the scene.
+
+ Parameters
+ ----------
+ node : :class:`Node`
+ The node to be removed.
+ """
+
+ # Remove self from nodes
+ self.nodes.remove(node)
+
+ # Remove children
+ for child in node.children:
+ self._remove_node(child)
+
+ # Remove self from the graph
+ self._digraph.remove_node(node)
+
+ # Remove from maps
+ if node.name in self._name_to_nodes:
+ self._name_to_nodes[node.name].remove(node)
+ if len(self._name_to_nodes[node.name]) == 0:
+ self._name_to_nodes.pop(node.name)
+ for obj in [node.mesh, node.camera, node.light]:
+ if obj is None:
+ continue
+ self._obj_to_nodes[obj].remove(node)
+ if len(self._obj_to_nodes[obj]) == 0:
+ self._obj_to_nodes.pop(obj)
+ if obj.name is not None:
+ self._obj_name_to_nodes[obj.name].remove(node)
+ if len(self._obj_name_to_nodes[obj.name]) == 0:
+ self._obj_name_to_nodes.pop(obj.name)
+ if node.mesh is not None:
+ self._mesh_nodes.remove(node)
+ if node.light is not None:
+ if isinstance(node.light, PointLight):
+ self._point_light_nodes.remove(node)
+ if isinstance(node.light, SpotLight):
+ self._spot_light_nodes.remove(node)
+ if isinstance(node.light, DirectionalLight):
+ self._directional_light_nodes.remove(node)
+ if node.camera is not None:
+ self._camera_nodes.remove(node)
+ if self._main_camera_node == node:
+ if len(self._camera_nodes) > 0:
+ self._main_camera_node = next(iter(self._camera_nodes))
+ else:
+ self._main_camera_node = None
+
+ @staticmethod
+ def from_trimesh_scene(trimesh_scene,
+ bg_color=None, ambient_light=None):
+ """Create a :class:`.Scene` from a :class:`trimesh.scene.scene.Scene`.
+
+ Parameters
+ ----------
+ trimesh_scene : :class:`trimesh.scene.scene.Scene`
+ Scene with :class:~`trimesh.base.Trimesh` objects.
+ bg_color : (4,) float
+ Background color for the created scene.
+ ambient_light : (3,) float or None
+ Ambient light in the scene.
+
+ Returns
+ -------
+ scene_pr : :class:`Scene`
+ A scene containing the same geometry as the trimesh scene.
+ """
+ # convert trimesh geometries to pyrender geometries
+ geometries = {name: Mesh.from_trimesh(geom)
+ for name, geom in trimesh_scene.geometry.items()}
+
+ # create the pyrender scene object
+ scene_pr = Scene(bg_color=bg_color, ambient_light=ambient_light)
+
+ # add every node with geometry to the pyrender scene
+ for node in trimesh_scene.graph.nodes_geometry:
+ pose, geom_name = trimesh_scene.graph[node]
+ scene_pr.add(geometries[geom_name], pose=pose)
+
+ return scene_pr
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shader_program.py b/generate_human_motion/pyrender/build/lib/pyrender/shader_program.py
new file mode 100644
index 0000000000000000000000000000000000000000..c1803f280c98033abe0769771a9ad8ecfec942e3
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shader_program.py
@@ -0,0 +1,283 @@
+"""OpenGL shader program wrapper.
+"""
+import numpy as np
+import os
+import re
+
+import OpenGL
+from OpenGL.GL import *
+from OpenGL.GL import shaders as gl_shader_utils
+
+
+class ShaderProgramCache(object):
+ """A cache for shader programs.
+ """
+
+ def __init__(self, shader_dir=None):
+ self._program_cache = {}
+ self.shader_dir = shader_dir
+ if self.shader_dir is None:
+ base_dir, _ = os.path.split(os.path.realpath(__file__))
+ self.shader_dir = os.path.join(base_dir, 'shaders')
+
+ def get_program(self, vertex_shader, fragment_shader,
+ geometry_shader=None, defines=None):
+ """Get a program via a list of shader files to include in the program.
+
+ Parameters
+ ----------
+ vertex_shader : str
+ The vertex shader filename.
+ fragment_shader : str
+ The fragment shader filename.
+ geometry_shader : str
+ The geometry shader filename.
+ defines : dict
+ Defines and their values for the shader.
+
+ Returns
+ -------
+ program : :class:`.ShaderProgram`
+ The program.
+ """
+ shader_names = []
+ if defines is None:
+ defines = {}
+ shader_filenames = [
+ x for x in [vertex_shader, fragment_shader, geometry_shader]
+ if x is not None
+ ]
+ for fn in shader_filenames:
+ if fn is None:
+ continue
+ _, name = os.path.split(fn)
+ shader_names.append(name)
+ cid = OpenGL.contextdata.getContext()
+ key = tuple([cid] + sorted(
+ [(s,1) for s in shader_names] + [(d, defines[d]) for d in defines]
+ ))
+
+ if key not in self._program_cache:
+ shader_filenames = [
+ os.path.join(self.shader_dir, fn) for fn in shader_filenames
+ ]
+ if len(shader_filenames) == 2:
+ shader_filenames.append(None)
+ vs, fs, gs = shader_filenames
+ self._program_cache[key] = ShaderProgram(
+ vertex_shader=vs, fragment_shader=fs,
+ geometry_shader=gs, defines=defines
+ )
+ return self._program_cache[key]
+
+ def clear(self):
+ for key in self._program_cache:
+ self._program_cache[key].delete()
+ self._program_cache = {}
+
+
+class ShaderProgram(object):
+ """A thin wrapper about OpenGL shader programs that supports easy creation,
+ binding, and uniform-setting.
+
+ Parameters
+ ----------
+ vertex_shader : str
+ The vertex shader filename.
+ fragment_shader : str
+ The fragment shader filename.
+ geometry_shader : str
+ The geometry shader filename.
+ defines : dict
+ Defines and their values for the shader.
+ """
+
+ def __init__(self, vertex_shader, fragment_shader,
+ geometry_shader=None, defines=None):
+
+ self.vertex_shader = vertex_shader
+ self.fragment_shader = fragment_shader
+ self.geometry_shader = geometry_shader
+
+ self.defines = defines
+ if self.defines is None:
+ self.defines = {}
+
+ self._program_id = None
+ self._vao_id = None # PYOPENGL BUG
+
+ # DEBUG
+ # self._unif_map = {}
+
+ def _add_to_context(self):
+ if self._program_id is not None:
+ raise ValueError('Shader program already in context')
+ shader_ids = []
+
+ # Load vert shader
+ shader_ids.append(gl_shader_utils.compileShader(
+ self._load(self.vertex_shader), GL_VERTEX_SHADER)
+ )
+ # Load frag shader
+ shader_ids.append(gl_shader_utils.compileShader(
+ self._load(self.fragment_shader), GL_FRAGMENT_SHADER)
+ )
+ # Load geometry shader
+ if self.geometry_shader is not None:
+ shader_ids.append(gl_shader_utils.compileShader(
+ self._load(self.geometry_shader), GL_GEOMETRY_SHADER)
+ )
+
+ # Bind empty VAO PYOPENGL BUG
+ if self._vao_id is None:
+ self._vao_id = glGenVertexArrays(1)
+ glBindVertexArray(self._vao_id)
+
+ # Compile program
+ self._program_id = gl_shader_utils.compileProgram(*shader_ids)
+
+ # Unbind empty VAO PYOPENGL BUG
+ glBindVertexArray(0)
+
+ def _in_context(self):
+ return self._program_id is not None
+
+ def _remove_from_context(self):
+ if self._program_id is not None:
+ glDeleteProgram(self._program_id)
+ glDeleteVertexArrays(1, [self._vao_id])
+ self._program_id = None
+ self._vao_id = None
+
+ def _load(self, shader_filename):
+ path, _ = os.path.split(shader_filename)
+
+ with open(shader_filename) as f:
+ text = f.read()
+
+ def ifdef(matchobj):
+ if matchobj.group(1) in self.defines:
+ return '#if 1'
+ else:
+ return '#if 0'
+
+ def ifndef(matchobj):
+ if matchobj.group(1) in self.defines:
+ return '#if 0'
+ else:
+ return '#if 1'
+
+ ifdef_regex = re.compile(
+ '#ifdef\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*$', re.MULTILINE
+ )
+ ifndef_regex = re.compile(
+ '#ifndef\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*$', re.MULTILINE
+ )
+ text = re.sub(ifdef_regex, ifdef, text)
+ text = re.sub(ifndef_regex, ifndef, text)
+
+ for define in self.defines:
+ value = str(self.defines[define])
+ text = text.replace(define, value)
+
+ return text
+
+ def _bind(self):
+ """Bind this shader program to the current OpenGL context.
+ """
+ if self._program_id is None:
+ raise ValueError('Cannot bind program that is not in context')
+ # glBindVertexArray(self._vao_id)
+ glUseProgram(self._program_id)
+
+ def _unbind(self):
+ """Unbind this shader program from the current OpenGL context.
+ """
+ glUseProgram(0)
+
+ def delete(self):
+ """Delete this shader program from the current OpenGL context.
+ """
+ self._remove_from_context()
+
+ def set_uniform(self, name, value, unsigned=False):
+ """Set a uniform value in the current shader program.
+
+ Parameters
+ ----------
+ name : str
+ Name of the uniform to set.
+ value : int, float, or ndarray
+ Value to set the uniform to.
+ unsigned : bool
+ If True, ints will be treated as unsigned values.
+ """
+ try:
+ # DEBUG
+ # self._unif_map[name] = 1, (1,)
+ loc = glGetUniformLocation(self._program_id, name)
+
+ if loc == -1:
+ raise ValueError('Invalid shader variable: {}'.format(name))
+
+ if isinstance(value, np.ndarray):
+ # DEBUG
+ # self._unif_map[name] = value.size, value.shape
+ if value.ndim == 1:
+ if (np.issubdtype(value.dtype, np.unsignedinteger) or
+ unsigned):
+ dtype = 'u'
+ value = value.astype(np.uint32)
+ elif np.issubdtype(value.dtype, np.integer):
+ dtype = 'i'
+ value = value.astype(np.int32)
+ else:
+ dtype = 'f'
+ value = value.astype(np.float32)
+ self._FUNC_MAP[(value.shape[0], dtype)](loc, 1, value)
+ else:
+ self._FUNC_MAP[(value.shape[0], value.shape[1])](
+ loc, 1, GL_TRUE, value
+ )
+
+ # Call correct uniform function
+ elif isinstance(value, float):
+ glUniform1f(loc, value)
+ elif isinstance(value, int):
+ if unsigned:
+ glUniform1ui(loc, value)
+ else:
+ glUniform1i(loc, value)
+ elif isinstance(value, bool):
+ if unsigned:
+ glUniform1ui(loc, int(value))
+ else:
+ glUniform1i(loc, int(value))
+ else:
+ raise ValueError('Invalid data type')
+ except Exception:
+ pass
+
+ _FUNC_MAP = {
+ (1,'u'): glUniform1uiv,
+ (2,'u'): glUniform2uiv,
+ (3,'u'): glUniform3uiv,
+ (4,'u'): glUniform4uiv,
+ (1,'i'): glUniform1iv,
+ (2,'i'): glUniform2iv,
+ (3,'i'): glUniform3iv,
+ (4,'i'): glUniform4iv,
+ (1,'f'): glUniform1fv,
+ (2,'f'): glUniform2fv,
+ (3,'f'): glUniform3fv,
+ (4,'f'): glUniform4fv,
+ (2,2): glUniformMatrix2fv,
+ (2,3): glUniformMatrix2x3fv,
+ (2,4): glUniformMatrix2x4fv,
+ (3,2): glUniformMatrix3x2fv,
+ (3,3): glUniformMatrix3fv,
+ (3,4): glUniformMatrix3x4fv,
+ (4,2): glUniformMatrix4x2fv,
+ (4,3): glUniformMatrix4x3fv,
+ (4,4): glUniformMatrix4fv,
+ }
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/debug_quad.frag b/generate_human_motion/pyrender/build/lib/pyrender/shaders/debug_quad.frag
new file mode 100644
index 0000000000000000000000000000000000000000..4647bb50dfa1e4510e2d4afb37959c7f57532eca
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/debug_quad.frag
@@ -0,0 +1,23 @@
+#version 330 core
+out vec4 FragColor;
+
+in vec2 TexCoords;
+
+uniform sampler2D depthMap;
+//uniform float near_plane;
+//uniform float far_plane;
+//
+//// required when using a perspective projection matrix
+//float LinearizeDepth(float depth)
+//{
+// float z = depth * 2.0 - 1.0; // Back to NDC
+// return (2.0 * near_plane * far_plane) / (far_plane + near_plane - z * (far_plane - near_plane));
+//}
+
+void main()
+{
+ float depthValue = texture(depthMap, TexCoords).r;
+ // FragColor = vec4(vec3(LinearizeDepth(depthValue) / far_plane), 1.0); // perspective
+ FragColor = vec4(vec3(depthValue), 1.0); // orthographic
+ //FragColor = vec4(1.0, 1.0, 0.0, 1.0);
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/debug_quad.vert b/generate_human_motion/pyrender/build/lib/pyrender/shaders/debug_quad.vert
new file mode 100644
index 0000000000000000000000000000000000000000..d2f2fcb7626f6c22e0d52bf4d6c91251cbdb9f52
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/debug_quad.vert
@@ -0,0 +1,25 @@
+#version 330 core
+//layout (location = 0) in vec3 aPos;
+//layout (location = 1) in vec2 aTexCoords;
+//
+//out vec2 TexCoords;
+//
+//void main()
+//{
+// TexCoords = aTexCoords;
+// gl_Position = vec4(aPos, 1.0);
+//}
+//
+//
+//layout(location = 0) out vec2 uv;
+
+out vec2 TexCoords;
+
+void main()
+{
+ float x = float(((uint(gl_VertexID) + 2u) / 3u)%2u);
+ float y = float(((uint(gl_VertexID) + 1u) / 3u)%2u);
+
+ gl_Position = vec4(-1.0f + x*2.0f, -1.0f+y*2.0f, 0.0f, 1.0f);
+ TexCoords = vec2(x, y);
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/flat.frag b/generate_human_motion/pyrender/build/lib/pyrender/shaders/flat.frag
new file mode 100644
index 0000000000000000000000000000000000000000..7ec01c6d095ec5dacc693accd3ad507ced61a79a
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/flat.frag
@@ -0,0 +1,126 @@
+#version 330 core
+///////////////////////////////////////////////////////////////////////////////
+// Structs
+///////////////////////////////////////////////////////////////////////////////
+
+struct Material {
+ vec3 emissive_factor;
+
+#ifdef USE_METALLIC_MATERIAL
+ vec4 base_color_factor;
+ float metallic_factor;
+ float roughness_factor;
+#endif
+
+#ifdef USE_GLOSSY_MATERIAL
+ vec4 diffuse_factor;
+ vec3 specular_factor;
+ float glossiness_factor;
+#endif
+
+#ifdef HAS_NORMAL_TEX
+ sampler2D normal_texture;
+#endif
+#ifdef HAS_OCCLUSION_TEX
+ sampler2D occlusion_texture;
+#endif
+#ifdef HAS_EMISSIVE_TEX
+ sampler2D emissive_texture;
+#endif
+#ifdef HAS_BASE_COLOR_TEX
+ sampler2D base_color_texture;
+#endif
+#ifdef HAS_METALLIC_ROUGHNESS_TEX
+ sampler2D metallic_roughness_texture;
+#endif
+#ifdef HAS_DIFFUSE_TEX
+ sampler2D diffuse_texture;
+#endif
+#ifdef HAS_SPECULAR_GLOSSINESS_TEX
+ sampler2D specular_glossiness;
+#endif
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// Uniforms
+///////////////////////////////////////////////////////////////////////////////
+uniform Material material;
+uniform vec3 cam_pos;
+
+#ifdef USE_IBL
+uniform samplerCube diffuse_env;
+uniform samplerCube specular_env;
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Inputs
+///////////////////////////////////////////////////////////////////////////////
+
+in vec3 frag_position;
+#ifdef NORMAL_LOC
+in vec3 frag_normal;
+#endif
+#ifdef HAS_NORMAL_TEX
+#ifdef TANGENT_LOC
+#ifdef NORMAL_LOC
+in mat3 tbn;
+#endif
+#endif
+#endif
+#ifdef TEXCOORD_0_LOC
+in vec2 uv_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+in vec2 uv_1;
+#endif
+#ifdef COLOR_0_LOC
+in vec4 color_multiplier;
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// OUTPUTS
+///////////////////////////////////////////////////////////////////////////////
+
+out vec4 frag_color;
+
+///////////////////////////////////////////////////////////////////////////////
+// Constants
+///////////////////////////////////////////////////////////////////////////////
+const float PI = 3.141592653589793;
+const float min_roughness = 0.04;
+
+///////////////////////////////////////////////////////////////////////////////
+// Utility Functions
+///////////////////////////////////////////////////////////////////////////////
+vec4 srgb_to_linear(vec4 srgb)
+{
+#ifndef SRGB_CORRECTED
+ // Fast Approximation
+ //vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
+ //
+ vec3 b_less = step(vec3(0.04045),srgb.xyz);
+ vec3 lin_out = mix( srgb.xyz/vec3(12.92), pow((srgb.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), b_less );
+ return vec4(lin_out, srgb.w);
+#else
+ return srgb;
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// MAIN
+///////////////////////////////////////////////////////////////////////////////
+void main()
+{
+
+ // Compute albedo
+ vec4 base_color = material.base_color_factor;
+#ifdef HAS_BASE_COLOR_TEX
+ base_color = base_color * texture(material.base_color_texture, uv_0);
+#endif
+
+#ifdef COLOR_0_LOC
+ base_color *= color_multiplier;
+#endif
+
+ frag_color = clamp(base_color, 0.0, 1.0);
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/flat.vert b/generate_human_motion/pyrender/build/lib/pyrender/shaders/flat.vert
new file mode 100644
index 0000000000000000000000000000000000000000..cfd241c3544718a261f961c3aa3c03aa13c97761
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/flat.vert
@@ -0,0 +1,86 @@
+#version 330 core
+
+// Vertex Attributes
+layout(location = 0) in vec3 position;
+#ifdef NORMAL_LOC
+layout(location = NORMAL_LOC) in vec3 normal;
+#endif
+#ifdef TANGENT_LOC
+layout(location = TANGENT_LOC) in vec4 tangent;
+#endif
+#ifdef TEXCOORD_0_LOC
+layout(location = TEXCOORD_0_LOC) in vec2 texcoord_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+layout(location = TEXCOORD_1_LOC) in vec2 texcoord_1;
+#endif
+#ifdef COLOR_0_LOC
+layout(location = COLOR_0_LOC) in vec4 color_0;
+#endif
+#ifdef JOINTS_0_LOC
+layout(location = JOINTS_0_LOC) in vec4 joints_0;
+#endif
+#ifdef WEIGHTS_0_LOC
+layout(location = WEIGHTS_0_LOC) in vec4 weights_0;
+#endif
+layout(location = INST_M_LOC) in mat4 inst_m;
+
+// Uniforms
+uniform mat4 M;
+uniform mat4 V;
+uniform mat4 P;
+
+// Outputs
+out vec3 frag_position;
+#ifdef NORMAL_LOC
+out vec3 frag_normal;
+#endif
+#ifdef HAS_NORMAL_TEX
+#ifdef TANGENT_LOC
+#ifdef NORMAL_LOC
+out mat3 tbn;
+#endif
+#endif
+#endif
+#ifdef TEXCOORD_0_LOC
+out vec2 uv_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+out vec2 uv_1;
+#endif
+#ifdef COLOR_0_LOC
+out vec4 color_multiplier;
+#endif
+
+
+void main()
+{
+ gl_Position = P * V * M * inst_m * vec4(position, 1);
+ frag_position = vec3(M * inst_m * vec4(position, 1.0));
+
+ mat4 N = transpose(inverse(M * inst_m));
+
+#ifdef NORMAL_LOC
+ frag_normal = normalize(vec3(N * vec4(normal, 0.0)));
+#endif
+
+#ifdef HAS_NORMAL_TEX
+#ifdef TANGENT_LOC
+#ifdef NORMAL_LOC
+ vec3 normal_w = normalize(vec3(N * vec4(normal, 0.0)));
+ vec3 tangent_w = normalize(vec3(N * vec4(tangent.xyz, 0.0)));
+ vec3 bitangent_w = cross(normal_w, tangent_w) * tangent.w;
+ tbn = mat3(tangent_w, bitangent_w, normal_w);
+#endif
+#endif
+#endif
+#ifdef TEXCOORD_0_LOC
+ uv_0 = texcoord_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+ uv_1 = texcoord_1;
+#endif
+#ifdef COLOR_0_LOC
+ color_multiplier = color_0;
+#endif
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/mesh.frag b/generate_human_motion/pyrender/build/lib/pyrender/shaders/mesh.frag
new file mode 100644
index 0000000000000000000000000000000000000000..43187621b4388b18badf4e562a7ad300e59b029d
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/mesh.frag
@@ -0,0 +1,456 @@
+#version 330 core
+///////////////////////////////////////////////////////////////////////////////
+// Structs
+///////////////////////////////////////////////////////////////////////////////
+
+struct SpotLight {
+ vec3 color;
+ float intensity;
+ float range;
+ vec3 position;
+ vec3 direction;
+ float light_angle_scale;
+ float light_angle_offset;
+
+ #ifdef SPOT_LIGHT_SHADOWS
+ sampler2D shadow_map;
+ mat4 light_matrix;
+ #endif
+};
+
+struct DirectionalLight {
+ vec3 color;
+ float intensity;
+ vec3 direction;
+
+ #ifdef DIRECTIONAL_LIGHT_SHADOWS
+ sampler2D shadow_map;
+ mat4 light_matrix;
+ #endif
+};
+
+struct PointLight {
+ vec3 color;
+ float intensity;
+ float range;
+ vec3 position;
+
+ #ifdef POINT_LIGHT_SHADOWS
+ samplerCube shadow_map;
+ #endif
+};
+
+struct Material {
+ vec3 emissive_factor;
+
+#ifdef USE_METALLIC_MATERIAL
+ vec4 base_color_factor;
+ float metallic_factor;
+ float roughness_factor;
+#endif
+
+#ifdef USE_GLOSSY_MATERIAL
+ vec4 diffuse_factor;
+ vec3 specular_factor;
+ float glossiness_factor;
+#endif
+
+#ifdef HAS_NORMAL_TEX
+ sampler2D normal_texture;
+#endif
+#ifdef HAS_OCCLUSION_TEX
+ sampler2D occlusion_texture;
+#endif
+#ifdef HAS_EMISSIVE_TEX
+ sampler2D emissive_texture;
+#endif
+#ifdef HAS_BASE_COLOR_TEX
+ sampler2D base_color_texture;
+#endif
+#ifdef HAS_METALLIC_ROUGHNESS_TEX
+ sampler2D metallic_roughness_texture;
+#endif
+#ifdef HAS_DIFFUSE_TEX
+ sampler2D diffuse_texture;
+#endif
+#ifdef HAS_SPECULAR_GLOSSINESS_TEX
+ sampler2D specular_glossiness;
+#endif
+};
+
+struct PBRInfo {
+ float nl;
+ float nv;
+ float nh;
+ float lh;
+ float vh;
+ float roughness;
+ float metallic;
+ vec3 f0;
+ vec3 c_diff;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// Uniforms
+///////////////////////////////////////////////////////////////////////////////
+uniform Material material;
+uniform PointLight point_lights[MAX_POINT_LIGHTS];
+uniform int n_point_lights;
+uniform DirectionalLight directional_lights[MAX_DIRECTIONAL_LIGHTS];
+uniform int n_directional_lights;
+uniform SpotLight spot_lights[MAX_SPOT_LIGHTS];
+uniform int n_spot_lights;
+uniform vec3 cam_pos;
+uniform vec3 ambient_light;
+
+#ifdef USE_IBL
+uniform samplerCube diffuse_env;
+uniform samplerCube specular_env;
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Inputs
+///////////////////////////////////////////////////////////////////////////////
+
+in vec3 frag_position;
+#ifdef NORMAL_LOC
+in vec3 frag_normal;
+#endif
+#ifdef HAS_NORMAL_TEX
+#ifdef TANGENT_LOC
+#ifdef NORMAL_LOC
+in mat3 tbn;
+#endif
+#endif
+#endif
+#ifdef TEXCOORD_0_LOC
+in vec2 uv_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+in vec2 uv_1;
+#endif
+#ifdef COLOR_0_LOC
+in vec4 color_multiplier;
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// OUTPUTS
+///////////////////////////////////////////////////////////////////////////////
+
+out vec4 frag_color;
+
+///////////////////////////////////////////////////////////////////////////////
+// Constants
+///////////////////////////////////////////////////////////////////////////////
+const float PI = 3.141592653589793;
+const float min_roughness = 0.04;
+
+///////////////////////////////////////////////////////////////////////////////
+// Utility Functions
+///////////////////////////////////////////////////////////////////////////////
+vec4 srgb_to_linear(vec4 srgb)
+{
+#ifndef SRGB_CORRECTED
+ // Fast Approximation
+ //vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
+ //
+ vec3 b_less = step(vec3(0.04045),srgb.xyz);
+ vec3 lin_out = mix( srgb.xyz/vec3(12.92), pow((srgb.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), b_less );
+ return vec4(lin_out, srgb.w);
+#else
+ return srgb;
+#endif
+}
+
+// Normal computation
+vec3 get_normal()
+{
+#ifdef HAS_NORMAL_TEX
+
+#ifndef HAS_TANGENTS
+ vec3 pos_dx = dFdx(frag_position);
+ vec3 pos_dy = dFdy(frag_position);
+ vec3 tex_dx = dFdx(vec3(uv_0, 0.0));
+ vec3 tex_dy = dFdy(vec3(uv_0, 0.0));
+ vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
+
+#ifdef NORMAL_LOC
+ vec3 ng = normalize(frag_normal);
+#else
+ vec3 = cross(pos_dx, pos_dy);
+#endif
+
+ t = normalize(t - ng * dot(ng, t));
+ vec3 b = normalize(cross(ng, t));
+ mat3 tbn_n = mat3(t, b, ng);
+
+#else
+
+ mat3 tbn_n = tbn;
+
+#endif
+
+ vec3 n = texture(material.normal_texture, uv_0).rgb;
+ n = normalize(tbn_n * ((2.0 * n - 1.0) * vec3(1.0, 1.0, 1.0)));
+ return n; // TODO NORMAL MAPPING
+
+#else
+
+#ifdef NORMAL_LOC
+ return frag_normal;
+#else
+ return normalize(cam_pos - frag_position);
+#endif
+
+#endif
+}
+
+// Fresnel
+vec3 specular_reflection(PBRInfo info)
+{
+ vec3 res = info.f0 + (1.0 - info.f0) * pow(clamp(1.0 - info.vh, 0.0, 1.0), 5.0);
+ return res;
+}
+
+// Smith
+float geometric_occlusion(PBRInfo info)
+{
+ float r = info.roughness + 1.0;
+ float k = r * r / 8.0;
+ float g1 = info.nv / (info.nv * (1.0 - k) + k);
+ float g2 = info.nl / (info.nl * (1.0 - k) + k);
+ //float k = info.roughness * sqrt(2.0 / PI);
+ //float g1 = info.lh / (info.lh * (1.0 - k) + k);
+ //float g2 = info.nh / (info.nh * (1.0 - k) + k);
+ return g1 * g2;
+}
+
+float microfacet_distribution(PBRInfo info)
+{
+ float a = info.roughness * info.roughness;
+ float a2 = a * a;
+ float nh2 = info.nh * info.nh;
+
+ float denom = (nh2 * (a2 - 1.0) + 1.0);
+ return a2 / (PI * denom * denom);
+}
+
+vec3 compute_brdf(vec3 n, vec3 v, vec3 l,
+ float roughness, float metalness,
+ vec3 f0, vec3 c_diff, vec3 albedo,
+ vec3 radiance)
+{
+ vec3 h = normalize(l+v);
+ float nl = clamp(dot(n, l), 0.001, 1.0);
+ float nv = clamp(abs(dot(n, v)), 0.001, 1.0);
+ float nh = clamp(dot(n, h), 0.0, 1.0);
+ float lh = clamp(dot(l, h), 0.0, 1.0);
+ float vh = clamp(dot(v, h), 0.0, 1.0);
+
+ PBRInfo info = PBRInfo(nl, nv, nh, lh, vh, roughness, metalness, f0, c_diff);
+
+ // Compute PBR terms
+ vec3 F = specular_reflection(info);
+ float G = geometric_occlusion(info);
+ float D = microfacet_distribution(info);
+
+ // Compute BRDF
+ vec3 diffuse_contrib = (1.0 - F) * c_diff / PI;
+ vec3 spec_contrib = F * G * D / (4.0 * nl * nv + 0.001);
+
+ vec3 color = nl * radiance * (diffuse_contrib + spec_contrib);
+ return color;
+}
+
+float texture2DCompare(sampler2D depths, vec2 uv, float compare) {
+ return compare > texture(depths, uv.xy).r ? 1.0 : 0.0;
+}
+
+float texture2DShadowLerp(sampler2D depths, vec2 size, vec2 uv, float compare) {
+ vec2 texelSize = vec2(1.0)/size;
+ vec2 f = fract(uv*size+0.5);
+ vec2 centroidUV = floor(uv*size+0.5)/size;
+
+ float lb = texture2DCompare(depths, centroidUV+texelSize*vec2(0.0, 0.0), compare);
+ float lt = texture2DCompare(depths, centroidUV+texelSize*vec2(0.0, 1.0), compare);
+ float rb = texture2DCompare(depths, centroidUV+texelSize*vec2(1.0, 0.0), compare);
+ float rt = texture2DCompare(depths, centroidUV+texelSize*vec2(1.0, 1.0), compare);
+ float a = mix(lb, lt, f.y);
+ float b = mix(rb, rt, f.y);
+ float c = mix(a, b, f.x);
+ return c;
+}
+
+float PCF(sampler2D depths, vec2 size, vec2 uv, float compare){
+ float result = 0.0;
+ for(int x=-1; x<=1; x++){
+ for(int y=-1; y<=1; y++){
+ vec2 off = vec2(x,y)/size;
+ result += texture2DShadowLerp(depths, size, uv+off, compare);
+ }
+ }
+ return result/9.0;
+}
+
+float shadow_calc(mat4 light_matrix, sampler2D shadow_map, float nl)
+{
+ // Compute light texture UV coords
+ vec4 proj_coords = vec4(light_matrix * vec4(frag_position.xyz, 1.0));
+ vec3 light_coords = proj_coords.xyz / proj_coords.w;
+ light_coords = light_coords * 0.5 + 0.5;
+ float current_depth = light_coords.z;
+ float bias = max(0.001 * (1.0 - nl), 0.0001) / proj_coords.w;
+ float compare = (current_depth - bias);
+ float shadow = PCF(shadow_map, textureSize(shadow_map, 0), light_coords.xy, compare);
+ if (light_coords.z > 1.0) {
+ shadow = 0.0;
+ }
+ return shadow;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// MAIN
+///////////////////////////////////////////////////////////////////////////////
+void main()
+{
+
+ vec4 color = vec4(vec3(0.0), 1.0);
+///////////////////////////////////////////////////////////////////////////////
+// Handle Metallic Materials
+///////////////////////////////////////////////////////////////////////////////
+#ifdef USE_METALLIC_MATERIAL
+
+ // Compute metallic/roughness factors
+ float roughness = material.roughness_factor;
+ float metallic = material.metallic_factor;
+#ifdef HAS_METALLIC_ROUGHNESS_TEX
+ vec2 mr = texture(material.metallic_roughness_texture, uv_0).rg;
+ roughness = roughness * mr.r;
+ metallic = metallic * mr.g;
+#endif
+ roughness = clamp(roughness, min_roughness, 1.0);
+ metallic = clamp(metallic, 0.0, 1.0);
+ // In convention, material roughness is perceputal roughness ^ 2
+ float alpha_roughness = roughness * roughness;
+
+ // Compute albedo
+ vec4 base_color = material.base_color_factor;
+#ifdef HAS_BASE_COLOR_TEX
+ base_color = base_color * srgb_to_linear(texture(material.base_color_texture, uv_0));
+#endif
+
+ // Compute specular and diffuse colors
+ vec3 dialectric_spec = vec3(min_roughness);
+ vec3 c_diff = mix(vec3(0.0), base_color.rgb * (1 - min_roughness), 1.0 - metallic);
+ vec3 f0 = mix(dialectric_spec, base_color.rgb, metallic);
+
+ // Compute normal
+ vec3 n = normalize(get_normal());
+
+ // Loop over lights
+ for (int i = 0; i < n_directional_lights; i++) {
+ vec3 direction = directional_lights[i].direction;
+ vec3 v = normalize(cam_pos - frag_position); // Vector towards camera
+ vec3 l = normalize(-1.0 * direction); // Vector towards light
+
+ // Compute attenuation and radiance
+ float attenuation = directional_lights[i].intensity;
+ vec3 radiance = attenuation * directional_lights[i].color;
+
+ // Compute outbound color
+ vec3 res = compute_brdf(n, v, l, roughness, metallic,
+ f0, c_diff, base_color.rgb, radiance);
+
+ // Compute shadow
+#ifdef DIRECTIONAL_LIGHT_SHADOWS
+ float nl = clamp(dot(n,l), 0.0, 1.0);
+ float shadow = shadow_calc(
+ directional_lights[i].light_matrix,
+ directional_lights[i].shadow_map,
+ nl
+ );
+ res = res * (1.0 - shadow);
+#endif
+ color.xyz += res;
+ }
+
+ for (int i = 0; i < n_point_lights; i++) {
+ vec3 position = point_lights[i].position;
+ vec3 v = normalize(cam_pos - frag_position); // Vector towards camera
+ vec3 l = normalize(position - frag_position); // Vector towards light
+
+ // Compute attenuation and radiance
+ float dist = length(position - frag_position);
+ float attenuation = point_lights[i].intensity / (dist * dist);
+ vec3 radiance = attenuation * point_lights[i].color;
+
+ // Compute outbound color
+ vec3 res = compute_brdf(n, v, l, roughness, metallic,
+ f0, c_diff, base_color.rgb, radiance);
+ color.xyz += res;
+ }
+ for (int i = 0; i < n_spot_lights; i++) {
+ vec3 position = spot_lights[i].position;
+ vec3 v = normalize(cam_pos - frag_position); // Vector towards camera
+ vec3 l = normalize(position - frag_position); // Vector towards light
+
+ // Compute attenuation and radiance
+ vec3 direction = spot_lights[i].direction;
+ float las = spot_lights[i].light_angle_scale;
+ float lao = spot_lights[i].light_angle_offset;
+ float dist = length(position - frag_position);
+ float cd = clamp(dot(direction, -l), 0.0, 1.0);
+ float attenuation = clamp(cd * las + lao, 0.0, 1.0);
+ attenuation = attenuation * attenuation * spot_lights[i].intensity;
+ attenuation = attenuation / (dist * dist);
+ vec3 radiance = attenuation * spot_lights[i].color;
+
+ // Compute outbound color
+ vec3 res = compute_brdf(n, v, l, roughness, metallic,
+ f0, c_diff, base_color.rgb, radiance);
+#ifdef SPOT_LIGHT_SHADOWS
+ float nl = clamp(dot(n,l), 0.0, 1.0);
+ float shadow = shadow_calc(
+ spot_lights[i].light_matrix,
+ spot_lights[i].shadow_map,
+ nl
+ );
+ res = res * (1.0 - shadow);
+#endif
+ color.xyz += res;
+ }
+ color.xyz += base_color.xyz * ambient_light;
+
+ // Calculate lighting from environment
+#ifdef USE_IBL
+ // TODO
+#endif
+
+ // Apply occlusion
+#ifdef HAS_OCCLUSION_TEX
+ float ao = texture(material.occlusion_texture, uv_0).r;
+ color.xyz *= ao;
+#endif
+
+ // Apply emissive map
+ vec3 emissive = material.emissive_factor;
+#ifdef HAS_EMISSIVE_TEX
+ emissive *= srgb_to_linear(texture(material.emissive_texture, uv_0)).rgb;
+#endif
+ color.xyz += emissive * material.emissive_factor;
+
+#ifdef COLOR_0_LOC
+ color *= color_multiplier;
+#endif
+
+ frag_color = clamp(vec4(pow(color.xyz, vec3(1.0/2.2)), color.a * base_color.a), 0.0, 1.0);
+
+#else
+ // TODO GLOSSY MATERIAL BRDF
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Handle Glossy Materials
+///////////////////////////////////////////////////////////////////////////////
+
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/mesh.vert b/generate_human_motion/pyrender/build/lib/pyrender/shaders/mesh.vert
new file mode 100644
index 0000000000000000000000000000000000000000..cfd241c3544718a261f961c3aa3c03aa13c97761
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/mesh.vert
@@ -0,0 +1,86 @@
+#version 330 core
+
+// Vertex Attributes
+layout(location = 0) in vec3 position;
+#ifdef NORMAL_LOC
+layout(location = NORMAL_LOC) in vec3 normal;
+#endif
+#ifdef TANGENT_LOC
+layout(location = TANGENT_LOC) in vec4 tangent;
+#endif
+#ifdef TEXCOORD_0_LOC
+layout(location = TEXCOORD_0_LOC) in vec2 texcoord_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+layout(location = TEXCOORD_1_LOC) in vec2 texcoord_1;
+#endif
+#ifdef COLOR_0_LOC
+layout(location = COLOR_0_LOC) in vec4 color_0;
+#endif
+#ifdef JOINTS_0_LOC
+layout(location = JOINTS_0_LOC) in vec4 joints_0;
+#endif
+#ifdef WEIGHTS_0_LOC
+layout(location = WEIGHTS_0_LOC) in vec4 weights_0;
+#endif
+layout(location = INST_M_LOC) in mat4 inst_m;
+
+// Uniforms
+uniform mat4 M;
+uniform mat4 V;
+uniform mat4 P;
+
+// Outputs
+out vec3 frag_position;
+#ifdef NORMAL_LOC
+out vec3 frag_normal;
+#endif
+#ifdef HAS_NORMAL_TEX
+#ifdef TANGENT_LOC
+#ifdef NORMAL_LOC
+out mat3 tbn;
+#endif
+#endif
+#endif
+#ifdef TEXCOORD_0_LOC
+out vec2 uv_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+out vec2 uv_1;
+#endif
+#ifdef COLOR_0_LOC
+out vec4 color_multiplier;
+#endif
+
+
+void main()
+{
+ gl_Position = P * V * M * inst_m * vec4(position, 1);
+ frag_position = vec3(M * inst_m * vec4(position, 1.0));
+
+ mat4 N = transpose(inverse(M * inst_m));
+
+#ifdef NORMAL_LOC
+ frag_normal = normalize(vec3(N * vec4(normal, 0.0)));
+#endif
+
+#ifdef HAS_NORMAL_TEX
+#ifdef TANGENT_LOC
+#ifdef NORMAL_LOC
+ vec3 normal_w = normalize(vec3(N * vec4(normal, 0.0)));
+ vec3 tangent_w = normalize(vec3(N * vec4(tangent.xyz, 0.0)));
+ vec3 bitangent_w = cross(normal_w, tangent_w) * tangent.w;
+ tbn = mat3(tangent_w, bitangent_w, normal_w);
+#endif
+#endif
+#endif
+#ifdef TEXCOORD_0_LOC
+ uv_0 = texcoord_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+ uv_1 = texcoord_1;
+#endif
+#ifdef COLOR_0_LOC
+ color_multiplier = color_0;
+#endif
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/mesh_depth.frag b/generate_human_motion/pyrender/build/lib/pyrender/shaders/mesh_depth.frag
new file mode 100644
index 0000000000000000000000000000000000000000..d8b1fac6091cfa457ba835ae0758e955f06d8754
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/mesh_depth.frag
@@ -0,0 +1,8 @@
+#version 330 core
+
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = vec4(1.0);
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/mesh_depth.vert b/generate_human_motion/pyrender/build/lib/pyrender/shaders/mesh_depth.vert
new file mode 100644
index 0000000000000000000000000000000000000000..e534c058fb3e7b0efbec090513d55982db68ccaf
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/mesh_depth.vert
@@ -0,0 +1,13 @@
+#version 330 core
+layout(location = 0) in vec3 position;
+layout(location = INST_M_LOC) in mat4 inst_m;
+
+uniform mat4 P;
+uniform mat4 V;
+uniform mat4 M;
+
+void main()
+{
+ mat4 light_matrix = P * V;
+ gl_Position = light_matrix * M * inst_m * vec4(position, 1.0);
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/segmentation.frag b/generate_human_motion/pyrender/build/lib/pyrender/shaders/segmentation.frag
new file mode 100644
index 0000000000000000000000000000000000000000..40deb92cbdef3ec9fd952632624cd5f4b5ce0c84
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/segmentation.frag
@@ -0,0 +1,13 @@
+#version 330 core
+
+uniform vec3 color;
+out vec4 frag_color;
+
+///////////////////////////////////////////////////////////////////////////////
+// MAIN
+///////////////////////////////////////////////////////////////////////////////
+void main()
+{
+ frag_color = vec4(color, 1.0);
+ //frag_color = vec4(1.0, 0.5, 0.5, 1.0);
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/segmentation.vert b/generate_human_motion/pyrender/build/lib/pyrender/shaders/segmentation.vert
new file mode 100644
index 0000000000000000000000000000000000000000..503382599dae3c9415845f35b99d6678cfc7f716
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/segmentation.vert
@@ -0,0 +1,14 @@
+#version 330 core
+layout(location = 0) in vec3 position;
+layout(location = INST_M_LOC) in mat4 inst_m;
+
+uniform mat4 P;
+uniform mat4 V;
+uniform mat4 M;
+
+void main()
+{
+ mat4 light_matrix = P * V;
+ gl_Position = light_matrix * M * inst_m * vec4(position, 1.0);
+}
+
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/text.frag b/generate_human_motion/pyrender/build/lib/pyrender/shaders/text.frag
new file mode 100644
index 0000000000000000000000000000000000000000..486c97dc94ed5e9083ae348bc1e85c5cb26c44dc
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/text.frag
@@ -0,0 +1,12 @@
+#version 330 core
+in vec2 uv;
+out vec4 color;
+
+uniform sampler2D text;
+uniform vec4 text_color;
+
+void main()
+{
+ vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, uv).r);
+ color = text_color * sampled;
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/text.vert b/generate_human_motion/pyrender/build/lib/pyrender/shaders/text.vert
new file mode 100644
index 0000000000000000000000000000000000000000..005bc439b3d63522df99e5db2088953eb8defcf4
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/text.vert
@@ -0,0 +1,12 @@
+#version 330 core
+layout (location = 0) in vec4 vertex;
+
+out vec2 uv;
+
+uniform mat4 projection;
+
+void main()
+{
+ gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);
+ uv = vertex.zw;
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/vertex_normals.frag b/generate_human_motion/pyrender/build/lib/pyrender/shaders/vertex_normals.frag
new file mode 100644
index 0000000000000000000000000000000000000000..edf5beb7f283dd67e1710bff922555539966cee4
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/vertex_normals.frag
@@ -0,0 +1,10 @@
+#version 330 core
+
+out vec4 frag_color;
+
+uniform vec4 normal_color;
+
+void main()
+{
+ frag_color = normal_color;
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/vertex_normals.geom b/generate_human_motion/pyrender/build/lib/pyrender/shaders/vertex_normals.geom
new file mode 100644
index 0000000000000000000000000000000000000000..57f0b0e645e72d41116f5767d66fc37d01ed2714
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/vertex_normals.geom
@@ -0,0 +1,74 @@
+#version 330 core
+
+layout (triangles) in;
+
+#ifdef FACE_NORMALS
+
+#ifdef VERTEX_NORMALS
+ layout (line_strip, max_vertices = 8) out;
+#else
+ layout (line_strip, max_vertices = 2) out;
+#endif
+
+#else
+
+ layout (line_strip, max_vertices = 6) out;
+
+#endif
+
+in VS_OUT {
+ vec3 position;
+ vec3 normal;
+ mat4 mvp;
+} gs_in[];
+
+uniform float normal_magnitude;
+
+void GenerateVertNormal(int index)
+{
+
+ vec4 p0 = gs_in[index].mvp * vec4(gs_in[index].position, 1.0);
+ vec4 p1 = gs_in[index].mvp * vec4(normal_magnitude * normalize(gs_in[index].normal) + gs_in[index].position, 1.0);
+ gl_Position = p0;
+ EmitVertex();
+ gl_Position = p1;
+ EmitVertex();
+ EndPrimitive();
+}
+
+void GenerateFaceNormal()
+{
+ vec3 p0 = gs_in[0].position.xyz;
+ vec3 p1 = gs_in[1].position.xyz;
+ vec3 p2 = gs_in[2].position.xyz;
+
+ vec3 v0 = p0 - p1;
+ vec3 v1 = p2 - p1;
+
+ vec3 N = normalize(cross(v1, v0));
+ vec3 P = (p0 + p1 + p2) / 3.0;
+
+ vec4 np0 = gs_in[0].mvp * vec4(P, 1.0);
+ vec4 np1 = gs_in[0].mvp * vec4(normal_magnitude * N + P, 1.0);
+
+ gl_Position = np0;
+ EmitVertex();
+ gl_Position = np1;
+ EmitVertex();
+ EndPrimitive();
+}
+
+void main()
+{
+
+#ifdef FACE_NORMALS
+ GenerateFaceNormal();
+#endif
+
+#ifdef VERTEX_NORMALS
+ GenerateVertNormal(0);
+ GenerateVertNormal(1);
+ GenerateVertNormal(2);
+#endif
+
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/vertex_normals.vert b/generate_human_motion/pyrender/build/lib/pyrender/shaders/vertex_normals.vert
new file mode 100644
index 0000000000000000000000000000000000000000..be22eed2a0e904bcaf1ac5a4721558e574cddc62
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/vertex_normals.vert
@@ -0,0 +1,27 @@
+#version 330 core
+
+// Inputs
+layout(location = 0) in vec3 position;
+layout(location = NORMAL_LOC) in vec3 normal;
+layout(location = INST_M_LOC) in mat4 inst_m;
+
+// Output data
+out VS_OUT {
+ vec3 position;
+ vec3 normal;
+ mat4 mvp;
+} vs_out;
+
+// Uniform data
+uniform mat4 M;
+uniform mat4 V;
+uniform mat4 P;
+
+// Render loop
+void main() {
+ vs_out.mvp = P * V * M * inst_m;
+ vs_out.position = position;
+ vs_out.normal = normal;
+
+ gl_Position = vec4(position, 1.0);
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/shaders/vertex_normals_pc.geom b/generate_human_motion/pyrender/build/lib/pyrender/shaders/vertex_normals_pc.geom
new file mode 100644
index 0000000000000000000000000000000000000000..4ea4e7b8542703f64b8d28fd187e425137861fe4
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/shaders/vertex_normals_pc.geom
@@ -0,0 +1,29 @@
+#version 330 core
+
+layout (points) in;
+
+layout (line_strip, max_vertices = 2) out;
+
+in VS_OUT {
+ vec3 position;
+ vec3 normal;
+ mat4 mvp;
+} gs_in[];
+
+uniform float normal_magnitude;
+
+void GenerateVertNormal(int index)
+{
+ vec4 p0 = gs_in[index].mvp * vec4(gs_in[index].position, 1.0);
+ vec4 p1 = gs_in[index].mvp * vec4(normal_magnitude * normalize(gs_in[index].normal) + gs_in[index].position, 1.0);
+ gl_Position = p0;
+ EmitVertex();
+ gl_Position = p1;
+ EmitVertex();
+ EndPrimitive();
+}
+
+void main()
+{
+ GenerateVertNormal(0);
+}
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/texture.py b/generate_human_motion/pyrender/build/lib/pyrender/texture.py
new file mode 100644
index 0000000000000000000000000000000000000000..477759729d7b995a4f276e81d649617d045a066e
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/texture.py
@@ -0,0 +1,259 @@
+"""Textures, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-texture
+
+Author: Matthew Matl
+"""
+import numpy as np
+
+from OpenGL.GL import *
+
+from .utils import format_texture_source
+from .sampler import Sampler
+
+
+class Texture(object):
+ """A texture and its sampler.
+
+ Parameters
+ ----------
+ name : str, optional
+ The user-defined name of this object.
+ sampler : :class:`Sampler`
+ The sampler used by this texture.
+ source : (h,w,c) uint8 or (h,w,c) float or :class:`PIL.Image.Image`
+ The image used by this texture. If None, the texture is created
+ empty and width and height must be specified.
+ source_channels : str
+ Either `D`, `R`, `RG`, `GB`, `RGB`, or `RGBA`. Indicates the
+ channels to extract from `source`. Any missing channels will be filled
+ with `1.0`.
+ width : int, optional
+ For empty textures, the width of the texture buffer.
+ height : int, optional
+ For empty textures, the height of the texture buffer.
+ tex_type : int
+ Either GL_TEXTURE_2D or GL_TEXTURE_CUBE.
+ data_format : int
+ For now, just GL_FLOAT.
+ """
+
+ def __init__(self,
+ name=None,
+ sampler=None,
+ source=None,
+ source_channels=None,
+ width=None,
+ height=None,
+ tex_type=GL_TEXTURE_2D,
+ data_format=GL_UNSIGNED_BYTE):
+ self.source_channels = source_channels
+ self.name = name
+ self.sampler = sampler
+ self.source = source
+ self.width = width
+ self.height = height
+ self.tex_type = tex_type
+ self.data_format = data_format
+
+ self._texid = None
+ self._is_transparent = False
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def sampler(self):
+ """:class:`Sampler` : The sampler used by this texture.
+ """
+ return self._sampler
+
+ @sampler.setter
+ def sampler(self, value):
+ if value is None:
+ value = Sampler()
+ self._sampler = value
+
+ @property
+ def source(self):
+ """(h,w,c) uint8 or float or :class:`PIL.Image.Image` : The image
+ used in this texture.
+ """
+ return self._source
+
+ @source.setter
+ def source(self, value):
+ if value is None:
+ self._source = None
+ else:
+ self._source = format_texture_source(value, self.source_channels)
+ self._is_transparent = False
+
+ @property
+ def source_channels(self):
+ """str : The channels that were extracted from the original source.
+ """
+ return self._source_channels
+
+ @source_channels.setter
+ def source_channels(self, value):
+ self._source_channels = value
+
+ @property
+ def width(self):
+ """int : The width of the texture buffer.
+ """
+ return self._width
+
+ @width.setter
+ def width(self, value):
+ self._width = value
+
+ @property
+ def height(self):
+ """int : The height of the texture buffer.
+ """
+ return self._height
+
+ @height.setter
+ def height(self, value):
+ self._height = value
+
+ @property
+ def tex_type(self):
+ """int : The type of the texture.
+ """
+ return self._tex_type
+
+ @tex_type.setter
+ def tex_type(self, value):
+ self._tex_type = value
+
+ @property
+ def data_format(self):
+ """int : The format of the texture data.
+ """
+ return self._data_format
+
+ @data_format.setter
+ def data_format(self, value):
+ self._data_format = value
+
+ def is_transparent(self, cutoff=1.0):
+ """bool : If True, the texture is partially transparent.
+ """
+ if self._is_transparent is None:
+ self._is_transparent = False
+ if self.source_channels == 'RGBA' and self.source is not None:
+ if np.any(self.source[:,:,3] < cutoff):
+ self._is_transparent = True
+ return self._is_transparent
+
+ def delete(self):
+ """Remove this texture from the OpenGL context.
+ """
+ self._unbind()
+ self._remove_from_context()
+
+ ##################
+ # OpenGL code
+ ##################
+ def _add_to_context(self):
+ if self._texid is not None:
+ raise ValueError('Texture already loaded into OpenGL context')
+
+ fmt = GL_DEPTH_COMPONENT
+ if self.source_channels == 'R':
+ fmt = GL_RED
+ elif self.source_channels == 'RG' or self.source_channels == 'GB':
+ fmt = GL_RG
+ elif self.source_channels == 'RGB':
+ fmt = GL_RGB
+ elif self.source_channels == 'RGBA':
+ fmt = GL_RGBA
+
+ # Generate the OpenGL texture
+ self._texid = glGenTextures(1)
+ glBindTexture(self.tex_type, self._texid)
+
+ # Flip data for OpenGL buffer
+ data = None
+ width = self.width
+ height = self.height
+ if self.source is not None:
+ data = np.ascontiguousarray(np.flip(self.source, axis=0).flatten())
+ width = self.source.shape[1]
+ height = self.source.shape[0]
+
+ # Bind texture and generate mipmaps
+ glTexImage2D(
+ self.tex_type, 0, fmt, width, height, 0, fmt,
+ self.data_format, data
+ )
+ if self.source is not None:
+ glGenerateMipmap(self.tex_type)
+
+ if self.sampler.magFilter is not None:
+ glTexParameteri(
+ self.tex_type, GL_TEXTURE_MAG_FILTER, self.sampler.magFilter
+ )
+ else:
+ if self.source is not None:
+ glTexParameteri(self.tex_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
+ else:
+ glTexParameteri(self.tex_type, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
+ if self.sampler.minFilter is not None:
+ glTexParameteri(
+ self.tex_type, GL_TEXTURE_MIN_FILTER, self.sampler.minFilter
+ )
+ else:
+ if self.source is not None:
+ glTexParameteri(self.tex_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)
+ else:
+ glTexParameteri(self.tex_type, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
+
+ glTexParameteri(self.tex_type, GL_TEXTURE_WRAP_S, self.sampler.wrapS)
+ glTexParameteri(self.tex_type, GL_TEXTURE_WRAP_T, self.sampler.wrapT)
+ border_color = 255 * np.ones(4).astype(np.uint8)
+ if self.data_format == GL_FLOAT:
+ border_color = np.ones(4).astype(np.float32)
+ glTexParameterfv(
+ self.tex_type, GL_TEXTURE_BORDER_COLOR,
+ border_color
+ )
+
+ # Unbind texture
+ glBindTexture(self.tex_type, 0)
+
+ def _remove_from_context(self):
+ if self._texid is not None:
+ # TODO OPENGL BUG?
+ # glDeleteTextures(1, [self._texid])
+ glDeleteTextures([self._texid])
+ self._texid = None
+
+ def _in_context(self):
+ return self._texid is not None
+
+ def _bind(self):
+ # TODO HANDLE INDEXING INTO OTHER UV's
+ glBindTexture(self.tex_type, self._texid)
+
+ def _unbind(self):
+ glBindTexture(self.tex_type, 0)
+
+ def _bind_as_depth_attachment(self):
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ self.tex_type, self._texid, 0)
+
+ def _bind_as_color_attachment(self):
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ self.tex_type, self._texid, 0)
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/trackball.py b/generate_human_motion/pyrender/build/lib/pyrender/trackball.py
new file mode 100644
index 0000000000000000000000000000000000000000..3e57a0e82d3f07b80754f575c28a0e05cb73fc50
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/trackball.py
@@ -0,0 +1,216 @@
+"""Trackball class for 3D manipulation of viewpoints.
+"""
+import numpy as np
+
+import trimesh.transformations as transformations
+
+
+class Trackball(object):
+ """A trackball class for creating camera transforms from mouse movements.
+ """
+ STATE_ROTATE = 0
+ STATE_PAN = 1
+ STATE_ROLL = 2
+ STATE_ZOOM = 3
+
+ def __init__(self, pose, size, scale,
+ target=np.array([0.0, 0.0, 0.0])):
+ """Initialize a trackball with an initial camera-to-world pose
+ and the given parameters.
+
+ Parameters
+ ----------
+ pose : [4,4]
+ An initial camera-to-world pose for the trackball.
+
+ size : (float, float)
+ The width and height of the camera image in pixels.
+
+ scale : float
+ The diagonal of the scene's bounding box --
+ used for ensuring translation motions are sufficiently
+ fast for differently-sized scenes.
+
+ target : (3,) float
+ The center of the scene in world coordinates.
+ The trackball will revolve around this point.
+ """
+ self._size = np.array(size)
+ self._scale = float(scale)
+
+ self._pose = pose
+ self._n_pose = pose
+
+ self._target = target
+ self._n_target = target
+
+ self._state = Trackball.STATE_ROTATE
+
+ @property
+ def pose(self):
+ """autolab_core.RigidTransform : The current camera-to-world pose.
+ """
+ return self._n_pose
+
+ def set_state(self, state):
+ """Set the state of the trackball in order to change the effect of
+ dragging motions.
+
+ Parameters
+ ----------
+ state : int
+ One of Trackball.STATE_ROTATE, Trackball.STATE_PAN,
+ Trackball.STATE_ROLL, and Trackball.STATE_ZOOM.
+ """
+ self._state = state
+
+ def resize(self, size):
+ """Resize the window.
+
+ Parameters
+ ----------
+ size : (float, float)
+ The new width and height of the camera image in pixels.
+ """
+ self._size = np.array(size)
+
+ def down(self, point):
+ """Record an initial mouse press at a given point.
+
+ Parameters
+ ----------
+ point : (2,) int
+ The x and y pixel coordinates of the mouse press.
+ """
+ self._pdown = np.array(point, dtype=np.float32)
+ self._pose = self._n_pose
+ self._target = self._n_target
+
+ def drag(self, point):
+ """Update the tracball during a drag.
+
+ Parameters
+ ----------
+ point : (2,) int
+ The current x and y pixel coordinates of the mouse during a drag.
+ This will compute a movement for the trackball with the relative
+ motion between this point and the one marked by down().
+ """
+ point = np.array(point, dtype=np.float32)
+ dx, dy = point - self._pdown
+ mindim = 0.3 * np.min(self._size)
+
+ target = self._target
+ x_axis = self._pose[:3,0].flatten()
+ y_axis = self._pose[:3,1].flatten()
+ z_axis = self._pose[:3,2].flatten()
+ eye = self._pose[:3,3].flatten()
+
+ # Interpret drag as a rotation
+ if self._state == Trackball.STATE_ROTATE:
+ x_angle = -dx / mindim
+ x_rot_mat = transformations.rotation_matrix(
+ x_angle, y_axis, target
+ )
+
+ y_angle = dy / mindim
+ y_rot_mat = transformations.rotation_matrix(
+ y_angle, x_axis, target
+ )
+
+ self._n_pose = y_rot_mat.dot(x_rot_mat.dot(self._pose))
+
+ # Interpret drag as a roll about the camera axis
+ elif self._state == Trackball.STATE_ROLL:
+ center = self._size / 2.0
+ v_init = self._pdown - center
+ v_curr = point - center
+ v_init = v_init / np.linalg.norm(v_init)
+ v_curr = v_curr / np.linalg.norm(v_curr)
+
+ theta = (-np.arctan2(v_curr[1], v_curr[0]) +
+ np.arctan2(v_init[1], v_init[0]))
+
+ rot_mat = transformations.rotation_matrix(theta, z_axis, target)
+
+ self._n_pose = rot_mat.dot(self._pose)
+
+ # Interpret drag as a camera pan in view plane
+ elif self._state == Trackball.STATE_PAN:
+ dx = -dx / (5.0 * mindim) * self._scale
+ dy = -dy / (5.0 * mindim) * self._scale
+
+ translation = dx * x_axis + dy * y_axis
+ self._n_target = self._target + translation
+ t_tf = np.eye(4)
+ t_tf[:3,3] = translation
+ self._n_pose = t_tf.dot(self._pose)
+
+ # Interpret drag as a zoom motion
+ elif self._state == Trackball.STATE_ZOOM:
+ radius = np.linalg.norm(eye - target)
+ ratio = 0.0
+ if dy > 0:
+ ratio = np.exp(abs(dy) / (0.5 * self._size[1])) - 1.0
+ elif dy < 0:
+ ratio = 1.0 - np.exp(dy / (0.5 * (self._size[1])))
+ translation = -np.sign(dy) * ratio * radius * z_axis
+ t_tf = np.eye(4)
+ t_tf[:3,3] = translation
+ self._n_pose = t_tf.dot(self._pose)
+
+ def scroll(self, clicks):
+ """Zoom using a mouse scroll wheel motion.
+
+ Parameters
+ ----------
+ clicks : int
+ The number of clicks. Positive numbers indicate forward wheel
+ movement.
+ """
+ target = self._target
+ ratio = 0.90
+
+ mult = 1.0
+ if clicks > 0:
+ mult = ratio**clicks
+ elif clicks < 0:
+ mult = (1.0 / ratio)**abs(clicks)
+
+ z_axis = self._n_pose[:3,2].flatten()
+ eye = self._n_pose[:3,3].flatten()
+ radius = np.linalg.norm(eye - target)
+ translation = (mult * radius - radius) * z_axis
+ t_tf = np.eye(4)
+ t_tf[:3,3] = translation
+ self._n_pose = t_tf.dot(self._n_pose)
+
+ z_axis = self._pose[:3,2].flatten()
+ eye = self._pose[:3,3].flatten()
+ radius = np.linalg.norm(eye - target)
+ translation = (mult * radius - radius) * z_axis
+ t_tf = np.eye(4)
+ t_tf[:3,3] = translation
+ self._pose = t_tf.dot(self._pose)
+
+ def rotate(self, azimuth, axis=None):
+ """Rotate the trackball about the "Up" axis by azimuth radians.
+
+ Parameters
+ ----------
+ azimuth : float
+ The number of radians to rotate.
+ """
+ target = self._target
+
+ y_axis = self._n_pose[:3,1].flatten()
+ if axis is not None:
+ y_axis = axis
+ x_rot_mat = transformations.rotation_matrix(azimuth, y_axis, target)
+ self._n_pose = x_rot_mat.dot(self._n_pose)
+
+ y_axis = self._pose[:3,1].flatten()
+ if axis is not None:
+ y_axis = axis
+ x_rot_mat = transformations.rotation_matrix(azimuth, y_axis, target)
+ self._pose = x_rot_mat.dot(self._pose)
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/utils.py b/generate_human_motion/pyrender/build/lib/pyrender/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..48a11faf991606ad7fb0691582f0bc6f06101a45
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/utils.py
@@ -0,0 +1,115 @@
+import numpy as np
+from PIL import Image
+
+
+def format_color_vector(value, length):
+ """Format a color vector.
+ """
+ if isinstance(value, int):
+ value = value / 255.0
+ if isinstance(value, float):
+ value = np.repeat(value, length)
+ if isinstance(value, list) or isinstance(value, tuple):
+ value = np.array(value)
+ if isinstance(value, np.ndarray):
+ value = value.squeeze()
+ if np.issubdtype(value.dtype, np.integer):
+ value = (value / 255.0).astype(np.float32)
+ if value.ndim != 1:
+ raise ValueError('Format vector takes only 1-D vectors')
+ if length > value.shape[0]:
+ value = np.hstack((value, np.ones(length - value.shape[0])))
+ elif length < value.shape[0]:
+ value = value[:length]
+ else:
+ raise ValueError('Invalid vector data type')
+
+ return value.squeeze().astype(np.float32)
+
+
+def format_color_array(value, shape):
+ """Format an array of colors.
+ """
+ # Convert uint8 to floating
+ value = np.asanyarray(value)
+ if np.issubdtype(value.dtype, np.integer):
+ value = (value / 255.0).astype(np.float32)
+
+ # Match up shapes
+ if value.ndim == 1:
+ value = np.tile(value, (shape[0],1))
+ if value.shape[1] < shape[1]:
+ nc = shape[1] - value.shape[1]
+ value = np.column_stack((value, np.ones((value.shape[0], nc))))
+ elif value.shape[1] > shape[1]:
+ value = value[:,:shape[1]]
+ return value.astype(np.float32)
+
+
+def format_texture_source(texture, target_channels='RGB'):
+ """Format a texture as a float32 np array.
+ """
+
+ # Pass through None
+ if texture is None:
+ return None
+
+ # Convert PIL images into numpy arrays
+ if isinstance(texture, Image.Image):
+ if texture.mode == 'P' and target_channels in ('RGB', 'RGBA'):
+ texture = np.array(texture.convert(target_channels))
+ else:
+ texture = np.array(texture)
+
+ # Format numpy arrays
+ if isinstance(texture, np.ndarray):
+ if np.issubdtype(texture.dtype, np.floating):
+ texture = np.array(texture * 255.0, dtype=np.uint8)
+ elif np.issubdtype(texture.dtype, np.integer):
+ texture = texture.astype(np.uint8)
+ else:
+ raise TypeError('Invalid type {} for texture'.format(
+ type(texture)
+ ))
+
+ # Format array by picking out correct texture channels or padding
+ if texture.ndim == 2:
+ texture = texture[:,:,np.newaxis]
+ if target_channels == 'R':
+ texture = texture[:,:,0]
+ texture = texture.squeeze()
+ elif target_channels == 'RG':
+ if texture.shape[2] == 1:
+ texture = np.repeat(texture, 2, axis=2)
+ else:
+ texture = texture[:,:,(0,1)]
+ elif target_channels == 'GB':
+ if texture.shape[2] == 1:
+ texture = np.repeat(texture, 2, axis=2)
+ elif texture.shape[2] > 2:
+ texture = texture[:,:,(1,2)]
+ elif target_channels == 'RGB':
+ if texture.shape[2] == 1:
+ texture = np.repeat(texture, 3, axis=2)
+ elif texture.shape[2] == 2:
+ raise ValueError('Cannot reformat 2-channel texture into RGB')
+ else:
+ texture = texture[:,:,(0,1,2)]
+ elif target_channels == 'RGBA':
+ if texture.shape[2] == 1:
+ texture = np.repeat(texture, 4, axis=2)
+ texture[:,:,3] = 255
+ elif texture.shape[2] == 2:
+ raise ValueError('Cannot reformat 2-channel texture into RGBA')
+ elif texture.shape[2] == 3:
+ tx = np.empty((texture.shape[0], texture.shape[1], 4), dtype=np.uint8)
+ tx[:,:,:3] = texture
+ tx[:,:,3] = 255
+ texture = tx
+ else:
+ raise ValueError('Invalid texture channel specification: {}'
+ .format(target_channels))
+ else:
+ raise TypeError('Invalid type {} for texture'.format(type(texture)))
+
+ return texture
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/version.py b/generate_human_motion/pyrender/build/lib/pyrender/version.py
new file mode 100644
index 0000000000000000000000000000000000000000..a33fc87f61f528780e3319a5160769cc84512b1b
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/version.py
@@ -0,0 +1 @@
+__version__ = '0.1.45'
diff --git a/generate_human_motion/pyrender/build/lib/pyrender/viewer.py b/generate_human_motion/pyrender/build/lib/pyrender/viewer.py
new file mode 100644
index 0000000000000000000000000000000000000000..d2326c38205c6eaddb4f567e3b088329187af258
--- /dev/null
+++ b/generate_human_motion/pyrender/build/lib/pyrender/viewer.py
@@ -0,0 +1,1160 @@
+"""A pyglet-based interactive 3D scene viewer.
+"""
+import copy
+import os
+import sys
+from threading import Thread, RLock
+import time
+
+import imageio
+import numpy as np
+import OpenGL
+import trimesh
+
+try:
+ from Tkinter import Tk, tkFileDialog as filedialog
+except Exception:
+ try:
+ from tkinter import Tk, filedialog as filedialog
+ except Exception:
+ pass
+
+from .constants import (TARGET_OPEN_GL_MAJOR, TARGET_OPEN_GL_MINOR,
+ MIN_OPEN_GL_MAJOR, MIN_OPEN_GL_MINOR,
+ TEXT_PADDING, DEFAULT_SCENE_SCALE,
+ DEFAULT_Z_FAR, DEFAULT_Z_NEAR, RenderFlags, TextAlign)
+from .light import DirectionalLight
+from .node import Node
+from .camera import PerspectiveCamera, OrthographicCamera, IntrinsicsCamera
+from .trackball import Trackball
+from .renderer import Renderer
+from .mesh import Mesh
+
+import pyglet
+from pyglet import clock
+pyglet.options['shadow_window'] = False
+
+
+class Viewer(pyglet.window.Window):
+ """An interactive viewer for 3D scenes.
+
+ The viewer's camera is separate from the scene's, but will take on
+ the parameters of the scene's main view camera and start in the same pose.
+ If the scene does not have a camera, a suitable default will be provided.
+
+ Parameters
+ ----------
+ scene : :class:`Scene`
+ The scene to visualize.
+ viewport_size : (2,) int
+ The width and height of the initial viewing window.
+ render_flags : dict
+ A set of flags for rendering the scene. Described in the note below.
+ viewer_flags : dict
+ A set of flags for controlling the viewer's behavior.
+ Described in the note below.
+ registered_keys : dict
+ A map from ASCII key characters to tuples containing:
+
+ - A function to be called whenever the key is pressed,
+ whose first argument will be the viewer itself.
+ - (Optionally) A list of additional positional arguments
+ to be passed to the function.
+ - (Optionally) A dict of keyword arguments to be passed
+ to the function.
+
+ kwargs : dict
+ Any keyword arguments left over will be interpreted as belonging to
+ either the :attr:`.Viewer.render_flags` or :attr:`.Viewer.viewer_flags`
+ dictionaries. Those flag sets will be updated appropriately.
+
+ Note
+ ----
+ The basic commands for moving about the scene are given as follows:
+
+ - **Rotating about the scene**: Hold the left mouse button and
+ drag the cursor.
+ - **Rotating about the view axis**: Hold ``CTRL`` and the left mouse
+ button and drag the cursor.
+ - **Panning**:
+
+ - Hold SHIFT, then hold the left mouse button and drag the cursor, or
+ - Hold the middle mouse button and drag the cursor.
+
+ - **Zooming**:
+
+ - Scroll the mouse wheel, or
+ - Hold the right mouse button and drag the cursor.
+
+ Other keyboard commands are as follows:
+
+ - ``a``: Toggles rotational animation mode.
+ - ``c``: Toggles backface culling.
+ - ``f``: Toggles fullscreen mode.
+ - ``h``: Toggles shadow rendering.
+ - ``i``: Toggles axis display mode
+ (no axes, world axis, mesh axes, all axes).
+ - ``l``: Toggles lighting mode
+ (scene lighting, Raymond lighting, or direct lighting).
+ - ``m``: Toggles face normal visualization.
+ - ``n``: Toggles vertex normal visualization.
+ - ``o``: Toggles orthographic mode.
+ - ``q``: Quits the viewer.
+ - ``r``: Starts recording a GIF, and pressing again stops recording
+ and opens a file dialog.
+ - ``s``: Opens a file dialog to save the current view as an image.
+ - ``w``: Toggles wireframe mode
+ (scene default, flip wireframes, all wireframe, or all solid).
+ - ``z``: Resets the camera to the initial view.
+
+ Note
+ ----
+ The valid keys for ``render_flags`` are as follows:
+
+ - ``flip_wireframe``: `bool`, If `True`, all objects will have their
+ wireframe modes flipped from what their material indicates.
+ Defaults to `False`.
+ - ``all_wireframe``: `bool`, If `True`, all objects will be rendered
+ in wireframe mode. Defaults to `False`.
+ - ``all_solid``: `bool`, If `True`, all objects will be rendered in
+ solid mode. Defaults to `False`.
+ - ``shadows``: `bool`, If `True`, shadows will be rendered.
+ Defaults to `False`.
+ - ``vertex_normals``: `bool`, If `True`, vertex normals will be
+ rendered as blue lines. Defaults to `False`.
+ - ``face_normals``: `bool`, If `True`, face normals will be rendered as
+ blue lines. Defaults to `False`.
+ - ``cull_faces``: `bool`, If `True`, backfaces will be culled.
+ Defaults to `True`.
+ - ``point_size`` : float, The point size in pixels. Defaults to 1px.
+
+ Note
+ ----
+ The valid keys for ``viewer_flags`` are as follows:
+
+ - ``rotate``: `bool`, If `True`, the scene's camera will rotate
+ about an axis. Defaults to `False`.
+ - ``rotate_rate``: `float`, The rate of rotation in radians per second.
+ Defaults to `PI / 3.0`.
+ - ``rotate_axis``: `(3,) float`, The axis in world coordinates to rotate
+ about. Defaults to ``[0,0,1]``.
+ - ``view_center``: `(3,) float`, The position to rotate the scene about.
+ Defaults to the scene's centroid.
+ - ``use_raymond_lighting``: `bool`, If `True`, an additional set of three
+ directional lights that move with the camera will be added to the scene.
+ Defaults to `False`.
+ - ``use_direct_lighting``: `bool`, If `True`, an additional directional
+ light that moves with the camera and points out of it will be added to
+ the scene. Defaults to `False`.
+ - ``lighting_intensity``: `float`, The overall intensity of the
+ viewer's additional lights (when they're in use). Defaults to 3.0.
+ - ``use_perspective_cam``: `bool`, If `True`, a perspective camera will
+ be used. Otherwise, an orthographic camera is used. Defaults to `True`.
+ - ``save_directory``: `str`, A directory to open the file dialogs in.
+ Defaults to `None`.
+ - ``window_title``: `str`, A title for the viewer's application window.
+ Defaults to `"Scene Viewer"`.
+ - ``refresh_rate``: `float`, A refresh rate for rendering, in Hertz.
+ Defaults to `30.0`.
+ - ``fullscreen``: `bool`, Whether to make viewer fullscreen.
+ Defaults to `False`.
+ - ``show_world_axis``: `bool`, Whether to show the world axis.
+ Defaults to `False`.
+ - ``show_mesh_axes``: `bool`, Whether to show the individual mesh axes.
+ Defaults to `False`.
+ - ``caption``: `list of dict`, Text caption(s) to display on the viewer.
+ Defaults to `None`.
+
+ Note
+ ----
+ Animation can be accomplished by running the viewer with ``run_in_thread``
+ enabled. Then, just run a loop in your main thread, updating the scene as
+ needed. Before updating the scene, be sure to acquire the
+ :attr:`.Viewer.render_lock`, and release it when your update is done.
+ """
+
+ def __init__(self, scene, viewport_size=None,
+ render_flags=None, viewer_flags=None,
+ registered_keys=None, run_in_thread=False,
+ auto_start=True,
+ **kwargs):
+
+ #######################################################################
+ # Save attributes and flags
+ #######################################################################
+ if viewport_size is None:
+ viewport_size = (640, 480)
+ self._scene = scene
+ self._viewport_size = viewport_size
+ self._render_lock = RLock()
+ self._is_active = False
+ self._should_close = False
+ self._run_in_thread = run_in_thread
+ self._auto_start = auto_start
+
+ self._default_render_flags = {
+ 'flip_wireframe': False,
+ 'all_wireframe': False,
+ 'all_solid': False,
+ 'shadows': False,
+ 'vertex_normals': False,
+ 'face_normals': False,
+ 'cull_faces': True,
+ 'point_size': 1.0,
+ }
+ self._default_viewer_flags = {
+ 'mouse_pressed': False,
+ 'rotate': False,
+ 'rotate_rate': np.pi / 3.0,
+ 'rotate_axis': np.array([0.0, 0.0, 1.0]),
+ 'view_center': None,
+ 'record': False,
+ 'use_raymond_lighting': False,
+ 'use_direct_lighting': False,
+ 'lighting_intensity': 3.0,
+ 'use_perspective_cam': True,
+ 'save_directory': None,
+ 'window_title': 'Scene Viewer',
+ 'refresh_rate': 30.0,
+ 'fullscreen': False,
+ 'show_world_axis': False,
+ 'show_mesh_axes': False,
+ 'caption': None
+ }
+ self._render_flags = self._default_render_flags.copy()
+ self._viewer_flags = self._default_viewer_flags.copy()
+ self._viewer_flags['rotate_axis'] = (
+ self._default_viewer_flags['rotate_axis'].copy()
+ )
+
+ if render_flags is not None:
+ self._render_flags.update(render_flags)
+ if viewer_flags is not None:
+ self._viewer_flags.update(viewer_flags)
+
+ for key in kwargs:
+ if key in self.render_flags:
+ self._render_flags[key] = kwargs[key]
+ elif key in self.viewer_flags:
+ self._viewer_flags[key] = kwargs[key]
+
+ # TODO MAC OS BUG FOR SHADOWS
+ if sys.platform == 'darwin':
+ self._render_flags['shadows'] = False
+
+ self._registered_keys = {}
+ if registered_keys is not None:
+ self._registered_keys = {
+ ord(k.lower()): registered_keys[k] for k in registered_keys
+ }
+
+ #######################################################################
+ # Save internal settings
+ #######################################################################
+
+ # Set up caption stuff
+ self._message_text = None
+ self._ticks_till_fade = 2.0 / 3.0 * self.viewer_flags['refresh_rate']
+ self._message_opac = 1.0 + self._ticks_till_fade
+
+ # Set up raymond lights and direct lights
+ self._raymond_lights = self._create_raymond_lights()
+ self._direct_light = self._create_direct_light()
+
+ # Set up axes
+ self._axes = {}
+ self._axis_mesh = Mesh.from_trimesh(
+ trimesh.creation.axis(origin_size=0.1, axis_radius=0.05,
+ axis_length=1.0), smooth=False)
+ if self.viewer_flags['show_world_axis']:
+ self._set_axes(world=self.viewer_flags['show_world_axis'],
+ mesh=self.viewer_flags['show_mesh_axes'])
+
+ #######################################################################
+ # Set up camera node
+ #######################################################################
+ self._camera_node = None
+ self._prior_main_camera_node = None
+ self._default_camera_pose = None
+ self._default_persp_cam = None
+ self._default_orth_cam = None
+ self._trackball = None
+ self._saved_frames = []
+
+ # Extract main camera from scene and set up our mirrored copy
+ znear = None
+ zfar = None
+ if scene.main_camera_node is not None:
+ n = scene.main_camera_node
+ camera = copy.copy(n.camera)
+ if isinstance(camera, (PerspectiveCamera, IntrinsicsCamera)):
+ self._default_persp_cam = camera
+ znear = camera.znear
+ zfar = camera.zfar
+ elif isinstance(camera, OrthographicCamera):
+ self._default_orth_cam = camera
+ znear = camera.znear
+ zfar = camera.zfar
+ self._default_camera_pose = scene.get_pose(scene.main_camera_node)
+ self._prior_main_camera_node = n
+
+ # Set defaults as needed
+ if zfar is None:
+ zfar = max(scene.scale * 10.0, DEFAULT_Z_FAR)
+ if znear is None or znear == 0:
+ if scene.scale == 0:
+ znear = DEFAULT_Z_NEAR
+ else:
+ znear = min(scene.scale / 10.0, DEFAULT_Z_NEAR)
+
+ if self._default_persp_cam is None:
+ self._default_persp_cam = PerspectiveCamera(
+ yfov=np.pi / 3.0, znear=znear, zfar=zfar
+ )
+ if self._default_orth_cam is None:
+ xmag = ymag = scene.scale
+ if scene.scale == 0:
+ xmag = ymag = 1.0
+ self._default_orth_cam = OrthographicCamera(
+ xmag=xmag, ymag=ymag,
+ znear=znear,
+ zfar=zfar
+ )
+ if self._default_camera_pose is None:
+ self._default_camera_pose = self._compute_initial_camera_pose()
+
+ # Pick camera
+ if self.viewer_flags['use_perspective_cam']:
+ camera = self._default_persp_cam
+ else:
+ camera = self._default_orth_cam
+
+ self._camera_node = Node(
+ matrix=self._default_camera_pose, camera=camera
+ )
+ scene.add_node(self._camera_node)
+ scene.main_camera_node = self._camera_node
+ self._reset_view()
+
+ #######################################################################
+ # Initialize OpenGL context and renderer
+ #######################################################################
+ self._renderer = Renderer(
+ self._viewport_size[0], self._viewport_size[1],
+ self.render_flags['point_size']
+ )
+ self._is_active = True
+
+ if self.run_in_thread:
+ self._thread = Thread(target=self._init_and_start_app)
+ self._thread.start()
+ else:
+ if auto_start:
+ self._init_and_start_app()
+
+ def start(self):
+ self._init_and_start_app()
+
+ @property
+ def scene(self):
+ """:class:`.Scene` : The scene being visualized.
+ """
+ return self._scene
+
+ @property
+ def viewport_size(self):
+ """(2,) int : The width and height of the viewing window.
+ """
+ return self._viewport_size
+
+ @property
+ def render_lock(self):
+ """:class:`threading.RLock` : If acquired, prevents the viewer from
+ rendering until released.
+
+ Run :meth:`.Viewer.render_lock.acquire` before making updates to
+ the scene in a different thread, and run
+ :meth:`.Viewer.render_lock.release` once you're done to let the viewer
+ continue.
+ """
+ return self._render_lock
+
+ @property
+ def is_active(self):
+ """bool : `True` if the viewer is active, or `False` if it has
+ been closed.
+ """
+ return self._is_active
+
+ @property
+ def run_in_thread(self):
+ """bool : Whether the viewer was run in a separate thread.
+ """
+ return self._run_in_thread
+
+ @property
+ def render_flags(self):
+ """dict : Flags for controlling the renderer's behavior.
+
+ - ``flip_wireframe``: `bool`, If `True`, all objects will have their
+ wireframe modes flipped from what their material indicates.
+ Defaults to `False`.
+ - ``all_wireframe``: `bool`, If `True`, all objects will be rendered
+ in wireframe mode. Defaults to `False`.
+ - ``all_solid``: `bool`, If `True`, all objects will be rendered in
+ solid mode. Defaults to `False`.
+ - ``shadows``: `bool`, If `True`, shadows will be rendered.
+ Defaults to `False`.
+ - ``vertex_normals``: `bool`, If `True`, vertex normals will be
+ rendered as blue lines. Defaults to `False`.
+ - ``face_normals``: `bool`, If `True`, face normals will be rendered as
+ blue lines. Defaults to `False`.
+ - ``cull_faces``: `bool`, If `True`, backfaces will be culled.
+ Defaults to `True`.
+ - ``point_size`` : float, The point size in pixels. Defaults to 1px.
+
+ """
+ return self._render_flags
+
+ @render_flags.setter
+ def render_flags(self, value):
+ self._render_flags = value
+
+ @property
+ def viewer_flags(self):
+ """dict : Flags for controlling the viewer's behavior.
+
+ The valid keys for ``viewer_flags`` are as follows:
+
+ - ``rotate``: `bool`, If `True`, the scene's camera will rotate
+ about an axis. Defaults to `False`.
+ - ``rotate_rate``: `float`, The rate of rotation in radians per second.
+ Defaults to `PI / 3.0`.
+ - ``rotate_axis``: `(3,) float`, The axis in world coordinates to
+ rotate about. Defaults to ``[0,0,1]``.
+ - ``view_center``: `(3,) float`, The position to rotate the scene
+ about. Defaults to the scene's centroid.
+ - ``use_raymond_lighting``: `bool`, If `True`, an additional set of
+ three directional lights that move with the camera will be added to
+ the scene. Defaults to `False`.
+ - ``use_direct_lighting``: `bool`, If `True`, an additional directional
+ light that moves with the camera and points out of it will be
+ added to the scene. Defaults to `False`.
+ - ``lighting_intensity``: `float`, The overall intensity of the
+ viewer's additional lights (when they're in use). Defaults to 3.0.
+ - ``use_perspective_cam``: `bool`, If `True`, a perspective camera will
+ be used. Otherwise, an orthographic camera is used. Defaults to
+ `True`.
+ - ``save_directory``: `str`, A directory to open the file dialogs in.
+ Defaults to `None`.
+ - ``window_title``: `str`, A title for the viewer's application window.
+ Defaults to `"Scene Viewer"`.
+ - ``refresh_rate``: `float`, A refresh rate for rendering, in Hertz.
+ Defaults to `30.0`.
+ - ``fullscreen``: `bool`, Whether to make viewer fullscreen.
+ Defaults to `False`.
+ - ``show_world_axis``: `bool`, Whether to show the world axis.
+ Defaults to `False`.
+ - ``show_mesh_axes``: `bool`, Whether to show the individual mesh axes.
+ Defaults to `False`.
+ - ``caption``: `list of dict`, Text caption(s) to display on
+ the viewer. Defaults to `None`.
+
+ """
+ return self._viewer_flags
+
+ @viewer_flags.setter
+ def viewer_flags(self, value):
+ self._viewer_flags = value
+
+ @property
+ def registered_keys(self):
+ """dict : Map from ASCII key character to a handler function.
+
+ This is a map from ASCII key characters to tuples containing:
+
+ - A function to be called whenever the key is pressed,
+ whose first argument will be the viewer itself.
+ - (Optionally) A list of additional positional arguments
+ to be passed to the function.
+ - (Optionally) A dict of keyword arguments to be passed
+ to the function.
+
+ """
+ return self._registered_keys
+
+ @registered_keys.setter
+ def registered_keys(self, value):
+ self._registered_keys = value
+
+ def close_external(self):
+ """Close the viewer from another thread.
+
+ This function will wait for the actual close, so you immediately
+ manipulate the scene afterwards.
+ """
+ self._should_close = True
+ while self.is_active:
+ time.sleep(1.0 / self.viewer_flags['refresh_rate'])
+
+ def save_gif(self, filename=None):
+ """Save the stored GIF frames to a file.
+
+ To use this asynchronously, run the viewer with the ``record``
+ flag and the ``run_in_thread`` flags set.
+ Kill the viewer after your desired time with
+ :meth:`.Viewer.close_external`, and then call :meth:`.Viewer.save_gif`.
+
+ Parameters
+ ----------
+ filename : str
+ The file to save the GIF to. If not specified,
+ a file dialog will be opened to ask the user where
+ to save the GIF file.
+ """
+ if filename is None:
+ filename = self._get_save_filename(['gif', 'all'])
+ if filename is not None:
+ self.viewer_flags['save_directory'] = os.path.dirname(filename)
+ imageio.mimwrite(filename, self._saved_frames,
+ fps=self.viewer_flags['refresh_rate'],
+ palettesize=128, subrectangles=True)
+ self._saved_frames = []
+
+ def on_close(self):
+ """Exit the event loop when the window is closed.
+ """
+ # Remove our camera and restore the prior one
+ if self._camera_node is not None:
+ self.scene.remove_node(self._camera_node)
+ if self._prior_main_camera_node is not None:
+ self.scene.main_camera_node = self._prior_main_camera_node
+
+ # Delete any lighting nodes that we've attached
+ if self.viewer_flags['use_raymond_lighting']:
+ for n in self._raymond_lights:
+ if self.scene.has_node(n):
+ self.scene.remove_node(n)
+ if self.viewer_flags['use_direct_lighting']:
+ if self.scene.has_node(self._direct_light):
+ self.scene.remove_node(self._direct_light)
+
+ # Delete any axis nodes that we've attached
+ self._remove_axes()
+
+ # Delete renderer
+ if self._renderer is not None:
+ self._renderer.delete()
+ self._renderer = None
+
+ # Force clean-up of OpenGL context data
+ try:
+ OpenGL.contextdata.cleanupContext()
+ self.close()
+ except Exception:
+ pass
+ finally:
+ self._is_active = False
+ super(Viewer, self).on_close()
+ pyglet.app.exit()
+
+ def on_draw(self):
+ """Redraw the scene into the viewing window.
+ """
+ if self._renderer is None:
+ return
+
+ if self.run_in_thread or not self._auto_start:
+ self.render_lock.acquire()
+
+ # Make OpenGL context current
+ self.switch_to()
+
+ # Render the scene
+ self.clear()
+ self._render()
+
+ if self._message_text is not None:
+ self._renderer.render_text(
+ self._message_text,
+ self.viewport_size[0] - TEXT_PADDING,
+ TEXT_PADDING,
+ font_pt=20,
+ color=np.array([0.1, 0.7, 0.2,
+ np.clip(self._message_opac, 0.0, 1.0)]),
+ align=TextAlign.BOTTOM_RIGHT
+ )
+
+ if self.viewer_flags['caption'] is not None:
+ for caption in self.viewer_flags['caption']:
+ xpos, ypos = self._location_to_x_y(caption['location'])
+ self._renderer.render_text(
+ caption['text'],
+ xpos,
+ ypos,
+ font_name=caption['font_name'],
+ font_pt=caption['font_pt'],
+ color=caption['color'],
+ scale=caption['scale'],
+ align=caption['location']
+ )
+
+ if self.run_in_thread or not self._auto_start:
+ self.render_lock.release()
+
+ def on_resize(self, width, height):
+ """Resize the camera and trackball when the window is resized.
+ """
+ if self._renderer is None:
+ return
+
+ self._viewport_size = (width, height)
+ self._trackball.resize(self._viewport_size)
+ self._renderer.viewport_width = self._viewport_size[0]
+ self._renderer.viewport_height = self._viewport_size[1]
+ self.on_draw()
+
+ def on_mouse_press(self, x, y, buttons, modifiers):
+ """Record an initial mouse press.
+ """
+ self._trackball.set_state(Trackball.STATE_ROTATE)
+ if (buttons == pyglet.window.mouse.LEFT):
+ ctrl = (modifiers & pyglet.window.key.MOD_CTRL)
+ shift = (modifiers & pyglet.window.key.MOD_SHIFT)
+ if (ctrl and shift):
+ self._trackball.set_state(Trackball.STATE_ZOOM)
+ elif ctrl:
+ self._trackball.set_state(Trackball.STATE_ROLL)
+ elif shift:
+ self._trackball.set_state(Trackball.STATE_PAN)
+ elif (buttons == pyglet.window.mouse.MIDDLE):
+ self._trackball.set_state(Trackball.STATE_PAN)
+ elif (buttons == pyglet.window.mouse.RIGHT):
+ self._trackball.set_state(Trackball.STATE_ZOOM)
+
+ self._trackball.down(np.array([x, y]))
+
+ # Stop animating while using the mouse
+ self.viewer_flags['mouse_pressed'] = True
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ """Record a mouse drag.
+ """
+ self._trackball.drag(np.array([x, y]))
+
+ def on_mouse_release(self, x, y, button, modifiers):
+ """Record a mouse release.
+ """
+ self.viewer_flags['mouse_pressed'] = False
+
+ def on_mouse_scroll(self, x, y, dx, dy):
+ """Record a mouse scroll.
+ """
+ if self.viewer_flags['use_perspective_cam']:
+ self._trackball.scroll(dy)
+ else:
+ spfc = 0.95
+ spbc = 1.0 / 0.95
+ sf = 1.0
+ if dy > 0:
+ sf = spfc * dy
+ elif dy < 0:
+ sf = - spbc * dy
+
+ c = self._camera_node.camera
+ xmag = max(c.xmag * sf, 1e-8)
+ ymag = max(c.ymag * sf, 1e-8 * c.ymag / c.xmag)
+ c.xmag = xmag
+ c.ymag = ymag
+
+ def on_key_press(self, symbol, modifiers):
+ """Record a key press.
+ """
+ # First, check for registered key callbacks
+ if symbol in self.registered_keys:
+ tup = self.registered_keys[symbol]
+ callback = None
+ args = []
+ kwargs = {}
+ if not isinstance(tup, (list, tuple, np.ndarray)):
+ callback = tup
+ else:
+ callback = tup[0]
+ if len(tup) == 2:
+ args = tup[1]
+ if len(tup) == 3:
+ kwargs = tup[2]
+ callback(self, *args, **kwargs)
+ return
+
+ # Otherwise, use default key functions
+
+ # A causes the frame to rotate
+ self._message_text = None
+ if symbol == pyglet.window.key.A:
+ self.viewer_flags['rotate'] = not self.viewer_flags['rotate']
+ if self.viewer_flags['rotate']:
+ self._message_text = 'Rotation On'
+ else:
+ self._message_text = 'Rotation Off'
+
+ # C toggles backface culling
+ elif symbol == pyglet.window.key.C:
+ self.render_flags['cull_faces'] = (
+ not self.render_flags['cull_faces']
+ )
+ if self.render_flags['cull_faces']:
+ self._message_text = 'Cull Faces On'
+ else:
+ self._message_text = 'Cull Faces Off'
+
+ # F toggles face normals
+ elif symbol == pyglet.window.key.F:
+ self.viewer_flags['fullscreen'] = (
+ not self.viewer_flags['fullscreen']
+ )
+ self.set_fullscreen(self.viewer_flags['fullscreen'])
+ self.activate()
+ if self.viewer_flags['fullscreen']:
+ self._message_text = 'Fullscreen On'
+ else:
+ self._message_text = 'Fullscreen Off'
+
+ # S toggles shadows
+ elif symbol == pyglet.window.key.H and sys.platform != 'darwin':
+ self.render_flags['shadows'] = not self.render_flags['shadows']
+ if self.render_flags['shadows']:
+ self._message_text = 'Shadows On'
+ else:
+ self._message_text = 'Shadows Off'
+
+ elif symbol == pyglet.window.key.I:
+ if (self.viewer_flags['show_world_axis'] and not
+ self.viewer_flags['show_mesh_axes']):
+ self.viewer_flags['show_world_axis'] = False
+ self.viewer_flags['show_mesh_axes'] = True
+ self._set_axes(False, True)
+ self._message_text = 'Mesh Axes On'
+ elif (not self.viewer_flags['show_world_axis'] and
+ self.viewer_flags['show_mesh_axes']):
+ self.viewer_flags['show_world_axis'] = True
+ self.viewer_flags['show_mesh_axes'] = True
+ self._set_axes(True, True)
+ self._message_text = 'All Axes On'
+ elif (self.viewer_flags['show_world_axis'] and
+ self.viewer_flags['show_mesh_axes']):
+ self.viewer_flags['show_world_axis'] = False
+ self.viewer_flags['show_mesh_axes'] = False
+ self._set_axes(False, False)
+ self._message_text = 'All Axes Off'
+ else:
+ self.viewer_flags['show_world_axis'] = True
+ self.viewer_flags['show_mesh_axes'] = False
+ self._set_axes(True, False)
+ self._message_text = 'World Axis On'
+
+ # L toggles the lighting mode
+ elif symbol == pyglet.window.key.L:
+ if self.viewer_flags['use_raymond_lighting']:
+ self.viewer_flags['use_raymond_lighting'] = False
+ self.viewer_flags['use_direct_lighting'] = True
+ self._message_text = 'Direct Lighting'
+ elif self.viewer_flags['use_direct_lighting']:
+ self.viewer_flags['use_raymond_lighting'] = False
+ self.viewer_flags['use_direct_lighting'] = False
+ self._message_text = 'Default Lighting'
+ else:
+ self.viewer_flags['use_raymond_lighting'] = True
+ self.viewer_flags['use_direct_lighting'] = False
+ self._message_text = 'Raymond Lighting'
+
+ # M toggles face normals
+ elif symbol == pyglet.window.key.M:
+ self.render_flags['face_normals'] = (
+ not self.render_flags['face_normals']
+ )
+ if self.render_flags['face_normals']:
+ self._message_text = 'Face Normals On'
+ else:
+ self._message_text = 'Face Normals Off'
+
+ # N toggles vertex normals
+ elif symbol == pyglet.window.key.N:
+ self.render_flags['vertex_normals'] = (
+ not self.render_flags['vertex_normals']
+ )
+ if self.render_flags['vertex_normals']:
+ self._message_text = 'Vert Normals On'
+ else:
+ self._message_text = 'Vert Normals Off'
+
+ # O toggles orthographic camera mode
+ elif symbol == pyglet.window.key.O:
+ self.viewer_flags['use_perspective_cam'] = (
+ not self.viewer_flags['use_perspective_cam']
+ )
+ if self.viewer_flags['use_perspective_cam']:
+ camera = self._default_persp_cam
+ self._message_text = 'Perspective View'
+ else:
+ camera = self._default_orth_cam
+ self._message_text = 'Orthographic View'
+
+ cam_pose = self._camera_node.matrix.copy()
+ cam_node = Node(matrix=cam_pose, camera=camera)
+ self.scene.remove_node(self._camera_node)
+ self.scene.add_node(cam_node)
+ self.scene.main_camera_node = cam_node
+ self._camera_node = cam_node
+
+ # Q quits the viewer
+ elif symbol == pyglet.window.key.Q:
+ self.on_close()
+
+ # R starts recording frames
+ elif symbol == pyglet.window.key.R:
+ if self.viewer_flags['record']:
+ self.save_gif()
+ self.set_caption(self.viewer_flags['window_title'])
+ else:
+ self.set_caption(
+ '{} (RECORDING)'.format(self.viewer_flags['window_title'])
+ )
+ self.viewer_flags['record'] = not self.viewer_flags['record']
+
+ # S saves the current frame as an image
+ elif symbol == pyglet.window.key.S:
+ self._save_image()
+
+ # W toggles through wireframe modes
+ elif symbol == pyglet.window.key.W:
+ if self.render_flags['flip_wireframe']:
+ self.render_flags['flip_wireframe'] = False
+ self.render_flags['all_wireframe'] = True
+ self.render_flags['all_solid'] = False
+ self._message_text = 'All Wireframe'
+ elif self.render_flags['all_wireframe']:
+ self.render_flags['flip_wireframe'] = False
+ self.render_flags['all_wireframe'] = False
+ self.render_flags['all_solid'] = True
+ self._message_text = 'All Solid'
+ elif self.render_flags['all_solid']:
+ self.render_flags['flip_wireframe'] = False
+ self.render_flags['all_wireframe'] = False
+ self.render_flags['all_solid'] = False
+ self._message_text = 'Default Wireframe'
+ else:
+ self.render_flags['flip_wireframe'] = True
+ self.render_flags['all_wireframe'] = False
+ self.render_flags['all_solid'] = False
+ self._message_text = 'Flip Wireframe'
+
+ # Z resets the camera viewpoint
+ elif symbol == pyglet.window.key.Z:
+ self._reset_view()
+
+ if self._message_text is not None:
+ self._message_opac = 1.0 + self._ticks_till_fade
+
+ @staticmethod
+ def _time_event(dt, self):
+ """The timer callback.
+ """
+ # Don't run old dead events after we've already closed
+ if not self._is_active:
+ return
+
+ if self.viewer_flags['record']:
+ self._record()
+ if (self.viewer_flags['rotate'] and not
+ self.viewer_flags['mouse_pressed']):
+ self._rotate()
+
+ # Manage message opacity
+ if self._message_text is not None:
+ if self._message_opac > 1.0:
+ self._message_opac -= 1.0
+ else:
+ self._message_opac *= 0.90
+ if self._message_opac < 0.05:
+ self._message_opac = 1.0 + self._ticks_till_fade
+ self._message_text = None
+
+ if self._should_close:
+ self.on_close()
+ else:
+ self.on_draw()
+
+ def _reset_view(self):
+ """Reset the view to a good initial state.
+
+ The view is initially along the positive x-axis at a
+ sufficient distance from the scene.
+ """
+ scale = self.scene.scale
+ if scale == 0.0:
+ scale = DEFAULT_SCENE_SCALE
+ centroid = self.scene.centroid
+
+ if self.viewer_flags['view_center'] is not None:
+ centroid = self.viewer_flags['view_center']
+
+ self._camera_node.matrix = self._default_camera_pose
+ self._trackball = Trackball(
+ self._default_camera_pose, self.viewport_size, scale, centroid
+ )
+
+ def _get_save_filename(self, file_exts):
+ file_types = {
+ 'png': ('png files', '*.png'),
+ 'jpg': ('jpeg files', '*.jpg'),
+ 'gif': ('gif files', '*.gif'),
+ 'all': ('all files', '*'),
+ }
+ filetypes = [file_types[x] for x in file_exts]
+ try:
+ root = Tk()
+ save_dir = self.viewer_flags['save_directory']
+ if save_dir is None:
+ save_dir = os.getcwd()
+ filename = filedialog.asksaveasfilename(
+ initialdir=save_dir, title='Select file save location',
+ filetypes=filetypes
+ )
+ except Exception:
+ return None
+
+ root.destroy()
+ if filename == ():
+ return None
+ return filename
+
+ def _save_image(self):
+ filename = self._get_save_filename(['png', 'jpg', 'gif', 'all'])
+ if filename is not None:
+ self.viewer_flags['save_directory'] = os.path.dirname(filename)
+ imageio.imwrite(filename, self._renderer.read_color_buf())
+
+ def _record(self):
+ """Save another frame for the GIF.
+ """
+ data = self._renderer.read_color_buf()
+ if not np.all(data == 0.0):
+ self._saved_frames.append(data)
+
+ def _rotate(self):
+ """Animate the scene by rotating the camera.
+ """
+ az = (self.viewer_flags['rotate_rate'] /
+ self.viewer_flags['refresh_rate'])
+ self._trackball.rotate(az, self.viewer_flags['rotate_axis'])
+
+ def _render(self):
+ """Render the scene into the framebuffer and flip.
+ """
+ scene = self.scene
+ self._camera_node.matrix = self._trackball.pose.copy()
+
+ # Set lighting
+ vli = self.viewer_flags['lighting_intensity']
+ if self.viewer_flags['use_raymond_lighting']:
+ for n in self._raymond_lights:
+ n.light.intensity = vli / 3.0
+ if not self.scene.has_node(n):
+ scene.add_node(n, parent_node=self._camera_node)
+ else:
+ self._direct_light.light.intensity = vli
+ for n in self._raymond_lights:
+ if self.scene.has_node(n):
+ self.scene.remove_node(n)
+
+ if self.viewer_flags['use_direct_lighting']:
+ if not self.scene.has_node(self._direct_light):
+ scene.add_node(
+ self._direct_light, parent_node=self._camera_node
+ )
+ elif self.scene.has_node(self._direct_light):
+ self.scene.remove_node(self._direct_light)
+
+ flags = RenderFlags.NONE
+ if self.render_flags['flip_wireframe']:
+ flags |= RenderFlags.FLIP_WIREFRAME
+ elif self.render_flags['all_wireframe']:
+ flags |= RenderFlags.ALL_WIREFRAME
+ elif self.render_flags['all_solid']:
+ flags |= RenderFlags.ALL_SOLID
+
+ if self.render_flags['shadows']:
+ flags |= RenderFlags.SHADOWS_DIRECTIONAL | RenderFlags.SHADOWS_SPOT
+ if self.render_flags['vertex_normals']:
+ flags |= RenderFlags.VERTEX_NORMALS
+ if self.render_flags['face_normals']:
+ flags |= RenderFlags.FACE_NORMALS
+ if not self.render_flags['cull_faces']:
+ flags |= RenderFlags.SKIP_CULL_FACES
+
+ self._renderer.render(self.scene, flags)
+
+ def _init_and_start_app(self):
+ # Try multiple configs starting with target OpenGL version
+ # and multisampling and removing these options if exception
+ # Note: multisampling not available on all hardware
+ from pyglet.gl import Config
+ confs = [Config(sample_buffers=1, samples=4,
+ depth_size=24,
+ double_buffer=True,
+ major_version=TARGET_OPEN_GL_MAJOR,
+ minor_version=TARGET_OPEN_GL_MINOR),
+ Config(depth_size=24,
+ double_buffer=True,
+ major_version=TARGET_OPEN_GL_MAJOR,
+ minor_version=TARGET_OPEN_GL_MINOR),
+ Config(sample_buffers=1, samples=4,
+ depth_size=24,
+ double_buffer=True,
+ major_version=MIN_OPEN_GL_MAJOR,
+ minor_version=MIN_OPEN_GL_MINOR),
+ Config(depth_size=24,
+ double_buffer=True,
+ major_version=MIN_OPEN_GL_MAJOR,
+ minor_version=MIN_OPEN_GL_MINOR)]
+ for conf in confs:
+ try:
+ super(Viewer, self).__init__(config=conf, resizable=True,
+ width=self._viewport_size[0],
+ height=self._viewport_size[1])
+ break
+ except pyglet.window.NoSuchConfigException:
+ pass
+
+ if not self.context:
+ raise ValueError('Unable to initialize an OpenGL 3+ context')
+ clock.schedule_interval(
+ Viewer._time_event, 1.0 / self.viewer_flags['refresh_rate'], self
+ )
+ self.switch_to()
+ self.set_caption(self.viewer_flags['window_title'])
+ pyglet.app.run()
+
+ def _compute_initial_camera_pose(self):
+ centroid = self.scene.centroid
+ if self.viewer_flags['view_center'] is not None:
+ centroid = self.viewer_flags['view_center']
+ scale = self.scene.scale
+ if scale == 0.0:
+ scale = DEFAULT_SCENE_SCALE
+
+ s2 = 1.0 / np.sqrt(2.0)
+ cp = np.eye(4)
+ cp[:3,:3] = np.array([
+ [0.0, -s2, s2],
+ [1.0, 0.0, 0.0],
+ [0.0, s2, s2]
+ ])
+ hfov = np.pi / 6.0
+ dist = scale / (2.0 * np.tan(hfov))
+ cp[:3,3] = dist * np.array([1.0, 0.0, 1.0]) + centroid
+
+ return cp
+
+ def _create_raymond_lights(self):
+ thetas = np.pi * np.array([1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0])
+ phis = np.pi * np.array([0.0, 2.0 / 3.0, 4.0 / 3.0])
+
+ nodes = []
+
+ for phi, theta in zip(phis, thetas):
+ xp = np.sin(theta) * np.cos(phi)
+ yp = np.sin(theta) * np.sin(phi)
+ zp = np.cos(theta)
+
+ z = np.array([xp, yp, zp])
+ z = z / np.linalg.norm(z)
+ x = np.array([-z[1], z[0], 0.0])
+ if np.linalg.norm(x) == 0:
+ x = np.array([1.0, 0.0, 0.0])
+ x = x / np.linalg.norm(x)
+ y = np.cross(z, x)
+
+ matrix = np.eye(4)
+ matrix[:3,:3] = np.c_[x,y,z]
+ nodes.append(Node(
+ light=DirectionalLight(color=np.ones(3), intensity=1.0),
+ matrix=matrix
+ ))
+
+ return nodes
+
+ def _create_direct_light(self):
+ light = DirectionalLight(color=np.ones(3), intensity=1.0)
+ n = Node(light=light, matrix=np.eye(4))
+ return n
+
+ def _set_axes(self, world, mesh):
+ scale = self.scene.scale
+ if world:
+ if 'scene' not in self._axes:
+ n = Node(mesh=self._axis_mesh, scale=np.ones(3) * scale * 0.3)
+ self.scene.add_node(n)
+ self._axes['scene'] = n
+ else:
+ if 'scene' in self._axes:
+ self.scene.remove_node(self._axes['scene'])
+ self._axes.pop('scene')
+
+ if mesh:
+ old_nodes = []
+ existing_axes = set([self._axes[k] for k in self._axes])
+ for node in self.scene.mesh_nodes:
+ if node not in existing_axes:
+ old_nodes.append(node)
+
+ for node in old_nodes:
+ if node in self._axes:
+ continue
+ n = Node(
+ mesh=self._axis_mesh,
+ scale=np.ones(3) * node.mesh.scale * 0.5
+ )
+ self.scene.add_node(n, parent_node=node)
+ self._axes[node] = n
+ else:
+ to_remove = set()
+ for main_node in self._axes:
+ if main_node in self.scene.mesh_nodes:
+ self.scene.remove_node(self._axes[main_node])
+ to_remove.add(main_node)
+ for main_node in to_remove:
+ self._axes.pop(main_node)
+
+ def _remove_axes(self):
+ for main_node in self._axes:
+ axis_node = self._axes[main_node]
+ self.scene.remove_node(axis_node)
+ self._axes = {}
+
+ def _location_to_x_y(self, location):
+ if location == TextAlign.CENTER:
+ return (self.viewport_size[0] / 2.0, self.viewport_size[1] / 2.0)
+ elif location == TextAlign.CENTER_LEFT:
+ return (TEXT_PADDING, self.viewport_size[1] / 2.0)
+ elif location == TextAlign.CENTER_RIGHT:
+ return (self.viewport_size[0] - TEXT_PADDING,
+ self.viewport_size[1] / 2.0)
+ elif location == TextAlign.BOTTOM_LEFT:
+ return (TEXT_PADDING, TEXT_PADDING)
+ elif location == TextAlign.BOTTOM_RIGHT:
+ return (self.viewport_size[0] - TEXT_PADDING, TEXT_PADDING)
+ elif location == TextAlign.BOTTOM_CENTER:
+ return (self.viewport_size[0] / 2.0, TEXT_PADDING)
+ elif location == TextAlign.TOP_LEFT:
+ return (TEXT_PADDING, self.viewport_size[1] - TEXT_PADDING)
+ elif location == TextAlign.TOP_RIGHT:
+ return (self.viewport_size[0] - TEXT_PADDING,
+ self.viewport_size[1] - TEXT_PADDING)
+ elif location == TextAlign.TOP_CENTER:
+ return (self.viewport_size[0] / 2.0,
+ self.viewport_size[1] - TEXT_PADDING)
+
+
+__all__ = ['Viewer']
diff --git a/generate_human_motion/pyrender/docs/Makefile b/generate_human_motion/pyrender/docs/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..b1064a04362a0c4372fae351f99ed3bd9f82ff92
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/Makefile
@@ -0,0 +1,23 @@
+# Minimal makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+SOURCEDIR = source
+BUILDDIR = build
+
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+.PHONY: help Makefile
+
+clean:
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+ rm -rf ./source/generated/*
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/generate_human_motion/pyrender/docs/make.bat b/generate_human_motion/pyrender/docs/make.bat
new file mode 100644
index 0000000000000000000000000000000000000000..4d9eb83d9f9309029f4b14ff09024658bb0f5563
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/make.bat
@@ -0,0 +1,35 @@
+@ECHO OFF
+
+pushd %~dp0
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set SOURCEDIR=source
+set BUILDDIR=build
+
+if "%1" == "" goto help
+
+%SPHINXBUILD% >NUL 2>NUL
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+goto end
+
+:help
+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
+
+:end
+popd
diff --git a/generate_human_motion/pyrender/docs/source/api/index.rst b/generate_human_motion/pyrender/docs/source/api/index.rst
new file mode 100644
index 0000000000000000000000000000000000000000..b6e473149d8f132f176e242c93406fdb84ce0b04
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/source/api/index.rst
@@ -0,0 +1,59 @@
+Pyrender API Documentation
+==========================
+
+Constants
+---------
+.. automodapi:: pyrender.constants
+ :no-inheritance-diagram:
+ :no-main-docstr:
+ :no-heading:
+
+Cameras
+-------
+.. automodapi:: pyrender.camera
+ :no-inheritance-diagram:
+ :no-main-docstr:
+ :no-heading:
+
+Lighting
+--------
+.. automodapi:: pyrender.light
+ :no-inheritance-diagram:
+ :no-main-docstr:
+ :no-heading:
+
+Objects
+-------
+.. automodapi:: pyrender
+ :no-inheritance-diagram:
+ :no-main-docstr:
+ :no-heading:
+ :skip: Camera, DirectionalLight, Light, OffscreenRenderer, Node
+ :skip: OrthographicCamera, PerspectiveCamera, PointLight, RenderFlags
+ :skip: Renderer, Scene, SpotLight, TextAlign, Viewer, GLTF
+
+Scenes
+------
+.. automodapi:: pyrender
+ :no-inheritance-diagram:
+ :no-main-docstr:
+ :no-heading:
+ :skip: Camera, DirectionalLight, Light, OffscreenRenderer
+ :skip: OrthographicCamera, PerspectiveCamera, PointLight, RenderFlags
+ :skip: Renderer, SpotLight, TextAlign, Viewer, Sampler, Texture, Material
+ :skip: MetallicRoughnessMaterial, Primitive, Mesh, GLTF
+
+On-Screen Viewer
+----------------
+.. automodapi:: pyrender.viewer
+ :no-inheritance-diagram:
+ :no-inherited-members:
+ :no-main-docstr:
+ :no-heading:
+
+Off-Screen Rendering
+--------------------
+.. automodapi:: pyrender.offscreen
+ :no-inheritance-diagram:
+ :no-main-docstr:
+ :no-heading:
diff --git a/generate_human_motion/pyrender/docs/source/conf.py b/generate_human_motion/pyrender/docs/source/conf.py
new file mode 100644
index 0000000000000000000000000000000000000000..6bf194c375e7e789b334a838953adfeaf2eb59b6
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/source/conf.py
@@ -0,0 +1,352 @@
+# -*- coding: utf-8 -*-
+#
+# core documentation build configuration file, created by
+# sphinx-quickstart on Sun Oct 16 14:33:48 2016.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys
+import os
+from pyrender import __version__
+from sphinx.domains.python import PythonDomain
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+sys.path.insert(0, os.path.abspath('../../'))
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.autosummary',
+ 'sphinx.ext.coverage',
+ 'sphinx.ext.githubpages',
+ 'sphinx.ext.intersphinx',
+ 'sphinx.ext.napoleon',
+ 'sphinx.ext.viewcode',
+ 'sphinx_automodapi.automodapi',
+ 'sphinx_automodapi.smart_resolver'
+]
+numpydoc_class_members_toctree = False
+automodapi_toctreedirnm = 'generated'
+automodsumm_inherited_members = True
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix(es) of source filenames.
+# You can specify multiple suffix as a list of string:
+# source_suffix = ['.rst', '.md']
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'pyrender'
+copyright = u'2018, Matthew Matl'
+author = u'Matthew Matl'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = __version__
+# The full version, including alpha/beta/rc tags.
+release = __version__
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#
+# This is also used if you do content translation via gettext catalogs.
+# Usually you set "language" from the command line for these cases.
+language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = []
+
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+#keep_warnings = False
+
+# If true, `todo` and `todoList` produce output, else they produce nothing.
+todo_include_todos = False
+
+
+# -- Options for HTML output ----------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+import sphinx_rtd_theme
+html_theme = 'sphinx_rtd_theme'
+html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# " v documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (relative to this directory) to use as a favicon of
+# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+#html_extra_path = []
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Language to be used for generating the HTML full-text search index.
+# Sphinx supports the following languages:
+# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
+# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
+#html_search_language = 'en'
+
+# A dictionary with options for the search language support, empty by default.
+# Now only 'ja' uses this config value
+#html_search_options = {'type': 'default'}
+
+# The name of a javascript file (relative to the configuration directory) that
+# implements a search results scorer. If empty, the default will be used.
+#html_search_scorer = 'scorer.js'
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'coredoc'
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+
+# Latex figure (float) alignment
+#'figure_align': 'htbp',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ (master_doc, 'pyrender.tex', u'pyrender Documentation',
+ u'Matthew Matl', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ (master_doc, 'pyrender', u'pyrender Documentation',
+ [author], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ (master_doc, 'pyrender', u'pyrender Documentation',
+ author, 'pyrender', 'One line description of project.',
+ 'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+#texinfo_no_detailmenu = False
+
+intersphinx_mapping = {
+ 'python' : ('https://docs.python.org/', None),
+ 'pyrender' : ('https://pyrender.readthedocs.io/en/latest/', None),
+}
+
+# Autosummary fix
+autosummary_generate = True
+
+# Try to suppress multiple-definition warnings by always taking the shorter
+# path when two or more paths have the same base module
+
+class MyPythonDomain(PythonDomain):
+
+ def find_obj(self, env, modname, classname, name, type, searchmode=0):
+ """Ensures an object always resolves to the desired module
+ if defined there."""
+ orig_matches = PythonDomain.find_obj(
+ self, env, modname, classname, name, type, searchmode
+ )
+
+ if len(orig_matches) <= 1:
+ return orig_matches
+
+ # If multiple matches, try to take the shortest if all the modules are
+ # the same
+ first_match_name_sp = orig_matches[0][0].split('.')
+ base_name = first_match_name_sp[0]
+ min_len = len(first_match_name_sp)
+ best_match = orig_matches[0]
+
+ for match in orig_matches[1:]:
+ match_name = match[0]
+ match_name_sp = match_name.split('.')
+ match_base = match_name_sp[0]
+
+ # If we have mismatched bases, return them all to trigger warnings
+ if match_base != base_name:
+ return orig_matches
+
+ # Otherwise, check and see if it's shorter
+ if len(match_name_sp) < min_len:
+ min_len = len(match_name_sp)
+ best_match = match
+
+ return (best_match,)
+
+
+def setup(sphinx):
+ """Use MyPythonDomain in place of PythonDomain"""
+ sphinx.override_domain(MyPythonDomain)
+
diff --git a/generate_human_motion/pyrender/docs/source/examples/cameras.rst b/generate_human_motion/pyrender/docs/source/examples/cameras.rst
new file mode 100644
index 0000000000000000000000000000000000000000..39186b75b16584d11fd1606b92291c104e0452bd
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/source/examples/cameras.rst
@@ -0,0 +1,26 @@
+.. _camera_guide:
+
+Creating Cameras
+================
+
+Pyrender supports three camera types -- :class:`.PerspectiveCamera` and
+:class:`.IntrinsicsCamera` types,
+which render scenes as a human would see them, and
+:class:`.OrthographicCamera` types, which preserve distances between points.
+
+Creating cameras is easy -- just specify their basic attributes:
+
+>>> pc = pyrender.PerspectiveCamera(yfov=np.pi / 3.0, aspectRatio=1.414)
+>>> oc = pyrender.OrthographicCamera(xmag=1.0, ymag=1.0)
+
+For more information, see the Khronos group's documentation here_:
+
+.. _here: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#projection-matrices
+
+When you add cameras to the scene, make sure that you're using OpenGL camera
+coordinates to specify their pose. See the illustration below for details.
+Basically, the camera z-axis points away from the scene, the x-axis points
+right in image space, and the y-axis points up in image space.
+
+.. image:: /_static/camera_coords.png
+
diff --git a/generate_human_motion/pyrender/docs/source/examples/index.rst b/generate_human_motion/pyrender/docs/source/examples/index.rst
new file mode 100644
index 0000000000000000000000000000000000000000..4be536cd62c1cca112228f4e114e783be77a0ab8
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/source/examples/index.rst
@@ -0,0 +1,20 @@
+.. _guide:
+
+User Guide
+==========
+
+This section contains guides on how to use Pyrender to quickly visualize
+your 3D data, including a quickstart guide and more detailed descriptions
+of each part of the rendering pipeline.
+
+
+.. toctree::
+ :maxdepth: 2
+
+ quickstart.rst
+ models.rst
+ lighting.rst
+ cameras.rst
+ scenes.rst
+ offscreen.rst
+ viewer.rst
diff --git a/generate_human_motion/pyrender/docs/source/examples/lighting.rst b/generate_human_motion/pyrender/docs/source/examples/lighting.rst
new file mode 100644
index 0000000000000000000000000000000000000000..f89bee7d15027a0f52711622b053b49cc6e1b410
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/source/examples/lighting.rst
@@ -0,0 +1,21 @@
+.. _lighting_guide:
+
+Creating Lights
+===============
+
+Pyrender supports three types of punctual light:
+
+- :class:`.PointLight`: Point-based light sources, such as light bulbs.
+- :class:`.SpotLight`: A conical light source, like a flashlight.
+- :class:`.DirectionalLight`: A general light that does not attenuate with
+ distance.
+
+Creating lights is easy -- just specify their basic attributes:
+
+>>> pl = pyrender.PointLight(color=[1.0, 1.0, 1.0], intensity=2.0)
+>>> sl = pyrender.SpotLight(color=[1.0, 1.0, 1.0], intensity=2.0,
+... innerConeAngle=0.05, outerConeAngle=0.5)
+>>> dl = pyrender.DirectionalLight(color=[1.0, 1.0, 1.0], intensity=2.0)
+
+For more information about how these lighting models are implemented,
+see their class documentation.
diff --git a/generate_human_motion/pyrender/docs/source/examples/models.rst b/generate_human_motion/pyrender/docs/source/examples/models.rst
new file mode 100644
index 0000000000000000000000000000000000000000..84e71c4ff41a8d2e0eb2dc48434caedb757ff954
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/source/examples/models.rst
@@ -0,0 +1,143 @@
+.. _model_guide:
+
+Loading and Configuring Models
+==============================
+The first step to any rendering application is loading your models.
+Pyrender implements the GLTF 2.0 specification, which means that all
+models are composed of a hierarchy of objects.
+
+At the top level, we have a :class:`.Mesh`. The :class:`.Mesh` is
+basically a wrapper of any number of :class:`.Primitive` types,
+which actually represent geometry that can be drawn to the screen.
+
+Primitives are composed of a variety of parameters, including
+vertex positions, vertex normals, color and texture information,
+and triangle indices if smooth rendering is desired.
+They can implement point clouds, triangular meshes, or lines
+depending on how you configure their data and set their
+:attr:`.Primitive.mode` parameter.
+
+Although you can create primitives yourself if you want to,
+it's probably easier to just use the utility functions provided
+in the :class:`.Mesh` class.
+
+Creating Triangular Meshes
+--------------------------
+
+Simple Construction
+~~~~~~~~~~~~~~~~~~~
+Pyrender allows you to create a :class:`.Mesh` containing a
+triangular mesh model directly from a :class:`~trimesh.base.Trimesh` object
+using the :meth:`.Mesh.from_trimesh` static method.
+
+>>> import trimesh
+>>> import pyrender
+>>> import numpy as np
+>>> tm = trimesh.load('examples/models/fuze.obj')
+>>> m = pyrender.Mesh.from_trimesh(tm)
+>>> m.primitives
+[]
+
+You can also create a single :class:`.Mesh` from a list of
+:class:`~trimesh.base.Trimesh` objects:
+
+>>> tms = [trimesh.creation.icosahedron(), trimesh.creation.cylinder()]
+>>> m = pyrender.Mesh.from_trimesh(tms)
+[,
+ ]
+
+Vertex Smoothing
+~~~~~~~~~~~~~~~~
+
+The :meth:`.Mesh.from_trimesh` method has a few additional optional parameters.
+If you want to render the mesh without interpolating face normals, which can
+be useful for meshes that are supposed to be angular (e.g. a cube), you
+can specify ``smooth=False``.
+
+>>> m = pyrender.Mesh.from_trimesh(tm, smooth=False)
+
+Per-Face or Per-Vertex Coloration
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you have an untextured trimesh, you can color it in with per-face or
+per-vertex colors:
+
+>>> tm.visual.vertex_colors = np.random.uniform(size=tm.vertices.shape)
+>>> tm.visual.face_colors = np.random.uniform(size=tm.faces.shape)
+>>> m = pyrender.Mesh.from_trimesh(tm)
+
+Instancing
+~~~~~~~~~~
+
+If you want to render many copies of the same mesh at different poses,
+you can statically create a vast array of them in an efficient manner.
+Simply specify the ``poses`` parameter to be a list of ``N`` 4x4 homogenous
+transformation matrics that position the meshes relative to their common
+base frame:
+
+>>> tfs = np.tile(np.eye(4), (3,1,1))
+>>> tfs[1,:3,3] = [0.1, 0.0, 0.0]
+>>> tfs[2,:3,3] = [0.2, 0.0, 0.0]
+>>> tfs
+array([[[1. , 0. , 0. , 0. ],
+ [0. , 1. , 0. , 0. ],
+ [0. , 0. , 1. , 0. ],
+ [0. , 0. , 0. , 1. ]],
+ [[1. , 0. , 0. , 0.1],
+ [0. , 1. , 0. , 0. ],
+ [0. , 0. , 1. , 0. ],
+ [0. , 0. , 0. , 1. ]],
+ [[1. , 0. , 0. , 0.2],
+ [0. , 1. , 0. , 0. ],
+ [0. , 0. , 1. , 0. ],
+ [0. , 0. , 0. , 1. ]]])
+
+>>> m = pyrender.Mesh.from_trimesh(tm, poses=tfs)
+
+Custom Materials
+~~~~~~~~~~~~~~~~
+
+You can also specify a custom material for any triangular mesh you create
+in the ``material`` parameter of :meth:`.Mesh.from_trimesh`.
+The main material supported by Pyrender is the
+:class:`.MetallicRoughnessMaterial`.
+The metallic-roughness model supports rendering highly-realistic objects across
+a wide gamut of materials.
+
+For more information, see the documentation of the
+:class:`.MetallicRoughnessMaterial` constructor or look at the Khronos_
+documentation for more information.
+
+.. _Khronos: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#materials
+
+Creating Point Clouds
+---------------------
+
+Point Sprites
+~~~~~~~~~~~~~
+Pyrender also allows you to create a :class:`.Mesh` containing a
+point cloud directly from :class:`numpy.ndarray` instances
+using the :meth:`.Mesh.from_points` static method.
+
+Simply provide a list of points and optional per-point colors and normals.
+
+>>> pts = tm.vertices.copy()
+>>> colors = np.random.uniform(size=pts.shape)
+>>> m = pyrender.Mesh.from_points(pts, colors=colors)
+
+Point clouds created in this way will be rendered as square point sprites.
+
+.. image:: /_static/points.png
+
+Point Spheres
+~~~~~~~~~~~~~
+If you have a monochromatic point cloud and would like to render it with
+spheres, you can render it by instancing a spherical trimesh:
+
+>>> sm = trimesh.creation.uv_sphere(radius=0.1)
+>>> sm.visual.vertex_colors = [1.0, 0.0, 0.0]
+>>> tfs = np.tile(np.eye(4), (len(pts), 1, 1))
+>>> tfs[:,:3,3] = pts
+>>> m = pyrender.Mesh.from_trimesh(sm, poses=tfs)
+
+.. image:: /_static/points2.png
diff --git a/generate_human_motion/pyrender/docs/source/examples/offscreen.rst b/generate_human_motion/pyrender/docs/source/examples/offscreen.rst
new file mode 100644
index 0000000000000000000000000000000000000000..291532b6e0c0e512df35a97e3c826cc83015aeca
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/source/examples/offscreen.rst
@@ -0,0 +1,87 @@
+.. _offscreen_guide:
+
+Offscreen Rendering
+===================
+
+.. note::
+ If you're using a headless server, you'll need to use either EGL (for
+ GPU-accelerated rendering) or OSMesa (for CPU-only software rendering).
+ If you're using OSMesa, be sure that you've installed it properly. See
+ :ref:`osmesa` for details.
+
+Choosing a Backend
+------------------
+
+Once you have a scene set up with its geometry, cameras, and lights,
+you can render it using the :class:`.OffscreenRenderer`. Pyrender supports
+three backends for offscreen rendering:
+
+- Pyglet, the same engine that runs the viewer. This requires an active
+ display manager, so you can't run it on a headless server. This is the
+ default option.
+- OSMesa, a software renderer.
+- EGL, which allows for GPU-accelerated rendering without a display manager.
+
+If you want to use OSMesa or EGL, you need to set the ``PYOPENGL_PLATFORM``
+environment variable before importing pyrender or any other OpenGL library.
+You can do this at the command line:
+
+.. code-block:: bash
+
+ PYOPENGL_PLATFORM=osmesa python render.py
+
+or at the top of your Python script:
+
+.. code-block:: bash
+
+ # Top of main python script
+ import os
+ os.environ['PYOPENGL_PLATFORM'] = 'egl'
+
+The handle for EGL is ``egl``, and the handle for OSMesa is ``osmesa``.
+
+Running the Renderer
+--------------------
+
+Once you've set your environment variable appropriately, create your scene and
+then configure the :class:`.OffscreenRenderer` object with a window width,
+a window height, and a size for point-cloud points:
+
+>>> r = pyrender.OffscreenRenderer(viewport_width=640,
+... viewport_height=480,
+... point_size=1.0)
+
+Then, just call the :meth:`.OffscreenRenderer.render` function:
+
+>>> color, depth = r.render(scene)
+
+.. image:: /_static/scene.png
+
+This will return a ``(w,h,3)`` channel floating-point color image and
+a ``(w,h)`` floating-point depth image rendered from the scene's main camera.
+
+You can customize the rendering process by using flag options from
+:class:`.RenderFlags` and bitwise or-ing them together. For example,
+the following code renders a color image with an alpha channel
+and enables shadow mapping for all directional lights:
+
+>>> flags = RenderFlags.RGBA | RenderFlags.SHADOWS_DIRECTIONAL
+>>> color, depth = r.render(scene, flags=flags)
+
+Once you're done with the offscreen renderer, you need to close it before you
+can run a different renderer or open the viewer for the same scene:
+
+>>> r.delete()
+
+Google CoLab Examples
+---------------------
+
+For a minimal working example of offscreen rendering using OSMesa,
+see the `OSMesa Google CoLab notebook`_.
+
+.. _OSMesa Google CoLab notebook: https://colab.research.google.com/drive/1Z71mHIc-Sqval92nK290vAsHZRUkCjUx
+
+For a minimal working example of offscreen rendering using EGL,
+see the `EGL Google CoLab notebook`_.
+
+.. _EGL Google CoLab notebook: https://colab.research.google.com/drive/1rTLHk0qxh4dn8KNe-mCnN8HAWdd2_BEh
diff --git a/generate_human_motion/pyrender/docs/source/examples/quickstart.rst b/generate_human_motion/pyrender/docs/source/examples/quickstart.rst
new file mode 100644
index 0000000000000000000000000000000000000000..ac556419e5206c2ccd4bc985feb1a8c7347310af
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/source/examples/quickstart.rst
@@ -0,0 +1,71 @@
+.. _quickstart_guide:
+
+Quickstart
+==========
+
+
+Minimal Example for 3D Viewer
+-----------------------------
+Here is a minimal example of loading and viewing a triangular mesh model
+in pyrender.
+
+>>> import trimesh
+>>> import pyrender
+>>> fuze_trimesh = trimesh.load('examples/models/fuze.obj')
+>>> mesh = pyrender.Mesh.from_trimesh(fuze_trimesh)
+>>> scene = pyrender.Scene()
+>>> scene.add(mesh)
+>>> pyrender.Viewer(scene, use_raymond_lighting=True)
+
+.. image:: /_static/fuze.png
+
+
+Minimal Example for Offscreen Rendering
+---------------------------------------
+.. note::
+ If you're using a headless server, make sure that you followed the guide
+ for installing OSMesa. See :ref:`osmesa`.
+
+Here is a minimal example of rendering a mesh model offscreen in pyrender.
+The only additional necessities are that you need to add lighting and a camera.
+
+>>> import numpy as np
+>>> import trimesh
+>>> import pyrender
+>>> import matplotlib.pyplot as plt
+
+>>> fuze_trimesh = trimesh.load('examples/models/fuze.obj')
+>>> mesh = pyrender.Mesh.from_trimesh(fuze_trimesh)
+>>> scene = pyrender.Scene()
+>>> scene.add(mesh)
+>>> camera = pyrender.PerspectiveCamera(yfov=np.pi / 3.0, aspectRatio=1.0)
+>>> s = np.sqrt(2)/2
+>>> camera_pose = np.array([
+... [0.0, -s, s, 0.3],
+... [1.0, 0.0, 0.0, 0.0],
+... [0.0, s, s, 0.35],
+... [0.0, 0.0, 0.0, 1.0],
+... ])
+>>> scene.add(camera, pose=camera_pose)
+>>> light = pyrender.SpotLight(color=np.ones(3), intensity=3.0,
+... innerConeAngle=np.pi/16.0,
+... outerConeAngle=np.pi/6.0)
+>>> scene.add(light, pose=camera_pose)
+>>> r = pyrender.OffscreenRenderer(400, 400)
+>>> color, depth = r.render(scene)
+>>> plt.figure()
+>>> plt.subplot(1,2,1)
+>>> plt.axis('off')
+>>> plt.imshow(color)
+>>> plt.subplot(1,2,2)
+>>> plt.axis('off')
+>>> plt.imshow(depth, cmap=plt.cm.gray_r)
+>>> plt.show()
+
+.. image:: /_static/minexcolor.png
+ :width: 45%
+ :align: left
+.. image:: /_static/minexdepth.png
+ :width: 45%
+ :align: right
+
diff --git a/generate_human_motion/pyrender/docs/source/examples/scenes.rst b/generate_human_motion/pyrender/docs/source/examples/scenes.rst
new file mode 100644
index 0000000000000000000000000000000000000000..94c243f8b860b9669ac26105fd2b9906054f4568
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/source/examples/scenes.rst
@@ -0,0 +1,78 @@
+.. _scene_guide:
+
+Creating Scenes
+===============
+
+Before you render anything, you need to put all of your lights, cameras,
+and meshes into a scene. The :class:`.Scene` object keeps track of the relative
+poses of these primitives by inserting them into :class:`.Node` objects and
+keeping them in a directed acyclic graph.
+
+Adding Objects
+--------------
+
+To create a :class:`.Scene`, simply call the constructor. You can optionally
+specify an ambient light color and a background color:
+
+>>> scene = pyrender.Scene(ambient_light=[0.02, 0.02, 0.02],
+... bg_color=[1.0, 1.0, 1.0])
+
+You can add objects to a scene by first creating a :class:`.Node` object
+and adding the object and its pose to the :class:`.Node`. Poses are specified
+as 4x4 homogenous transformation matrices that are stored in the node's
+:attr:`.Node.matrix` attribute. Note that the :class:`.Node`
+constructor requires you to specify whether you're adding a mesh, light,
+or camera.
+
+>>> mesh = pyrender.Mesh.from_trimesh(tm)
+>>> light = pyrender.PointLight(color=[1.0, 1.0, 1.0], intensity=2.0)
+>>> cam = pyrender.PerspectiveCamera(yfov=np.pi / 3.0, aspectRatio=1.414)
+>>> nm = pyrender.Node(mesh=mesh, matrix=np.eye(4))
+>>> nl = pyrender.Node(light=light, matrix=np.eye(4))
+>>> nc = pyrender.Node(camera=cam, matrix=np.eye(4))
+>>> scene.add_node(nm)
+>>> scene.add_node(nl)
+>>> scene.add_node(nc)
+
+You can also add objects directly to a scene with the :meth:`.Scene.add` function,
+which takes care of creating a :class:`.Node` for you.
+
+>>> scene.add(mesh, pose=np.eye(4))
+>>> scene.add(light, pose=np.eye(4))
+>>> scene.add(cam, pose=np.eye(4))
+
+Nodes can be hierarchical, in which case the node's :attr:`.Node.matrix`
+specifies that node's pose relative to its parent frame. You can add nodes to
+a scene hierarchically by specifying a parent node in your calls to
+:meth:`.Scene.add` or :meth:`.Scene.add_node`:
+
+>>> scene.add_node(nl, parent_node=nc)
+>>> scene.add(cam, parent_node=nm)
+
+If you add multiple cameras to a scene, you can specify which one to render from
+by setting the :attr:`.Scene.main_camera_node` attribute.
+
+Updating Objects
+----------------
+
+You can update the poses of existing nodes with the :meth:`.Scene.set_pose`
+function. Simply call it with a :class:`.Node` that is already in the scene
+and the new pose of that node with respect to its parent as a 4x4 homogenous
+transformation matrix:
+
+>>> scene.set_pose(nl, pose=np.eye(4))
+
+If you want to get the local pose of a node, you can just access its
+:attr:`.Node.matrix` attribute. However, if you want to the get
+the pose of a node *with respect to the world frame*, you can call the
+:meth:`.Scene.get_pose` method.
+
+>>> tf = scene.get_pose(nl)
+
+Removing Objects
+----------------
+
+Finally, you can remove a :class:`.Node` and all of its children from the
+scene with the :meth:`.Scene.remove_node` function:
+
+>>> scene.remove_node(nl)
diff --git a/generate_human_motion/pyrender/docs/source/examples/viewer.rst b/generate_human_motion/pyrender/docs/source/examples/viewer.rst
new file mode 100644
index 0000000000000000000000000000000000000000..00a7973b46ec7da33b51b65581af6f25c1b1652f
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/source/examples/viewer.rst
@@ -0,0 +1,61 @@
+.. _viewer_guide:
+
+Live Scene Viewer
+=================
+
+Standard Usage
+--------------
+In addition to the offscreen renderer, Pyrender comes with a live scene viewer.
+In its standard invocation, calling the :class:`.Viewer`'s constructor will
+immediately pop a viewing window that you can navigate around in.
+
+>>> pyrender.Viewer(scene)
+
+By default, the viewer uses your scene's lighting. If you'd like to start with
+some additional lighting that moves around with the camera, you can specify that
+with:
+
+>>> pyrender.Viewer(scene, use_raymond_lighting=True)
+
+For a full list of the many options that the :class:`.Viewer` supports, check out its
+documentation.
+
+.. image:: /_static/rotation.gif
+
+Running the Viewer in a Separate Thread
+---------------------------------------
+If you'd like to animate your models, you'll want to run the viewer in a
+separate thread so that you can update the scene while the viewer is running.
+To do this, first pop the viewer in a separate thread by calling its constructor
+with the ``run_in_thread`` option set:
+
+>>> v = pyrender.Viewer(scene, run_in_thread=True)
+
+Then, you can manipulate the :class:`.Scene` while the viewer is running to
+animate things. However, be careful to acquire the viewer's
+:attr:`.Viewer.render_lock` before editing the scene to prevent data corruption:
+
+>>> i = 0
+>>> while True:
+... pose = np.eye(4)
+... pose[:3,3] = [i, 0, 0]
+... v.render_lock.acquire()
+... scene.set_pose(mesh_node, pose)
+... v.render_lock.release()
+... i += 0.01
+
+.. image:: /_static/scissors.gif
+
+You can wait on the viewer to be closed manually:
+
+>>> while v.is_active:
+... pass
+
+Or you can close it from the main thread forcibly.
+Make sure to still loop and block for the viewer to actually exit before using
+the scene object again.
+
+>>> v.close_external()
+>>> while v.is_active:
+... pass
+
diff --git a/generate_human_motion/pyrender/docs/source/index.rst b/generate_human_motion/pyrender/docs/source/index.rst
new file mode 100644
index 0000000000000000000000000000000000000000..baf189ede6bb3435cad5b8795e1937ef1a3c2c56
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/source/index.rst
@@ -0,0 +1,41 @@
+.. core documentation master file, created by
+ sphinx-quickstart on Sun Oct 16 14:33:48 2016.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+Pyrender Documentation
+========================
+Pyrender is a pure Python (2.7, 3.4, 3.5, 3.6) library for physically-based
+rendering and visualization.
+It is designed to meet the glTF 2.0 specification_ from Khronos
+
+.. _specification: https://www.khronos.org/gltf/
+
+Pyrender is lightweight, easy to install, and simple to use.
+It comes packaged with both an intuitive scene viewer and a headache-free
+offscreen renderer with support for GPU-accelerated rendering on headless
+servers, which makes it perfect for machine learning applications.
+Check out the :ref:`guide` for a full tutorial, or fork me on
+Github_.
+
+.. _Github: https://github.com/mmatl/pyrender
+
+.. image:: _static/rotation.gif
+
+.. image:: _static/damaged_helmet.png
+
+.. toctree::
+ :maxdepth: 2
+
+ install/index.rst
+ examples/index.rst
+ api/index.rst
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
diff --git a/generate_human_motion/pyrender/docs/source/install/index.rst b/generate_human_motion/pyrender/docs/source/install/index.rst
new file mode 100644
index 0000000000000000000000000000000000000000..c785f202d877f8bbaf286c21eddca1925973f75e
--- /dev/null
+++ b/generate_human_motion/pyrender/docs/source/install/index.rst
@@ -0,0 +1,172 @@
+Installation Guide
+==================
+
+Python Installation
+-------------------
+
+This package is available via ``pip``.
+
+.. code-block:: bash
+
+ pip install pyrender
+
+If you're on MacOS, you'll need
+to pre-install my fork of ``pyglet``, as the version on PyPI hasn't yet included
+my change that enables OpenGL contexts on MacOS.
+
+.. code-block:: bash
+
+ git clone https://github.com/mmatl/pyglet.git
+ cd pyglet
+ pip install .
+
+.. _osmesa:
+
+Getting Pyrender Working with OSMesa
+------------------------------------
+If you want to render scenes offscreen but don't want to have to
+install a display manager or deal with the pains of trying to get
+OpenGL to work over SSH, you have two options.
+
+The first (and preferred) option is using EGL, which enables you to perform
+GPU-accelerated rendering on headless servers.
+However, you'll need EGL 1.5 to get modern OpenGL contexts.
+This comes packaged with NVIDIA's current drivers, but if you are having issues
+getting EGL to work with your hardware, you can try using OSMesa,
+a software-based offscreen renderer that is included with any Mesa
+install.
+
+If you want to use OSMesa with pyrender, you'll have to perform two additional
+installation steps:
+
+- :ref:`installmesa`
+- :ref:`installpyopengl`
+
+Then, read the offscreen rendering tutorial. See :ref:`offscreen_guide`.
+
+.. _installmesa:
+
+Installing OSMesa
+*****************
+
+As a first step, you'll need to rebuild and re-install Mesa with support
+for fast offscreen rendering and OpenGL 3+ contexts.
+I'd recommend installing from source, but you can also try my ``.deb``
+for Ubuntu 16.04 and up.
+
+Installing from a Debian Package
+********************************
+
+If you're running Ubuntu 16.04 or newer, you should be able to install the
+required version of Mesa from my ``.deb`` file.
+
+.. code-block:: bash
+
+ sudo apt update
+ sudo wget https://github.com/mmatl/travis_debs/raw/master/xenial/mesa_18.3.3-0.deb
+ sudo dpkg -i ./mesa_18.3.3-0.deb || true
+ sudo apt install -f
+
+If this doesn't work, try building from source.
+
+Building From Source
+********************
+
+First, install build dependencies via `apt` or your system's package manager.
+
+.. code-block:: bash
+
+ sudo apt-get install llvm-6.0 freeglut3 freeglut3-dev
+
+Then, download the current release of Mesa from here_.
+Unpack the source and go to the source folder:
+
+.. _here: https://archive.mesa3d.org/mesa-18.3.3.tar.gz
+
+.. code-block:: bash
+
+ tar xfv mesa-18.3.3.tar.gz
+ cd mesa-18.3.3
+
+Replace ``PREFIX`` with the path you want to install Mesa at.
+If you're not worried about overwriting your default Mesa install,
+a good place is at ``/usr/local``.
+
+Now, configure the installation by running the following command:
+
+.. code-block:: bash
+
+ ./configure --prefix=PREFIX \
+ --enable-opengl --disable-gles1 --disable-gles2 \
+ --disable-va --disable-xvmc --disable-vdpau \
+ --enable-shared-glapi \
+ --disable-texture-float \
+ --enable-gallium-llvm --enable-llvm-shared-libs \
+ --with-gallium-drivers=swrast,swr \
+ --disable-dri --with-dri-drivers= \
+ --disable-egl --with-egl-platforms= --disable-gbm \
+ --disable-glx \
+ --disable-osmesa --enable-gallium-osmesa \
+ ac_cv_path_LLVM_CONFIG=llvm-config-6.0
+
+Finally, build and install Mesa.
+
+.. code-block:: bash
+
+ make -j8
+ make install
+
+Finally, if you didn't install Mesa in the system path,
+add the following lines to your ``~/.bashrc`` file after
+changing ``MESA_HOME`` to your mesa installation path (i.e. what you used as
+``PREFIX`` during the configure command).
+
+.. code-block:: bash
+
+ MESA_HOME=/path/to/your/mesa/installation
+ export LIBRARY_PATH=$LIBRARY_PATH:$MESA_HOME/lib
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MESA_HOME/lib
+ export C_INCLUDE_PATH=$C_INCLUDE_PATH:$MESA_HOME/include/
+ export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:$MESA_HOME/include/
+
+.. _installpyopengl:
+
+Installing a Compatible Fork of PyOpenGL
+****************************************
+
+Next, install and use my fork of ``PyOpenGL``.
+This fork enables getting modern OpenGL contexts with OSMesa.
+My patch has been included in ``PyOpenGL``, but it has not yet been released
+on PyPI.
+
+.. code-block:: bash
+
+ git clone https://github.com/mmatl/pyopengl.git
+ pip install ./pyopengl
+
+
+Building Documentation
+----------------------
+
+The online documentation for ``pyrender`` is automatically built by Read The Docs.
+Building ``pyrender``'s documentation locally requires a few extra dependencies --
+specifically, `sphinx`_ and a few plugins.
+
+.. _sphinx: http://www.sphinx-doc.org/en/master/
+
+To install the dependencies required, simply change directories into the `pyrender` source and run
+
+.. code-block:: bash
+
+ $ pip install .[docs]
+
+Then, go to the ``docs`` directory and run ``make`` with the appropriate target.
+For example,
+
+.. code-block:: bash
+
+ $ cd docs/
+ $ make html
+
+will generate a set of web pages. Any documentation files
+generated in this manner can be found in ``docs/build``.
diff --git a/generate_human_motion/pyrender/examples/duck.py b/generate_human_motion/pyrender/examples/duck.py
new file mode 100644
index 0000000000000000000000000000000000000000..9a94bad5bfb30493f7364f2e52cbb4badbccb2c7
--- /dev/null
+++ b/generate_human_motion/pyrender/examples/duck.py
@@ -0,0 +1,13 @@
+from pyrender import Mesh, Scene, Viewer
+from io import BytesIO
+import numpy as np
+import trimesh
+import requests
+
+duck_source = "https://github.com/KhronosGroup/glTF-Sample-Models/raw/master/2.0/Duck/glTF-Binary/Duck.glb"
+
+duck = trimesh.load(BytesIO(requests.get(duck_source).content), file_type='glb')
+duckmesh = Mesh.from_trimesh(list(duck.geometry.values())[0])
+scene = Scene(ambient_light=np.array([1.0, 1.0, 1.0, 1.0]))
+scene.add(duckmesh)
+Viewer(scene)
diff --git a/generate_human_motion/pyrender/examples/example.py b/generate_human_motion/pyrender/examples/example.py
new file mode 100644
index 0000000000000000000000000000000000000000..599a4850a5899cdeb1a76db1c5cf1c91c263cd41
--- /dev/null
+++ b/generate_human_motion/pyrender/examples/example.py
@@ -0,0 +1,157 @@
+"""Examples of using pyrender for viewing and offscreen rendering.
+"""
+import pyglet
+pyglet.options['shadow_window'] = False
+import os
+import numpy as np
+import trimesh
+
+from pyrender import PerspectiveCamera,\
+ DirectionalLight, SpotLight, PointLight,\
+ MetallicRoughnessMaterial,\
+ Primitive, Mesh, Node, Scene,\
+ Viewer, OffscreenRenderer, RenderFlags
+
+#==============================================================================
+# Mesh creation
+#==============================================================================
+
+#------------------------------------------------------------------------------
+# Creating textured meshes from trimeshes
+#------------------------------------------------------------------------------
+
+# Fuze trimesh
+fuze_trimesh = trimesh.load('./models/fuze.obj')
+fuze_mesh = Mesh.from_trimesh(fuze_trimesh)
+
+# Drill trimesh
+drill_trimesh = trimesh.load('./models/drill.obj')
+drill_mesh = Mesh.from_trimesh(drill_trimesh)
+drill_pose = np.eye(4)
+drill_pose[0,3] = 0.1
+drill_pose[2,3] = -np.min(drill_trimesh.vertices[:,2])
+
+# Wood trimesh
+wood_trimesh = trimesh.load('./models/wood.obj')
+wood_mesh = Mesh.from_trimesh(wood_trimesh)
+
+# Water bottle trimesh
+bottle_gltf = trimesh.load('./models/WaterBottle.glb')
+bottle_trimesh = bottle_gltf.geometry[list(bottle_gltf.geometry.keys())[0]]
+bottle_mesh = Mesh.from_trimesh(bottle_trimesh)
+bottle_pose = np.array([
+ [1.0, 0.0, 0.0, 0.1],
+ [0.0, 0.0, -1.0, -0.16],
+ [0.0, 1.0, 0.0, 0.13],
+ [0.0, 0.0, 0.0, 1.0],
+])
+
+#------------------------------------------------------------------------------
+# Creating meshes with per-vertex colors
+#------------------------------------------------------------------------------
+boxv_trimesh = trimesh.creation.box(extents=0.1*np.ones(3))
+boxv_vertex_colors = np.random.uniform(size=(boxv_trimesh.vertices.shape))
+boxv_trimesh.visual.vertex_colors = boxv_vertex_colors
+boxv_mesh = Mesh.from_trimesh(boxv_trimesh, smooth=False)
+
+#------------------------------------------------------------------------------
+# Creating meshes with per-face colors
+#------------------------------------------------------------------------------
+boxf_trimesh = trimesh.creation.box(extents=0.1*np.ones(3))
+boxf_face_colors = np.random.uniform(size=boxf_trimesh.faces.shape)
+boxf_trimesh.visual.face_colors = boxf_face_colors
+boxf_mesh = Mesh.from_trimesh(boxf_trimesh, smooth=False)
+
+#------------------------------------------------------------------------------
+# Creating meshes from point clouds
+#------------------------------------------------------------------------------
+points = trimesh.creation.icosphere(radius=0.05).vertices
+point_colors = np.random.uniform(size=points.shape)
+points_mesh = Mesh.from_points(points, colors=point_colors)
+
+#==============================================================================
+# Light creation
+#==============================================================================
+
+direc_l = DirectionalLight(color=np.ones(3), intensity=1.0)
+spot_l = SpotLight(color=np.ones(3), intensity=10.0,
+ innerConeAngle=np.pi/16, outerConeAngle=np.pi/6)
+point_l = PointLight(color=np.ones(3), intensity=10.0)
+
+#==============================================================================
+# Camera creation
+#==============================================================================
+
+cam = PerspectiveCamera(yfov=(np.pi / 3.0))
+cam_pose = np.array([
+ [0.0, -np.sqrt(2)/2, np.sqrt(2)/2, 0.5],
+ [1.0, 0.0, 0.0, 0.0],
+ [0.0, np.sqrt(2)/2, np.sqrt(2)/2, 0.4],
+ [0.0, 0.0, 0.0, 1.0]
+])
+
+#==============================================================================
+# Scene creation
+#==============================================================================
+
+scene = Scene(ambient_light=np.array([0.02, 0.02, 0.02, 1.0]))
+
+#==============================================================================
+# Adding objects to the scene
+#==============================================================================
+
+#------------------------------------------------------------------------------
+# By manually creating nodes
+#------------------------------------------------------------------------------
+fuze_node = Node(mesh=fuze_mesh, translation=np.array([0.1, 0.15, -np.min(fuze_trimesh.vertices[:,2])]))
+scene.add_node(fuze_node)
+boxv_node = Node(mesh=boxv_mesh, translation=np.array([-0.1, 0.10, 0.05]))
+scene.add_node(boxv_node)
+boxf_node = Node(mesh=boxf_mesh, translation=np.array([-0.1, -0.10, 0.05]))
+scene.add_node(boxf_node)
+
+#------------------------------------------------------------------------------
+# By using the add() utility function
+#------------------------------------------------------------------------------
+drill_node = scene.add(drill_mesh, pose=drill_pose)
+bottle_node = scene.add(bottle_mesh, pose=bottle_pose)
+wood_node = scene.add(wood_mesh)
+direc_l_node = scene.add(direc_l, pose=cam_pose)
+spot_l_node = scene.add(spot_l, pose=cam_pose)
+
+#==============================================================================
+# Using the viewer with a default camera
+#==============================================================================
+
+v = Viewer(scene, shadows=True)
+
+#==============================================================================
+# Using the viewer with a pre-specified camera
+#==============================================================================
+cam_node = scene.add(cam, pose=cam_pose)
+v = Viewer(scene, central_node=drill_node)
+
+#==============================================================================
+# Rendering offscreen from that camera
+#==============================================================================
+
+r = OffscreenRenderer(viewport_width=640*2, viewport_height=480*2)
+color, depth = r.render(scene)
+
+import matplotlib.pyplot as plt
+plt.figure()
+plt.imshow(color)
+plt.show()
+
+#==============================================================================
+# Segmask rendering
+#==============================================================================
+
+nm = {node: 20*(i + 1) for i, node in enumerate(scene.mesh_nodes)}
+seg = r.render(scene, RenderFlags.SEG, nm)[0]
+plt.figure()
+plt.imshow(seg)
+plt.show()
+
+r.delete()
+
diff --git a/generate_human_motion/pyrender/pyrender.egg-info/PKG-INFO b/generate_human_motion/pyrender/pyrender.egg-info/PKG-INFO
new file mode 100644
index 0000000000000000000000000000000000000000..89a41cb46ead7c453c306f3d06a797f4ac6d8761
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender.egg-info/PKG-INFO
@@ -0,0 +1,25 @@
+Metadata-Version: 2.1
+Name: pyrender
+Version: 0.1.45
+Summary: Easy-to-use Python renderer for 3D visualization
+Home-page: https://github.com/mmatl/pyrender
+Author: Matthew Matl
+Author-email: matthewcmatl@gmail.com
+License: MIT License
+Keywords: rendering graphics opengl 3d visualization pbr gltf
+Platform: UNKNOWN
+Classifier: Development Status :: 4 - Beta
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Operating System :: POSIX :: Linux
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Natural Language :: English
+Classifier: Topic :: Scientific/Engineering
+Provides-Extra: dev
+Provides-Extra: docs
+License-File: LICENSE
+
+A simple implementation of Physically-Based Rendering (PBR) in Python. Compliant with the glTF 2.0 standard.
+
diff --git a/generate_human_motion/pyrender/pyrender.egg-info/SOURCES.txt b/generate_human_motion/pyrender/pyrender.egg-info/SOURCES.txt
new file mode 100644
index 0000000000000000000000000000000000000000..80e49ad67ef14c6ecadecbe24b4c278d43d7a1d5
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender.egg-info/SOURCES.txt
@@ -0,0 +1,59 @@
+LICENSE
+MANIFEST.in
+README.md
+setup.py
+pyrender/__init__.py
+pyrender/camera.py
+pyrender/constants.py
+pyrender/font.py
+pyrender/light.py
+pyrender/material.py
+pyrender/mesh.py
+pyrender/node.py
+pyrender/offscreen.py
+pyrender/primitive.py
+pyrender/renderer.py
+pyrender/sampler.py
+pyrender/scene.py
+pyrender/shader_program.py
+pyrender/texture.py
+pyrender/trackball.py
+pyrender/utils.py
+pyrender/version.py
+pyrender/viewer.py
+pyrender.egg-info/PKG-INFO
+pyrender.egg-info/SOURCES.txt
+pyrender.egg-info/dependency_links.txt
+pyrender.egg-info/requires.txt
+pyrender.egg-info/top_level.txt
+pyrender/fonts/OpenSans-Bold.ttf
+pyrender/fonts/OpenSans-BoldItalic.ttf
+pyrender/fonts/OpenSans-ExtraBold.ttf
+pyrender/fonts/OpenSans-ExtraBoldItalic.ttf
+pyrender/fonts/OpenSans-Italic.ttf
+pyrender/fonts/OpenSans-Light.ttf
+pyrender/fonts/OpenSans-LightItalic.ttf
+pyrender/fonts/OpenSans-Regular.ttf
+pyrender/fonts/OpenSans-Semibold.ttf
+pyrender/fonts/OpenSans-SemiboldItalic.ttf
+pyrender/platforms/__init__.py
+pyrender/platforms/base.py
+pyrender/platforms/egl.py
+pyrender/platforms/osmesa.py
+pyrender/platforms/pyglet_platform.py
+pyrender/shaders/debug_quad.frag
+pyrender/shaders/debug_quad.vert
+pyrender/shaders/flat.frag
+pyrender/shaders/flat.vert
+pyrender/shaders/mesh.frag
+pyrender/shaders/mesh.vert
+pyrender/shaders/mesh_depth.frag
+pyrender/shaders/mesh_depth.vert
+pyrender/shaders/segmentation.frag
+pyrender/shaders/segmentation.vert
+pyrender/shaders/text.frag
+pyrender/shaders/text.vert
+pyrender/shaders/vertex_normals.frag
+pyrender/shaders/vertex_normals.geom
+pyrender/shaders/vertex_normals.vert
+pyrender/shaders/vertex_normals_pc.geom
\ No newline at end of file
diff --git a/generate_human_motion/pyrender/pyrender.egg-info/dependency_links.txt b/generate_human_motion/pyrender/pyrender.egg-info/dependency_links.txt
new file mode 100644
index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/generate_human_motion/pyrender/pyrender.egg-info/requires.txt b/generate_human_motion/pyrender/pyrender.egg-info/requires.txt
new file mode 100644
index 0000000000000000000000000000000000000000..c7754a07704882b92493b8dfbaf5797a851227c5
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender.egg-info/requires.txt
@@ -0,0 +1,23 @@
+freetype-py
+imageio
+networkx
+numpy
+Pillow
+pyglet>=1.5.24
+PyOpenGL~=3.1.0
+PyOpenGL_accelerate~=3.1.0
+scipy
+six
+trimesh
+
+[dev]
+flake8
+pre-commit
+pytest
+pytest-cov
+tox
+
+[docs]
+sphinx
+sphinx_rtd_theme
+sphinx-automodapi
diff --git a/generate_human_motion/pyrender/pyrender.egg-info/top_level.txt b/generate_human_motion/pyrender/pyrender.egg-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..007b48629bfc09c1c8c8a10901b466cf3f87b666
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender.egg-info/top_level.txt
@@ -0,0 +1 @@
+pyrender
diff --git a/generate_human_motion/pyrender/pyrender/__init__.py b/generate_human_motion/pyrender/pyrender/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..ee3709846823b7c4b71b22da0e24d63d805528a8
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/__init__.py
@@ -0,0 +1,24 @@
+from .camera import (Camera, PerspectiveCamera, OrthographicCamera,
+ IntrinsicsCamera)
+from .light import Light, PointLight, DirectionalLight, SpotLight
+from .sampler import Sampler
+from .texture import Texture
+from .material import Material, MetallicRoughnessMaterial
+from .primitive import Primitive
+from .mesh import Mesh
+from .node import Node
+from .scene import Scene
+from .renderer import Renderer
+from .viewer import Viewer
+from .offscreen import OffscreenRenderer
+from .version import __version__
+from .constants import RenderFlags, TextAlign, GLTF
+
+__all__ = [
+ 'Camera', 'PerspectiveCamera', 'OrthographicCamera', 'IntrinsicsCamera',
+ 'Light', 'PointLight', 'DirectionalLight', 'SpotLight',
+ 'Sampler', 'Texture', 'Material', 'MetallicRoughnessMaterial',
+ 'Primitive', 'Mesh', 'Node', 'Scene', 'Renderer', 'Viewer',
+ 'OffscreenRenderer', '__version__', 'RenderFlags', 'TextAlign',
+ 'GLTF'
+]
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/__init__.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fb4fe7a3c1438dfec007aecafc6f6f08c34f895c
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/__init__.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/camera.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/camera.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8f41161e1933b81755f4e8c692ab4522c331a367
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/camera.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/constants.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/constants.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6662e8c381041c68f6e7fc91f67fac1ef4b911c6
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/constants.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/font.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/font.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8426c1ef7562eb0b3cf2506787022bb4c90ba47d
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/font.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/light.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/light.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..831a754917bcfab92465e1ebe03f741bd2ff719c
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/light.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/material.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/material.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..387d8c11a5ed98e43d32b63f28f893052bf48dd2
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/material.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/mesh.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/mesh.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9c15e307762b55b3c2c8fe19df5839ab384f6605
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/mesh.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/node.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/node.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..060c8f623f6322a462e0e5235e5254a52d222575
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/node.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/offscreen.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/offscreen.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e12361d757a0975edc5a22f4978cb9d6473f80f8
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/offscreen.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/primitive.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/primitive.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..287b41f3f47fac5e0ff988d8d7477f5c592f450d
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/primitive.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/renderer.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/renderer.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b7af12b515715ab3ce767397562c4eb827c5a23f
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/renderer.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/sampler.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/sampler.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0716c37bcfe042b9d88703c22a9937f0411ba688
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/sampler.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/scene.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/scene.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5b4c6b1a225ccad1d98616875b924d40b6810a40
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/scene.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/shader_program.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/shader_program.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..74fe645f394dfa1dad7f4b35637997ab50816bef
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/shader_program.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/texture.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/texture.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..84c9b838fa8af7ce7182482d3e7958de33b6f749
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/texture.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/trackball.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/trackball.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f55c245f2fe80b59fe0347ad65ac27c50a86e0d9
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/trackball.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/utils.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/utils.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..49b68ccb7e5db85d1249575cc8824f67d63fb4d7
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/utils.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/version.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/version.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..45a63b64369cb595adddb5340bcfc9375c79dd2a
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/version.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/__pycache__/viewer.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/__pycache__/viewer.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..01a541653700a522724f1a7ff80ca1d2f98b7666
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/__pycache__/viewer.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/camera.py b/generate_human_motion/pyrender/pyrender/camera.py
new file mode 100644
index 0000000000000000000000000000000000000000..e019358039033c3a372c990ebad3151258c3651d
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/camera.py
@@ -0,0 +1,437 @@
+"""Virtual cameras compliant with the glTF 2.0 specification as described at
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-camera
+
+Author: Matthew Matl
+"""
+import abc
+import numpy as np
+import six
+import sys
+
+from .constants import DEFAULT_Z_NEAR, DEFAULT_Z_FAR
+
+
+@six.add_metaclass(abc.ABCMeta)
+class Camera(object):
+ """Abstract base class for all cameras.
+
+ Note
+ ----
+ Camera poses are specified in the OpenGL format,
+ where the z axis points away from the view direction and the
+ x and y axes point to the right and up in the image plane, respectively.
+
+ Parameters
+ ----------
+ znear : float
+ The floating-point distance to the near clipping plane.
+ zfar : float
+ The floating-point distance to the far clipping plane.
+ ``zfar`` must be greater than ``znear``.
+ name : str, optional
+ The user-defined name of this object.
+ """
+
+ def __init__(self,
+ znear=DEFAULT_Z_NEAR,
+ zfar=DEFAULT_Z_FAR,
+ name=None):
+ self.name = name
+ self.znear = znear
+ self.zfar = zfar
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def znear(self):
+ """float : The distance to the near clipping plane.
+ """
+ return self._znear
+
+ @znear.setter
+ def znear(self, value):
+ value = float(value)
+ if value < 0:
+ raise ValueError('z-near must be >= 0.0')
+ self._znear = value
+
+ @property
+ def zfar(self):
+ """float : The distance to the far clipping plane.
+ """
+ return self._zfar
+
+ @zfar.setter
+ def zfar(self, value):
+ value = float(value)
+ if value <= 0 or value <= self.znear:
+ raise ValueError('zfar must be >0 and >znear')
+ self._zfar = value
+
+ @abc.abstractmethod
+ def get_projection_matrix(self, width=None, height=None):
+ """Return the OpenGL projection matrix for this camera.
+
+ Parameters
+ ----------
+ width : int
+ Width of the current viewport, in pixels.
+ height : int
+ Height of the current viewport, in pixels.
+ """
+ pass
+
+
+class PerspectiveCamera(Camera):
+
+ """A perspective camera for perspective projection.
+
+ Parameters
+ ----------
+ yfov : float
+ The floating-point vertical field of view in radians.
+ znear : float
+ The floating-point distance to the near clipping plane.
+ If not specified, defaults to 0.05.
+ zfar : float, optional
+ The floating-point distance to the far clipping plane.
+ ``zfar`` must be greater than ``znear``.
+ If None, the camera uses an infinite projection matrix.
+ aspectRatio : float, optional
+ The floating-point aspect ratio of the field of view.
+ If not specified, the camera uses the viewport's aspect ratio.
+ name : str, optional
+ The user-defined name of this object.
+ """
+
+ def __init__(self,
+ yfov,
+ znear=DEFAULT_Z_NEAR,
+ zfar=None,
+ aspectRatio=None,
+ name=None):
+ super(PerspectiveCamera, self).__init__(
+ znear=znear,
+ zfar=zfar,
+ name=name,
+ )
+
+ self.yfov = yfov
+ self.aspectRatio = aspectRatio
+
+ @property
+ def yfov(self):
+ """float : The vertical field of view in radians.
+ """
+ return self._yfov
+
+ @yfov.setter
+ def yfov(self, value):
+ value = float(value)
+ if value <= 0.0:
+ raise ValueError('Field of view must be positive')
+ self._yfov = value
+
+ @property
+ def zfar(self):
+ """float : The distance to the far clipping plane.
+ """
+ return self._zfar
+
+ @zfar.setter
+ def zfar(self, value):
+ if value is not None:
+ value = float(value)
+ if value <= 0 or value <= self.znear:
+ raise ValueError('zfar must be >0 and >znear')
+ self._zfar = value
+
+ @property
+ def aspectRatio(self):
+ """float : The ratio of the width to the height of the field of view.
+ """
+ return self._aspectRatio
+
+ @aspectRatio.setter
+ def aspectRatio(self, value):
+ if value is not None:
+ value = float(value)
+ if value <= 0.0:
+ raise ValueError('Aspect ratio must be positive')
+ self._aspectRatio = value
+
+ def get_projection_matrix(self, width=None, height=None):
+ """Return the OpenGL projection matrix for this camera.
+
+ Parameters
+ ----------
+ width : int
+ Width of the current viewport, in pixels.
+ height : int
+ Height of the current viewport, in pixels.
+ """
+ aspect_ratio = self.aspectRatio
+ if aspect_ratio is None:
+ if width is None or height is None:
+ raise ValueError('Aspect ratio of camera must be defined')
+ aspect_ratio = float(width) / float(height)
+
+ a = aspect_ratio
+ t = np.tan(self.yfov / 2.0)
+ n = self.znear
+ f = self.zfar
+
+ P = np.zeros((4,4))
+ P[0][0] = 1.0 / (a * t)
+ P[1][1] = 1.0 / t
+ P[3][2] = -1.0
+
+ if f is None:
+ P[2][2] = -1.0
+ P[2][3] = -2.0 * n
+ else:
+ P[2][2] = (f + n) / (n - f)
+ P[2][3] = (2 * f * n) / (n - f)
+
+ return P
+
+
+class OrthographicCamera(Camera):
+ """An orthographic camera for orthographic projection.
+
+ Parameters
+ ----------
+ xmag : float
+ The floating-point horizontal magnification of the view.
+ ymag : float
+ The floating-point vertical magnification of the view.
+ znear : float
+ The floating-point distance to the near clipping plane.
+ If not specified, defaults to 0.05.
+ zfar : float
+ The floating-point distance to the far clipping plane.
+ ``zfar`` must be greater than ``znear``.
+ If not specified, defaults to 100.0.
+ name : str, optional
+ The user-defined name of this object.
+ """
+
+ def __init__(self,
+ xmag,
+ ymag,
+ znear=DEFAULT_Z_NEAR,
+ zfar=DEFAULT_Z_FAR,
+ name=None):
+ super(OrthographicCamera, self).__init__(
+ znear=znear,
+ zfar=zfar,
+ name=name,
+ )
+
+ self.xmag = xmag
+ self.ymag = ymag
+
+ @property
+ def xmag(self):
+ """float : The horizontal magnification of the view.
+ """
+ return self._xmag
+
+ @xmag.setter
+ def xmag(self, value):
+ value = float(value)
+ if value <= 0.0:
+ raise ValueError('X magnification must be positive')
+ self._xmag = value
+
+ @property
+ def ymag(self):
+ """float : The vertical magnification of the view.
+ """
+ return self._ymag
+
+ @ymag.setter
+ def ymag(self, value):
+ value = float(value)
+ if value <= 0.0:
+ raise ValueError('Y magnification must be positive')
+ self._ymag = value
+
+ @property
+ def znear(self):
+ """float : The distance to the near clipping plane.
+ """
+ return self._znear
+
+ @znear.setter
+ def znear(self, value):
+ value = float(value)
+ if value <= 0:
+ raise ValueError('z-near must be > 0.0')
+ self._znear = value
+
+ def get_projection_matrix(self, width=None, height=None):
+ """Return the OpenGL projection matrix for this camera.
+
+ Parameters
+ ----------
+ width : int
+ Width of the current viewport, in pixels.
+ Unused in this function.
+ height : int
+ Height of the current viewport, in pixels.
+ Unused in this function.
+ """
+ xmag = self.xmag
+ ymag = self.ymag
+
+ # If screen width/height defined, rescale xmag
+ if width is not None and height is not None:
+ xmag = width / height * ymag
+
+ n = self.znear
+ f = self.zfar
+ P = np.zeros((4,4))
+ P[0][0] = 1.0 / xmag
+ P[1][1] = 1.0 / ymag
+ P[2][2] = 2.0 / (n - f)
+ P[2][3] = (f + n) / (n - f)
+ P[3][3] = 1.0
+ return P
+
+
+class IntrinsicsCamera(Camera):
+ """A perspective camera with custom intrinsics.
+
+ Parameters
+ ----------
+ fx : float
+ X-axis focal length in pixels.
+ fy : float
+ Y-axis focal length in pixels.
+ cx : float
+ X-axis optical center in pixels.
+ cy : float
+ Y-axis optical center in pixels.
+ znear : float
+ The floating-point distance to the near clipping plane.
+ If not specified, defaults to 0.05.
+ zfar : float
+ The floating-point distance to the far clipping plane.
+ ``zfar`` must be greater than ``znear``.
+ If not specified, defaults to 100.0.
+ name : str, optional
+ The user-defined name of this object.
+ """
+
+ def __init__(self,
+ fx,
+ fy,
+ cx,
+ cy,
+ znear=DEFAULT_Z_NEAR,
+ zfar=DEFAULT_Z_FAR,
+ name=None):
+ super(IntrinsicsCamera, self).__init__(
+ znear=znear,
+ zfar=zfar,
+ name=name,
+ )
+
+ self.fx = fx
+ self.fy = fy
+ self.cx = cx
+ self.cy = cy
+
+ @property
+ def fx(self):
+ """float : X-axis focal length in meters.
+ """
+ return self._fx
+
+ @fx.setter
+ def fx(self, value):
+ self._fx = float(value)
+
+ @property
+ def fy(self):
+ """float : Y-axis focal length in meters.
+ """
+ return self._fy
+
+ @fy.setter
+ def fy(self, value):
+ self._fy = float(value)
+
+ @property
+ def cx(self):
+ """float : X-axis optical center in pixels.
+ """
+ return self._cx
+
+ @cx.setter
+ def cx(self, value):
+ self._cx = float(value)
+
+ @property
+ def cy(self):
+ """float : Y-axis optical center in pixels.
+ """
+ return self._cy
+
+ @cy.setter
+ def cy(self, value):
+ self._cy = float(value)
+
+ def get_projection_matrix(self, width, height):
+ """Return the OpenGL projection matrix for this camera.
+
+ Parameters
+ ----------
+ width : int
+ Width of the current viewport, in pixels.
+ height : int
+ Height of the current viewport, in pixels.
+ """
+ width = float(width)
+ height = float(height)
+
+ cx, cy = self.cx, self.cy
+ fx, fy = self.fx, self.fy
+ if sys.platform == 'darwin':
+ cx = self.cx * 2.0
+ cy = self.cy * 2.0
+ fx = self.fx * 2.0
+ fy = self.fy * 2.0
+
+ P = np.zeros((4,4))
+ P[0][0] = 2.0 * fx / width
+ P[1][1] = 2.0 * fy / height
+ P[0][2] = 1.0 - 2.0 * cx / width
+ P[1][2] = 2.0 * cy / height - 1.0
+ P[3][2] = -1.0
+
+ n = self.znear
+ f = self.zfar
+ if f is None:
+ P[2][2] = -1.0
+ P[2][3] = -2.0 * n
+ else:
+ P[2][2] = (f + n) / (n - f)
+ P[2][3] = (2 * f * n) / (n - f)
+
+ return P
+
+
+__all__ = ['Camera', 'PerspectiveCamera', 'OrthographicCamera',
+ 'IntrinsicsCamera']
diff --git a/generate_human_motion/pyrender/pyrender/constants.py b/generate_human_motion/pyrender/pyrender/constants.py
new file mode 100644
index 0000000000000000000000000000000000000000..8a5785b6fdb21910a174252c5af2f05b40ece4a5
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/constants.py
@@ -0,0 +1,149 @@
+DEFAULT_Z_NEAR = 0.05 # Near clipping plane, in meters
+DEFAULT_Z_FAR = 100.0 # Far clipping plane, in meters
+DEFAULT_SCENE_SCALE = 2.0 # Default scene scale
+MAX_N_LIGHTS = 4 # Maximum number of lights of each type allowed
+TARGET_OPEN_GL_MAJOR = 4 # Target OpenGL Major Version
+TARGET_OPEN_GL_MINOR = 1 # Target OpenGL Minor Version
+MIN_OPEN_GL_MAJOR = 3 # Minimum OpenGL Major Version
+MIN_OPEN_GL_MINOR = 3 # Minimum OpenGL Minor Version
+FLOAT_SZ = 4 # Byte size of GL float32
+UINT_SZ = 4 # Byte size of GL uint32
+SHADOW_TEX_SZ = 2048 # Width and Height of Shadow Textures
+TEXT_PADDING = 20 # Width of padding for rendering text (px)
+
+
+# Flags for render type
+class RenderFlags(object):
+ """Flags for rendering in the scene.
+
+ Combine them with the bitwise or. For example,
+
+ >>> flags = OFFSCREEN | SHADOWS_DIRECTIONAL | VERTEX_NORMALS
+
+ would result in an offscreen render with directional shadows and
+ vertex normals enabled.
+ """
+ NONE = 0
+ """Normal PBR Render."""
+ DEPTH_ONLY = 1
+ """Only render the depth buffer."""
+ OFFSCREEN = 2
+ """Render offscreen and return the depth and (optionally) color buffers."""
+ FLIP_WIREFRAME = 4
+ """Invert the status of wireframe rendering for each mesh."""
+ ALL_WIREFRAME = 8
+ """Render all meshes as wireframes."""
+ ALL_SOLID = 16
+ """Render all meshes as solids."""
+ SHADOWS_DIRECTIONAL = 32
+ """Render shadows for directional lights."""
+ SHADOWS_POINT = 64
+ """Render shadows for point lights."""
+ SHADOWS_SPOT = 128
+ """Render shadows for spot lights."""
+ SHADOWS_ALL = 32 | 64 | 128
+ """Render shadows for all lights."""
+ VERTEX_NORMALS = 256
+ """Render vertex normals."""
+ FACE_NORMALS = 512
+ """Render face normals."""
+ SKIP_CULL_FACES = 1024
+ """Do not cull back faces."""
+ RGBA = 2048
+ """Render the color buffer with the alpha channel enabled."""
+ FLAT = 4096
+ """Render the color buffer flat, with no lighting computations."""
+ SEG = 8192
+
+
+class TextAlign:
+ """Text alignment options for captions.
+
+ Only use one at a time.
+ """
+ CENTER = 0
+ """Center the text by width and height."""
+ CENTER_LEFT = 1
+ """Center the text by height and left-align it."""
+ CENTER_RIGHT = 2
+ """Center the text by height and right-align it."""
+ BOTTOM_LEFT = 3
+ """Put the text in the bottom-left corner."""
+ BOTTOM_RIGHT = 4
+ """Put the text in the bottom-right corner."""
+ BOTTOM_CENTER = 5
+ """Center the text by width and fix it to the bottom."""
+ TOP_LEFT = 6
+ """Put the text in the top-left corner."""
+ TOP_RIGHT = 7
+ """Put the text in the top-right corner."""
+ TOP_CENTER = 8
+ """Center the text by width and fix it to the top."""
+
+
+class GLTF(object):
+ """Options for GL objects."""
+ NEAREST = 9728
+ """Nearest neighbor interpolation."""
+ LINEAR = 9729
+ """Linear interpolation."""
+ NEAREST_MIPMAP_NEAREST = 9984
+ """Nearest mipmapping."""
+ LINEAR_MIPMAP_NEAREST = 9985
+ """Linear mipmapping."""
+ NEAREST_MIPMAP_LINEAR = 9986
+ """Nearest mipmapping."""
+ LINEAR_MIPMAP_LINEAR = 9987
+ """Linear mipmapping."""
+ CLAMP_TO_EDGE = 33071
+ """Clamp to the edge of the texture."""
+ MIRRORED_REPEAT = 33648
+ """Mirror the texture."""
+ REPEAT = 10497
+ """Repeat the texture."""
+ POINTS = 0
+ """Render as points."""
+ LINES = 1
+ """Render as lines."""
+ LINE_LOOP = 2
+ """Render as a line loop."""
+ LINE_STRIP = 3
+ """Render as a line strip."""
+ TRIANGLES = 4
+ """Render as triangles."""
+ TRIANGLE_STRIP = 5
+ """Render as a triangle strip."""
+ TRIANGLE_FAN = 6
+ """Render as a triangle fan."""
+
+
+class BufFlags(object):
+ POSITION = 0
+ NORMAL = 1
+ TANGENT = 2
+ TEXCOORD_0 = 4
+ TEXCOORD_1 = 8
+ COLOR_0 = 16
+ JOINTS_0 = 32
+ WEIGHTS_0 = 64
+
+
+class TexFlags(object):
+ NONE = 0
+ NORMAL = 1
+ OCCLUSION = 2
+ EMISSIVE = 4
+ BASE_COLOR = 8
+ METALLIC_ROUGHNESS = 16
+ DIFFUSE = 32
+ SPECULAR_GLOSSINESS = 64
+
+
+class ProgramFlags:
+ NONE = 0
+ USE_MATERIAL = 1
+ VERTEX_NORMALS = 2
+ FACE_NORMALS = 4
+
+
+__all__ = ['RenderFlags', 'TextAlign', 'GLTF']
diff --git a/generate_human_motion/pyrender/pyrender/font.py b/generate_human_motion/pyrender/pyrender/font.py
new file mode 100644
index 0000000000000000000000000000000000000000..5ac530d7b949f50314a0d9cf5d744bedcace0571
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/font.py
@@ -0,0 +1,272 @@
+"""Font texture loader and processor.
+
+Author: Matthew Matl
+"""
+import freetype
+import numpy as np
+import os
+
+import OpenGL
+from OpenGL.GL import *
+
+from .constants import TextAlign, FLOAT_SZ
+from .texture import Texture
+from .sampler import Sampler
+
+
+class FontCache(object):
+ """A cache for fonts.
+ """
+
+ def __init__(self, font_dir=None):
+ self._font_cache = {}
+ self.font_dir = font_dir
+ if self.font_dir is None:
+ base_dir, _ = os.path.split(os.path.realpath(__file__))
+ self.font_dir = os.path.join(base_dir, 'fonts')
+
+ def get_font(self, font_name, font_pt):
+ # If it's a file, load it directly, else, try to load from font dir.
+ if os.path.isfile(font_name):
+ font_filename = font_name
+ _, font_name = os.path.split(font_name)
+ font_name, _ = os.path.split(font_name)
+ else:
+ font_filename = os.path.join(self.font_dir, font_name) + '.ttf'
+
+ cid = OpenGL.contextdata.getContext()
+ key = (cid, font_name, int(font_pt))
+
+ if key not in self._font_cache:
+ self._font_cache[key] = Font(font_filename, font_pt)
+ return self._font_cache[key]
+
+ def clear(self):
+ for key in self._font_cache:
+ self._font_cache[key].delete()
+ self._font_cache = {}
+
+
+class Character(object):
+ """A single character, with its texture and attributes.
+ """
+
+ def __init__(self, texture, size, bearing, advance):
+ self.texture = texture
+ self.size = size
+ self.bearing = bearing
+ self.advance = advance
+
+
+class Font(object):
+ """A font object.
+
+ Parameters
+ ----------
+ font_file : str
+ The file to load the font from.
+ font_pt : int
+ The height of the font in pixels.
+ """
+
+ def __init__(self, font_file, font_pt=40):
+ self.font_file = font_file
+ self.font_pt = int(font_pt)
+ self._face = freetype.Face(font_file)
+ self._face.set_pixel_sizes(0, font_pt)
+ self._character_map = {}
+
+ for i in range(0, 128):
+
+ # Generate texture
+ face = self._face
+ face.load_char(chr(i))
+ buf = face.glyph.bitmap.buffer
+ src = (np.array(buf) / 255.0).astype(np.float32)
+ src = src.reshape((face.glyph.bitmap.rows,
+ face.glyph.bitmap.width))
+ tex = Texture(
+ sampler=Sampler(
+ magFilter=GL_LINEAR,
+ minFilter=GL_LINEAR,
+ wrapS=GL_CLAMP_TO_EDGE,
+ wrapT=GL_CLAMP_TO_EDGE
+ ),
+ source=src,
+ source_channels='R',
+ )
+ character = Character(
+ texture=tex,
+ size=np.array([face.glyph.bitmap.width,
+ face.glyph.bitmap.rows]),
+ bearing=np.array([face.glyph.bitmap_left,
+ face.glyph.bitmap_top]),
+ advance=face.glyph.advance.x
+ )
+ self._character_map[chr(i)] = character
+
+ self._vbo = None
+ self._vao = None
+
+ @property
+ def font_file(self):
+ """str : The file the font was loaded from.
+ """
+ return self._font_file
+
+ @font_file.setter
+ def font_file(self, value):
+ self._font_file = value
+
+ @property
+ def font_pt(self):
+ """int : The height of the font in pixels.
+ """
+ return self._font_pt
+
+ @font_pt.setter
+ def font_pt(self, value):
+ self._font_pt = int(value)
+
+ def _add_to_context(self):
+
+ self._vao = glGenVertexArrays(1)
+ glBindVertexArray(self._vao)
+ self._vbo = glGenBuffers(1)
+ glBindBuffer(GL_ARRAY_BUFFER, self._vbo)
+ glBufferData(GL_ARRAY_BUFFER, FLOAT_SZ * 6 * 4, None, GL_DYNAMIC_DRAW)
+ glEnableVertexAttribArray(0)
+ glVertexAttribPointer(
+ 0, 4, GL_FLOAT, GL_FALSE, 4 * FLOAT_SZ, ctypes.c_void_p(0)
+ )
+ glBindVertexArray(0)
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
+ for c in self._character_map:
+ ch = self._character_map[c]
+ if not ch.texture._in_context():
+ ch.texture._add_to_context()
+
+ def _remove_from_context(self):
+ for c in self._character_map:
+ ch = self._character_map[c]
+ ch.texture.delete()
+ if self._vao is not None:
+ glDeleteVertexArrays(1, [self._vao])
+ glDeleteBuffers(1, [self._vbo])
+ self._vao = None
+ self._vbo = None
+
+ def _in_context(self):
+ return self._vao is not None
+
+ def _bind(self):
+ glBindVertexArray(self._vao)
+
+ def _unbind(self):
+ glBindVertexArray(0)
+
+ def delete(self):
+ self._unbind()
+ self._remove_from_context()
+
+ def render_string(self, text, x, y, scale=1.0,
+ align=TextAlign.BOTTOM_LEFT):
+ """Render a string to the current view buffer.
+
+ Note
+ ----
+ Assumes correct shader program already bound w/ uniforms set.
+
+ Parameters
+ ----------
+ text : str
+ The text to render.
+ x : int
+ Horizontal pixel location of text.
+ y : int
+ Vertical pixel location of text.
+ scale : int
+ Scaling factor for text.
+ align : int
+ One of the TextAlign options which specifies where the ``x``
+ and ``y`` parameters lie on the text. For example,
+ :attr:`.TextAlign.BOTTOM_LEFT` means that ``x`` and ``y`` indicate
+ the position of the bottom-left corner of the textbox.
+ """
+ glActiveTexture(GL_TEXTURE0)
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+ glDisable(GL_DEPTH_TEST)
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
+ self._bind()
+
+ # Determine width and height of text relative to x, y
+ width = 0.0
+ height = 0.0
+ for c in text:
+ ch = self._character_map[c]
+ height = max(height, ch.bearing[1] * scale)
+ width += (ch.advance >> 6) * scale
+
+ # Determine offsets based on alignments
+ xoff = 0
+ yoff = 0
+ if align == TextAlign.BOTTOM_RIGHT:
+ xoff = -width
+ elif align == TextAlign.BOTTOM_CENTER:
+ xoff = -width / 2.0
+ elif align == TextAlign.TOP_LEFT:
+ yoff = -height
+ elif align == TextAlign.TOP_RIGHT:
+ yoff = -height
+ xoff = -width
+ elif align == TextAlign.TOP_CENTER:
+ yoff = -height
+ xoff = -width / 2.0
+ elif align == TextAlign.CENTER:
+ xoff = -width / 2.0
+ yoff = -height / 2.0
+ elif align == TextAlign.CENTER_LEFT:
+ yoff = -height / 2.0
+ elif align == TextAlign.CENTER_RIGHT:
+ xoff = -width
+ yoff = -height / 2.0
+
+ x += xoff
+ y += yoff
+
+ ch = None
+ for c in text:
+ ch = self._character_map[c]
+ xpos = x + ch.bearing[0] * scale
+ ypos = y - (ch.size[1] - ch.bearing[1]) * scale
+ w = ch.size[0] * scale
+ h = ch.size[1] * scale
+
+ vertices = np.array([
+ [xpos, ypos, 0.0, 0.0],
+ [xpos + w, ypos, 1.0, 0.0],
+ [xpos + w, ypos + h, 1.0, 1.0],
+ [xpos + w, ypos + h, 1.0, 1.0],
+ [xpos, ypos + h, 0.0, 1.0],
+ [xpos, ypos, 0.0, 0.0],
+ ], dtype=np.float32)
+
+ ch.texture._bind()
+
+ glBindBuffer(GL_ARRAY_BUFFER, self._vbo)
+ glBufferData(
+ GL_ARRAY_BUFFER, FLOAT_SZ * 6 * 4, vertices, GL_DYNAMIC_DRAW
+ )
+ # TODO MAKE THIS MORE EFFICIENT, lgBufferSubData is broken
+ # glBufferSubData(
+ # GL_ARRAY_BUFFER, 0, 6 * 4 * FLOAT_SZ,
+ # np.ascontiguousarray(vertices.flatten)
+ # )
+ glDrawArrays(GL_TRIANGLES, 0, 6)
+ x += (ch.advance >> 6) * scale
+
+ self._unbind()
+ if ch:
+ ch.texture._unbind()
diff --git a/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Bold.ttf b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Bold.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..fd79d43bea0293ac1b20e8aca1142627983d2c07
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Bold.ttf differ
diff --git a/generate_human_motion/pyrender/pyrender/fonts/OpenSans-BoldItalic.ttf b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-BoldItalic.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..9bc800958a421d937fc392e00beaef4eea76dc71
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-BoldItalic.ttf differ
diff --git a/generate_human_motion/pyrender/pyrender/fonts/OpenSans-ExtraBold.ttf b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-ExtraBold.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..21f6f84a0799946fc4ae02c52b27e61c3762c745
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-ExtraBold.ttf differ
diff --git a/generate_human_motion/pyrender/pyrender/fonts/OpenSans-ExtraBoldItalic.ttf b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-ExtraBoldItalic.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..31cb688340eff462dddf47efbb4dfef66cb7fbed
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-ExtraBoldItalic.ttf differ
diff --git a/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Italic.ttf b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Italic.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..c90da48ff3b8ad6167236d70c48df4d7b5de3bbb
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Italic.ttf differ
diff --git a/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Light.ttf b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Light.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..0d381897da20345fa63112f19042561f44ee3aa0
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Light.ttf differ
diff --git a/generate_human_motion/pyrender/pyrender/fonts/OpenSans-LightItalic.ttf b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-LightItalic.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..68299c4bc6b5b7adfff2c9aee4aed7c1547100ef
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-LightItalic.ttf differ
diff --git a/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Regular.ttf b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Regular.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..db433349b7047f72f40072630c1bc110620bf09e
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Regular.ttf differ
diff --git a/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Semibold.ttf b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Semibold.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..1a7679e3949fb045f152f456bc4adad31e8b9f55
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-Semibold.ttf differ
diff --git a/generate_human_motion/pyrender/pyrender/fonts/OpenSans-SemiboldItalic.ttf b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-SemiboldItalic.ttf
new file mode 100644
index 0000000000000000000000000000000000000000..59b6d16b065f6baa6f70ddbd4322a4f44bb9636a
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/fonts/OpenSans-SemiboldItalic.ttf differ
diff --git a/generate_human_motion/pyrender/pyrender/light.py b/generate_human_motion/pyrender/pyrender/light.py
new file mode 100644
index 0000000000000000000000000000000000000000..333d9e4e553a245c259251a89b69cb46b73b1278
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/light.py
@@ -0,0 +1,385 @@
+"""Punctual light sources as defined by the glTF 2.0 KHR extension at
+https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual
+
+Author: Matthew Matl
+"""
+import abc
+import numpy as np
+import six
+
+from OpenGL.GL import *
+
+from .utils import format_color_vector
+from .texture import Texture
+from .constants import SHADOW_TEX_SZ
+from .camera import OrthographicCamera, PerspectiveCamera
+
+
+
+@six.add_metaclass(abc.ABCMeta)
+class Light(object):
+ """Base class for all light objects.
+
+ Parameters
+ ----------
+ color : (3,) float
+ RGB value for the light's color in linear space.
+ intensity : float
+ Brightness of light. The units that this is defined in depend on the
+ type of light. Point and spot lights use luminous intensity in candela
+ (lm/sr), while directional lights use illuminance in lux (lm/m2).
+ name : str, optional
+ Name of the light.
+ """
+ def __init__(self,
+ color=None,
+ intensity=None,
+ name=None):
+
+ if color is None:
+ color = np.ones(3)
+ if intensity is None:
+ intensity = 1.0
+
+ self.name = name
+ self.color = color
+ self.intensity = intensity
+ self._shadow_camera = None
+ self._shadow_texture = None
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def color(self):
+ """(3,) float : The light's color.
+ """
+ return self._color
+
+ @color.setter
+ def color(self, value):
+ self._color = format_color_vector(value, 3)
+
+ @property
+ def intensity(self):
+ """float : The light's intensity in candela or lux.
+ """
+ return self._intensity
+
+ @intensity.setter
+ def intensity(self, value):
+ self._intensity = float(value)
+
+ @property
+ def shadow_texture(self):
+ """:class:`.Texture` : A texture used to hold shadow maps for this light.
+ """
+ return self._shadow_texture
+
+ @shadow_texture.setter
+ def shadow_texture(self, value):
+ if self._shadow_texture is not None:
+ if self._shadow_texture._in_context():
+ self._shadow_texture.delete()
+ self._shadow_texture = value
+
+ @abc.abstractmethod
+ def _generate_shadow_texture(self, size=None):
+ """Generate a shadow texture for this light.
+
+ Parameters
+ ----------
+ size : int, optional
+ Size of texture map. Must be a positive power of two.
+ """
+ pass
+
+ @abc.abstractmethod
+ def _get_shadow_camera(self, scene_scale):
+ """Generate and return a shadow mapping camera for this light.
+
+ Parameters
+ ----------
+ scene_scale : float
+ Length of scene's bounding box diagonal.
+
+ Returns
+ -------
+ camera : :class:`.Camera`
+ The camera used to render shadowmaps for this light.
+ """
+ pass
+
+
+class DirectionalLight(Light):
+ """Directional lights are light sources that act as though they are
+ infinitely far away and emit light in the direction of the local -z axis.
+ This light type inherits the orientation of the node that it belongs to;
+ position and scale are ignored except for their effect on the inherited
+ node orientation. Because it is at an infinite distance, the light is
+ not attenuated. Its intensity is defined in lumens per metre squared,
+ or lux (lm/m2).
+
+ Parameters
+ ----------
+ color : (3,) float, optional
+ RGB value for the light's color in linear space. Defaults to white
+ (i.e. [1.0, 1.0, 1.0]).
+ intensity : float, optional
+ Brightness of light, in lux (lm/m^2). Defaults to 1.0
+ name : str, optional
+ Name of the light.
+ """
+
+ def __init__(self,
+ color=None,
+ intensity=None,
+ name=None):
+ super(DirectionalLight, self).__init__(
+ color=color,
+ intensity=intensity,
+ name=name,
+ )
+
+ def _generate_shadow_texture(self, size=None):
+ """Generate a shadow texture for this light.
+
+ Parameters
+ ----------
+ size : int, optional
+ Size of texture map. Must be a positive power of two.
+ """
+ if size is None:
+ size = SHADOW_TEX_SZ
+ self.shadow_texture = Texture(width=size, height=size,
+ source_channels='D', data_format=GL_FLOAT)
+
+ def _get_shadow_camera(self, scene_scale):
+ """Generate and return a shadow mapping camera for this light.
+
+ Parameters
+ ----------
+ scene_scale : float
+ Length of scene's bounding box diagonal.
+
+ Returns
+ -------
+ camera : :class:`.Camera`
+ The camera used to render shadowmaps for this light.
+ """
+ return OrthographicCamera(
+ znear=0.01 * scene_scale,
+ zfar=10 * scene_scale,
+ xmag=scene_scale,
+ ymag=scene_scale
+ )
+
+
+class PointLight(Light):
+ """Point lights emit light in all directions from their position in space;
+ rotation and scale are ignored except for their effect on the inherited
+ node position. The brightness of the light attenuates in a physically
+ correct manner as distance increases from the light's position (i.e.
+ brightness goes like the inverse square of the distance). Point light
+ intensity is defined in candela, which is lumens per square radian (lm/sr).
+
+ Parameters
+ ----------
+ color : (3,) float
+ RGB value for the light's color in linear space.
+ intensity : float
+ Brightness of light in candela (lm/sr).
+ range : float
+ Cutoff distance at which light's intensity may be considered to
+ have reached zero. If None, the range is assumed to be infinite.
+ name : str, optional
+ Name of the light.
+ """
+
+ def __init__(self,
+ color=None,
+ intensity=None,
+ range=None,
+ name=None):
+ super(PointLight, self).__init__(
+ color=color,
+ intensity=intensity,
+ name=name,
+ )
+ self.range = range
+
+ @property
+ def range(self):
+ """float : The cutoff distance for the light.
+ """
+ return self._range
+
+ @range.setter
+ def range(self, value):
+ if value is not None:
+ value = float(value)
+ if value <= 0:
+ raise ValueError('Range must be > 0')
+ self._range = value
+ self._range = value
+
+ def _generate_shadow_texture(self, size=None):
+ """Generate a shadow texture for this light.
+
+ Parameters
+ ----------
+ size : int, optional
+ Size of texture map. Must be a positive power of two.
+ """
+ raise NotImplementedError('Shadows not implemented for point lights')
+
+ def _get_shadow_camera(self, scene_scale):
+ """Generate and return a shadow mapping camera for this light.
+
+ Parameters
+ ----------
+ scene_scale : float
+ Length of scene's bounding box diagonal.
+
+ Returns
+ -------
+ camera : :class:`.Camera`
+ The camera used to render shadowmaps for this light.
+ """
+ raise NotImplementedError('Shadows not implemented for point lights')
+
+
+class SpotLight(Light):
+ """Spot lights emit light in a cone in the direction of the local -z axis.
+ The angle and falloff of the cone is defined using two numbers, the
+ ``innerConeAngle`` and ``outerConeAngle``.
+ As with point lights, the brightness
+ also attenuates in a physically correct manner as distance increases from
+ the light's position (i.e. brightness goes like the inverse square of the
+ distance). Spot light intensity refers to the brightness inside the
+ ``innerConeAngle`` (and at the location of the light) and is defined in
+ candela, which is lumens per square radian (lm/sr). A spot light's position
+ and orientation are inherited from its node transform. Inherited scale does
+ not affect cone shape, and is ignored except for its effect on position
+ and orientation.
+
+ Parameters
+ ----------
+ color : (3,) float
+ RGB value for the light's color in linear space.
+ intensity : float
+ Brightness of light in candela (lm/sr).
+ range : float
+ Cutoff distance at which light's intensity may be considered to
+ have reached zero. If None, the range is assumed to be infinite.
+ innerConeAngle : float
+ Angle, in radians, from centre of spotlight where falloff begins.
+ Must be greater than or equal to ``0`` and less
+ than ``outerConeAngle``. Defaults to ``0``.
+ outerConeAngle : float
+ Angle, in radians, from centre of spotlight where falloff ends.
+ Must be greater than ``innerConeAngle`` and less than or equal to
+ ``PI / 2.0``. Defaults to ``PI / 4.0``.
+ name : str, optional
+ Name of the light.
+ """
+
+ def __init__(self,
+ color=None,
+ intensity=None,
+ range=None,
+ innerConeAngle=0.0,
+ outerConeAngle=(np.pi / 4.0),
+ name=None):
+ super(SpotLight, self).__init__(
+ name=name,
+ color=color,
+ intensity=intensity,
+ )
+ self.outerConeAngle = outerConeAngle
+ self.innerConeAngle = innerConeAngle
+ self.range = range
+
+ @property
+ def innerConeAngle(self):
+ """float : The inner cone angle in radians.
+ """
+ return self._innerConeAngle
+
+ @innerConeAngle.setter
+ def innerConeAngle(self, value):
+ if value < 0.0 or value > self.outerConeAngle:
+ raise ValueError('Invalid value for inner cone angle')
+ self._innerConeAngle = float(value)
+
+ @property
+ def outerConeAngle(self):
+ """float : The outer cone angle in radians.
+ """
+ return self._outerConeAngle
+
+ @outerConeAngle.setter
+ def outerConeAngle(self, value):
+ if value < 0.0 or value > np.pi / 2.0 + 1e-9:
+ raise ValueError('Invalid value for outer cone angle')
+ self._outerConeAngle = float(value)
+
+ @property
+ def range(self):
+ """float : The cutoff distance for the light.
+ """
+ return self._range
+
+ @range.setter
+ def range(self, value):
+ if value is not None:
+ value = float(value)
+ if value <= 0:
+ raise ValueError('Range must be > 0')
+ self._range = value
+ self._range = value
+
+ def _generate_shadow_texture(self, size=None):
+ """Generate a shadow texture for this light.
+
+ Parameters
+ ----------
+ size : int, optional
+ Size of texture map. Must be a positive power of two.
+ """
+ if size is None:
+ size = SHADOW_TEX_SZ
+ self.shadow_texture = Texture(width=size, height=size,
+ source_channels='D', data_format=GL_FLOAT)
+
+ def _get_shadow_camera(self, scene_scale):
+ """Generate and return a shadow mapping camera for this light.
+
+ Parameters
+ ----------
+ scene_scale : float
+ Length of scene's bounding box diagonal.
+
+ Returns
+ -------
+ camera : :class:`.Camera`
+ The camera used to render shadowmaps for this light.
+ """
+ return PerspectiveCamera(
+ znear=0.01 * scene_scale,
+ zfar=10 * scene_scale,
+ yfov=np.clip(2 * self.outerConeAngle + np.pi / 16.0, 0.0, np.pi),
+ aspectRatio=1.0
+ )
+
+
+__all__ = ['Light', 'DirectionalLight', 'SpotLight', 'PointLight']
diff --git a/generate_human_motion/pyrender/pyrender/material.py b/generate_human_motion/pyrender/pyrender/material.py
new file mode 100644
index 0000000000000000000000000000000000000000..3ce9c2d184ed213c84b015e36bea558cd1efc6b7
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/material.py
@@ -0,0 +1,707 @@
+"""Material properties, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-material
+and
+https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness
+
+Author: Matthew Matl
+"""
+import abc
+import numpy as np
+import six
+
+from .constants import TexFlags
+from .utils import format_color_vector, format_texture_source
+from .texture import Texture
+
+
+@six.add_metaclass(abc.ABCMeta)
+class Material(object):
+ """Base for standard glTF 2.0 materials.
+
+ Parameters
+ ----------
+ name : str, optional
+ The user-defined name of this object.
+ normalTexture : (n,n,3) float or :class:`Texture`, optional
+ A tangent space normal map. The texture contains RGB components in
+ linear space. Each texel represents the XYZ components of a normal
+ vector in tangent space. Red [0 to 255] maps to X [-1 to 1]. Green
+ [0 to 255] maps to Y [-1 to 1]. Blue [128 to 255] maps to Z
+ [1/255 to 1]. The normal vectors use OpenGL conventions where +X is
+ right and +Y is up. +Z points toward the viewer.
+ occlusionTexture : (n,n,1) float or :class:`Texture`, optional
+ The occlusion map texture. The occlusion values are sampled from the R
+ channel. Higher values indicate areas that should receive full indirect
+ lighting and lower values indicate no indirect lighting. These values
+ are linear. If other channels are present (GBA), they are ignored for
+ occlusion calculations.
+ emissiveTexture : (n,n,3) float or :class:`Texture`, optional
+ The emissive map controls the color and intensity of the light being
+ emitted by the material. This texture contains RGB components in sRGB
+ color space. If a fourth component (A) is present, it is ignored.
+ emissiveFactor : (3,) float, optional
+ The RGB components of the emissive color of the material. These values
+ are linear. If an emissiveTexture is specified, this value is
+ multiplied with the texel values.
+ alphaMode : str, optional
+ The material's alpha rendering mode enumeration specifying the
+ interpretation of the alpha value of the main factor and texture.
+ Allowed Values:
+
+ - `"OPAQUE"` The alpha value is ignored and the rendered output is
+ fully opaque.
+ - `"MASK"` The rendered output is either fully opaque or fully
+ transparent depending on the alpha value and the specified alpha
+ cutoff value.
+ - `"BLEND"` The alpha value is used to composite the source and
+ destination areas. The rendered output is combined with the
+ background using the normal painting operation (i.e. the Porter
+ and Duff over operator).
+
+ alphaCutoff : float, optional
+ Specifies the cutoff threshold when in MASK mode. If the alpha value is
+ greater than or equal to this value then it is rendered as fully
+ opaque, otherwise, it is rendered as fully transparent.
+ A value greater than 1.0 will render the entire material as fully
+ transparent. This value is ignored for other modes.
+ doubleSided : bool, optional
+ Specifies whether the material is double sided. When this value is
+ false, back-face culling is enabled. When this value is true,
+ back-face culling is disabled and double sided lighting is enabled.
+ smooth : bool, optional
+ If True, the material is rendered smoothly by using only one normal
+ per vertex and face indexing.
+ wireframe : bool, optional
+ If True, the material is rendered in wireframe mode.
+ """
+
+ def __init__(self,
+ name=None,
+ normalTexture=None,
+ occlusionTexture=None,
+ emissiveTexture=None,
+ emissiveFactor=None,
+ alphaMode=None,
+ alphaCutoff=None,
+ doubleSided=False,
+ smooth=True,
+ wireframe=False):
+
+ # Set defaults
+ if alphaMode is None:
+ alphaMode = 'OPAQUE'
+
+ if alphaCutoff is None:
+ alphaCutoff = 0.5
+
+ if emissiveFactor is None:
+ emissiveFactor = np.zeros(3).astype(np.float32)
+
+ self.name = name
+ self.normalTexture = normalTexture
+ self.occlusionTexture = occlusionTexture
+ self.emissiveTexture = emissiveTexture
+ self.emissiveFactor = emissiveFactor
+ self.alphaMode = alphaMode
+ self.alphaCutoff = alphaCutoff
+ self.doubleSided = doubleSided
+ self.smooth = smooth
+ self.wireframe = wireframe
+
+ self._tex_flags = None
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def normalTexture(self):
+ """(n,n,3) float or :class:`Texture` : The tangent-space normal map.
+ """
+ return self._normalTexture
+
+ @normalTexture.setter
+ def normalTexture(self, value):
+ # TODO TMP
+ self._normalTexture = self._format_texture(value, 'RGB')
+ self._tex_flags = None
+
+ @property
+ def occlusionTexture(self):
+ """(n,n,1) float or :class:`Texture` : The ambient occlusion map.
+ """
+ return self._occlusionTexture
+
+ @occlusionTexture.setter
+ def occlusionTexture(self, value):
+ self._occlusionTexture = self._format_texture(value, 'R')
+ self._tex_flags = None
+
+ @property
+ def emissiveTexture(self):
+ """(n,n,3) float or :class:`Texture` : The emission map.
+ """
+ return self._emissiveTexture
+
+ @emissiveTexture.setter
+ def emissiveTexture(self, value):
+ self._emissiveTexture = self._format_texture(value, 'RGB')
+ self._tex_flags = None
+
+ @property
+ def emissiveFactor(self):
+ """(3,) float : Base multiplier for emission colors.
+ """
+ return self._emissiveFactor
+
+ @emissiveFactor.setter
+ def emissiveFactor(self, value):
+ if value is None:
+ value = np.zeros(3)
+ self._emissiveFactor = format_color_vector(value, 3)
+
+ @property
+ def alphaMode(self):
+ """str : The mode for blending.
+ """
+ return self._alphaMode
+
+ @alphaMode.setter
+ def alphaMode(self, value):
+ if value not in set(['OPAQUE', 'MASK', 'BLEND']):
+ raise ValueError('Invalid alpha mode {}'.format(value))
+ self._alphaMode = value
+
+ @property
+ def alphaCutoff(self):
+ """float : The cutoff threshold in MASK mode.
+ """
+ return self._alphaCutoff
+
+ @alphaCutoff.setter
+ def alphaCutoff(self, value):
+ if value < 0 or value > 1:
+ raise ValueError('Alpha cutoff must be in range [0,1]')
+ self._alphaCutoff = float(value)
+
+ @property
+ def doubleSided(self):
+ """bool : Whether the material is double-sided.
+ """
+ return self._doubleSided
+
+ @doubleSided.setter
+ def doubleSided(self, value):
+ if not isinstance(value, bool):
+ raise TypeError('Double sided must be a boolean value')
+ self._doubleSided = value
+
+ @property
+ def smooth(self):
+ """bool : Whether to render the mesh smoothly by
+ interpolating vertex normals.
+ """
+ return self._smooth
+
+ @smooth.setter
+ def smooth(self, value):
+ if not isinstance(value, bool):
+ raise TypeError('Double sided must be a boolean value')
+ self._smooth = value
+
+ @property
+ def wireframe(self):
+ """bool : Whether to render the mesh in wireframe mode.
+ """
+ return self._wireframe
+
+ @wireframe.setter
+ def wireframe(self, value):
+ if not isinstance(value, bool):
+ raise TypeError('Wireframe must be a boolean value')
+ self._wireframe = value
+
+ @property
+ def is_transparent(self):
+ """bool : If True, the object is partially transparent.
+ """
+ return self._compute_transparency()
+
+ @property
+ def tex_flags(self):
+ """int : Texture availability flags.
+ """
+ if self._tex_flags is None:
+ self._tex_flags = self._compute_tex_flags()
+ return self._tex_flags
+
+ @property
+ def textures(self):
+ """list of :class:`Texture` : The textures associated with this
+ material.
+ """
+ return self._compute_textures()
+
+ def _compute_transparency(self):
+ return False
+
+ def _compute_tex_flags(self):
+ tex_flags = TexFlags.NONE
+ if self.normalTexture is not None:
+ tex_flags |= TexFlags.NORMAL
+ if self.occlusionTexture is not None:
+ tex_flags |= TexFlags.OCCLUSION
+ if self.emissiveTexture is not None:
+ tex_flags |= TexFlags.EMISSIVE
+ return tex_flags
+
+ def _compute_textures(self):
+ all_textures = [
+ self.normalTexture, self.occlusionTexture, self.emissiveTexture
+ ]
+ textures = set([t for t in all_textures if t is not None])
+ return textures
+
+ def _format_texture(self, texture, target_channels='RGB'):
+ """Format a texture as a float32 np array.
+ """
+ if isinstance(texture, Texture) or texture is None:
+ return texture
+ else:
+ source = format_texture_source(texture, target_channels)
+ return Texture(source=source, source_channels=target_channels)
+
+
+class MetallicRoughnessMaterial(Material):
+ """A material based on the metallic-roughness material model from
+ Physically-Based Rendering (PBR) methodology.
+
+ Parameters
+ ----------
+ name : str, optional
+ The user-defined name of this object.
+ normalTexture : (n,n,3) float or :class:`Texture`, optional
+ A tangent space normal map. The texture contains RGB components in
+ linear space. Each texel represents the XYZ components of a normal
+ vector in tangent space. Red [0 to 255] maps to X [-1 to 1]. Green
+ [0 to 255] maps to Y [-1 to 1]. Blue [128 to 255] maps to Z
+ [1/255 to 1]. The normal vectors use OpenGL conventions where +X is
+ right and +Y is up. +Z points toward the viewer.
+ occlusionTexture : (n,n,1) float or :class:`Texture`, optional
+ The occlusion map texture. The occlusion values are sampled from the R
+ channel. Higher values indicate areas that should receive full indirect
+ lighting and lower values indicate no indirect lighting. These values
+ are linear. If other channels are present (GBA), they are ignored for
+ occlusion calculations.
+ emissiveTexture : (n,n,3) float or :class:`Texture`, optional
+ The emissive map controls the color and intensity of the light being
+ emitted by the material. This texture contains RGB components in sRGB
+ color space. If a fourth component (A) is present, it is ignored.
+ emissiveFactor : (3,) float, optional
+ The RGB components of the emissive color of the material. These values
+ are linear. If an emissiveTexture is specified, this value is
+ multiplied with the texel values.
+ alphaMode : str, optional
+ The material's alpha rendering mode enumeration specifying the
+ interpretation of the alpha value of the main factor and texture.
+ Allowed Values:
+
+ - `"OPAQUE"` The alpha value is ignored and the rendered output is
+ fully opaque.
+ - `"MASK"` The rendered output is either fully opaque or fully
+ transparent depending on the alpha value and the specified alpha
+ cutoff value.
+ - `"BLEND"` The alpha value is used to composite the source and
+ destination areas. The rendered output is combined with the
+ background using the normal painting operation (i.e. the Porter
+ and Duff over operator).
+
+ alphaCutoff : float, optional
+ Specifies the cutoff threshold when in MASK mode. If the alpha value is
+ greater than or equal to this value then it is rendered as fully
+ opaque, otherwise, it is rendered as fully transparent.
+ A value greater than 1.0 will render the entire material as fully
+ transparent. This value is ignored for other modes.
+ doubleSided : bool, optional
+ Specifies whether the material is double sided. When this value is
+ false, back-face culling is enabled. When this value is true,
+ back-face culling is disabled and double sided lighting is enabled.
+ smooth : bool, optional
+ If True, the material is rendered smoothly by using only one normal
+ per vertex and face indexing.
+ wireframe : bool, optional
+ If True, the material is rendered in wireframe mode.
+ baseColorFactor : (4,) float, optional
+ The RGBA components of the base color of the material. The fourth
+ component (A) is the alpha coverage of the material. The alphaMode
+ property specifies how alpha is interpreted. These values are linear.
+ If a baseColorTexture is specified, this value is multiplied with the
+ texel values.
+ baseColorTexture : (n,n,4) float or :class:`Texture`, optional
+ The base color texture. This texture contains RGB(A) components in sRGB
+ color space. The first three components (RGB) specify the base color of
+ the material. If the fourth component (A) is present, it represents the
+ alpha coverage of the material. Otherwise, an alpha of 1.0 is assumed.
+ The alphaMode property specifies how alpha is interpreted.
+ The stored texels must not be premultiplied.
+ metallicFactor : float
+ The metalness of the material. A value of 1.0 means the material is a
+ metal. A value of 0.0 means the material is a dielectric. Values in
+ between are for blending between metals and dielectrics such as dirty
+ metallic surfaces. This value is linear. If a metallicRoughnessTexture
+ is specified, this value is multiplied with the metallic texel values.
+ roughnessFactor : float
+ The roughness of the material. A value of 1.0 means the material is
+ completely rough. A value of 0.0 means the material is completely
+ smooth. This value is linear. If a metallicRoughnessTexture is
+ specified, this value is multiplied with the roughness texel values.
+ metallicRoughnessTexture : (n,n,2) float or :class:`Texture`, optional
+ The metallic-roughness texture. The metalness values are sampled from
+ the B channel. The roughness values are sampled from the G channel.
+ These values are linear. If other channels are present (R or A), they
+ are ignored for metallic-roughness calculations.
+ """
+
+ def __init__(self,
+ name=None,
+ normalTexture=None,
+ occlusionTexture=None,
+ emissiveTexture=None,
+ emissiveFactor=None,
+ alphaMode=None,
+ alphaCutoff=None,
+ doubleSided=False,
+ smooth=True,
+ wireframe=False,
+ baseColorFactor=None,
+ baseColorTexture=None,
+ metallicFactor=1.0,
+ roughnessFactor=1.0,
+ metallicRoughnessTexture=None):
+ super(MetallicRoughnessMaterial, self).__init__(
+ name=name,
+ normalTexture=normalTexture,
+ occlusionTexture=occlusionTexture,
+ emissiveTexture=emissiveTexture,
+ emissiveFactor=emissiveFactor,
+ alphaMode=alphaMode,
+ alphaCutoff=alphaCutoff,
+ doubleSided=doubleSided,
+ smooth=smooth,
+ wireframe=wireframe
+ )
+
+ # Set defaults
+ if baseColorFactor is None:
+ baseColorFactor = np.ones(4).astype(np.float32)
+
+ self.baseColorFactor = baseColorFactor
+ self.baseColorTexture = baseColorTexture
+ self.metallicFactor = metallicFactor
+ self.roughnessFactor = roughnessFactor
+ self.metallicRoughnessTexture = metallicRoughnessTexture
+
+ @property
+ def baseColorFactor(self):
+ """(4,) float or :class:`Texture` : The RGBA base color multiplier.
+ """
+ return self._baseColorFactor
+
+ @baseColorFactor.setter
+ def baseColorFactor(self, value):
+ if value is None:
+ value = np.ones(4)
+ self._baseColorFactor = format_color_vector(value, 4)
+
+ @property
+ def baseColorTexture(self):
+ """(n,n,4) float or :class:`Texture` : The diffuse texture.
+ """
+ return self._baseColorTexture
+
+ @baseColorTexture.setter
+ def baseColorTexture(self, value):
+ self._baseColorTexture = self._format_texture(value, 'RGBA')
+ self._tex_flags = None
+
+ @property
+ def metallicFactor(self):
+ """float : The metalness of the material.
+ """
+ return self._metallicFactor
+
+ @metallicFactor.setter
+ def metallicFactor(self, value):
+ if value is None:
+ value = 1.0
+ if value < 0 or value > 1:
+ raise ValueError('Metallic factor must be in range [0,1]')
+ self._metallicFactor = float(value)
+
+ @property
+ def roughnessFactor(self):
+ """float : The roughness of the material.
+ """
+ return self.RoughnessFactor
+
+ @roughnessFactor.setter
+ def roughnessFactor(self, value):
+ if value is None:
+ value = 1.0
+ if value < 0 or value > 1:
+ raise ValueError('Roughness factor must be in range [0,1]')
+ self.RoughnessFactor = float(value)
+
+ @property
+ def metallicRoughnessTexture(self):
+ """(n,n,2) float or :class:`Texture` : The metallic-roughness texture.
+ """
+ return self._metallicRoughnessTexture
+
+ @metallicRoughnessTexture.setter
+ def metallicRoughnessTexture(self, value):
+ self._metallicRoughnessTexture = self._format_texture(value, 'GB')
+ self._tex_flags = None
+
+ def _compute_tex_flags(self):
+ tex_flags = super(MetallicRoughnessMaterial, self)._compute_tex_flags()
+ if self.baseColorTexture is not None:
+ tex_flags |= TexFlags.BASE_COLOR
+ if self.metallicRoughnessTexture is not None:
+ tex_flags |= TexFlags.METALLIC_ROUGHNESS
+ return tex_flags
+
+ def _compute_transparency(self):
+ if self.alphaMode == 'OPAQUE':
+ return False
+ cutoff = self.alphaCutoff
+ if self.alphaMode == 'BLEND':
+ cutoff = 1.0
+ if self.baseColorFactor[3] < cutoff:
+ return True
+ if (self.baseColorTexture is not None and
+ self.baseColorTexture.is_transparent(cutoff)):
+ return True
+ return False
+
+ def _compute_textures(self):
+ textures = super(MetallicRoughnessMaterial, self)._compute_textures()
+ all_textures = [self.baseColorTexture, self.metallicRoughnessTexture]
+ all_textures = {t for t in all_textures if t is not None}
+ textures |= all_textures
+ return textures
+
+
+class SpecularGlossinessMaterial(Material):
+ """A material based on the specular-glossiness material model from
+ Physically-Based Rendering (PBR) methodology.
+
+ Parameters
+ ----------
+ name : str, optional
+ The user-defined name of this object.
+ normalTexture : (n,n,3) float or :class:`Texture`, optional
+ A tangent space normal map. The texture contains RGB components in
+ linear space. Each texel represents the XYZ components of a normal
+ vector in tangent space. Red [0 to 255] maps to X [-1 to 1]. Green
+ [0 to 255] maps to Y [-1 to 1]. Blue [128 to 255] maps to Z
+ [1/255 to 1]. The normal vectors use OpenGL conventions where +X is
+ right and +Y is up. +Z points toward the viewer.
+ occlusionTexture : (n,n,1) float or :class:`Texture`, optional
+ The occlusion map texture. The occlusion values are sampled from the R
+ channel. Higher values indicate areas that should receive full indirect
+ lighting and lower values indicate no indirect lighting. These values
+ are linear. If other channels are present (GBA), they are ignored for
+ occlusion calculations.
+ emissiveTexture : (n,n,3) float or :class:`Texture`, optional
+ The emissive map controls the color and intensity of the light being
+ emitted by the material. This texture contains RGB components in sRGB
+ color space. If a fourth component (A) is present, it is ignored.
+ emissiveFactor : (3,) float, optional
+ The RGB components of the emissive color of the material. These values
+ are linear. If an emissiveTexture is specified, this value is
+ multiplied with the texel values.
+ alphaMode : str, optional
+ The material's alpha rendering mode enumeration specifying the
+ interpretation of the alpha value of the main factor and texture.
+ Allowed Values:
+
+ - `"OPAQUE"` The alpha value is ignored and the rendered output is
+ fully opaque.
+ - `"MASK"` The rendered output is either fully opaque or fully
+ transparent depending on the alpha value and the specified alpha
+ cutoff value.
+ - `"BLEND"` The alpha value is used to composite the source and
+ destination areas. The rendered output is combined with the
+ background using the normal painting operation (i.e. the Porter
+ and Duff over operator).
+
+ alphaCutoff : float, optional
+ Specifies the cutoff threshold when in MASK mode. If the alpha value is
+ greater than or equal to this value then it is rendered as fully
+ opaque, otherwise, it is rendered as fully transparent.
+ A value greater than 1.0 will render the entire material as fully
+ transparent. This value is ignored for other modes.
+ doubleSided : bool, optional
+ Specifies whether the material is double sided. When this value is
+ false, back-face culling is enabled. When this value is true,
+ back-face culling is disabled and double sided lighting is enabled.
+ smooth : bool, optional
+ If True, the material is rendered smoothly by using only one normal
+ per vertex and face indexing.
+ wireframe : bool, optional
+ If True, the material is rendered in wireframe mode.
+ diffuseFactor : (4,) float
+ The RGBA components of the reflected diffuse color of the material.
+ Metals have a diffuse value of [0.0, 0.0, 0.0]. The fourth component
+ (A) is the opacity of the material. The values are linear.
+ diffuseTexture : (n,n,4) float or :class:`Texture`, optional
+ The diffuse texture. This texture contains RGB(A) components of the
+ reflected diffuse color of the material in sRGB color space. If the
+ fourth component (A) is present, it represents the alpha coverage of
+ the material. Otherwise, an alpha of 1.0 is assumed.
+ The alphaMode property specifies how alpha is interpreted.
+ The stored texels must not be premultiplied.
+ specularFactor : (3,) float
+ The specular RGB color of the material. This value is linear.
+ glossinessFactor : float
+ The glossiness or smoothness of the material. A value of 1.0 means the
+ material has full glossiness or is perfectly smooth. A value of 0.0
+ means the material has no glossiness or is perfectly rough. This value
+ is linear.
+ specularGlossinessTexture : (n,n,4) or :class:`Texture`, optional
+ The specular-glossiness texture is a RGBA texture, containing the
+ specular color (RGB) in sRGB space and the glossiness value (A) in
+ linear space.
+ """
+
+ def __init__(self,
+ name=None,
+ normalTexture=None,
+ occlusionTexture=None,
+ emissiveTexture=None,
+ emissiveFactor=None,
+ alphaMode=None,
+ alphaCutoff=None,
+ doubleSided=False,
+ smooth=True,
+ wireframe=False,
+ diffuseFactor=None,
+ diffuseTexture=None,
+ specularFactor=None,
+ glossinessFactor=1.0,
+ specularGlossinessTexture=None):
+ super(SpecularGlossinessMaterial, self).__init__(
+ name=name,
+ normalTexture=normalTexture,
+ occlusionTexture=occlusionTexture,
+ emissiveTexture=emissiveTexture,
+ emissiveFactor=emissiveFactor,
+ alphaMode=alphaMode,
+ alphaCutoff=alphaCutoff,
+ doubleSided=doubleSided,
+ smooth=smooth,
+ wireframe=wireframe
+ )
+
+ # Set defaults
+ if diffuseFactor is None:
+ diffuseFactor = np.ones(4).astype(np.float32)
+ if specularFactor is None:
+ specularFactor = np.ones(3).astype(np.float32)
+
+ self.diffuseFactor = diffuseFactor
+ self.diffuseTexture = diffuseTexture
+ self.specularFactor = specularFactor
+ self.glossinessFactor = glossinessFactor
+ self.specularGlossinessTexture = specularGlossinessTexture
+
+ @property
+ def diffuseFactor(self):
+ """(4,) float : The diffuse base color.
+ """
+ return self._diffuseFactor
+
+ @diffuseFactor.setter
+ def diffuseFactor(self, value):
+ self._diffuseFactor = format_color_vector(value, 4)
+
+ @property
+ def diffuseTexture(self):
+ """(n,n,4) float or :class:`Texture` : The diffuse map.
+ """
+ return self._diffuseTexture
+
+ @diffuseTexture.setter
+ def diffuseTexture(self, value):
+ self._diffuseTexture = self._format_texture(value, 'RGBA')
+ self._tex_flags = None
+
+ @property
+ def specularFactor(self):
+ """(3,) float : The specular color of the material.
+ """
+ return self._specularFactor
+
+ @specularFactor.setter
+ def specularFactor(self, value):
+ self._specularFactor = format_color_vector(value, 3)
+
+ @property
+ def glossinessFactor(self):
+ """float : The glossiness of the material.
+ """
+ return self.glossinessFactor
+
+ @glossinessFactor.setter
+ def glossinessFactor(self, value):
+ if value < 0 or value > 1:
+ raise ValueError('glossiness factor must be in range [0,1]')
+ self._glossinessFactor = float(value)
+
+ @property
+ def specularGlossinessTexture(self):
+ """(n,n,4) or :class:`Texture` : The specular-glossiness texture.
+ """
+ return self._specularGlossinessTexture
+
+ @specularGlossinessTexture.setter
+ def specularGlossinessTexture(self, value):
+ self._specularGlossinessTexture = self._format_texture(value, 'GB')
+ self._tex_flags = None
+
+ def _compute_tex_flags(self):
+ flags = super(SpecularGlossinessMaterial, self)._compute_tex_flags()
+ if self.diffuseTexture is not None:
+ flags |= TexFlags.DIFFUSE
+ if self.specularGlossinessTexture is not None:
+ flags |= TexFlags.SPECULAR_GLOSSINESS
+ return flags
+
+ def _compute_transparency(self):
+ if self.alphaMode == 'OPAQUE':
+ return False
+ cutoff = self.alphaCutoff
+ if self.alphaMode == 'BLEND':
+ cutoff = 1.0
+ if self.diffuseFactor[3] < cutoff:
+ return True
+ if (self.diffuseTexture is not None and
+ self.diffuseTexture.is_transparent(cutoff)):
+ return True
+ return False
+
+ def _compute_textures(self):
+ textures = super(SpecularGlossinessMaterial, self)._compute_textures()
+ all_textures = [self.diffuseTexture, self.specularGlossinessTexture]
+ all_textures = {t for t in all_textures if t is not None}
+ textures |= all_textures
+ return textures
diff --git a/generate_human_motion/pyrender/pyrender/mesh.py b/generate_human_motion/pyrender/pyrender/mesh.py
new file mode 100644
index 0000000000000000000000000000000000000000..36833ea3dfa6c095a18fc745ff34cf106e83c95d
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/mesh.py
@@ -0,0 +1,328 @@
+"""Meshes, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-mesh
+
+Author: Matthew Matl
+"""
+import copy
+
+import numpy as np
+import trimesh
+
+from .primitive import Primitive
+from .constants import GLTF
+from .material import MetallicRoughnessMaterial
+
+
+class Mesh(object):
+ """A set of primitives to be rendered.
+
+ Parameters
+ ----------
+ name : str
+ The user-defined name of this object.
+ primitives : list of :class:`Primitive`
+ The primitives associated with this mesh.
+ weights : (k,) float
+ Array of weights to be applied to the Morph Targets.
+ is_visible : bool
+ If False, the mesh will not be rendered.
+ """
+
+ def __init__(self, primitives, name=None, weights=None, is_visible=True):
+ self.primitives = primitives
+ self.name = name
+ self.weights = weights
+ self.is_visible = is_visible
+
+ self._bounds = None
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def primitives(self):
+ """list of :class:`Primitive` : The primitives associated
+ with this mesh.
+ """
+ return self._primitives
+
+ @primitives.setter
+ def primitives(self, value):
+ self._primitives = value
+
+ @property
+ def weights(self):
+ """(k,) float : Weights to be applied to morph targets.
+ """
+ return self._weights
+
+ @weights.setter
+ def weights(self, value):
+ self._weights = value
+
+ @property
+ def is_visible(self):
+ """bool : Whether the mesh is visible.
+ """
+ return self._is_visible
+
+ @is_visible.setter
+ def is_visible(self, value):
+ self._is_visible = value
+
+ @property
+ def bounds(self):
+ """(2,3) float : The axis-aligned bounds of the mesh.
+ """
+ if self._bounds is None:
+ bounds = np.array([[np.infty, np.infty, np.infty],
+ [-np.infty, -np.infty, -np.infty]])
+ for p in self.primitives:
+ bounds[0] = np.minimum(bounds[0], p.bounds[0])
+ bounds[1] = np.maximum(bounds[1], p.bounds[1])
+ self._bounds = bounds
+ return self._bounds
+
+ @property
+ def centroid(self):
+ """(3,) float : The centroid of the mesh's axis-aligned bounding box
+ (AABB).
+ """
+ return np.mean(self.bounds, axis=0)
+
+ @property
+ def extents(self):
+ """(3,) float : The lengths of the axes of the mesh's AABB.
+ """
+ return np.diff(self.bounds, axis=0).reshape(-1)
+
+ @property
+ def scale(self):
+ """(3,) float : The length of the diagonal of the mesh's AABB.
+ """
+ return np.linalg.norm(self.extents)
+
+ @property
+ def is_transparent(self):
+ """bool : If True, the mesh is partially-transparent.
+ """
+ for p in self.primitives:
+ if p.is_transparent:
+ return True
+ return False
+
+ @staticmethod
+ def from_points(points, colors=None, normals=None,
+ is_visible=True, poses=None):
+ """Create a Mesh from a set of points.
+
+ Parameters
+ ----------
+ points : (n,3) float
+ The point positions.
+ colors : (n,3) or (n,4) float, optional
+ RGB or RGBA colors for each point.
+ normals : (n,3) float, optionals
+ The normal vectors for each point.
+ is_visible : bool
+ If False, the points will not be rendered.
+ poses : (x,4,4)
+ Array of 4x4 transformation matrices for instancing this object.
+
+ Returns
+ -------
+ mesh : :class:`Mesh`
+ The created mesh.
+ """
+ primitive = Primitive(
+ positions=points,
+ normals=normals,
+ color_0=colors,
+ mode=GLTF.POINTS,
+ poses=poses
+ )
+ mesh = Mesh(primitives=[primitive], is_visible=is_visible)
+ return mesh
+
+ @staticmethod
+ def from_trimesh(mesh, material=None, is_visible=True,
+ poses=None, wireframe=False, smooth=True):
+ """Create a Mesh from a :class:`~trimesh.base.Trimesh`.
+
+ Parameters
+ ----------
+ mesh : :class:`~trimesh.base.Trimesh` or list of them
+ A triangular mesh or a list of meshes.
+ material : :class:`Material`
+ The material of the object. Overrides any mesh material.
+ If not specified and the mesh has no material, a default material
+ will be used.
+ is_visible : bool
+ If False, the mesh will not be rendered.
+ poses : (n,4,4) float
+ Array of 4x4 transformation matrices for instancing this object.
+ wireframe : bool
+ If `True`, the mesh will be rendered as a wireframe object
+ smooth : bool
+ If `True`, the mesh will be rendered with interpolated vertex
+ normals. Otherwise, the mesh edges will stay sharp.
+
+ Returns
+ -------
+ mesh : :class:`Mesh`
+ The created mesh.
+ """
+
+ if isinstance(mesh, (list, tuple, set, np.ndarray)):
+ meshes = list(mesh)
+ elif isinstance(mesh, trimesh.Trimesh):
+ meshes = [mesh]
+ else:
+ raise TypeError('Expected a Trimesh or a list, got a {}'
+ .format(type(mesh)))
+
+ primitives = []
+ for m in meshes:
+ positions = None
+ normals = None
+ indices = None
+
+ # Compute positions, normals, and indices
+ if smooth:
+ positions = m.vertices.copy()
+ normals = m.vertex_normals.copy()
+ indices = m.faces.copy()
+ else:
+ positions = m.vertices[m.faces].reshape((3 * len(m.faces), 3))
+ normals = np.repeat(m.face_normals, 3, axis=0)
+
+ # Compute colors, texture coords, and material properties
+ color_0, texcoord_0, primitive_material = Mesh._get_trimesh_props(m, smooth=smooth, material=material)
+
+ # Override if material is given.
+ if material is not None:
+ #primitive_material = copy.copy(material)
+ primitive_material = copy.deepcopy(material) # TODO
+
+ if primitive_material is None:
+ # Replace material with default if needed
+ primitive_material = MetallicRoughnessMaterial(
+ alphaMode='BLEND',
+ baseColorFactor=[0.3, 0.3, 0.3, 1.0],
+ metallicFactor=0.2,
+ roughnessFactor=0.8
+ )
+
+ primitive_material.wireframe = wireframe
+
+ # Create the primitive
+ primitives.append(Primitive(
+ positions=positions,
+ normals=normals,
+ texcoord_0=texcoord_0,
+ color_0=color_0,
+ indices=indices,
+ material=primitive_material,
+ mode=GLTF.TRIANGLES,
+ poses=poses
+ ))
+
+ return Mesh(primitives=primitives, is_visible=is_visible)
+
+ @staticmethod
+ def _get_trimesh_props(mesh, smooth=False, material=None):
+ """Gets the vertex colors, texture coordinates, and material properties
+ from a :class:`~trimesh.base.Trimesh`.
+ """
+ colors = None
+ texcoords = None
+
+ # If the trimesh visual is undefined, return none for both
+ if not mesh.visual.defined:
+ return colors, texcoords, material
+
+ # Process vertex colors
+ if material is None:
+ if mesh.visual.kind == 'vertex':
+ vc = mesh.visual.vertex_colors.copy()
+ if smooth:
+ colors = vc
+ else:
+ colors = vc[mesh.faces].reshape(
+ (3 * len(mesh.faces), vc.shape[1])
+ )
+ material = MetallicRoughnessMaterial(
+ alphaMode='BLEND',
+ baseColorFactor=[1.0, 1.0, 1.0, 1.0],
+ metallicFactor=0.2,
+ roughnessFactor=0.8
+ )
+ # Process face colors
+ elif mesh.visual.kind == 'face':
+ if smooth:
+ raise ValueError('Cannot use face colors with a smooth mesh')
+ else:
+ colors = np.repeat(mesh.visual.face_colors, 3, axis=0)
+
+ material = MetallicRoughnessMaterial(
+ alphaMode='BLEND',
+ baseColorFactor=[1.0, 1.0, 1.0, 1.0],
+ metallicFactor=0.2,
+ roughnessFactor=0.8
+ )
+
+ # Process texture colors
+ if mesh.visual.kind == 'texture':
+ # Configure UV coordinates
+ if mesh.visual.uv is not None and len(mesh.visual.uv) != 0:
+ uv = mesh.visual.uv.copy()
+ if smooth:
+ texcoords = uv
+ else:
+ texcoords = uv[mesh.faces].reshape(
+ (3 * len(mesh.faces), uv.shape[1])
+ )
+
+ if material is None:
+ # Configure mesh material
+ mat = mesh.visual.material
+
+ if isinstance(mat, trimesh.visual.texture.PBRMaterial):
+ material = MetallicRoughnessMaterial(
+ normalTexture=mat.normalTexture,
+ occlusionTexture=mat.occlusionTexture,
+ emissiveTexture=mat.emissiveTexture,
+ emissiveFactor=mat.emissiveFactor,
+ alphaMode='BLEND',
+ baseColorFactor=mat.baseColorFactor,
+ baseColorTexture=mat.baseColorTexture,
+ metallicFactor=mat.metallicFactor,
+ roughnessFactor=mat.roughnessFactor,
+ metallicRoughnessTexture=mat.metallicRoughnessTexture,
+ doubleSided=mat.doubleSided,
+ alphaCutoff=mat.alphaCutoff
+ )
+ elif isinstance(mat, trimesh.visual.texture.SimpleMaterial):
+ glossiness = mat.kwargs.get('Ns', 1.0)
+ if isinstance(glossiness, list):
+ glossiness = float(glossiness[0])
+ roughness = (2 / (glossiness + 2)) ** (1.0 / 4.0)
+ material = MetallicRoughnessMaterial(
+ alphaMode='BLEND',
+ roughnessFactor=roughness,
+ baseColorFactor=mat.diffuse,
+ baseColorTexture=mat.image,
+ )
+ elif isinstance(mat, MetallicRoughnessMaterial):
+ material = mat
+
+ return colors, texcoords, material
diff --git a/generate_human_motion/pyrender/pyrender/node.py b/generate_human_motion/pyrender/pyrender/node.py
new file mode 100644
index 0000000000000000000000000000000000000000..1f37f7856cc732a37dc58253022a7c331489493e
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/node.py
@@ -0,0 +1,263 @@
+"""Nodes, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-node
+
+Author: Matthew Matl
+"""
+import numpy as np
+
+import trimesh.transformations as transformations
+
+from .camera import Camera
+from .mesh import Mesh
+from .light import Light
+
+
+class Node(object):
+ """A node in the node hierarchy.
+
+ Parameters
+ ----------
+ name : str, optional
+ The user-defined name of this object.
+ camera : :class:`Camera`, optional
+ The camera in this node.
+ children : list of :class:`Node`
+ The children of this node.
+ skin : int, optional
+ The index of the skin referenced by this node.
+ matrix : (4,4) float, optional
+ A floating-point 4x4 transformation matrix.
+ mesh : :class:`Mesh`, optional
+ The mesh in this node.
+ rotation : (4,) float, optional
+ The node's unit quaternion in the order (x, y, z, w), where
+ w is the scalar.
+ scale : (3,) float, optional
+ The node's non-uniform scale, given as the scaling factors along the x,
+ y, and z axes.
+ translation : (3,) float, optional
+ The node's translation along the x, y, and z axes.
+ weights : (n,) float
+ The weights of the instantiated Morph Target. Number of elements must
+ match number of Morph Targets of used mesh.
+ light : :class:`Light`, optional
+ The light in this node.
+ """
+
+ def __init__(self,
+ name=None,
+ camera=None,
+ children=None,
+ skin=None,
+ matrix=None,
+ mesh=None,
+ rotation=None,
+ scale=None,
+ translation=None,
+ weights=None,
+ light=None):
+ # Set defaults
+ if children is None:
+ children = []
+
+ self._matrix = None
+ self._scale = None
+ self._rotation = None
+ self._translation = None
+ if matrix is None:
+ if rotation is None:
+ rotation = np.array([0.0, 0.0, 0.0, 1.0])
+ if translation is None:
+ translation = np.zeros(3)
+ if scale is None:
+ scale = np.ones(3)
+ self.rotation = rotation
+ self.translation = translation
+ self.scale = scale
+ else:
+ self.matrix = matrix
+
+ self.name = name
+ self.camera = camera
+ self.children = children
+ self.skin = skin
+ self.mesh = mesh
+ self.weights = weights
+ self.light = light
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def camera(self):
+ """:class:`Camera` : The camera in this node.
+ """
+ return self._camera
+
+ @camera.setter
+ def camera(self, value):
+ if value is not None and not isinstance(value, Camera):
+ raise TypeError('Value must be a camera')
+ self._camera = value
+
+ @property
+ def children(self):
+ """list of :class:`Node` : The children of this node.
+ """
+ return self._children
+
+ @children.setter
+ def children(self, value):
+ self._children = value
+
+ @property
+ def skin(self):
+ """int : The skin index for this node.
+ """
+ return self._skin
+
+ @skin.setter
+ def skin(self, value):
+ self._skin = value
+
+ @property
+ def mesh(self):
+ """:class:`Mesh` : The mesh in this node.
+ """
+ return self._mesh
+
+ @mesh.setter
+ def mesh(self, value):
+ if value is not None and not isinstance(value, Mesh):
+ raise TypeError('Value must be a mesh')
+ self._mesh = value
+
+ @property
+ def light(self):
+ """:class:`Light` : The light in this node.
+ """
+ return self._light
+
+ @light.setter
+ def light(self, value):
+ if value is not None and not isinstance(value, Light):
+ raise TypeError('Value must be a light')
+ self._light = value
+
+ @property
+ def rotation(self):
+ """(4,) float : The xyzw quaternion for this node.
+ """
+ return self._rotation
+
+ @rotation.setter
+ def rotation(self, value):
+ value = np.asanyarray(value)
+ if value.shape != (4,):
+ raise ValueError('Quaternion must be a (4,) vector')
+ if np.abs(np.linalg.norm(value) - 1.0) > 1e-3:
+ raise ValueError('Quaternion must have norm == 1.0')
+ self._rotation = value
+ self._matrix = None
+
+ @property
+ def translation(self):
+ """(3,) float : The translation for this node.
+ """
+ return self._translation
+
+ @translation.setter
+ def translation(self, value):
+ value = np.asanyarray(value)
+ if value.shape != (3,):
+ raise ValueError('Translation must be a (3,) vector')
+ self._translation = value
+ self._matrix = None
+
+ @property
+ def scale(self):
+ """(3,) float : The scale for this node.
+ """
+ return self._scale
+
+ @scale.setter
+ def scale(self, value):
+ value = np.asanyarray(value)
+ if value.shape != (3,):
+ raise ValueError('Scale must be a (3,) vector')
+ self._scale = value
+ self._matrix = None
+
+ @property
+ def matrix(self):
+ """(4,4) float : The homogenous transform matrix for this node.
+
+ Note that this matrix's elements are not settable,
+ it's just a copy of the internal matrix. You can set the whole
+ matrix, but not an individual element.
+ """
+ if self._matrix is None:
+ self._matrix = self._m_from_tqs(
+ self.translation, self.rotation, self.scale
+ )
+ return self._matrix.copy()
+
+ @matrix.setter
+ def matrix(self, value):
+ value = np.asanyarray(value)
+ if value.shape != (4,4):
+ raise ValueError('Matrix must be a 4x4 numpy ndarray')
+ if not np.allclose(value[3,:], np.array([0.0, 0.0, 0.0, 1.0])):
+ raise ValueError('Bottom row of matrix must be [0,0,0,1]')
+ self.rotation = Node._q_from_m(value)
+ self.scale = Node._s_from_m(value)
+ self.translation = Node._t_from_m(value)
+ self._matrix = value
+
+ @staticmethod
+ def _t_from_m(m):
+ return m[:3,3]
+
+ @staticmethod
+ def _r_from_m(m):
+ U = m[:3,:3]
+ norms = np.linalg.norm(U.T, axis=1)
+ return U / norms
+
+ @staticmethod
+ def _q_from_m(m):
+ M = np.eye(4)
+ M[:3,:3] = Node._r_from_m(m)
+ q_wxyz = transformations.quaternion_from_matrix(M)
+ return np.roll(q_wxyz, -1)
+
+ @staticmethod
+ def _s_from_m(m):
+ return np.linalg.norm(m[:3,:3].T, axis=1)
+
+ @staticmethod
+ def _r_from_q(q):
+ q_wxyz = np.roll(q, 1)
+ return transformations.quaternion_matrix(q_wxyz)[:3,:3]
+
+ @staticmethod
+ def _m_from_tqs(t, q, s):
+ S = np.eye(4)
+ S[:3,:3] = np.diag(s)
+
+ R = np.eye(4)
+ R[:3,:3] = Node._r_from_q(q)
+
+ T = np.eye(4)
+ T[:3,3] = t
+
+ return T.dot(R.dot(S))
diff --git a/generate_human_motion/pyrender/pyrender/offscreen.py b/generate_human_motion/pyrender/pyrender/offscreen.py
new file mode 100644
index 0000000000000000000000000000000000000000..9242a029a5320873fe7647e4b3dac4522a02e2fd
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/offscreen.py
@@ -0,0 +1,160 @@
+"""Wrapper for offscreen rendering.
+
+Author: Matthew Matl
+"""
+import os
+
+from .renderer import Renderer
+from .constants import RenderFlags
+
+
+class OffscreenRenderer(object):
+ """A wrapper for offscreen rendering.
+
+ Parameters
+ ----------
+ viewport_width : int
+ The width of the main viewport, in pixels.
+ viewport_height : int
+ The height of the main viewport, in pixels.
+ point_size : float
+ The size of screen-space points in pixels.
+ """
+
+ def __init__(self, viewport_width, viewport_height, point_size=1.0):
+ self.viewport_width = viewport_width
+ self.viewport_height = viewport_height
+ self.point_size = point_size
+
+ self._platform = None
+ self._renderer = None
+ self._create()
+
+ @property
+ def viewport_width(self):
+ """int : The width of the main viewport, in pixels.
+ """
+ return self._viewport_width
+
+ @viewport_width.setter
+ def viewport_width(self, value):
+ self._viewport_width = int(value)
+
+ @property
+ def viewport_height(self):
+ """int : The height of the main viewport, in pixels.
+ """
+ return self._viewport_height
+
+ @viewport_height.setter
+ def viewport_height(self, value):
+ self._viewport_height = int(value)
+
+ @property
+ def point_size(self):
+ """float : The pixel size of points in point clouds.
+ """
+ return self._point_size
+
+ @point_size.setter
+ def point_size(self, value):
+ self._point_size = float(value)
+
+ def render(self, scene, flags=RenderFlags.NONE, seg_node_map=None):
+ """Render a scene with the given set of flags.
+
+ Parameters
+ ----------
+ scene : :class:`Scene`
+ A scene to render.
+ flags : int
+ A bitwise or of one or more flags from :class:`.RenderFlags`.
+ seg_node_map : dict
+ A map from :class:`.Node` objects to (3,) colors for each.
+ If specified along with flags set to :attr:`.RenderFlags.SEG`,
+ the color image will be a segmentation image.
+
+ Returns
+ -------
+ color_im : (h, w, 3) uint8 or (h, w, 4) uint8
+ The color buffer in RGB format, or in RGBA format if
+ :attr:`.RenderFlags.RGBA` is set.
+ Not returned if flags includes :attr:`.RenderFlags.DEPTH_ONLY`.
+ depth_im : (h, w) float32
+ The depth buffer in linear units.
+ """
+ self._platform.make_current()
+ # If platform does not support dynamically-resizing framebuffers,
+ # destroy it and restart it
+ if (self._platform.viewport_height != self.viewport_height or
+ self._platform.viewport_width != self.viewport_width):
+ if not self._platform.supports_framebuffers():
+ self.delete()
+ self._create()
+
+ self._platform.make_current()
+ self._renderer.viewport_width = self.viewport_width
+ self._renderer.viewport_height = self.viewport_height
+ self._renderer.point_size = self.point_size
+
+ if self._platform.supports_framebuffers():
+ flags |= RenderFlags.OFFSCREEN
+ retval = self._renderer.render(scene, flags, seg_node_map)
+ else:
+ self._renderer.render(scene, flags, seg_node_map)
+ depth = self._renderer.read_depth_buf()
+ if flags & RenderFlags.DEPTH_ONLY:
+ retval = depth
+ else:
+ color = self._renderer.read_color_buf()
+ retval = color, depth
+
+ # Make the platform not current
+ self._platform.make_uncurrent()
+ return retval
+
+ def delete(self):
+ """Free all OpenGL resources.
+ """
+ self._platform.make_current()
+ self._renderer.delete()
+ self._platform.delete_context()
+ del self._renderer
+ del self._platform
+ self._renderer = None
+ self._platform = None
+ import gc
+ gc.collect()
+
+ def _create(self):
+ from pyrender.platforms.pyglet_platform import PygletPlatform
+ self._platform = PygletPlatform(self.viewport_width, self.viewport_height)
+ #if 'PYOPENGL_PLATFORM' not in os.environ:
+
+ # #elif os.environ['PYOPENGL_PLATFORM'] == 'egl':
+ # from pyrender.platforms import egl
+ # device_id = int(os.environ.get('EGL_DEVICE_ID', '0'))
+ # egl_device = egl.get_device_by_index(device_id)
+ # self._platform = egl.EGLPlatform(self.viewport_width,
+ # self.viewport_height,
+ # device=egl_device)
+ # elif os.environ['PYOPENGL_PLATFORM'] == 'osmesa':
+ # from pyrender.platforms.osmesa import OSMesaPlatform
+ # self._platform = OSMesaPlatform(self.viewport_width,
+ # self.viewport_height)
+ # else:
+ # raise ValueError('Unsupported PyOpenGL platform: {}'.format(
+ # os.environ['PYOPENGL_PLATFORM']
+ # ))
+ self._platform.init_context()
+ self._platform.make_current()
+ self._renderer = Renderer(self.viewport_width, self.viewport_height)
+
+ def __del__(self):
+ try:
+ self.delete()
+ except Exception:
+ pass
+
+
+__all__ = ['OffscreenRenderer']
diff --git a/generate_human_motion/pyrender/pyrender/platforms/__init__.py b/generate_human_motion/pyrender/pyrender/platforms/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..7837fd5fdeccab5e48c85e41d20b238ea7396599
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/platforms/__init__.py
@@ -0,0 +1,6 @@
+"""Platforms for generating offscreen OpenGL contexts for rendering.
+
+Author: Matthew Matl
+"""
+
+from .base import Platform
diff --git a/generate_human_motion/pyrender/pyrender/platforms/__pycache__/__init__.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/platforms/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1a0002992e0d58e1fb1520f8f2a8485f6e5e725a
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/platforms/__pycache__/__init__.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/platforms/__pycache__/base.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/platforms/__pycache__/base.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..336f5abdf7723051b9fa7813967447152bdfb715
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/platforms/__pycache__/base.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/platforms/__pycache__/egl.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/platforms/__pycache__/egl.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b9dcd5bf654abc14384ecffa9d34a5ccb8b68096
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/platforms/__pycache__/egl.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/platforms/__pycache__/pyglet_platform.cpython-310.pyc b/generate_human_motion/pyrender/pyrender/platforms/__pycache__/pyglet_platform.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..82042c7d6c885fccc069f91b7e399dc283ff6ab1
Binary files /dev/null and b/generate_human_motion/pyrender/pyrender/platforms/__pycache__/pyglet_platform.cpython-310.pyc differ
diff --git a/generate_human_motion/pyrender/pyrender/platforms/base.py b/generate_human_motion/pyrender/pyrender/platforms/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..c9ecda906145e239737901809aa59db8d3e231c6
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/platforms/base.py
@@ -0,0 +1,76 @@
+import abc
+
+import six
+
+
+@six.add_metaclass(abc.ABCMeta)
+class Platform(object):
+ """Base class for all OpenGL platforms.
+
+ Parameters
+ ----------
+ viewport_width : int
+ The width of the main viewport, in pixels.
+ viewport_height : int
+ The height of the main viewport, in pixels
+ """
+
+ def __init__(self, viewport_width, viewport_height):
+ self.viewport_width = viewport_width
+ self.viewport_height = viewport_height
+
+ @property
+ def viewport_width(self):
+ """int : The width of the main viewport, in pixels.
+ """
+ return self._viewport_width
+
+ @viewport_width.setter
+ def viewport_width(self, value):
+ self._viewport_width = value
+
+ @property
+ def viewport_height(self):
+ """int : The height of the main viewport, in pixels.
+ """
+ return self._viewport_height
+
+ @viewport_height.setter
+ def viewport_height(self, value):
+ self._viewport_height = value
+
+ @abc.abstractmethod
+ def init_context(self):
+ """Create an OpenGL context.
+ """
+ pass
+
+ @abc.abstractmethod
+ def make_current(self):
+ """Make the OpenGL context current.
+ """
+ pass
+
+ @abc.abstractmethod
+ def make_uncurrent(self):
+ """Make the OpenGL context uncurrent.
+ """
+ pass
+
+ @abc.abstractmethod
+ def delete_context(self):
+ """Delete the OpenGL context.
+ """
+ pass
+
+ @abc.abstractmethod
+ def supports_framebuffers(self):
+ """Returns True if the method supports framebuffer rendering.
+ """
+ pass
+
+ def __del__(self):
+ try:
+ self.delete_context()
+ except Exception:
+ pass
diff --git a/generate_human_motion/pyrender/pyrender/platforms/egl.py b/generate_human_motion/pyrender/pyrender/platforms/egl.py
new file mode 100644
index 0000000000000000000000000000000000000000..ae2478d29c9a538c53ad83fa31f8e2277cd897c8
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/platforms/egl.py
@@ -0,0 +1,219 @@
+import ctypes
+import os
+
+import OpenGL.platform
+
+from .base import Platform
+
+EGL_PLATFORM_DEVICE_EXT = 0x313F
+EGL_DRM_DEVICE_FILE_EXT = 0x3233
+
+
+def _ensure_egl_loaded():
+ plugin = OpenGL.platform.PlatformPlugin.by_name('egl')
+ if plugin is None:
+ raise RuntimeError("EGL platform plugin is not available.")
+
+ plugin_class = plugin.load()
+ plugin.loaded = True
+ # create instance of this platform implementation
+ plugin = plugin_class()
+
+ plugin.install(vars(OpenGL.platform))
+
+
+_ensure_egl_loaded()
+from OpenGL import EGL as egl
+
+
+def _get_egl_func(func_name, res_type, *arg_types):
+ address = egl.eglGetProcAddress(func_name)
+ if address is None:
+ return None
+
+ proto = ctypes.CFUNCTYPE(res_type)
+ proto.argtypes = arg_types
+ func = proto(address)
+ return func
+
+
+def _get_egl_struct(struct_name):
+ from OpenGL._opaque import opaque_pointer_cls
+ return opaque_pointer_cls(struct_name)
+
+
+# These are not defined in PyOpenGL by default.
+_EGLDeviceEXT = _get_egl_struct('EGLDeviceEXT')
+_eglGetPlatformDisplayEXT = _get_egl_func('eglGetPlatformDisplayEXT', egl.EGLDisplay)
+_eglQueryDevicesEXT = _get_egl_func('eglQueryDevicesEXT', egl.EGLBoolean)
+_eglQueryDeviceStringEXT = _get_egl_func('eglQueryDeviceStringEXT', ctypes.c_char_p)
+
+
+def query_devices():
+ if _eglQueryDevicesEXT is None:
+ raise RuntimeError("EGL query extension is not loaded or is not supported.")
+
+ num_devices = egl.EGLint()
+ success = _eglQueryDevicesEXT(0, None, ctypes.pointer(num_devices))
+ if not success or num_devices.value < 1:
+ return []
+
+ devices = (_EGLDeviceEXT * num_devices.value)() # array of size num_devices
+ success = _eglQueryDevicesEXT(num_devices.value, devices, ctypes.pointer(num_devices))
+ if not success or num_devices.value < 1:
+ return []
+
+ return [EGLDevice(devices[i]) for i in range(num_devices.value)]
+
+
+def get_default_device():
+ # Fall back to not using query extension.
+ if _eglQueryDevicesEXT is None:
+ return EGLDevice(None)
+
+ return query_devices()[0]
+
+
+def get_device_by_index(device_id):
+ if _eglQueryDevicesEXT is None and device_id == 0:
+ return get_default_device()
+
+ devices = query_devices()
+ if device_id >= len(devices):
+ raise ValueError('Invalid device ID ({})'.format(device_id, len(devices)))
+ return devices[device_id]
+
+
+class EGLDevice:
+
+ def __init__(self, display=None):
+ self._display = display
+
+ def get_display(self):
+ if self._display is None:
+ return egl.eglGetDisplay(egl.EGL_DEFAULT_DISPLAY)
+
+ return _eglGetPlatformDisplayEXT(EGL_PLATFORM_DEVICE_EXT, self._display, None)
+
+ @property
+ def name(self):
+ if self._display is None:
+ return 'default'
+
+ name = _eglQueryDeviceStringEXT(self._display, EGL_DRM_DEVICE_FILE_EXT)
+ if name is None:
+ return None
+
+ return name.decode('ascii')
+
+ def __repr__(self):
+ return "".format(self.name)
+
+
+class EGLPlatform(Platform):
+ """Renders using EGL.
+ """
+
+ def __init__(self, viewport_width, viewport_height, device: EGLDevice = None):
+ super(EGLPlatform, self).__init__(viewport_width, viewport_height)
+ if device is None:
+ device = get_default_device()
+
+ self._egl_device = device
+ self._egl_display = None
+ self._egl_context = None
+
+ def init_context(self):
+ _ensure_egl_loaded()
+
+ from OpenGL.EGL import (
+ EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, EGL_BLUE_SIZE,
+ EGL_RED_SIZE, EGL_GREEN_SIZE, EGL_DEPTH_SIZE,
+ EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_CONFORMANT,
+ EGL_NONE, EGL_DEFAULT_DISPLAY, EGL_NO_CONTEXT,
+ EGL_OPENGL_API, EGL_CONTEXT_MAJOR_VERSION,
+ EGL_CONTEXT_MINOR_VERSION,
+ EGL_CONTEXT_OPENGL_PROFILE_MASK,
+ EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
+ eglGetDisplay, eglInitialize, eglChooseConfig,
+ eglBindAPI, eglCreateContext, EGLConfig
+ )
+ from OpenGL import arrays
+
+ config_attributes = arrays.GLintArray.asArray([
+ EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
+ EGL_BLUE_SIZE, 8,
+ EGL_RED_SIZE, 8,
+ EGL_GREEN_SIZE, 8,
+ EGL_DEPTH_SIZE, 24,
+ EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
+ EGL_CONFORMANT, EGL_OPENGL_BIT,
+ EGL_NONE
+ ])
+ context_attributes = arrays.GLintArray.asArray([
+ EGL_CONTEXT_MAJOR_VERSION, 4,
+ EGL_CONTEXT_MINOR_VERSION, 1,
+ EGL_CONTEXT_OPENGL_PROFILE_MASK,
+ EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
+ EGL_NONE
+ ])
+ major, minor = ctypes.c_long(), ctypes.c_long()
+ num_configs = ctypes.c_long()
+ configs = (EGLConfig * 1)()
+
+ # Cache DISPLAY if necessary and get an off-screen EGL display
+ orig_dpy = None
+ if 'DISPLAY' in os.environ:
+ orig_dpy = os.environ['DISPLAY']
+ del os.environ['DISPLAY']
+
+ self._egl_display = self._egl_device.get_display()
+ if orig_dpy is not None:
+ os.environ['DISPLAY'] = orig_dpy
+
+ # Initialize EGL
+ assert eglInitialize(self._egl_display, major, minor)
+ assert eglChooseConfig(
+ self._egl_display, config_attributes, configs, 1, num_configs
+ )
+
+ # Bind EGL to the OpenGL API
+ assert eglBindAPI(EGL_OPENGL_API)
+
+ # Create an EGL context
+ self._egl_context = eglCreateContext(
+ self._egl_display, configs[0],
+ EGL_NO_CONTEXT, context_attributes
+ )
+
+ # Make it current
+ self.make_current()
+
+ def make_current(self):
+ from OpenGL.EGL import eglMakeCurrent, EGL_NO_SURFACE
+ assert eglMakeCurrent(
+ self._egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
+ self._egl_context
+ )
+
+ def make_uncurrent(self):
+ """Make the OpenGL context uncurrent.
+ """
+ pass
+
+ def delete_context(self):
+ from OpenGL.EGL import eglDestroyContext, eglTerminate
+ if self._egl_display is not None:
+ if self._egl_context is not None:
+ eglDestroyContext(self._egl_display, self._egl_context)
+ self._egl_context = None
+ eglTerminate(self._egl_display)
+ self._egl_display = None
+
+ def supports_framebuffers(self):
+ return True
+
+
+__all__ = ['EGLPlatform']
diff --git a/generate_human_motion/pyrender/pyrender/platforms/osmesa.py b/generate_human_motion/pyrender/pyrender/platforms/osmesa.py
new file mode 100644
index 0000000000000000000000000000000000000000..deaa5ff44031a107883913ae9a18fc425d650f3d
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/platforms/osmesa.py
@@ -0,0 +1,59 @@
+from .base import Platform
+
+
+__all__ = ['OSMesaPlatform']
+
+
+class OSMesaPlatform(Platform):
+ """Renders into a software buffer using OSMesa. Requires special versions
+ of OSMesa to be installed, plus PyOpenGL upgrade.
+ """
+
+ def __init__(self, viewport_width, viewport_height):
+ super(OSMesaPlatform, self).__init__(viewport_width, viewport_height)
+ self._context = None
+ self._buffer = None
+
+ def init_context(self):
+ from OpenGL import arrays
+ from OpenGL.osmesa import (
+ OSMesaCreateContextAttribs, OSMESA_FORMAT,
+ OSMESA_RGBA, OSMESA_PROFILE, OSMESA_CORE_PROFILE,
+ OSMESA_CONTEXT_MAJOR_VERSION, OSMESA_CONTEXT_MINOR_VERSION,
+ OSMESA_DEPTH_BITS
+ )
+
+ attrs = arrays.GLintArray.asArray([
+ OSMESA_FORMAT, OSMESA_RGBA,
+ OSMESA_DEPTH_BITS, 24,
+ OSMESA_PROFILE, OSMESA_CORE_PROFILE,
+ OSMESA_CONTEXT_MAJOR_VERSION, 3,
+ OSMESA_CONTEXT_MINOR_VERSION, 3,
+ 0
+ ])
+ self._context = OSMesaCreateContextAttribs(attrs, None)
+ self._buffer = arrays.GLubyteArray.zeros(
+ (self.viewport_height, self.viewport_width, 4)
+ )
+
+ def make_current(self):
+ from OpenGL import GL as gl
+ from OpenGL.osmesa import OSMesaMakeCurrent
+ assert(OSMesaMakeCurrent(
+ self._context, self._buffer, gl.GL_UNSIGNED_BYTE,
+ self.viewport_width, self.viewport_height
+ ))
+
+ def make_uncurrent(self):
+ """Make the OpenGL context uncurrent.
+ """
+ pass
+
+ def delete_context(self):
+ from OpenGL.osmesa import OSMesaDestroyContext
+ OSMesaDestroyContext(self._context)
+ self._context = None
+ self._buffer = None
+
+ def supports_framebuffers(self):
+ return False
diff --git a/generate_human_motion/pyrender/pyrender/platforms/pyglet_platform.py b/generate_human_motion/pyrender/pyrender/platforms/pyglet_platform.py
new file mode 100644
index 0000000000000000000000000000000000000000..a70cf7b659bc85a92f6c9c8ebcc360662a068507
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/platforms/pyglet_platform.py
@@ -0,0 +1,90 @@
+from pyrender.constants import (TARGET_OPEN_GL_MAJOR, TARGET_OPEN_GL_MINOR,
+ MIN_OPEN_GL_MAJOR, MIN_OPEN_GL_MINOR)
+from .base import Platform
+
+import OpenGL
+
+
+__all__ = ['PygletPlatform']
+
+
+class PygletPlatform(Platform):
+ """Renders on-screen using a 1x1 hidden Pyglet window for getting
+ an OpenGL context.
+ """
+
+ def __init__(self, viewport_width, viewport_height):
+ super(PygletPlatform, self).__init__(viewport_width, viewport_height)
+ self._window = None
+
+ def init_context(self):
+ import pyglet
+ pyglet.options['shadow_window'] = False
+
+ try:
+ pyglet.lib.x11.xlib.XInitThreads()
+ except Exception:
+ pass
+
+ self._window = None
+ confs = [pyglet.gl.Config(sample_buffers=1, samples=4,
+ depth_size=24,
+ double_buffer=True,
+ major_version=TARGET_OPEN_GL_MAJOR,
+ minor_version=TARGET_OPEN_GL_MINOR),
+ pyglet.gl.Config(depth_size=24,
+ double_buffer=True,
+ major_version=TARGET_OPEN_GL_MAJOR,
+ minor_version=TARGET_OPEN_GL_MINOR),
+ pyglet.gl.Config(sample_buffers=1, samples=4,
+ depth_size=24,
+ double_buffer=True,
+ major_version=MIN_OPEN_GL_MAJOR,
+ minor_version=MIN_OPEN_GL_MINOR),
+ pyglet.gl.Config(depth_size=24,
+ double_buffer=True,
+ major_version=MIN_OPEN_GL_MAJOR,
+ minor_version=MIN_OPEN_GL_MINOR)]
+ for conf in confs:
+ try:
+ self._window = pyglet.window.Window(config=conf, visible=False,
+ resizable=False,
+ width=1, height=1)
+ break
+ except pyglet.window.NoSuchConfigException as e:
+ pass
+
+ if not self._window:
+ raise ValueError(
+ 'Failed to initialize Pyglet window with an OpenGL >= 3+ '
+ 'context. If you\'re logged in via SSH, ensure that you\'re '
+ 'running your script with vglrun (i.e. VirtualGL). The '
+ 'internal error message was "{}"'.format(e)
+ )
+
+ def make_current(self):
+ if self._window:
+ self._window.switch_to()
+
+ def make_uncurrent(self):
+ try:
+ import pyglet
+ pyglet.gl.xlib.glx.glXMakeContextCurrent(self._window.context.x_display, 0, 0, None)
+ except Exception:
+ pass
+
+ def delete_context(self):
+ if self._window is not None:
+ self.make_current()
+ cid = OpenGL.contextdata.getContext()
+ try:
+ self._window.context.destroy()
+ self._window.close()
+ except Exception:
+ pass
+ self._window = None
+ OpenGL.contextdata.cleanupContext(cid)
+ del cid
+
+ def supports_framebuffers(self):
+ return True
diff --git a/generate_human_motion/pyrender/pyrender/primitive.py b/generate_human_motion/pyrender/pyrender/primitive.py
new file mode 100644
index 0000000000000000000000000000000000000000..7f83f46f532b126a4573e715dd03d079fef755ca
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/primitive.py
@@ -0,0 +1,489 @@
+"""Primitives, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-primitive
+
+Author: Matthew Matl
+"""
+import numpy as np
+
+from OpenGL.GL import *
+
+from .material import Material, MetallicRoughnessMaterial
+from .constants import FLOAT_SZ, UINT_SZ, BufFlags, GLTF
+from .utils import format_color_array
+
+
+class Primitive(object):
+ """A primitive object which can be rendered.
+
+ Parameters
+ ----------
+ positions : (n, 3) float
+ XYZ vertex positions.
+ normals : (n, 3) float
+ Normalized XYZ vertex normals.
+ tangents : (n, 4) float
+ XYZW vertex tangents where the w component is a sign value
+ (either +1 or -1) indicating the handedness of the tangent basis.
+ texcoord_0 : (n, 2) float
+ The first set of UV texture coordinates.
+ texcoord_1 : (n, 2) float
+ The second set of UV texture coordinates.
+ color_0 : (n, 4) float
+ RGBA vertex colors.
+ joints_0 : (n, 4) float
+ Joint information.
+ weights_0 : (n, 4) float
+ Weight information for morphing.
+ indices : (m, 3) int
+ Face indices for triangle meshes or fans.
+ material : :class:`Material`
+ The material to apply to this primitive when rendering.
+ mode : int
+ The type of primitives to render, one of the following:
+
+ - ``0``: POINTS
+ - ``1``: LINES
+ - ``2``: LINE_LOOP
+ - ``3``: LINE_STRIP
+ - ``4``: TRIANGLES
+ - ``5``: TRIANGLES_STRIP
+ - ``6``: TRIANGLES_FAN
+ targets : (k,) int
+ Morph target indices.
+ poses : (x,4,4), float
+ Array of 4x4 transformation matrices for instancing this object.
+ """
+
+ def __init__(self,
+ positions,
+ normals=None,
+ tangents=None,
+ texcoord_0=None,
+ texcoord_1=None,
+ color_0=None,
+ joints_0=None,
+ weights_0=None,
+ indices=None,
+ material=None,
+ mode=None,
+ targets=None,
+ poses=None):
+
+ if mode is None:
+ mode = GLTF.TRIANGLES
+
+ self.positions = positions
+ self.normals = normals
+ self.tangents = tangents
+ self.texcoord_0 = texcoord_0
+ self.texcoord_1 = texcoord_1
+ self.color_0 = color_0
+ self.joints_0 = joints_0
+ self.weights_0 = weights_0
+ self.indices = indices
+ self.material = material
+ self.mode = mode
+ self.targets = targets
+ self.poses = poses
+
+ self._bounds = None
+ self._vaid = None
+ self._buffers = []
+ self._is_transparent = None
+ self._buf_flags = None
+
+ @property
+ def positions(self):
+ """(n,3) float : XYZ vertex positions.
+ """
+ return self._positions
+
+ @positions.setter
+ def positions(self, value):
+ value = np.asanyarray(value, dtype=np.float32)
+ self._positions = np.ascontiguousarray(value)
+ self._bounds = None
+
+ @property
+ def normals(self):
+ """(n,3) float : Normalized XYZ vertex normals.
+ """
+ return self._normals
+
+ @normals.setter
+ def normals(self, value):
+ if value is not None:
+ value = np.asanyarray(value, dtype=np.float32)
+ value = np.ascontiguousarray(value)
+ if value.shape != self.positions.shape:
+ raise ValueError('Incorrect normals shape')
+ self._normals = value
+
+ @property
+ def tangents(self):
+ """(n,4) float : XYZW vertex tangents.
+ """
+ return self._tangents
+
+ @tangents.setter
+ def tangents(self, value):
+ if value is not None:
+ value = np.asanyarray(value, dtype=np.float32)
+ value = np.ascontiguousarray(value)
+ if value.shape != (self.positions.shape[0], 4):
+ raise ValueError('Incorrect tangent shape')
+ self._tangents = value
+
+ @property
+ def texcoord_0(self):
+ """(n,2) float : The first set of UV texture coordinates.
+ """
+ return self._texcoord_0
+
+ @texcoord_0.setter
+ def texcoord_0(self, value):
+ if value is not None:
+ value = np.asanyarray(value, dtype=np.float32)
+ value = np.ascontiguousarray(value)
+ if (value.ndim != 2 or value.shape[0] != self.positions.shape[0] or
+ value.shape[1] < 2):
+ raise ValueError('Incorrect texture coordinate shape')
+ if value.shape[1] > 2:
+ value = value[:,:2]
+ self._texcoord_0 = value
+
+ @property
+ def texcoord_1(self):
+ """(n,2) float : The second set of UV texture coordinates.
+ """
+ return self._texcoord_1
+
+ @texcoord_1.setter
+ def texcoord_1(self, value):
+ if value is not None:
+ value = np.asanyarray(value, dtype=np.float32)
+ value = np.ascontiguousarray(value)
+ if (value.ndim != 2 or value.shape[0] != self.positions.shape[0] or
+ value.shape[1] != 2):
+ raise ValueError('Incorrect texture coordinate shape')
+ self._texcoord_1 = value
+
+ @property
+ def color_0(self):
+ """(n,4) float : RGBA vertex colors.
+ """
+ return self._color_0
+
+ @color_0.setter
+ def color_0(self, value):
+ if value is not None:
+ value = np.ascontiguousarray(
+ format_color_array(value, shape=(len(self.positions), 4))
+ )
+ self._is_transparent = None
+ self._color_0 = value
+
+ @property
+ def joints_0(self):
+ """(n,4) float : Joint information.
+ """
+ return self._joints_0
+
+ @joints_0.setter
+ def joints_0(self, value):
+ self._joints_0 = value
+
+ @property
+ def weights_0(self):
+ """(n,4) float : Weight information for morphing.
+ """
+ return self._weights_0
+
+ @weights_0.setter
+ def weights_0(self, value):
+ self._weights_0 = value
+
+ @property
+ def indices(self):
+ """(m,3) int : Face indices for triangle meshes or fans.
+ """
+ return self._indices
+
+ @indices.setter
+ def indices(self, value):
+ if value is not None:
+ value = np.asanyarray(value, dtype=np.float32)
+ value = np.ascontiguousarray(value)
+ self._indices = value
+
+ @property
+ def material(self):
+ """:class:`Material` : The material for this primitive.
+ """
+ return self._material
+
+ @material.setter
+ def material(self, value):
+ # Create default material
+ if value is None:
+ value = MetallicRoughnessMaterial()
+ else:
+ if not isinstance(value, Material):
+ raise TypeError('Object material must be of type Material')
+ self._material = value
+
+ @property
+ def mode(self):
+ """int : The type of primitive to render.
+ """
+ return self._mode
+
+ @mode.setter
+ def mode(self, value):
+ value = int(value)
+ if value < GLTF.POINTS or value > GLTF.TRIANGLE_FAN:
+ raise ValueError('Invalid mode')
+ self._mode = value
+
+ @property
+ def targets(self):
+ """(k,) int : Morph target indices.
+ """
+ return self._targets
+
+ @targets.setter
+ def targets(self, value):
+ self._targets = value
+
+ @property
+ def poses(self):
+ """(x,4,4) float : Homogenous transforms for instancing this primitive.
+ """
+ return self._poses
+
+ @poses.setter
+ def poses(self, value):
+ if value is not None:
+ value = np.asanyarray(value, dtype=np.float32)
+ value = np.ascontiguousarray(value)
+ if value.ndim == 2:
+ value = value[np.newaxis,:,:]
+ if value.shape[1] != 4 or value.shape[2] != 4:
+ raise ValueError('Pose matrices must be of shape (n,4,4), '
+ 'got {}'.format(value.shape))
+ self._poses = value
+ self._bounds = None
+
+ @property
+ def bounds(self):
+ if self._bounds is None:
+ self._bounds = self._compute_bounds()
+ return self._bounds
+
+ @property
+ def centroid(self):
+ """(3,) float : The centroid of the primitive's AABB.
+ """
+ return np.mean(self.bounds, axis=0)
+
+ @property
+ def extents(self):
+ """(3,) float : The lengths of the axes of the primitive's AABB.
+ """
+ return np.diff(self.bounds, axis=0).reshape(-1)
+
+ @property
+ def scale(self):
+ """(3,) float : The length of the diagonal of the primitive's AABB.
+ """
+ return np.linalg.norm(self.extents)
+
+ @property
+ def buf_flags(self):
+ """int : The flags for the render buffer.
+ """
+ if self._buf_flags is None:
+ self._buf_flags = self._compute_buf_flags()
+ return self._buf_flags
+
+ def delete(self):
+ self._unbind()
+ self._remove_from_context()
+
+ @property
+ def is_transparent(self):
+ """bool : If True, the mesh is partially-transparent.
+ """
+ return self._compute_transparency()
+
+ def _add_to_context(self):
+ if self._vaid is not None:
+ raise ValueError('Mesh is already bound to a context')
+
+ # Generate and bind VAO
+ self._vaid = glGenVertexArrays(1)
+ glBindVertexArray(self._vaid)
+
+ #######################################################################
+ # Fill vertex buffer
+ #######################################################################
+
+ # Generate and bind vertex buffer
+ vertexbuffer = glGenBuffers(1)
+ self._buffers.append(vertexbuffer)
+ glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer)
+
+ # positions
+ vertex_data = self.positions
+ attr_sizes = [3]
+
+ # Normals
+ if self.normals is not None:
+ vertex_data = np.hstack((vertex_data, self.normals))
+ attr_sizes.append(3)
+
+ # Tangents
+ if self.tangents is not None:
+ vertex_data = np.hstack((vertex_data, self.tangents))
+ attr_sizes.append(4)
+
+ # Texture Coordinates
+ if self.texcoord_0 is not None:
+ vertex_data = np.hstack((vertex_data, self.texcoord_0))
+ attr_sizes.append(2)
+ if self.texcoord_1 is not None:
+ vertex_data = np.hstack((vertex_data, self.texcoord_1))
+ attr_sizes.append(2)
+
+ # Color
+ if self.color_0 is not None:
+ vertex_data = np.hstack((vertex_data, self.color_0))
+ attr_sizes.append(4)
+
+ # TODO JOINTS AND WEIGHTS
+ # PASS
+
+ # Copy data to buffer
+ vertex_data = np.ascontiguousarray(
+ vertex_data.flatten().astype(np.float32)
+ )
+ glBufferData(
+ GL_ARRAY_BUFFER, FLOAT_SZ * len(vertex_data),
+ vertex_data, GL_STATIC_DRAW
+ )
+ total_sz = sum(attr_sizes)
+ offset = 0
+ for i, sz in enumerate(attr_sizes):
+ glVertexAttribPointer(
+ i, sz, GL_FLOAT, GL_FALSE, FLOAT_SZ * total_sz,
+ ctypes.c_void_p(FLOAT_SZ * offset)
+ )
+ glEnableVertexAttribArray(i)
+ offset += sz
+
+ #######################################################################
+ # Fill model matrix buffer
+ #######################################################################
+
+ if self.poses is not None:
+ pose_data = np.ascontiguousarray(
+ np.transpose(self.poses, [0,2,1]).flatten().astype(np.float32)
+ )
+ else:
+ pose_data = np.ascontiguousarray(
+ np.eye(4).flatten().astype(np.float32)
+ )
+
+ modelbuffer = glGenBuffers(1)
+ self._buffers.append(modelbuffer)
+ glBindBuffer(GL_ARRAY_BUFFER, modelbuffer)
+ glBufferData(
+ GL_ARRAY_BUFFER, FLOAT_SZ * len(pose_data),
+ pose_data, GL_STATIC_DRAW
+ )
+
+ for i in range(0, 4):
+ idx = i + len(attr_sizes)
+ glEnableVertexAttribArray(idx)
+ glVertexAttribPointer(
+ idx, 4, GL_FLOAT, GL_FALSE, FLOAT_SZ * 4 * 4,
+ ctypes.c_void_p(4 * FLOAT_SZ * i)
+ )
+ glVertexAttribDivisor(idx, 1)
+
+ #######################################################################
+ # Fill element buffer
+ #######################################################################
+ if self.indices is not None:
+ elementbuffer = glGenBuffers(1)
+ self._buffers.append(elementbuffer)
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer)
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, UINT_SZ * self.indices.size,
+ self.indices.flatten().astype(np.uint32),
+ GL_STATIC_DRAW)
+
+ glBindVertexArray(0)
+
+ def _remove_from_context(self):
+ if self._vaid is not None:
+ glDeleteVertexArrays(1, [self._vaid])
+ glDeleteBuffers(len(self._buffers), self._buffers)
+ self._vaid = None
+ self._buffers = []
+
+ def _in_context(self):
+ return self._vaid is not None
+
+ def _bind(self):
+ if self._vaid is None:
+ raise ValueError('Cannot bind a Mesh that has not been added '
+ 'to a context')
+ glBindVertexArray(self._vaid)
+
+ def _unbind(self):
+ glBindVertexArray(0)
+
+ def _compute_bounds(self):
+ """Compute the bounds of this object.
+ """
+ # Compute bounds of this object
+ bounds = np.array([np.min(self.positions, axis=0),
+ np.max(self.positions, axis=0)])
+
+ # If instanced, compute translations for approximate bounds
+ if self.poses is not None:
+ bounds += np.array([np.min(self.poses[:,:3,3], axis=0),
+ np.max(self.poses[:,:3,3], axis=0)])
+ return bounds
+
+ def _compute_transparency(self):
+ """Compute whether or not this object is transparent.
+ """
+ if self.material.is_transparent:
+ return True
+ if self._is_transparent is None:
+ self._is_transparent = False
+ if self.color_0 is not None:
+ if np.any(self._color_0[:,3] != 1.0):
+ self._is_transparent = True
+ return self._is_transparent
+
+ def _compute_buf_flags(self):
+ buf_flags = BufFlags.POSITION
+
+ if self.normals is not None:
+ buf_flags |= BufFlags.NORMAL
+ if self.tangents is not None:
+ buf_flags |= BufFlags.TANGENT
+ if self.texcoord_0 is not None:
+ buf_flags |= BufFlags.TEXCOORD_0
+ if self.texcoord_1 is not None:
+ buf_flags |= BufFlags.TEXCOORD_1
+ if self.color_0 is not None:
+ buf_flags |= BufFlags.COLOR_0
+ if self.joints_0 is not None:
+ buf_flags |= BufFlags.JOINTS_0
+ if self.weights_0 is not None:
+ buf_flags |= BufFlags.WEIGHTS_0
+
+ return buf_flags
diff --git a/generate_human_motion/pyrender/pyrender/renderer.py b/generate_human_motion/pyrender/pyrender/renderer.py
new file mode 100644
index 0000000000000000000000000000000000000000..5ae14c5cdb1785226a52ae6b71b08f01de069962
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/renderer.py
@@ -0,0 +1,1339 @@
+"""PBR renderer for Python.
+
+Author: Matthew Matl
+"""
+import sys
+
+import numpy as np
+import PIL
+
+from .constants import (RenderFlags, TextAlign, GLTF, BufFlags, TexFlags,
+ ProgramFlags, DEFAULT_Z_FAR, DEFAULT_Z_NEAR,
+ SHADOW_TEX_SZ, MAX_N_LIGHTS)
+from .shader_program import ShaderProgramCache
+from .material import MetallicRoughnessMaterial, SpecularGlossinessMaterial
+from .light import PointLight, SpotLight, DirectionalLight
+from .font import FontCache
+from .utils import format_color_vector
+
+from OpenGL.GL import *
+
+
+class Renderer(object):
+ """Class for handling all rendering operations on a scene.
+
+ Note
+ ----
+ This renderer relies on the existence of an OpenGL context and
+ does not create one on its own.
+
+ Parameters
+ ----------
+ viewport_width : int
+ Width of the viewport in pixels.
+ viewport_height : int
+ Width of the viewport height in pixels.
+ point_size : float, optional
+ Size of points in pixels. Defaults to 1.0.
+ """
+
+ def __init__(self, viewport_width, viewport_height, point_size=1.0):
+ self.dpscale = 1
+ # Scaling needed on retina displays
+ if sys.platform == 'darwin':
+ self.dpscale = 2
+
+ self.viewport_width = viewport_width
+ self.viewport_height = viewport_height
+ self.point_size = point_size
+
+ # Optional framebuffer for offscreen renders
+ self._main_fb = None
+ self._main_cb = None
+ self._main_db = None
+ self._main_fb_ms = None
+ self._main_cb_ms = None
+ self._main_db_ms = None
+ self._main_fb_dims = (None, None)
+ self._shadow_fb = None
+ self._latest_znear = DEFAULT_Z_NEAR
+ self._latest_zfar = DEFAULT_Z_FAR
+
+ # Shader Program Cache
+ self._program_cache = ShaderProgramCache()
+ self._font_cache = FontCache()
+ self._meshes = set()
+ self._mesh_textures = set()
+ self._shadow_textures = set()
+ self._texture_alloc_idx = 0
+
+ @property
+ def viewport_width(self):
+ """int : The width of the main viewport, in pixels.
+ """
+ return self._viewport_width
+
+ @viewport_width.setter
+ def viewport_width(self, value):
+ self._viewport_width = self.dpscale * value
+
+ @property
+ def viewport_height(self):
+ """int : The height of the main viewport, in pixels.
+ """
+ return self._viewport_height
+
+ @viewport_height.setter
+ def viewport_height(self, value):
+ self._viewport_height = self.dpscale * value
+
+ @property
+ def point_size(self):
+ """float : The size of screen-space points, in pixels.
+ """
+ return self._point_size
+
+ @point_size.setter
+ def point_size(self, value):
+ self._point_size = float(value)
+
+ def render(self, scene, flags, seg_node_map=None):
+ """Render a scene with the given set of flags.
+
+ Parameters
+ ----------
+ scene : :class:`Scene`
+ A scene to render.
+ flags : int
+ A specification from :class:`.RenderFlags`.
+ seg_node_map : dict
+ A map from :class:`.Node` objects to (3,) colors for each.
+ If specified along with flags set to :attr:`.RenderFlags.SEG`,
+ the color image will be a segmentation image.
+
+ Returns
+ -------
+ color_im : (h, w, 3) uint8 or (h, w, 4) uint8
+ If :attr:`RenderFlags.OFFSCREEN` is set, the color buffer. This is
+ normally an RGB buffer, but if :attr:`.RenderFlags.RGBA` is set,
+ the buffer will be a full RGBA buffer.
+ depth_im : (h, w) float32
+ If :attr:`RenderFlags.OFFSCREEN` is set, the depth buffer
+ in linear units.
+ """
+ # Update context with meshes and textures
+ self._update_context(scene, flags)
+
+ # Render necessary shadow maps
+ if not bool(flags & RenderFlags.DEPTH_ONLY or flags & RenderFlags.SEG):
+ for ln in scene.light_nodes:
+ take_pass = False
+ if (isinstance(ln.light, DirectionalLight) and
+ bool(flags & RenderFlags.SHADOWS_DIRECTIONAL)):
+ take_pass = True
+ elif (isinstance(ln.light, SpotLight) and
+ bool(flags & RenderFlags.SHADOWS_SPOT)):
+ take_pass = True
+ elif (isinstance(ln.light, PointLight) and
+ bool(flags & RenderFlags.SHADOWS_POINT)):
+ take_pass = True
+ if take_pass:
+ self._shadow_mapping_pass(scene, ln, flags)
+
+ # Make forward pass
+ retval = self._forward_pass(scene, flags, seg_node_map=seg_node_map)
+
+ # If necessary, make normals pass
+ if flags & (RenderFlags.VERTEX_NORMALS | RenderFlags.FACE_NORMALS):
+ self._normals_pass(scene, flags)
+
+ # Update camera settings for retrieving depth buffers
+ self._latest_znear = scene.main_camera_node.camera.znear
+ self._latest_zfar = scene.main_camera_node.camera.zfar
+
+ return retval
+
+ def render_text(self, text, x, y, font_name='OpenSans-Regular',
+ font_pt=40, color=None, scale=1.0,
+ align=TextAlign.BOTTOM_LEFT):
+ """Render text into the current viewport.
+
+ Note
+ ----
+ This cannot be done into an offscreen buffer.
+
+ Parameters
+ ----------
+ text : str
+ The text to render.
+ x : int
+ Horizontal pixel location of text.
+ y : int
+ Vertical pixel location of text.
+ font_name : str
+ Name of font, from the ``pyrender/fonts`` folder, or
+ a path to a ``.ttf`` file.
+ font_pt : int
+ Height of the text, in font points.
+ color : (4,) float
+ The color of the text. Default is black.
+ scale : int
+ Scaling factor for text.
+ align : int
+ One of the :class:`TextAlign` options which specifies where the
+ ``x`` and ``y`` parameters lie on the text. For example,
+ :attr:`TextAlign.BOTTOM_LEFT` means that ``x`` and ``y`` indicate
+ the position of the bottom-left corner of the textbox.
+ """
+ x *= self.dpscale
+ y *= self.dpscale
+ font_pt *= self.dpscale
+
+ if color is None:
+ color = np.array([0.0, 0.0, 0.0, 1.0])
+ else:
+ color = format_color_vector(color, 4)
+
+ # Set up viewport for render
+ self._configure_forward_pass_viewport(0)
+
+ # Load font
+ font = self._font_cache.get_font(font_name, font_pt)
+ if not font._in_context():
+ font._add_to_context()
+
+ # Load program
+ program = self._get_text_program()
+ program._bind()
+
+ # Set uniforms
+ p = np.eye(4)
+ p[0,0] = 2.0 / self.viewport_width
+ p[0,3] = -1.0
+ p[1,1] = 2.0 / self.viewport_height
+ p[1,3] = -1.0
+ program.set_uniform('projection', p)
+ program.set_uniform('text_color', color)
+
+ # Draw text
+ font.render_string(text, x, y, scale, align)
+
+ def read_color_buf(self):
+ """Read and return the current viewport's color buffer.
+
+ Alpha cannot be computed for an on-screen buffer.
+
+ Returns
+ -------
+ color_im : (h, w, 3) uint8
+ The color buffer in RGB byte format.
+ """
+ # Extract color image from frame buffer
+ width, height = self.viewport_width, self.viewport_height
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0)
+ glReadBuffer(GL_FRONT)
+ color_buf = glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE)
+
+ # Re-format them into numpy arrays
+ color_im = np.frombuffer(color_buf, dtype=np.uint8)
+ color_im = color_im.reshape((height, width, 3))
+ color_im = np.flip(color_im, axis=0)
+
+ # Resize for macos if needed
+ if sys.platform == 'darwin':
+ color_im = self._resize_image(color_im, True)
+
+ return color_im
+
+ def read_depth_buf(self):
+ """Read and return the current viewport's color buffer.
+
+ Returns
+ -------
+ depth_im : (h, w) float32
+ The depth buffer in linear units.
+ """
+ width, height = self.viewport_width, self.viewport_height
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, 0)
+ glReadBuffer(GL_FRONT)
+ depth_buf = glReadPixels(
+ 0, 0, width, height, GL_DEPTH_COMPONENT, GL_FLOAT
+ )
+
+ depth_im = np.frombuffer(depth_buf, dtype=np.float32)
+ depth_im = depth_im.reshape((height, width))
+ depth_im = np.flip(depth_im, axis=0)
+
+ inf_inds = (depth_im == 1.0)
+ depth_im = 2.0 * depth_im - 1.0
+ z_near, z_far = self._latest_znear, self._latest_zfar
+ noninf = np.logical_not(inf_inds)
+ if z_far is None:
+ depth_im[noninf] = 2 * z_near / (1.0 - depth_im[noninf])
+ else:
+ depth_im[noninf] = ((2.0 * z_near * z_far) /
+ (z_far + z_near - depth_im[noninf] *
+ (z_far - z_near)))
+ depth_im[inf_inds] = 0.0
+
+ # Resize for macos if needed
+ if sys.platform == 'darwin':
+ depth_im = self._resize_image(depth_im)
+
+ return depth_im
+
+ def delete(self):
+ """Free all allocated OpenGL resources.
+ """
+ # Free shaders
+ self._program_cache.clear()
+
+ # Free fonts
+ self._font_cache.clear()
+
+ # Free meshes
+ for mesh in self._meshes:
+ for p in mesh.primitives:
+ p.delete()
+
+ # Free textures
+ for mesh_texture in self._mesh_textures:
+ mesh_texture.delete()
+
+ for shadow_texture in self._shadow_textures:
+ shadow_texture.delete()
+
+ self._meshes = set()
+ self._mesh_textures = set()
+ self._shadow_textures = set()
+ self._texture_alloc_idx = 0
+
+ self._delete_main_framebuffer()
+ self._delete_shadow_framebuffer()
+
+ def __del__(self):
+ try:
+ self.delete()
+ except Exception:
+ pass
+
+ ###########################################################################
+ # Rendering passes
+ ###########################################################################
+
+ def _forward_pass(self, scene, flags, seg_node_map=None):
+ # Set up viewport for render
+ self._configure_forward_pass_viewport(flags)
+
+ # Clear it
+ if bool(flags & RenderFlags.SEG):
+ glClearColor(0.0, 0.0, 0.0, 1.0)
+ if seg_node_map is None:
+ seg_node_map = {}
+ else:
+ glClearColor(*scene.bg_color)
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
+
+ if not bool(flags & RenderFlags.SEG):
+ glEnable(GL_MULTISAMPLE)
+ else:
+ glDisable(GL_MULTISAMPLE)
+
+ # Set up camera matrices
+ V, P = self._get_camera_matrices(scene)
+
+ program = None
+ # Now, render each object in sorted order
+ for node in self._sorted_mesh_nodes(scene):
+ mesh = node.mesh
+
+ # Skip the mesh if it's not visible
+ if not mesh.is_visible:
+ continue
+
+ # If SEG, set color
+ if bool(flags & RenderFlags.SEG):
+ if node not in seg_node_map:
+ continue
+ color = seg_node_map[node]
+ if not isinstance(color, (list, tuple, np.ndarray)):
+ color = np.repeat(color, 3)
+ else:
+ color = np.asanyarray(color)
+ color = color / 255.0
+
+ for primitive in mesh.primitives:
+
+ # First, get and bind the appropriate program
+ program = self._get_primitive_program(
+ primitive, flags, ProgramFlags.USE_MATERIAL
+ )
+ program._bind()
+
+ # Set the camera uniforms
+ program.set_uniform('V', V)
+ program.set_uniform('P', P)
+ program.set_uniform(
+ 'cam_pos', scene.get_pose(scene.main_camera_node)[:3,3]
+ )
+ if bool(flags & RenderFlags.SEG):
+ program.set_uniform('color', color)
+
+ # Next, bind the lighting
+ if not (flags & RenderFlags.DEPTH_ONLY or flags & RenderFlags.FLAT or
+ flags & RenderFlags.SEG):
+ self._bind_lighting(scene, program, node, flags)
+
+ # Finally, bind and draw the primitive
+ self._bind_and_draw_primitive(
+ primitive=primitive,
+ pose=scene.get_pose(node),
+ program=program,
+ flags=flags
+ )
+ self._reset_active_textures()
+
+ # Unbind the shader and flush the output
+ if program is not None:
+ program._unbind()
+ glFlush()
+
+ # If doing offscreen render, copy result from framebuffer and return
+ if flags & RenderFlags.OFFSCREEN:
+ return self._read_main_framebuffer(scene, flags)
+ else:
+ return
+
+ def _shadow_mapping_pass(self, scene, light_node, flags):
+ light = light_node.light
+
+ # Set up viewport for render
+ self._configure_shadow_mapping_viewport(light, flags)
+
+ # Set up camera matrices
+ V, P = self._get_light_cam_matrices(scene, light_node, flags)
+
+ # Now, render each object in sorted order
+ for node in self._sorted_mesh_nodes(scene):
+ mesh = node.mesh
+
+ # Skip the mesh if it's not visible
+ if not mesh.is_visible:
+ continue
+
+ for primitive in mesh.primitives:
+
+ # First, get and bind the appropriate program
+ program = self._get_primitive_program(
+ primitive, flags, ProgramFlags.NONE
+ )
+ program._bind()
+
+ # Set the camera uniforms
+ program.set_uniform('V', V)
+ program.set_uniform('P', P)
+ program.set_uniform(
+ 'cam_pos', scene.get_pose(scene.main_camera_node)[:3,3]
+ )
+
+ # Finally, bind and draw the primitive
+ self._bind_and_draw_primitive(
+ primitive=primitive,
+ pose=scene.get_pose(node),
+ program=program,
+ flags=RenderFlags.DEPTH_ONLY
+ )
+ self._reset_active_textures()
+
+ # Unbind the shader and flush the output
+ if program is not None:
+ program._unbind()
+ glFlush()
+
+ def _normals_pass(self, scene, flags):
+ # Set up viewport for render
+ self._configure_forward_pass_viewport(flags)
+ program = None
+
+ # Set up camera matrices
+ V, P = self._get_camera_matrices(scene)
+
+ # Now, render each object in sorted order
+ for node in self._sorted_mesh_nodes(scene):
+ mesh = node.mesh
+
+ # Skip the mesh if it's not visible
+ if not mesh.is_visible:
+ continue
+
+ for primitive in mesh.primitives:
+
+ # Skip objects that don't have normals
+ if not primitive.buf_flags & BufFlags.NORMAL:
+ continue
+
+ # First, get and bind the appropriate program
+ pf = ProgramFlags.NONE
+ if flags & RenderFlags.VERTEX_NORMALS:
+ pf = pf | ProgramFlags.VERTEX_NORMALS
+ if flags & RenderFlags.FACE_NORMALS:
+ pf = pf | ProgramFlags.FACE_NORMALS
+ program = self._get_primitive_program(primitive, flags, pf)
+ program._bind()
+
+ # Set the camera uniforms
+ program.set_uniform('V', V)
+ program.set_uniform('P', P)
+ program.set_uniform('normal_magnitude', 0.05 * primitive.scale)
+ program.set_uniform(
+ 'normal_color', np.array([0.1, 0.1, 1.0, 1.0])
+ )
+
+ # Finally, bind and draw the primitive
+ self._bind_and_draw_primitive(
+ primitive=primitive,
+ pose=scene.get_pose(node),
+ program=program,
+ flags=RenderFlags.DEPTH_ONLY
+ )
+ self._reset_active_textures()
+
+ # Unbind the shader and flush the output
+ if program is not None:
+ program._unbind()
+ glFlush()
+
+ ###########################################################################
+ # Handlers for binding uniforms and drawing primitives
+ ###########################################################################
+
+ def _bind_and_draw_primitive(self, primitive, pose, program, flags):
+ # Set model pose matrix
+ program.set_uniform('M', pose)
+
+ # Bind mesh buffers
+ primitive._bind()
+
+ # Bind mesh material
+ if not (flags & RenderFlags.DEPTH_ONLY or flags & RenderFlags.SEG):
+ material = primitive.material
+
+ # Bind textures
+ tf = material.tex_flags
+ if tf & TexFlags.NORMAL:
+ self._bind_texture(material.normalTexture,
+ 'material.normal_texture', program)
+ if tf & TexFlags.OCCLUSION:
+ self._bind_texture(material.occlusionTexture,
+ 'material.occlusion_texture', program)
+ if tf & TexFlags.EMISSIVE:
+ self._bind_texture(material.emissiveTexture,
+ 'material.emissive_texture', program)
+ if tf & TexFlags.BASE_COLOR:
+ self._bind_texture(material.baseColorTexture,
+ 'material.base_color_texture', program)
+ if tf & TexFlags.METALLIC_ROUGHNESS:
+ self._bind_texture(material.metallicRoughnessTexture,
+ 'material.metallic_roughness_texture',
+ program)
+ if tf & TexFlags.DIFFUSE:
+ self._bind_texture(material.diffuseTexture,
+ 'material.diffuse_texture', program)
+ if tf & TexFlags.SPECULAR_GLOSSINESS:
+ self._bind_texture(material.specularGlossinessTexture,
+ 'material.specular_glossiness_texture',
+ program)
+
+ # Bind other uniforms
+ b = 'material.{}'
+ program.set_uniform(b.format('emissive_factor'),
+ material.emissiveFactor)
+ if isinstance(material, MetallicRoughnessMaterial):
+ program.set_uniform(b.format('base_color_factor'),
+ material.baseColorFactor)
+ program.set_uniform(b.format('metallic_factor'),
+ material.metallicFactor)
+ program.set_uniform(b.format('roughness_factor'),
+ material.roughnessFactor)
+ elif isinstance(material, SpecularGlossinessMaterial):
+ program.set_uniform(b.format('diffuse_factor'),
+ material.diffuseFactor)
+ program.set_uniform(b.format('specular_factor'),
+ material.specularFactor)
+ program.set_uniform(b.format('glossiness_factor'),
+ material.glossinessFactor)
+
+ # Set blending options
+ if material.alphaMode == 'BLEND':
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+ else:
+ glEnable(GL_BLEND)
+ glBlendFunc(GL_ONE, GL_ZERO)
+
+ # Set wireframe mode
+ wf = material.wireframe
+ if flags & RenderFlags.FLIP_WIREFRAME:
+ wf = not wf
+ if (flags & RenderFlags.ALL_WIREFRAME) or wf:
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
+ else:
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
+
+ # Set culling mode
+ if material.doubleSided or flags & RenderFlags.SKIP_CULL_FACES:
+ glDisable(GL_CULL_FACE)
+ else:
+ glEnable(GL_CULL_FACE)
+ glCullFace(GL_BACK)
+ else:
+ glEnable(GL_CULL_FACE)
+ glEnable(GL_BLEND)
+ glCullFace(GL_BACK)
+ glBlendFunc(GL_ONE, GL_ZERO)
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
+
+ # Set point size if needed
+ glDisable(GL_PROGRAM_POINT_SIZE)
+ if primitive.mode == GLTF.POINTS:
+ glEnable(GL_PROGRAM_POINT_SIZE)
+ glPointSize(self.point_size)
+
+ # Render mesh
+ n_instances = 1
+ if primitive.poses is not None:
+ n_instances = len(primitive.poses)
+
+ if primitive.indices is not None:
+ glDrawElementsInstanced(
+ primitive.mode, primitive.indices.size, GL_UNSIGNED_INT,
+ ctypes.c_void_p(0), n_instances
+ )
+ else:
+ glDrawArraysInstanced(
+ primitive.mode, 0, len(primitive.positions), n_instances
+ )
+
+ # Unbind mesh buffers
+ primitive._unbind()
+
+ def _bind_lighting(self, scene, program, node, flags):
+ """Bind all lighting uniform values for a scene.
+ """
+ max_n_lights = self._compute_max_n_lights(flags)
+
+ n_d = min(len(scene.directional_light_nodes), max_n_lights[0])
+ n_s = min(len(scene.spot_light_nodes), max_n_lights[1])
+ n_p = min(len(scene.point_light_nodes), max_n_lights[2])
+ program.set_uniform('ambient_light', scene.ambient_light)
+ program.set_uniform('n_directional_lights', n_d)
+ program.set_uniform('n_spot_lights', n_s)
+ program.set_uniform('n_point_lights', n_p)
+ plc = 0
+ slc = 0
+ dlc = 0
+
+ light_nodes = scene.light_nodes
+ if (len(scene.directional_light_nodes) > max_n_lights[0] or
+ len(scene.spot_light_nodes) > max_n_lights[1] or
+ len(scene.point_light_nodes) > max_n_lights[2]):
+ light_nodes = self._sorted_nodes_by_distance(
+ scene, scene.light_nodes, node
+ )
+
+ for n in light_nodes:
+ light = n.light
+ pose = scene.get_pose(n)
+ position = pose[:3,3]
+ direction = -pose[:3,2]
+
+ if isinstance(light, PointLight):
+ if plc == max_n_lights[2]:
+ continue
+ b = 'point_lights[{}].'.format(plc)
+ plc += 1
+ shadow = bool(flags & RenderFlags.SHADOWS_POINT)
+ program.set_uniform(b + 'position', position)
+ elif isinstance(light, SpotLight):
+ if slc == max_n_lights[1]:
+ continue
+ b = 'spot_lights[{}].'.format(slc)
+ slc += 1
+ shadow = bool(flags & RenderFlags.SHADOWS_SPOT)
+ las = 1.0 / max(0.001, np.cos(light.innerConeAngle) -
+ np.cos(light.outerConeAngle))
+ lao = -np.cos(light.outerConeAngle) * las
+ program.set_uniform(b + 'direction', direction)
+ program.set_uniform(b + 'position', position)
+ program.set_uniform(b + 'light_angle_scale', las)
+ program.set_uniform(b + 'light_angle_offset', lao)
+ else:
+ if dlc == max_n_lights[0]:
+ continue
+ b = 'directional_lights[{}].'.format(dlc)
+ dlc += 1
+ shadow = bool(flags & RenderFlags.SHADOWS_DIRECTIONAL)
+ program.set_uniform(b + 'direction', direction)
+
+ program.set_uniform(b + 'color', light.color)
+ program.set_uniform(b + 'intensity', light.intensity)
+ # if light.range is not None:
+ # program.set_uniform(b + 'range', light.range)
+ # else:
+ # program.set_uniform(b + 'range', 0)
+
+ if shadow:
+ self._bind_texture(light.shadow_texture,
+ b + 'shadow_map', program)
+ if not isinstance(light, PointLight):
+ V, P = self._get_light_cam_matrices(scene, n, flags)
+ program.set_uniform(b + 'light_matrix', P.dot(V))
+ else:
+ raise NotImplementedError(
+ 'Point light shadows not implemented'
+ )
+
+ def _sorted_mesh_nodes(self, scene):
+ cam_loc = scene.get_pose(scene.main_camera_node)[:3,3]
+ solid_nodes = []
+ trans_nodes = []
+ for node in scene.mesh_nodes:
+ mesh = node.mesh
+ if mesh.is_transparent:
+ trans_nodes.append(node)
+ else:
+ solid_nodes.append(node)
+
+ # TODO BETTER SORTING METHOD
+ trans_nodes.sort(
+ key=lambda n: -np.linalg.norm(scene.get_pose(n)[:3,3] - cam_loc)
+ )
+ solid_nodes.sort(
+ key=lambda n: -np.linalg.norm(scene.get_pose(n)[:3,3] - cam_loc)
+ )
+
+ return solid_nodes + trans_nodes
+
+ def _sorted_nodes_by_distance(self, scene, nodes, compare_node):
+ nodes = list(nodes)
+ compare_posn = scene.get_pose(compare_node)[:3,3]
+ nodes.sort(key=lambda n: np.linalg.norm(
+ scene.get_pose(n)[:3,3] - compare_posn)
+ )
+ return nodes
+
+ ###########################################################################
+ # Context Management
+ ###########################################################################
+
+ def _update_context(self, scene, flags):
+
+ # Update meshes
+ scene_meshes = scene.meshes
+
+ # Add new meshes to context
+ for mesh in scene_meshes - self._meshes:
+ for p in mesh.primitives:
+ p._add_to_context()
+
+ # Remove old meshes from context
+ for mesh in self._meshes - scene_meshes:
+ for p in mesh.primitives:
+ p.delete()
+
+ self._meshes = scene_meshes.copy()
+
+ # Update mesh textures
+ mesh_textures = set()
+ for m in scene_meshes:
+ for p in m.primitives:
+ mesh_textures |= p.material.textures
+
+ # Add new textures to context
+ for texture in mesh_textures - self._mesh_textures:
+ texture._add_to_context()
+
+ # Remove old textures from context
+ for texture in self._mesh_textures - mesh_textures:
+ texture.delete()
+
+ self._mesh_textures = mesh_textures.copy()
+
+ shadow_textures = set()
+ for l in scene.lights:
+ # Create if needed
+ active = False
+ if (isinstance(l, DirectionalLight) and
+ flags & RenderFlags.SHADOWS_DIRECTIONAL):
+ active = True
+ elif (isinstance(l, PointLight) and
+ flags & RenderFlags.SHADOWS_POINT):
+ active = True
+ elif isinstance(l, SpotLight) and flags & RenderFlags.SHADOWS_SPOT:
+ active = True
+
+ if active and l.shadow_texture is None:
+ l._generate_shadow_texture()
+ if l.shadow_texture is not None:
+ shadow_textures.add(l.shadow_texture)
+
+ # Add new textures to context
+ for texture in shadow_textures - self._shadow_textures:
+ texture._add_to_context()
+
+ # Remove old textures from context
+ for texture in self._shadow_textures - shadow_textures:
+ texture.delete()
+
+ self._shadow_textures = shadow_textures.copy()
+
+ ###########################################################################
+ # Texture Management
+ ###########################################################################
+
+ def _bind_texture(self, texture, uniform_name, program):
+ """Bind a texture to an active texture unit and return
+ the texture unit index that was used.
+ """
+ tex_id = self._get_next_active_texture()
+ glActiveTexture(GL_TEXTURE0 + tex_id)
+ texture._bind()
+ program.set_uniform(uniform_name, tex_id)
+
+ def _get_next_active_texture(self):
+ val = self._texture_alloc_idx
+ self._texture_alloc_idx += 1
+ return val
+
+ def _reset_active_textures(self):
+ self._texture_alloc_idx = 0
+
+ ###########################################################################
+ # Camera Matrix Management
+ ###########################################################################
+
+ def _get_camera_matrices(self, scene):
+ main_camera_node = scene.main_camera_node
+ if main_camera_node is None:
+ raise ValueError('Cannot render scene without a camera')
+ P = main_camera_node.camera.get_projection_matrix(
+ width=self.viewport_width, height=self.viewport_height
+ )
+ pose = scene.get_pose(main_camera_node)
+ V = np.linalg.inv(pose) # V maps from world to camera
+ return V, P
+
+ def _get_light_cam_matrices(self, scene, light_node, flags):
+ light = light_node.light
+ pose = scene.get_pose(light_node).copy()
+ s = scene.scale
+ camera = light._get_shadow_camera(s)
+ P = camera.get_projection_matrix()
+ if isinstance(light, DirectionalLight):
+ direction = -pose[:3,2]
+ c = scene.centroid
+ loc = c - direction * s
+ pose[:3,3] = loc
+ V = np.linalg.inv(pose) # V maps from world to camera
+ return V, P
+
+ ###########################################################################
+ # Shader Program Management
+ ###########################################################################
+
+ def _get_text_program(self):
+ program = self._program_cache.get_program(
+ vertex_shader='text.vert',
+ fragment_shader='text.frag'
+ )
+
+ if not program._in_context():
+ program._add_to_context()
+
+ return program
+
+ def _compute_max_n_lights(self, flags):
+ max_n_lights = [MAX_N_LIGHTS, MAX_N_LIGHTS, MAX_N_LIGHTS]
+ n_tex_units = glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS)
+
+ # Reserved texture units: 6
+ # Normal Map
+ # Occlusion Map
+ # Emissive Map
+ # Base Color or Diffuse Map
+ # MR or SG Map
+ # Environment cubemap
+
+ n_reserved_textures = 6
+ n_available_textures = n_tex_units - n_reserved_textures
+
+ # Distribute textures evenly among lights with shadows, with
+ # a preference for directional lights
+ n_shadow_types = 0
+ if flags & RenderFlags.SHADOWS_DIRECTIONAL:
+ n_shadow_types += 1
+ if flags & RenderFlags.SHADOWS_SPOT:
+ n_shadow_types += 1
+ if flags & RenderFlags.SHADOWS_POINT:
+ n_shadow_types += 1
+
+ if n_shadow_types > 0:
+ tex_per_light = n_available_textures // n_shadow_types
+
+ if flags & RenderFlags.SHADOWS_DIRECTIONAL:
+ max_n_lights[0] = (
+ tex_per_light +
+ (n_available_textures - tex_per_light * n_shadow_types)
+ )
+ if flags & RenderFlags.SHADOWS_SPOT:
+ max_n_lights[1] = tex_per_light
+ if flags & RenderFlags.SHADOWS_POINT:
+ max_n_lights[2] = tex_per_light
+
+ return max_n_lights
+
+ def _get_primitive_program(self, primitive, flags, program_flags):
+ vertex_shader = None
+ fragment_shader = None
+ geometry_shader = None
+ defines = {}
+
+ if (bool(program_flags & ProgramFlags.USE_MATERIAL) and
+ not flags & RenderFlags.DEPTH_ONLY and
+ not flags & RenderFlags.FLAT and
+ not flags & RenderFlags.SEG):
+ vertex_shader = 'mesh.vert'
+ fragment_shader = 'mesh.frag'
+ elif bool(program_flags & (ProgramFlags.VERTEX_NORMALS |
+ ProgramFlags.FACE_NORMALS)):
+ vertex_shader = 'vertex_normals.vert'
+ if primitive.mode == GLTF.POINTS:
+ geometry_shader = 'vertex_normals_pc.geom'
+ else:
+ geometry_shader = 'vertex_normals.geom'
+ fragment_shader = 'vertex_normals.frag'
+ elif flags & RenderFlags.FLAT:
+ vertex_shader = 'flat.vert'
+ fragment_shader = 'flat.frag'
+ elif flags & RenderFlags.SEG:
+ vertex_shader = 'segmentation.vert'
+ fragment_shader = 'segmentation.frag'
+ else:
+ vertex_shader = 'mesh_depth.vert'
+ fragment_shader = 'mesh_depth.frag'
+
+ # Set up vertex buffer DEFINES
+ bf = primitive.buf_flags
+ buf_idx = 1
+ if bf & BufFlags.NORMAL:
+ defines['NORMAL_LOC'] = buf_idx
+ buf_idx += 1
+ if bf & BufFlags.TANGENT:
+ defines['TANGENT_LOC'] = buf_idx
+ buf_idx += 1
+ if bf & BufFlags.TEXCOORD_0:
+ defines['TEXCOORD_0_LOC'] = buf_idx
+ buf_idx += 1
+ if bf & BufFlags.TEXCOORD_1:
+ defines['TEXCOORD_1_LOC'] = buf_idx
+ buf_idx += 1
+ if bf & BufFlags.COLOR_0:
+ defines['COLOR_0_LOC'] = buf_idx
+ buf_idx += 1
+ if bf & BufFlags.JOINTS_0:
+ defines['JOINTS_0_LOC'] = buf_idx
+ buf_idx += 1
+ if bf & BufFlags.WEIGHTS_0:
+ defines['WEIGHTS_0_LOC'] = buf_idx
+ buf_idx += 1
+ defines['INST_M_LOC'] = buf_idx
+
+ # Set up shadow mapping defines
+ if flags & RenderFlags.SHADOWS_DIRECTIONAL:
+ defines['DIRECTIONAL_LIGHT_SHADOWS'] = 1
+ if flags & RenderFlags.SHADOWS_SPOT:
+ defines['SPOT_LIGHT_SHADOWS'] = 1
+ if flags & RenderFlags.SHADOWS_POINT:
+ defines['POINT_LIGHT_SHADOWS'] = 1
+ max_n_lights = self._compute_max_n_lights(flags)
+ defines['MAX_DIRECTIONAL_LIGHTS'] = max_n_lights[0]
+ defines['MAX_SPOT_LIGHTS'] = max_n_lights[1]
+ defines['MAX_POINT_LIGHTS'] = max_n_lights[2]
+
+ # Set up vertex normal defines
+ if program_flags & ProgramFlags.VERTEX_NORMALS:
+ defines['VERTEX_NORMALS'] = 1
+ if program_flags & ProgramFlags.FACE_NORMALS:
+ defines['FACE_NORMALS'] = 1
+
+ # Set up material texture defines
+ if bool(program_flags & ProgramFlags.USE_MATERIAL):
+ tf = primitive.material.tex_flags
+ if tf & TexFlags.NORMAL:
+ defines['HAS_NORMAL_TEX'] = 1
+ if tf & TexFlags.OCCLUSION:
+ defines['HAS_OCCLUSION_TEX'] = 1
+ if tf & TexFlags.EMISSIVE:
+ defines['HAS_EMISSIVE_TEX'] = 1
+ if tf & TexFlags.BASE_COLOR:
+ defines['HAS_BASE_COLOR_TEX'] = 1
+ if tf & TexFlags.METALLIC_ROUGHNESS:
+ defines['HAS_METALLIC_ROUGHNESS_TEX'] = 1
+ if tf & TexFlags.DIFFUSE:
+ defines['HAS_DIFFUSE_TEX'] = 1
+ if tf & TexFlags.SPECULAR_GLOSSINESS:
+ defines['HAS_SPECULAR_GLOSSINESS_TEX'] = 1
+ if isinstance(primitive.material, MetallicRoughnessMaterial):
+ defines['USE_METALLIC_MATERIAL'] = 1
+ elif isinstance(primitive.material, SpecularGlossinessMaterial):
+ defines['USE_GLOSSY_MATERIAL'] = 1
+
+ program = self._program_cache.get_program(
+ vertex_shader=vertex_shader,
+ fragment_shader=fragment_shader,
+ geometry_shader=geometry_shader,
+ defines=defines
+ )
+
+ if not program._in_context():
+ program._add_to_context()
+
+ return program
+
+ ###########################################################################
+ # Viewport Management
+ ###########################################################################
+
+ def _configure_forward_pass_viewport(self, flags):
+
+ # If using offscreen render, bind main framebuffer
+ if flags & RenderFlags.OFFSCREEN:
+ self._configure_main_framebuffer()
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, self._main_fb_ms)
+ else:
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0)
+
+ glViewport(0, 0, self.viewport_width, self.viewport_height)
+ glEnable(GL_DEPTH_TEST)
+ glDepthMask(GL_TRUE)
+ glDepthFunc(GL_LESS)
+ glDepthRange(0.0, 1.0)
+
+ def _configure_shadow_mapping_viewport(self, light, flags):
+ self._configure_shadow_framebuffer()
+ glBindFramebuffer(GL_FRAMEBUFFER, self._shadow_fb)
+ light.shadow_texture._bind()
+ light.shadow_texture._bind_as_depth_attachment()
+ glActiveTexture(GL_TEXTURE0)
+ light.shadow_texture._bind()
+ glDrawBuffer(GL_NONE)
+ glReadBuffer(GL_NONE)
+
+ glClear(GL_DEPTH_BUFFER_BIT)
+ glViewport(0, 0, SHADOW_TEX_SZ, SHADOW_TEX_SZ)
+ glEnable(GL_DEPTH_TEST)
+ glDepthMask(GL_TRUE)
+ glDepthFunc(GL_LESS)
+ glDepthRange(0.0, 1.0)
+ glDisable(GL_CULL_FACE)
+ glDisable(GL_BLEND)
+
+ ###########################################################################
+ # Framebuffer Management
+ ###########################################################################
+
+ def _configure_shadow_framebuffer(self):
+ if self._shadow_fb is None:
+ self._shadow_fb = glGenFramebuffers(1)
+
+ def _delete_shadow_framebuffer(self):
+ if self._shadow_fb is not None:
+ glDeleteFramebuffers(1, [self._shadow_fb])
+
+ def _configure_main_framebuffer(self):
+ # If mismatch with prior framebuffer, delete it
+ if (self._main_fb is not None and
+ self.viewport_width != self._main_fb_dims[0] or
+ self.viewport_height != self._main_fb_dims[1]):
+ self._delete_main_framebuffer()
+
+ # If framebuffer doesn't exist, create it
+ if self._main_fb is None:
+ # Generate standard buffer
+ self._main_cb, self._main_db = glGenRenderbuffers(2)
+
+ glBindRenderbuffer(GL_RENDERBUFFER, self._main_cb)
+ glRenderbufferStorage(
+ GL_RENDERBUFFER, GL_RGBA,
+ self.viewport_width, self.viewport_height
+ )
+
+ glBindRenderbuffer(GL_RENDERBUFFER, self._main_db)
+ glRenderbufferStorage(
+ GL_RENDERBUFFER, GL_DEPTH_COMPONENT24,
+ self.viewport_width, self.viewport_height
+ )
+
+ self._main_fb = glGenFramebuffers(1)
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, self._main_fb)
+ glFramebufferRenderbuffer(
+ GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, self._main_cb
+ )
+ glFramebufferRenderbuffer(
+ GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_RENDERBUFFER, self._main_db
+ )
+
+ # Generate multisample buffer
+ self._main_cb_ms, self._main_db_ms = glGenRenderbuffers(2)
+ glBindRenderbuffer(GL_RENDERBUFFER, self._main_cb_ms)
+ # glRenderbufferStorageMultisample(
+ # GL_RENDERBUFFER, 4, GL_RGBA,
+ # self.viewport_width, self.viewport_height
+ # )
+ # glBindRenderbuffer(GL_RENDERBUFFER, self._main_db_ms)
+ # glRenderbufferStorageMultisample(
+ # GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT24,
+ # self.viewport_width, self.viewport_height
+ # )
+ # 增加这一行
+ num_samples = min(glGetIntegerv(GL_MAX_SAMPLES), 4) # No more than GL_MAX_SAMPLES
+
+ # 其实就是把 4 替换成 num_samples,其余不变
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, num_samples, GL_RGBA, self.viewport_width, self.viewport_height)
+
+ glBindRenderbuffer(GL_RENDERBUFFER, self._main_db_ms) # 这行不变
+
+ # 这一行也是将 4 替换成 num_samples
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, num_samples, GL_DEPTH_COMPONENT24, self.viewport_width, self.viewport_height)
+
+ self._main_fb_ms = glGenFramebuffers(1)
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, self._main_fb_ms)
+ glFramebufferRenderbuffer(
+ GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_RENDERBUFFER, self._main_cb_ms
+ )
+ glFramebufferRenderbuffer(
+ GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ GL_RENDERBUFFER, self._main_db_ms
+ )
+
+ self._main_fb_dims = (self.viewport_width, self.viewport_height)
+
+ def _delete_main_framebuffer(self):
+ if self._main_fb is not None:
+ glDeleteFramebuffers(2, [self._main_fb, self._main_fb_ms])
+ if self._main_cb is not None:
+ glDeleteRenderbuffers(2, [self._main_cb, self._main_cb_ms])
+ if self._main_db is not None:
+ glDeleteRenderbuffers(2, [self._main_db, self._main_db_ms])
+
+ self._main_fb = None
+ self._main_cb = None
+ self._main_db = None
+ self._main_fb_ms = None
+ self._main_cb_ms = None
+ self._main_db_ms = None
+ self._main_fb_dims = (None, None)
+
+ def _read_main_framebuffer(self, scene, flags):
+ width, height = self._main_fb_dims[0], self._main_fb_dims[1]
+
+ # Bind framebuffer and blit buffers
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, self._main_fb_ms)
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, self._main_fb)
+ glBlitFramebuffer(
+ 0, 0, width, height, 0, 0, width, height,
+ GL_COLOR_BUFFER_BIT, GL_LINEAR
+ )
+ glBlitFramebuffer(
+ 0, 0, width, height, 0, 0, width, height,
+ GL_DEPTH_BUFFER_BIT, GL_NEAREST
+ )
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, self._main_fb)
+
+ # Read depth
+ depth_buf = glReadPixels(
+ 0, 0, width, height, GL_DEPTH_COMPONENT, GL_FLOAT
+ )
+ depth_im = np.frombuffer(depth_buf, dtype=np.float32)
+ depth_im = depth_im.reshape((height, width))
+ depth_im = np.flip(depth_im, axis=0)
+ inf_inds = (depth_im == 1.0)
+ depth_im = 2.0 * depth_im - 1.0
+ z_near = scene.main_camera_node.camera.znear
+ z_far = scene.main_camera_node.camera.zfar
+ noninf = np.logical_not(inf_inds)
+ if z_far is None:
+ depth_im[noninf] = 2 * z_near / (1.0 - depth_im[noninf])
+ else:
+ depth_im[noninf] = ((2.0 * z_near * z_far) /
+ (z_far + z_near - depth_im[noninf] *
+ (z_far - z_near)))
+ depth_im[inf_inds] = 0.0
+
+ # Resize for macos if needed
+ if sys.platform == 'darwin':
+ depth_im = self._resize_image(depth_im)
+
+ if flags & RenderFlags.DEPTH_ONLY:
+ return depth_im
+
+ # Read color
+ if flags & RenderFlags.RGBA:
+ color_buf = glReadPixels(
+ 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE
+ )
+ color_im = np.frombuffer(color_buf, dtype=np.uint8)
+ color_im = color_im.reshape((height, width, 4))
+ else:
+ color_buf = glReadPixels(
+ 0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE
+ )
+ color_im = np.frombuffer(color_buf, dtype=np.uint8)
+ color_im = color_im.reshape((height, width, 3))
+ color_im = np.flip(color_im, axis=0)
+
+ # Resize for macos if needed
+ if sys.platform == 'darwin':
+ color_im = self._resize_image(color_im, True)
+
+ return color_im, depth_im
+
+ def _resize_image(self, value, antialias=False):
+ """If needed, rescale the render for MacOS."""
+ img = PIL.Image.fromarray(value)
+ resample = PIL.Image.NEAREST
+ if antialias:
+ resample = PIL.Image.BILINEAR
+ size = (self.viewport_width // self.dpscale,
+ self.viewport_height // self.dpscale)
+ img = img.resize(size, resample=resample)
+ return np.array(img)
+
+ ###########################################################################
+ # Shadowmap Debugging
+ ###########################################################################
+
+ def _forward_pass_no_reset(self, scene, flags):
+ # Set up camera matrices
+ V, P = self._get_camera_matrices(scene)
+
+ # Now, render each object in sorted order
+ for node in self._sorted_mesh_nodes(scene):
+ mesh = node.mesh
+
+ # Skip the mesh if it's not visible
+ if not mesh.is_visible:
+ continue
+
+ for primitive in mesh.primitives:
+
+ # First, get and bind the appropriate program
+ program = self._get_primitive_program(
+ primitive, flags, ProgramFlags.USE_MATERIAL
+ )
+ program._bind()
+
+ # Set the camera uniforms
+ program.set_uniform('V', V)
+ program.set_uniform('P', P)
+ program.set_uniform(
+ 'cam_pos', scene.get_pose(scene.main_camera_node)[:3,3]
+ )
+
+ # Next, bind the lighting
+ if not flags & RenderFlags.DEPTH_ONLY and not flags & RenderFlags.FLAT:
+ self._bind_lighting(scene, program, node, flags)
+
+ # Finally, bind and draw the primitive
+ self._bind_and_draw_primitive(
+ primitive=primitive,
+ pose=scene.get_pose(node),
+ program=program,
+ flags=flags
+ )
+ self._reset_active_textures()
+
+ # Unbind the shader and flush the output
+ if program is not None:
+ program._unbind()
+ glFlush()
+
+ def _render_light_shadowmaps(self, scene, light_nodes, flags, tile=False):
+ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0)
+ glClearColor(*scene.bg_color)
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
+ glEnable(GL_DEPTH_TEST)
+ glDepthMask(GL_TRUE)
+ glDepthFunc(GL_LESS)
+ glDepthRange(0.0, 1.0)
+
+ w = self.viewport_width
+ h = self.viewport_height
+
+ num_nodes = len(light_nodes)
+ viewport_dims = {
+ (0, 2): [0, h // 2, w // 2, h],
+ (1, 2): [w // 2, h // 2, w, h],
+ (0, 3): [0, h // 2, w // 2, h],
+ (1, 3): [w // 2, h // 2, w, h],
+ (2, 3): [0, 0, w // 2, h // 2],
+ (0, 4): [0, h // 2, w // 2, h],
+ (1, 4): [w // 2, h // 2, w, h],
+ (2, 4): [0, 0, w // 2, h // 2],
+ (3, 4): [w // 2, 0, w, h // 2]
+ }
+
+ if tile:
+ for i, ln in enumerate(light_nodes):
+ light = ln.light
+
+ if light.shadow_texture is None:
+ raise ValueError('Light does not have a shadow texture')
+
+ glViewport(*viewport_dims[(i, num_nodes + 1)])
+
+ program = self._get_debug_quad_program()
+ program._bind()
+ self._bind_texture(light.shadow_texture, 'depthMap', program)
+ self._render_debug_quad()
+ self._reset_active_textures()
+ glFlush()
+ i += 1
+ glViewport(*viewport_dims[(i, num_nodes + 1)])
+ self._forward_pass_no_reset(scene, flags)
+ else:
+ for i, ln in enumerate(light_nodes):
+ light = ln.light
+
+ if light.shadow_texture is None:
+ raise ValueError('Light does not have a shadow texture')
+
+ glViewport(0, 0, self.viewport_width, self.viewport_height)
+
+ program = self._get_debug_quad_program()
+ program._bind()
+ self._bind_texture(light.shadow_texture, 'depthMap', program)
+ self._render_debug_quad()
+ self._reset_active_textures()
+ glFlush()
+ return
+
+ def _get_debug_quad_program(self):
+ program = self._program_cache.get_program(
+ vertex_shader='debug_quad.vert',
+ fragment_shader='debug_quad.frag'
+ )
+ if not program._in_context():
+ program._add_to_context()
+ return program
+
+ def _render_debug_quad(self):
+ x = glGenVertexArrays(1)
+ glBindVertexArray(x)
+ glDrawArrays(GL_TRIANGLES, 0, 6)
+ glBindVertexArray(0)
+ glDeleteVertexArrays(1, [x])
diff --git a/generate_human_motion/pyrender/pyrender/sampler.py b/generate_human_motion/pyrender/pyrender/sampler.py
new file mode 100644
index 0000000000000000000000000000000000000000..e4784d068f808a40a56c8e748d83175f7f4e6233
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/sampler.py
@@ -0,0 +1,102 @@
+"""Samplers, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-sampler
+
+Author: Matthew Matl
+"""
+from .constants import GLTF
+
+
+class Sampler(object):
+ """Texture sampler properties for filtering and wrapping modes.
+
+ Parameters
+ ----------
+ name : str, optional
+ The user-defined name of this object.
+ magFilter : int, optional
+ Magnification filter. Valid values:
+ - :attr:`.GLTF.NEAREST`
+ - :attr:`.GLTF.LINEAR`
+ minFilter : int, optional
+ Minification filter. Valid values:
+ - :attr:`.GLTF.NEAREST`
+ - :attr:`.GLTF.LINEAR`
+ - :attr:`.GLTF.NEAREST_MIPMAP_NEAREST`
+ - :attr:`.GLTF.LINEAR_MIPMAP_NEAREST`
+ - :attr:`.GLTF.NEAREST_MIPMAP_LINEAR`
+ - :attr:`.GLTF.LINEAR_MIPMAP_LINEAR`
+ wrapS : int, optional
+ S (U) wrapping mode. Valid values:
+ - :attr:`.GLTF.CLAMP_TO_EDGE`
+ - :attr:`.GLTF.MIRRORED_REPEAT`
+ - :attr:`.GLTF.REPEAT`
+ wrapT : int, optional
+ T (V) wrapping mode. Valid values:
+ - :attr:`.GLTF.CLAMP_TO_EDGE`
+ - :attr:`.GLTF.MIRRORED_REPEAT`
+ - :attr:`.GLTF.REPEAT`
+ """
+
+ def __init__(self,
+ name=None,
+ magFilter=None,
+ minFilter=None,
+ wrapS=GLTF.REPEAT,
+ wrapT=GLTF.REPEAT):
+ self.name = name
+ self.magFilter = magFilter
+ self.minFilter = minFilter
+ self.wrapS = wrapS
+ self.wrapT = wrapT
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def magFilter(self):
+ """int : Magnification filter type.
+ """
+ return self._magFilter
+
+ @magFilter.setter
+ def magFilter(self, value):
+ self._magFilter = value
+
+ @property
+ def minFilter(self):
+ """int : Minification filter type.
+ """
+ return self._minFilter
+
+ @minFilter.setter
+ def minFilter(self, value):
+ self._minFilter = value
+
+ @property
+ def wrapS(self):
+ """int : S (U) wrapping mode.
+ """
+ return self._wrapS
+
+ @wrapS.setter
+ def wrapS(self, value):
+ self._wrapS = value
+
+ @property
+ def wrapT(self):
+ """int : T (V) wrapping mode.
+ """
+ return self._wrapT
+
+ @wrapT.setter
+ def wrapT(self, value):
+ self._wrapT = value
diff --git a/generate_human_motion/pyrender/pyrender/scene.py b/generate_human_motion/pyrender/pyrender/scene.py
new file mode 100644
index 0000000000000000000000000000000000000000..2fe057ec66f52f2dd9c1363aacf72a7c6cec4e6c
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/scene.py
@@ -0,0 +1,585 @@
+"""Scenes, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-scene
+
+Author: Matthew Matl
+"""
+import numpy as np
+import networkx as nx
+import trimesh
+
+from .mesh import Mesh
+from .camera import Camera
+from .light import Light, PointLight, DirectionalLight, SpotLight
+from .node import Node
+from .utils import format_color_vector
+
+
+class Scene(object):
+ """A hierarchical scene graph.
+
+ Parameters
+ ----------
+ nodes : list of :class:`Node`
+ The set of all nodes in the scene.
+ bg_color : (4,) float, optional
+ Background color of scene.
+ ambient_light : (3,) float, optional
+ Color of ambient light. Defaults to no ambient light.
+ name : str, optional
+ The user-defined name of this object.
+ """
+
+ def __init__(self,
+ nodes=None,
+ bg_color=None,
+ ambient_light=None,
+ name=None):
+
+ if bg_color is None:
+ bg_color = np.ones(4)
+ else:
+ bg_color = format_color_vector(bg_color, 4)
+
+ if ambient_light is None:
+ ambient_light = np.zeros(3)
+
+ if nodes is None:
+ nodes = set()
+ self._nodes = set() # Will be added at the end of this function
+
+ self.bg_color = bg_color
+ self.ambient_light = ambient_light
+ self.name = name
+
+ self._name_to_nodes = {}
+ self._obj_to_nodes = {}
+ self._obj_name_to_nodes = {}
+ self._mesh_nodes = set()
+ self._point_light_nodes = set()
+ self._spot_light_nodes = set()
+ self._directional_light_nodes = set()
+ self._camera_nodes = set()
+ self._main_camera_node = None
+ self._bounds = None
+
+ # Transform tree
+ self._digraph = nx.DiGraph()
+ self._digraph.add_node('world')
+ self._path_cache = {}
+
+ # Find root nodes and add them
+ if len(nodes) > 0:
+ node_parent_map = {n: None for n in nodes}
+ for node in nodes:
+ for child in node.children:
+ if node_parent_map[child] is not None:
+ raise ValueError('Nodes may not have more than '
+ 'one parent')
+ node_parent_map[child] = node
+ for node in node_parent_map:
+ if node_parent_map[node] is None:
+ self.add_node(node)
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def nodes(self):
+ """set of :class:`Node` : Set of nodes in the scene.
+ """
+ return self._nodes
+
+ @property
+ def bg_color(self):
+ """(3,) float : The scene background color.
+ """
+ return self._bg_color
+
+ @bg_color.setter
+ def bg_color(self, value):
+ if value is None:
+ value = np.ones(4)
+ else:
+ value = format_color_vector(value, 4)
+ self._bg_color = value
+
+ @property
+ def ambient_light(self):
+ """(3,) float : The ambient light in the scene.
+ """
+ return self._ambient_light
+
+ @ambient_light.setter
+ def ambient_light(self, value):
+ if value is None:
+ value = np.zeros(3)
+ else:
+ value = format_color_vector(value, 3)
+ self._ambient_light = value
+
+ @property
+ def meshes(self):
+ """set of :class:`Mesh` : The meshes in the scene.
+ """
+ return set([n.mesh for n in self.mesh_nodes])
+
+ @property
+ def mesh_nodes(self):
+ """set of :class:`Node` : The nodes containing meshes.
+ """
+ return self._mesh_nodes
+
+ @property
+ def lights(self):
+ """set of :class:`Light` : The lights in the scene.
+ """
+ return self.point_lights | self.spot_lights | self.directional_lights
+
+ @property
+ def light_nodes(self):
+ """set of :class:`Node` : The nodes containing lights.
+ """
+ return (self.point_light_nodes | self.spot_light_nodes |
+ self.directional_light_nodes)
+
+ @property
+ def point_lights(self):
+ """set of :class:`PointLight` : The point lights in the scene.
+ """
+ return set([n.light for n in self.point_light_nodes])
+
+ @property
+ def point_light_nodes(self):
+ """set of :class:`Node` : The nodes containing point lights.
+ """
+ return self._point_light_nodes
+
+ @property
+ def spot_lights(self):
+ """set of :class:`SpotLight` : The spot lights in the scene.
+ """
+ return set([n.light for n in self.spot_light_nodes])
+
+ @property
+ def spot_light_nodes(self):
+ """set of :class:`Node` : The nodes containing spot lights.
+ """
+ return self._spot_light_nodes
+
+ @property
+ def directional_lights(self):
+ """set of :class:`DirectionalLight` : The directional lights in
+ the scene.
+ """
+ return set([n.light for n in self.directional_light_nodes])
+
+ @property
+ def directional_light_nodes(self):
+ """set of :class:`Node` : The nodes containing directional lights.
+ """
+ return self._directional_light_nodes
+
+ @property
+ def cameras(self):
+ """set of :class:`Camera` : The cameras in the scene.
+ """
+ return set([n.camera for n in self.camera_nodes])
+
+ @property
+ def camera_nodes(self):
+ """set of :class:`Node` : The nodes containing cameras in the scene.
+ """
+ return self._camera_nodes
+
+ @property
+ def main_camera_node(self):
+ """set of :class:`Node` : The node containing the main camera in the
+ scene.
+ """
+ return self._main_camera_node
+
+ @main_camera_node.setter
+ def main_camera_node(self, value):
+ if value not in self.nodes:
+ raise ValueError('New main camera node must already be in scene')
+ self._main_camera_node = value
+
+ @property
+ def bounds(self):
+ """(2,3) float : The axis-aligned bounds of the scene.
+ """
+ if self._bounds is None:
+ # Compute corners
+ corners = []
+ for mesh_node in self.mesh_nodes:
+ mesh = mesh_node.mesh
+ pose = self.get_pose(mesh_node)
+ corners_local = trimesh.bounds.corners(mesh.bounds)
+ corners_world = pose[:3,:3].dot(corners_local.T).T + pose[:3,3]
+ corners.append(corners_world)
+ if len(corners) == 0:
+ self._bounds = np.zeros((2,3))
+ else:
+ corners = np.vstack(corners)
+ self._bounds = np.array([np.min(corners, axis=0),
+ np.max(corners, axis=0)])
+ return self._bounds
+
+ @property
+ def centroid(self):
+ """(3,) float : The centroid of the scene's axis-aligned bounding box
+ (AABB).
+ """
+ return np.mean(self.bounds, axis=0)
+
+ @property
+ def extents(self):
+ """(3,) float : The lengths of the axes of the scene's AABB.
+ """
+ return np.diff(self.bounds, axis=0).reshape(-1)
+
+ @property
+ def scale(self):
+ """(3,) float : The length of the diagonal of the scene's AABB.
+ """
+ return np.linalg.norm(self.extents)
+
+ def add(self, obj, name=None, pose=None,
+ parent_node=None, parent_name=None):
+ """Add an object (mesh, light, or camera) to the scene.
+
+ Parameters
+ ----------
+ obj : :class:`Mesh`, :class:`Light`, or :class:`Camera`
+ The object to add to the scene.
+ name : str
+ A name for the new node to be created.
+ pose : (4,4) float
+ The local pose of this node relative to its parent node.
+ parent_node : :class:`Node`
+ The parent of this Node. If None, the new node is a root node.
+ parent_name : str
+ The name of the parent node, can be specified instead of
+ `parent_node`.
+
+ Returns
+ -------
+ node : :class:`Node`
+ The newly-created and inserted node.
+ """
+ if isinstance(obj, Mesh):
+ node = Node(name=name, matrix=pose, mesh=obj)
+ elif isinstance(obj, Light):
+ node = Node(name=name, matrix=pose, light=obj)
+ elif isinstance(obj, Camera):
+ node = Node(name=name, matrix=pose, camera=obj)
+ else:
+ raise TypeError('Unrecognized object type')
+
+ if parent_node is None and parent_name is not None:
+ parent_nodes = self.get_nodes(name=parent_name)
+ if len(parent_nodes) == 0:
+ raise ValueError('No parent node with name {} found'
+ .format(parent_name))
+ elif len(parent_nodes) > 1:
+ raise ValueError('More than one parent node with name {} found'
+ .format(parent_name))
+ parent_node = list(parent_nodes)[0]
+
+ self.add_node(node, parent_node=parent_node)
+
+ return node
+
+ def get_nodes(self, node=None, name=None, obj=None, obj_name=None):
+ """Search for existing nodes. Only nodes matching all specified
+ parameters is returned, or None if no such node exists.
+
+ Parameters
+ ----------
+ node : :class:`Node`, optional
+ If present, returns this node if it is in the scene.
+ name : str
+ A name for the Node.
+ obj : :class:`Mesh`, :class:`Light`, or :class:`Camera`
+ An object that is attached to the node.
+ obj_name : str
+ The name of an object that is attached to the node.
+
+ Returns
+ -------
+ nodes : set of :class:`.Node`
+ The nodes that match all query terms.
+ """
+ if node is not None:
+ if node in self.nodes:
+ return set([node])
+ else:
+ return set()
+ nodes = set(self.nodes)
+ if name is not None:
+ matches = set()
+ if name in self._name_to_nodes:
+ matches = self._name_to_nodes[name]
+ nodes = nodes & matches
+ if obj is not None:
+ matches = set()
+ if obj in self._obj_to_nodes:
+ matches = self._obj_to_nodes[obj]
+ nodes = nodes & matches
+ if obj_name is not None:
+ matches = set()
+ if obj_name in self._obj_name_to_nodes:
+ matches = self._obj_name_to_nodes[obj_name]
+ nodes = nodes & matches
+
+ return nodes
+
+ def add_node(self, node, parent_node=None):
+ """Add a Node to the scene.
+
+ Parameters
+ ----------
+ node : :class:`Node`
+ The node to be added.
+ parent_node : :class:`Node`
+ The parent of this Node. If None, the new node is a root node.
+ """
+ if node in self.nodes:
+ raise ValueError('Node already in scene')
+ self.nodes.add(node)
+
+ # Add node to sets
+ if node.name is not None:
+ if node.name not in self._name_to_nodes:
+ self._name_to_nodes[node.name] = set()
+ self._name_to_nodes[node.name].add(node)
+ for obj in [node.mesh, node.camera, node.light]:
+ if obj is not None:
+ if obj not in self._obj_to_nodes:
+ self._obj_to_nodes[obj] = set()
+ self._obj_to_nodes[obj].add(node)
+ if obj.name is not None:
+ if obj.name not in self._obj_name_to_nodes:
+ self._obj_name_to_nodes[obj.name] = set()
+ self._obj_name_to_nodes[obj.name].add(node)
+ if node.mesh is not None:
+ self._mesh_nodes.add(node)
+ if node.light is not None:
+ if isinstance(node.light, PointLight):
+ self._point_light_nodes.add(node)
+ if isinstance(node.light, SpotLight):
+ self._spot_light_nodes.add(node)
+ if isinstance(node.light, DirectionalLight):
+ self._directional_light_nodes.add(node)
+ if node.camera is not None:
+ self._camera_nodes.add(node)
+ if self._main_camera_node is None:
+ self._main_camera_node = node
+
+ if parent_node is None:
+ parent_node = 'world'
+ elif parent_node not in self.nodes:
+ raise ValueError('Parent node must already be in scene')
+ elif node not in parent_node.children:
+ parent_node.children.append(node)
+
+ # Create node in graph
+ self._digraph.add_node(node)
+ self._digraph.add_edge(node, parent_node)
+
+ # Iterate over children
+ for child in node.children:
+ self.add_node(child, node)
+
+ self._path_cache = {}
+ self._bounds = None
+
+ def has_node(self, node):
+ """Check if a node is already in the scene.
+
+ Parameters
+ ----------
+ node : :class:`Node`
+ The node to be checked.
+
+ Returns
+ -------
+ has_node : bool
+ True if the node is already in the scene and false otherwise.
+ """
+ return node in self.nodes
+
+ def remove_node(self, node):
+ """Remove a node and all its children from the scene.
+
+ Parameters
+ ----------
+ node : :class:`Node`
+ The node to be removed.
+ """
+ # Disconnect self from parent who is staying in the graph
+ parent = list(self._digraph.neighbors(node))[0]
+ self._remove_node(node)
+ if isinstance(parent, Node):
+ parent.children.remove(node)
+ self._path_cache = {}
+ self._bounds = None
+
+ def get_pose(self, node):
+ """Get the world-frame pose of a node in the scene.
+
+ Parameters
+ ----------
+ node : :class:`Node`
+ The node to find the pose of.
+
+ Returns
+ -------
+ pose : (4,4) float
+ The transform matrix for this node.
+ """
+ if node not in self.nodes:
+ raise ValueError('Node must already be in scene')
+ if node in self._path_cache:
+ path = self._path_cache[node]
+ else:
+ # Get path from from_frame to to_frame
+ path = nx.shortest_path(self._digraph, node, 'world')
+ self._path_cache[node] = path
+
+ # Traverse from from_node to to_node
+ pose = np.eye(4)
+ for n in path[:-1]:
+ pose = np.dot(n.matrix, pose)
+
+ return pose
+
+ def set_pose(self, node, pose):
+ """Set the local-frame pose of a node in the scene.
+
+ Parameters
+ ----------
+ node : :class:`Node`
+ The node to set the pose of.
+ pose : (4,4) float
+ The pose to set the node to.
+ """
+ if node not in self.nodes:
+ raise ValueError('Node must already be in scene')
+ node._matrix = pose
+ if node.mesh is not None:
+ self._bounds = None
+
+ def clear(self):
+ """Clear out all nodes to form an empty scene.
+ """
+ self._nodes = set()
+
+ self._name_to_nodes = {}
+ self._obj_to_nodes = {}
+ self._obj_name_to_nodes = {}
+ self._mesh_nodes = set()
+ self._point_light_nodes = set()
+ self._spot_light_nodes = set()
+ self._directional_light_nodes = set()
+ self._camera_nodes = set()
+ self._main_camera_node = None
+ self._bounds = None
+
+ # Transform tree
+ self._digraph = nx.DiGraph()
+ self._digraph.add_node('world')
+ self._path_cache = {}
+
+ def _remove_node(self, node):
+ """Remove a node and all its children from the scene.
+
+ Parameters
+ ----------
+ node : :class:`Node`
+ The node to be removed.
+ """
+
+ # Remove self from nodes
+ self.nodes.remove(node)
+
+ # Remove children
+ for child in node.children:
+ self._remove_node(child)
+
+ # Remove self from the graph
+ self._digraph.remove_node(node)
+
+ # Remove from maps
+ if node.name in self._name_to_nodes:
+ self._name_to_nodes[node.name].remove(node)
+ if len(self._name_to_nodes[node.name]) == 0:
+ self._name_to_nodes.pop(node.name)
+ for obj in [node.mesh, node.camera, node.light]:
+ if obj is None:
+ continue
+ self._obj_to_nodes[obj].remove(node)
+ if len(self._obj_to_nodes[obj]) == 0:
+ self._obj_to_nodes.pop(obj)
+ if obj.name is not None:
+ self._obj_name_to_nodes[obj.name].remove(node)
+ if len(self._obj_name_to_nodes[obj.name]) == 0:
+ self._obj_name_to_nodes.pop(obj.name)
+ if node.mesh is not None:
+ self._mesh_nodes.remove(node)
+ if node.light is not None:
+ if isinstance(node.light, PointLight):
+ self._point_light_nodes.remove(node)
+ if isinstance(node.light, SpotLight):
+ self._spot_light_nodes.remove(node)
+ if isinstance(node.light, DirectionalLight):
+ self._directional_light_nodes.remove(node)
+ if node.camera is not None:
+ self._camera_nodes.remove(node)
+ if self._main_camera_node == node:
+ if len(self._camera_nodes) > 0:
+ self._main_camera_node = next(iter(self._camera_nodes))
+ else:
+ self._main_camera_node = None
+
+ @staticmethod
+ def from_trimesh_scene(trimesh_scene,
+ bg_color=None, ambient_light=None):
+ """Create a :class:`.Scene` from a :class:`trimesh.scene.scene.Scene`.
+
+ Parameters
+ ----------
+ trimesh_scene : :class:`trimesh.scene.scene.Scene`
+ Scene with :class:~`trimesh.base.Trimesh` objects.
+ bg_color : (4,) float
+ Background color for the created scene.
+ ambient_light : (3,) float or None
+ Ambient light in the scene.
+
+ Returns
+ -------
+ scene_pr : :class:`Scene`
+ A scene containing the same geometry as the trimesh scene.
+ """
+ # convert trimesh geometries to pyrender geometries
+ geometries = {name: Mesh.from_trimesh(geom)
+ for name, geom in trimesh_scene.geometry.items()}
+
+ # create the pyrender scene object
+ scene_pr = Scene(bg_color=bg_color, ambient_light=ambient_light)
+
+ # add every node with geometry to the pyrender scene
+ for node in trimesh_scene.graph.nodes_geometry:
+ pose, geom_name = trimesh_scene.graph[node]
+ scene_pr.add(geometries[geom_name], pose=pose)
+
+ return scene_pr
diff --git a/generate_human_motion/pyrender/pyrender/shader_program.py b/generate_human_motion/pyrender/pyrender/shader_program.py
new file mode 100644
index 0000000000000000000000000000000000000000..c1803f280c98033abe0769771a9ad8ecfec942e3
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shader_program.py
@@ -0,0 +1,283 @@
+"""OpenGL shader program wrapper.
+"""
+import numpy as np
+import os
+import re
+
+import OpenGL
+from OpenGL.GL import *
+from OpenGL.GL import shaders as gl_shader_utils
+
+
+class ShaderProgramCache(object):
+ """A cache for shader programs.
+ """
+
+ def __init__(self, shader_dir=None):
+ self._program_cache = {}
+ self.shader_dir = shader_dir
+ if self.shader_dir is None:
+ base_dir, _ = os.path.split(os.path.realpath(__file__))
+ self.shader_dir = os.path.join(base_dir, 'shaders')
+
+ def get_program(self, vertex_shader, fragment_shader,
+ geometry_shader=None, defines=None):
+ """Get a program via a list of shader files to include in the program.
+
+ Parameters
+ ----------
+ vertex_shader : str
+ The vertex shader filename.
+ fragment_shader : str
+ The fragment shader filename.
+ geometry_shader : str
+ The geometry shader filename.
+ defines : dict
+ Defines and their values for the shader.
+
+ Returns
+ -------
+ program : :class:`.ShaderProgram`
+ The program.
+ """
+ shader_names = []
+ if defines is None:
+ defines = {}
+ shader_filenames = [
+ x for x in [vertex_shader, fragment_shader, geometry_shader]
+ if x is not None
+ ]
+ for fn in shader_filenames:
+ if fn is None:
+ continue
+ _, name = os.path.split(fn)
+ shader_names.append(name)
+ cid = OpenGL.contextdata.getContext()
+ key = tuple([cid] + sorted(
+ [(s,1) for s in shader_names] + [(d, defines[d]) for d in defines]
+ ))
+
+ if key not in self._program_cache:
+ shader_filenames = [
+ os.path.join(self.shader_dir, fn) for fn in shader_filenames
+ ]
+ if len(shader_filenames) == 2:
+ shader_filenames.append(None)
+ vs, fs, gs = shader_filenames
+ self._program_cache[key] = ShaderProgram(
+ vertex_shader=vs, fragment_shader=fs,
+ geometry_shader=gs, defines=defines
+ )
+ return self._program_cache[key]
+
+ def clear(self):
+ for key in self._program_cache:
+ self._program_cache[key].delete()
+ self._program_cache = {}
+
+
+class ShaderProgram(object):
+ """A thin wrapper about OpenGL shader programs that supports easy creation,
+ binding, and uniform-setting.
+
+ Parameters
+ ----------
+ vertex_shader : str
+ The vertex shader filename.
+ fragment_shader : str
+ The fragment shader filename.
+ geometry_shader : str
+ The geometry shader filename.
+ defines : dict
+ Defines and their values for the shader.
+ """
+
+ def __init__(self, vertex_shader, fragment_shader,
+ geometry_shader=None, defines=None):
+
+ self.vertex_shader = vertex_shader
+ self.fragment_shader = fragment_shader
+ self.geometry_shader = geometry_shader
+
+ self.defines = defines
+ if self.defines is None:
+ self.defines = {}
+
+ self._program_id = None
+ self._vao_id = None # PYOPENGL BUG
+
+ # DEBUG
+ # self._unif_map = {}
+
+ def _add_to_context(self):
+ if self._program_id is not None:
+ raise ValueError('Shader program already in context')
+ shader_ids = []
+
+ # Load vert shader
+ shader_ids.append(gl_shader_utils.compileShader(
+ self._load(self.vertex_shader), GL_VERTEX_SHADER)
+ )
+ # Load frag shader
+ shader_ids.append(gl_shader_utils.compileShader(
+ self._load(self.fragment_shader), GL_FRAGMENT_SHADER)
+ )
+ # Load geometry shader
+ if self.geometry_shader is not None:
+ shader_ids.append(gl_shader_utils.compileShader(
+ self._load(self.geometry_shader), GL_GEOMETRY_SHADER)
+ )
+
+ # Bind empty VAO PYOPENGL BUG
+ if self._vao_id is None:
+ self._vao_id = glGenVertexArrays(1)
+ glBindVertexArray(self._vao_id)
+
+ # Compile program
+ self._program_id = gl_shader_utils.compileProgram(*shader_ids)
+
+ # Unbind empty VAO PYOPENGL BUG
+ glBindVertexArray(0)
+
+ def _in_context(self):
+ return self._program_id is not None
+
+ def _remove_from_context(self):
+ if self._program_id is not None:
+ glDeleteProgram(self._program_id)
+ glDeleteVertexArrays(1, [self._vao_id])
+ self._program_id = None
+ self._vao_id = None
+
+ def _load(self, shader_filename):
+ path, _ = os.path.split(shader_filename)
+
+ with open(shader_filename) as f:
+ text = f.read()
+
+ def ifdef(matchobj):
+ if matchobj.group(1) in self.defines:
+ return '#if 1'
+ else:
+ return '#if 0'
+
+ def ifndef(matchobj):
+ if matchobj.group(1) in self.defines:
+ return '#if 0'
+ else:
+ return '#if 1'
+
+ ifdef_regex = re.compile(
+ '#ifdef\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*$', re.MULTILINE
+ )
+ ifndef_regex = re.compile(
+ '#ifndef\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*$', re.MULTILINE
+ )
+ text = re.sub(ifdef_regex, ifdef, text)
+ text = re.sub(ifndef_regex, ifndef, text)
+
+ for define in self.defines:
+ value = str(self.defines[define])
+ text = text.replace(define, value)
+
+ return text
+
+ def _bind(self):
+ """Bind this shader program to the current OpenGL context.
+ """
+ if self._program_id is None:
+ raise ValueError('Cannot bind program that is not in context')
+ # glBindVertexArray(self._vao_id)
+ glUseProgram(self._program_id)
+
+ def _unbind(self):
+ """Unbind this shader program from the current OpenGL context.
+ """
+ glUseProgram(0)
+
+ def delete(self):
+ """Delete this shader program from the current OpenGL context.
+ """
+ self._remove_from_context()
+
+ def set_uniform(self, name, value, unsigned=False):
+ """Set a uniform value in the current shader program.
+
+ Parameters
+ ----------
+ name : str
+ Name of the uniform to set.
+ value : int, float, or ndarray
+ Value to set the uniform to.
+ unsigned : bool
+ If True, ints will be treated as unsigned values.
+ """
+ try:
+ # DEBUG
+ # self._unif_map[name] = 1, (1,)
+ loc = glGetUniformLocation(self._program_id, name)
+
+ if loc == -1:
+ raise ValueError('Invalid shader variable: {}'.format(name))
+
+ if isinstance(value, np.ndarray):
+ # DEBUG
+ # self._unif_map[name] = value.size, value.shape
+ if value.ndim == 1:
+ if (np.issubdtype(value.dtype, np.unsignedinteger) or
+ unsigned):
+ dtype = 'u'
+ value = value.astype(np.uint32)
+ elif np.issubdtype(value.dtype, np.integer):
+ dtype = 'i'
+ value = value.astype(np.int32)
+ else:
+ dtype = 'f'
+ value = value.astype(np.float32)
+ self._FUNC_MAP[(value.shape[0], dtype)](loc, 1, value)
+ else:
+ self._FUNC_MAP[(value.shape[0], value.shape[1])](
+ loc, 1, GL_TRUE, value
+ )
+
+ # Call correct uniform function
+ elif isinstance(value, float):
+ glUniform1f(loc, value)
+ elif isinstance(value, int):
+ if unsigned:
+ glUniform1ui(loc, value)
+ else:
+ glUniform1i(loc, value)
+ elif isinstance(value, bool):
+ if unsigned:
+ glUniform1ui(loc, int(value))
+ else:
+ glUniform1i(loc, int(value))
+ else:
+ raise ValueError('Invalid data type')
+ except Exception:
+ pass
+
+ _FUNC_MAP = {
+ (1,'u'): glUniform1uiv,
+ (2,'u'): glUniform2uiv,
+ (3,'u'): glUniform3uiv,
+ (4,'u'): glUniform4uiv,
+ (1,'i'): glUniform1iv,
+ (2,'i'): glUniform2iv,
+ (3,'i'): glUniform3iv,
+ (4,'i'): glUniform4iv,
+ (1,'f'): glUniform1fv,
+ (2,'f'): glUniform2fv,
+ (3,'f'): glUniform3fv,
+ (4,'f'): glUniform4fv,
+ (2,2): glUniformMatrix2fv,
+ (2,3): glUniformMatrix2x3fv,
+ (2,4): glUniformMatrix2x4fv,
+ (3,2): glUniformMatrix3x2fv,
+ (3,3): glUniformMatrix3fv,
+ (3,4): glUniformMatrix3x4fv,
+ (4,2): glUniformMatrix4x2fv,
+ (4,3): glUniformMatrix4x3fv,
+ (4,4): glUniformMatrix4fv,
+ }
diff --git a/generate_human_motion/pyrender/pyrender/shaders/debug_quad.frag b/generate_human_motion/pyrender/pyrender/shaders/debug_quad.frag
new file mode 100644
index 0000000000000000000000000000000000000000..4647bb50dfa1e4510e2d4afb37959c7f57532eca
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/debug_quad.frag
@@ -0,0 +1,23 @@
+#version 330 core
+out vec4 FragColor;
+
+in vec2 TexCoords;
+
+uniform sampler2D depthMap;
+//uniform float near_plane;
+//uniform float far_plane;
+//
+//// required when using a perspective projection matrix
+//float LinearizeDepth(float depth)
+//{
+// float z = depth * 2.0 - 1.0; // Back to NDC
+// return (2.0 * near_plane * far_plane) / (far_plane + near_plane - z * (far_plane - near_plane));
+//}
+
+void main()
+{
+ float depthValue = texture(depthMap, TexCoords).r;
+ // FragColor = vec4(vec3(LinearizeDepth(depthValue) / far_plane), 1.0); // perspective
+ FragColor = vec4(vec3(depthValue), 1.0); // orthographic
+ //FragColor = vec4(1.0, 1.0, 0.0, 1.0);
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/debug_quad.vert b/generate_human_motion/pyrender/pyrender/shaders/debug_quad.vert
new file mode 100644
index 0000000000000000000000000000000000000000..d2f2fcb7626f6c22e0d52bf4d6c91251cbdb9f52
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/debug_quad.vert
@@ -0,0 +1,25 @@
+#version 330 core
+//layout (location = 0) in vec3 aPos;
+//layout (location = 1) in vec2 aTexCoords;
+//
+//out vec2 TexCoords;
+//
+//void main()
+//{
+// TexCoords = aTexCoords;
+// gl_Position = vec4(aPos, 1.0);
+//}
+//
+//
+//layout(location = 0) out vec2 uv;
+
+out vec2 TexCoords;
+
+void main()
+{
+ float x = float(((uint(gl_VertexID) + 2u) / 3u)%2u);
+ float y = float(((uint(gl_VertexID) + 1u) / 3u)%2u);
+
+ gl_Position = vec4(-1.0f + x*2.0f, -1.0f+y*2.0f, 0.0f, 1.0f);
+ TexCoords = vec2(x, y);
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/flat.frag b/generate_human_motion/pyrender/pyrender/shaders/flat.frag
new file mode 100644
index 0000000000000000000000000000000000000000..7ec01c6d095ec5dacc693accd3ad507ced61a79a
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/flat.frag
@@ -0,0 +1,126 @@
+#version 330 core
+///////////////////////////////////////////////////////////////////////////////
+// Structs
+///////////////////////////////////////////////////////////////////////////////
+
+struct Material {
+ vec3 emissive_factor;
+
+#ifdef USE_METALLIC_MATERIAL
+ vec4 base_color_factor;
+ float metallic_factor;
+ float roughness_factor;
+#endif
+
+#ifdef USE_GLOSSY_MATERIAL
+ vec4 diffuse_factor;
+ vec3 specular_factor;
+ float glossiness_factor;
+#endif
+
+#ifdef HAS_NORMAL_TEX
+ sampler2D normal_texture;
+#endif
+#ifdef HAS_OCCLUSION_TEX
+ sampler2D occlusion_texture;
+#endif
+#ifdef HAS_EMISSIVE_TEX
+ sampler2D emissive_texture;
+#endif
+#ifdef HAS_BASE_COLOR_TEX
+ sampler2D base_color_texture;
+#endif
+#ifdef HAS_METALLIC_ROUGHNESS_TEX
+ sampler2D metallic_roughness_texture;
+#endif
+#ifdef HAS_DIFFUSE_TEX
+ sampler2D diffuse_texture;
+#endif
+#ifdef HAS_SPECULAR_GLOSSINESS_TEX
+ sampler2D specular_glossiness;
+#endif
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// Uniforms
+///////////////////////////////////////////////////////////////////////////////
+uniform Material material;
+uniform vec3 cam_pos;
+
+#ifdef USE_IBL
+uniform samplerCube diffuse_env;
+uniform samplerCube specular_env;
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Inputs
+///////////////////////////////////////////////////////////////////////////////
+
+in vec3 frag_position;
+#ifdef NORMAL_LOC
+in vec3 frag_normal;
+#endif
+#ifdef HAS_NORMAL_TEX
+#ifdef TANGENT_LOC
+#ifdef NORMAL_LOC
+in mat3 tbn;
+#endif
+#endif
+#endif
+#ifdef TEXCOORD_0_LOC
+in vec2 uv_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+in vec2 uv_1;
+#endif
+#ifdef COLOR_0_LOC
+in vec4 color_multiplier;
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// OUTPUTS
+///////////////////////////////////////////////////////////////////////////////
+
+out vec4 frag_color;
+
+///////////////////////////////////////////////////////////////////////////////
+// Constants
+///////////////////////////////////////////////////////////////////////////////
+const float PI = 3.141592653589793;
+const float min_roughness = 0.04;
+
+///////////////////////////////////////////////////////////////////////////////
+// Utility Functions
+///////////////////////////////////////////////////////////////////////////////
+vec4 srgb_to_linear(vec4 srgb)
+{
+#ifndef SRGB_CORRECTED
+ // Fast Approximation
+ //vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
+ //
+ vec3 b_less = step(vec3(0.04045),srgb.xyz);
+ vec3 lin_out = mix( srgb.xyz/vec3(12.92), pow((srgb.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), b_less );
+ return vec4(lin_out, srgb.w);
+#else
+ return srgb;
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// MAIN
+///////////////////////////////////////////////////////////////////////////////
+void main()
+{
+
+ // Compute albedo
+ vec4 base_color = material.base_color_factor;
+#ifdef HAS_BASE_COLOR_TEX
+ base_color = base_color * texture(material.base_color_texture, uv_0);
+#endif
+
+#ifdef COLOR_0_LOC
+ base_color *= color_multiplier;
+#endif
+
+ frag_color = clamp(base_color, 0.0, 1.0);
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/flat.vert b/generate_human_motion/pyrender/pyrender/shaders/flat.vert
new file mode 100644
index 0000000000000000000000000000000000000000..cfd241c3544718a261f961c3aa3c03aa13c97761
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/flat.vert
@@ -0,0 +1,86 @@
+#version 330 core
+
+// Vertex Attributes
+layout(location = 0) in vec3 position;
+#ifdef NORMAL_LOC
+layout(location = NORMAL_LOC) in vec3 normal;
+#endif
+#ifdef TANGENT_LOC
+layout(location = TANGENT_LOC) in vec4 tangent;
+#endif
+#ifdef TEXCOORD_0_LOC
+layout(location = TEXCOORD_0_LOC) in vec2 texcoord_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+layout(location = TEXCOORD_1_LOC) in vec2 texcoord_1;
+#endif
+#ifdef COLOR_0_LOC
+layout(location = COLOR_0_LOC) in vec4 color_0;
+#endif
+#ifdef JOINTS_0_LOC
+layout(location = JOINTS_0_LOC) in vec4 joints_0;
+#endif
+#ifdef WEIGHTS_0_LOC
+layout(location = WEIGHTS_0_LOC) in vec4 weights_0;
+#endif
+layout(location = INST_M_LOC) in mat4 inst_m;
+
+// Uniforms
+uniform mat4 M;
+uniform mat4 V;
+uniform mat4 P;
+
+// Outputs
+out vec3 frag_position;
+#ifdef NORMAL_LOC
+out vec3 frag_normal;
+#endif
+#ifdef HAS_NORMAL_TEX
+#ifdef TANGENT_LOC
+#ifdef NORMAL_LOC
+out mat3 tbn;
+#endif
+#endif
+#endif
+#ifdef TEXCOORD_0_LOC
+out vec2 uv_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+out vec2 uv_1;
+#endif
+#ifdef COLOR_0_LOC
+out vec4 color_multiplier;
+#endif
+
+
+void main()
+{
+ gl_Position = P * V * M * inst_m * vec4(position, 1);
+ frag_position = vec3(M * inst_m * vec4(position, 1.0));
+
+ mat4 N = transpose(inverse(M * inst_m));
+
+#ifdef NORMAL_LOC
+ frag_normal = normalize(vec3(N * vec4(normal, 0.0)));
+#endif
+
+#ifdef HAS_NORMAL_TEX
+#ifdef TANGENT_LOC
+#ifdef NORMAL_LOC
+ vec3 normal_w = normalize(vec3(N * vec4(normal, 0.0)));
+ vec3 tangent_w = normalize(vec3(N * vec4(tangent.xyz, 0.0)));
+ vec3 bitangent_w = cross(normal_w, tangent_w) * tangent.w;
+ tbn = mat3(tangent_w, bitangent_w, normal_w);
+#endif
+#endif
+#endif
+#ifdef TEXCOORD_0_LOC
+ uv_0 = texcoord_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+ uv_1 = texcoord_1;
+#endif
+#ifdef COLOR_0_LOC
+ color_multiplier = color_0;
+#endif
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/mesh.frag b/generate_human_motion/pyrender/pyrender/shaders/mesh.frag
new file mode 100644
index 0000000000000000000000000000000000000000..43187621b4388b18badf4e562a7ad300e59b029d
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/mesh.frag
@@ -0,0 +1,456 @@
+#version 330 core
+///////////////////////////////////////////////////////////////////////////////
+// Structs
+///////////////////////////////////////////////////////////////////////////////
+
+struct SpotLight {
+ vec3 color;
+ float intensity;
+ float range;
+ vec3 position;
+ vec3 direction;
+ float light_angle_scale;
+ float light_angle_offset;
+
+ #ifdef SPOT_LIGHT_SHADOWS
+ sampler2D shadow_map;
+ mat4 light_matrix;
+ #endif
+};
+
+struct DirectionalLight {
+ vec3 color;
+ float intensity;
+ vec3 direction;
+
+ #ifdef DIRECTIONAL_LIGHT_SHADOWS
+ sampler2D shadow_map;
+ mat4 light_matrix;
+ #endif
+};
+
+struct PointLight {
+ vec3 color;
+ float intensity;
+ float range;
+ vec3 position;
+
+ #ifdef POINT_LIGHT_SHADOWS
+ samplerCube shadow_map;
+ #endif
+};
+
+struct Material {
+ vec3 emissive_factor;
+
+#ifdef USE_METALLIC_MATERIAL
+ vec4 base_color_factor;
+ float metallic_factor;
+ float roughness_factor;
+#endif
+
+#ifdef USE_GLOSSY_MATERIAL
+ vec4 diffuse_factor;
+ vec3 specular_factor;
+ float glossiness_factor;
+#endif
+
+#ifdef HAS_NORMAL_TEX
+ sampler2D normal_texture;
+#endif
+#ifdef HAS_OCCLUSION_TEX
+ sampler2D occlusion_texture;
+#endif
+#ifdef HAS_EMISSIVE_TEX
+ sampler2D emissive_texture;
+#endif
+#ifdef HAS_BASE_COLOR_TEX
+ sampler2D base_color_texture;
+#endif
+#ifdef HAS_METALLIC_ROUGHNESS_TEX
+ sampler2D metallic_roughness_texture;
+#endif
+#ifdef HAS_DIFFUSE_TEX
+ sampler2D diffuse_texture;
+#endif
+#ifdef HAS_SPECULAR_GLOSSINESS_TEX
+ sampler2D specular_glossiness;
+#endif
+};
+
+struct PBRInfo {
+ float nl;
+ float nv;
+ float nh;
+ float lh;
+ float vh;
+ float roughness;
+ float metallic;
+ vec3 f0;
+ vec3 c_diff;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// Uniforms
+///////////////////////////////////////////////////////////////////////////////
+uniform Material material;
+uniform PointLight point_lights[MAX_POINT_LIGHTS];
+uniform int n_point_lights;
+uniform DirectionalLight directional_lights[MAX_DIRECTIONAL_LIGHTS];
+uniform int n_directional_lights;
+uniform SpotLight spot_lights[MAX_SPOT_LIGHTS];
+uniform int n_spot_lights;
+uniform vec3 cam_pos;
+uniform vec3 ambient_light;
+
+#ifdef USE_IBL
+uniform samplerCube diffuse_env;
+uniform samplerCube specular_env;
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Inputs
+///////////////////////////////////////////////////////////////////////////////
+
+in vec3 frag_position;
+#ifdef NORMAL_LOC
+in vec3 frag_normal;
+#endif
+#ifdef HAS_NORMAL_TEX
+#ifdef TANGENT_LOC
+#ifdef NORMAL_LOC
+in mat3 tbn;
+#endif
+#endif
+#endif
+#ifdef TEXCOORD_0_LOC
+in vec2 uv_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+in vec2 uv_1;
+#endif
+#ifdef COLOR_0_LOC
+in vec4 color_multiplier;
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// OUTPUTS
+///////////////////////////////////////////////////////////////////////////////
+
+out vec4 frag_color;
+
+///////////////////////////////////////////////////////////////////////////////
+// Constants
+///////////////////////////////////////////////////////////////////////////////
+const float PI = 3.141592653589793;
+const float min_roughness = 0.04;
+
+///////////////////////////////////////////////////////////////////////////////
+// Utility Functions
+///////////////////////////////////////////////////////////////////////////////
+vec4 srgb_to_linear(vec4 srgb)
+{
+#ifndef SRGB_CORRECTED
+ // Fast Approximation
+ //vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
+ //
+ vec3 b_less = step(vec3(0.04045),srgb.xyz);
+ vec3 lin_out = mix( srgb.xyz/vec3(12.92), pow((srgb.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), b_less );
+ return vec4(lin_out, srgb.w);
+#else
+ return srgb;
+#endif
+}
+
+// Normal computation
+vec3 get_normal()
+{
+#ifdef HAS_NORMAL_TEX
+
+#ifndef HAS_TANGENTS
+ vec3 pos_dx = dFdx(frag_position);
+ vec3 pos_dy = dFdy(frag_position);
+ vec3 tex_dx = dFdx(vec3(uv_0, 0.0));
+ vec3 tex_dy = dFdy(vec3(uv_0, 0.0));
+ vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
+
+#ifdef NORMAL_LOC
+ vec3 ng = normalize(frag_normal);
+#else
+ vec3 = cross(pos_dx, pos_dy);
+#endif
+
+ t = normalize(t - ng * dot(ng, t));
+ vec3 b = normalize(cross(ng, t));
+ mat3 tbn_n = mat3(t, b, ng);
+
+#else
+
+ mat3 tbn_n = tbn;
+
+#endif
+
+ vec3 n = texture(material.normal_texture, uv_0).rgb;
+ n = normalize(tbn_n * ((2.0 * n - 1.0) * vec3(1.0, 1.0, 1.0)));
+ return n; // TODO NORMAL MAPPING
+
+#else
+
+#ifdef NORMAL_LOC
+ return frag_normal;
+#else
+ return normalize(cam_pos - frag_position);
+#endif
+
+#endif
+}
+
+// Fresnel
+vec3 specular_reflection(PBRInfo info)
+{
+ vec3 res = info.f0 + (1.0 - info.f0) * pow(clamp(1.0 - info.vh, 0.0, 1.0), 5.0);
+ return res;
+}
+
+// Smith
+float geometric_occlusion(PBRInfo info)
+{
+ float r = info.roughness + 1.0;
+ float k = r * r / 8.0;
+ float g1 = info.nv / (info.nv * (1.0 - k) + k);
+ float g2 = info.nl / (info.nl * (1.0 - k) + k);
+ //float k = info.roughness * sqrt(2.0 / PI);
+ //float g1 = info.lh / (info.lh * (1.0 - k) + k);
+ //float g2 = info.nh / (info.nh * (1.0 - k) + k);
+ return g1 * g2;
+}
+
+float microfacet_distribution(PBRInfo info)
+{
+ float a = info.roughness * info.roughness;
+ float a2 = a * a;
+ float nh2 = info.nh * info.nh;
+
+ float denom = (nh2 * (a2 - 1.0) + 1.0);
+ return a2 / (PI * denom * denom);
+}
+
+vec3 compute_brdf(vec3 n, vec3 v, vec3 l,
+ float roughness, float metalness,
+ vec3 f0, vec3 c_diff, vec3 albedo,
+ vec3 radiance)
+{
+ vec3 h = normalize(l+v);
+ float nl = clamp(dot(n, l), 0.001, 1.0);
+ float nv = clamp(abs(dot(n, v)), 0.001, 1.0);
+ float nh = clamp(dot(n, h), 0.0, 1.0);
+ float lh = clamp(dot(l, h), 0.0, 1.0);
+ float vh = clamp(dot(v, h), 0.0, 1.0);
+
+ PBRInfo info = PBRInfo(nl, nv, nh, lh, vh, roughness, metalness, f0, c_diff);
+
+ // Compute PBR terms
+ vec3 F = specular_reflection(info);
+ float G = geometric_occlusion(info);
+ float D = microfacet_distribution(info);
+
+ // Compute BRDF
+ vec3 diffuse_contrib = (1.0 - F) * c_diff / PI;
+ vec3 spec_contrib = F * G * D / (4.0 * nl * nv + 0.001);
+
+ vec3 color = nl * radiance * (diffuse_contrib + spec_contrib);
+ return color;
+}
+
+float texture2DCompare(sampler2D depths, vec2 uv, float compare) {
+ return compare > texture(depths, uv.xy).r ? 1.0 : 0.0;
+}
+
+float texture2DShadowLerp(sampler2D depths, vec2 size, vec2 uv, float compare) {
+ vec2 texelSize = vec2(1.0)/size;
+ vec2 f = fract(uv*size+0.5);
+ vec2 centroidUV = floor(uv*size+0.5)/size;
+
+ float lb = texture2DCompare(depths, centroidUV+texelSize*vec2(0.0, 0.0), compare);
+ float lt = texture2DCompare(depths, centroidUV+texelSize*vec2(0.0, 1.0), compare);
+ float rb = texture2DCompare(depths, centroidUV+texelSize*vec2(1.0, 0.0), compare);
+ float rt = texture2DCompare(depths, centroidUV+texelSize*vec2(1.0, 1.0), compare);
+ float a = mix(lb, lt, f.y);
+ float b = mix(rb, rt, f.y);
+ float c = mix(a, b, f.x);
+ return c;
+}
+
+float PCF(sampler2D depths, vec2 size, vec2 uv, float compare){
+ float result = 0.0;
+ for(int x=-1; x<=1; x++){
+ for(int y=-1; y<=1; y++){
+ vec2 off = vec2(x,y)/size;
+ result += texture2DShadowLerp(depths, size, uv+off, compare);
+ }
+ }
+ return result/9.0;
+}
+
+float shadow_calc(mat4 light_matrix, sampler2D shadow_map, float nl)
+{
+ // Compute light texture UV coords
+ vec4 proj_coords = vec4(light_matrix * vec4(frag_position.xyz, 1.0));
+ vec3 light_coords = proj_coords.xyz / proj_coords.w;
+ light_coords = light_coords * 0.5 + 0.5;
+ float current_depth = light_coords.z;
+ float bias = max(0.001 * (1.0 - nl), 0.0001) / proj_coords.w;
+ float compare = (current_depth - bias);
+ float shadow = PCF(shadow_map, textureSize(shadow_map, 0), light_coords.xy, compare);
+ if (light_coords.z > 1.0) {
+ shadow = 0.0;
+ }
+ return shadow;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// MAIN
+///////////////////////////////////////////////////////////////////////////////
+void main()
+{
+
+ vec4 color = vec4(vec3(0.0), 1.0);
+///////////////////////////////////////////////////////////////////////////////
+// Handle Metallic Materials
+///////////////////////////////////////////////////////////////////////////////
+#ifdef USE_METALLIC_MATERIAL
+
+ // Compute metallic/roughness factors
+ float roughness = material.roughness_factor;
+ float metallic = material.metallic_factor;
+#ifdef HAS_METALLIC_ROUGHNESS_TEX
+ vec2 mr = texture(material.metallic_roughness_texture, uv_0).rg;
+ roughness = roughness * mr.r;
+ metallic = metallic * mr.g;
+#endif
+ roughness = clamp(roughness, min_roughness, 1.0);
+ metallic = clamp(metallic, 0.0, 1.0);
+ // In convention, material roughness is perceputal roughness ^ 2
+ float alpha_roughness = roughness * roughness;
+
+ // Compute albedo
+ vec4 base_color = material.base_color_factor;
+#ifdef HAS_BASE_COLOR_TEX
+ base_color = base_color * srgb_to_linear(texture(material.base_color_texture, uv_0));
+#endif
+
+ // Compute specular and diffuse colors
+ vec3 dialectric_spec = vec3(min_roughness);
+ vec3 c_diff = mix(vec3(0.0), base_color.rgb * (1 - min_roughness), 1.0 - metallic);
+ vec3 f0 = mix(dialectric_spec, base_color.rgb, metallic);
+
+ // Compute normal
+ vec3 n = normalize(get_normal());
+
+ // Loop over lights
+ for (int i = 0; i < n_directional_lights; i++) {
+ vec3 direction = directional_lights[i].direction;
+ vec3 v = normalize(cam_pos - frag_position); // Vector towards camera
+ vec3 l = normalize(-1.0 * direction); // Vector towards light
+
+ // Compute attenuation and radiance
+ float attenuation = directional_lights[i].intensity;
+ vec3 radiance = attenuation * directional_lights[i].color;
+
+ // Compute outbound color
+ vec3 res = compute_brdf(n, v, l, roughness, metallic,
+ f0, c_diff, base_color.rgb, radiance);
+
+ // Compute shadow
+#ifdef DIRECTIONAL_LIGHT_SHADOWS
+ float nl = clamp(dot(n,l), 0.0, 1.0);
+ float shadow = shadow_calc(
+ directional_lights[i].light_matrix,
+ directional_lights[i].shadow_map,
+ nl
+ );
+ res = res * (1.0 - shadow);
+#endif
+ color.xyz += res;
+ }
+
+ for (int i = 0; i < n_point_lights; i++) {
+ vec3 position = point_lights[i].position;
+ vec3 v = normalize(cam_pos - frag_position); // Vector towards camera
+ vec3 l = normalize(position - frag_position); // Vector towards light
+
+ // Compute attenuation and radiance
+ float dist = length(position - frag_position);
+ float attenuation = point_lights[i].intensity / (dist * dist);
+ vec3 radiance = attenuation * point_lights[i].color;
+
+ // Compute outbound color
+ vec3 res = compute_brdf(n, v, l, roughness, metallic,
+ f0, c_diff, base_color.rgb, radiance);
+ color.xyz += res;
+ }
+ for (int i = 0; i < n_spot_lights; i++) {
+ vec3 position = spot_lights[i].position;
+ vec3 v = normalize(cam_pos - frag_position); // Vector towards camera
+ vec3 l = normalize(position - frag_position); // Vector towards light
+
+ // Compute attenuation and radiance
+ vec3 direction = spot_lights[i].direction;
+ float las = spot_lights[i].light_angle_scale;
+ float lao = spot_lights[i].light_angle_offset;
+ float dist = length(position - frag_position);
+ float cd = clamp(dot(direction, -l), 0.0, 1.0);
+ float attenuation = clamp(cd * las + lao, 0.0, 1.0);
+ attenuation = attenuation * attenuation * spot_lights[i].intensity;
+ attenuation = attenuation / (dist * dist);
+ vec3 radiance = attenuation * spot_lights[i].color;
+
+ // Compute outbound color
+ vec3 res = compute_brdf(n, v, l, roughness, metallic,
+ f0, c_diff, base_color.rgb, radiance);
+#ifdef SPOT_LIGHT_SHADOWS
+ float nl = clamp(dot(n,l), 0.0, 1.0);
+ float shadow = shadow_calc(
+ spot_lights[i].light_matrix,
+ spot_lights[i].shadow_map,
+ nl
+ );
+ res = res * (1.0 - shadow);
+#endif
+ color.xyz += res;
+ }
+ color.xyz += base_color.xyz * ambient_light;
+
+ // Calculate lighting from environment
+#ifdef USE_IBL
+ // TODO
+#endif
+
+ // Apply occlusion
+#ifdef HAS_OCCLUSION_TEX
+ float ao = texture(material.occlusion_texture, uv_0).r;
+ color.xyz *= ao;
+#endif
+
+ // Apply emissive map
+ vec3 emissive = material.emissive_factor;
+#ifdef HAS_EMISSIVE_TEX
+ emissive *= srgb_to_linear(texture(material.emissive_texture, uv_0)).rgb;
+#endif
+ color.xyz += emissive * material.emissive_factor;
+
+#ifdef COLOR_0_LOC
+ color *= color_multiplier;
+#endif
+
+ frag_color = clamp(vec4(pow(color.xyz, vec3(1.0/2.2)), color.a * base_color.a), 0.0, 1.0);
+
+#else
+ // TODO GLOSSY MATERIAL BRDF
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Handle Glossy Materials
+///////////////////////////////////////////////////////////////////////////////
+
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/mesh.vert b/generate_human_motion/pyrender/pyrender/shaders/mesh.vert
new file mode 100644
index 0000000000000000000000000000000000000000..cfd241c3544718a261f961c3aa3c03aa13c97761
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/mesh.vert
@@ -0,0 +1,86 @@
+#version 330 core
+
+// Vertex Attributes
+layout(location = 0) in vec3 position;
+#ifdef NORMAL_LOC
+layout(location = NORMAL_LOC) in vec3 normal;
+#endif
+#ifdef TANGENT_LOC
+layout(location = TANGENT_LOC) in vec4 tangent;
+#endif
+#ifdef TEXCOORD_0_LOC
+layout(location = TEXCOORD_0_LOC) in vec2 texcoord_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+layout(location = TEXCOORD_1_LOC) in vec2 texcoord_1;
+#endif
+#ifdef COLOR_0_LOC
+layout(location = COLOR_0_LOC) in vec4 color_0;
+#endif
+#ifdef JOINTS_0_LOC
+layout(location = JOINTS_0_LOC) in vec4 joints_0;
+#endif
+#ifdef WEIGHTS_0_LOC
+layout(location = WEIGHTS_0_LOC) in vec4 weights_0;
+#endif
+layout(location = INST_M_LOC) in mat4 inst_m;
+
+// Uniforms
+uniform mat4 M;
+uniform mat4 V;
+uniform mat4 P;
+
+// Outputs
+out vec3 frag_position;
+#ifdef NORMAL_LOC
+out vec3 frag_normal;
+#endif
+#ifdef HAS_NORMAL_TEX
+#ifdef TANGENT_LOC
+#ifdef NORMAL_LOC
+out mat3 tbn;
+#endif
+#endif
+#endif
+#ifdef TEXCOORD_0_LOC
+out vec2 uv_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+out vec2 uv_1;
+#endif
+#ifdef COLOR_0_LOC
+out vec4 color_multiplier;
+#endif
+
+
+void main()
+{
+ gl_Position = P * V * M * inst_m * vec4(position, 1);
+ frag_position = vec3(M * inst_m * vec4(position, 1.0));
+
+ mat4 N = transpose(inverse(M * inst_m));
+
+#ifdef NORMAL_LOC
+ frag_normal = normalize(vec3(N * vec4(normal, 0.0)));
+#endif
+
+#ifdef HAS_NORMAL_TEX
+#ifdef TANGENT_LOC
+#ifdef NORMAL_LOC
+ vec3 normal_w = normalize(vec3(N * vec4(normal, 0.0)));
+ vec3 tangent_w = normalize(vec3(N * vec4(tangent.xyz, 0.0)));
+ vec3 bitangent_w = cross(normal_w, tangent_w) * tangent.w;
+ tbn = mat3(tangent_w, bitangent_w, normal_w);
+#endif
+#endif
+#endif
+#ifdef TEXCOORD_0_LOC
+ uv_0 = texcoord_0;
+#endif
+#ifdef TEXCOORD_1_LOC
+ uv_1 = texcoord_1;
+#endif
+#ifdef COLOR_0_LOC
+ color_multiplier = color_0;
+#endif
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/mesh_depth.frag b/generate_human_motion/pyrender/pyrender/shaders/mesh_depth.frag
new file mode 100644
index 0000000000000000000000000000000000000000..d8b1fac6091cfa457ba835ae0758e955f06d8754
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/mesh_depth.frag
@@ -0,0 +1,8 @@
+#version 330 core
+
+out vec4 frag_color;
+
+void main()
+{
+ frag_color = vec4(1.0);
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/mesh_depth.vert b/generate_human_motion/pyrender/pyrender/shaders/mesh_depth.vert
new file mode 100644
index 0000000000000000000000000000000000000000..e534c058fb3e7b0efbec090513d55982db68ccaf
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/mesh_depth.vert
@@ -0,0 +1,13 @@
+#version 330 core
+layout(location = 0) in vec3 position;
+layout(location = INST_M_LOC) in mat4 inst_m;
+
+uniform mat4 P;
+uniform mat4 V;
+uniform mat4 M;
+
+void main()
+{
+ mat4 light_matrix = P * V;
+ gl_Position = light_matrix * M * inst_m * vec4(position, 1.0);
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/segmentation.frag b/generate_human_motion/pyrender/pyrender/shaders/segmentation.frag
new file mode 100644
index 0000000000000000000000000000000000000000..40deb92cbdef3ec9fd952632624cd5f4b5ce0c84
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/segmentation.frag
@@ -0,0 +1,13 @@
+#version 330 core
+
+uniform vec3 color;
+out vec4 frag_color;
+
+///////////////////////////////////////////////////////////////////////////////
+// MAIN
+///////////////////////////////////////////////////////////////////////////////
+void main()
+{
+ frag_color = vec4(color, 1.0);
+ //frag_color = vec4(1.0, 0.5, 0.5, 1.0);
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/segmentation.vert b/generate_human_motion/pyrender/pyrender/shaders/segmentation.vert
new file mode 100644
index 0000000000000000000000000000000000000000..503382599dae3c9415845f35b99d6678cfc7f716
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/segmentation.vert
@@ -0,0 +1,14 @@
+#version 330 core
+layout(location = 0) in vec3 position;
+layout(location = INST_M_LOC) in mat4 inst_m;
+
+uniform mat4 P;
+uniform mat4 V;
+uniform mat4 M;
+
+void main()
+{
+ mat4 light_matrix = P * V;
+ gl_Position = light_matrix * M * inst_m * vec4(position, 1.0);
+}
+
diff --git a/generate_human_motion/pyrender/pyrender/shaders/text.frag b/generate_human_motion/pyrender/pyrender/shaders/text.frag
new file mode 100644
index 0000000000000000000000000000000000000000..486c97dc94ed5e9083ae348bc1e85c5cb26c44dc
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/text.frag
@@ -0,0 +1,12 @@
+#version 330 core
+in vec2 uv;
+out vec4 color;
+
+uniform sampler2D text;
+uniform vec4 text_color;
+
+void main()
+{
+ vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, uv).r);
+ color = text_color * sampled;
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/text.vert b/generate_human_motion/pyrender/pyrender/shaders/text.vert
new file mode 100644
index 0000000000000000000000000000000000000000..005bc439b3d63522df99e5db2088953eb8defcf4
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/text.vert
@@ -0,0 +1,12 @@
+#version 330 core
+layout (location = 0) in vec4 vertex;
+
+out vec2 uv;
+
+uniform mat4 projection;
+
+void main()
+{
+ gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);
+ uv = vertex.zw;
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/vertex_normals.frag b/generate_human_motion/pyrender/pyrender/shaders/vertex_normals.frag
new file mode 100644
index 0000000000000000000000000000000000000000..edf5beb7f283dd67e1710bff922555539966cee4
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/vertex_normals.frag
@@ -0,0 +1,10 @@
+#version 330 core
+
+out vec4 frag_color;
+
+uniform vec4 normal_color;
+
+void main()
+{
+ frag_color = normal_color;
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/vertex_normals.geom b/generate_human_motion/pyrender/pyrender/shaders/vertex_normals.geom
new file mode 100644
index 0000000000000000000000000000000000000000..57f0b0e645e72d41116f5767d66fc37d01ed2714
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/vertex_normals.geom
@@ -0,0 +1,74 @@
+#version 330 core
+
+layout (triangles) in;
+
+#ifdef FACE_NORMALS
+
+#ifdef VERTEX_NORMALS
+ layout (line_strip, max_vertices = 8) out;
+#else
+ layout (line_strip, max_vertices = 2) out;
+#endif
+
+#else
+
+ layout (line_strip, max_vertices = 6) out;
+
+#endif
+
+in VS_OUT {
+ vec3 position;
+ vec3 normal;
+ mat4 mvp;
+} gs_in[];
+
+uniform float normal_magnitude;
+
+void GenerateVertNormal(int index)
+{
+
+ vec4 p0 = gs_in[index].mvp * vec4(gs_in[index].position, 1.0);
+ vec4 p1 = gs_in[index].mvp * vec4(normal_magnitude * normalize(gs_in[index].normal) + gs_in[index].position, 1.0);
+ gl_Position = p0;
+ EmitVertex();
+ gl_Position = p1;
+ EmitVertex();
+ EndPrimitive();
+}
+
+void GenerateFaceNormal()
+{
+ vec3 p0 = gs_in[0].position.xyz;
+ vec3 p1 = gs_in[1].position.xyz;
+ vec3 p2 = gs_in[2].position.xyz;
+
+ vec3 v0 = p0 - p1;
+ vec3 v1 = p2 - p1;
+
+ vec3 N = normalize(cross(v1, v0));
+ vec3 P = (p0 + p1 + p2) / 3.0;
+
+ vec4 np0 = gs_in[0].mvp * vec4(P, 1.0);
+ vec4 np1 = gs_in[0].mvp * vec4(normal_magnitude * N + P, 1.0);
+
+ gl_Position = np0;
+ EmitVertex();
+ gl_Position = np1;
+ EmitVertex();
+ EndPrimitive();
+}
+
+void main()
+{
+
+#ifdef FACE_NORMALS
+ GenerateFaceNormal();
+#endif
+
+#ifdef VERTEX_NORMALS
+ GenerateVertNormal(0);
+ GenerateVertNormal(1);
+ GenerateVertNormal(2);
+#endif
+
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/vertex_normals.vert b/generate_human_motion/pyrender/pyrender/shaders/vertex_normals.vert
new file mode 100644
index 0000000000000000000000000000000000000000..be22eed2a0e904bcaf1ac5a4721558e574cddc62
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/vertex_normals.vert
@@ -0,0 +1,27 @@
+#version 330 core
+
+// Inputs
+layout(location = 0) in vec3 position;
+layout(location = NORMAL_LOC) in vec3 normal;
+layout(location = INST_M_LOC) in mat4 inst_m;
+
+// Output data
+out VS_OUT {
+ vec3 position;
+ vec3 normal;
+ mat4 mvp;
+} vs_out;
+
+// Uniform data
+uniform mat4 M;
+uniform mat4 V;
+uniform mat4 P;
+
+// Render loop
+void main() {
+ vs_out.mvp = P * V * M * inst_m;
+ vs_out.position = position;
+ vs_out.normal = normal;
+
+ gl_Position = vec4(position, 1.0);
+}
diff --git a/generate_human_motion/pyrender/pyrender/shaders/vertex_normals_pc.geom b/generate_human_motion/pyrender/pyrender/shaders/vertex_normals_pc.geom
new file mode 100644
index 0000000000000000000000000000000000000000..4ea4e7b8542703f64b8d28fd187e425137861fe4
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/shaders/vertex_normals_pc.geom
@@ -0,0 +1,29 @@
+#version 330 core
+
+layout (points) in;
+
+layout (line_strip, max_vertices = 2) out;
+
+in VS_OUT {
+ vec3 position;
+ vec3 normal;
+ mat4 mvp;
+} gs_in[];
+
+uniform float normal_magnitude;
+
+void GenerateVertNormal(int index)
+{
+ vec4 p0 = gs_in[index].mvp * vec4(gs_in[index].position, 1.0);
+ vec4 p1 = gs_in[index].mvp * vec4(normal_magnitude * normalize(gs_in[index].normal) + gs_in[index].position, 1.0);
+ gl_Position = p0;
+ EmitVertex();
+ gl_Position = p1;
+ EmitVertex();
+ EndPrimitive();
+}
+
+void main()
+{
+ GenerateVertNormal(0);
+}
diff --git a/generate_human_motion/pyrender/pyrender/texture.py b/generate_human_motion/pyrender/pyrender/texture.py
new file mode 100644
index 0000000000000000000000000000000000000000..477759729d7b995a4f276e81d649617d045a066e
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/texture.py
@@ -0,0 +1,259 @@
+"""Textures, conforming to the glTF 2.0 standards as specified in
+https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-texture
+
+Author: Matthew Matl
+"""
+import numpy as np
+
+from OpenGL.GL import *
+
+from .utils import format_texture_source
+from .sampler import Sampler
+
+
+class Texture(object):
+ """A texture and its sampler.
+
+ Parameters
+ ----------
+ name : str, optional
+ The user-defined name of this object.
+ sampler : :class:`Sampler`
+ The sampler used by this texture.
+ source : (h,w,c) uint8 or (h,w,c) float or :class:`PIL.Image.Image`
+ The image used by this texture. If None, the texture is created
+ empty and width and height must be specified.
+ source_channels : str
+ Either `D`, `R`, `RG`, `GB`, `RGB`, or `RGBA`. Indicates the
+ channels to extract from `source`. Any missing channels will be filled
+ with `1.0`.
+ width : int, optional
+ For empty textures, the width of the texture buffer.
+ height : int, optional
+ For empty textures, the height of the texture buffer.
+ tex_type : int
+ Either GL_TEXTURE_2D or GL_TEXTURE_CUBE.
+ data_format : int
+ For now, just GL_FLOAT.
+ """
+
+ def __init__(self,
+ name=None,
+ sampler=None,
+ source=None,
+ source_channels=None,
+ width=None,
+ height=None,
+ tex_type=GL_TEXTURE_2D,
+ data_format=GL_UNSIGNED_BYTE):
+ self.source_channels = source_channels
+ self.name = name
+ self.sampler = sampler
+ self.source = source
+ self.width = width
+ self.height = height
+ self.tex_type = tex_type
+ self.data_format = data_format
+
+ self._texid = None
+ self._is_transparent = False
+
+ @property
+ def name(self):
+ """str : The user-defined name of this object.
+ """
+ return self._name
+
+ @name.setter
+ def name(self, value):
+ if value is not None:
+ value = str(value)
+ self._name = value
+
+ @property
+ def sampler(self):
+ """:class:`Sampler` : The sampler used by this texture.
+ """
+ return self._sampler
+
+ @sampler.setter
+ def sampler(self, value):
+ if value is None:
+ value = Sampler()
+ self._sampler = value
+
+ @property
+ def source(self):
+ """(h,w,c) uint8 or float or :class:`PIL.Image.Image` : The image
+ used in this texture.
+ """
+ return self._source
+
+ @source.setter
+ def source(self, value):
+ if value is None:
+ self._source = None
+ else:
+ self._source = format_texture_source(value, self.source_channels)
+ self._is_transparent = False
+
+ @property
+ def source_channels(self):
+ """str : The channels that were extracted from the original source.
+ """
+ return self._source_channels
+
+ @source_channels.setter
+ def source_channels(self, value):
+ self._source_channels = value
+
+ @property
+ def width(self):
+ """int : The width of the texture buffer.
+ """
+ return self._width
+
+ @width.setter
+ def width(self, value):
+ self._width = value
+
+ @property
+ def height(self):
+ """int : The height of the texture buffer.
+ """
+ return self._height
+
+ @height.setter
+ def height(self, value):
+ self._height = value
+
+ @property
+ def tex_type(self):
+ """int : The type of the texture.
+ """
+ return self._tex_type
+
+ @tex_type.setter
+ def tex_type(self, value):
+ self._tex_type = value
+
+ @property
+ def data_format(self):
+ """int : The format of the texture data.
+ """
+ return self._data_format
+
+ @data_format.setter
+ def data_format(self, value):
+ self._data_format = value
+
+ def is_transparent(self, cutoff=1.0):
+ """bool : If True, the texture is partially transparent.
+ """
+ if self._is_transparent is None:
+ self._is_transparent = False
+ if self.source_channels == 'RGBA' and self.source is not None:
+ if np.any(self.source[:,:,3] < cutoff):
+ self._is_transparent = True
+ return self._is_transparent
+
+ def delete(self):
+ """Remove this texture from the OpenGL context.
+ """
+ self._unbind()
+ self._remove_from_context()
+
+ ##################
+ # OpenGL code
+ ##################
+ def _add_to_context(self):
+ if self._texid is not None:
+ raise ValueError('Texture already loaded into OpenGL context')
+
+ fmt = GL_DEPTH_COMPONENT
+ if self.source_channels == 'R':
+ fmt = GL_RED
+ elif self.source_channels == 'RG' or self.source_channels == 'GB':
+ fmt = GL_RG
+ elif self.source_channels == 'RGB':
+ fmt = GL_RGB
+ elif self.source_channels == 'RGBA':
+ fmt = GL_RGBA
+
+ # Generate the OpenGL texture
+ self._texid = glGenTextures(1)
+ glBindTexture(self.tex_type, self._texid)
+
+ # Flip data for OpenGL buffer
+ data = None
+ width = self.width
+ height = self.height
+ if self.source is not None:
+ data = np.ascontiguousarray(np.flip(self.source, axis=0).flatten())
+ width = self.source.shape[1]
+ height = self.source.shape[0]
+
+ # Bind texture and generate mipmaps
+ glTexImage2D(
+ self.tex_type, 0, fmt, width, height, 0, fmt,
+ self.data_format, data
+ )
+ if self.source is not None:
+ glGenerateMipmap(self.tex_type)
+
+ if self.sampler.magFilter is not None:
+ glTexParameteri(
+ self.tex_type, GL_TEXTURE_MAG_FILTER, self.sampler.magFilter
+ )
+ else:
+ if self.source is not None:
+ glTexParameteri(self.tex_type, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
+ else:
+ glTexParameteri(self.tex_type, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
+ if self.sampler.minFilter is not None:
+ glTexParameteri(
+ self.tex_type, GL_TEXTURE_MIN_FILTER, self.sampler.minFilter
+ )
+ else:
+ if self.source is not None:
+ glTexParameteri(self.tex_type, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)
+ else:
+ glTexParameteri(self.tex_type, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
+
+ glTexParameteri(self.tex_type, GL_TEXTURE_WRAP_S, self.sampler.wrapS)
+ glTexParameteri(self.tex_type, GL_TEXTURE_WRAP_T, self.sampler.wrapT)
+ border_color = 255 * np.ones(4).astype(np.uint8)
+ if self.data_format == GL_FLOAT:
+ border_color = np.ones(4).astype(np.float32)
+ glTexParameterfv(
+ self.tex_type, GL_TEXTURE_BORDER_COLOR,
+ border_color
+ )
+
+ # Unbind texture
+ glBindTexture(self.tex_type, 0)
+
+ def _remove_from_context(self):
+ if self._texid is not None:
+ # TODO OPENGL BUG?
+ # glDeleteTextures(1, [self._texid])
+ glDeleteTextures([self._texid])
+ self._texid = None
+
+ def _in_context(self):
+ return self._texid is not None
+
+ def _bind(self):
+ # TODO HANDLE INDEXING INTO OTHER UV's
+ glBindTexture(self.tex_type, self._texid)
+
+ def _unbind(self):
+ glBindTexture(self.tex_type, 0)
+
+ def _bind_as_depth_attachment(self):
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+ self.tex_type, self._texid, 0)
+
+ def _bind_as_color_attachment(self):
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ self.tex_type, self._texid, 0)
diff --git a/generate_human_motion/pyrender/pyrender/trackball.py b/generate_human_motion/pyrender/pyrender/trackball.py
new file mode 100644
index 0000000000000000000000000000000000000000..3e57a0e82d3f07b80754f575c28a0e05cb73fc50
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/trackball.py
@@ -0,0 +1,216 @@
+"""Trackball class for 3D manipulation of viewpoints.
+"""
+import numpy as np
+
+import trimesh.transformations as transformations
+
+
+class Trackball(object):
+ """A trackball class for creating camera transforms from mouse movements.
+ """
+ STATE_ROTATE = 0
+ STATE_PAN = 1
+ STATE_ROLL = 2
+ STATE_ZOOM = 3
+
+ def __init__(self, pose, size, scale,
+ target=np.array([0.0, 0.0, 0.0])):
+ """Initialize a trackball with an initial camera-to-world pose
+ and the given parameters.
+
+ Parameters
+ ----------
+ pose : [4,4]
+ An initial camera-to-world pose for the trackball.
+
+ size : (float, float)
+ The width and height of the camera image in pixels.
+
+ scale : float
+ The diagonal of the scene's bounding box --
+ used for ensuring translation motions are sufficiently
+ fast for differently-sized scenes.
+
+ target : (3,) float
+ The center of the scene in world coordinates.
+ The trackball will revolve around this point.
+ """
+ self._size = np.array(size)
+ self._scale = float(scale)
+
+ self._pose = pose
+ self._n_pose = pose
+
+ self._target = target
+ self._n_target = target
+
+ self._state = Trackball.STATE_ROTATE
+
+ @property
+ def pose(self):
+ """autolab_core.RigidTransform : The current camera-to-world pose.
+ """
+ return self._n_pose
+
+ def set_state(self, state):
+ """Set the state of the trackball in order to change the effect of
+ dragging motions.
+
+ Parameters
+ ----------
+ state : int
+ One of Trackball.STATE_ROTATE, Trackball.STATE_PAN,
+ Trackball.STATE_ROLL, and Trackball.STATE_ZOOM.
+ """
+ self._state = state
+
+ def resize(self, size):
+ """Resize the window.
+
+ Parameters
+ ----------
+ size : (float, float)
+ The new width and height of the camera image in pixels.
+ """
+ self._size = np.array(size)
+
+ def down(self, point):
+ """Record an initial mouse press at a given point.
+
+ Parameters
+ ----------
+ point : (2,) int
+ The x and y pixel coordinates of the mouse press.
+ """
+ self._pdown = np.array(point, dtype=np.float32)
+ self._pose = self._n_pose
+ self._target = self._n_target
+
+ def drag(self, point):
+ """Update the tracball during a drag.
+
+ Parameters
+ ----------
+ point : (2,) int
+ The current x and y pixel coordinates of the mouse during a drag.
+ This will compute a movement for the trackball with the relative
+ motion between this point and the one marked by down().
+ """
+ point = np.array(point, dtype=np.float32)
+ dx, dy = point - self._pdown
+ mindim = 0.3 * np.min(self._size)
+
+ target = self._target
+ x_axis = self._pose[:3,0].flatten()
+ y_axis = self._pose[:3,1].flatten()
+ z_axis = self._pose[:3,2].flatten()
+ eye = self._pose[:3,3].flatten()
+
+ # Interpret drag as a rotation
+ if self._state == Trackball.STATE_ROTATE:
+ x_angle = -dx / mindim
+ x_rot_mat = transformations.rotation_matrix(
+ x_angle, y_axis, target
+ )
+
+ y_angle = dy / mindim
+ y_rot_mat = transformations.rotation_matrix(
+ y_angle, x_axis, target
+ )
+
+ self._n_pose = y_rot_mat.dot(x_rot_mat.dot(self._pose))
+
+ # Interpret drag as a roll about the camera axis
+ elif self._state == Trackball.STATE_ROLL:
+ center = self._size / 2.0
+ v_init = self._pdown - center
+ v_curr = point - center
+ v_init = v_init / np.linalg.norm(v_init)
+ v_curr = v_curr / np.linalg.norm(v_curr)
+
+ theta = (-np.arctan2(v_curr[1], v_curr[0]) +
+ np.arctan2(v_init[1], v_init[0]))
+
+ rot_mat = transformations.rotation_matrix(theta, z_axis, target)
+
+ self._n_pose = rot_mat.dot(self._pose)
+
+ # Interpret drag as a camera pan in view plane
+ elif self._state == Trackball.STATE_PAN:
+ dx = -dx / (5.0 * mindim) * self._scale
+ dy = -dy / (5.0 * mindim) * self._scale
+
+ translation = dx * x_axis + dy * y_axis
+ self._n_target = self._target + translation
+ t_tf = np.eye(4)
+ t_tf[:3,3] = translation
+ self._n_pose = t_tf.dot(self._pose)
+
+ # Interpret drag as a zoom motion
+ elif self._state == Trackball.STATE_ZOOM:
+ radius = np.linalg.norm(eye - target)
+ ratio = 0.0
+ if dy > 0:
+ ratio = np.exp(abs(dy) / (0.5 * self._size[1])) - 1.0
+ elif dy < 0:
+ ratio = 1.0 - np.exp(dy / (0.5 * (self._size[1])))
+ translation = -np.sign(dy) * ratio * radius * z_axis
+ t_tf = np.eye(4)
+ t_tf[:3,3] = translation
+ self._n_pose = t_tf.dot(self._pose)
+
+ def scroll(self, clicks):
+ """Zoom using a mouse scroll wheel motion.
+
+ Parameters
+ ----------
+ clicks : int
+ The number of clicks. Positive numbers indicate forward wheel
+ movement.
+ """
+ target = self._target
+ ratio = 0.90
+
+ mult = 1.0
+ if clicks > 0:
+ mult = ratio**clicks
+ elif clicks < 0:
+ mult = (1.0 / ratio)**abs(clicks)
+
+ z_axis = self._n_pose[:3,2].flatten()
+ eye = self._n_pose[:3,3].flatten()
+ radius = np.linalg.norm(eye - target)
+ translation = (mult * radius - radius) * z_axis
+ t_tf = np.eye(4)
+ t_tf[:3,3] = translation
+ self._n_pose = t_tf.dot(self._n_pose)
+
+ z_axis = self._pose[:3,2].flatten()
+ eye = self._pose[:3,3].flatten()
+ radius = np.linalg.norm(eye - target)
+ translation = (mult * radius - radius) * z_axis
+ t_tf = np.eye(4)
+ t_tf[:3,3] = translation
+ self._pose = t_tf.dot(self._pose)
+
+ def rotate(self, azimuth, axis=None):
+ """Rotate the trackball about the "Up" axis by azimuth radians.
+
+ Parameters
+ ----------
+ azimuth : float
+ The number of radians to rotate.
+ """
+ target = self._target
+
+ y_axis = self._n_pose[:3,1].flatten()
+ if axis is not None:
+ y_axis = axis
+ x_rot_mat = transformations.rotation_matrix(azimuth, y_axis, target)
+ self._n_pose = x_rot_mat.dot(self._n_pose)
+
+ y_axis = self._pose[:3,1].flatten()
+ if axis is not None:
+ y_axis = axis
+ x_rot_mat = transformations.rotation_matrix(azimuth, y_axis, target)
+ self._pose = x_rot_mat.dot(self._pose)
diff --git a/generate_human_motion/pyrender/pyrender/utils.py b/generate_human_motion/pyrender/pyrender/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..48a11faf991606ad7fb0691582f0bc6f06101a45
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/utils.py
@@ -0,0 +1,115 @@
+import numpy as np
+from PIL import Image
+
+
+def format_color_vector(value, length):
+ """Format a color vector.
+ """
+ if isinstance(value, int):
+ value = value / 255.0
+ if isinstance(value, float):
+ value = np.repeat(value, length)
+ if isinstance(value, list) or isinstance(value, tuple):
+ value = np.array(value)
+ if isinstance(value, np.ndarray):
+ value = value.squeeze()
+ if np.issubdtype(value.dtype, np.integer):
+ value = (value / 255.0).astype(np.float32)
+ if value.ndim != 1:
+ raise ValueError('Format vector takes only 1-D vectors')
+ if length > value.shape[0]:
+ value = np.hstack((value, np.ones(length - value.shape[0])))
+ elif length < value.shape[0]:
+ value = value[:length]
+ else:
+ raise ValueError('Invalid vector data type')
+
+ return value.squeeze().astype(np.float32)
+
+
+def format_color_array(value, shape):
+ """Format an array of colors.
+ """
+ # Convert uint8 to floating
+ value = np.asanyarray(value)
+ if np.issubdtype(value.dtype, np.integer):
+ value = (value / 255.0).astype(np.float32)
+
+ # Match up shapes
+ if value.ndim == 1:
+ value = np.tile(value, (shape[0],1))
+ if value.shape[1] < shape[1]:
+ nc = shape[1] - value.shape[1]
+ value = np.column_stack((value, np.ones((value.shape[0], nc))))
+ elif value.shape[1] > shape[1]:
+ value = value[:,:shape[1]]
+ return value.astype(np.float32)
+
+
+def format_texture_source(texture, target_channels='RGB'):
+ """Format a texture as a float32 np array.
+ """
+
+ # Pass through None
+ if texture is None:
+ return None
+
+ # Convert PIL images into numpy arrays
+ if isinstance(texture, Image.Image):
+ if texture.mode == 'P' and target_channels in ('RGB', 'RGBA'):
+ texture = np.array(texture.convert(target_channels))
+ else:
+ texture = np.array(texture)
+
+ # Format numpy arrays
+ if isinstance(texture, np.ndarray):
+ if np.issubdtype(texture.dtype, np.floating):
+ texture = np.array(texture * 255.0, dtype=np.uint8)
+ elif np.issubdtype(texture.dtype, np.integer):
+ texture = texture.astype(np.uint8)
+ else:
+ raise TypeError('Invalid type {} for texture'.format(
+ type(texture)
+ ))
+
+ # Format array by picking out correct texture channels or padding
+ if texture.ndim == 2:
+ texture = texture[:,:,np.newaxis]
+ if target_channels == 'R':
+ texture = texture[:,:,0]
+ texture = texture.squeeze()
+ elif target_channels == 'RG':
+ if texture.shape[2] == 1:
+ texture = np.repeat(texture, 2, axis=2)
+ else:
+ texture = texture[:,:,(0,1)]
+ elif target_channels == 'GB':
+ if texture.shape[2] == 1:
+ texture = np.repeat(texture, 2, axis=2)
+ elif texture.shape[2] > 2:
+ texture = texture[:,:,(1,2)]
+ elif target_channels == 'RGB':
+ if texture.shape[2] == 1:
+ texture = np.repeat(texture, 3, axis=2)
+ elif texture.shape[2] == 2:
+ raise ValueError('Cannot reformat 2-channel texture into RGB')
+ else:
+ texture = texture[:,:,(0,1,2)]
+ elif target_channels == 'RGBA':
+ if texture.shape[2] == 1:
+ texture = np.repeat(texture, 4, axis=2)
+ texture[:,:,3] = 255
+ elif texture.shape[2] == 2:
+ raise ValueError('Cannot reformat 2-channel texture into RGBA')
+ elif texture.shape[2] == 3:
+ tx = np.empty((texture.shape[0], texture.shape[1], 4), dtype=np.uint8)
+ tx[:,:,:3] = texture
+ tx[:,:,3] = 255
+ texture = tx
+ else:
+ raise ValueError('Invalid texture channel specification: {}'
+ .format(target_channels))
+ else:
+ raise TypeError('Invalid type {} for texture'.format(type(texture)))
+
+ return texture
diff --git a/generate_human_motion/pyrender/pyrender/version.py b/generate_human_motion/pyrender/pyrender/version.py
new file mode 100644
index 0000000000000000000000000000000000000000..a33fc87f61f528780e3319a5160769cc84512b1b
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/version.py
@@ -0,0 +1 @@
+__version__ = '0.1.45'
diff --git a/generate_human_motion/pyrender/pyrender/viewer.py b/generate_human_motion/pyrender/pyrender/viewer.py
new file mode 100644
index 0000000000000000000000000000000000000000..d2326c38205c6eaddb4f567e3b088329187af258
--- /dev/null
+++ b/generate_human_motion/pyrender/pyrender/viewer.py
@@ -0,0 +1,1160 @@
+"""A pyglet-based interactive 3D scene viewer.
+"""
+import copy
+import os
+import sys
+from threading import Thread, RLock
+import time
+
+import imageio
+import numpy as np
+import OpenGL
+import trimesh
+
+try:
+ from Tkinter import Tk, tkFileDialog as filedialog
+except Exception:
+ try:
+ from tkinter import Tk, filedialog as filedialog
+ except Exception:
+ pass
+
+from .constants import (TARGET_OPEN_GL_MAJOR, TARGET_OPEN_GL_MINOR,
+ MIN_OPEN_GL_MAJOR, MIN_OPEN_GL_MINOR,
+ TEXT_PADDING, DEFAULT_SCENE_SCALE,
+ DEFAULT_Z_FAR, DEFAULT_Z_NEAR, RenderFlags, TextAlign)
+from .light import DirectionalLight
+from .node import Node
+from .camera import PerspectiveCamera, OrthographicCamera, IntrinsicsCamera
+from .trackball import Trackball
+from .renderer import Renderer
+from .mesh import Mesh
+
+import pyglet
+from pyglet import clock
+pyglet.options['shadow_window'] = False
+
+
+class Viewer(pyglet.window.Window):
+ """An interactive viewer for 3D scenes.
+
+ The viewer's camera is separate from the scene's, but will take on
+ the parameters of the scene's main view camera and start in the same pose.
+ If the scene does not have a camera, a suitable default will be provided.
+
+ Parameters
+ ----------
+ scene : :class:`Scene`
+ The scene to visualize.
+ viewport_size : (2,) int
+ The width and height of the initial viewing window.
+ render_flags : dict
+ A set of flags for rendering the scene. Described in the note below.
+ viewer_flags : dict
+ A set of flags for controlling the viewer's behavior.
+ Described in the note below.
+ registered_keys : dict
+ A map from ASCII key characters to tuples containing:
+
+ - A function to be called whenever the key is pressed,
+ whose first argument will be the viewer itself.
+ - (Optionally) A list of additional positional arguments
+ to be passed to the function.
+ - (Optionally) A dict of keyword arguments to be passed
+ to the function.
+
+ kwargs : dict
+ Any keyword arguments left over will be interpreted as belonging to
+ either the :attr:`.Viewer.render_flags` or :attr:`.Viewer.viewer_flags`
+ dictionaries. Those flag sets will be updated appropriately.
+
+ Note
+ ----
+ The basic commands for moving about the scene are given as follows:
+
+ - **Rotating about the scene**: Hold the left mouse button and
+ drag the cursor.
+ - **Rotating about the view axis**: Hold ``CTRL`` and the left mouse
+ button and drag the cursor.
+ - **Panning**:
+
+ - Hold SHIFT, then hold the left mouse button and drag the cursor, or
+ - Hold the middle mouse button and drag the cursor.
+
+ - **Zooming**:
+
+ - Scroll the mouse wheel, or
+ - Hold the right mouse button and drag the cursor.
+
+ Other keyboard commands are as follows:
+
+ - ``a``: Toggles rotational animation mode.
+ - ``c``: Toggles backface culling.
+ - ``f``: Toggles fullscreen mode.
+ - ``h``: Toggles shadow rendering.
+ - ``i``: Toggles axis display mode
+ (no axes, world axis, mesh axes, all axes).
+ - ``l``: Toggles lighting mode
+ (scene lighting, Raymond lighting, or direct lighting).
+ - ``m``: Toggles face normal visualization.
+ - ``n``: Toggles vertex normal visualization.
+ - ``o``: Toggles orthographic mode.
+ - ``q``: Quits the viewer.
+ - ``r``: Starts recording a GIF, and pressing again stops recording
+ and opens a file dialog.
+ - ``s``: Opens a file dialog to save the current view as an image.
+ - ``w``: Toggles wireframe mode
+ (scene default, flip wireframes, all wireframe, or all solid).
+ - ``z``: Resets the camera to the initial view.
+
+ Note
+ ----
+ The valid keys for ``render_flags`` are as follows:
+
+ - ``flip_wireframe``: `bool`, If `True`, all objects will have their
+ wireframe modes flipped from what their material indicates.
+ Defaults to `False`.
+ - ``all_wireframe``: `bool`, If `True`, all objects will be rendered
+ in wireframe mode. Defaults to `False`.
+ - ``all_solid``: `bool`, If `True`, all objects will be rendered in
+ solid mode. Defaults to `False`.
+ - ``shadows``: `bool`, If `True`, shadows will be rendered.
+ Defaults to `False`.
+ - ``vertex_normals``: `bool`, If `True`, vertex normals will be
+ rendered as blue lines. Defaults to `False`.
+ - ``face_normals``: `bool`, If `True`, face normals will be rendered as
+ blue lines. Defaults to `False`.
+ - ``cull_faces``: `bool`, If `True`, backfaces will be culled.
+ Defaults to `True`.
+ - ``point_size`` : float, The point size in pixels. Defaults to 1px.
+
+ Note
+ ----
+ The valid keys for ``viewer_flags`` are as follows:
+
+ - ``rotate``: `bool`, If `True`, the scene's camera will rotate
+ about an axis. Defaults to `False`.
+ - ``rotate_rate``: `float`, The rate of rotation in radians per second.
+ Defaults to `PI / 3.0`.
+ - ``rotate_axis``: `(3,) float`, The axis in world coordinates to rotate
+ about. Defaults to ``[0,0,1]``.
+ - ``view_center``: `(3,) float`, The position to rotate the scene about.
+ Defaults to the scene's centroid.
+ - ``use_raymond_lighting``: `bool`, If `True`, an additional set of three
+ directional lights that move with the camera will be added to the scene.
+ Defaults to `False`.
+ - ``use_direct_lighting``: `bool`, If `True`, an additional directional
+ light that moves with the camera and points out of it will be added to
+ the scene. Defaults to `False`.
+ - ``lighting_intensity``: `float`, The overall intensity of the
+ viewer's additional lights (when they're in use). Defaults to 3.0.
+ - ``use_perspective_cam``: `bool`, If `True`, a perspective camera will
+ be used. Otherwise, an orthographic camera is used. Defaults to `True`.
+ - ``save_directory``: `str`, A directory to open the file dialogs in.
+ Defaults to `None`.
+ - ``window_title``: `str`, A title for the viewer's application window.
+ Defaults to `"Scene Viewer"`.
+ - ``refresh_rate``: `float`, A refresh rate for rendering, in Hertz.
+ Defaults to `30.0`.
+ - ``fullscreen``: `bool`, Whether to make viewer fullscreen.
+ Defaults to `False`.
+ - ``show_world_axis``: `bool`, Whether to show the world axis.
+ Defaults to `False`.
+ - ``show_mesh_axes``: `bool`, Whether to show the individual mesh axes.
+ Defaults to `False`.
+ - ``caption``: `list of dict`, Text caption(s) to display on the viewer.
+ Defaults to `None`.
+
+ Note
+ ----
+ Animation can be accomplished by running the viewer with ``run_in_thread``
+ enabled. Then, just run a loop in your main thread, updating the scene as
+ needed. Before updating the scene, be sure to acquire the
+ :attr:`.Viewer.render_lock`, and release it when your update is done.
+ """
+
+ def __init__(self, scene, viewport_size=None,
+ render_flags=None, viewer_flags=None,
+ registered_keys=None, run_in_thread=False,
+ auto_start=True,
+ **kwargs):
+
+ #######################################################################
+ # Save attributes and flags
+ #######################################################################
+ if viewport_size is None:
+ viewport_size = (640, 480)
+ self._scene = scene
+ self._viewport_size = viewport_size
+ self._render_lock = RLock()
+ self._is_active = False
+ self._should_close = False
+ self._run_in_thread = run_in_thread
+ self._auto_start = auto_start
+
+ self._default_render_flags = {
+ 'flip_wireframe': False,
+ 'all_wireframe': False,
+ 'all_solid': False,
+ 'shadows': False,
+ 'vertex_normals': False,
+ 'face_normals': False,
+ 'cull_faces': True,
+ 'point_size': 1.0,
+ }
+ self._default_viewer_flags = {
+ 'mouse_pressed': False,
+ 'rotate': False,
+ 'rotate_rate': np.pi / 3.0,
+ 'rotate_axis': np.array([0.0, 0.0, 1.0]),
+ 'view_center': None,
+ 'record': False,
+ 'use_raymond_lighting': False,
+ 'use_direct_lighting': False,
+ 'lighting_intensity': 3.0,
+ 'use_perspective_cam': True,
+ 'save_directory': None,
+ 'window_title': 'Scene Viewer',
+ 'refresh_rate': 30.0,
+ 'fullscreen': False,
+ 'show_world_axis': False,
+ 'show_mesh_axes': False,
+ 'caption': None
+ }
+ self._render_flags = self._default_render_flags.copy()
+ self._viewer_flags = self._default_viewer_flags.copy()
+ self._viewer_flags['rotate_axis'] = (
+ self._default_viewer_flags['rotate_axis'].copy()
+ )
+
+ if render_flags is not None:
+ self._render_flags.update(render_flags)
+ if viewer_flags is not None:
+ self._viewer_flags.update(viewer_flags)
+
+ for key in kwargs:
+ if key in self.render_flags:
+ self._render_flags[key] = kwargs[key]
+ elif key in self.viewer_flags:
+ self._viewer_flags[key] = kwargs[key]
+
+ # TODO MAC OS BUG FOR SHADOWS
+ if sys.platform == 'darwin':
+ self._render_flags['shadows'] = False
+
+ self._registered_keys = {}
+ if registered_keys is not None:
+ self._registered_keys = {
+ ord(k.lower()): registered_keys[k] for k in registered_keys
+ }
+
+ #######################################################################
+ # Save internal settings
+ #######################################################################
+
+ # Set up caption stuff
+ self._message_text = None
+ self._ticks_till_fade = 2.0 / 3.0 * self.viewer_flags['refresh_rate']
+ self._message_opac = 1.0 + self._ticks_till_fade
+
+ # Set up raymond lights and direct lights
+ self._raymond_lights = self._create_raymond_lights()
+ self._direct_light = self._create_direct_light()
+
+ # Set up axes
+ self._axes = {}
+ self._axis_mesh = Mesh.from_trimesh(
+ trimesh.creation.axis(origin_size=0.1, axis_radius=0.05,
+ axis_length=1.0), smooth=False)
+ if self.viewer_flags['show_world_axis']:
+ self._set_axes(world=self.viewer_flags['show_world_axis'],
+ mesh=self.viewer_flags['show_mesh_axes'])
+
+ #######################################################################
+ # Set up camera node
+ #######################################################################
+ self._camera_node = None
+ self._prior_main_camera_node = None
+ self._default_camera_pose = None
+ self._default_persp_cam = None
+ self._default_orth_cam = None
+ self._trackball = None
+ self._saved_frames = []
+
+ # Extract main camera from scene and set up our mirrored copy
+ znear = None
+ zfar = None
+ if scene.main_camera_node is not None:
+ n = scene.main_camera_node
+ camera = copy.copy(n.camera)
+ if isinstance(camera, (PerspectiveCamera, IntrinsicsCamera)):
+ self._default_persp_cam = camera
+ znear = camera.znear
+ zfar = camera.zfar
+ elif isinstance(camera, OrthographicCamera):
+ self._default_orth_cam = camera
+ znear = camera.znear
+ zfar = camera.zfar
+ self._default_camera_pose = scene.get_pose(scene.main_camera_node)
+ self._prior_main_camera_node = n
+
+ # Set defaults as needed
+ if zfar is None:
+ zfar = max(scene.scale * 10.0, DEFAULT_Z_FAR)
+ if znear is None or znear == 0:
+ if scene.scale == 0:
+ znear = DEFAULT_Z_NEAR
+ else:
+ znear = min(scene.scale / 10.0, DEFAULT_Z_NEAR)
+
+ if self._default_persp_cam is None:
+ self._default_persp_cam = PerspectiveCamera(
+ yfov=np.pi / 3.0, znear=znear, zfar=zfar
+ )
+ if self._default_orth_cam is None:
+ xmag = ymag = scene.scale
+ if scene.scale == 0:
+ xmag = ymag = 1.0
+ self._default_orth_cam = OrthographicCamera(
+ xmag=xmag, ymag=ymag,
+ znear=znear,
+ zfar=zfar
+ )
+ if self._default_camera_pose is None:
+ self._default_camera_pose = self._compute_initial_camera_pose()
+
+ # Pick camera
+ if self.viewer_flags['use_perspective_cam']:
+ camera = self._default_persp_cam
+ else:
+ camera = self._default_orth_cam
+
+ self._camera_node = Node(
+ matrix=self._default_camera_pose, camera=camera
+ )
+ scene.add_node(self._camera_node)
+ scene.main_camera_node = self._camera_node
+ self._reset_view()
+
+ #######################################################################
+ # Initialize OpenGL context and renderer
+ #######################################################################
+ self._renderer = Renderer(
+ self._viewport_size[0], self._viewport_size[1],
+ self.render_flags['point_size']
+ )
+ self._is_active = True
+
+ if self.run_in_thread:
+ self._thread = Thread(target=self._init_and_start_app)
+ self._thread.start()
+ else:
+ if auto_start:
+ self._init_and_start_app()
+
+ def start(self):
+ self._init_and_start_app()
+
+ @property
+ def scene(self):
+ """:class:`.Scene` : The scene being visualized.
+ """
+ return self._scene
+
+ @property
+ def viewport_size(self):
+ """(2,) int : The width and height of the viewing window.
+ """
+ return self._viewport_size
+
+ @property
+ def render_lock(self):
+ """:class:`threading.RLock` : If acquired, prevents the viewer from
+ rendering until released.
+
+ Run :meth:`.Viewer.render_lock.acquire` before making updates to
+ the scene in a different thread, and run
+ :meth:`.Viewer.render_lock.release` once you're done to let the viewer
+ continue.
+ """
+ return self._render_lock
+
+ @property
+ def is_active(self):
+ """bool : `True` if the viewer is active, or `False` if it has
+ been closed.
+ """
+ return self._is_active
+
+ @property
+ def run_in_thread(self):
+ """bool : Whether the viewer was run in a separate thread.
+ """
+ return self._run_in_thread
+
+ @property
+ def render_flags(self):
+ """dict : Flags for controlling the renderer's behavior.
+
+ - ``flip_wireframe``: `bool`, If `True`, all objects will have their
+ wireframe modes flipped from what their material indicates.
+ Defaults to `False`.
+ - ``all_wireframe``: `bool`, If `True`, all objects will be rendered
+ in wireframe mode. Defaults to `False`.
+ - ``all_solid``: `bool`, If `True`, all objects will be rendered in
+ solid mode. Defaults to `False`.
+ - ``shadows``: `bool`, If `True`, shadows will be rendered.
+ Defaults to `False`.
+ - ``vertex_normals``: `bool`, If `True`, vertex normals will be
+ rendered as blue lines. Defaults to `False`.
+ - ``face_normals``: `bool`, If `True`, face normals will be rendered as
+ blue lines. Defaults to `False`.
+ - ``cull_faces``: `bool`, If `True`, backfaces will be culled.
+ Defaults to `True`.
+ - ``point_size`` : float, The point size in pixels. Defaults to 1px.
+
+ """
+ return self._render_flags
+
+ @render_flags.setter
+ def render_flags(self, value):
+ self._render_flags = value
+
+ @property
+ def viewer_flags(self):
+ """dict : Flags for controlling the viewer's behavior.
+
+ The valid keys for ``viewer_flags`` are as follows:
+
+ - ``rotate``: `bool`, If `True`, the scene's camera will rotate
+ about an axis. Defaults to `False`.
+ - ``rotate_rate``: `float`, The rate of rotation in radians per second.
+ Defaults to `PI / 3.0`.
+ - ``rotate_axis``: `(3,) float`, The axis in world coordinates to
+ rotate about. Defaults to ``[0,0,1]``.
+ - ``view_center``: `(3,) float`, The position to rotate the scene
+ about. Defaults to the scene's centroid.
+ - ``use_raymond_lighting``: `bool`, If `True`, an additional set of
+ three directional lights that move with the camera will be added to
+ the scene. Defaults to `False`.
+ - ``use_direct_lighting``: `bool`, If `True`, an additional directional
+ light that moves with the camera and points out of it will be
+ added to the scene. Defaults to `False`.
+ - ``lighting_intensity``: `float`, The overall intensity of the
+ viewer's additional lights (when they're in use). Defaults to 3.0.
+ - ``use_perspective_cam``: `bool`, If `True`, a perspective camera will
+ be used. Otherwise, an orthographic camera is used. Defaults to
+ `True`.
+ - ``save_directory``: `str`, A directory to open the file dialogs in.
+ Defaults to `None`.
+ - ``window_title``: `str`, A title for the viewer's application window.
+ Defaults to `"Scene Viewer"`.
+ - ``refresh_rate``: `float`, A refresh rate for rendering, in Hertz.
+ Defaults to `30.0`.
+ - ``fullscreen``: `bool`, Whether to make viewer fullscreen.
+ Defaults to `False`.
+ - ``show_world_axis``: `bool`, Whether to show the world axis.
+ Defaults to `False`.
+ - ``show_mesh_axes``: `bool`, Whether to show the individual mesh axes.
+ Defaults to `False`.
+ - ``caption``: `list of dict`, Text caption(s) to display on
+ the viewer. Defaults to `None`.
+
+ """
+ return self._viewer_flags
+
+ @viewer_flags.setter
+ def viewer_flags(self, value):
+ self._viewer_flags = value
+
+ @property
+ def registered_keys(self):
+ """dict : Map from ASCII key character to a handler function.
+
+ This is a map from ASCII key characters to tuples containing:
+
+ - A function to be called whenever the key is pressed,
+ whose first argument will be the viewer itself.
+ - (Optionally) A list of additional positional arguments
+ to be passed to the function.
+ - (Optionally) A dict of keyword arguments to be passed
+ to the function.
+
+ """
+ return self._registered_keys
+
+ @registered_keys.setter
+ def registered_keys(self, value):
+ self._registered_keys = value
+
+ def close_external(self):
+ """Close the viewer from another thread.
+
+ This function will wait for the actual close, so you immediately
+ manipulate the scene afterwards.
+ """
+ self._should_close = True
+ while self.is_active:
+ time.sleep(1.0 / self.viewer_flags['refresh_rate'])
+
+ def save_gif(self, filename=None):
+ """Save the stored GIF frames to a file.
+
+ To use this asynchronously, run the viewer with the ``record``
+ flag and the ``run_in_thread`` flags set.
+ Kill the viewer after your desired time with
+ :meth:`.Viewer.close_external`, and then call :meth:`.Viewer.save_gif`.
+
+ Parameters
+ ----------
+ filename : str
+ The file to save the GIF to. If not specified,
+ a file dialog will be opened to ask the user where
+ to save the GIF file.
+ """
+ if filename is None:
+ filename = self._get_save_filename(['gif', 'all'])
+ if filename is not None:
+ self.viewer_flags['save_directory'] = os.path.dirname(filename)
+ imageio.mimwrite(filename, self._saved_frames,
+ fps=self.viewer_flags['refresh_rate'],
+ palettesize=128, subrectangles=True)
+ self._saved_frames = []
+
+ def on_close(self):
+ """Exit the event loop when the window is closed.
+ """
+ # Remove our camera and restore the prior one
+ if self._camera_node is not None:
+ self.scene.remove_node(self._camera_node)
+ if self._prior_main_camera_node is not None:
+ self.scene.main_camera_node = self._prior_main_camera_node
+
+ # Delete any lighting nodes that we've attached
+ if self.viewer_flags['use_raymond_lighting']:
+ for n in self._raymond_lights:
+ if self.scene.has_node(n):
+ self.scene.remove_node(n)
+ if self.viewer_flags['use_direct_lighting']:
+ if self.scene.has_node(self._direct_light):
+ self.scene.remove_node(self._direct_light)
+
+ # Delete any axis nodes that we've attached
+ self._remove_axes()
+
+ # Delete renderer
+ if self._renderer is not None:
+ self._renderer.delete()
+ self._renderer = None
+
+ # Force clean-up of OpenGL context data
+ try:
+ OpenGL.contextdata.cleanupContext()
+ self.close()
+ except Exception:
+ pass
+ finally:
+ self._is_active = False
+ super(Viewer, self).on_close()
+ pyglet.app.exit()
+
+ def on_draw(self):
+ """Redraw the scene into the viewing window.
+ """
+ if self._renderer is None:
+ return
+
+ if self.run_in_thread or not self._auto_start:
+ self.render_lock.acquire()
+
+ # Make OpenGL context current
+ self.switch_to()
+
+ # Render the scene
+ self.clear()
+ self._render()
+
+ if self._message_text is not None:
+ self._renderer.render_text(
+ self._message_text,
+ self.viewport_size[0] - TEXT_PADDING,
+ TEXT_PADDING,
+ font_pt=20,
+ color=np.array([0.1, 0.7, 0.2,
+ np.clip(self._message_opac, 0.0, 1.0)]),
+ align=TextAlign.BOTTOM_RIGHT
+ )
+
+ if self.viewer_flags['caption'] is not None:
+ for caption in self.viewer_flags['caption']:
+ xpos, ypos = self._location_to_x_y(caption['location'])
+ self._renderer.render_text(
+ caption['text'],
+ xpos,
+ ypos,
+ font_name=caption['font_name'],
+ font_pt=caption['font_pt'],
+ color=caption['color'],
+ scale=caption['scale'],
+ align=caption['location']
+ )
+
+ if self.run_in_thread or not self._auto_start:
+ self.render_lock.release()
+
+ def on_resize(self, width, height):
+ """Resize the camera and trackball when the window is resized.
+ """
+ if self._renderer is None:
+ return
+
+ self._viewport_size = (width, height)
+ self._trackball.resize(self._viewport_size)
+ self._renderer.viewport_width = self._viewport_size[0]
+ self._renderer.viewport_height = self._viewport_size[1]
+ self.on_draw()
+
+ def on_mouse_press(self, x, y, buttons, modifiers):
+ """Record an initial mouse press.
+ """
+ self._trackball.set_state(Trackball.STATE_ROTATE)
+ if (buttons == pyglet.window.mouse.LEFT):
+ ctrl = (modifiers & pyglet.window.key.MOD_CTRL)
+ shift = (modifiers & pyglet.window.key.MOD_SHIFT)
+ if (ctrl and shift):
+ self._trackball.set_state(Trackball.STATE_ZOOM)
+ elif ctrl:
+ self._trackball.set_state(Trackball.STATE_ROLL)
+ elif shift:
+ self._trackball.set_state(Trackball.STATE_PAN)
+ elif (buttons == pyglet.window.mouse.MIDDLE):
+ self._trackball.set_state(Trackball.STATE_PAN)
+ elif (buttons == pyglet.window.mouse.RIGHT):
+ self._trackball.set_state(Trackball.STATE_ZOOM)
+
+ self._trackball.down(np.array([x, y]))
+
+ # Stop animating while using the mouse
+ self.viewer_flags['mouse_pressed'] = True
+
+ def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
+ """Record a mouse drag.
+ """
+ self._trackball.drag(np.array([x, y]))
+
+ def on_mouse_release(self, x, y, button, modifiers):
+ """Record a mouse release.
+ """
+ self.viewer_flags['mouse_pressed'] = False
+
+ def on_mouse_scroll(self, x, y, dx, dy):
+ """Record a mouse scroll.
+ """
+ if self.viewer_flags['use_perspective_cam']:
+ self._trackball.scroll(dy)
+ else:
+ spfc = 0.95
+ spbc = 1.0 / 0.95
+ sf = 1.0
+ if dy > 0:
+ sf = spfc * dy
+ elif dy < 0:
+ sf = - spbc * dy
+
+ c = self._camera_node.camera
+ xmag = max(c.xmag * sf, 1e-8)
+ ymag = max(c.ymag * sf, 1e-8 * c.ymag / c.xmag)
+ c.xmag = xmag
+ c.ymag = ymag
+
+ def on_key_press(self, symbol, modifiers):
+ """Record a key press.
+ """
+ # First, check for registered key callbacks
+ if symbol in self.registered_keys:
+ tup = self.registered_keys[symbol]
+ callback = None
+ args = []
+ kwargs = {}
+ if not isinstance(tup, (list, tuple, np.ndarray)):
+ callback = tup
+ else:
+ callback = tup[0]
+ if len(tup) == 2:
+ args = tup[1]
+ if len(tup) == 3:
+ kwargs = tup[2]
+ callback(self, *args, **kwargs)
+ return
+
+ # Otherwise, use default key functions
+
+ # A causes the frame to rotate
+ self._message_text = None
+ if symbol == pyglet.window.key.A:
+ self.viewer_flags['rotate'] = not self.viewer_flags['rotate']
+ if self.viewer_flags['rotate']:
+ self._message_text = 'Rotation On'
+ else:
+ self._message_text = 'Rotation Off'
+
+ # C toggles backface culling
+ elif symbol == pyglet.window.key.C:
+ self.render_flags['cull_faces'] = (
+ not self.render_flags['cull_faces']
+ )
+ if self.render_flags['cull_faces']:
+ self._message_text = 'Cull Faces On'
+ else:
+ self._message_text = 'Cull Faces Off'
+
+ # F toggles face normals
+ elif symbol == pyglet.window.key.F:
+ self.viewer_flags['fullscreen'] = (
+ not self.viewer_flags['fullscreen']
+ )
+ self.set_fullscreen(self.viewer_flags['fullscreen'])
+ self.activate()
+ if self.viewer_flags['fullscreen']:
+ self._message_text = 'Fullscreen On'
+ else:
+ self._message_text = 'Fullscreen Off'
+
+ # S toggles shadows
+ elif symbol == pyglet.window.key.H and sys.platform != 'darwin':
+ self.render_flags['shadows'] = not self.render_flags['shadows']
+ if self.render_flags['shadows']:
+ self._message_text = 'Shadows On'
+ else:
+ self._message_text = 'Shadows Off'
+
+ elif symbol == pyglet.window.key.I:
+ if (self.viewer_flags['show_world_axis'] and not
+ self.viewer_flags['show_mesh_axes']):
+ self.viewer_flags['show_world_axis'] = False
+ self.viewer_flags['show_mesh_axes'] = True
+ self._set_axes(False, True)
+ self._message_text = 'Mesh Axes On'
+ elif (not self.viewer_flags['show_world_axis'] and
+ self.viewer_flags['show_mesh_axes']):
+ self.viewer_flags['show_world_axis'] = True
+ self.viewer_flags['show_mesh_axes'] = True
+ self._set_axes(True, True)
+ self._message_text = 'All Axes On'
+ elif (self.viewer_flags['show_world_axis'] and
+ self.viewer_flags['show_mesh_axes']):
+ self.viewer_flags['show_world_axis'] = False
+ self.viewer_flags['show_mesh_axes'] = False
+ self._set_axes(False, False)
+ self._message_text = 'All Axes Off'
+ else:
+ self.viewer_flags['show_world_axis'] = True
+ self.viewer_flags['show_mesh_axes'] = False
+ self._set_axes(True, False)
+ self._message_text = 'World Axis On'
+
+ # L toggles the lighting mode
+ elif symbol == pyglet.window.key.L:
+ if self.viewer_flags['use_raymond_lighting']:
+ self.viewer_flags['use_raymond_lighting'] = False
+ self.viewer_flags['use_direct_lighting'] = True
+ self._message_text = 'Direct Lighting'
+ elif self.viewer_flags['use_direct_lighting']:
+ self.viewer_flags['use_raymond_lighting'] = False
+ self.viewer_flags['use_direct_lighting'] = False
+ self._message_text = 'Default Lighting'
+ else:
+ self.viewer_flags['use_raymond_lighting'] = True
+ self.viewer_flags['use_direct_lighting'] = False
+ self._message_text = 'Raymond Lighting'
+
+ # M toggles face normals
+ elif symbol == pyglet.window.key.M:
+ self.render_flags['face_normals'] = (
+ not self.render_flags['face_normals']
+ )
+ if self.render_flags['face_normals']:
+ self._message_text = 'Face Normals On'
+ else:
+ self._message_text = 'Face Normals Off'
+
+ # N toggles vertex normals
+ elif symbol == pyglet.window.key.N:
+ self.render_flags['vertex_normals'] = (
+ not self.render_flags['vertex_normals']
+ )
+ if self.render_flags['vertex_normals']:
+ self._message_text = 'Vert Normals On'
+ else:
+ self._message_text = 'Vert Normals Off'
+
+ # O toggles orthographic camera mode
+ elif symbol == pyglet.window.key.O:
+ self.viewer_flags['use_perspective_cam'] = (
+ not self.viewer_flags['use_perspective_cam']
+ )
+ if self.viewer_flags['use_perspective_cam']:
+ camera = self._default_persp_cam
+ self._message_text = 'Perspective View'
+ else:
+ camera = self._default_orth_cam
+ self._message_text = 'Orthographic View'
+
+ cam_pose = self._camera_node.matrix.copy()
+ cam_node = Node(matrix=cam_pose, camera=camera)
+ self.scene.remove_node(self._camera_node)
+ self.scene.add_node(cam_node)
+ self.scene.main_camera_node = cam_node
+ self._camera_node = cam_node
+
+ # Q quits the viewer
+ elif symbol == pyglet.window.key.Q:
+ self.on_close()
+
+ # R starts recording frames
+ elif symbol == pyglet.window.key.R:
+ if self.viewer_flags['record']:
+ self.save_gif()
+ self.set_caption(self.viewer_flags['window_title'])
+ else:
+ self.set_caption(
+ '{} (RECORDING)'.format(self.viewer_flags['window_title'])
+ )
+ self.viewer_flags['record'] = not self.viewer_flags['record']
+
+ # S saves the current frame as an image
+ elif symbol == pyglet.window.key.S:
+ self._save_image()
+
+ # W toggles through wireframe modes
+ elif symbol == pyglet.window.key.W:
+ if self.render_flags['flip_wireframe']:
+ self.render_flags['flip_wireframe'] = False
+ self.render_flags['all_wireframe'] = True
+ self.render_flags['all_solid'] = False
+ self._message_text = 'All Wireframe'
+ elif self.render_flags['all_wireframe']:
+ self.render_flags['flip_wireframe'] = False
+ self.render_flags['all_wireframe'] = False
+ self.render_flags['all_solid'] = True
+ self._message_text = 'All Solid'
+ elif self.render_flags['all_solid']:
+ self.render_flags['flip_wireframe'] = False
+ self.render_flags['all_wireframe'] = False
+ self.render_flags['all_solid'] = False
+ self._message_text = 'Default Wireframe'
+ else:
+ self.render_flags['flip_wireframe'] = True
+ self.render_flags['all_wireframe'] = False
+ self.render_flags['all_solid'] = False
+ self._message_text = 'Flip Wireframe'
+
+ # Z resets the camera viewpoint
+ elif symbol == pyglet.window.key.Z:
+ self._reset_view()
+
+ if self._message_text is not None:
+ self._message_opac = 1.0 + self._ticks_till_fade
+
+ @staticmethod
+ def _time_event(dt, self):
+ """The timer callback.
+ """
+ # Don't run old dead events after we've already closed
+ if not self._is_active:
+ return
+
+ if self.viewer_flags['record']:
+ self._record()
+ if (self.viewer_flags['rotate'] and not
+ self.viewer_flags['mouse_pressed']):
+ self._rotate()
+
+ # Manage message opacity
+ if self._message_text is not None:
+ if self._message_opac > 1.0:
+ self._message_opac -= 1.0
+ else:
+ self._message_opac *= 0.90
+ if self._message_opac < 0.05:
+ self._message_opac = 1.0 + self._ticks_till_fade
+ self._message_text = None
+
+ if self._should_close:
+ self.on_close()
+ else:
+ self.on_draw()
+
+ def _reset_view(self):
+ """Reset the view to a good initial state.
+
+ The view is initially along the positive x-axis at a
+ sufficient distance from the scene.
+ """
+ scale = self.scene.scale
+ if scale == 0.0:
+ scale = DEFAULT_SCENE_SCALE
+ centroid = self.scene.centroid
+
+ if self.viewer_flags['view_center'] is not None:
+ centroid = self.viewer_flags['view_center']
+
+ self._camera_node.matrix = self._default_camera_pose
+ self._trackball = Trackball(
+ self._default_camera_pose, self.viewport_size, scale, centroid
+ )
+
+ def _get_save_filename(self, file_exts):
+ file_types = {
+ 'png': ('png files', '*.png'),
+ 'jpg': ('jpeg files', '*.jpg'),
+ 'gif': ('gif files', '*.gif'),
+ 'all': ('all files', '*'),
+ }
+ filetypes = [file_types[x] for x in file_exts]
+ try:
+ root = Tk()
+ save_dir = self.viewer_flags['save_directory']
+ if save_dir is None:
+ save_dir = os.getcwd()
+ filename = filedialog.asksaveasfilename(
+ initialdir=save_dir, title='Select file save location',
+ filetypes=filetypes
+ )
+ except Exception:
+ return None
+
+ root.destroy()
+ if filename == ():
+ return None
+ return filename
+
+ def _save_image(self):
+ filename = self._get_save_filename(['png', 'jpg', 'gif', 'all'])
+ if filename is not None:
+ self.viewer_flags['save_directory'] = os.path.dirname(filename)
+ imageio.imwrite(filename, self._renderer.read_color_buf())
+
+ def _record(self):
+ """Save another frame for the GIF.
+ """
+ data = self._renderer.read_color_buf()
+ if not np.all(data == 0.0):
+ self._saved_frames.append(data)
+
+ def _rotate(self):
+ """Animate the scene by rotating the camera.
+ """
+ az = (self.viewer_flags['rotate_rate'] /
+ self.viewer_flags['refresh_rate'])
+ self._trackball.rotate(az, self.viewer_flags['rotate_axis'])
+
+ def _render(self):
+ """Render the scene into the framebuffer and flip.
+ """
+ scene = self.scene
+ self._camera_node.matrix = self._trackball.pose.copy()
+
+ # Set lighting
+ vli = self.viewer_flags['lighting_intensity']
+ if self.viewer_flags['use_raymond_lighting']:
+ for n in self._raymond_lights:
+ n.light.intensity = vli / 3.0
+ if not self.scene.has_node(n):
+ scene.add_node(n, parent_node=self._camera_node)
+ else:
+ self._direct_light.light.intensity = vli
+ for n in self._raymond_lights:
+ if self.scene.has_node(n):
+ self.scene.remove_node(n)
+
+ if self.viewer_flags['use_direct_lighting']:
+ if not self.scene.has_node(self._direct_light):
+ scene.add_node(
+ self._direct_light, parent_node=self._camera_node
+ )
+ elif self.scene.has_node(self._direct_light):
+ self.scene.remove_node(self._direct_light)
+
+ flags = RenderFlags.NONE
+ if self.render_flags['flip_wireframe']:
+ flags |= RenderFlags.FLIP_WIREFRAME
+ elif self.render_flags['all_wireframe']:
+ flags |= RenderFlags.ALL_WIREFRAME
+ elif self.render_flags['all_solid']:
+ flags |= RenderFlags.ALL_SOLID
+
+ if self.render_flags['shadows']:
+ flags |= RenderFlags.SHADOWS_DIRECTIONAL | RenderFlags.SHADOWS_SPOT
+ if self.render_flags['vertex_normals']:
+ flags |= RenderFlags.VERTEX_NORMALS
+ if self.render_flags['face_normals']:
+ flags |= RenderFlags.FACE_NORMALS
+ if not self.render_flags['cull_faces']:
+ flags |= RenderFlags.SKIP_CULL_FACES
+
+ self._renderer.render(self.scene, flags)
+
+ def _init_and_start_app(self):
+ # Try multiple configs starting with target OpenGL version
+ # and multisampling and removing these options if exception
+ # Note: multisampling not available on all hardware
+ from pyglet.gl import Config
+ confs = [Config(sample_buffers=1, samples=4,
+ depth_size=24,
+ double_buffer=True,
+ major_version=TARGET_OPEN_GL_MAJOR,
+ minor_version=TARGET_OPEN_GL_MINOR),
+ Config(depth_size=24,
+ double_buffer=True,
+ major_version=TARGET_OPEN_GL_MAJOR,
+ minor_version=TARGET_OPEN_GL_MINOR),
+ Config(sample_buffers=1, samples=4,
+ depth_size=24,
+ double_buffer=True,
+ major_version=MIN_OPEN_GL_MAJOR,
+ minor_version=MIN_OPEN_GL_MINOR),
+ Config(depth_size=24,
+ double_buffer=True,
+ major_version=MIN_OPEN_GL_MAJOR,
+ minor_version=MIN_OPEN_GL_MINOR)]
+ for conf in confs:
+ try:
+ super(Viewer, self).__init__(config=conf, resizable=True,
+ width=self._viewport_size[0],
+ height=self._viewport_size[1])
+ break
+ except pyglet.window.NoSuchConfigException:
+ pass
+
+ if not self.context:
+ raise ValueError('Unable to initialize an OpenGL 3+ context')
+ clock.schedule_interval(
+ Viewer._time_event, 1.0 / self.viewer_flags['refresh_rate'], self
+ )
+ self.switch_to()
+ self.set_caption(self.viewer_flags['window_title'])
+ pyglet.app.run()
+
+ def _compute_initial_camera_pose(self):
+ centroid = self.scene.centroid
+ if self.viewer_flags['view_center'] is not None:
+ centroid = self.viewer_flags['view_center']
+ scale = self.scene.scale
+ if scale == 0.0:
+ scale = DEFAULT_SCENE_SCALE
+
+ s2 = 1.0 / np.sqrt(2.0)
+ cp = np.eye(4)
+ cp[:3,:3] = np.array([
+ [0.0, -s2, s2],
+ [1.0, 0.0, 0.0],
+ [0.0, s2, s2]
+ ])
+ hfov = np.pi / 6.0
+ dist = scale / (2.0 * np.tan(hfov))
+ cp[:3,3] = dist * np.array([1.0, 0.0, 1.0]) + centroid
+
+ return cp
+
+ def _create_raymond_lights(self):
+ thetas = np.pi * np.array([1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0])
+ phis = np.pi * np.array([0.0, 2.0 / 3.0, 4.0 / 3.0])
+
+ nodes = []
+
+ for phi, theta in zip(phis, thetas):
+ xp = np.sin(theta) * np.cos(phi)
+ yp = np.sin(theta) * np.sin(phi)
+ zp = np.cos(theta)
+
+ z = np.array([xp, yp, zp])
+ z = z / np.linalg.norm(z)
+ x = np.array([-z[1], z[0], 0.0])
+ if np.linalg.norm(x) == 0:
+ x = np.array([1.0, 0.0, 0.0])
+ x = x / np.linalg.norm(x)
+ y = np.cross(z, x)
+
+ matrix = np.eye(4)
+ matrix[:3,:3] = np.c_[x,y,z]
+ nodes.append(Node(
+ light=DirectionalLight(color=np.ones(3), intensity=1.0),
+ matrix=matrix
+ ))
+
+ return nodes
+
+ def _create_direct_light(self):
+ light = DirectionalLight(color=np.ones(3), intensity=1.0)
+ n = Node(light=light, matrix=np.eye(4))
+ return n
+
+ def _set_axes(self, world, mesh):
+ scale = self.scene.scale
+ if world:
+ if 'scene' not in self._axes:
+ n = Node(mesh=self._axis_mesh, scale=np.ones(3) * scale * 0.3)
+ self.scene.add_node(n)
+ self._axes['scene'] = n
+ else:
+ if 'scene' in self._axes:
+ self.scene.remove_node(self._axes['scene'])
+ self._axes.pop('scene')
+
+ if mesh:
+ old_nodes = []
+ existing_axes = set([self._axes[k] for k in self._axes])
+ for node in self.scene.mesh_nodes:
+ if node not in existing_axes:
+ old_nodes.append(node)
+
+ for node in old_nodes:
+ if node in self._axes:
+ continue
+ n = Node(
+ mesh=self._axis_mesh,
+ scale=np.ones(3) * node.mesh.scale * 0.5
+ )
+ self.scene.add_node(n, parent_node=node)
+ self._axes[node] = n
+ else:
+ to_remove = set()
+ for main_node in self._axes:
+ if main_node in self.scene.mesh_nodes:
+ self.scene.remove_node(self._axes[main_node])
+ to_remove.add(main_node)
+ for main_node in to_remove:
+ self._axes.pop(main_node)
+
+ def _remove_axes(self):
+ for main_node in self._axes:
+ axis_node = self._axes[main_node]
+ self.scene.remove_node(axis_node)
+ self._axes = {}
+
+ def _location_to_x_y(self, location):
+ if location == TextAlign.CENTER:
+ return (self.viewport_size[0] / 2.0, self.viewport_size[1] / 2.0)
+ elif location == TextAlign.CENTER_LEFT:
+ return (TEXT_PADDING, self.viewport_size[1] / 2.0)
+ elif location == TextAlign.CENTER_RIGHT:
+ return (self.viewport_size[0] - TEXT_PADDING,
+ self.viewport_size[1] / 2.0)
+ elif location == TextAlign.BOTTOM_LEFT:
+ return (TEXT_PADDING, TEXT_PADDING)
+ elif location == TextAlign.BOTTOM_RIGHT:
+ return (self.viewport_size[0] - TEXT_PADDING, TEXT_PADDING)
+ elif location == TextAlign.BOTTOM_CENTER:
+ return (self.viewport_size[0] / 2.0, TEXT_PADDING)
+ elif location == TextAlign.TOP_LEFT:
+ return (TEXT_PADDING, self.viewport_size[1] - TEXT_PADDING)
+ elif location == TextAlign.TOP_RIGHT:
+ return (self.viewport_size[0] - TEXT_PADDING,
+ self.viewport_size[1] - TEXT_PADDING)
+ elif location == TextAlign.TOP_CENTER:
+ return (self.viewport_size[0] / 2.0,
+ self.viewport_size[1] - TEXT_PADDING)
+
+
+__all__ = ['Viewer']
diff --git a/generate_human_motion/pyrender/requirements.txt b/generate_human_motion/pyrender/requirements.txt
new file mode 100644
index 0000000000000000000000000000000000000000..8c40b74256f0dc6697754bb8609f69a39d51beba
--- /dev/null
+++ b/generate_human_motion/pyrender/requirements.txt
@@ -0,0 +1,14 @@
+freetype-py
+imageio
+networkx
+numpy
+Pillow
+pyglet==1.4.0a1
+PyOpenGL
+PyOpenGL_accelerate
+six
+trimesh
+sphinx
+sphinx_rtd_theme
+sphinx-automodapi
+
diff --git a/generate_human_motion/pyrender/setup.py b/generate_human_motion/pyrender/setup.py
new file mode 100644
index 0000000000000000000000000000000000000000..9a11b5c2d32983cd3c240597a504995dfb439af4
--- /dev/null
+++ b/generate_human_motion/pyrender/setup.py
@@ -0,0 +1,76 @@
+"""
+Setup of pyrender Python codebase.
+
+Author: Matthew Matl
+"""
+import sys
+from setuptools import setup
+
+# load __version__
+exec(open('pyrender/version.py').read())
+
+def get_imageio_dep():
+ if sys.version[0] == "2":
+ return 'imageio<=2.6.1'
+ return 'imageio'
+
+requirements = [
+ 'freetype-py', # For font loading
+ get_imageio_dep(), # For Image I/O
+ 'networkx', # For the scene graph
+ 'numpy', # Numpy
+ 'Pillow', # For Trimesh texture conversions
+ 'pyglet>=1.5.24', # For the pyglet viewer
+ 'PyOpenGL~=3.1.0', # For OpenGL
+ 'PyOpenGL_accelerate~=3.1.0', # For OpenGL
+ 'scipy', # Because of trimesh missing dep
+ 'six', # For Python 2/3 interop
+ 'trimesh', # For meshes
+]
+
+dev_requirements = [
+ 'flake8', # Code formatting checker
+ 'pre-commit', # Pre-commit hooks
+ 'pytest', # Code testing
+ 'pytest-cov', # Coverage testing
+ 'tox', # Automatic virtualenv testing
+]
+
+docs_requirements = [
+ 'sphinx', # General doc library
+ 'sphinx_rtd_theme', # RTD theme for sphinx
+ 'sphinx-automodapi' # For generating nice tables
+]
+
+
+setup(
+ name = 'pyrender',
+ version=__version__,
+ description='Easy-to-use Python renderer for 3D visualization',
+ long_description='A simple implementation of Physically-Based Rendering '
+ '(PBR) in Python. Compliant with the glTF 2.0 standard.',
+ author='Matthew Matl',
+ author_email='matthewcmatl@gmail.com',
+ license='MIT License',
+ url = 'https://github.com/mmatl/pyrender',
+ classifiers = [
+ 'Development Status :: 4 - Beta',
+ 'License :: OSI Approved :: MIT License',
+ 'Operating System :: POSIX :: Linux',
+ 'Operating System :: MacOS :: MacOS X',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ 'Natural Language :: English',
+ 'Topic :: Scientific/Engineering'
+ ],
+ keywords = 'rendering graphics opengl 3d visualization pbr gltf',
+ packages = ['pyrender', 'pyrender.platforms'],
+ setup_requires = requirements,
+ install_requires = requirements,
+ extras_require={
+ 'dev': dev_requirements,
+ 'docs': docs_requirements,
+ },
+ include_package_data=True
+)
diff --git a/generate_human_motion/pyrender/tests/__init__.py b/generate_human_motion/pyrender/tests/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/generate_human_motion/pyrender/tests/conftest.py b/generate_human_motion/pyrender/tests/conftest.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/generate_human_motion/pyrender/tests/pytest.ini b/generate_human_motion/pyrender/tests/pytest.ini
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/generate_human_motion/pyrender/tests/unit/__init__.py b/generate_human_motion/pyrender/tests/unit/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/generate_human_motion/pyrender/tests/unit/test_cameras.py b/generate_human_motion/pyrender/tests/unit/test_cameras.py
new file mode 100644
index 0000000000000000000000000000000000000000..7544ad8f8e3ee55236fd2e32dbc12065153cbe5b
--- /dev/null
+++ b/generate_human_motion/pyrender/tests/unit/test_cameras.py
@@ -0,0 +1,164 @@
+import numpy as np
+import pytest
+
+from pyrender import PerspectiveCamera, OrthographicCamera
+
+
+def test_perspective_camera():
+
+ # Set up constants
+ znear = 0.05
+ zfar = 100
+ yfov = np.pi / 3.0
+ width = 1000.0
+ height = 500.0
+ aspectRatio = 640.0 / 480.0
+
+ # Test basics
+ with pytest.raises(TypeError):
+ p = PerspectiveCamera()
+
+ p = PerspectiveCamera(yfov=yfov)
+ assert p.yfov == yfov
+ assert p.znear == 0.05
+ assert p.zfar is None
+ assert p.aspectRatio is None
+ p.name = 'asdf'
+ p.name = None
+
+ with pytest.raises(ValueError):
+ p.yfov = 0.0
+
+ with pytest.raises(ValueError):
+ p.yfov = -1.0
+
+ with pytest.raises(ValueError):
+ p.znear = -1.0
+
+ p.znear = 0.0
+ p.znear = 0.05
+ p.zfar = 100.0
+ assert p.zfar == 100.0
+
+ with pytest.raises(ValueError):
+ p.zfar = 0.03
+
+ with pytest.raises(ValueError):
+ p.zfar = 0.05
+
+ p.aspectRatio = 10.0
+ assert p.aspectRatio == 10.0
+
+ with pytest.raises(ValueError):
+ p.aspectRatio = 0.0
+
+ with pytest.raises(ValueError):
+ p.aspectRatio = -1.0
+
+ # Test matrix getting/setting
+
+ # NF
+ p.znear = 0.05
+ p.zfar = 100
+ p.aspectRatio = None
+
+ with pytest.raises(ValueError):
+ p.get_projection_matrix()
+
+ assert np.allclose(
+ p.get_projection_matrix(width, height),
+ np.array([
+ [1.0 / (width / height * np.tan(yfov / 2.0)), 0.0, 0.0, 0.0],
+ [0.0, 1.0 / np.tan(yfov / 2.0), 0.0, 0.0],
+ [0.0, 0.0, (zfar + znear) / (znear - zfar),
+ (2 * zfar * znear) / (znear - zfar)],
+ [0.0, 0.0, -1.0, 0.0]
+ ])
+ )
+
+ # NFA
+ p.aspectRatio = aspectRatio
+ assert np.allclose(
+ p.get_projection_matrix(width, height),
+ np.array([
+ [1.0 / (aspectRatio * np.tan(yfov / 2.0)), 0.0, 0.0, 0.0],
+ [0.0, 1.0 / np.tan(yfov / 2.0), 0.0, 0.0],
+ [0.0, 0.0, (zfar + znear) / (znear - zfar),
+ (2 * zfar * znear) / (znear - zfar)],
+ [0.0, 0.0, -1.0, 0.0]
+ ])
+ )
+ assert np.allclose(
+ p.get_projection_matrix(), p.get_projection_matrix(width, height)
+ )
+
+ # N
+ p.zfar = None
+ p.aspectRatio = None
+ assert np.allclose(
+ p.get_projection_matrix(width, height),
+ np.array([
+ [1.0 / (width / height * np.tan(yfov / 2.0)), 0.0, 0.0, 0.0],
+ [0.0, 1.0 / np.tan(yfov / 2.0), 0.0, 0.0],
+ [0.0, 0.0, -1.0, -2.0 * znear],
+ [0.0, 0.0, -1.0, 0.0]
+ ])
+ )
+
+
+def test_orthographic_camera():
+ xm = 1.0
+ ym = 2.0
+ n = 0.05
+ f = 100.0
+
+ with pytest.raises(TypeError):
+ c = OrthographicCamera()
+
+ c = OrthographicCamera(xmag=xm, ymag=ym)
+
+ assert c.xmag == xm
+ assert c.ymag == ym
+ assert c.znear == 0.05
+ assert c.zfar == 100.0
+ assert c.name is None
+
+ with pytest.raises(TypeError):
+ c.ymag = None
+
+ with pytest.raises(ValueError):
+ c.ymag = 0.0
+
+ with pytest.raises(ValueError):
+ c.ymag = -1.0
+
+ with pytest.raises(TypeError):
+ c.xmag = None
+
+ with pytest.raises(ValueError):
+ c.xmag = 0.0
+
+ with pytest.raises(ValueError):
+ c.xmag = -1.0
+
+ with pytest.raises(TypeError):
+ c.znear = None
+
+ with pytest.raises(ValueError):
+ c.znear = 0.0
+
+ with pytest.raises(ValueError):
+ c.znear = -1.0
+
+ with pytest.raises(ValueError):
+ c.zfar = 0.01
+
+ assert np.allclose(
+ c.get_projection_matrix(),
+ np.array([
+ [1.0 / xm, 0, 0, 0],
+ [0, 1.0 / ym, 0, 0],
+ [0, 0, 2.0 / (n - f), (f + n) / (n - f)],
+ [0, 0, 0, 1.0]
+ ])
+ )
diff --git a/generate_human_motion/pyrender/tests/unit/test_egl.py b/generate_human_motion/pyrender/tests/unit/test_egl.py
new file mode 100644
index 0000000000000000000000000000000000000000..e2f4bef39e33c2794e6837b5a1bb127d8d4dba06
--- /dev/null
+++ b/generate_human_motion/pyrender/tests/unit/test_egl.py
@@ -0,0 +1,16 @@
+# from pyrender.platforms import egl
+
+
+def tmp_test_default_device():
+ egl.get_default_device()
+
+
+def tmp_test_query_device():
+ devices = egl.query_devices()
+ assert len(devices) > 0
+
+
+def tmp_test_init_context():
+ device = egl.query_devices()[0]
+ platform = egl.EGLPlatform(128, 128, device=device)
+ platform.init_context()
diff --git a/generate_human_motion/pyrender/tests/unit/test_lights.py b/generate_human_motion/pyrender/tests/unit/test_lights.py
new file mode 100644
index 0000000000000000000000000000000000000000..ffde856b21e8cce9532f0308fcd1c7eb2d1eba90
--- /dev/null
+++ b/generate_human_motion/pyrender/tests/unit/test_lights.py
@@ -0,0 +1,104 @@
+import numpy as np
+import pytest
+
+from pyrender import (DirectionalLight, SpotLight, PointLight, Texture,
+ PerspectiveCamera, OrthographicCamera)
+from pyrender.constants import SHADOW_TEX_SZ
+
+
+def test_directional_light():
+
+ d = DirectionalLight()
+ assert d.name is None
+ assert np.all(d.color == 1.0)
+ assert d.intensity == 1.0
+
+ d.name = 'direc'
+ with pytest.raises(ValueError):
+ d.color = None
+ with pytest.raises(TypeError):
+ d.intensity = None
+
+ d = DirectionalLight(color=[0.0, 0.0, 0.0])
+ assert np.all(d.color == 0.0)
+
+ d._generate_shadow_texture()
+ st = d.shadow_texture
+ assert isinstance(st, Texture)
+ assert st.width == st.height == SHADOW_TEX_SZ
+
+ sc = d._get_shadow_camera(scene_scale=5.0)
+ assert isinstance(sc, OrthographicCamera)
+ assert sc.xmag == sc.ymag == 5.0
+ assert sc.znear == 0.01 * 5.0
+ assert sc.zfar == 10 * 5.0
+
+
+def test_spot_light():
+
+ s = SpotLight()
+ assert s.name is None
+ assert np.all(s.color == 1.0)
+ assert s.intensity == 1.0
+ assert s.innerConeAngle == 0.0
+ assert s.outerConeAngle == np.pi / 4.0
+ assert s.range is None
+
+ with pytest.raises(ValueError):
+ s.range = -1.0
+
+ with pytest.raises(ValueError):
+ s.range = 0.0
+
+ with pytest.raises(ValueError):
+ s.innerConeAngle = -1.0
+
+ with pytest.raises(ValueError):
+ s.innerConeAngle = np.pi / 3.0
+
+ with pytest.raises(ValueError):
+ s.outerConeAngle = -1.0
+
+ with pytest.raises(ValueError):
+ s.outerConeAngle = np.pi
+
+ s.range = 5.0
+ s.outerConeAngle = np.pi / 2 - 0.05
+ s.innerConeAngle = np.pi / 3
+ s.innerConeAngle = 0.0
+ s.outerConeAngle = np.pi / 4.0
+
+ s._generate_shadow_texture()
+ st = s.shadow_texture
+ assert isinstance(st, Texture)
+ assert st.width == st.height == SHADOW_TEX_SZ
+
+ sc = s._get_shadow_camera(scene_scale=5.0)
+ assert isinstance(sc, PerspectiveCamera)
+ assert sc.znear == 0.01 * 5.0
+ assert sc.zfar == 10 * 5.0
+ assert sc.aspectRatio == 1.0
+ assert np.allclose(sc.yfov, np.pi / 16.0 * 9.0) # Plus pi / 16
+
+
+def test_point_light():
+
+ s = PointLight()
+ assert s.name is None
+ assert np.all(s.color == 1.0)
+ assert s.intensity == 1.0
+ assert s.range is None
+
+ with pytest.raises(ValueError):
+ s.range = -1.0
+
+ with pytest.raises(ValueError):
+ s.range = 0.0
+
+ s.range = 5.0
+
+ with pytest.raises(NotImplementedError):
+ s._generate_shadow_texture()
+
+ with pytest.raises(NotImplementedError):
+ s._get_shadow_camera(scene_scale=5.0)
diff --git a/generate_human_motion/pyrender/tests/unit/test_meshes.py b/generate_human_motion/pyrender/tests/unit/test_meshes.py
new file mode 100644
index 0000000000000000000000000000000000000000..7070b01171c97069fa013c6eba8eee217017f08e
--- /dev/null
+++ b/generate_human_motion/pyrender/tests/unit/test_meshes.py
@@ -0,0 +1,133 @@
+import numpy as np
+import pytest
+import trimesh
+
+from pyrender import (Mesh, Primitive)
+
+
+def test_meshes():
+
+ with pytest.raises(TypeError):
+ x = Mesh()
+ with pytest.raises(TypeError):
+ x = Primitive()
+ with pytest.raises(ValueError):
+ x = Primitive([], mode=10)
+
+ # Basics
+ x = Mesh([])
+ assert x.name is None
+ assert x.is_visible
+ assert x.weights is None
+
+ x.name = 'str'
+
+ # From Trimesh
+ x = Mesh.from_trimesh(trimesh.creation.box())
+ assert isinstance(x, Mesh)
+ assert len(x.primitives) == 1
+ assert x.is_visible
+ assert np.allclose(x.bounds, np.array([
+ [-0.5, -0.5, -0.5],
+ [0.5, 0.5, 0.5]
+ ]))
+ assert np.allclose(x.centroid, np.zeros(3))
+ assert np.allclose(x.extents, np.ones(3))
+ assert np.allclose(x.scale, np.sqrt(3))
+ assert not x.is_transparent
+
+ # Test some primitive functions
+ x = x.primitives[0]
+ with pytest.raises(ValueError):
+ x.normals = np.zeros(10)
+ with pytest.raises(ValueError):
+ x.tangents = np.zeros(10)
+ with pytest.raises(ValueError):
+ x.texcoord_0 = np.zeros(10)
+ with pytest.raises(ValueError):
+ x.texcoord_1 = np.zeros(10)
+ with pytest.raises(TypeError):
+ x.material = np.zeros(10)
+ assert x.targets is None
+ assert np.allclose(x.bounds, np.array([
+ [-0.5, -0.5, -0.5],
+ [0.5, 0.5, 0.5]
+ ]))
+ assert np.allclose(x.centroid, np.zeros(3))
+ assert np.allclose(x.extents, np.ones(3))
+ assert np.allclose(x.scale, np.sqrt(3))
+ x.material.baseColorFactor = np.array([0.0, 0.0, 0.0, 0.0])
+ assert x.is_transparent
+
+ # From two trimeshes
+ x = Mesh.from_trimesh([trimesh.creation.box(),
+ trimesh.creation.cylinder(radius=0.1, height=2.0)],
+ smooth=False)
+ assert isinstance(x, Mesh)
+ assert len(x.primitives) == 2
+ assert x.is_visible
+ assert np.allclose(x.bounds, np.array([
+ [-0.5, -0.5, -1.0],
+ [0.5, 0.5, 1.0]
+ ]))
+ assert np.allclose(x.centroid, np.zeros(3))
+ assert np.allclose(x.extents, [1.0, 1.0, 2.0])
+ assert np.allclose(x.scale, np.sqrt(6))
+ assert not x.is_transparent
+
+ # From bad data
+ with pytest.raises(TypeError):
+ x = Mesh.from_trimesh(None)
+
+ # With instancing
+ poses = np.tile(np.eye(4), (5,1,1))
+ poses[:,0,3] = np.array([0,1,2,3,4])
+ x = Mesh.from_trimesh(trimesh.creation.box(), poses=poses)
+ assert np.allclose(x.bounds, np.array([
+ [-0.5, -0.5, -0.5],
+ [4.5, 0.5, 0.5]
+ ]))
+ poses = np.eye(4)
+ x = Mesh.from_trimesh(trimesh.creation.box(), poses=poses)
+ poses = np.eye(3)
+ with pytest.raises(ValueError):
+ x = Mesh.from_trimesh(trimesh.creation.box(), poses=poses)
+
+ # From textured meshes
+ fm = trimesh.load('tests/data/fuze.obj')
+ x = Mesh.from_trimesh(fm)
+ assert isinstance(x, Mesh)
+ assert len(x.primitives) == 1
+ assert x.is_visible
+ assert not x.is_transparent
+ assert x.primitives[0].material.baseColorTexture is not None
+
+ x = Mesh.from_trimesh(fm, smooth=False)
+ fm.visual = fm.visual.to_color()
+ fm.visual.face_colors = np.array([1.0, 0.0, 0.0, 1.0])
+ x = Mesh.from_trimesh(fm, smooth=False)
+ with pytest.raises(ValueError):
+ x = Mesh.from_trimesh(fm, smooth=True)
+
+ fm.visual.vertex_colors = np.array([1.0, 0.0, 0.0, 0.5])
+ x = Mesh.from_trimesh(fm, smooth=False)
+ x = Mesh.from_trimesh(fm, smooth=True)
+ assert x.primitives[0].color_0 is not None
+ assert x.is_transparent
+
+ bm = trimesh.load('tests/data/WaterBottle.glb').dump()[0]
+ x = Mesh.from_trimesh(bm)
+ assert x.primitives[0].material.baseColorTexture is not None
+ assert x.primitives[0].material.emissiveTexture is not None
+ assert x.primitives[0].material.metallicRoughnessTexture is not None
+
+ # From point cloud
+ x = Mesh.from_points(fm.vertices)
+
+# def test_duck():
+# bm = trimesh.load('tests/data/Duck.glb').dump()[0]
+# x = Mesh.from_trimesh(bm)
+# assert x.primitives[0].material.baseColorTexture is not None
+# pixel = x.primitives[0].material.baseColorTexture.source[100, 100]
+# yellowish = np.array([1.0, 0.7411765, 0.0, 1.0])
+# assert np.allclose(pixel, yellowish)
diff --git a/generate_human_motion/pyrender/tests/unit/test_nodes.py b/generate_human_motion/pyrender/tests/unit/test_nodes.py
new file mode 100644
index 0000000000000000000000000000000000000000..9857c8221b7f6fb8530699bdf5593f8f0b74e152
--- /dev/null
+++ b/generate_human_motion/pyrender/tests/unit/test_nodes.py
@@ -0,0 +1,124 @@
+import numpy as np
+import pytest
+from trimesh import transformations
+
+from pyrender import (DirectionalLight, PerspectiveCamera, Mesh, Node)
+
+
+def test_nodes():
+
+ x = Node()
+ assert x.name is None
+ assert x.camera is None
+ assert x.children == []
+ assert x.skin is None
+ assert np.allclose(x.matrix, np.eye(4))
+ assert x.mesh is None
+ assert np.allclose(x.rotation, [0,0,0,1])
+ assert np.allclose(x.scale, np.ones(3))
+ assert np.allclose(x.translation, np.zeros(3))
+ assert x.weights is None
+ assert x.light is None
+
+ x.name = 'node'
+
+ # Test node light/camera/mesh tests
+ c = PerspectiveCamera(yfov=2.0)
+ m = Mesh([])
+ d = DirectionalLight()
+ x.camera = c
+ assert x.camera == c
+ with pytest.raises(TypeError):
+ x.camera = m
+ x.camera = d
+ x.camera = None
+ x.mesh = m
+ assert x.mesh == m
+ with pytest.raises(TypeError):
+ x.mesh = c
+ x.mesh = d
+ x.light = d
+ assert x.light == d
+ with pytest.raises(TypeError):
+ x.light = m
+ x.light = c
+
+ # Test transformations getters/setters/etc...
+ # Set up test values
+ x = np.array([1.0, 0.0, 0.0])
+ y = np.array([0.0, 1.0, 0.0])
+ t = np.array([1.0, 2.0, 3.0])
+ s = np.array([0.5, 2.0, 1.0])
+
+ Mx = transformations.rotation_matrix(np.pi / 2.0, x)
+ qx = np.roll(transformations.quaternion_about_axis(np.pi / 2.0, x), -1)
+ Mxt = Mx.copy()
+ Mxt[:3,3] = t
+ S = np.eye(4)
+ S[:3,:3] = np.diag(s)
+ Mxts = Mxt.dot(S)
+
+ My = transformations.rotation_matrix(np.pi / 2.0, y)
+ qy = np.roll(transformations.quaternion_about_axis(np.pi / 2.0, y), -1)
+ Myt = My.copy()
+ Myt[:3,3] = t
+
+ x = Node(matrix=Mx)
+ assert np.allclose(x.matrix, Mx)
+ assert np.allclose(x.rotation, qx)
+ assert np.allclose(x.translation, np.zeros(3))
+ assert np.allclose(x.scale, np.ones(3))
+
+ x.matrix = My
+ assert np.allclose(x.matrix, My)
+ assert np.allclose(x.rotation, qy)
+ assert np.allclose(x.translation, np.zeros(3))
+ assert np.allclose(x.scale, np.ones(3))
+ x.translation = t
+ assert np.allclose(x.matrix, Myt)
+ assert np.allclose(x.rotation, qy)
+ x.rotation = qx
+ assert np.allclose(x.matrix, Mxt)
+ x.scale = s
+ assert np.allclose(x.matrix, Mxts)
+
+ x = Node(matrix=Mxt)
+ assert np.allclose(x.matrix, Mxt)
+ assert np.allclose(x.rotation, qx)
+ assert np.allclose(x.translation, t)
+ assert np.allclose(x.scale, np.ones(3))
+
+ x = Node(matrix=Mxts)
+ assert np.allclose(x.matrix, Mxts)
+ assert np.allclose(x.rotation, qx)
+ assert np.allclose(x.translation, t)
+ assert np.allclose(x.scale, s)
+
+ # Individual element getters
+ x.scale[0] = 0
+ assert np.allclose(x.scale[0], 0)
+
+ x.translation[0] = 0
+ assert np.allclose(x.translation[0], 0)
+
+ x.matrix = np.eye(4)
+ x.matrix[0,0] = 500
+ assert x.matrix[0,0] == 1.0
+
+ # Failures
+ with pytest.raises(ValueError):
+ x.matrix = 5 * np.eye(4)
+ with pytest.raises(ValueError):
+ x.matrix = np.eye(5)
+ with pytest.raises(ValueError):
+ x.matrix = np.eye(4).dot([5,1,1,1])
+ with pytest.raises(ValueError):
+ x.rotation = np.array([1,2])
+ with pytest.raises(ValueError):
+ x.rotation = np.array([1,2,3])
+ with pytest.raises(ValueError):
+ x.rotation = np.array([1,2,3,4])
+ with pytest.raises(ValueError):
+ x.translation = np.array([1,2,3,4])
+ with pytest.raises(ValueError):
+ x.scale = np.array([1,2,3,4])
diff --git a/generate_human_motion/pyrender/tests/unit/test_offscreen.py b/generate_human_motion/pyrender/tests/unit/test_offscreen.py
new file mode 100644
index 0000000000000000000000000000000000000000..88983b0ff4e2ab6f5ef252c51f2ac669c3a0e0ca
--- /dev/null
+++ b/generate_human_motion/pyrender/tests/unit/test_offscreen.py
@@ -0,0 +1,92 @@
+import numpy as np
+import trimesh
+
+from pyrender import (OffscreenRenderer, PerspectiveCamera, DirectionalLight,
+ SpotLight, Mesh, Node, Scene)
+
+
+def test_offscreen_renderer(tmpdir):
+
+ # Fuze trimesh
+ fuze_trimesh = trimesh.load('examples/models/fuze.obj')
+ fuze_mesh = Mesh.from_trimesh(fuze_trimesh)
+
+ # Drill trimesh
+ drill_trimesh = trimesh.load('examples/models/drill.obj')
+ drill_mesh = Mesh.from_trimesh(drill_trimesh)
+ drill_pose = np.eye(4)
+ drill_pose[0,3] = 0.1
+ drill_pose[2,3] = -np.min(drill_trimesh.vertices[:,2])
+
+ # Wood trimesh
+ wood_trimesh = trimesh.load('examples/models/wood.obj')
+ wood_mesh = Mesh.from_trimesh(wood_trimesh)
+
+ # Water bottle trimesh
+ bottle_gltf = trimesh.load('examples/models/WaterBottle.glb')
+ bottle_trimesh = bottle_gltf.geometry[list(bottle_gltf.geometry.keys())[0]]
+ bottle_mesh = Mesh.from_trimesh(bottle_trimesh)
+ bottle_pose = np.array([
+ [1.0, 0.0, 0.0, 0.1],
+ [0.0, 0.0, -1.0, -0.16],
+ [0.0, 1.0, 0.0, 0.13],
+ [0.0, 0.0, 0.0, 1.0],
+ ])
+
+ boxv_trimesh = trimesh.creation.box(extents=0.1 * np.ones(3))
+ boxv_vertex_colors = np.random.uniform(size=(boxv_trimesh.vertices.shape))
+ boxv_trimesh.visual.vertex_colors = boxv_vertex_colors
+ boxv_mesh = Mesh.from_trimesh(boxv_trimesh, smooth=False)
+ boxf_trimesh = trimesh.creation.box(extents=0.1 * np.ones(3))
+ boxf_face_colors = np.random.uniform(size=boxf_trimesh.faces.shape)
+ boxf_trimesh.visual.face_colors = boxf_face_colors
+ # Instanced
+ poses = np.tile(np.eye(4), (2,1,1))
+ poses[0,:3,3] = np.array([-0.1, -0.10, 0.05])
+ poses[1,:3,3] = np.array([-0.15, -0.10, 0.05])
+ boxf_mesh = Mesh.from_trimesh(boxf_trimesh, poses=poses, smooth=False)
+
+ points = trimesh.creation.icosphere(radius=0.05).vertices
+ point_colors = np.random.uniform(size=points.shape)
+ points_mesh = Mesh.from_points(points, colors=point_colors)
+
+ direc_l = DirectionalLight(color=np.ones(3), intensity=1.0)
+ spot_l = SpotLight(color=np.ones(3), intensity=10.0,
+ innerConeAngle=np.pi / 16, outerConeAngle=np.pi / 6)
+
+ cam = PerspectiveCamera(yfov=(np.pi / 3.0))
+ cam_pose = np.array([
+ [0.0, -np.sqrt(2) / 2, np.sqrt(2) / 2, 0.5],
+ [1.0, 0.0, 0.0, 0.0],
+ [0.0, np.sqrt(2) / 2, np.sqrt(2) / 2, 0.4],
+ [0.0, 0.0, 0.0, 1.0]
+ ])
+
+ scene = Scene(ambient_light=np.array([0.02, 0.02, 0.02]))
+
+ fuze_node = Node(mesh=fuze_mesh, translation=np.array([
+ 0.1, 0.15, -np.min(fuze_trimesh.vertices[:,2])
+ ]))
+ scene.add_node(fuze_node)
+ boxv_node = Node(mesh=boxv_mesh, translation=np.array([-0.1, 0.10, 0.05]))
+ scene.add_node(boxv_node)
+ boxf_node = Node(mesh=boxf_mesh)
+ scene.add_node(boxf_node)
+
+ _ = scene.add(drill_mesh, pose=drill_pose)
+ _ = scene.add(bottle_mesh, pose=bottle_pose)
+ _ = scene.add(wood_mesh)
+ _ = scene.add(direc_l, pose=cam_pose)
+ _ = scene.add(spot_l, pose=cam_pose)
+ _ = scene.add(points_mesh)
+
+ _ = scene.add(cam, pose=cam_pose)
+
+ r = OffscreenRenderer(viewport_width=640, viewport_height=480)
+ color, depth = r.render(scene)
+
+ assert color.shape == (480, 640, 3)
+ assert depth.shape == (480, 640)
+ assert np.max(depth.data) > 0.05
+ assert np.count_nonzero(depth.data) > (0.2 * depth.size)
+ r.delete()
diff --git a/generate_human_motion/pyrender/tests/unit/test_scenes.py b/generate_human_motion/pyrender/tests/unit/test_scenes.py
new file mode 100644
index 0000000000000000000000000000000000000000..d85dd714cb5d842ea12dee4140adfd7db55c9c01
--- /dev/null
+++ b/generate_human_motion/pyrender/tests/unit/test_scenes.py
@@ -0,0 +1,235 @@
+import numpy as np
+import pytest
+import trimesh
+
+from pyrender import (Mesh, PerspectiveCamera, DirectionalLight,
+ SpotLight, PointLight, Scene, Node, OrthographicCamera)
+
+
+def test_scenes():
+
+ # Basics
+ s = Scene()
+ assert np.allclose(s.bg_color, np.ones(4))
+ assert np.allclose(s.ambient_light, np.zeros(3))
+ assert len(s.nodes) == 0
+ assert s.name is None
+ s.name = 'asdf'
+ s.bg_color = None
+ s.ambient_light = None
+ assert np.allclose(s.bg_color, np.ones(4))
+ assert np.allclose(s.ambient_light, np.zeros(3))
+
+ assert s.nodes == set()
+ assert s.cameras == set()
+ assert s.lights == set()
+ assert s.point_lights == set()
+ assert s.spot_lights == set()
+ assert s.directional_lights == set()
+ assert s.meshes == set()
+ assert s.camera_nodes == set()
+ assert s.light_nodes == set()
+ assert s.point_light_nodes == set()
+ assert s.spot_light_nodes == set()
+ assert s.directional_light_nodes == set()
+ assert s.mesh_nodes == set()
+ assert s.main_camera_node is None
+ assert np.all(s.bounds == 0)
+ assert np.all(s.centroid == 0)
+ assert np.all(s.extents == 0)
+ assert np.all(s.scale == 0)
+
+ # From trimesh scene
+ tms = trimesh.load('tests/data/WaterBottle.glb')
+ s = Scene.from_trimesh_scene(tms)
+ assert len(s.meshes) == 1
+ assert len(s.mesh_nodes) == 1
+
+ # Test bg color formatting
+ s = Scene(bg_color=[0, 1.0, 0])
+ assert np.allclose(s.bg_color, np.array([0.0, 1.0, 0.0, 1.0]))
+
+ # Test constructor for nodes
+ n1 = Node()
+ n2 = Node()
+ n3 = Node()
+ nodes = [n1, n2, n3]
+ s = Scene(nodes=nodes)
+ n1.children.append(n2)
+ s = Scene(nodes=nodes)
+ n3.children.append(n2)
+ with pytest.raises(ValueError):
+ s = Scene(nodes=nodes)
+ n3.children = []
+ n2.children.append(n3)
+ n3.children.append(n2)
+ with pytest.raises(ValueError):
+ s = Scene(nodes=nodes)
+
+ # Test node accessors
+ n1 = Node()
+ n2 = Node()
+ n3 = Node()
+ nodes = [n1, n2]
+ s = Scene(nodes=nodes)
+ assert s.has_node(n1)
+ assert s.has_node(n2)
+ assert not s.has_node(n3)
+
+ # Test node poses
+ for n in nodes:
+ assert np.allclose(s.get_pose(n), np.eye(4))
+ with pytest.raises(ValueError):
+ s.get_pose(n3)
+ with pytest.raises(ValueError):
+ s.set_pose(n3, np.eye(4))
+ tf = np.eye(4)
+ tf[:3,3] = np.ones(3)
+ s.set_pose(n1, tf)
+ assert np.allclose(s.get_pose(n1), tf)
+ assert np.allclose(s.get_pose(n2), np.eye(4))
+
+ nodes = [n1, n2, n3]
+ tf2 = np.eye(4)
+ tf2[:3,:3] = np.diag([-1,-1,1])
+ n1.children.append(n2)
+ n1.matrix = tf
+ n2.matrix = tf2
+ s = Scene(nodes=nodes)
+ assert np.allclose(s.get_pose(n1), tf)
+ assert np.allclose(s.get_pose(n2), tf.dot(tf2))
+ assert np.allclose(s.get_pose(n3), np.eye(4))
+
+ n1 = Node()
+ n2 = Node()
+ n3 = Node()
+ n1.children.append(n2)
+ s = Scene()
+ s.add_node(n1)
+ with pytest.raises(ValueError):
+ s.add_node(n2)
+ s.set_pose(n1, tf)
+ assert np.allclose(s.get_pose(n1), tf)
+ assert np.allclose(s.get_pose(n2), tf)
+ s.set_pose(n2, tf2)
+ assert np.allclose(s.get_pose(n2), tf.dot(tf2))
+
+ # Test node removal
+ n1 = Node()
+ n2 = Node()
+ n3 = Node()
+ n1.children.append(n2)
+ n2.children.append(n3)
+ s = Scene(nodes=[n1, n2, n3])
+ s.remove_node(n2)
+ assert len(s.nodes) == 1
+ assert n1 in s.nodes
+ assert len(n1.children) == 0
+ assert len(n2.children) == 1
+ s.add_node(n2, parent_node=n1)
+ assert len(n1.children) == 1
+ n1.matrix = tf
+ n3.matrix = tf2
+ assert np.allclose(s.get_pose(n3), tf.dot(tf2))
+
+ # Now test ADD function
+ s = Scene()
+ m = Mesh([], name='m')
+ cp = PerspectiveCamera(yfov=2.0)
+ co = OrthographicCamera(xmag=1.0, ymag=1.0)
+ dl = DirectionalLight()
+ pl = PointLight()
+ sl = SpotLight()
+
+ n1 = s.add(m, name='mn')
+ assert n1.mesh == m
+ assert len(s.nodes) == 1
+ assert len(s.mesh_nodes) == 1
+ assert n1 in s.mesh_nodes
+ assert len(s.meshes) == 1
+ assert m in s.meshes
+ assert len(s.get_nodes(node=n2)) == 0
+ n2 = s.add(m, pose=tf)
+ assert len(s.nodes) == len(s.mesh_nodes) == 2
+ assert len(s.meshes) == 1
+ assert len(s.get_nodes(node=n1)) == 1
+ assert len(s.get_nodes(node=n1, name='mn')) == 1
+ assert len(s.get_nodes(name='mn')) == 1
+ assert len(s.get_nodes(obj=m)) == 2
+ assert len(s.get_nodes(obj=m, obj_name='m')) == 2
+ assert len(s.get_nodes(obj=co)) == 0
+ nsl = s.add(sl, name='sln')
+ npl = s.add(pl, parent_name='sln')
+ assert nsl.children[0] == npl
+ ndl = s.add(dl, parent_node=npl)
+ assert npl.children[0] == ndl
+ nco = s.add(co)
+ ncp = s.add(cp)
+
+ assert len(s.light_nodes) == len(s.lights) == 3
+ assert len(s.point_light_nodes) == len(s.point_lights) == 1
+ assert npl in s.point_light_nodes
+ assert len(s.spot_light_nodes) == len(s.spot_lights) == 1
+ assert nsl in s.spot_light_nodes
+ assert len(s.directional_light_nodes) == len(s.directional_lights) == 1
+ assert ndl in s.directional_light_nodes
+ assert len(s.cameras) == len(s.camera_nodes) == 2
+ assert s.main_camera_node == nco
+ s.main_camera_node = ncp
+ s.remove_node(ncp)
+ assert len(s.cameras) == len(s.camera_nodes) == 1
+ assert s.main_camera_node == nco
+ s.remove_node(n2)
+ assert len(s.meshes) == 1
+ s.remove_node(n1)
+ assert len(s.meshes) == 0
+ s.remove_node(nsl)
+ assert len(s.lights) == 0
+ s.remove_node(nco)
+ assert s.main_camera_node is None
+
+ s.add_node(n1)
+ s.clear()
+ assert len(s.nodes) == 0
+
+ # Trigger final errors
+ with pytest.raises(ValueError):
+ s.main_camera_node = None
+ with pytest.raises(ValueError):
+ s.main_camera_node = ncp
+ with pytest.raises(ValueError):
+ s.add(m, parent_node=n1)
+ with pytest.raises(ValueError):
+ s.add(m, name='asdf')
+ s.add(m, name='asdf')
+ s.add(m, parent_name='asdf')
+ with pytest.raises(ValueError):
+ s.add(m, parent_name='asfd')
+ with pytest.raises(TypeError):
+ s.add(None)
+
+ s.clear()
+ # Test bounds
+ m1 = Mesh.from_trimesh(trimesh.creation.box())
+ m2 = Mesh.from_trimesh(trimesh.creation.box())
+ m3 = Mesh.from_trimesh(trimesh.creation.box())
+ n1 = Node(mesh=m1)
+ n2 = Node(mesh=m2, translation=[1.0, 0.0, 0.0])
+ n3 = Node(mesh=m3, translation=[0.5, 0.0, 1.0])
+ s.add_node(n1)
+ s.add_node(n2)
+ s.add_node(n3)
+ assert np.allclose(s.bounds, [[-0.5, -0.5, -0.5], [1.5, 0.5, 1.5]])
+ s.clear()
+ s.add_node(n1)
+ s.add_node(n2, parent_node=n1)
+ s.add_node(n3, parent_node=n2)
+ assert np.allclose(s.bounds, [[-0.5, -0.5, -0.5], [2.0, 0.5, 1.5]])
+ tf = np.eye(4)
+ tf[:3,3] = np.ones(3)
+ s.set_pose(n3, tf)
+ assert np.allclose(s.bounds, [[-0.5, -0.5, -0.5], [2.5, 1.5, 1.5]])
+ s.remove_node(n2)
+ assert np.allclose(s.bounds, [[-0.5, -0.5, -0.5], [0.5, 0.5, 0.5]])
+ s.clear()
+ assert np.allclose(s.bounds, 0.0)
diff --git a/generate_human_motion/requirements.txt b/generate_human_motion/requirements.txt
new file mode 100644
index 0000000000000000000000000000000000000000..50c2174b9dc8dba55b051c3c3fbe2b3b58c6e136
--- /dev/null
+++ b/generate_human_motion/requirements.txt
@@ -0,0 +1,27 @@
+git+https://github.com/openai/CLIP.git
+numpy==1.23.3
+matplotlib==3.4.3
+matplotlib-inline==0.1.2
+transformers
+h5py
+smplx
+shapely
+freetype-py
+imageio
+networkx
+numpy
+Pillow
+pyglet
+PyOpenGL
+PyOpenGL_accelerate
+six
+trimesh
+sphinx
+sphinx_rtd_theme
+sphinx-automodapi
+mapbox_earcut
+chumpy
+gdown
+MoviePy
+ffmpeg
+gradio==3.12
\ No newline at end of file