clear ht
This commit is contained in:
@@ -1,39 +0,0 @@
|
|||||||
<?php
|
|
||||||
// error_reporting(0);
|
|
||||||
$sqm = $_POST['sqm'];
|
|
||||||
$num = $_POST['num'];
|
|
||||||
$type = $_POST['type'];
|
|
||||||
include "config.php";
|
|
||||||
$zame = 'PAY_';
|
|
||||||
$type == 0 && (die("<script>alert('请选择类型');window.history.back(-1); </script>"));
|
|
||||||
$type == 2 && ($zame = 'CDK_');
|
|
||||||
$sqm != $d_gmrz && (die("<script>alert('授权码错误');window.history.back(-1); </script>"));
|
|
||||||
$num > 100 && (die("<script>alert('单次最多生成100条');window.history.back(-1); </script>"));
|
|
||||||
$num == '' && ($num = 1);
|
|
||||||
$mysql = mysqli_connect($PZ['DB_HOST'],$PZ['DB_USER'],$PZ['DB_PWD'],$PZ['DB_NAME'],$PZ['DB_PORT']) or die("<script>alert('数据库连接失败');window.history.back(-1); </script>");
|
|
||||||
for($i=1;$i<=$num;$i++){
|
|
||||||
$cdk = cdkey('iguozicc');
|
|
||||||
$txt .= $cdk."\n";
|
|
||||||
if(!$mysql->query("INSERT INTO cdk (cdk,type) VALUES ('$cdk','$type');")){die("<script>alert('生成失败,请查看数据库连接是否正常');window.history.back(-1); </script>");}
|
|
||||||
}
|
|
||||||
$ts = time().'.txt';
|
|
||||||
Header ( "Content-type: application/octet-stream" );
|
|
||||||
Header ( "Accept-Ranges: bytes" );
|
|
||||||
Header ( "Content-Disposition: attachment; filename=".$zame.$ts);
|
|
||||||
die($txt);
|
|
||||||
|
|
||||||
function cdkey($namespace = null) {
|
|
||||||
static $guid = '';
|
|
||||||
$uid = uniqid ( "", true );
|
|
||||||
$data = $namespace;
|
|
||||||
$data .= $_SERVER ['REQUEST_TIME'];
|
|
||||||
$data .= $_SERVER ['HTTP_USER_AGENT'];
|
|
||||||
$data .= $_SERVER ['SERVER_ADDR'];
|
|
||||||
$data .= $_SERVER ['SERVER_PORT'];
|
|
||||||
$data .= $_SERVER ['REMOTE_ADDR'];
|
|
||||||
$data .= $_SERVER ['REMOTE_PORT'];
|
|
||||||
$hash = strtoupper (substr(md5($uid.$data), 8, 16));
|
|
||||||
$guid = substr ( $hash, 0, 4 ) . '-' . substr ( $hash, 4, 4 ) . '-' . substr ( $hash, 8, 4 ) . '-' . substr ( $hash, 12, 4 );
|
|
||||||
return $guid;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
error_reporting(0);
|
|
||||||
$PZ = array(
|
|
||||||
'DB_HOST'=>'127.0.0.1',// 服务器地址
|
|
||||||
'DB_NAME'=>'cdk',// 游戏数据库
|
|
||||||
'DB_USER'=>'root',// 用户名
|
|
||||||
'DB_PWD'=>'mysql_tr2Few',// 密码
|
|
||||||
'DB_PORT'=>'23306',// 端口
|
|
||||||
'DB_CHARSET'=>'utf8',// 数据库字符集
|
|
||||||
);
|
|
||||||
$d_gmrz = "51boshao.com";//gm认证码
|
|
||||||
?>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 55 KiB |
@@ -1,179 +0,0 @@
|
|||||||
body { background-color: #ffffff; font-family: '12px/1.7 -apple-system', '微软雅黑', 'Helvetica Neue', 'Helvetica', arial, sans-serif, 'DejaVu Sans', 'Lucida Grande', Tahoma, 'Hiragino Sans GB', STHeiti, SimSun; font-weight: 300; font-size: 16px; color: #555; font-style: normal; -webkit-font-smoothing: antialiased; -webkit-text-stroke-width: 0px; -moz-osx-font-smoothing: grayscale; -webkit-overflow-scrolling: touch; }
|
|
||||||
/* Titles */
|
|
||||||
h1, h2, h3, h4, h5, h6 { font-family: '12px/1.7 -apple-system', '微软雅黑', 'Helvetica Neue', 'Helvetica', arial, sans-serif, 'DejaVu Sans', 'Lucida Grande', Tahoma, 'Hiragino Sans GB', STHeiti, SimSun; font-weight: 300; color: #555; }
|
|
||||||
h1 { font-size: 40px; }
|
|
||||||
h3 { color: #555; font-weight: 400; }
|
|
||||||
h4 { color: #555; font-weight: 400; font-size: 20px; }
|
|
||||||
/* Paragraph & Typographic */
|
|
||||||
p { line-height: 28px; margin-bottom: 25px; font-size: 16px; }
|
|
||||||
hr { display: block; height: 1px; border: 0; border-top: 1px solid #f5f5f5; margin: 1em 0; padding: 0; }
|
|
||||||
.defaultWrap { margin-top: 20px; }
|
|
||||||
.mainWrap { margin-top: 50px; }
|
|
||||||
.footWrap { border-top: 1px solid #ddd; padding: 20px 0; margin-top: 20px; }
|
|
||||||
.centered { text-align: center; }
|
|
||||||
.col-centered { float: none; margin: 0 auto; }
|
|
||||||
.navbar-default { border-color: transparent; }
|
|
||||||
.navbar-default .navbar-brand { color: #334455; }
|
|
||||||
.navbar-default .navbar-nav > li > a { color: #334455; }
|
|
||||||
.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:focus, .navbar-default .navbar-nav > .active > a:hover { color: #334455; border-bottom: 1px solid #3498db; background-color: transparent; }
|
|
||||||
.btn { outline: none; }
|
|
||||||
.btn:focus { outline: none; }
|
|
||||||
.btn-group-theme { padding-top: 8px; }
|
|
||||||
.btn-count { border: 1px solid #ddd; max-width: 40px; min-width: 40px; padding: 4px 0; cursor: default; margin-bottom: 6px; }
|
|
||||||
.dropdown-menu > li { }
|
|
||||||
.dropdown-menu > li > a { line-height: 2.5; font-weight: 100; }
|
|
||||||
/* Helpers */
|
|
||||||
|
|
||||||
.mt { margin-top: 40px; margin-bottom: 40px; }
|
|
||||||
i { margin: 8px; color: #3498db; }
|
|
||||||
.icon { text-align: center; }
|
|
||||||
.tar { text-align: right }
|
|
||||||
.tal { text-align: left; }
|
|
||||||
.tac { text-align: center; }
|
|
||||||
.heading-right { text-align: right; margin-top: 12px; color: #ddd; }
|
|
||||||
.explore-list > .row { border-top: 1px solid #ddd; }
|
|
||||||
.content > p, .content > a p { margin-bottom: 5px; }
|
|
||||||
.content > h5 { margin-bottom: 0; }
|
|
||||||
.content-list-wrap { padding: 0 15px; }
|
|
||||||
.content-list { padding: 15px 0; border-bottom: 1px solid #f5f5f5; }
|
|
||||||
.article-view { background-color: #333; border-radius: 5px; padding: 10px 0; opacity: .95; }
|
|
||||||
.article-view ul { padding-left: 15px; }
|
|
||||||
.article-view a, .article-view a:hover { color: #fff; }
|
|
||||||
.article-list-summary { padding-bottom: 5px; }
|
|
||||||
.article-content > h3 { margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px dashed #f1f1f1; }
|
|
||||||
.publish { padding-top: 30px; }
|
|
||||||
.publish-button { padding: 8px 0; }
|
|
||||||
.main-side { padding: 15px 0; }
|
|
||||||
.main-side > ul { margin: 0; padding: 0; }
|
|
||||||
.main-side > ul > li { list-style: none; }
|
|
||||||
.nav-side > li.active > a, .nav-side > li.active > a:focus, .nav-side > li.active > a:hover { background: transparent; color: #3498db; border-bottom: 1px solid #3498db; }
|
|
||||||
.nav-pills > li > a { color: #555; border-radius: 0; }
|
|
||||||
.nav-side > li > a:hover { color: #3498db; background: transparent; }
|
|
||||||
.nav-side { background: transparent; }
|
|
||||||
.panel { background-color: transparent; box-shadow: 0 1px 1px rgba(0, 0, 0, 0); margin-bottom: 0px; }
|
|
||||||
.panel-footer { padding: 5px 0; background-color: transparent; border-radius: 0; border: none; }
|
|
||||||
.panel-cpf-slide { background-color: transparent; }
|
|
||||||
.panel-cpf-slide > .panel-heading { color: #333; border-color: #ddd; padding: 15px 1px; }
|
|
||||||
.panel-cpf-slide > .panel-body { padding: 15px 1px; }
|
|
||||||
.panel-cpf-default > .panel-heading { color: #333; border-color: #ddd; padding: 20px 15px 10px 15px }
|
|
||||||
.panel-cpf-invite > .panel-heading { color: #333; border-color: #ddd; padding: 15px 0 20px 0; }
|
|
||||||
.panel-cpf-content > .panel-heading, .panel-cpf-answer > .panel-heading { padding: 15px 0; border-color: #ddd; }
|
|
||||||
.panel-cpf-content > .panel-body, .panel-cpf-answer > .panel-body { padding: 15px 0; overflow: hidden; }
|
|
||||||
.panel-message-list > .panel-heading { border-bottom: 1px dashed #ddd; }
|
|
||||||
.panel-message-list > .panel-body { padding: 5px 15px; }
|
|
||||||
.panel-border { margin: 10px 0; border: 1px solid #efefef; }
|
|
||||||
.recommend-title { font-size: 18px; font-weight: 300; }
|
|
||||||
.recommend-more { margin-top: 3px; text-align: right; }
|
|
||||||
.recommend-body { padding: 5px 15px; }
|
|
||||||
.child-topic-list { padding: 10px 0 20px 0; border-bottom: 1px solid #f5f5f5; }
|
|
||||||
.form-center-button { text-align: center; }
|
|
||||||
.form-center-button > button, .form-center-button > a { margin: 0 20px; }
|
|
||||||
.title-pagination { margin-top: 30px; }
|
|
||||||
.title-pagination > a { padding: 1px 8px; }
|
|
||||||
.editor-user-info { padding-bottom: 15px; }
|
|
||||||
.editor-user-info > .info { padding: 5px 0; }
|
|
||||||
.answer-content { margin: 3px 0; }
|
|
||||||
.answer-content > p { margin: 0; }
|
|
||||||
.answer-list { border-bottom: 1px solid #eee; padding-bottom: 12px; }
|
|
||||||
.blocked-content-list { text-align: center; padding: 10px 0; }
|
|
||||||
.blocked-content { text-decoration: line-through; font-style: oblique; }
|
|
||||||
.posts-list > .row { padding: 12px 0; border-top: 1px solid #f5f5f5; }
|
|
||||||
.posts-list > .row .col-xs-3 { vertical-align: middle; }
|
|
||||||
.reply-list, .comment-list { border-bottom: 1px solid #f5f5f5 }
|
|
||||||
.reply-list > .media-left, .comment-list > .media-left { padding-top: 5px; }
|
|
||||||
.reply-list-flag { padding-bottom: 10px; }
|
|
||||||
.reply-control-panel, .answer-control-panel { display: none; padding-left: 10px; }
|
|
||||||
.answer-control-panel > a { margin: 0 5px; }
|
|
||||||
.correlation-list { list-style: none; margin: 0; padding: 0; }
|
|
||||||
.correlation-list > li { padding: 5px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
||||||
.content-fold-flag { max-height: 70px; overflow: hidden; }
|
|
||||||
.invite-input { float: right; max-width: 120px; }
|
|
||||||
.invite-btn { float: right; }
|
|
||||||
.invite-list { border-bottom: 1px solid #f5f5f5; padding-bottom: 6px; }
|
|
||||||
.invalid-topic { color: #b09f9f; }
|
|
||||||
.n-invalid { border: 1px solid #d00000; }
|
|
||||||
.validator-tips { text-align: center; }
|
|
||||||
.validator-tips .tip { color: #555; }
|
|
||||||
.validator-tips .error { color: #d00000; }
|
|
||||||
.user-avatar { background-color: rgba(255, 255, 255, 0.3); background-size: cover; }
|
|
||||||
.user-content-tab { margin-top: 30px; margin-bottom: 10px; border-bottom: 1px solid #ececec; }
|
|
||||||
.answer-comment-list { margin: 6px 0; padding-bottom: 6px; border-bottom: 1px solid #efefef; }
|
|
||||||
.message-content-list { margin: 10px 0; padding-bottom: 6px; }
|
|
||||||
.message-nav { margin-left: 20px; }
|
|
||||||
.message-nav > span { margin-left: 10px; }
|
|
||||||
.message-nav .active > a { color: #3498db; }
|
|
||||||
.message-content { margin-top: 10px; padding: 20px 10px; max-width: 65%; background-color: #F0F8FF; word-break: break-all; border-radius: 10px; position: relative; }
|
|
||||||
.message-content > button { display: none; position: absolute; top: 3px; border: none; outline: none; }
|
|
||||||
.message-content > button > span { border: none; outline: none; }
|
|
||||||
.answer-comment-list .col-md-12, .message-content-list .col-md-12 { padding-left: 0; padding-right: 0; }
|
|
||||||
.answer-comment-list small { color: #BFBFBF; }
|
|
||||||
.answer-comment-info, .message-list-info { border-bottom: 1px solid #efefef; padding-bottom: 10px; margin: 5px 0; }
|
|
||||||
.message-list-info > div { padding: 0; }
|
|
||||||
.answer-comment-page { margin: 10px 0; }
|
|
||||||
.search-result-list { padding: 10px 0; border-bottom: 1px solid #f7f7f7; }
|
|
||||||
#image-preview, #qr-image-preview { width: 128px; height: 128px; margin: 0 auto; border: 1px solid #ecf0f1; position: relative; overflow: hidden; background-color: #ffffff; color: #ecf0f1; }
|
|
||||||
#image-preview > input, #qr-image-preview > input { line-height: 200px; font-size: 200px; position: absolute; opacity: 0; z-index: 10; }
|
|
||||||
#image-preview > label, #qr-image-preview > label { position: absolute; z-index: 5; opacity: 0.8; cursor: pointer; width: 200px; height: 50px; font-size: 20px; line-height: 50px; text-transform: uppercase; top: 0; left: 0; right: 0; bottom: 0; margin: auto; text-align: center; }
|
|
||||||
#image-preview > label { background: url('../../../images/camera.png') no-repeat 50% 50%; }
|
|
||||||
#qr-image-preview > label { background: url('../../../images/qr.png') no-repeat 50% 50%; }
|
|
||||||
#titleListContent { right: 40px; bottom: 20px; display: none; position: absolute; opacity: 1 }
|
|
||||||
#goTop, #newMessage, #titleList { padding: 5px 0; color: #fff; text-align: center; position: fixed; _position: absolute; right: 3%; z-index: 98; cursor: pointer; filter: Alpha(opacity=75); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)"; }
|
|
||||||
#goTop img, #newMessage img, #titleList img { opacity: .75; }
|
|
||||||
#goTop > i, #newMessage > i, #titleList > i { color: #333; font-size: 42px; }
|
|
||||||
#goTop { display: none; bottom: 80px; }
|
|
||||||
#newMessage { bottom: 155px; }
|
|
||||||
#titleList { display: none; bottom: 117px; }
|
|
||||||
.new-message-flag { display: none; }
|
|
||||||
.new-message-badge { position: absolute; top: -2px; right: -8px; color: #fff; z-index: 99; background: #ee0000; }
|
|
||||||
#topic-choose-menu > a { margin-right: 5px; }
|
|
||||||
.article-content > p img { margin: 0 auto; }
|
|
||||||
.act-list { padding: 0 15px; }
|
|
||||||
.act-list > .row { padding: 10px 0; border-bottom: 1px solid #f5f5f5; }
|
|
||||||
.act-list > .row .col-md-12 { margin: 0; padding: 0; }
|
|
||||||
.act-list .content img, .explore-list .content img, .article-content-list .content img { max-width: 300px; }
|
|
||||||
.content-menu-title > h4 { display: inline-block; }
|
|
||||||
.content-menu-title > img { display: inline-block; border: none; margin-bottom: 5px; }
|
|
||||||
.content-images-list { }
|
|
||||||
.content-images-list > a { border: 1px solid #ddd; padding: 3px; display: inline-block; }
|
|
||||||
.navbar-xs-ul > li { float: left; }
|
|
||||||
.article-nav li { list-style: none; text-align: left; }
|
|
||||||
.xs-navbar-toggle { float: right; padding-right: 15px; margin: 0; border: none; }
|
|
||||||
.xs-navbar-toggle > .nickname { color: #fff; }
|
|
||||||
.xs-search { margin-top: 10px; }
|
|
||||||
.xs-publish { background-color: transparent; margin-top: 40%; }
|
|
||||||
.xs-publish .type { background-color: #fdfdfd; border-radius: 10px; margin: 20px 10px; }
|
|
||||||
.xs-publish .type > a { color: #555; padding: 15px; display: block; width: 100%; height: 100%; }
|
|
||||||
|
|
||||||
@media (min-width: 320px) {
|
|
||||||
.act-list .media-left, .explore-list .media-left { display: none; }
|
|
||||||
.content > img, .content > p > img { max-width: 280px; }
|
|
||||||
}
|
|
||||||
|
|
||||||
@media all and (min-width: 350px) and (max-width: 375px) {
|
|
||||||
.act-list .media-left, .explore-list .media-left { display: none; }
|
|
||||||
.content > img, .content > p > img { max-width: 340px; }
|
|
||||||
}
|
|
||||||
|
|
||||||
@media all and (min-width: 375px) and (max-width: 450px) {
|
|
||||||
.act-list .media-left, .explore-list .media-left { display: none; }
|
|
||||||
.content > img, .content > p > img { max-width: 350px; }
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
.act-list .media-left, .explore-list .media-left { display: table-cell; }
|
|
||||||
.content > img, .content > p > img { max-width: 680px; }
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 1024px) {
|
|
||||||
.act-list .media-left, .explore-list .media-left { display: table-cell; }
|
|
||||||
.act-list .content img, .explore-list .content img, .article-content-list .content img { max-width: 360px; }
|
|
||||||
.content > img, .content > p > img { max-width: 780px; }
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 1600px) {
|
|
||||||
.act-list .media-left, .explore-list .media-left { display: table-cell; }
|
|
||||||
.navbar-default .navbar-brand { position: absolute; left: 150px; }
|
|
||||||
.navbar-default .navbar-nav-op { position: absolute; right: 150px; }
|
|
||||||
.answer-act { position: absolute; left: -50px; }
|
|
||||||
.content > img, .content > p > img { max-width: 780px; }
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh-cn">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
||||||
<title>缥缈CDK生成</title>
|
|
||||||
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link href="https://cdn.staticfile.org/bootstrap-select/1.13.10/css/bootstrap-select.min.css" rel="stylesheet">
|
|
||||||
<link href="images/main.css" rel="stylesheet">
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/jquery/2.0.0/jquery.min.js"></script>
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/bootbox.js/4.4.0/bootbox.min.js"></script>
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/bootstrap-select/1.13.10/js/bootstrap-select.min.js"></script>
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/bootstrap-select/1.13.10/js/i18n/defaults-zh_CN.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="intro" style="margin-top:0px;">
|
|
||||||
|
|
||||||
<div class="col-md-4 col-centered tac"> <img src="images/logo.png" alt="logo"> </div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3 col-sm-8 col-centered">
|
|
||||||
<form method="post" id="register-form" autocomplete="off" action="cdks.php" class="nice-validator n-default" novalidate>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" class="form-control" id="sqm" name="sqm" placeholder="GM授权码" autocomplete="off">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" class="form-control" id="num" name="num" placeholder="生成数量" autocomplete="off">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<select id="type" class="form-control" name="type"><option value="0">请选择类型</option><option value="2">邮件</option></select>
|
|
||||||
</div>
|
|
||||||
<div class="form-center-button">
|
|
||||||
<input class="btn btn-danger" type="submit" value="生成授权码">
|
|
||||||
</div><br>
|
|
||||||
<div id="divMsg" style="color:#F00" class="validator-tips">源码屋:www.51boshao.com</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
document.onkeydown = function(event) {
|
|
||||||
var target, code, tag;
|
|
||||||
if (!event) {
|
|
||||||
event = window.event; //针对ie浏览器
|
|
||||||
target = event.srcElement;
|
|
||||||
code = event.keyCode;
|
|
||||||
if (code == 13) {
|
|
||||||
tag = target.tagName;
|
|
||||||
if (tag == "TEXTAREA") { return true; }
|
|
||||||
else { return false; }
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
target = event.target; //针对遵循w3c标准的浏览器,如Firefox
|
|
||||||
code = event.keyCode;
|
|
||||||
if (code == 13) {
|
|
||||||
tag = target.tagName;
|
|
||||||
if (tag == "INPUT") { return false; }
|
|
||||||
else { return true; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
error_reporting(0);
|
|
||||||
$PZ = array(
|
|
||||||
'DB_HOST'=>'127.0.0.1',// 服务器地址
|
|
||||||
'DB_NAME'=>'cdk',// 游戏数据库
|
|
||||||
'DB_USER'=>'root',// 用户名
|
|
||||||
'DB_PWD'=>'mysql_tr2Few',// 密码
|
|
||||||
'DB_PORT'=>'23306',// 端口
|
|
||||||
'DB_CHARSET'=>'utf8',// 数据库字符集
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
4258
ht/pay/css/style.css
4258
ht/pay/css/style.css
File diff suppressed because it is too large
Load Diff
448
ht/pay/index.php
448
ht/pay/index.php
@@ -1,448 +0,0 @@
|
|||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
|
||||||
<title>缥缈自助授权</title>
|
|
||||||
<link rel="icon" href="favicon.ico" type="image/ico">
|
|
||||||
|
|
||||||
|
|
||||||
<meta name="author" content="yinqi">
|
|
||||||
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link href="./css/style.css" rel="stylesheet">
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/jquery/2.0.0/jquery.min.js"></script>
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/bootbox.js/4.4.0/bootbox.min.js"></script>
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/bootstrap-select/1.13.10/js/bootstrap-select.min.js"></script>
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/bootstrap-select/1.13.10/js/i18n/defaults-zh_CN.js"></script>
|
|
||||||
<script src="./js/uti.js"></script>
|
|
||||||
<style>
|
|
||||||
.wrapper {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.login {
|
|
||||||
display: flex !important;
|
|
||||||
min-height: 100vh;
|
|
||||||
align-items: center !important;
|
|
||||||
justify-content: center !important;
|
|
||||||
}
|
|
||||||
.login-center {
|
|
||||||
background: #fff;
|
|
||||||
min-width: 38.25rem;
|
|
||||||
padding: 2.14286em 3.57143em;
|
|
||||||
border-radius: 5px;
|
|
||||||
margin: 2.85714em 0;
|
|
||||||
}
|
|
||||||
.login-header {
|
|
||||||
margin-bottom: 1.5rem !important;
|
|
||||||
}
|
|
||||||
.login-center .has-feedback.feedback-left .form-control {
|
|
||||||
padding-left: 38px;
|
|
||||||
padding-right: 12px;
|
|
||||||
}
|
|
||||||
.login-center .has-feedback.feedback-left .form-control-feedback {
|
|
||||||
left: 0;
|
|
||||||
right: auto;
|
|
||||||
width: 38px;
|
|
||||||
height: 38px;
|
|
||||||
line-height: 38px;
|
|
||||||
z-index: 4;
|
|
||||||
color: #dcdcdc;
|
|
||||||
}
|
|
||||||
.login-center .has-feedback.feedback-left.row .form-control-feedback {
|
|
||||||
left: 15px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<style>
|
|
||||||
.lizi1{
|
|
||||||
display:table;
|
|
||||||
z-index:10;
|
|
||||||
position:absolute;
|
|
||||||
height:100%;
|
|
||||||
width:100%;
|
|
||||||
}
|
|
||||||
.login-center{
|
|
||||||
background: rgba(255, 255, 255, 0.4);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<body data-logobg="color_8" data-sidebarbg="color_8">
|
|
||||||
<!--开始-->
|
|
||||||
<style type="text/css">
|
|
||||||
*{margin:0;padding:0;list-style-type:none;}
|
|
||||||
a,img{border:0;}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<canvas id="sakura" style="position:absolute;"></canvas>
|
|
||||||
<!-- sakura shader -->
|
|
||||||
<script id="sakura_point_vsh" type="x-shader/x_vertex">
|
|
||||||
uniform mat4 uProjection;
|
|
||||||
uniform mat4 uModelview;
|
|
||||||
uniform vec3 uResolution;
|
|
||||||
uniform vec3 uOffset;
|
|
||||||
uniform vec3 uDOF; //x:focus distance, y:focus radius, z:max radius
|
|
||||||
uniform vec3 uFade; //x:start distance, y:half distance, z:near fade start
|
|
||||||
|
|
||||||
attribute vec3 aPosition;
|
|
||||||
attribute vec3 aEuler;
|
|
||||||
attribute vec2 aMisc; //x:size, y:fade
|
|
||||||
|
|
||||||
varying vec3 pposition;
|
|
||||||
varying float psize;
|
|
||||||
varying float palpha;
|
|
||||||
varying float pdist;
|
|
||||||
|
|
||||||
//varying mat3 rotMat;
|
|
||||||
varying vec3 normX;
|
|
||||||
varying vec3 normY;
|
|
||||||
varying vec3 normZ;
|
|
||||||
varying vec3 normal;
|
|
||||||
|
|
||||||
varying float diffuse;
|
|
||||||
varying float specular;
|
|
||||||
varying float rstop;
|
|
||||||
varying float distancefade;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
// Projection is based on vertical angle
|
|
||||||
vec4 pos = uModelview * vec4(aPosition + uOffset, 1.0);
|
|
||||||
gl_Position = uProjection * pos;
|
|
||||||
gl_PointSize = aMisc.x * uProjection[1][1] / -pos.z * uResolution.y * 0.5;
|
|
||||||
|
|
||||||
pposition = pos.xyz;
|
|
||||||
psize = aMisc.x;
|
|
||||||
pdist = length(pos.xyz);
|
|
||||||
palpha = smoothstep(0.0, 1.0, (pdist - 0.1) / uFade.z);
|
|
||||||
|
|
||||||
vec3 elrsn = sin(aEuler);
|
|
||||||
vec3 elrcs = cos(aEuler);
|
|
||||||
mat3 rotx = mat3(
|
|
||||||
1.0, 0.0, 0.0,
|
|
||||||
0.0, elrcs.x, elrsn.x,
|
|
||||||
0.0, -elrsn.x, elrcs.x
|
|
||||||
);
|
|
||||||
mat3 roty = mat3(
|
|
||||||
elrcs.y, 0.0, -elrsn.y,
|
|
||||||
0.0, 1.0, 0.0,
|
|
||||||
elrsn.y, 0.0, elrcs.y
|
|
||||||
);
|
|
||||||
mat3 rotz = mat3(
|
|
||||||
elrcs.z, elrsn.z, 0.0,
|
|
||||||
-elrsn.z, elrcs.z, 0.0,
|
|
||||||
0.0, 0.0, 1.0
|
|
||||||
);
|
|
||||||
mat3 rotmat = rotx * roty * rotz;
|
|
||||||
normal = rotmat[2];
|
|
||||||
|
|
||||||
mat3 trrotm = mat3(
|
|
||||||
rotmat[0][0], rotmat[1][0], rotmat[2][0],
|
|
||||||
rotmat[0][1], rotmat[1][1], rotmat[2][1],
|
|
||||||
rotmat[0][2], rotmat[1][2], rotmat[2][2]
|
|
||||||
);
|
|
||||||
normX = trrotm[0];
|
|
||||||
normY = trrotm[1];
|
|
||||||
normZ = trrotm[2];
|
|
||||||
|
|
||||||
const vec3 lit = vec3(0.6917144638660746, 0.6917144638660746, -0.20751433915982237);
|
|
||||||
|
|
||||||
float tmpdfs = dot(lit, normal);
|
|
||||||
if(tmpdfs < 0.0) {
|
|
||||||
normal = -normal;
|
|
||||||
tmpdfs = dot(lit, normal);
|
|
||||||
}
|
|
||||||
diffuse = 0.4 + tmpdfs;
|
|
||||||
|
|
||||||
vec3 eyev = normalize(-pos.xyz);
|
|
||||||
if(dot(eyev, normal) > 0.0) {
|
|
||||||
vec3 hv = normalize(eyev + lit);
|
|
||||||
specular = pow(max(dot(hv, normal), 0.0), 20.0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
specular = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
rstop = clamp((abs(pdist - uDOF.x) - uDOF.y) / uDOF.z, 0.0, 1.0);
|
|
||||||
rstop = pow(rstop, 0.5);
|
|
||||||
//-0.69315 = ln(0.5)
|
|
||||||
distancefade = min(1.0, exp((uFade.x - pdist) * 0.69315 / uFade.y));
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script id="sakura_point_fsh" type="x-shader/x_fragment">
|
|
||||||
#ifdef GL_ES
|
|
||||||
//precision mediump float;
|
|
||||||
precision highp float;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform vec3 uDOF; //x:focus distance, y:focus radius, z:max radius
|
|
||||||
uniform vec3 uFade; //x:start distance, y:half distance, z:near fade start
|
|
||||||
|
|
||||||
const vec3 fadeCol = vec3(0.08, 0.03, 0.06);
|
|
||||||
|
|
||||||
varying vec3 pposition;
|
|
||||||
varying float psize;
|
|
||||||
varying float palpha;
|
|
||||||
varying float pdist;
|
|
||||||
|
|
||||||
//varying mat3 rotMat;
|
|
||||||
varying vec3 normX;
|
|
||||||
varying vec3 normY;
|
|
||||||
varying vec3 normZ;
|
|
||||||
varying vec3 normal;
|
|
||||||
|
|
||||||
varying float diffuse;
|
|
||||||
varying float specular;
|
|
||||||
varying float rstop;
|
|
||||||
varying float distancefade;
|
|
||||||
|
|
||||||
float ellipse(vec2 p, vec2 o, vec2 r) {
|
|
||||||
vec2 lp = (p - o) / r;
|
|
||||||
return length(lp) - 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
vec3 p = vec3(gl_PointCoord - vec2(0.5, 0.5), 0.0) * 2.0;
|
|
||||||
vec3 d = vec3(0.0, 0.0, -1.0);
|
|
||||||
float nd = normZ.z; //dot(-normZ, d);
|
|
||||||
if(abs(nd) < 0.0001) discard;
|
|
||||||
|
|
||||||
float np = dot(normZ, p);
|
|
||||||
vec3 tp = p + d * np / nd;
|
|
||||||
vec2 coord = vec2(dot(normX, tp), dot(normY, tp));
|
|
||||||
|
|
||||||
//angle = 15 degree
|
|
||||||
const float flwrsn = 0.258819045102521;
|
|
||||||
const float flwrcs = 0.965925826289068;
|
|
||||||
mat2 flwrm = mat2(flwrcs, -flwrsn, flwrsn, flwrcs);
|
|
||||||
vec2 flwrp = vec2(abs(coord.x), coord.y) * flwrm;
|
|
||||||
|
|
||||||
float r;
|
|
||||||
if(flwrp.x < 0.0) {
|
|
||||||
r = ellipse(flwrp, vec2(0.065, 0.024) * 0.5, vec2(0.36, 0.96) * 0.5);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
r = ellipse(flwrp, vec2(0.065, 0.024) * 0.5, vec2(0.58, 0.96) * 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(r > rstop) discard;
|
|
||||||
|
|
||||||
vec3 col = mix(vec3(1.0, 0.8, 0.75), vec3(1.0, 0.9, 0.87), r);
|
|
||||||
float grady = mix(0.0, 1.0, pow(coord.y * 0.5 + 0.5, 0.35));
|
|
||||||
col *= vec3(1.0, grady, grady);
|
|
||||||
col *= mix(0.8, 1.0, pow(abs(coord.x), 0.3));
|
|
||||||
col = col * diffuse + specular;
|
|
||||||
|
|
||||||
col = mix(fadeCol, col, distancefade);
|
|
||||||
|
|
||||||
float alpha = (rstop > 0.001)? (0.5 - r / (rstop * 2.0)) : 1.0;
|
|
||||||
alpha = smoothstep(0.0, 1.0, alpha) * palpha;
|
|
||||||
|
|
||||||
gl_FragColor = vec4(col * 0.5, alpha);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<!-- effects -->
|
|
||||||
<script id="fx_common_vsh" type="x-shader/x_vertex">
|
|
||||||
uniform vec3 uResolution;
|
|
||||||
attribute vec2 aPosition;
|
|
||||||
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
||||||
texCoord = aPosition.xy * 0.5 + vec2(0.5, 0.5);
|
|
||||||
screenCoord = aPosition.xy * vec2(uResolution.z, 1.0);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script id="bg_fsh" type="x-shader/x_fragment">
|
|
||||||
#ifdef GL_ES
|
|
||||||
//precision mediump float;
|
|
||||||
precision highp float;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform vec2 uTimes;
|
|
||||||
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
vec3 col;
|
|
||||||
float c;
|
|
||||||
vec2 tmpv = texCoord * vec2(0.8, 1.0) - vec2(0.95, 1.0);
|
|
||||||
c = exp(-pow(length(tmpv) * 1.8, 2.0));
|
|
||||||
col = mix(vec3(0.02, 0.0, 0.03), vec3(0.96, 0.98, 1.0) * 1.5, c);
|
|
||||||
gl_FragColor = vec4(col * 0.5, 1.0);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script id="fx_brightbuf_fsh" type="x-shader/x_fragment">
|
|
||||||
#ifdef GL_ES
|
|
||||||
//precision mediump float;
|
|
||||||
precision highp float;
|
|
||||||
#endif
|
|
||||||
uniform sampler2D uSrc;
|
|
||||||
uniform vec2 uDelta;
|
|
||||||
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
vec4 col = texture2D(uSrc, texCoord);
|
|
||||||
gl_FragColor = vec4(col.rgb * 2.0 - vec3(0.5), 1.0);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script id="fx_dirblur_r4_fsh" type="x-shader/x_fragment">
|
|
||||||
#ifdef GL_ES
|
|
||||||
//precision mediump float;
|
|
||||||
precision highp float;
|
|
||||||
#endif
|
|
||||||
uniform sampler2D uSrc;
|
|
||||||
uniform vec2 uDelta;
|
|
||||||
uniform vec4 uBlurDir; //dir(x, y), stride(z, w)
|
|
||||||
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
vec4 col = texture2D(uSrc, texCoord);
|
|
||||||
col = col + texture2D(uSrc, texCoord + uBlurDir.xy * uDelta);
|
|
||||||
col = col + texture2D(uSrc, texCoord - uBlurDir.xy * uDelta);
|
|
||||||
col = col + texture2D(uSrc, texCoord + (uBlurDir.xy + uBlurDir.zw) * uDelta);
|
|
||||||
col = col + texture2D(uSrc, texCoord - (uBlurDir.xy + uBlurDir.zw) * uDelta);
|
|
||||||
gl_FragColor = col / 5.0;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<!-- effect fragment shader template -->
|
|
||||||
<script id="fx_common_fsh" type="x-shader/x_fragment">
|
|
||||||
#ifdef GL_ES
|
|
||||||
//precision mediump float;
|
|
||||||
precision highp float;
|
|
||||||
#endif
|
|
||||||
uniform sampler2D uSrc;
|
|
||||||
uniform vec2 uDelta;
|
|
||||||
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
gl_FragColor = texture2D(uSrc, texCoord);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<!-- post processing -->
|
|
||||||
<script id="pp_final_vsh" type="x-shader/x_vertex">
|
|
||||||
uniform vec3 uResolution;
|
|
||||||
attribute vec2 aPosition;
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
void main(void) {
|
|
||||||
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
||||||
texCoord = aPosition.xy * 0.5 + vec2(0.5, 0.5);
|
|
||||||
screenCoord = aPosition.xy * vec2(uResolution.z, 1.0);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script id="pp_final_fsh" type="x-shader/x_fragment">
|
|
||||||
#ifdef GL_ES
|
|
||||||
//precision mediump float;
|
|
||||||
precision highp float;
|
|
||||||
#endif
|
|
||||||
uniform sampler2D uSrc;
|
|
||||||
uniform sampler2D uBloom;
|
|
||||||
uniform vec2 uDelta;
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
void main(void) {
|
|
||||||
vec4 srccol = texture2D(uSrc, texCoord) * 2.0;
|
|
||||||
vec4 bloomcol = texture2D(uBloom, texCoord);
|
|
||||||
vec4 col;
|
|
||||||
col = srccol + bloomcol * (vec4(1.0) + srccol);
|
|
||||||
col *= smoothstep(1.0, 0.0, pow(length((texCoord - vec2(0.5)) * 2.0), 1.2) * 0.5);
|
|
||||||
col = pow(col, vec4(0.45454545454545)); //(1.0 / 2.2)
|
|
||||||
|
|
||||||
gl_FragColor = vec4(col.rgb, 1.0);
|
|
||||||
gl_FragColor.a = 1.0;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<!--结尾-->
|
|
||||||
<div class="lizi1">
|
|
||||||
<div class="login">
|
|
||||||
<div class="login-center">
|
|
||||||
<div class="login-header text-center">
|
|
||||||
<h3>缥缈</h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form method="post" id="register-form" autocomplete="off" action="#" class="nice-validator n-default" novalidate>
|
|
||||||
|
|
||||||
<div class="form-group has-feedback feedback-left">
|
|
||||||
<input type="text" class="form-control" id="cdk" name="cdk" placeholder="请输入CDKEY" autocomplete="off">
|
|
||||||
</div>
|
|
||||||
<div class="form-group has-feedback feedback-left">
|
|
||||||
<input type="text" class="form-control" id="usr" name="usr" placeholder="请输入要授权的账号" autocomplete="off">
|
|
||||||
</div>
|
|
||||||
<div class="form-group has-feedback feedback-left">
|
|
||||||
<input type="text" class="form-control" onKeyUp="value=value.replace(/[\W]/g,'')" id="sqm" name="sqm" placeholder="请设置后台密码(仅支持数字和英文)" autocomplete="off">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<input class="btn btn-block btn-primary" name='reg' id="1" value="提交" type="button" onclick= "test(this)">
|
|
||||||
</div><br>
|
|
||||||
<div id="divMsg" style="color:#F00" class="validator-tips"></div>
|
|
||||||
</form>
|
|
||||||
<hr>
|
|
||||||
<footer class="col-sm-12 text-center"><p class="m-b-0">源码屋:www.51boshao.com</p>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
function api(){
|
|
||||||
$.ajaxSetup({contentType: "application/x-www-form-urlencoded; charset=utf-8"});
|
|
||||||
$.post("pay.php", {
|
|
||||||
usr:$("#usr").val(),
|
|
||||||
cdk:$("#cdk").val(),
|
|
||||||
sqm:$("#sqm").val()
|
|
||||||
},function(data){
|
|
||||||
$('input[name=reg]').attr('id','1');
|
|
||||||
$('input[name=reg]').attr('value','提交');
|
|
||||||
bootbox.alert({message:data,title:"提示"});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function test(obj){
|
|
||||||
var _status = obj.id;
|
|
||||||
if(_status != '1'){
|
|
||||||
$('input[name=reg]').attr('id','0');
|
|
||||||
$('input[name=reg]').attr('value','正在提交...');
|
|
||||||
return false;
|
|
||||||
}else{
|
|
||||||
$('input[name=reg]').attr('id','0');
|
|
||||||
$('input[name=reg]').attr('value','正在提交...');
|
|
||||||
api();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
document.onkeydown = function(event) {
|
|
||||||
var target, code, tag;
|
|
||||||
if (!event) {
|
|
||||||
event = window.event; //针对ie浏览器
|
|
||||||
target = event.srcElement;
|
|
||||||
code = event.keyCode;
|
|
||||||
if (code == 13) {
|
|
||||||
tag = target.tagName;
|
|
||||||
if (tag == "TEXTAREA") { return true; }
|
|
||||||
else { return false; }
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
target = event.target; //针对遵循w3c标准的浏览器,如Firefox
|
|
||||||
code = event.keyCode;
|
|
||||||
if (code == 13) {
|
|
||||||
tag = target.tagName;
|
|
||||||
if (tag == "INPUT") { return false; }
|
|
||||||
else { return true; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<audio autoplay loop>
|
|
||||||
<source src="mp3/music.mp3">
|
|
||||||
</audio>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
802
ht/pay/js/uti.js
802
ht/pay/js/uti.js
@@ -1,802 +0,0 @@
|
|||||||
// Utilities
|
|
||||||
var Vector3 = {};
|
|
||||||
var Matrix44 = {};
|
|
||||||
Vector3.create = function(x, y, z) {
|
|
||||||
return {'x':x, 'y':y, 'z':z};
|
|
||||||
};
|
|
||||||
Vector3.dot = function (v0, v1) {
|
|
||||||
return v0.x * v1.x + v0.y * v1.y + v0.z * v1.z;
|
|
||||||
};
|
|
||||||
Vector3.cross = function (v, v0, v1) {
|
|
||||||
v.x = v0.y * v1.z - v0.z * v1.y;
|
|
||||||
v.y = v0.z * v1.x - v0.x * v1.z;
|
|
||||||
v.z = v0.x * v1.y - v0.y * v1.x;
|
|
||||||
};
|
|
||||||
Vector3.normalize = function (v) {
|
|
||||||
var l = v.x * v.x + v.y * v.y + v.z * v.z;
|
|
||||||
if(l > 0.00001) {
|
|
||||||
l = 1.0 / Math.sqrt(l);
|
|
||||||
v.x *= l;
|
|
||||||
v.y *= l;
|
|
||||||
v.z *= l;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Vector3.arrayForm = function(v) {
|
|
||||||
if(v.array) {
|
|
||||||
v.array[0] = v.x;
|
|
||||||
v.array[1] = v.y;
|
|
||||||
v.array[2] = v.z;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
v.array = new Float32Array([v.x, v.y, v.z]);
|
|
||||||
}
|
|
||||||
return v.array;
|
|
||||||
};
|
|
||||||
Matrix44.createIdentity = function () {
|
|
||||||
return new Float32Array([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]);
|
|
||||||
};
|
|
||||||
Matrix44.loadProjection = function (m, aspect, vdeg, near, far) {
|
|
||||||
var h = near * Math.tan(vdeg * Math.PI / 180.0 * 0.5) * 2.0;
|
|
||||||
var w = h * aspect;
|
|
||||||
|
|
||||||
m[0] = 2.0 * near / w;
|
|
||||||
m[1] = 0.0;
|
|
||||||
m[2] = 0.0;
|
|
||||||
m[3] = 0.0;
|
|
||||||
|
|
||||||
m[4] = 0.0;
|
|
||||||
m[5] = 2.0 * near / h;
|
|
||||||
m[6] = 0.0;
|
|
||||||
m[7] = 0.0;
|
|
||||||
|
|
||||||
m[8] = 0.0;
|
|
||||||
m[9] = 0.0;
|
|
||||||
m[10] = -(far + near) / (far - near);
|
|
||||||
m[11] = -1.0;
|
|
||||||
|
|
||||||
m[12] = 0.0;
|
|
||||||
m[13] = 0.0;
|
|
||||||
m[14] = -2.0 * far * near / (far - near);
|
|
||||||
m[15] = 0.0;
|
|
||||||
};
|
|
||||||
Matrix44.loadLookAt = function (m, vpos, vlook, vup) {
|
|
||||||
var frontv = Vector3.create(vpos.x - vlook.x, vpos.y - vlook.y, vpos.z - vlook.z);
|
|
||||||
Vector3.normalize(frontv);
|
|
||||||
var sidev = Vector3.create(1.0, 0.0, 0.0);
|
|
||||||
Vector3.cross(sidev, vup, frontv);
|
|
||||||
Vector3.normalize(sidev);
|
|
||||||
var topv = Vector3.create(1.0, 0.0, 0.0);
|
|
||||||
Vector3.cross(topv, frontv, sidev);
|
|
||||||
Vector3.normalize(topv);
|
|
||||||
|
|
||||||
m[0] = sidev.x;
|
|
||||||
m[1] = topv.x;
|
|
||||||
m[2] = frontv.x;
|
|
||||||
m[3] = 0.0;
|
|
||||||
|
|
||||||
m[4] = sidev.y;
|
|
||||||
m[5] = topv.y;
|
|
||||||
m[6] = frontv.y;
|
|
||||||
m[7] = 0.0;
|
|
||||||
|
|
||||||
m[8] = sidev.z;
|
|
||||||
m[9] = topv.z;
|
|
||||||
m[10] = frontv.z;
|
|
||||||
m[11] = 0.0;
|
|
||||||
|
|
||||||
m[12] = -(vpos.x * m[0] + vpos.y * m[4] + vpos.z * m[8]);
|
|
||||||
m[13] = -(vpos.x * m[1] + vpos.y * m[5] + vpos.z * m[9]);
|
|
||||||
m[14] = -(vpos.x * m[2] + vpos.y * m[6] + vpos.z * m[10]);
|
|
||||||
m[15] = 1.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
var timeInfo = {
|
|
||||||
'start':0, 'prev':0, // Date
|
|
||||||
'delta':0, 'elapsed':0 // Number(sec)
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
var gl;
|
|
||||||
var renderSpec = {
|
|
||||||
'width':0,
|
|
||||||
'height':0,
|
|
||||||
'aspect':1,
|
|
||||||
'array':new Float32Array(3),
|
|
||||||
'halfWidth':0,
|
|
||||||
'halfHeight':0,
|
|
||||||
'halfArray':new Float32Array(3)
|
|
||||||
// and some render targets. see setViewport()
|
|
||||||
};
|
|
||||||
renderSpec.setSize = function(w, h) {
|
|
||||||
renderSpec.width = w;
|
|
||||||
renderSpec.height = h;
|
|
||||||
renderSpec.aspect = renderSpec.width / renderSpec.height;
|
|
||||||
renderSpec.array[0] = renderSpec.width;
|
|
||||||
renderSpec.array[1] = renderSpec.height;
|
|
||||||
renderSpec.array[2] = renderSpec.aspect;
|
|
||||||
|
|
||||||
renderSpec.halfWidth = Math.floor(w / 2);
|
|
||||||
renderSpec.halfHeight = Math.floor(h / 2);
|
|
||||||
renderSpec.halfArray[0] = renderSpec.halfWidth;
|
|
||||||
renderSpec.halfArray[1] = renderSpec.halfHeight;
|
|
||||||
renderSpec.halfArray[2] = renderSpec.halfWidth / renderSpec.halfHeight;
|
|
||||||
};
|
|
||||||
|
|
||||||
function deleteRenderTarget(rt) {
|
|
||||||
gl.deleteFramebuffer(rt.frameBuffer);
|
|
||||||
gl.deleteRenderbuffer(rt.renderBuffer);
|
|
||||||
gl.deleteTexture(rt.texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createRenderTarget(w, h) {
|
|
||||||
var ret = {
|
|
||||||
'width':w,
|
|
||||||
'height':h,
|
|
||||||
'sizeArray':new Float32Array([w, h, w / h]),
|
|
||||||
'dtxArray':new Float32Array([1.0 / w, 1.0 / h])
|
|
||||||
};
|
|
||||||
ret.frameBuffer = gl.createFramebuffer();
|
|
||||||
ret.renderBuffer = gl.createRenderbuffer();
|
|
||||||
ret.texture = gl.createTexture();
|
|
||||||
|
|
||||||
gl.bindTexture(gl.TEXTURE_2D, ret.texture);
|
|
||||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, w, h, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
||||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
||||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
||||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
||||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
||||||
|
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, ret.frameBuffer);
|
|
||||||
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, ret.texture, 0);
|
|
||||||
|
|
||||||
gl.bindRenderbuffer(gl.RENDERBUFFER, ret.renderBuffer);
|
|
||||||
gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, w, h);
|
|
||||||
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, ret.renderBuffer);
|
|
||||||
|
|
||||||
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
||||||
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
function compileShader(shtype, shsrc) {
|
|
||||||
var retsh = gl.createShader(shtype);
|
|
||||||
|
|
||||||
gl.shaderSource(retsh, shsrc);
|
|
||||||
gl.compileShader(retsh);
|
|
||||||
|
|
||||||
if(!gl.getShaderParameter(retsh, gl.COMPILE_STATUS)) {
|
|
||||||
var errlog = gl.getShaderInfoLog(retsh);
|
|
||||||
gl.deleteShader(retsh);
|
|
||||||
console.error(errlog);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return retsh;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createShader(vtxsrc, frgsrc, uniformlist, attrlist) {
|
|
||||||
var vsh = compileShader(gl.VERTEX_SHADER, vtxsrc);
|
|
||||||
var fsh = compileShader(gl.FRAGMENT_SHADER, frgsrc);
|
|
||||||
|
|
||||||
if(vsh == null || fsh == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var prog = gl.createProgram();
|
|
||||||
gl.attachShader(prog, vsh);
|
|
||||||
gl.attachShader(prog, fsh);
|
|
||||||
|
|
||||||
gl.deleteShader(vsh);
|
|
||||||
gl.deleteShader(fsh);
|
|
||||||
|
|
||||||
gl.linkProgram(prog);
|
|
||||||
if (!gl.getProgramParameter(prog, gl.LINK_STATUS)) {
|
|
||||||
var errlog = gl.getProgramInfoLog(prog);
|
|
||||||
console.error(errlog);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(uniformlist) {
|
|
||||||
prog.uniforms = {};
|
|
||||||
for(var i = 0; i < uniformlist.length; i++) {
|
|
||||||
prog.uniforms[uniformlist[i]] = gl.getUniformLocation(prog, uniformlist[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(attrlist) {
|
|
||||||
prog.attributes = {};
|
|
||||||
for(var i = 0; i < attrlist.length; i++) {
|
|
||||||
var attr = attrlist[i];
|
|
||||||
prog.attributes[attr] = gl.getAttribLocation(prog, attr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return prog;
|
|
||||||
}
|
|
||||||
|
|
||||||
function useShader(prog) {
|
|
||||||
gl.useProgram(prog);
|
|
||||||
for(var attr in prog.attributes) {
|
|
||||||
gl.enableVertexAttribArray(prog.attributes[attr]);;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function unuseShader(prog) {
|
|
||||||
for(var attr in prog.attributes) {
|
|
||||||
gl.disableVertexAttribArray(prog.attributes[attr]);;
|
|
||||||
}
|
|
||||||
gl.useProgram(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/////
|
|
||||||
var projection = {
|
|
||||||
'angle':60,
|
|
||||||
'nearfar':new Float32Array([0.1, 100.0]),
|
|
||||||
'matrix':Matrix44.createIdentity()
|
|
||||||
};
|
|
||||||
var camera = {
|
|
||||||
'position':Vector3.create(0, 0, 100),
|
|
||||||
'lookat':Vector3.create(0, 0, 0),
|
|
||||||
'up':Vector3.create(0, 1, 0),
|
|
||||||
'dof':Vector3.create(10.0, 4.0, 8.0),
|
|
||||||
'matrix':Matrix44.createIdentity()
|
|
||||||
};
|
|
||||||
|
|
||||||
var pointFlower = {};
|
|
||||||
var meshFlower = {};
|
|
||||||
var sceneStandBy = false;
|
|
||||||
|
|
||||||
var BlossomParticle = function () {
|
|
||||||
this.velocity = new Array(3);
|
|
||||||
this.rotation = new Array(3);
|
|
||||||
this.position = new Array(3);
|
|
||||||
this.euler = new Array(3);
|
|
||||||
this.size = 1.0;
|
|
||||||
this.alpha = 1.0;
|
|
||||||
this.zkey = 0.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
BlossomParticle.prototype.setVelocity = function (vx, vy, vz) {
|
|
||||||
this.velocity[0] = vx;
|
|
||||||
this.velocity[1] = vy;
|
|
||||||
this.velocity[2] = vz;
|
|
||||||
};
|
|
||||||
|
|
||||||
BlossomParticle.prototype.setRotation = function (rx, ry, rz) {
|
|
||||||
this.rotation[0] = rx;
|
|
||||||
this.rotation[1] = ry;
|
|
||||||
this.rotation[2] = rz;
|
|
||||||
};
|
|
||||||
|
|
||||||
BlossomParticle.prototype.setPosition = function (nx, ny, nz) {
|
|
||||||
this.position[0] = nx;
|
|
||||||
this.position[1] = ny;
|
|
||||||
this.position[2] = nz;
|
|
||||||
};
|
|
||||||
|
|
||||||
BlossomParticle.prototype.setEulerAngles = function (rx, ry, rz) {
|
|
||||||
this.euler[0] = rx;
|
|
||||||
this.euler[1] = ry;
|
|
||||||
this.euler[2] = rz;
|
|
||||||
};
|
|
||||||
|
|
||||||
BlossomParticle.prototype.setSize = function (s) {
|
|
||||||
this.size = s;
|
|
||||||
};
|
|
||||||
|
|
||||||
BlossomParticle.prototype.update = function (dt, et) {
|
|
||||||
this.position[0] += this.velocity[0] * dt;
|
|
||||||
this.position[1] += this.velocity[1] * dt;
|
|
||||||
this.position[2] += this.velocity[2] * dt;
|
|
||||||
|
|
||||||
this.euler[0] += this.rotation[0] * dt;
|
|
||||||
this.euler[1] += this.rotation[1] * dt;
|
|
||||||
this.euler[2] += this.rotation[2] * dt;
|
|
||||||
};
|
|
||||||
|
|
||||||
function createPointFlowers() {
|
|
||||||
// get point sizes
|
|
||||||
var prm = gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE);
|
|
||||||
renderSpec.pointSize = {'min':prm[0], 'max':prm[1]};
|
|
||||||
|
|
||||||
var vtxsrc = document.getElementById("sakura_point_vsh").textContent;
|
|
||||||
var frgsrc = document.getElementById("sakura_point_fsh").textContent;
|
|
||||||
|
|
||||||
pointFlower.program = createShader(
|
|
||||||
vtxsrc, frgsrc,
|
|
||||||
['uProjection', 'uModelview', 'uResolution', 'uOffset', 'uDOF', 'uFade'],
|
|
||||||
['aPosition', 'aEuler', 'aMisc']
|
|
||||||
);
|
|
||||||
|
|
||||||
useShader(pointFlower.program);
|
|
||||||
pointFlower.offset = new Float32Array([0.0, 0.0, 0.0]);
|
|
||||||
pointFlower.fader = Vector3.create(0.0, 10.0, 0.0);
|
|
||||||
|
|
||||||
// paramerters: velocity[3], rotate[3]
|
|
||||||
pointFlower.numFlowers = 1600;
|
|
||||||
pointFlower.particles = new Array(pointFlower.numFlowers);
|
|
||||||
// vertex attributes {position[3], euler_xyz[3], size[1]}
|
|
||||||
pointFlower.dataArray = new Float32Array(pointFlower.numFlowers * (3 + 3 + 2));
|
|
||||||
pointFlower.positionArrayOffset = 0;
|
|
||||||
pointFlower.eulerArrayOffset = pointFlower.numFlowers * 3;
|
|
||||||
pointFlower.miscArrayOffset = pointFlower.numFlowers * 6;
|
|
||||||
|
|
||||||
pointFlower.buffer = gl.createBuffer();
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, pointFlower.buffer);
|
|
||||||
gl.bufferData(gl.ARRAY_BUFFER, pointFlower.dataArray, gl.DYNAMIC_DRAW);
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
||||||
|
|
||||||
unuseShader(pointFlower.program);
|
|
||||||
|
|
||||||
for(var i = 0; i < pointFlower.numFlowers; i++) {
|
|
||||||
pointFlower.particles[i] = new BlossomParticle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function initPointFlowers() {
|
|
||||||
//area
|
|
||||||
pointFlower.area = Vector3.create(20.0, 20.0, 20.0);
|
|
||||||
pointFlower.area.x = pointFlower.area.y * renderSpec.aspect;
|
|
||||||
|
|
||||||
pointFlower.fader.x = 10.0; //env fade start
|
|
||||||
pointFlower.fader.y = pointFlower.area.z; //env fade half
|
|
||||||
pointFlower.fader.z = 0.1; //near fade start
|
|
||||||
|
|
||||||
//particles
|
|
||||||
var PI2 = Math.PI * 2.0;
|
|
||||||
var tmpv3 = Vector3.create(0, 0, 0);
|
|
||||||
var tmpv = 0;
|
|
||||||
var symmetryrand = function() {return (Math.random() * 2.0 - 1.0);};
|
|
||||||
for(var i = 0; i < pointFlower.numFlowers; i++) {
|
|
||||||
var tmpprtcl = pointFlower.particles[i];
|
|
||||||
|
|
||||||
//velocity
|
|
||||||
tmpv3.x = symmetryrand() * 0.3 + 0.8;
|
|
||||||
tmpv3.y = symmetryrand() * 0.2 - 1.0;
|
|
||||||
tmpv3.z = symmetryrand() * 0.3 + 0.5;
|
|
||||||
Vector3.normalize(tmpv3);
|
|
||||||
tmpv = 2.0 + Math.random() * 1.0;
|
|
||||||
tmpprtcl.setVelocity(tmpv3.x * tmpv, tmpv3.y * tmpv, tmpv3.z * tmpv);
|
|
||||||
|
|
||||||
//rotation
|
|
||||||
tmpprtcl.setRotation(
|
|
||||||
symmetryrand() * PI2 * 0.5,
|
|
||||||
symmetryrand() * PI2 * 0.5,
|
|
||||||
symmetryrand() * PI2 * 0.5
|
|
||||||
);
|
|
||||||
|
|
||||||
//position
|
|
||||||
tmpprtcl.setPosition(
|
|
||||||
symmetryrand() * pointFlower.area.x,
|
|
||||||
symmetryrand() * pointFlower.area.y,
|
|
||||||
symmetryrand() * pointFlower.area.z
|
|
||||||
);
|
|
||||||
|
|
||||||
//euler
|
|
||||||
tmpprtcl.setEulerAngles(
|
|
||||||
Math.random() * Math.PI * 2.0,
|
|
||||||
Math.random() * Math.PI * 2.0,
|
|
||||||
Math.random() * Math.PI * 2.0
|
|
||||||
);
|
|
||||||
|
|
||||||
//size
|
|
||||||
tmpprtcl.setSize(0.9 + Math.random() * 0.1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderPointFlowers() {
|
|
||||||
//update
|
|
||||||
var PI2 = Math.PI * 2.0;
|
|
||||||
var limit = [pointFlower.area.x, pointFlower.area.y, pointFlower.area.z];
|
|
||||||
var repeatPos = function (prt, cmp, limit) {
|
|
||||||
if(Math.abs(prt.position[cmp]) - prt.size * 0.5 > limit) {
|
|
||||||
//out of area
|
|
||||||
if(prt.position[cmp] > 0) {
|
|
||||||
prt.position[cmp] -= limit * 2.0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
prt.position[cmp] += limit * 2.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var repeatEuler = function (prt, cmp) {
|
|
||||||
prt.euler[cmp] = prt.euler[cmp] % PI2;
|
|
||||||
if(prt.euler[cmp] < 0.0) {
|
|
||||||
prt.euler[cmp] += PI2;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
for(var i = 0; i < pointFlower.numFlowers; i++) {
|
|
||||||
var prtcl = pointFlower.particles[i];
|
|
||||||
prtcl.update(timeInfo.delta, timeInfo.elapsed);
|
|
||||||
repeatPos(prtcl, 0, pointFlower.area.x);
|
|
||||||
repeatPos(prtcl, 1, pointFlower.area.y);
|
|
||||||
repeatPos(prtcl, 2, pointFlower.area.z);
|
|
||||||
repeatEuler(prtcl, 0);
|
|
||||||
repeatEuler(prtcl, 1);
|
|
||||||
repeatEuler(prtcl, 2);
|
|
||||||
|
|
||||||
prtcl.alpha = 1.0;//(pointFlower.area.z - prtcl.position[2]) * 0.5;
|
|
||||||
|
|
||||||
prtcl.zkey = (camera.matrix[2] * prtcl.position[0]
|
|
||||||
+ camera.matrix[6] * prtcl.position[1]
|
|
||||||
+ camera.matrix[10] * prtcl.position[2]
|
|
||||||
+ camera.matrix[14]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// sort
|
|
||||||
pointFlower.particles.sort(function(p0, p1){return p0.zkey - p1.zkey;});
|
|
||||||
|
|
||||||
// update data
|
|
||||||
var ipos = pointFlower.positionArrayOffset;
|
|
||||||
var ieuler = pointFlower.eulerArrayOffset;
|
|
||||||
var imisc = pointFlower.miscArrayOffset;
|
|
||||||
for(var i = 0; i < pointFlower.numFlowers; i++) {
|
|
||||||
var prtcl = pointFlower.particles[i];
|
|
||||||
pointFlower.dataArray[ipos] = prtcl.position[0];
|
|
||||||
pointFlower.dataArray[ipos + 1] = prtcl.position[1];
|
|
||||||
pointFlower.dataArray[ipos + 2] = prtcl.position[2];
|
|
||||||
ipos += 3;
|
|
||||||
pointFlower.dataArray[ieuler] = prtcl.euler[0];
|
|
||||||
pointFlower.dataArray[ieuler + 1] = prtcl.euler[1];
|
|
||||||
pointFlower.dataArray[ieuler + 2] = prtcl.euler[2];
|
|
||||||
ieuler += 3;
|
|
||||||
pointFlower.dataArray[imisc] = prtcl.size;
|
|
||||||
pointFlower.dataArray[imisc + 1] = prtcl.alpha;
|
|
||||||
imisc += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
//draw
|
|
||||||
gl.enable(gl.BLEND);
|
|
||||||
//gl.disable(gl.DEPTH_TEST);
|
|
||||||
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
var prog = pointFlower.program;
|
|
||||||
useShader(prog);
|
|
||||||
|
|
||||||
gl.uniformMatrix4fv(prog.uniforms.uProjection, false, projection.matrix);
|
|
||||||
gl.uniformMatrix4fv(prog.uniforms.uModelview, false, camera.matrix);
|
|
||||||
gl.uniform3fv(prog.uniforms.uResolution, renderSpec.array);
|
|
||||||
gl.uniform3fv(prog.uniforms.uDOF, Vector3.arrayForm(camera.dof));
|
|
||||||
gl.uniform3fv(prog.uniforms.uFade, Vector3.arrayForm(pointFlower.fader));
|
|
||||||
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, pointFlower.buffer);
|
|
||||||
gl.bufferData(gl.ARRAY_BUFFER, pointFlower.dataArray, gl.DYNAMIC_DRAW);
|
|
||||||
|
|
||||||
gl.vertexAttribPointer(prog.attributes.aPosition, 3, gl.FLOAT, false, 0, pointFlower.positionArrayOffset * Float32Array.BYTES_PER_ELEMENT);
|
|
||||||
gl.vertexAttribPointer(prog.attributes.aEuler, 3, gl.FLOAT, false, 0, pointFlower.eulerArrayOffset * Float32Array.BYTES_PER_ELEMENT);
|
|
||||||
gl.vertexAttribPointer(prog.attributes.aMisc, 2, gl.FLOAT, false, 0, pointFlower.miscArrayOffset * Float32Array.BYTES_PER_ELEMENT);
|
|
||||||
|
|
||||||
// doubler
|
|
||||||
for(var i = 1; i < 2; i++) {
|
|
||||||
var zpos = i * -2.0;
|
|
||||||
pointFlower.offset[0] = pointFlower.area.x * -1.0;
|
|
||||||
pointFlower.offset[1] = pointFlower.area.y * -1.0;
|
|
||||||
pointFlower.offset[2] = pointFlower.area.z * zpos;
|
|
||||||
gl.uniform3fv(prog.uniforms.uOffset, pointFlower.offset);
|
|
||||||
gl.drawArrays(gl.POINT, 0, pointFlower.numFlowers);
|
|
||||||
|
|
||||||
pointFlower.offset[0] = pointFlower.area.x * -1.0;
|
|
||||||
pointFlower.offset[1] = pointFlower.area.y * 1.0;
|
|
||||||
pointFlower.offset[2] = pointFlower.area.z * zpos;
|
|
||||||
gl.uniform3fv(prog.uniforms.uOffset, pointFlower.offset);
|
|
||||||
gl.drawArrays(gl.POINT, 0, pointFlower.numFlowers);
|
|
||||||
|
|
||||||
pointFlower.offset[0] = pointFlower.area.x * 1.0;
|
|
||||||
pointFlower.offset[1] = pointFlower.area.y * -1.0;
|
|
||||||
pointFlower.offset[2] = pointFlower.area.z * zpos;
|
|
||||||
gl.uniform3fv(prog.uniforms.uOffset, pointFlower.offset);
|
|
||||||
gl.drawArrays(gl.POINT, 0, pointFlower.numFlowers);
|
|
||||||
|
|
||||||
pointFlower.offset[0] = pointFlower.area.x * 1.0;
|
|
||||||
pointFlower.offset[1] = pointFlower.area.y * 1.0;
|
|
||||||
pointFlower.offset[2] = pointFlower.area.z * zpos;
|
|
||||||
gl.uniform3fv(prog.uniforms.uOffset, pointFlower.offset);
|
|
||||||
gl.drawArrays(gl.POINT, 0, pointFlower.numFlowers);
|
|
||||||
}
|
|
||||||
|
|
||||||
//main
|
|
||||||
pointFlower.offset[0] = 0.0;
|
|
||||||
pointFlower.offset[1] = 0.0;
|
|
||||||
pointFlower.offset[2] = 0.0;
|
|
||||||
gl.uniform3fv(prog.uniforms.uOffset, pointFlower.offset);
|
|
||||||
gl.drawArrays(gl.POINT, 0, pointFlower.numFlowers);
|
|
||||||
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
||||||
unuseShader(prog);
|
|
||||||
|
|
||||||
gl.enable(gl.DEPTH_TEST);
|
|
||||||
gl.disable(gl.BLEND);
|
|
||||||
}
|
|
||||||
|
|
||||||
// effects
|
|
||||||
//common util
|
|
||||||
function createEffectProgram(vtxsrc, frgsrc, exunifs, exattrs) {
|
|
||||||
var ret = {};
|
|
||||||
var unifs = ['uResolution', 'uSrc', 'uDelta'];
|
|
||||||
if(exunifs) {
|
|
||||||
unifs = unifs.concat(exunifs);
|
|
||||||
}
|
|
||||||
var attrs = ['aPosition'];
|
|
||||||
if(exattrs) {
|
|
||||||
attrs = attrs.concat(exattrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret.program = createShader(vtxsrc, frgsrc, unifs, attrs);
|
|
||||||
useShader(ret.program);
|
|
||||||
|
|
||||||
ret.dataArray = new Float32Array([
|
|
||||||
-1.0, -1.0,
|
|
||||||
1.0, -1.0,
|
|
||||||
-1.0, 1.0,
|
|
||||||
1.0, 1.0
|
|
||||||
]);
|
|
||||||
ret.buffer = gl.createBuffer();
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, ret.buffer);
|
|
||||||
gl.bufferData(gl.ARRAY_BUFFER, ret.dataArray, gl.STATIC_DRAW);
|
|
||||||
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
||||||
unuseShader(ret.program);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// basic usage
|
|
||||||
// useEffect(prog, srctex({'texture':texid, 'dtxArray':(f32)[dtx, dty]})); //basic initialize
|
|
||||||
// gl.uniform**(...); //additional uniforms
|
|
||||||
// drawEffect()
|
|
||||||
// unuseEffect(prog)
|
|
||||||
// TEXTURE0 makes src
|
|
||||||
function useEffect(fxobj, srctex) {
|
|
||||||
var prog = fxobj.program;
|
|
||||||
useShader(prog);
|
|
||||||
gl.uniform3fv(prog.uniforms.uResolution, renderSpec.array);
|
|
||||||
|
|
||||||
if(srctex != null) {
|
|
||||||
gl.uniform2fv(prog.uniforms.uDelta, srctex.dtxArray);
|
|
||||||
gl.uniform1i(prog.uniforms.uSrc, 0);
|
|
||||||
|
|
||||||
gl.activeTexture(gl.TEXTURE0);
|
|
||||||
gl.bindTexture(gl.TEXTURE_2D, srctex.texture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function drawEffect(fxobj) {
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, fxobj.buffer);
|
|
||||||
gl.vertexAttribPointer(fxobj.program.attributes.aPosition, 2, gl.FLOAT, false, 0, 0);
|
|
||||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
||||||
}
|
|
||||||
function unuseEffect(fxobj) {
|
|
||||||
unuseShader(fxobj.program);
|
|
||||||
}
|
|
||||||
|
|
||||||
var effectLib = {};
|
|
||||||
function createEffectLib() {
|
|
||||||
|
|
||||||
var vtxsrc, frgsrc;
|
|
||||||
//common
|
|
||||||
var cmnvtxsrc = document.getElementById("fx_common_vsh").textContent;
|
|
||||||
|
|
||||||
//background
|
|
||||||
frgsrc = document.getElementById("bg_fsh").textContent;
|
|
||||||
effectLib.sceneBg = createEffectProgram(cmnvtxsrc, frgsrc, ['uTimes'], null);
|
|
||||||
|
|
||||||
// make brightpixels buffer
|
|
||||||
frgsrc = document.getElementById("fx_brightbuf_fsh").textContent;
|
|
||||||
effectLib.mkBrightBuf = createEffectProgram(cmnvtxsrc, frgsrc, null, null);
|
|
||||||
|
|
||||||
// direction blur
|
|
||||||
frgsrc = document.getElementById("fx_dirblur_r4_fsh").textContent;
|
|
||||||
effectLib.dirBlur = createEffectProgram(cmnvtxsrc, frgsrc, ['uBlurDir'], null);
|
|
||||||
|
|
||||||
//final composite
|
|
||||||
vtxsrc = document.getElementById("pp_final_vsh").textContent;
|
|
||||||
frgsrc = document.getElementById("pp_final_fsh").textContent;
|
|
||||||
effectLib.finalComp = createEffectProgram(vtxsrc, frgsrc, ['uBloom'], null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// background
|
|
||||||
function createBackground() {
|
|
||||||
//console.log("create background");
|
|
||||||
}
|
|
||||||
function initBackground() {
|
|
||||||
//console.log("init background");
|
|
||||||
}
|
|
||||||
function renderBackground() {
|
|
||||||
gl.disable(gl.DEPTH_TEST);
|
|
||||||
|
|
||||||
useEffect(effectLib.sceneBg, null);
|
|
||||||
gl.uniform2f(effectLib.sceneBg.program.uniforms.uTimes, timeInfo.elapsed, timeInfo.delta);
|
|
||||||
drawEffect(effectLib.sceneBg);
|
|
||||||
unuseEffect(effectLib.sceneBg);
|
|
||||||
|
|
||||||
gl.enable(gl.DEPTH_TEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
// post process
|
|
||||||
var postProcess = {};
|
|
||||||
function createPostProcess() {
|
|
||||||
//console.log("create post process");
|
|
||||||
}
|
|
||||||
function initPostProcess() {
|
|
||||||
//console.log("init post process");
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderPostProcess() {
|
|
||||||
gl.enable(gl.TEXTURE_2D);
|
|
||||||
gl.disable(gl.DEPTH_TEST);
|
|
||||||
var bindRT = function (rt, isclear) {
|
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, rt.frameBuffer);
|
|
||||||
gl.viewport(0, 0, rt.width, rt.height);
|
|
||||||
if(isclear) {
|
|
||||||
gl.clearColor(0, 0, 0, 0);
|
|
||||||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//make bright buff
|
|
||||||
bindRT(renderSpec.wHalfRT0, true);
|
|
||||||
useEffect(effectLib.mkBrightBuf, renderSpec.mainRT);
|
|
||||||
drawEffect(effectLib.mkBrightBuf);
|
|
||||||
unuseEffect(effectLib.mkBrightBuf);
|
|
||||||
|
|
||||||
// make bloom
|
|
||||||
for(var i = 0; i < 2; i++) {
|
|
||||||
var p = 1.5 + 1 * i;
|
|
||||||
var s = 2.0 + 1 * i;
|
|
||||||
bindRT(renderSpec.wHalfRT1, true);
|
|
||||||
useEffect(effectLib.dirBlur, renderSpec.wHalfRT0);
|
|
||||||
gl.uniform4f(effectLib.dirBlur.program.uniforms.uBlurDir, p, 0.0, s, 0.0);
|
|
||||||
drawEffect(effectLib.dirBlur);
|
|
||||||
unuseEffect(effectLib.dirBlur);
|
|
||||||
|
|
||||||
bindRT(renderSpec.wHalfRT0, true);
|
|
||||||
useEffect(effectLib.dirBlur, renderSpec.wHalfRT1);
|
|
||||||
gl.uniform4f(effectLib.dirBlur.program.uniforms.uBlurDir, 0.0, p, 0.0, s);
|
|
||||||
drawEffect(effectLib.dirBlur);
|
|
||||||
unuseEffect(effectLib.dirBlur);
|
|
||||||
}
|
|
||||||
|
|
||||||
//display
|
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
||||||
gl.viewport(0, 0, renderSpec.width, renderSpec.height);
|
|
||||||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
||||||
|
|
||||||
useEffect(effectLib.finalComp, renderSpec.mainRT);
|
|
||||||
gl.uniform1i(effectLib.finalComp.program.uniforms.uBloom, 1);
|
|
||||||
gl.activeTexture(gl.TEXTURE1);
|
|
||||||
gl.bindTexture(gl.TEXTURE_2D, renderSpec.wHalfRT0.texture);
|
|
||||||
drawEffect(effectLib.finalComp);
|
|
||||||
unuseEffect(effectLib.finalComp);
|
|
||||||
|
|
||||||
gl.enable(gl.DEPTH_TEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
/////
|
|
||||||
var SceneEnv = {};
|
|
||||||
function createScene() {
|
|
||||||
createEffectLib();
|
|
||||||
createBackground();
|
|
||||||
createPointFlowers();
|
|
||||||
createPostProcess();
|
|
||||||
sceneStandBy = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function initScene() {
|
|
||||||
initBackground();
|
|
||||||
initPointFlowers();
|
|
||||||
initPostProcess();
|
|
||||||
|
|
||||||
//camera.position.z = 17.320508;
|
|
||||||
camera.position.z = pointFlower.area.z + projection.nearfar[0];
|
|
||||||
projection.angle = Math.atan2(pointFlower.area.y, camera.position.z + pointFlower.area.z) * 180.0 / Math.PI * 2.0;
|
|
||||||
Matrix44.loadProjection(projection.matrix, renderSpec.aspect, projection.angle, projection.nearfar[0], projection.nearfar[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderScene() {
|
|
||||||
//draw
|
|
||||||
Matrix44.loadLookAt(camera.matrix, camera.position, camera.lookat, camera.up);
|
|
||||||
|
|
||||||
gl.enable(gl.DEPTH_TEST);
|
|
||||||
|
|
||||||
//gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, renderSpec.mainRT.frameBuffer);
|
|
||||||
gl.viewport(0, 0, renderSpec.mainRT.width, renderSpec.mainRT.height);
|
|
||||||
gl.clearColor(0.005, 0, 0.05, 0);
|
|
||||||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
||||||
|
|
||||||
renderBackground();
|
|
||||||
renderPointFlowers();
|
|
||||||
renderPostProcess();
|
|
||||||
}
|
|
||||||
|
|
||||||
/////
|
|
||||||
function onResize(e) {
|
|
||||||
makeCanvasFullScreen(document.getElementById("sakura"));
|
|
||||||
setViewports();
|
|
||||||
if(sceneStandBy) {
|
|
||||||
initScene();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setViewports() {
|
|
||||||
renderSpec.setSize(gl.canvas.width, gl.canvas.height);
|
|
||||||
|
|
||||||
gl.clearColor(0.2, 0.2, 0.5, 1.0);
|
|
||||||
gl.viewport(0, 0, renderSpec.width, renderSpec.height);
|
|
||||||
|
|
||||||
var rtfunc = function (rtname, rtw, rth) {
|
|
||||||
var rt = renderSpec[rtname];
|
|
||||||
if(rt) deleteRenderTarget(rt);
|
|
||||||
renderSpec[rtname] = createRenderTarget(rtw, rth);
|
|
||||||
};
|
|
||||||
rtfunc('mainRT', renderSpec.width, renderSpec.height);
|
|
||||||
rtfunc('wFullRT0', renderSpec.width, renderSpec.height);
|
|
||||||
rtfunc('wFullRT1', renderSpec.width, renderSpec.height);
|
|
||||||
rtfunc('wHalfRT0', renderSpec.halfWidth, renderSpec.halfHeight);
|
|
||||||
rtfunc('wHalfRT1', renderSpec.halfWidth, renderSpec.halfHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
function render() {
|
|
||||||
renderScene();
|
|
||||||
}
|
|
||||||
|
|
||||||
var animating = true;
|
|
||||||
function toggleAnimation(elm) {
|
|
||||||
animating ^= true;
|
|
||||||
if(animating) animate();
|
|
||||||
if(elm) {
|
|
||||||
elm.innerHTML = animating? "Stop":"Start";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function stepAnimation() {
|
|
||||||
if(!animating) animate();
|
|
||||||
}
|
|
||||||
|
|
||||||
function animate() {
|
|
||||||
var curdate = new Date();
|
|
||||||
timeInfo.elapsed = (curdate - timeInfo.start) / 1000.0;
|
|
||||||
timeInfo.delta = (curdate - timeInfo.prev) / 1000.0;
|
|
||||||
timeInfo.prev = curdate;
|
|
||||||
|
|
||||||
if(animating) requestAnimationFrame(animate);
|
|
||||||
render();
|
|
||||||
}
|
|
||||||
|
|
||||||
function makeCanvasFullScreen(canvas) {
|
|
||||||
var b = document.body;
|
|
||||||
var d = document.documentElement;
|
|
||||||
fullw = Math.max(b.clientWidth , b.scrollWidth, d.scrollWidth, d.clientWidth);
|
|
||||||
fullh = Math.max(b.clientHeight , b.scrollHeight, d.scrollHeight, d.clientHeight);
|
|
||||||
canvas.width = fullw;
|
|
||||||
canvas.height = fullh;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('load', function(e) {
|
|
||||||
var canvas = document.getElementById("sakura");
|
|
||||||
try {
|
|
||||||
makeCanvasFullScreen(canvas);
|
|
||||||
gl = canvas.getContext('experimental-webgl');
|
|
||||||
} catch(e) {
|
|
||||||
alert("WebGL not supported." + e);
|
|
||||||
console.error(e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('resize', onResize);
|
|
||||||
|
|
||||||
setViewports();
|
|
||||||
createScene();
|
|
||||||
initScene();
|
|
||||||
|
|
||||||
timeInfo.start = new Date();
|
|
||||||
timeInfo.prev = timeInfo.start;
|
|
||||||
animate();
|
|
||||||
});
|
|
||||||
|
|
||||||
//set window.requestAnimationFrame
|
|
||||||
(function (w, r) {
|
|
||||||
w['r'+r] = w['r'+r] || w['webkitR'+r] || w['mozR'+r] || w['msR'+r] || w['oR'+r] || function(c){ w.setTimeout(c, 1000 / 60); };
|
|
||||||
})(window, 'equestAnimationFrame');
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
error_reporting(0);
|
|
||||||
$sqm = $_POST['sqm'];
|
|
||||||
$usr = $_POST['usr'];
|
|
||||||
$cdk = $_POST['cdk'];
|
|
||||||
$sqm = str_replace(array(' ','%'),'',$sqm);
|
|
||||||
$usr = str_replace(array(' ','%'),'',$usr);
|
|
||||||
$cdk = str_replace(array(' ','%'),'',$cdk);
|
|
||||||
$cdk =='' && (die('请输入CDKEY'));
|
|
||||||
$usr =='' && (die('请输入角色名称'));
|
|
||||||
$sqm =='' && (die('请设置后台密码'));
|
|
||||||
include "config.php";
|
|
||||||
$mysql = mysqli_connect($PZ['DB_HOST'],$PZ['DB_USER'],$PZ['DB_PWD'],$PZ['DB_NAME'],$PZ['DB_PORT']) or die("数据库连接错误");
|
|
||||||
$mysql->query('set names utf8');
|
|
||||||
$xx = mysqli_fetch_assoc($mysql->query("SELECT * FROM tafang_center.account WHERE account = '$usr' limit 1"));
|
|
||||||
$xx['id'] =='' && (die('无此角色名,请检查后再试'));
|
|
||||||
$rid = $xx['id'];
|
|
||||||
$xxx = mysqli_fetch_assoc($mysql->query("SELECT * FROM cdk WHERE cdk = '$cdk' limit 1"));
|
|
||||||
$xxx['id'] == '' && (die('无此授权卡'));
|
|
||||||
$xxx['status'] != 0 && (die('此授权卡已被使用'));
|
|
||||||
$lx = $xxx['type'] + 100;
|
|
||||||
$ss = mysqli_fetch_assoc($mysql->query("SELECT type FROM cdk WHERE uid = '$rid' limit 1"));
|
|
||||||
$xlx = $ss['type'] + 100;
|
|
||||||
|
|
||||||
if($xlx == 100){
|
|
||||||
if($mysql->query("UPDATE cdk SET status = 1 , uid = '$rid', pass = '$sqm' WHERE cdk = '$cdk';")){
|
|
||||||
die('角色授权成功!请妥善保管您设置的后台密码');
|
|
||||||
}else{
|
|
||||||
die('授权失败.请联系管理员');
|
|
||||||
}
|
|
||||||
}elseif($xlx == $lx){
|
|
||||||
die('此角色已是授权用户,无需再次开通');
|
|
||||||
}elseif($xlx < $lx){
|
|
||||||
$mysql->query("DELETE FROM cdk WHERE uid = '$rid' limit 1");
|
|
||||||
if($mysql->query("UPDATE cdk SET status = 1 , uid = '$rid', pass = '$sqm' WHERE cdk = '$cdk';")){
|
|
||||||
die('角色授权成功!请妥善保管您设置的后台密码');
|
|
||||||
}else{
|
|
||||||
die('授权失败.请联系管理员');
|
|
||||||
}
|
|
||||||
}elseif($xlx > $lx){
|
|
||||||
die('此角色已是授权用户,无需再次开通');
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
121
ht/vip/api.php
121
ht/vip/api.php
@@ -1,121 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// error_reporting(0);
|
|
||||||
$sqm = $_POST['sqm'];
|
|
||||||
$usr = $_POST['usr'];
|
|
||||||
$bao = $_POST['bao'];
|
|
||||||
$num = $_POST['num'];
|
|
||||||
$item = $_POST['item'];
|
|
||||||
$gnxz = $_POST['gnxz'];
|
|
||||||
$sqm = str_replace(array(' ','%'),'',$sqm);
|
|
||||||
$usr = str_replace(array(' ','%'),'',$usr);
|
|
||||||
$gnxz = str_replace(array(' ','%'),'',$gnxz);
|
|
||||||
$usr = str_replace(array(' ','%'),'',$usr);
|
|
||||||
$usr =='' && (die('请输入内容'));
|
|
||||||
$sqm =='' && (die('请输入后台密码'));
|
|
||||||
$gnxz == 0 && (die('请选择功能'));
|
|
||||||
include "config.php";
|
|
||||||
$mysql = mysqli_connect($PZ['DB_HOST'],$PZ['DB_USER'],$PZ['DB_PWD'],$PZ['DB_NAME'],$PZ['DB_PORT']) or die("数据库连接错误");
|
|
||||||
$mysql->query('set names utf8');
|
|
||||||
$xx = mysqli_fetch_assoc($mysql->query("SELECT * FROM tafang_center.account WHERE account = '$usr' limit 1"));
|
|
||||||
$xx['id'] =='' && (die('无此角色'));
|
|
||||||
$rid = $xx['id'];
|
|
||||||
$ss = mysqli_fetch_assoc($mysql->query("SELECT pass,type FROM cdk WHERE uid = '$rid' limit 1"));
|
|
||||||
//$ss['type'] < $gnxz && (die('此角色未授权此功能'));
|
|
||||||
//$ss['pass'] != $sqm && (die('后台密码错误'));
|
|
||||||
$num>999999999 && (die('数量限制1-9999'));
|
|
||||||
|
|
||||||
|
|
||||||
if($gnxz==1){
|
|
||||||
$bao == 0 && (die('请选择充值项目'));
|
|
||||||
$bao > 15 && (die('错误的充值项目'));
|
|
||||||
$data = urlencode($bao);
|
|
||||||
// $re = gmmail(8800 + $rid,$item,$itemnum);
|
|
||||||
exit("");
|
|
||||||
// $ret = json_decode(curl_https("http://127.0.0.1:7555/GM?cmd=openServer&id={$rid}&type={$data}"),true);
|
|
||||||
// if($ret['success']==1){die('发送成功');}else{die($ret['reason']);}
|
|
||||||
}elseif($gnxz==2){
|
|
||||||
$item =='0' && (die('请选择物品'));
|
|
||||||
$find=false;
|
|
||||||
|
|
||||||
$json_string = file_get_contents('./item.json');
|
|
||||||
$data = json_decode($json_string, true);
|
|
||||||
foreach($data as $txts){
|
|
||||||
if(trim($txts['resId']) == trim($item)){
|
|
||||||
$find=true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//if($find==false){die('此物品您无权发送');}
|
|
||||||
$num =='' && ($num = 1);
|
|
||||||
$ts = time();
|
|
||||||
$title = urlencode('系统邮件');
|
|
||||||
$txt = urlencode('您有新的邮件,请及时查收');
|
|
||||||
// if($item > 99){$num > 100 && ($num = 100);}else{$num > 99999999 && ($num = 99999999);}
|
|
||||||
$xx222 = mysqli_fetch_assoc($mysql->query("SELECT * FROM tafang_game_zjy.role WHERE code = '$usr' limit 1"));
|
|
||||||
$xx222['id'] =='' && (die('无此角色'));
|
|
||||||
$uid = $xx222['id'];
|
|
||||||
$re = gmmail($uid,$item,$num);
|
|
||||||
exit($re);
|
|
||||||
// $ret = json_decode(curl_https("http://127.0.0.1:7555/GM?cmd=sendMail&names={$rid}&sn={$item}&num={$num}&title={$title}&detail={$txt}&batchCode={$ts}&expiredTime=7"),true);;
|
|
||||||
// if($ret['success']==1){die('发送成功');}else{die('发送失败');}
|
|
||||||
}else{
|
|
||||||
die('error');
|
|
||||||
}
|
|
||||||
|
|
||||||
function curl_https($url){
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
|
||||||
$cnt = curl_exec($ch);
|
|
||||||
curl_close($ch);
|
|
||||||
return $cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
function curl_http_post($url,$data){
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
||||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
||||||
'Accept: application/json, text/plain, */*',
|
|
||||||
'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
|
|
||||||
'Connection: keep-alive',
|
|
||||||
'Content-Type: application/json',
|
|
||||||
'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1 Edg/121.0.0.0',
|
|
||||||
'Accept-Encoding: gzip',
|
|
||||||
'X-Mgip-sign: gzip',
|
|
||||||
]);
|
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
|
||||||
|
|
||||||
$response = curl_exec($ch);
|
|
||||||
|
|
||||||
curl_close($ch);
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
function gmmail($uuid,$item,$itemnum){
|
|
||||||
|
|
||||||
|
|
||||||
$url = 'http://127.0.0.1:19000/center/gm';
|
|
||||||
|
|
||||||
$param=array(
|
|
||||||
"role"=>$uuid,
|
|
||||||
"item"=>[array($item,$itemnum)
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$data = json_encode($param);
|
|
||||||
|
|
||||||
$response = curl_http_post($url,$data);
|
|
||||||
|
|
||||||
|
|
||||||
return '发送成功';
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
error_reporting(0);
|
|
||||||
$PZ = array(
|
|
||||||
'DB_HOST'=>'192.168.25.110',// 服务器地址
|
|
||||||
'DB_NAME'=>'cdk',// 游戏数据库
|
|
||||||
'DB_USER'=>'root',// 用户名
|
|
||||||
'DB_PWD'=>'mysql_tr2Few',// 密码
|
|
||||||
'DB_PORT'=>'23306',// 端口
|
|
||||||
'DB_CHARSET'=>'utf8',// 数据库字符集
|
|
||||||
);
|
|
||||||
?>
|
|
||||||
4258
ht/vip/css/style.css
4258
ht/vip/css/style.css
File diff suppressed because it is too large
Load Diff
506
ht/vip/index.php
506
ht/vip/index.php
@@ -1,506 +0,0 @@
|
|||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
|
||||||
<title>缥缈用户后台</title>
|
|
||||||
<link rel="icon" href="favicon.ico" type="image/ico">
|
|
||||||
|
|
||||||
|
|
||||||
<meta name="author" content="yinqi">
|
|
||||||
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link href="./css/style.css" rel="stylesheet">
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/jquery/2.0.0/jquery.min.js"></script>
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/bootbox.js/4.4.0/bootbox.min.js"></script>
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/bootstrap-select/1.13.10/js/bootstrap-select.min.js"></script>
|
|
||||||
<script type="text/javascript" src="https://cdn.staticfile.org/bootstrap-select/1.13.10/js/i18n/defaults-zh_CN.js"></script>
|
|
||||||
<script src="./js/uti.js"></script>
|
|
||||||
<style>
|
|
||||||
.wrapper {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.login {
|
|
||||||
display: flex !important;
|
|
||||||
min-height: 100vh;
|
|
||||||
align-items: center !important;
|
|
||||||
justify-content: center !important;
|
|
||||||
}
|
|
||||||
.login-center {
|
|
||||||
background: #fff;
|
|
||||||
min-width: 38.25rem;
|
|
||||||
padding: 2.14286em 3.57143em;
|
|
||||||
border-radius: 5px;
|
|
||||||
margin: 2.85714em 0;
|
|
||||||
}
|
|
||||||
.login-header {
|
|
||||||
margin-bottom: 1.5rem !important;
|
|
||||||
}
|
|
||||||
.login-center .has-feedback.feedback-left .form-control {
|
|
||||||
padding-left: 38px;
|
|
||||||
padding-right: 12px;
|
|
||||||
}
|
|
||||||
.login-center .has-feedback.feedback-left .form-control-feedback {
|
|
||||||
left: 0;
|
|
||||||
right: auto;
|
|
||||||
width: 38px;
|
|
||||||
height: 38px;
|
|
||||||
line-height: 38px;
|
|
||||||
z-index: 4;
|
|
||||||
color: #dcdcdc;
|
|
||||||
}
|
|
||||||
.login-center .has-feedback.feedback-left.row .form-control-feedback {
|
|
||||||
left: 15px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<style>
|
|
||||||
.lizi1{
|
|
||||||
display:table;
|
|
||||||
z-index:10;
|
|
||||||
position:absolute;
|
|
||||||
height:100%;
|
|
||||||
width:100%;
|
|
||||||
}
|
|
||||||
.login-center{
|
|
||||||
background: rgba(255, 255, 255, 0.4);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<body data-logobg="color_8" data-sidebarbg="color_8">
|
|
||||||
<!--开始-->
|
|
||||||
<style type="text/css">
|
|
||||||
*{margin:0;padding:0;list-style-type:none;}
|
|
||||||
a,img{border:0;}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<canvas id="sakura" style="position:absolute;"></canvas>
|
|
||||||
<!-- sakura shader -->
|
|
||||||
<script id="sakura_point_vsh" type="x-shader/x_vertex">
|
|
||||||
uniform mat4 uProjection;
|
|
||||||
uniform mat4 uModelview;
|
|
||||||
uniform vec3 uResolution;
|
|
||||||
uniform vec3 uOffset;
|
|
||||||
uniform vec3 uDOF; //x:focus distance, y:focus radius, z:max radius
|
|
||||||
uniform vec3 uFade; //x:start distance, y:half distance, z:near fade start
|
|
||||||
|
|
||||||
attribute vec3 aPosition;
|
|
||||||
attribute vec3 aEuler;
|
|
||||||
attribute vec2 aMisc; //x:size, y:fade
|
|
||||||
|
|
||||||
varying vec3 pposition;
|
|
||||||
varying float psize;
|
|
||||||
varying float palpha;
|
|
||||||
varying float pdist;
|
|
||||||
|
|
||||||
//varying mat3 rotMat;
|
|
||||||
varying vec3 normX;
|
|
||||||
varying vec3 normY;
|
|
||||||
varying vec3 normZ;
|
|
||||||
varying vec3 normal;
|
|
||||||
|
|
||||||
varying float diffuse;
|
|
||||||
varying float specular;
|
|
||||||
varying float rstop;
|
|
||||||
varying float distancefade;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
// Projection is based on vertical angle
|
|
||||||
vec4 pos = uModelview * vec4(aPosition + uOffset, 1.0);
|
|
||||||
gl_Position = uProjection * pos;
|
|
||||||
gl_PointSize = aMisc.x * uProjection[1][1] / -pos.z * uResolution.y * 0.5;
|
|
||||||
|
|
||||||
pposition = pos.xyz;
|
|
||||||
psize = aMisc.x;
|
|
||||||
pdist = length(pos.xyz);
|
|
||||||
palpha = smoothstep(0.0, 1.0, (pdist - 0.1) / uFade.z);
|
|
||||||
|
|
||||||
vec3 elrsn = sin(aEuler);
|
|
||||||
vec3 elrcs = cos(aEuler);
|
|
||||||
mat3 rotx = mat3(
|
|
||||||
1.0, 0.0, 0.0,
|
|
||||||
0.0, elrcs.x, elrsn.x,
|
|
||||||
0.0, -elrsn.x, elrcs.x
|
|
||||||
);
|
|
||||||
mat3 roty = mat3(
|
|
||||||
elrcs.y, 0.0, -elrsn.y,
|
|
||||||
0.0, 1.0, 0.0,
|
|
||||||
elrsn.y, 0.0, elrcs.y
|
|
||||||
);
|
|
||||||
mat3 rotz = mat3(
|
|
||||||
elrcs.z, elrsn.z, 0.0,
|
|
||||||
-elrsn.z, elrcs.z, 0.0,
|
|
||||||
0.0, 0.0, 1.0
|
|
||||||
);
|
|
||||||
mat3 rotmat = rotx * roty * rotz;
|
|
||||||
normal = rotmat[2];
|
|
||||||
|
|
||||||
mat3 trrotm = mat3(
|
|
||||||
rotmat[0][0], rotmat[1][0], rotmat[2][0],
|
|
||||||
rotmat[0][1], rotmat[1][1], rotmat[2][1],
|
|
||||||
rotmat[0][2], rotmat[1][2], rotmat[2][2]
|
|
||||||
);
|
|
||||||
normX = trrotm[0];
|
|
||||||
normY = trrotm[1];
|
|
||||||
normZ = trrotm[2];
|
|
||||||
|
|
||||||
const vec3 lit = vec3(0.6917144638660746, 0.6917144638660746, -0.20751433915982237);
|
|
||||||
|
|
||||||
float tmpdfs = dot(lit, normal);
|
|
||||||
if(tmpdfs < 0.0) {
|
|
||||||
normal = -normal;
|
|
||||||
tmpdfs = dot(lit, normal);
|
|
||||||
}
|
|
||||||
diffuse = 0.4 + tmpdfs;
|
|
||||||
|
|
||||||
vec3 eyev = normalize(-pos.xyz);
|
|
||||||
if(dot(eyev, normal) > 0.0) {
|
|
||||||
vec3 hv = normalize(eyev + lit);
|
|
||||||
specular = pow(max(dot(hv, normal), 0.0), 20.0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
specular = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
rstop = clamp((abs(pdist - uDOF.x) - uDOF.y) / uDOF.z, 0.0, 1.0);
|
|
||||||
rstop = pow(rstop, 0.5);
|
|
||||||
//-0.69315 = ln(0.5)
|
|
||||||
distancefade = min(1.0, exp((uFade.x - pdist) * 0.69315 / uFade.y));
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script id="sakura_point_fsh" type="x-shader/x_fragment">
|
|
||||||
#ifdef GL_ES
|
|
||||||
//precision mediump float;
|
|
||||||
precision highp float;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform vec3 uDOF; //x:focus distance, y:focus radius, z:max radius
|
|
||||||
uniform vec3 uFade; //x:start distance, y:half distance, z:near fade start
|
|
||||||
|
|
||||||
const vec3 fadeCol = vec3(0.08, 0.03, 0.06);
|
|
||||||
|
|
||||||
varying vec3 pposition;
|
|
||||||
varying float psize;
|
|
||||||
varying float palpha;
|
|
||||||
varying float pdist;
|
|
||||||
|
|
||||||
//varying mat3 rotMat;
|
|
||||||
varying vec3 normX;
|
|
||||||
varying vec3 normY;
|
|
||||||
varying vec3 normZ;
|
|
||||||
varying vec3 normal;
|
|
||||||
|
|
||||||
varying float diffuse;
|
|
||||||
varying float specular;
|
|
||||||
varying float rstop;
|
|
||||||
varying float distancefade;
|
|
||||||
|
|
||||||
float ellipse(vec2 p, vec2 o, vec2 r) {
|
|
||||||
vec2 lp = (p - o) / r;
|
|
||||||
return length(lp) - 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
vec3 p = vec3(gl_PointCoord - vec2(0.5, 0.5), 0.0) * 2.0;
|
|
||||||
vec3 d = vec3(0.0, 0.0, -1.0);
|
|
||||||
float nd = normZ.z; //dot(-normZ, d);
|
|
||||||
if(abs(nd) < 0.0001) discard;
|
|
||||||
|
|
||||||
float np = dot(normZ, p);
|
|
||||||
vec3 tp = p + d * np / nd;
|
|
||||||
vec2 coord = vec2(dot(normX, tp), dot(normY, tp));
|
|
||||||
|
|
||||||
//angle = 15 degree
|
|
||||||
const float flwrsn = 0.258819045102521;
|
|
||||||
const float flwrcs = 0.965925826289068;
|
|
||||||
mat2 flwrm = mat2(flwrcs, -flwrsn, flwrsn, flwrcs);
|
|
||||||
vec2 flwrp = vec2(abs(coord.x), coord.y) * flwrm;
|
|
||||||
|
|
||||||
float r;
|
|
||||||
if(flwrp.x < 0.0) {
|
|
||||||
r = ellipse(flwrp, vec2(0.065, 0.024) * 0.5, vec2(0.36, 0.96) * 0.5);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
r = ellipse(flwrp, vec2(0.065, 0.024) * 0.5, vec2(0.58, 0.96) * 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(r > rstop) discard;
|
|
||||||
|
|
||||||
vec3 col = mix(vec3(1.0, 0.8, 0.75), vec3(1.0, 0.9, 0.87), r);
|
|
||||||
float grady = mix(0.0, 1.0, pow(coord.y * 0.5 + 0.5, 0.35));
|
|
||||||
col *= vec3(1.0, grady, grady);
|
|
||||||
col *= mix(0.8, 1.0, pow(abs(coord.x), 0.3));
|
|
||||||
col = col * diffuse + specular;
|
|
||||||
|
|
||||||
col = mix(fadeCol, col, distancefade);
|
|
||||||
|
|
||||||
float alpha = (rstop > 0.001)? (0.5 - r / (rstop * 2.0)) : 1.0;
|
|
||||||
alpha = smoothstep(0.0, 1.0, alpha) * palpha;
|
|
||||||
|
|
||||||
gl_FragColor = vec4(col * 0.5, alpha);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<!-- effects -->
|
|
||||||
<script id="fx_common_vsh" type="x-shader/x_vertex">
|
|
||||||
uniform vec3 uResolution;
|
|
||||||
attribute vec2 aPosition;
|
|
||||||
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
||||||
texCoord = aPosition.xy * 0.5 + vec2(0.5, 0.5);
|
|
||||||
screenCoord = aPosition.xy * vec2(uResolution.z, 1.0);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script id="bg_fsh" type="x-shader/x_fragment">
|
|
||||||
#ifdef GL_ES
|
|
||||||
//precision mediump float;
|
|
||||||
precision highp float;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uniform vec2 uTimes;
|
|
||||||
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
vec3 col;
|
|
||||||
float c;
|
|
||||||
vec2 tmpv = texCoord * vec2(0.8, 1.0) - vec2(0.95, 1.0);
|
|
||||||
c = exp(-pow(length(tmpv) * 1.8, 2.0));
|
|
||||||
col = mix(vec3(0.02, 0.0, 0.03), vec3(0.96, 0.98, 1.0) * 1.5, c);
|
|
||||||
gl_FragColor = vec4(col * 0.5, 1.0);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script id="fx_brightbuf_fsh" type="x-shader/x_fragment">
|
|
||||||
#ifdef GL_ES
|
|
||||||
//precision mediump float;
|
|
||||||
precision highp float;
|
|
||||||
#endif
|
|
||||||
uniform sampler2D uSrc;
|
|
||||||
uniform vec2 uDelta;
|
|
||||||
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
vec4 col = texture2D(uSrc, texCoord);
|
|
||||||
gl_FragColor = vec4(col.rgb * 2.0 - vec3(0.5), 1.0);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script id="fx_dirblur_r4_fsh" type="x-shader/x_fragment">
|
|
||||||
#ifdef GL_ES
|
|
||||||
//precision mediump float;
|
|
||||||
precision highp float;
|
|
||||||
#endif
|
|
||||||
uniform sampler2D uSrc;
|
|
||||||
uniform vec2 uDelta;
|
|
||||||
uniform vec4 uBlurDir; //dir(x, y), stride(z, w)
|
|
||||||
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
vec4 col = texture2D(uSrc, texCoord);
|
|
||||||
col = col + texture2D(uSrc, texCoord + uBlurDir.xy * uDelta);
|
|
||||||
col = col + texture2D(uSrc, texCoord - uBlurDir.xy * uDelta);
|
|
||||||
col = col + texture2D(uSrc, texCoord + (uBlurDir.xy + uBlurDir.zw) * uDelta);
|
|
||||||
col = col + texture2D(uSrc, texCoord - (uBlurDir.xy + uBlurDir.zw) * uDelta);
|
|
||||||
gl_FragColor = col / 5.0;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<!-- effect fragment shader template -->
|
|
||||||
<script id="fx_common_fsh" type="x-shader/x_fragment">
|
|
||||||
#ifdef GL_ES
|
|
||||||
//precision mediump float;
|
|
||||||
precision highp float;
|
|
||||||
#endif
|
|
||||||
uniform sampler2D uSrc;
|
|
||||||
uniform vec2 uDelta;
|
|
||||||
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
gl_FragColor = texture2D(uSrc, texCoord);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<!-- post processing -->
|
|
||||||
<script id="pp_final_vsh" type="x-shader/x_vertex">
|
|
||||||
uniform vec3 uResolution;
|
|
||||||
attribute vec2 aPosition;
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
void main(void) {
|
|
||||||
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
||||||
texCoord = aPosition.xy * 0.5 + vec2(0.5, 0.5);
|
|
||||||
screenCoord = aPosition.xy * vec2(uResolution.z, 1.0);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script id="pp_final_fsh" type="x-shader/x_fragment">
|
|
||||||
#ifdef GL_ES
|
|
||||||
//precision mediump float;
|
|
||||||
precision highp float;
|
|
||||||
#endif
|
|
||||||
uniform sampler2D uSrc;
|
|
||||||
uniform sampler2D uBloom;
|
|
||||||
uniform vec2 uDelta;
|
|
||||||
varying vec2 texCoord;
|
|
||||||
varying vec2 screenCoord;
|
|
||||||
void main(void) {
|
|
||||||
vec4 srccol = texture2D(uSrc, texCoord) * 2.0;
|
|
||||||
vec4 bloomcol = texture2D(uBloom, texCoord);
|
|
||||||
vec4 col;
|
|
||||||
col = srccol + bloomcol * (vec4(1.0) + srccol);
|
|
||||||
col *= smoothstep(1.0, 0.0, pow(length((texCoord - vec2(0.5)) * 2.0), 1.2) * 0.5);
|
|
||||||
col = pow(col, vec4(0.45454545454545)); //(1.0 / 2.2)
|
|
||||||
|
|
||||||
gl_FragColor = vec4(col.rgb, 1.0);
|
|
||||||
gl_FragColor.a = 1.0;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<!--结尾-->
|
|
||||||
<div class="lizi1">
|
|
||||||
<div class="login">
|
|
||||||
<div class="login-center">
|
|
||||||
<div class="login-header text-center">
|
|
||||||
<h3>缥缈</h3>
|
|
||||||
</div>
|
|
||||||
<form method="post" id="register-form" autocomplete="off" action="#" class="nice-validator n-default" novalidate>
|
|
||||||
<div class="form-group has-feedback feedback-left">
|
|
||||||
<input type="text" class="form-control" id="usr" name="usr" placeholder="角色名称" autocomplete="off">
|
|
||||||
</div>
|
|
||||||
<div class="form-group has-feedback feedback-left">
|
|
||||||
<input type="text" class="form-control" id="sqm" name="sqm" placeholder="后台密码" autocomplete="off">
|
|
||||||
</div>
|
|
||||||
<div class="form-group has-feedback feedback-left">
|
|
||||||
<select id="gnxz" class="form-control" name="gnxz"><option value="0">请选择功能</option><option value="2">物品</option></select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group" id='xpay' style="display:none;">
|
|
||||||
<select id='bao' class="form-control"><option value='0'>请选择类型</option><option value='coin'>铜钱</option><option value='gold'>金砖</option>
|
|
||||||
</select></div>
|
|
||||||
<div id='xbao' style="display:none;">
|
|
||||||
<div class="form-group has-feedback feedback-left">
|
|
||||||
<div class="input-group">
|
|
||||||
<input type='text' class="form-control" value='' id='searchipt' placeholder='物品搜索'>
|
|
||||||
<span class="input-group-btn"><button class="btn btn-info" type="button" id='search' >搜索</button></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<select id='item' class="form-control"><option value='0'>请选择道具</option> <?php
|
|
||||||
$json_string = file_get_contents('./item.json');
|
|
||||||
$data = json_decode($json_string, true);
|
|
||||||
foreach($data as $txts){
|
|
||||||
echo '<option value="'.$txts['resId'].'">'.$txts['name'].'</option>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" class="form-control" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" id="num" name="num" placeholder="请输入数量" autocomplete="off">
|
|
||||||
</div></div>
|
|
||||||
<div class="form-group">
|
|
||||||
<input class="btn btn-block btn-primary" name='reg' id="1" value="提交" type="button" onclick= "test(this)">
|
|
||||||
</div><br>
|
|
||||||
<div id="divMsg" style="color:#F00" class="validator-tips"></div>
|
|
||||||
</form>
|
|
||||||
<footer class="col-sm-12 text-center"><p class="m-b-0">源码屋:www.51boshao.com</p>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
$('#gnxz').change(function(){
|
|
||||||
var gn = $(this).children('option:selected').val();
|
|
||||||
if(gn == 1 ){
|
|
||||||
document.getElementById('xpay').style.display = "";
|
|
||||||
document.getElementById('xbao').style.display = "none";
|
|
||||||
}else if(gn == 2 ){
|
|
||||||
document.getElementById('xpay').style.display = "none";
|
|
||||||
document.getElementById('xbao').style.display = "";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#search').click(function(){
|
|
||||||
var keyword=$('#searchipt').val();
|
|
||||||
$.ajax({
|
|
||||||
url:'itemquery.php',
|
|
||||||
type:'post',
|
|
||||||
'data':{keyword:keyword},
|
|
||||||
'cache':false,
|
|
||||||
'dataType':'json',
|
|
||||||
success:function(data){
|
|
||||||
if(data){
|
|
||||||
$('#item').html('');
|
|
||||||
for (var i in data){
|
|
||||||
$('#item').append('<option value="'+data[i].key+'">'+data[i].val+'</option>');
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$('#item').html('<option value="0">未找到</option>');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error:function(){
|
|
||||||
bootbox.alert({message:'操作失败',title:"提示"});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function api(){
|
|
||||||
$.ajaxSetup({contentType: "application/x-www-form-urlencoded; charset=utf-8"});
|
|
||||||
$.post("api.php", {
|
|
||||||
sqm:$("#sqm").val(),
|
|
||||||
usr:$("#usr").val(),
|
|
||||||
bao:$("#bao").val(),
|
|
||||||
num:$("#num").val(),
|
|
||||||
item:$("#item").val(),
|
|
||||||
gnxz:$("#gnxz").val()
|
|
||||||
},function(data){
|
|
||||||
$('input[name=reg]').attr('id','1');
|
|
||||||
$('input[name=reg]').attr('value','提交');
|
|
||||||
bootbox.alert({message:data,title:"提示"});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function test(obj){
|
|
||||||
var _status = obj.id;
|
|
||||||
if(_status != '1'){
|
|
||||||
$('input[name=reg]').attr('id','0');
|
|
||||||
$('input[name=reg]').attr('value','正在提交...');
|
|
||||||
return false;
|
|
||||||
}else{
|
|
||||||
$('input[name=reg]').attr('id','0');
|
|
||||||
$('input[name=reg]').attr('value','正在提交...');
|
|
||||||
api();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
document.onkeydown = function(event) {
|
|
||||||
var target, code, tag;
|
|
||||||
if (!event) {
|
|
||||||
event = window.event; //针对ie浏览器
|
|
||||||
target = event.srcElement;
|
|
||||||
code = event.keyCode;
|
|
||||||
if (code == 13) {
|
|
||||||
tag = target.tagName;
|
|
||||||
if (tag == "TEXTAREA") { return true; }
|
|
||||||
else { return false; }
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
target = event.target; //针对遵循w3c标准的浏览器,如Firefox
|
|
||||||
code = event.keyCode;
|
|
||||||
if (code == 13) {
|
|
||||||
tag = target.tagName;
|
|
||||||
if (tag == "INPUT") { return false; }
|
|
||||||
else { return true; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<audio autoplay loop>
|
|
||||||
<source src="mp3/music.mp3">
|
|
||||||
</audio>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
[{"resId":3,"name":"经验","useType":1},
|
|
||||||
{"resId":6,"name":"钻石","useType":1},
|
|
||||||
{"resId":7,"name":"金币","useType":1},
|
|
||||||
{"resId":8,"name":"洗炼石","useType":1},
|
|
||||||
{"resId":9,"name":"体力","useType":1},
|
|
||||||
{"resId":10,"name":"充值币","useType":1},
|
|
||||||
{"resId":10002,"name":"发冠升级图纸","useType":1},
|
|
||||||
{"resId":10003,"name":"道袍升级图纸","useType":1},
|
|
||||||
{"resId":10004,"name":"项链升级图纸","useType":1},
|
|
||||||
{"resId":10005,"name":"戒指升级图纸","useType":1},
|
|
||||||
{"resId":10006,"name":"靴子升级图纸","useType":1},
|
|
||||||
{"resId":10007,"name":"新手道书","useType":1},
|
|
||||||
{"resId":10008,"name":"五色土","useType":1},
|
|
||||||
{"resId":10009,"name":"女娲石","useType":1},
|
|
||||||
{"resId":10010,"name":"突破丹","useType":1},
|
|
||||||
{"resId":10011,"name":"随机装备图纸","useType":2},
|
|
||||||
{"resId":10012,"name":"随机技能卷轴","useType":4},
|
|
||||||
{"resId":10013,"name":"随机宝石箱子","useType":3},
|
|
||||||
{"resId":10014,"name":"普通宝石箱","useType":3},
|
|
||||||
{"resId":10015,"name":"璀璨宝石箱","useType":3},
|
|
||||||
{"resId":10016,"name":"随机紫色宝石宝箱","useType":3},
|
|
||||||
{"resId":10017,"name":"随机金色宝石宝箱","useType":3},
|
|
||||||
{"resId":10018,"name":"随机红色宝石宝箱","useType":3},
|
|
||||||
{"resId":10019,"name":"随机多彩宝石宝箱","useType":3},
|
|
||||||
{"resId":10020,"name":"宝石抽取券","useType":1},
|
|
||||||
{"resId":10021,"name":"灵宠抽取券","useType":1},
|
|
||||||
{"resId":10022,"name":"随机宝石箱子","useType":3},
|
|
||||||
{"resId":10023,"name":"随机稀有宝石","useType":3},
|
|
||||||
{"resId":10024,"name":"随机宝石箱子","useType":3},
|
|
||||||
{"resId":10101,"name":"御剑术卷轴","useType":1},
|
|
||||||
{"resId":10102,"name":"毒气弹卷轴","useType":1},
|
|
||||||
{"resId":10103,"name":"寒冰箭卷轴","useType":1},
|
|
||||||
{"resId":10104,"name":"惊雷咒卷轴","useType":1},
|
|
||||||
{"resId":10105,"name":"石狮子卷轴","useType":1},
|
|
||||||
{"resId":10106,"name":"剑气斩卷轴","useType":1},
|
|
||||||
{"resId":10107,"name":"万剑诀卷轴","useType":1},
|
|
||||||
{"resId":10108,"name":"寒冰突刺卷轴","useType":1},
|
|
||||||
{"resId":10109,"name":"连环闪电卷轴","useType":1},
|
|
||||||
{"resId":10110,"name":"泰山压顶卷轴","useType":1},
|
|
||||||
{"resId":10111,"name":"风暴术卷轴","useType":1},
|
|
||||||
{"resId":10112,"name":"天雷网卷轴","useType":1},
|
|
||||||
{"resId":10113,"name":"巨石突刺卷轴","useType":1},
|
|
||||||
{"resId":10114,"name":"旋风术卷轴","useType":1},
|
|
||||||
{"resId":10115,"name":"闪电球卷轴","useType":1},
|
|
||||||
{"resId":10116,"name":"改名卡","useType":1},
|
|
||||||
{"resId":10117,"name":"随机宝石箱子","useType":1},
|
|
||||||
{"resId":10118,"name":"随机蓝色宝石宝箱","useType":3},
|
|
||||||
{"resId":10119,"name":"晶石掉落","useType":1},
|
|
||||||
{"resId":10120,"name":"技能卷轴自选宝箱","useType":5},
|
|
||||||
{"resId":10121,"name":"灵宠口粮","useType":1},
|
|
||||||
{"resId":10122,"name":"灵宠抽卡箱","useType":1},
|
|
||||||
{"resId":10123,"name":"灵宠口粮","useType":1},
|
|
||||||
{"resId":10999,"name":"1元代金券","useType":1}]
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
error_reporting(0);
|
|
||||||
if($_POST){
|
|
||||||
$key=trim($_POST['keyword']);
|
|
||||||
$return=array(array('key'=>0,'val'=>'请选择'));
|
|
||||||
$file = fopen("item.txt", "r");
|
|
||||||
if($key==''){
|
|
||||||
while(!feof($file))
|
|
||||||
{
|
|
||||||
$line=fgets($file);
|
|
||||||
$txts=explode('|',$line);
|
|
||||||
if(count($txts)==2){
|
|
||||||
$tmp=array(
|
|
||||||
'key'=>$txts[0],
|
|
||||||
'val'=>$txts[1]
|
|
||||||
);
|
|
||||||
array_push($return,$tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
while(!feof($file))
|
|
||||||
{
|
|
||||||
$line=fgets($file);
|
|
||||||
$pos=strpos($line,$key);
|
|
||||||
if($pos){
|
|
||||||
$txts=explode('|',$line);
|
|
||||||
if(count($txts)==2){
|
|
||||||
$tmp=array(
|
|
||||||
'key'=>$txts[0],
|
|
||||||
'val'=>$txts[1]
|
|
||||||
);
|
|
||||||
array_push($return,$tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose($file);
|
|
||||||
echo(json_encode($return));
|
|
||||||
}else{
|
|
||||||
$return=array(array('key'=>0,'val'=>'请选择'));
|
|
||||||
echo(json_encode($return));
|
|
||||||
}
|
|
||||||
802
ht/vip/js/uti.js
802
ht/vip/js/uti.js
@@ -1,802 +0,0 @@
|
|||||||
// Utilities
|
|
||||||
var Vector3 = {};
|
|
||||||
var Matrix44 = {};
|
|
||||||
Vector3.create = function(x, y, z) {
|
|
||||||
return {'x':x, 'y':y, 'z':z};
|
|
||||||
};
|
|
||||||
Vector3.dot = function (v0, v1) {
|
|
||||||
return v0.x * v1.x + v0.y * v1.y + v0.z * v1.z;
|
|
||||||
};
|
|
||||||
Vector3.cross = function (v, v0, v1) {
|
|
||||||
v.x = v0.y * v1.z - v0.z * v1.y;
|
|
||||||
v.y = v0.z * v1.x - v0.x * v1.z;
|
|
||||||
v.z = v0.x * v1.y - v0.y * v1.x;
|
|
||||||
};
|
|
||||||
Vector3.normalize = function (v) {
|
|
||||||
var l = v.x * v.x + v.y * v.y + v.z * v.z;
|
|
||||||
if(l > 0.00001) {
|
|
||||||
l = 1.0 / Math.sqrt(l);
|
|
||||||
v.x *= l;
|
|
||||||
v.y *= l;
|
|
||||||
v.z *= l;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Vector3.arrayForm = function(v) {
|
|
||||||
if(v.array) {
|
|
||||||
v.array[0] = v.x;
|
|
||||||
v.array[1] = v.y;
|
|
||||||
v.array[2] = v.z;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
v.array = new Float32Array([v.x, v.y, v.z]);
|
|
||||||
}
|
|
||||||
return v.array;
|
|
||||||
};
|
|
||||||
Matrix44.createIdentity = function () {
|
|
||||||
return new Float32Array([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]);
|
|
||||||
};
|
|
||||||
Matrix44.loadProjection = function (m, aspect, vdeg, near, far) {
|
|
||||||
var h = near * Math.tan(vdeg * Math.PI / 180.0 * 0.5) * 2.0;
|
|
||||||
var w = h * aspect;
|
|
||||||
|
|
||||||
m[0] = 2.0 * near / w;
|
|
||||||
m[1] = 0.0;
|
|
||||||
m[2] = 0.0;
|
|
||||||
m[3] = 0.0;
|
|
||||||
|
|
||||||
m[4] = 0.0;
|
|
||||||
m[5] = 2.0 * near / h;
|
|
||||||
m[6] = 0.0;
|
|
||||||
m[7] = 0.0;
|
|
||||||
|
|
||||||
m[8] = 0.0;
|
|
||||||
m[9] = 0.0;
|
|
||||||
m[10] = -(far + near) / (far - near);
|
|
||||||
m[11] = -1.0;
|
|
||||||
|
|
||||||
m[12] = 0.0;
|
|
||||||
m[13] = 0.0;
|
|
||||||
m[14] = -2.0 * far * near / (far - near);
|
|
||||||
m[15] = 0.0;
|
|
||||||
};
|
|
||||||
Matrix44.loadLookAt = function (m, vpos, vlook, vup) {
|
|
||||||
var frontv = Vector3.create(vpos.x - vlook.x, vpos.y - vlook.y, vpos.z - vlook.z);
|
|
||||||
Vector3.normalize(frontv);
|
|
||||||
var sidev = Vector3.create(1.0, 0.0, 0.0);
|
|
||||||
Vector3.cross(sidev, vup, frontv);
|
|
||||||
Vector3.normalize(sidev);
|
|
||||||
var topv = Vector3.create(1.0, 0.0, 0.0);
|
|
||||||
Vector3.cross(topv, frontv, sidev);
|
|
||||||
Vector3.normalize(topv);
|
|
||||||
|
|
||||||
m[0] = sidev.x;
|
|
||||||
m[1] = topv.x;
|
|
||||||
m[2] = frontv.x;
|
|
||||||
m[3] = 0.0;
|
|
||||||
|
|
||||||
m[4] = sidev.y;
|
|
||||||
m[5] = topv.y;
|
|
||||||
m[6] = frontv.y;
|
|
||||||
m[7] = 0.0;
|
|
||||||
|
|
||||||
m[8] = sidev.z;
|
|
||||||
m[9] = topv.z;
|
|
||||||
m[10] = frontv.z;
|
|
||||||
m[11] = 0.0;
|
|
||||||
|
|
||||||
m[12] = -(vpos.x * m[0] + vpos.y * m[4] + vpos.z * m[8]);
|
|
||||||
m[13] = -(vpos.x * m[1] + vpos.y * m[5] + vpos.z * m[9]);
|
|
||||||
m[14] = -(vpos.x * m[2] + vpos.y * m[6] + vpos.z * m[10]);
|
|
||||||
m[15] = 1.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
var timeInfo = {
|
|
||||||
'start':0, 'prev':0, // Date
|
|
||||||
'delta':0, 'elapsed':0 // Number(sec)
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
var gl;
|
|
||||||
var renderSpec = {
|
|
||||||
'width':0,
|
|
||||||
'height':0,
|
|
||||||
'aspect':1,
|
|
||||||
'array':new Float32Array(3),
|
|
||||||
'halfWidth':0,
|
|
||||||
'halfHeight':0,
|
|
||||||
'halfArray':new Float32Array(3)
|
|
||||||
// and some render targets. see setViewport()
|
|
||||||
};
|
|
||||||
renderSpec.setSize = function(w, h) {
|
|
||||||
renderSpec.width = w;
|
|
||||||
renderSpec.height = h;
|
|
||||||
renderSpec.aspect = renderSpec.width / renderSpec.height;
|
|
||||||
renderSpec.array[0] = renderSpec.width;
|
|
||||||
renderSpec.array[1] = renderSpec.height;
|
|
||||||
renderSpec.array[2] = renderSpec.aspect;
|
|
||||||
|
|
||||||
renderSpec.halfWidth = Math.floor(w / 2);
|
|
||||||
renderSpec.halfHeight = Math.floor(h / 2);
|
|
||||||
renderSpec.halfArray[0] = renderSpec.halfWidth;
|
|
||||||
renderSpec.halfArray[1] = renderSpec.halfHeight;
|
|
||||||
renderSpec.halfArray[2] = renderSpec.halfWidth / renderSpec.halfHeight;
|
|
||||||
};
|
|
||||||
|
|
||||||
function deleteRenderTarget(rt) {
|
|
||||||
gl.deleteFramebuffer(rt.frameBuffer);
|
|
||||||
gl.deleteRenderbuffer(rt.renderBuffer);
|
|
||||||
gl.deleteTexture(rt.texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createRenderTarget(w, h) {
|
|
||||||
var ret = {
|
|
||||||
'width':w,
|
|
||||||
'height':h,
|
|
||||||
'sizeArray':new Float32Array([w, h, w / h]),
|
|
||||||
'dtxArray':new Float32Array([1.0 / w, 1.0 / h])
|
|
||||||
};
|
|
||||||
ret.frameBuffer = gl.createFramebuffer();
|
|
||||||
ret.renderBuffer = gl.createRenderbuffer();
|
|
||||||
ret.texture = gl.createTexture();
|
|
||||||
|
|
||||||
gl.bindTexture(gl.TEXTURE_2D, ret.texture);
|
|
||||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, w, h, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
||||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
||||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
||||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
||||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
||||||
|
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, ret.frameBuffer);
|
|
||||||
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, ret.texture, 0);
|
|
||||||
|
|
||||||
gl.bindRenderbuffer(gl.RENDERBUFFER, ret.renderBuffer);
|
|
||||||
gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, w, h);
|
|
||||||
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, ret.renderBuffer);
|
|
||||||
|
|
||||||
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
||||||
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
function compileShader(shtype, shsrc) {
|
|
||||||
var retsh = gl.createShader(shtype);
|
|
||||||
|
|
||||||
gl.shaderSource(retsh, shsrc);
|
|
||||||
gl.compileShader(retsh);
|
|
||||||
|
|
||||||
if(!gl.getShaderParameter(retsh, gl.COMPILE_STATUS)) {
|
|
||||||
var errlog = gl.getShaderInfoLog(retsh);
|
|
||||||
gl.deleteShader(retsh);
|
|
||||||
console.error(errlog);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return retsh;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createShader(vtxsrc, frgsrc, uniformlist, attrlist) {
|
|
||||||
var vsh = compileShader(gl.VERTEX_SHADER, vtxsrc);
|
|
||||||
var fsh = compileShader(gl.FRAGMENT_SHADER, frgsrc);
|
|
||||||
|
|
||||||
if(vsh == null || fsh == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var prog = gl.createProgram();
|
|
||||||
gl.attachShader(prog, vsh);
|
|
||||||
gl.attachShader(prog, fsh);
|
|
||||||
|
|
||||||
gl.deleteShader(vsh);
|
|
||||||
gl.deleteShader(fsh);
|
|
||||||
|
|
||||||
gl.linkProgram(prog);
|
|
||||||
if (!gl.getProgramParameter(prog, gl.LINK_STATUS)) {
|
|
||||||
var errlog = gl.getProgramInfoLog(prog);
|
|
||||||
console.error(errlog);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(uniformlist) {
|
|
||||||
prog.uniforms = {};
|
|
||||||
for(var i = 0; i < uniformlist.length; i++) {
|
|
||||||
prog.uniforms[uniformlist[i]] = gl.getUniformLocation(prog, uniformlist[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(attrlist) {
|
|
||||||
prog.attributes = {};
|
|
||||||
for(var i = 0; i < attrlist.length; i++) {
|
|
||||||
var attr = attrlist[i];
|
|
||||||
prog.attributes[attr] = gl.getAttribLocation(prog, attr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return prog;
|
|
||||||
}
|
|
||||||
|
|
||||||
function useShader(prog) {
|
|
||||||
gl.useProgram(prog);
|
|
||||||
for(var attr in prog.attributes) {
|
|
||||||
gl.enableVertexAttribArray(prog.attributes[attr]);;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function unuseShader(prog) {
|
|
||||||
for(var attr in prog.attributes) {
|
|
||||||
gl.disableVertexAttribArray(prog.attributes[attr]);;
|
|
||||||
}
|
|
||||||
gl.useProgram(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/////
|
|
||||||
var projection = {
|
|
||||||
'angle':60,
|
|
||||||
'nearfar':new Float32Array([0.1, 100.0]),
|
|
||||||
'matrix':Matrix44.createIdentity()
|
|
||||||
};
|
|
||||||
var camera = {
|
|
||||||
'position':Vector3.create(0, 0, 100),
|
|
||||||
'lookat':Vector3.create(0, 0, 0),
|
|
||||||
'up':Vector3.create(0, 1, 0),
|
|
||||||
'dof':Vector3.create(10.0, 4.0, 8.0),
|
|
||||||
'matrix':Matrix44.createIdentity()
|
|
||||||
};
|
|
||||||
|
|
||||||
var pointFlower = {};
|
|
||||||
var meshFlower = {};
|
|
||||||
var sceneStandBy = false;
|
|
||||||
|
|
||||||
var BlossomParticle = function () {
|
|
||||||
this.velocity = new Array(3);
|
|
||||||
this.rotation = new Array(3);
|
|
||||||
this.position = new Array(3);
|
|
||||||
this.euler = new Array(3);
|
|
||||||
this.size = 1.0;
|
|
||||||
this.alpha = 1.0;
|
|
||||||
this.zkey = 0.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
BlossomParticle.prototype.setVelocity = function (vx, vy, vz) {
|
|
||||||
this.velocity[0] = vx;
|
|
||||||
this.velocity[1] = vy;
|
|
||||||
this.velocity[2] = vz;
|
|
||||||
};
|
|
||||||
|
|
||||||
BlossomParticle.prototype.setRotation = function (rx, ry, rz) {
|
|
||||||
this.rotation[0] = rx;
|
|
||||||
this.rotation[1] = ry;
|
|
||||||
this.rotation[2] = rz;
|
|
||||||
};
|
|
||||||
|
|
||||||
BlossomParticle.prototype.setPosition = function (nx, ny, nz) {
|
|
||||||
this.position[0] = nx;
|
|
||||||
this.position[1] = ny;
|
|
||||||
this.position[2] = nz;
|
|
||||||
};
|
|
||||||
|
|
||||||
BlossomParticle.prototype.setEulerAngles = function (rx, ry, rz) {
|
|
||||||
this.euler[0] = rx;
|
|
||||||
this.euler[1] = ry;
|
|
||||||
this.euler[2] = rz;
|
|
||||||
};
|
|
||||||
|
|
||||||
BlossomParticle.prototype.setSize = function (s) {
|
|
||||||
this.size = s;
|
|
||||||
};
|
|
||||||
|
|
||||||
BlossomParticle.prototype.update = function (dt, et) {
|
|
||||||
this.position[0] += this.velocity[0] * dt;
|
|
||||||
this.position[1] += this.velocity[1] * dt;
|
|
||||||
this.position[2] += this.velocity[2] * dt;
|
|
||||||
|
|
||||||
this.euler[0] += this.rotation[0] * dt;
|
|
||||||
this.euler[1] += this.rotation[1] * dt;
|
|
||||||
this.euler[2] += this.rotation[2] * dt;
|
|
||||||
};
|
|
||||||
|
|
||||||
function createPointFlowers() {
|
|
||||||
// get point sizes
|
|
||||||
var prm = gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE);
|
|
||||||
renderSpec.pointSize = {'min':prm[0], 'max':prm[1]};
|
|
||||||
|
|
||||||
var vtxsrc = document.getElementById("sakura_point_vsh").textContent;
|
|
||||||
var frgsrc = document.getElementById("sakura_point_fsh").textContent;
|
|
||||||
|
|
||||||
pointFlower.program = createShader(
|
|
||||||
vtxsrc, frgsrc,
|
|
||||||
['uProjection', 'uModelview', 'uResolution', 'uOffset', 'uDOF', 'uFade'],
|
|
||||||
['aPosition', 'aEuler', 'aMisc']
|
|
||||||
);
|
|
||||||
|
|
||||||
useShader(pointFlower.program);
|
|
||||||
pointFlower.offset = new Float32Array([0.0, 0.0, 0.0]);
|
|
||||||
pointFlower.fader = Vector3.create(0.0, 10.0, 0.0);
|
|
||||||
|
|
||||||
// paramerters: velocity[3], rotate[3]
|
|
||||||
pointFlower.numFlowers = 1600;
|
|
||||||
pointFlower.particles = new Array(pointFlower.numFlowers);
|
|
||||||
// vertex attributes {position[3], euler_xyz[3], size[1]}
|
|
||||||
pointFlower.dataArray = new Float32Array(pointFlower.numFlowers * (3 + 3 + 2));
|
|
||||||
pointFlower.positionArrayOffset = 0;
|
|
||||||
pointFlower.eulerArrayOffset = pointFlower.numFlowers * 3;
|
|
||||||
pointFlower.miscArrayOffset = pointFlower.numFlowers * 6;
|
|
||||||
|
|
||||||
pointFlower.buffer = gl.createBuffer();
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, pointFlower.buffer);
|
|
||||||
gl.bufferData(gl.ARRAY_BUFFER, pointFlower.dataArray, gl.DYNAMIC_DRAW);
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
||||||
|
|
||||||
unuseShader(pointFlower.program);
|
|
||||||
|
|
||||||
for(var i = 0; i < pointFlower.numFlowers; i++) {
|
|
||||||
pointFlower.particles[i] = new BlossomParticle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function initPointFlowers() {
|
|
||||||
//area
|
|
||||||
pointFlower.area = Vector3.create(20.0, 20.0, 20.0);
|
|
||||||
pointFlower.area.x = pointFlower.area.y * renderSpec.aspect;
|
|
||||||
|
|
||||||
pointFlower.fader.x = 10.0; //env fade start
|
|
||||||
pointFlower.fader.y = pointFlower.area.z; //env fade half
|
|
||||||
pointFlower.fader.z = 0.1; //near fade start
|
|
||||||
|
|
||||||
//particles
|
|
||||||
var PI2 = Math.PI * 2.0;
|
|
||||||
var tmpv3 = Vector3.create(0, 0, 0);
|
|
||||||
var tmpv = 0;
|
|
||||||
var symmetryrand = function() {return (Math.random() * 2.0 - 1.0);};
|
|
||||||
for(var i = 0; i < pointFlower.numFlowers; i++) {
|
|
||||||
var tmpprtcl = pointFlower.particles[i];
|
|
||||||
|
|
||||||
//velocity
|
|
||||||
tmpv3.x = symmetryrand() * 0.3 + 0.8;
|
|
||||||
tmpv3.y = symmetryrand() * 0.2 - 1.0;
|
|
||||||
tmpv3.z = symmetryrand() * 0.3 + 0.5;
|
|
||||||
Vector3.normalize(tmpv3);
|
|
||||||
tmpv = 2.0 + Math.random() * 1.0;
|
|
||||||
tmpprtcl.setVelocity(tmpv3.x * tmpv, tmpv3.y * tmpv, tmpv3.z * tmpv);
|
|
||||||
|
|
||||||
//rotation
|
|
||||||
tmpprtcl.setRotation(
|
|
||||||
symmetryrand() * PI2 * 0.5,
|
|
||||||
symmetryrand() * PI2 * 0.5,
|
|
||||||
symmetryrand() * PI2 * 0.5
|
|
||||||
);
|
|
||||||
|
|
||||||
//position
|
|
||||||
tmpprtcl.setPosition(
|
|
||||||
symmetryrand() * pointFlower.area.x,
|
|
||||||
symmetryrand() * pointFlower.area.y,
|
|
||||||
symmetryrand() * pointFlower.area.z
|
|
||||||
);
|
|
||||||
|
|
||||||
//euler
|
|
||||||
tmpprtcl.setEulerAngles(
|
|
||||||
Math.random() * Math.PI * 2.0,
|
|
||||||
Math.random() * Math.PI * 2.0,
|
|
||||||
Math.random() * Math.PI * 2.0
|
|
||||||
);
|
|
||||||
|
|
||||||
//size
|
|
||||||
tmpprtcl.setSize(0.9 + Math.random() * 0.1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderPointFlowers() {
|
|
||||||
//update
|
|
||||||
var PI2 = Math.PI * 2.0;
|
|
||||||
var limit = [pointFlower.area.x, pointFlower.area.y, pointFlower.area.z];
|
|
||||||
var repeatPos = function (prt, cmp, limit) {
|
|
||||||
if(Math.abs(prt.position[cmp]) - prt.size * 0.5 > limit) {
|
|
||||||
//out of area
|
|
||||||
if(prt.position[cmp] > 0) {
|
|
||||||
prt.position[cmp] -= limit * 2.0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
prt.position[cmp] += limit * 2.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var repeatEuler = function (prt, cmp) {
|
|
||||||
prt.euler[cmp] = prt.euler[cmp] % PI2;
|
|
||||||
if(prt.euler[cmp] < 0.0) {
|
|
||||||
prt.euler[cmp] += PI2;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
for(var i = 0; i < pointFlower.numFlowers; i++) {
|
|
||||||
var prtcl = pointFlower.particles[i];
|
|
||||||
prtcl.update(timeInfo.delta, timeInfo.elapsed);
|
|
||||||
repeatPos(prtcl, 0, pointFlower.area.x);
|
|
||||||
repeatPos(prtcl, 1, pointFlower.area.y);
|
|
||||||
repeatPos(prtcl, 2, pointFlower.area.z);
|
|
||||||
repeatEuler(prtcl, 0);
|
|
||||||
repeatEuler(prtcl, 1);
|
|
||||||
repeatEuler(prtcl, 2);
|
|
||||||
|
|
||||||
prtcl.alpha = 1.0;//(pointFlower.area.z - prtcl.position[2]) * 0.5;
|
|
||||||
|
|
||||||
prtcl.zkey = (camera.matrix[2] * prtcl.position[0]
|
|
||||||
+ camera.matrix[6] * prtcl.position[1]
|
|
||||||
+ camera.matrix[10] * prtcl.position[2]
|
|
||||||
+ camera.matrix[14]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// sort
|
|
||||||
pointFlower.particles.sort(function(p0, p1){return p0.zkey - p1.zkey;});
|
|
||||||
|
|
||||||
// update data
|
|
||||||
var ipos = pointFlower.positionArrayOffset;
|
|
||||||
var ieuler = pointFlower.eulerArrayOffset;
|
|
||||||
var imisc = pointFlower.miscArrayOffset;
|
|
||||||
for(var i = 0; i < pointFlower.numFlowers; i++) {
|
|
||||||
var prtcl = pointFlower.particles[i];
|
|
||||||
pointFlower.dataArray[ipos] = prtcl.position[0];
|
|
||||||
pointFlower.dataArray[ipos + 1] = prtcl.position[1];
|
|
||||||
pointFlower.dataArray[ipos + 2] = prtcl.position[2];
|
|
||||||
ipos += 3;
|
|
||||||
pointFlower.dataArray[ieuler] = prtcl.euler[0];
|
|
||||||
pointFlower.dataArray[ieuler + 1] = prtcl.euler[1];
|
|
||||||
pointFlower.dataArray[ieuler + 2] = prtcl.euler[2];
|
|
||||||
ieuler += 3;
|
|
||||||
pointFlower.dataArray[imisc] = prtcl.size;
|
|
||||||
pointFlower.dataArray[imisc + 1] = prtcl.alpha;
|
|
||||||
imisc += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
//draw
|
|
||||||
gl.enable(gl.BLEND);
|
|
||||||
//gl.disable(gl.DEPTH_TEST);
|
|
||||||
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
||||||
|
|
||||||
var prog = pointFlower.program;
|
|
||||||
useShader(prog);
|
|
||||||
|
|
||||||
gl.uniformMatrix4fv(prog.uniforms.uProjection, false, projection.matrix);
|
|
||||||
gl.uniformMatrix4fv(prog.uniforms.uModelview, false, camera.matrix);
|
|
||||||
gl.uniform3fv(prog.uniforms.uResolution, renderSpec.array);
|
|
||||||
gl.uniform3fv(prog.uniforms.uDOF, Vector3.arrayForm(camera.dof));
|
|
||||||
gl.uniform3fv(prog.uniforms.uFade, Vector3.arrayForm(pointFlower.fader));
|
|
||||||
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, pointFlower.buffer);
|
|
||||||
gl.bufferData(gl.ARRAY_BUFFER, pointFlower.dataArray, gl.DYNAMIC_DRAW);
|
|
||||||
|
|
||||||
gl.vertexAttribPointer(prog.attributes.aPosition, 3, gl.FLOAT, false, 0, pointFlower.positionArrayOffset * Float32Array.BYTES_PER_ELEMENT);
|
|
||||||
gl.vertexAttribPointer(prog.attributes.aEuler, 3, gl.FLOAT, false, 0, pointFlower.eulerArrayOffset * Float32Array.BYTES_PER_ELEMENT);
|
|
||||||
gl.vertexAttribPointer(prog.attributes.aMisc, 2, gl.FLOAT, false, 0, pointFlower.miscArrayOffset * Float32Array.BYTES_PER_ELEMENT);
|
|
||||||
|
|
||||||
// doubler
|
|
||||||
for(var i = 1; i < 2; i++) {
|
|
||||||
var zpos = i * -2.0;
|
|
||||||
pointFlower.offset[0] = pointFlower.area.x * -1.0;
|
|
||||||
pointFlower.offset[1] = pointFlower.area.y * -1.0;
|
|
||||||
pointFlower.offset[2] = pointFlower.area.z * zpos;
|
|
||||||
gl.uniform3fv(prog.uniforms.uOffset, pointFlower.offset);
|
|
||||||
gl.drawArrays(gl.POINT, 0, pointFlower.numFlowers);
|
|
||||||
|
|
||||||
pointFlower.offset[0] = pointFlower.area.x * -1.0;
|
|
||||||
pointFlower.offset[1] = pointFlower.area.y * 1.0;
|
|
||||||
pointFlower.offset[2] = pointFlower.area.z * zpos;
|
|
||||||
gl.uniform3fv(prog.uniforms.uOffset, pointFlower.offset);
|
|
||||||
gl.drawArrays(gl.POINT, 0, pointFlower.numFlowers);
|
|
||||||
|
|
||||||
pointFlower.offset[0] = pointFlower.area.x * 1.0;
|
|
||||||
pointFlower.offset[1] = pointFlower.area.y * -1.0;
|
|
||||||
pointFlower.offset[2] = pointFlower.area.z * zpos;
|
|
||||||
gl.uniform3fv(prog.uniforms.uOffset, pointFlower.offset);
|
|
||||||
gl.drawArrays(gl.POINT, 0, pointFlower.numFlowers);
|
|
||||||
|
|
||||||
pointFlower.offset[0] = pointFlower.area.x * 1.0;
|
|
||||||
pointFlower.offset[1] = pointFlower.area.y * 1.0;
|
|
||||||
pointFlower.offset[2] = pointFlower.area.z * zpos;
|
|
||||||
gl.uniform3fv(prog.uniforms.uOffset, pointFlower.offset);
|
|
||||||
gl.drawArrays(gl.POINT, 0, pointFlower.numFlowers);
|
|
||||||
}
|
|
||||||
|
|
||||||
//main
|
|
||||||
pointFlower.offset[0] = 0.0;
|
|
||||||
pointFlower.offset[1] = 0.0;
|
|
||||||
pointFlower.offset[2] = 0.0;
|
|
||||||
gl.uniform3fv(prog.uniforms.uOffset, pointFlower.offset);
|
|
||||||
gl.drawArrays(gl.POINT, 0, pointFlower.numFlowers);
|
|
||||||
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
||||||
unuseShader(prog);
|
|
||||||
|
|
||||||
gl.enable(gl.DEPTH_TEST);
|
|
||||||
gl.disable(gl.BLEND);
|
|
||||||
}
|
|
||||||
|
|
||||||
// effects
|
|
||||||
//common util
|
|
||||||
function createEffectProgram(vtxsrc, frgsrc, exunifs, exattrs) {
|
|
||||||
var ret = {};
|
|
||||||
var unifs = ['uResolution', 'uSrc', 'uDelta'];
|
|
||||||
if(exunifs) {
|
|
||||||
unifs = unifs.concat(exunifs);
|
|
||||||
}
|
|
||||||
var attrs = ['aPosition'];
|
|
||||||
if(exattrs) {
|
|
||||||
attrs = attrs.concat(exattrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret.program = createShader(vtxsrc, frgsrc, unifs, attrs);
|
|
||||||
useShader(ret.program);
|
|
||||||
|
|
||||||
ret.dataArray = new Float32Array([
|
|
||||||
-1.0, -1.0,
|
|
||||||
1.0, -1.0,
|
|
||||||
-1.0, 1.0,
|
|
||||||
1.0, 1.0
|
|
||||||
]);
|
|
||||||
ret.buffer = gl.createBuffer();
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, ret.buffer);
|
|
||||||
gl.bufferData(gl.ARRAY_BUFFER, ret.dataArray, gl.STATIC_DRAW);
|
|
||||||
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
||||||
unuseShader(ret.program);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// basic usage
|
|
||||||
// useEffect(prog, srctex({'texture':texid, 'dtxArray':(f32)[dtx, dty]})); //basic initialize
|
|
||||||
// gl.uniform**(...); //additional uniforms
|
|
||||||
// drawEffect()
|
|
||||||
// unuseEffect(prog)
|
|
||||||
// TEXTURE0 makes src
|
|
||||||
function useEffect(fxobj, srctex) {
|
|
||||||
var prog = fxobj.program;
|
|
||||||
useShader(prog);
|
|
||||||
gl.uniform3fv(prog.uniforms.uResolution, renderSpec.array);
|
|
||||||
|
|
||||||
if(srctex != null) {
|
|
||||||
gl.uniform2fv(prog.uniforms.uDelta, srctex.dtxArray);
|
|
||||||
gl.uniform1i(prog.uniforms.uSrc, 0);
|
|
||||||
|
|
||||||
gl.activeTexture(gl.TEXTURE0);
|
|
||||||
gl.bindTexture(gl.TEXTURE_2D, srctex.texture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function drawEffect(fxobj) {
|
|
||||||
gl.bindBuffer(gl.ARRAY_BUFFER, fxobj.buffer);
|
|
||||||
gl.vertexAttribPointer(fxobj.program.attributes.aPosition, 2, gl.FLOAT, false, 0, 0);
|
|
||||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
||||||
}
|
|
||||||
function unuseEffect(fxobj) {
|
|
||||||
unuseShader(fxobj.program);
|
|
||||||
}
|
|
||||||
|
|
||||||
var effectLib = {};
|
|
||||||
function createEffectLib() {
|
|
||||||
|
|
||||||
var vtxsrc, frgsrc;
|
|
||||||
//common
|
|
||||||
var cmnvtxsrc = document.getElementById("fx_common_vsh").textContent;
|
|
||||||
|
|
||||||
//background
|
|
||||||
frgsrc = document.getElementById("bg_fsh").textContent;
|
|
||||||
effectLib.sceneBg = createEffectProgram(cmnvtxsrc, frgsrc, ['uTimes'], null);
|
|
||||||
|
|
||||||
// make brightpixels buffer
|
|
||||||
frgsrc = document.getElementById("fx_brightbuf_fsh").textContent;
|
|
||||||
effectLib.mkBrightBuf = createEffectProgram(cmnvtxsrc, frgsrc, null, null);
|
|
||||||
|
|
||||||
// direction blur
|
|
||||||
frgsrc = document.getElementById("fx_dirblur_r4_fsh").textContent;
|
|
||||||
effectLib.dirBlur = createEffectProgram(cmnvtxsrc, frgsrc, ['uBlurDir'], null);
|
|
||||||
|
|
||||||
//final composite
|
|
||||||
vtxsrc = document.getElementById("pp_final_vsh").textContent;
|
|
||||||
frgsrc = document.getElementById("pp_final_fsh").textContent;
|
|
||||||
effectLib.finalComp = createEffectProgram(vtxsrc, frgsrc, ['uBloom'], null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// background
|
|
||||||
function createBackground() {
|
|
||||||
//console.log("create background");
|
|
||||||
}
|
|
||||||
function initBackground() {
|
|
||||||
//console.log("init background");
|
|
||||||
}
|
|
||||||
function renderBackground() {
|
|
||||||
gl.disable(gl.DEPTH_TEST);
|
|
||||||
|
|
||||||
useEffect(effectLib.sceneBg, null);
|
|
||||||
gl.uniform2f(effectLib.sceneBg.program.uniforms.uTimes, timeInfo.elapsed, timeInfo.delta);
|
|
||||||
drawEffect(effectLib.sceneBg);
|
|
||||||
unuseEffect(effectLib.sceneBg);
|
|
||||||
|
|
||||||
gl.enable(gl.DEPTH_TEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
// post process
|
|
||||||
var postProcess = {};
|
|
||||||
function createPostProcess() {
|
|
||||||
//console.log("create post process");
|
|
||||||
}
|
|
||||||
function initPostProcess() {
|
|
||||||
//console.log("init post process");
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderPostProcess() {
|
|
||||||
gl.enable(gl.TEXTURE_2D);
|
|
||||||
gl.disable(gl.DEPTH_TEST);
|
|
||||||
var bindRT = function (rt, isclear) {
|
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, rt.frameBuffer);
|
|
||||||
gl.viewport(0, 0, rt.width, rt.height);
|
|
||||||
if(isclear) {
|
|
||||||
gl.clearColor(0, 0, 0, 0);
|
|
||||||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//make bright buff
|
|
||||||
bindRT(renderSpec.wHalfRT0, true);
|
|
||||||
useEffect(effectLib.mkBrightBuf, renderSpec.mainRT);
|
|
||||||
drawEffect(effectLib.mkBrightBuf);
|
|
||||||
unuseEffect(effectLib.mkBrightBuf);
|
|
||||||
|
|
||||||
// make bloom
|
|
||||||
for(var i = 0; i < 2; i++) {
|
|
||||||
var p = 1.5 + 1 * i;
|
|
||||||
var s = 2.0 + 1 * i;
|
|
||||||
bindRT(renderSpec.wHalfRT1, true);
|
|
||||||
useEffect(effectLib.dirBlur, renderSpec.wHalfRT0);
|
|
||||||
gl.uniform4f(effectLib.dirBlur.program.uniforms.uBlurDir, p, 0.0, s, 0.0);
|
|
||||||
drawEffect(effectLib.dirBlur);
|
|
||||||
unuseEffect(effectLib.dirBlur);
|
|
||||||
|
|
||||||
bindRT(renderSpec.wHalfRT0, true);
|
|
||||||
useEffect(effectLib.dirBlur, renderSpec.wHalfRT1);
|
|
||||||
gl.uniform4f(effectLib.dirBlur.program.uniforms.uBlurDir, 0.0, p, 0.0, s);
|
|
||||||
drawEffect(effectLib.dirBlur);
|
|
||||||
unuseEffect(effectLib.dirBlur);
|
|
||||||
}
|
|
||||||
|
|
||||||
//display
|
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
||||||
gl.viewport(0, 0, renderSpec.width, renderSpec.height);
|
|
||||||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
||||||
|
|
||||||
useEffect(effectLib.finalComp, renderSpec.mainRT);
|
|
||||||
gl.uniform1i(effectLib.finalComp.program.uniforms.uBloom, 1);
|
|
||||||
gl.activeTexture(gl.TEXTURE1);
|
|
||||||
gl.bindTexture(gl.TEXTURE_2D, renderSpec.wHalfRT0.texture);
|
|
||||||
drawEffect(effectLib.finalComp);
|
|
||||||
unuseEffect(effectLib.finalComp);
|
|
||||||
|
|
||||||
gl.enable(gl.DEPTH_TEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
/////
|
|
||||||
var SceneEnv = {};
|
|
||||||
function createScene() {
|
|
||||||
createEffectLib();
|
|
||||||
createBackground();
|
|
||||||
createPointFlowers();
|
|
||||||
createPostProcess();
|
|
||||||
sceneStandBy = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function initScene() {
|
|
||||||
initBackground();
|
|
||||||
initPointFlowers();
|
|
||||||
initPostProcess();
|
|
||||||
|
|
||||||
//camera.position.z = 17.320508;
|
|
||||||
camera.position.z = pointFlower.area.z + projection.nearfar[0];
|
|
||||||
projection.angle = Math.atan2(pointFlower.area.y, camera.position.z + pointFlower.area.z) * 180.0 / Math.PI * 2.0;
|
|
||||||
Matrix44.loadProjection(projection.matrix, renderSpec.aspect, projection.angle, projection.nearfar[0], projection.nearfar[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderScene() {
|
|
||||||
//draw
|
|
||||||
Matrix44.loadLookAt(camera.matrix, camera.position, camera.lookat, camera.up);
|
|
||||||
|
|
||||||
gl.enable(gl.DEPTH_TEST);
|
|
||||||
|
|
||||||
//gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
||||||
gl.bindFramebuffer(gl.FRAMEBUFFER, renderSpec.mainRT.frameBuffer);
|
|
||||||
gl.viewport(0, 0, renderSpec.mainRT.width, renderSpec.mainRT.height);
|
|
||||||
gl.clearColor(0.005, 0, 0.05, 0);
|
|
||||||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
||||||
|
|
||||||
renderBackground();
|
|
||||||
renderPointFlowers();
|
|
||||||
renderPostProcess();
|
|
||||||
}
|
|
||||||
|
|
||||||
/////
|
|
||||||
function onResize(e) {
|
|
||||||
makeCanvasFullScreen(document.getElementById("sakura"));
|
|
||||||
setViewports();
|
|
||||||
if(sceneStandBy) {
|
|
||||||
initScene();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setViewports() {
|
|
||||||
renderSpec.setSize(gl.canvas.width, gl.canvas.height);
|
|
||||||
|
|
||||||
gl.clearColor(0.2, 0.2, 0.5, 1.0);
|
|
||||||
gl.viewport(0, 0, renderSpec.width, renderSpec.height);
|
|
||||||
|
|
||||||
var rtfunc = function (rtname, rtw, rth) {
|
|
||||||
var rt = renderSpec[rtname];
|
|
||||||
if(rt) deleteRenderTarget(rt);
|
|
||||||
renderSpec[rtname] = createRenderTarget(rtw, rth);
|
|
||||||
};
|
|
||||||
rtfunc('mainRT', renderSpec.width, renderSpec.height);
|
|
||||||
rtfunc('wFullRT0', renderSpec.width, renderSpec.height);
|
|
||||||
rtfunc('wFullRT1', renderSpec.width, renderSpec.height);
|
|
||||||
rtfunc('wHalfRT0', renderSpec.halfWidth, renderSpec.halfHeight);
|
|
||||||
rtfunc('wHalfRT1', renderSpec.halfWidth, renderSpec.halfHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
function render() {
|
|
||||||
renderScene();
|
|
||||||
}
|
|
||||||
|
|
||||||
var animating = true;
|
|
||||||
function toggleAnimation(elm) {
|
|
||||||
animating ^= true;
|
|
||||||
if(animating) animate();
|
|
||||||
if(elm) {
|
|
||||||
elm.innerHTML = animating? "Stop":"Start";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function stepAnimation() {
|
|
||||||
if(!animating) animate();
|
|
||||||
}
|
|
||||||
|
|
||||||
function animate() {
|
|
||||||
var curdate = new Date();
|
|
||||||
timeInfo.elapsed = (curdate - timeInfo.start) / 1000.0;
|
|
||||||
timeInfo.delta = (curdate - timeInfo.prev) / 1000.0;
|
|
||||||
timeInfo.prev = curdate;
|
|
||||||
|
|
||||||
if(animating) requestAnimationFrame(animate);
|
|
||||||
render();
|
|
||||||
}
|
|
||||||
|
|
||||||
function makeCanvasFullScreen(canvas) {
|
|
||||||
var b = document.body;
|
|
||||||
var d = document.documentElement;
|
|
||||||
fullw = Math.max(b.clientWidth , b.scrollWidth, d.scrollWidth, d.clientWidth);
|
|
||||||
fullh = Math.max(b.clientHeight , b.scrollHeight, d.scrollHeight, d.clientHeight);
|
|
||||||
canvas.width = fullw;
|
|
||||||
canvas.height = fullh;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('load', function(e) {
|
|
||||||
var canvas = document.getElementById("sakura");
|
|
||||||
try {
|
|
||||||
makeCanvasFullScreen(canvas);
|
|
||||||
gl = canvas.getContext('experimental-webgl');
|
|
||||||
} catch(e) {
|
|
||||||
alert("WebGL not supported." + e);
|
|
||||||
console.error(e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('resize', onResize);
|
|
||||||
|
|
||||||
setViewports();
|
|
||||||
createScene();
|
|
||||||
initScene();
|
|
||||||
|
|
||||||
timeInfo.start = new Date();
|
|
||||||
timeInfo.prev = timeInfo.start;
|
|
||||||
animate();
|
|
||||||
});
|
|
||||||
|
|
||||||
//set window.requestAnimationFrame
|
|
||||||
(function (w, r) {
|
|
||||||
w['r'+r] = w['r'+r] || w['webkitR'+r] || w['mozR'+r] || w['msR'+r] || w['oR'+r] || function(c){ w.setTimeout(c, 1000 / 60); };
|
|
||||||
})(window, 'equestAnimationFrame');
|
|
||||||
Reference in New Issue
Block a user