⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 custom_shape.c

📁 video linux conference
💻 C
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************** * custom_shape.c: ***************************************************************************** * Copyright (C) 2004 VideoLAN * $Id: custom_shape.c 10101 2005-03-02 16:47:31Z robux4 $ * * Authors: Cyril Deguet <asmax@videolan.org> *          code from projectM http://xmms-projectm.sourceforge.net * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA. *****************************************************************************///#include <stdio.h>#include <string.h>#include <stdlib.h>#include "common.h"#include "fatal.h"#include "param_types.h"#include "param.h"#include "expr_types.h"#include "eval.h"#include "splaytree_types.h"#include "splaytree.h"#include "tree_types.h"#include "per_frame_eqn_types.h"#include "per_frame_eqn.h"#include "init_cond_types.h"#include "init_cond.h"#include "preset_types.h"#include "custom_shape_types.h"#include "custom_shape.h"#include "init_cond_types.h"#include "init_cond.h"custom_shape_t * interface_shape = NULL;int cwave_interface_id = 0;extern preset_t * active_preset;inline void eval_custom_shape_init_conds(custom_shape_t * custom_shape);void load_unspec_init_cond_shape(param_t * param);void destroy_param_db_tree_shape(splaytree_t * tree);void destroy_per_frame_eqn_tree_shape(splaytree_t * tree);void destroy_per_frame_init_eqn_tree_shape(splaytree_t * tree);void destroy_init_cond_tree_shape(splaytree_t * tree);custom_shape_t * new_custom_shape(int id) {  custom_shape_t * custom_shape;  param_t * param;  if ((custom_shape = (custom_shape_t*)malloc(sizeof(custom_shape_t))) == NULL)    return NULL;  custom_shape->id = id;  custom_shape->per_frame_count = 0;  custom_shape->per_frame_eqn_string_index = 0;  custom_shape->per_frame_init_eqn_string_index = 0;  /* Initialize tree data structures */  if ((custom_shape->param_tree =        create_splaytree(compare_string, copy_string, free_string)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  if ((custom_shape->per_frame_eqn_tree =        create_splaytree(compare_int, copy_int, free_int)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  if ((custom_shape->init_cond_tree =        create_splaytree(compare_string, copy_string, free_string)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }    if ((custom_shape->per_frame_init_eqn_tree =        create_splaytree(compare_string, copy_string, free_string)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  /* Start: Load custom shape parameters */  if ((param = new_param_double("r", P_FLAG_NONE, &custom_shape->r, NULL, 1.0, 0.0, .5)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }   if ((param = new_param_double("g", P_FLAG_NONE, &custom_shape->g, NULL, 1.0, 0.0, .5)) == NULL){    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_double("b", P_FLAG_NONE, &custom_shape->b, NULL, 1.0, 0.0, .5)) == NULL){    free_custom_shape(custom_shape);    return NULL;				         }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_double("a", P_FLAG_NONE, &custom_shape->a, NULL, 1.0, 0.0, .5)) == NULL){    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_double("border_r", P_FLAG_NONE, &custom_shape->border_r, NULL, 1.0, 0.0, .5)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }   if ((param = new_param_double("border_g", P_FLAG_NONE, &custom_shape->border_g, NULL, 1.0, 0.0, .5)) == NULL){    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_double("border_b", P_FLAG_NONE, &custom_shape->border_b, NULL, 1.0, 0.0, .5)) == NULL){    free_custom_shape(custom_shape);    return NULL;				         }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_double("border_a", P_FLAG_NONE, &custom_shape->border_a, NULL, 1.0, 0.0, .5)) == NULL){    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_double("r2", P_FLAG_NONE, &custom_shape->r2, NULL, 1.0, 0.0, .5)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }   if ((param = new_param_double("g2", P_FLAG_NONE, &custom_shape->g2, NULL, 1.0, 0.0, .5)) == NULL){    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_double("b2", P_FLAG_NONE, &custom_shape->b2, NULL, 1.0, 0.0, .5)) == NULL){    free_custom_shape(custom_shape);    return NULL;				         }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_double("a2", P_FLAG_NONE, &custom_shape->a2, NULL, 1.0, 0.0, .5)) == NULL){    free_custom_shape(custom_shape);    return NULL;  }    if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_double("x", P_FLAG_NONE, &custom_shape->x, NULL, 1.0, 0.0, .5)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_double("y", P_FLAG_NONE, &custom_shape->y, NULL, 1.0, 0.0, .5)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_bool("thickOutline", P_FLAG_NONE, &custom_shape->thickOutline, 1, 0, 0)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_bool("enabled", P_FLAG_NONE, &custom_shape->enabled, 1, 0, 0)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_int("sides", P_FLAG_NONE, &custom_shape->sides, 100, 3, 3)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_bool("additive", P_FLAG_NONE, &custom_shape->additive, 1, 0, 0)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }  if ((param = new_param_bool("textured", P_FLAG_NONE, &custom_shape->textured, 1, 0, 0)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }  if (insert_param(param, custom_shape->param_tree) < 0) {    free_custom_shape(custom_shape);    return NULL;  }   if ((param = new_param_double("rad", P_FLAG_NONE, &custom_shape->rad, NULL, MAX_DOUBLE_SIZE, 0, 0.0)) == NULL) {    free_custom_shape(custom_shape);    return NULL;  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -