Skip to content

Commit

Permalink
[docs] 标准化文档
Browse files Browse the repository at this point in the history
  • Loading branch information
Italink committed Nov 23, 2024
1 parent e3143dd commit 4000036
Show file tree
Hide file tree
Showing 16 changed files with 182 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Docs/00-C++/5.内存管理.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ int main(int argc,char** argv) {

尽量避免内存上下文的调整,可以有效增加缓存的命中率,人的大脑其实也有这样的机制,不信你看:

<iframe src="//player.bilibili.com/player.html?aid=218871639&bvid=BV1o8411x7aE&cid=855664393&page=1&autoplay=false" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
<p style="text-align:center"><iframe width="560" height="315" src="//player.bilibili.com/player.html?aid=218871639&bvid=BV1o8411x7aE&cid=855664393&page=1&autoplay=false" scrolling="no" border="0" frameborder="0" framespacing="0" allowfullscreen="true"></iframe></p>

关于缓存,这里有一篇更深入的文章:

Expand Down
3 changes: 3 additions & 0 deletions Docs/02-EngineTechnology/0.渲染架构.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
comments: true
---
# 渲染架构

在之前的章节中,我们学会了如何使用 **QRhi** 完成图形的绘制,但图形渲染并非只是使用图形API那么简单,随着3D场景中图形复杂度的提升,直接使用RHI的接口编写 线性的逻辑 会让代码变得非常混乱,而为了让代码的组织结构更为合理,现代图形引擎都会在 RHI 的基础上,进行进一步的封装。
Expand Down
3 changes: 3 additions & 0 deletions Docs/02-EngineTechnology/Waitting.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
---
comments: true
---
Waiting~~~
3 changes: 3 additions & 0 deletions Docs/03-GraphicsTechnology/Waitting.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
---
comments: true
---
Waiting~~~
3 changes: 3 additions & 0 deletions Docs/04-UnrealEngine/+.虚幻开发者的基本素养.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
comments: true
---
## 工程管理

## 资产管理
Expand Down
2 changes: 1 addition & 1 deletion Docs/04-UnrealEngine/7.音频开发.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ comments: true

长久以来,渲染一直是图形引擎的热点,而音频似乎很难吸引开发者的注意力,但实际上,音频除了可以增加沉浸式的交互体验,还能进一步增加画面的表现力:

<iframe src="//player.bilibili.com/player.html?aid=797879954&bvid=BV1iy4y167pf&cid=259593464&p=1&autoplay=false" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
<p style="text-align:center"><iframe width="560" height="315" src="//player.bilibili.com/player.html?aid=797879954&bvid=BV1iy4y167pf&cid=259593464&p=1&autoplay=false" scrolling="no" border="0" frameborder="0" framespacing="0" allowfullscreen="true"></iframe></p>

笔者也正是因此,点燃了对程序开发的热情,为了让音频能有更好的图形表现效果,这才入了图形引擎的坑~

Expand Down
3 changes: 3 additions & 0 deletions Docs/04-UnrealEngine/8.开放场景搭建.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
comments: true
---
# 开放场景


Expand Down
5 changes: 1 addition & 4 deletions Docs/05-OpenSource/Qt桌面水面波纹特效.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ comments: true

- Github仓库:https://github.com/Italink/DesktopWaveEffect.git

<p style="text-align:center">
<iframe width="560" height="315" src="//player.bilibili.com/player.html?isOutside=true&aid=753422025&bvid=BV1yk4y1B72b&cid=197938359&p=1&autoplay=false" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true">
</iframe>
</p>
<p style="text-align:center"><iframe width="560" height="315" src="//player.bilibili.com/player.html?isOutside=true&aid=753422025&bvid=BV1yk4y1B72b&cid=197938359&p=1&autoplay=false" scrolling="no" border="0" frameborder="0" framespacing="0" allowfullscreen="true"></iframe></p>

![img](Resources/6c6942fc23e6d499a06203ccb8e73992.png)

Expand Down
11 changes: 2 additions & 9 deletions Docs/05-OpenSource/音频可视化软件-Specinker.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,14 @@ Spec的初衷是为了让笔者自己能学到一些音视频、图形相关的

本科毕业答辩PPT演示:

<p style="text-align:center">
<iframe width="560" height="315" src="//player.bilibili.com/player.html?bvid=BV1f44y1z7qi&cid=348421166&p=1&share_source=copy_web&autoplay=false" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true">
</iframe>
</p>

<p style="text-align:center"><iframe width="560" height="315" src="//player.bilibili.com/player.html?bvid=BV1f44y1z7qi&cid=348421166&p=1&share_source=copy_web&autoplay=false" scrolling="no" border="0" frameborder="0" framespacing="0" allowfullscreen="true"></iframe></p>
## **Specinker是什么?**

Specinker是up耗时一年呕心沥血制作的一个音频可视化图形引擎, 它具备很多的图形效果,包含一些基础的频谱图形,特效滤镜,粒子系统,3D模型等,up把这些图形进行了封装,公开了一些可调整的参数,你甚至可以为这些参数编写lua脚本以实现动态的效果(比如说自动旋转、跟踪鼠标、跟随节奏移动......)

## **视频教程**

<p style="text-align:center">
<iframe width="560" height="315" src="//player.bilibili.com/player.html?isOutside=true&aid=335187087&bvid=BV1XA411c7vb&cid=398619724&p=1&autoplay=false" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true">
</iframe>
</p>
<p style="text-align:center"><iframe width="560" height="315" src="//player.bilibili.com/player.html?isOutside=true&aid=335187087&bvid=BV1XA411c7vb&cid=398619724&p=1&autoplay=false" scrolling="no" border="0" frameborder="0" framespacing="0" allowfullscreen="true"></iframe></p>

## **Specinker的功能亮点**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ categories:

第一次演讲在开学之后的第五周,此时音频分析引擎基本完成,能够播放音频显示简单的音频简单频谱。看过雨滴制作的一些皮肤之后,感觉效果不是很理想。![img](Resources/bf1cbdaa7fb784dd8fba7a1cfd803317.png)

<iframe src="//player.bilibili.com/player.html?isOutside=true&aid=68047699&bvid=BV1PJ411w7sM&cid=117945274&p=1&autoplay=false" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
<p style="text-align:center"><iframe width="560" height="315" src="//player.bilibili.com/player.html?isOutside=true&aid=68047699&bvid=BV1PJ411w7sM&cid=117945274&p=1&autoplay=false" scrolling="no" border="0" frameborder="0" framespacing="0" allowfullscreen="true"></iframe></p>

<!-- more -->

Expand Down
2 changes: 1 addition & 1 deletion Docs/06-Blog/Posts/整活/Qt 3D UI.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ categories:

不过现在能做好多有意思的东西了~

<iframe src="https://vdn6.vzuu.com/SD/652a8c62-6ce8-11ee-88b7-d2e6d33fcc65-v8_f2_t1_A2to2a0O.mp4?pkey=AAUFPh49yrEREFjNGW-ETwUINkkyFvAo8WBfpUU-D6dLjf_7x0tH7JZLjN4hV7Wp0Nax4nrkt9zhPXgE9RHXRKx7&bu=1513c7c2&c=avc.8.0&expiration=1732382722&f=mp4&pu=3a8548f7&v=ks6&pp=ChMxNDAxNjIzODY1NzM5NTc5MzkyGGMiC2ZlZWRfY2hvaWNlMhMxMzY5MDA1NjA4NTk5OTA0MjU3PXu830Q%3D&pf=Web&pt=zhihu" scrolling="no" seamless align="middle" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
<p style="text-align:center"><iframe width="560" height="315" src="https://vdn6.vzuu.com/SD/652a8c62-6ce8-11ee-88b7-d2e6d33fcc65-v8_f2_t1_A2to2a0O.mp4?pkey=AAUFPh49yrEREFjNGW-ETwUINkkyFvAo8WBfpUU-D6dLjf_7x0tH7JZLjN4hV7Wp0Nax4nrkt9zhPXgE9RHXRKx7&bu=1513c7c2&c=avc.8.0&expiration=1732382722&f=mp4&pu=3a8548f7&v=ks6&pp=ChMxNDAxNjIzODY1NzM5NTc5MzkyGGMiC2ZlZWRfY2hvaWNlMhMxMzY5MDA1NjA4NTk5OTA0MjU3PXu830Q%3D&pf=Web&pt=zhihu" scrolling="no" border="0" frameborder="0" framespacing="0" allowfullscreen="true"></iframe></p>

Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ categories:

小秀一波,文章跳票了,憋了这么久,这次应该会是一个比较正式的独立软件。

<iframe src="https://vdn6.vzuu.com/HD/e6eb9fdc-9cd8-11ee-b7bf-d26cc6cc8782-v8_f2_t1_wDmp8StY.mp4?pkey=AAW8TpcxKrdMPbKnRWXom_0IBB-JCdZn2RYWl_OL8LGBt8iwYQO7NEaPzTxpUmsSe8kKibU4rcA2MrR0_4uB6yZA&bu=1513c7c2&c=avc.8.0&expiration=1732384041&f=mp4&pu=3a8548f7&v=ks6&pp=ChMxNDAxNjIzODY1NzM5NTc5MzkyGGMiC2ZlZWRfY2hvaWNlMhMxMzY5MDA1NjA4NTk5OTA0MjU3PXu830Q%3D&pf=Web&pt=zhihu" scrolling="no" seamless align="middle" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
<p style="text-align:center"><iframe width="560" height="315" src="https://vdn6.vzuu.com/HD/e6eb9fdc-9cd8-11ee-b7bf-d26cc6cc8782-v8_f2_t1_wDmp8StY.mp4?pkey=AAW8TpcxKrdMPbKnRWXom_0IBB-JCdZn2RYWl_OL8LGBt8iwYQO7NEaPzTxpUmsSe8kKibU4rcA2MrR0_4uB6yZA&bu=1513c7c2&c=avc.8.0&expiration=1732384041&f=mp4&pu=3a8548f7&v=ks6&pp=ChMxNDAxNjIzODY1NzM5NTc5MzkyGGMiC2ZlZWRfY2hvaWNlMhMxMzY5MDA1NjA4NTk5OTA0MjU3PXu830Q%3D&pf=Web&pt=zhihu" scrolling="no" border="0" frameborder="0" framespacing="0" allowfullscreen="true"></iframe></p>

3 changes: 3 additions & 0 deletions Docs/06-Blog/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
---
comments: true
---
# Blog

3 changes: 3 additions & 0 deletions Docs/MkdocsRepair/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
comments: true
---
# MkdocsRepair

用于修复 Typora 中的 加粗语法 与 mkdocs html 解析不一致的问题
161 changes: 150 additions & 11 deletions Docs/MkdocsRepair/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,149 @@
#include <iostream>
#include <filesystem>
#include <fstream>
#include <regex>

using namespace std;
using namespace std::filesystem;

bool isSeparator(const char& ch) {
return ch == '\n'|| ch == ' '||ch == '\t';
return ch == '\n' || ch == ' ' || ch == '\t';
}

std::string repair(const std::string& str) {
bool containsSubstring(const std::string& str, const std::string& target) {
return str.find(target) != std::string::npos;
}

bool startsWithRegex(const std::string& str, const std::regex& pattern) {
std::smatch match;
if (std::regex_search(str, match, pattern)) {
return match.position() == 0;
}
return false;
}

void replaceAll(std::string& str, const std::string& old_str, const std::string& new_str) {
size_t pos = 0;
while ((pos = str.find(old_str, pos)) != std::string::npos) {
str.replace(pos, old_str.length(), new_str);
pos += new_str.length();
}
}

std::string extractMetaData(const std::string& input) {
std::regex pattern("---\n((?:.|\n)*?)---\n", std::regex_constants::ECMAScript );
std::sregex_iterator it(input.begin(), input.end(), pattern);
std::sregex_iterator end;
if (it != end) {
return it->str(1);
}
return "";
}

std::vector<std::string> extractVideoUrls(const std::string& input) {
std::vector<std::string> result;
std::regex pattern("<\\w+ .*</\\w+>", std::regex_constants::ECMAScript | std::regex::optimize );
std::sregex_iterator it(input.begin(), input.end(), pattern);
std::sregex_iterator end;
while (it != end) {
result.push_back(it->str());
++it;
}
return result;
}

#include <iostream>
#include <regex>
#include <string>
#include <vector>

#include <iostream>
#include <regex>
#include <string>
#include <vector>

#include <iostream>
#include <regex>
#include <string>
#include <vector>

#include <iostream>
#include <regex>
#include <string>
#include <vector>

// 用于从匹配到的<iframe>字符串中提取src的值,并根据条件处理后返回标准化后的<iframe>字符串
std::string processIframeMatch(const std::string& matchStr) {
// 从匹配到的字符串中提取src的值
std::regex srcRegex("src=(['\"])([^'\"]+)\\1|src=([^'\"\\s>]+)");
std::smatch srcMatch;
if (std::regex_search(matchStr, srcMatch, srcRegex)) {
std::string srcValue;
if (!srcMatch[2].str().empty()) {
// 匹配到带引号的src属性值
srcValue = srcMatch[2].str();
}
else if (!srcMatch[3].str().empty()) {
// 匹配到不带引号的src属性值
srcValue = srcMatch[3].str();
}

if (srcValue.find("bilibili") != std::string::npos && srcValue.find("&autoplay=false") == std::string::npos) {
// 如果src值中包含bilibili且不存在&autoplay=false,补充&autoplay=false
if (srcValue.find('?') != std::string::npos) {
srcValue += "&autoplay=false";
}
else {
srcValue += "?autoplay=false";
}
}

return "<p style=\"text-align:center\"><iframe width=\"560\" height=\"315\" src=\"" + srcValue + "\" scrolling=\"no\" border=\"0\" frameborder=\"0\" framespacing=\"0\" allowfullscreen=\"true\"></iframe></p>";
}

return matchStr;
}

std::string standardizeIframeTags(const std::string& input) {
// 定义正则表达式,用于匹配各种形式的<iframe>标签所在的整行文本
std::regex iframeRegex("^.*<iframe\\s+[^>]*>\\s*</iframe>.*$");

// 用于存储匹配结果的向量
std::vector<std::string> matches;

// 进行正则表达式匹配,将所有匹配到的包含<iframe>标签的整行文本存储到matches向量中
std::sregex_iterator it(input.begin(), input.end(), iframeRegex);
std::sregex_iterator end;
for (; it != end; ++it) {
matches.push_back(it->str());
}

// 用处理后的<iframe>字符串替换原字符串中的相应部分
std::string output = input;
for (const auto& match : matches) {
// 检查是否已经是完整的标准化格式,如果不是则进行替换
if (!std::regex_search(match, std::regex("^<p style=\"text-align:center\"><iframe\\s+[^>]*>\\s*</iframe></p>$"))) {
std::string replacement = processIframeMatch(match);
size_t pos = output.find(match);
if (pos != std::string::npos) {
output.replace(pos, match.length(), replacement);
}
}
}

return output;
}

std::string repair(const std::string& content) {
std::string result;
result.reserve(str.size());
result.reserve(content.size());
bool isLeft = true;
bool inCode = false;
bool inTip = false;
int XingCounter = 0;
int dddCounter = 0;
for (int i = 0; i < str.size(); i++) {
result = result + str[i];
for (int i = 0; i < content.size(); i++) {
result = result + content[i];
if (result.back() == '`') {
dddCounter++;
}
Expand Down Expand Up @@ -55,33 +180,47 @@ std::string repair(const std::string& str) {
XingCounter = 0;
}
}

std::string metaData = extractMetaData(result);
if (metaData.empty()) {
result = "---\ncomments: true\n---\n" + result;
}
else if (!containsSubstring(metaData, "comments: true")) {
replaceAll(result, metaData, metaData + "comments: true\n");
}

result = standardizeIframeTags(result);

//for (const std::string& videoUrl : extractVideoUrls(result)) {
// std::cout << videoUrl <<std::endl;
//}
return result;
}

void traverse(directory_iterator trans, string str = " ") {
while (!trans._At_end()) {
directory_iterator it = trans;
if ((*it).is_directory()) {
try { //可能访问到系统文件导致权限不够,所以这里需要进行异常处理
try { //可能访问到系统文件导致权限不够,所以这里需要进行异常处理
printf("%s \n", it->path().string().c_str());
traverse(directory_iterator((*it).path()), str + (trans._At_end() ? " " : ""));
traverse(directory_iterator((*it).path()), str + (trans._At_end() ? " " : ""));
}
catch (filesystem_error s) {
continue;
}
}
else if(it->is_regular_file()) {
else if (it->is_regular_file()) {
const string& ext = it->path().extension().string();
if (ext == ".md"|| ext == ".MD"|| ext == ".mD" || ext == ".Md") {
printf("%s \n",it->path().string().c_str());
if (ext == ".md" || ext == ".MD" || ext == ".mD" || ext == ".Md") {
printf("%s \n", it->path().string().c_str());
std::ifstream fin(it->path());
std::stringstream buffer;
buffer << fin.rdbuf();
const std::string& str = buffer.str();
fin.close();
const string& result = repair(str);
std::ofstream fout(it->path());
fout<<result;
fout << result;
fout.close();
}
}
Expand Down
3 changes: 3 additions & 0 deletions Docs/Waitting.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
---
comments: true
---
Waiting~~~

0 comments on commit 4000036

Please sign in to comment.