約 2,858,366 件
https://w.atwiki.jp/sampleisbest/pages/520.html
開発環境 Microsoft Visual Studio Community 2017 実行環境 Microsoft Windows 10 Home (64-bit) プロジェクトの種類 Visual C++ / 空のプロジェクト プロジェクト名 waveloop3 waveloop3.cpp // プロジェクトのプロパティ // Unicode文字セット #pragma comment(lib, "winmm") #include Windows.h #include wchar.h #include vector #include "Resource.h" using namespace std; typedef struct { int msec; int freq; } Sequence; #define SAMPLE_RATE 44100 #define BUFFERS 2 #define BUF_LEN 2048 #define TIMEBASE 24 // 関数プロトタイプ宣言 void Trace(LPCWSTR format, ...); INT_PTR CALLBACK MainDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); void Init(); void Timer(HWND hDlg); void GenerateWaveForm(LPWAVEHDR pwh); void Play(HWND hDlg); void Stop(HWND hDlg); void SetFreq(int freq); // グローバル変数 HWAVEOUT hwo = NULL; WAVEHDR wh[BUFFERS]; BYTE waveform[BUFFERS][BUF_LEN]; bool playing = false; int wavefreq; int phase; vector Sequence seq; int nseq; DWORD start; int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) { DialogBox(hInstance, MAKEINTRESOURCE(IDD_MAINDLG), NULL, MainDlg); return 0; } void Trace(LPCWSTR format, ...) { va_list arg_ptr; WCHAR buffer[256]; va_start(arg_ptr, format); int size = _vsnwprintf_s(buffer, _TRUNCATE, format, arg_ptr); va_end(arg_ptr); OutputDebugString(buffer); } INT_PTR CALLBACK MainDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { INT_PTR ret = TRUE;// メッセージを処理した switch (message) { case MM_WOM_DONE if (playing) { Timer(hDlg); GenerateWaveForm((LPWAVEHDR)lParam); } break; //case MM_WOM_OPEN //case MM_WOM_CLOSE case WM_COMMAND switch (LOWORD(wParam)) { case IDC_PLAY Play(hDlg); break; case IDC_STOP Stop(hDlg); break; case IDCANCEL EndDialog(hDlg, IDCANCEL); break; } break; case WM_INITDIALOG Init(); ret = TRUE;// SetFocusでフォーカスを設定した場合はFALSE break; case WM_CLOSE Stop(hDlg); ret = FALSE; break; default ret = FALSE;// メッセージを処理しなかった } return ret; } void Init() { int tempo = 120; int notes[] = { 60, 24, 62, 24, 64, 24, 65, 24, 64, 24, 62, 24, 60, 24, 0, 24, }; Sequence s; int elapse = 100;// wait for (int i = 0; i _countof(notes); i += 2) { int gate = (int)((notes[i + 1] / (double)TIMEBASE) * (60.0 / tempo) * 1000); s.msec = elapse; s.freq = (notes[i] == 0) ? 0 (int)(440 * pow(2, (notes[i] - 69) / 12.0)); seq.push_back(s); elapse += gate; } s.msec = elapse; s.freq = 0; seq.push_back(s); } void Timer(HWND hDlg) { int dur = (int)(GetTickCount() - start); if (seq[nseq].msec = dur) { SetFreq(seq[nseq].freq); nseq++; if ((int)(seq.size()) = nseq) Stop(hDlg); } } void GenerateWaveForm(LPWAVEHDR pwh) { LPBYTE data = (LPBYTE)(pwh- lpData); for (int i = 0; i BUF_LEN; i++) { phase += wavefreq; if (SAMPLE_RATE = phase) phase -= SAMPLE_RATE; double t = phase / (double)SAMPLE_RATE; data[i] = 128 + (t 0.5 ? 1 -1) * 10; } waveOutWrite(hwo, pwh, sizeof WAVEHDR); } //// void Play(HWND hDlg) { Trace(L"Play()\n"); EnableWindow(GetDlgItem(hDlg, IDC_PLAY), FALSE); playing = true; SetFreq(0); nseq = 0; start = GetTickCount(); MMRESULT mmr; WAVEFORMATEX wfx; wfx.wFormatTag = WAVE_FORMAT_PCM; wfx.nChannels = 1; wfx.nSamplesPerSec = SAMPLE_RATE; wfx.nAvgBytesPerSec = SAMPLE_RATE; wfx.nBlockAlign = 1; wfx.wBitsPerSample = 8; wfx.cbSize = 0; mmr = waveOutOpen( hwo, WAVE_MAPPER, wfx, (DWORD_PTR)hDlg, NULL, CALLBACK_WINDOW); Trace(L"waveOutOpen %u\n", mmr); for (int i = 0; i BUFFERS; i++) { LPWAVEHDR pwh = wh + i; pwh- lpData = (LPSTR)(waveform[i]); pwh- dwBufferLength = BUF_LEN; pwh- dwFlags = 0; mmr = waveOutPrepareHeader(hwo, pwh, sizeof WAVEHDR); Trace(L"waveOutPrepareHeader %d %u\n", i, mmr); GenerateWaveForm(pwh); } } void Stop(HWND hDlg) { Trace(L"Stop()\n"); EnableWindow(GetDlgItem(hDlg, IDC_PLAY), TRUE); playing = false; if (hwo) { MMRESULT mmr; mmr = waveOutReset(hwo); Trace(L"waveOutReset %u\n", mmr); for (int i = 0; i BUFFERS; i++) { mmr = waveOutUnprepareHeader(hwo, wh + i, sizeof WAVEHDR); Trace(L"waveOutUnprepareHeader %d %u\n", i, mmr); } mmr = waveOutClose(hwo); Trace(L"waveOutClose %u\n", mmr); hwo = NULL; } } void SetFreq(int freq) { wavefreq = freq; phase = 0; } Resource.h #define IDD_MAINDLG100 //#define IDT_TIMER101 #define IDC_STATIC-1 #define IDC_PLAY1000 #define IDC_STOP1001 waveloop3.rc // resource script #include windows.h #include "resource.h" IDD_MAINDLG DIALOGEX 100, 100, 320, 200 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW CAPTION "waveloop3" FONT 9, "MS UI Gothic" BEGIN PUSHBUTTON"Play( P)", IDC_PLAY, 10, 10, 50, 15 PUSHBUTTON"Stop( S)", IDC_STOP, 70, 10, 50, 15 END
https://w.atwiki.jp/ns2best/pages/4.html
ニュース @wikiのwikiモードでは #news(興味のある単語) と入力することで、あるキーワードに関連するニュース一覧を表示することができます 詳しくはこちらをご覧ください。 =>http //www1.atwiki.jp/guide/pages/266.html#id_542badf7 たとえば、#news(ゲーム)と入力すると以下のように表示されます。 台北ゲームショウ2023現地リポート。4日間で30万人が来場する、東京ゲームショウとはまた違う魅力と特徴のあるイベント - ファミ通.com エジプト考古学者による時代考証済み!『Pharaoh A New Era』ゲームプレイトレイラー公開―ミッション攻略はかなり高難易度 ... - Game*Spark 「札幌発ゲームの開発を」 セガ札幌スタジオ・瀬川社長講演 道政経懇:北海道新聞デジタル - 北海道新聞 「BLUE REFLECTION SUN/燦」,リリース直前生放送が2月14日に ... - 4Gamer.net ユニークな物理系パズルゲーム「IDEA」,3月8日のリリースを発表。白い電球を転がして,アイデアを開花させよう - 4Gamer.net FALL OUT BOY(フォール・アウト・ボーイ)、NHLオールスター ... - TOWER RECORDS ONLINE 村上隆の代表作“お花”のキャラを育てるデジタル育成ゲームが登場 ... - smart ニコリのパズルゲーム『橋をかけろ』がSwitch/PC/Xbox One向けに2月9日から配信開始。数字と数字を線でつなぐ、誰でも遊べて頭を使うルール - ファミ通.com NFLとDAZNが長期契約を締結、来季からゲームパス ... - NFL日本公式サイト 協力謎解きゲーム『How 2 Escape』発表。2人がそれぞれPCとスマホで ... - AUTOMATON テンセント、人気ゲーム「ヴァロラント」リーグ設立計画-統制 ... - ブルームバーグ トレーニングゲーム vs FC延岡AGATA 試合結果について - ガイナーレ鳥取 2023シーズンホームゲーム 場外ステージイベント出演者募集のお知らせ - レノファ山口FC 【3月17日、18日】サントリーサンバーズ住吉ホームゲーム ファン ... - サントリー 5つの文明が覇を争うボードゲーム「モニュメンタル」の日本語版が ... - 4Gamer.net スクエニ牧場RPG『ハーヴェステラ』最新アプデ配信。ゲーム終盤の“あの ... - AUTOMATON 自分好みにカスタマイズできるモジュール型アケコンが,海外の ... - 4Gamer.net 【アケアカ】ハムスターがゲームメーカー“アルュメ”のタイトルの権利を取得。第1弾『アケアカ まじかるスピード』が2月9日に配信決定! - ファミ通.com ハムスター,アルュメのゲームなどに関する全権利を取得。第1弾タイトル「アーケードアーカイブス まじかる ... - 4Gamer.net 宿屋の予約を勝ち取れ!ブラフと先読みのボードゲーム『オーバー ... - Dream News メタバースゲーム「The Sandbox(サンドボックス)」、サウジ政府機関とMOU締結 - CRYPTO TIMES 八戸市で避難所運営手順の図上訓練 ゲーム感覚で学ぶ|NHK 青森県 ... - nhk.or.jp スマートフォン向けリズムゲーム「D4DJ Groovy Mix」イベント&ガチャ ... - みんかぶ インディーズのロボットゲーム10作品を一堂に集めた ... - 4Gamer.net Steam乗り物づくりゲーム『Astronimo』発表。最大4人で乗り物作成 ... - AUTOMATON くにおくん風2on2バスケゲーム『Street Basket Challenge』がSteamに近日登場! - Game*Spark Gリーグ・ネクストアップゲームの出場選手決定 馬場雄大は選外 ... - Sporting News ドット絵でコマンドバトルのゾンビゲーム『ゾンビ・オブ・ザ ... - Yahoo!ニュース 新作リアル脱出ゲーム『探偵博物館 シャーロックミュージアムからの脱出』開催決定 - http //spice.eplus.jp/ TVアニメ『スパイ教室』初のプライズ商品が、全国のゲーム ... - PR TIMES クラウドゲーム×配信者「“視聴”と“遊ぶ”をシームレスに連携 ... - PR TIMES ゲームクリエイターズギルド×慶應義塾大学 社会&ビジネスゲーム ... - PR TIMES 茨城・つくばの並木中 SDGs版「人生ゲーム」で授業 17目標、学び ... - 茨城新聞クロスアイ 生徒と奏でる青春育成ゲーム『ウインドボーイズ!』過去の限定 ... - PR TIMES 【ゲーム情報】八王子戦 CLUB BIGBULLS抽選会の賞品は・・・? - bigbulls.jp 『TOKYO INDIE GAMES SUMMIT』 本日よりチケット販売開始 ... - PR TIMES YouTube ライブで遊べる参加型ゲームプラットフォーム fingger ... - PR TIMES [プレイレポ]「Axie Infinity Origins」のゲームシステムや賞金額を紹介。東南アジアで人気を集めるブロック ... - 4Gamer.net ここはどこ……? 場所当てゲーム「GeoGuessr」がVTuberの間で流行 - Mogura VR Sensor Tower、優れたモバイルゲーム/アプリを表彰する「APAC Awards ... - SocialGameInfo 『fingger』リリースゲームやTGS2022出展、『VALORANT』大会 ... - 電撃オンライン 【特集】 4KやレイトレゲームもサクサクなRTX 4090搭載 ... - PC Watch 【リポート】ネッツのデュラントがオールスターゲームを欠場へ ... - Sporting News インディーズゲームの小部屋:Room#770「Vengeful Guardian ... - 4Gamer.net ゲームチェンジの好機 - 愛媛新聞 大ヒットゲームから新たなCG長編誕生!監獄島が恐怖に染まる ... - Yahoo!ニュース 中国モバイルゲームトップ30の海外売上高、総額約1兆2200億円 米・日 ... - 36Kr Japan ボールの代わりに人間をぶん投げるバカスポーツゲーム『Grab n Throw ... - Game*Spark カードゲームで災害対応学ぶ 伊勢・明倫小、意見出し合う 三重 ... - Yahoo!ニュース 【調査レポート】スマホに入っているゲームアプリの数は?「2つ ... - PR TIMES 「胸を盛らず“素の状態”で勝負しました」ゲームヒロインに扮する ... - Yahoo!ニュース 動画配信、ゲーム市場に熱視線 - 日本経済新聞 『STAR WARS ジェダイ:サバイバー』から9分間のゲームプレイ映像を公開!新たな惑星で始まるカルの冒険 - IGN Japan ボードゲームも「独占」から「分かち合い」へ! シェア経済を体験 ... - greenz.jp 「ゲーム好きのための婚活パーティー in TZ GAME Labs」3月4日に ... - 4Gamer.net 「爆雪の日にできるカスゲーム紹介」じゃんけんに負けたメイド姿 ... - Yahoo!ニュース 単語パズル「Wordle」を解きつつアクションゲーム「Flappy Bird ... - GIGAZINE(ギガジン) 大阪南港ATCで人気ゲーム「ペルソナ」展 原画や「イザナギ」等身 ... - Yahoo!ニュース 小学3年生のプログラマー 妹のために作ったゲームで全国大会へ ... - Yahoo!ニュース 「コナステ メダルコーナー」,ビデオシングルゲーム“フィーチャー ... - 4Gamer.net 「命は清き焔」―ゲーム音楽ライブ復活の象徴的イベント ... - Yahoo!ニュース 『ポケモンSV』が任天堂ゲーム専用機ソフトとして過去最高の初動販売数を記録。Switch(有機EL)が販売台数を伸ばす【任天堂決算】 - ファミ通.com 飛行船で旅するキュートな貿易ゲーム『Townseek』デモ版がSteam ... - Yahoo!ニュース テレビ大阪「音楽爆弾」,2月8日放送回はゲーム音楽の裏側を徹底 ... - 4Gamer.net 『更年期が幸年期になるカードゲーム』をつかう研修で「更年期 ... - PR TIMES 「レトロゲーム」の価格高騰、若者・外国人から人気で数万円以上に…投資目的の買い占めも - 読売新聞オンライン 「ドラえもん人生ゲーム ひみつ道具で大冒険!」発売決定! 3つの ... - Yahoo!ニュース 2023/3/4・5 埼玉県上尾大会 ホームゲーム情報|埼玉上尾 ... - 上尾中央医科グループ NCSOFT新作カジュアルマッチ3パズルゲーム『パズアップ ... - ファミ通App 『Atomic Heart』台北ゲームショウで球状のボスとの戦闘シーンなど ... - Yahoo!ニュース 「格ゲー×ローグライク」という唯一無二のゲーム、『TOBAL2』の ... - Yahoo!ニュース 確定申告をゲーム実況で解説する動画が大反響!国税庁が語った ... - Yahoo!ニュース 「やはりゲームでも俺の青春ラブコメはまちがっている。完 ... - Yahoo!ニュース 『ホグワーツ・レガシー』15時間プレイレビュー。緻密に再現された『ハリー・ポッター』の世界に感動、俺TUEEEな魔法アクションも爽快 - ファミ通.com VTuber効果?「イカゲーム」風デスゲーム『Crab Game』の ... - Yahoo!ニュース マルチな才能を持つ赤松健氏のパソコンゲームデビュー作 ... - Yahoo!ニュース マルチな才能を持つ赤松健氏のパソコンゲームデビュー作『パラディン』 - AKIBA PC Hotline! 川崎フロンターレ:2/17 横浜FM「ホームゲーム開催情報」について - 川崎フロンターレ 『鉄拳8』に「ニーナ・ウィリアムズ」が参戦決定!ゲームプレイ ... - Yahoo!ニュース 「死の宣告」と投稿…ゲームセンターが電気料金値上げで悲鳴 年間 ... - Yahoo!ニュース 『ホグワーツ・レガシー』情報まとめ。『ハリー・ポッター』のオープンワールドアクションRPG。デラックス・エディションは明日(2/7)からプレイ可能 - ファミ通.com 『シン・クロニクル』総合ディレクター松永純氏と『ギ・クロニクル』朗読に参加した声優・相良茉優さんが登場! ゲームのニュース番組『ゲームのお天気お姉さん』2月7日(火)夜8時から配信開始 - 電ファミニコゲーマー 無料プレイゲームの『Warlander』が急浮上!『ホグワーツ ... - Yahoo!ニュース 「セガを殺せ」謎のスマホゲームプロジェクト始動 ティザー映像は ... - Yahoo!ニュース 「ホグワーツ・レガシー」が発売前日にトレンド入り! ハリポタ世界への没入体験に期待高まる 「違法アバダケダブラ ... - GAME Watch ローポリながらよく動く総合格闘技ゲーム『Weekend Warriors ... - Yahoo!ニュース 話題の会話型推理ゲーム「マダミス」 最大の魅力は「一度きり」の ... - Yahoo!ニュース 世界最長級ボードゲーム「メガシヴィ」、15時間の熱戦! 沖縄で初 ... - Yahoo!ニュース PS5、ついに販売“正常化” ソニーのゲーム事業に死角はないのか - Impress Watch テレビゲームの象徴的な存在「セーブポイント」は、なぜわれわれ ... - Yahoo!ニュース 国立天文台がゲームを開発!? 遊んで学べるファンタジーTRPG ... - Yahoo!ニュース 時間を溶かしたければ必見!ゲームしながら社会勉強もできる「PS ... - Yahoo!ニュース 今年で40周年!激ムズLDゲーム『ドラゴンズレア』で即死祭り開催 ... - Yahoo!ニュース 【2月5日更新】今週発売! 期待の新作ゲーム情報まとめ(Impress ... - Yahoo!ニュース サバイバルホラーゲーム「ラブラブスクールデイズ」,2月6日に ... - 4Gamer.net オープンワールドゾンビサバイバルMMO『The Day Before』10分 ... - Yahoo!ニュース <小野憲史のゲーム時評>ゲーム、ネット、スマホで発達障害“的”な ... - Yahoo!ニュース Xboxゲームパスは「持続不能」、任天堂のビジネスモデルがベスト ... - Yahoo!ニュース auゲーム版「FGO」がサービス終了。スケジュールは後日案内 ... - Yahoo!ニュース “著作権者不明”なゲームに朗報?新制度で加速していく復刻 ... - Yahoo!ニュース PCゲームは“タダ”で手に入れる! 人気タイトルから名作まで、無料 ... - WIRED.jp 【ゲーム依存】なる子とならない子の決定的な差 - 東洋経済オンライン
https://w.atwiki.jp/sampleisbest/pages/226.html
開発環境 Microsoft Visual C# 2010 Express (SP1) 実行環境 Microsoft Windows XP Home Edition (SP3) プロジェクトの種類 Windows Game (4.0) プロジェクト名 XnaSphere Game1.cs // XnaSphere1 - XNA 球体(球面線形補間) using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace XnaSphere { class Game1 Game { GraphicsDeviceManager graphics; SpriteBatch sprite; SpriteFont font; BasicEffect effect; VertexBuffer vertexBuffer; IndexBuffer indexBuffer; // fps int sec; int draw = 0; int fps = 0; // カメラ int camLat = 0; int camLong = 90; float camDist = 5; public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; Content.RootDirectory = "Content"; IsMouseVisible = true; } protected override void LoadContent() { font = Content.Load SpriteFont ("SpriteFont1"); sprite = new SpriteBatch(GraphicsDevice); effect = new BasicEffect(GraphicsDevice); //effect.VertexColorEnabled = true; //effect.EnableDefaultLighting(); effect.Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45), GraphicsDevice.Viewport.AspectRatio, 1, 100); // 頂点バッファ int stackNum = 16; // 輪切りの数 int[] dir = { 0, 1, 0, -1, 0, 1 }; // 方向配列 VertexPositionColor[] vertices = new VertexPositionColor[stackNum * stackNum + 2]; int i = 0; vertices[i++] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Yellow); for (int stack = 1; stack stackNum; stack++) { float rad = ((stackNum - 2 * stack) / (float)stackNum) * MathHelper.PiOver2; float y = (float)Math.Sin(rad); float r = (float)Math.Cos(rad); int sliceNum = Math.Min(stack, stackNum - stack); // 1象限内の頂点数 for (int quad = 0; quad 4; quad++) // 4象限 { Quaternion q1 = new Quaternion(dir[quad + 1] * r, y, dir[quad + 0] * r, 0); Quaternion q2 = new Quaternion(dir[quad + 2] * r, y, dir[quad + 1] * r, 0); for (int slice = 0; slice sliceNum; slice++) { // 球面線形補間 Quaternion q = Quaternion.Slerp(q1, q2, slice / (float)sliceNum); q.Normalize(); Vector3 normal = new Vector3(q.X, q.Y, q.Z); vertices[i++] = new VertexPositionColor( normal, (i 1) == 0 ? Color.Red Color.Yellow); } } } vertices[i++] = new VertexPositionColor(new Vector3(0, -1, 0), Color.Yellow); vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), vertices.Length, BufferUsage.WriteOnly); vertexBuffer.SetData(vertices); // 索引バッファ short[] indices = new short[stackNum * stackNum * 6]; i = 0; int prevHead = 0; // 前の先頭頂点番号 int prevVtx = 1; // 前の頂点数 for (int stack = 0; stack stackNum / 2; stack++) { int currHead = prevHead + prevVtx; // 現在の先頭頂点番号 int currVtx = 4 * (stack + 1); // 現在の頂点数 for (int quad = 0; quad 4; quad++) // 4象限 { int prevQuad = quad * stack; // 前の象限オフセット int currQuad = quad * (stack + 1); // 現在の象限オフセット for (int n = 0; ; n++) { indices[i++] = (short)(prevHead + (prevQuad + n) % prevVtx); indices[i++] = (short)(currHead + (currQuad + n)); indices[i++] = (short)(currHead + (currQuad + n + 1) % currVtx); if (stack = n) break; indices[i++] = (short)(prevHead + (prevQuad + n)); indices[i++] = (short)(currHead + (currQuad + n + 1)); indices[i++] = (short)(prevHead + (prevQuad + n + 1) % prevVtx); } } prevHead = currHead; prevVtx = currVtx; } for (int stack = stackNum / 2 - 1; 0 = stack; stack--) { int currHead = prevHead + prevVtx; int currVtx = Math.Max(4 * stack, 1); for (int quad = 0; quad 4; quad++) // 4象限 { int prevQuad = quad * (stack + 1); int currQuad = quad * stack; for (int n = 0; ; n++) { indices[i++] = (short)(currHead + (currQuad + n) % currVtx); indices[i++] = (short)(prevHead + (prevQuad + n + 1) % prevVtx); indices[i++] = (short)(prevHead + (prevQuad + n)); if (stack = n) break; indices[i++] = (short)(currHead + (currQuad + n)); indices[i++] = (short)(currHead + (currQuad + n + 1) % currVtx); indices[i++] = (short)(prevHead + (prevQuad + n + 1)); } } prevHead = currHead; prevVtx = currVtx; } indexBuffer = new IndexBuffer(GraphicsDevice, typeof(short), indices.Length, BufferUsage.WriteOnly); indexBuffer.SetData(indices); base.LoadContent(); } protected override void Update(GameTime gameTime) { KeyboardState kState = Keyboard.GetState(); if (kState.IsKeyDown(Keys.Escape)) Exit(); if (kState.IsKeyDown(Keys.Up)) camLat++; if (kState.IsKeyDown(Keys.Down)) camLat--; if (kState.IsKeyDown(Keys.Left)) camLong = (camLong + 1) % 360; if (kState.IsKeyDown(Keys.Right)) camLong = (camLong + 359) % 360; if (kState.IsKeyDown(Keys.PageUp)) camDist -= 0.1f; if (kState.IsKeyDown(Keys.PageDown)) camDist += 0.1f; base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.RasterizerState = new RasterizerState { FillMode = FillMode.WireFrame }; // カメラ位置 float rad = MathHelper.ToRadians(camLat); float y = (float)Math.Sin(rad) * camDist; float r = (float)Math.Cos(rad) * camDist; rad = MathHelper.ToRadians(camLong); float x = (float)Math.Cos(rad) * r; float z = (float)Math.Sin(rad) * r; effect.View = Matrix.CreateLookAt(new Vector3(x, y, z), Vector3.Zero, Vector3.Up); GraphicsDevice.SetVertexBuffer(vertexBuffer); GraphicsDevice.Indices = indexBuffer; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, vertexBuffer.VertexCount, 0, indexBuffer.IndexCount / 3); } // fps draw++; if (gameTime.TotalGameTime.Seconds != sec) { fps = draw; draw = 0; sec = gameTime.TotalGameTime.Seconds; } sprite.Begin(); string text = String.Format( "fps={0} lat={1} long={2} dist={3 f1}", fps, camLat, camLong, camDist); sprite.DrawString(font, text, new Vector2(0, 0), Color.White); sprite.End(); base.Draw(gameTime); } } }
https://w.atwiki.jp/hdlwiki/pages/338.html
ドラゴンボールZ3 PlayStation 2 the Best 【メーカー】バンダイ 【発売日】2006/3/2 動作報告 HDA3.0 SCPH-50000MB(V10) 純正40GB PS2でインストール 不具合報告であったセーブ問題は改善されていた。完全動作 商品の説明
https://w.atwiki.jp/heroup/pages/318.html
俺にできる最上のこと(ザ・ベスト・アット・ワット・アイ・ドゥー) ウルヴァリン
https://w.atwiki.jp/sampleisbest/pages/180.html
開発環境 Microsoft Visual C++ 2010 Express (SP1) 実行環境 Microsoft Windows XP Home Edition (SP3) プロジェクトの種類 空の CLR プロジェクト プロジェクト名 ClrD3D 参考 ライト(Light) ClrD3D_26.cpp /* #26 メッシュとライト プロジェクトへの参照の追加(参照タブ) C \WINDOWS\Microsoft.NET\DirectX for Managed Code\1.0.2902.0 Microsoft.DirectX.dll Microsoft.DirectX.Direct3D.dll Microsoft.DirectX.Direct3DX.dll */ #pragma comment(linker, "/subsystem windows /entry main") // アセンブリ #using System.dll #using System.Drawing.dll #using System.Windows.Forms.dll // 名前空間 using namespace System; using namespace System Drawing; using namespace System Threading; using namespace System Windows Forms; using namespace Microsoft DirectX; using namespace Microsoft DirectX Direct3D; ref class MainForm Form { private Device^ dev; PresentParameters^ pp; Mesh^ meshBox; Mesh^ meshSphere; float fDist;// 原点との距離 float fAlt;// 高度 int nCamAngle;// カメラの方位角 public MainForm() { MinimumSize = Drawing Size(80, 60); ClientSize = Drawing Size(800, 600); Text = "ClrD3D"; fDist = 5.0f; fAlt = 2.0f; nCamAngle = 210; KeyDown += gcnew KeyEventHandler(this, MainForm OnKeyDown); } bool DXInitialize() { try { pp = gcnew PresentParameters; pp- Windowed = true; pp- SwapEffect = SwapEffect Discard; pp- AutoDepthStencilFormat = DepthFormat D16; pp- EnableAutoDepthStencil = true; dev = gcnew Device(0, DeviceType Hardware, this, CreateFlags HardwareVertexProcessing, pp); CreateMesh(); return true; } catch (Exception^) { return false; } } void Render() { if (dev == nullptr) return; if (WindowState == FormWindowState Minimized) return; dev- RenderState- ZBufferEnable = true; dev- RenderState- ZBufferWriteEnable = true; // カメラの設定 float fRad = nCamAngle * (float)Math PI / 180; float fPosX = (float)Math Sin(fRad) * fDist; float fPosZ = (float)Math Cos(fRad) * fDist; dev- Transform- View = Matrix LookAtLH( Vector3(fPosX, fAlt, fPosZ), Vector3( 0.0f, 0.0f, 0.0f), Vector3( 0.0f, 1.0f, 0.0f)); dev- Transform- Projection = Matrix PerspectiveFovLH((float)Math PI / 4, (float)ClientSize.Width / (float)ClientSize.Height, 0.1f, 100.0f); // ライトの設定 //dev- RenderState- Lighting = false; dev- RenderState- Ambient = Color FromArgb(0x00,0x00,0x7f); dev- Lights[0]- Type = LightType Directional; dev- Lights[0]- Direction = Vector3 Normalize(Vector3(1, -2, 3)); dev- Lights[0]- Ambient = Color FromArgb(0x00,0x7f,0x00); dev- Lights[0]- Diffuse = Color FromArgb(0xff,0x00,0x00); dev- Lights[0]- Enabled = true; dev- Lights[0]- Update(); dev- Clear(ClearFlags Target | ClearFlags ZBuffer, 0x7f7fff, 1.0f, 0); dev- BeginScene(); // メッシュ描画 Material mat; mat.AmbientColor = ColorValue(1.0f, 1.0f, 1.0f); mat.DiffuseColor = ColorValue(1.0f, 1.0f, 1.0f); dev- Material = mat; dev- Transform- World = Matrix Translation(Vector3(-1.0f, 0.0f, 0.0f)); meshBox- DrawSubset(0); dev- Transform- World = Matrix Translation(Vector3( 1.0f, 0.0f, 0.0f)); meshSphere- DrawSubset(0); dev- EndScene(); try { dev- Present(); } catch (DeviceLostException^) { ResetDevice(); } } private void CreateMesh() { meshBox = Mesh Box(dev, 1, 1, 1); meshSphere = Mesh Sphere(dev, 0.5f, 16, 8); } void ResetDevice() { int hResult; if (!dev- CheckCooperativeLevel(hResult)) { switch (hResult) { case ResultCode DeviceLost Thread Sleep(10); break; case ResultCode DeviceNotReset dev- Reset(pp); break; } } } void OnKeyDown(Object^ sender, KeyEventArgs^ e) { switch (e- KeyCode) { case Keys W fDist -= 0.5f; break; case Keys S fDist += 0.5f; break; case Keys Up fAlt += 0.5f; break; case Keys Down fAlt -= 0.5f; break; case Keys Left nCamAngle += 5; break; case Keys Right nCamAngle -= 5; break; case Keys Escape Close(); break; } } }; int main() { MainForm^ form = gcnew MainForm; if (!form- DXInitialize()) { MessageBox Show("Direct3Dの初期化に失敗しました。", "ClrD3D"); return 0; } form- Show(); while (form- Created) { form- Render(); Application DoEvents(); } return 0; }
https://w.atwiki.jp/sampleisbest/pages/119.html
開発環境 Microsoft Visual C++ 2010 Express (SP1) 実行環境 Microsoft Windows XP Home Edition (SP3) プロジェクトの種類 空の CLR プロジェクト プロジェクト名 teapot Microsoft DirectX SDK (June 2010)をインストール 参考 日経ソフトウェア 2004/9 Sample Brower でティーポットを描画 エラー fatal error C1107 アセンブリ Microsoft.DirectX.dll がみつかりませんでした /AI または LIBPATH 環境変数を使用してアセンブリ検索パスを指定してください。 対処 プロジェクト構成プロパティ→C/C++→全般→#using 参照の解決 C \WINDOWS\Microsoft.NET\DirectX for Managed Code\1.0.2902.0 あるいは#usingではなく参照の追加でdllファイルを直接指定する エラー System.IO.FileLoadException のハンドルされていない例外が teapot.exe で発生しました。 追加情報 混合モード アセンブリはバージョン v1.1.4322 のランタイムに対して作成されており、 追加の構成情報がないと 4.0 ランタイムでは読み込めません。 対処 app.configを用意する プロジェクト「追加→既存の項目」を選択する app.configプロパティ 全般→項目の種類 カスタム ビルド ツール カスタム ビルド ツール→全般 コマンド ライン copy app.config "$(TargetPath).config" 出力ファイル $(TargetPath).config Visual C++ 2008でアプリケーション構成ファイル(app.config)を使う エラー マネージ デバッグ アシスタント LoaderLock では C \projects\vc++\teapot\Debug\teapot.exe に問題を検出しました。 追加情報 DLL C \WINDOWS\assembly\GAC\Microsoft.DirectX.Direct3D\1.0.2902.0__ 31bf3856ad364e35\Microsoft.DirectX.Direct3D.dll は、 OS ローダー ロック内でマネージ実行を試行しています。 DllMain またはイメージ初期化関数内でマネージ コードを実行しないでください。 この動作は、アプリケーションをハングさせる原因になる可能性があります。 対処 メニューから「ツール→設定→上級者用の設定」を選択する メニューから「デバッグ→例外」を選択する Managed Debugging Assistants→LoaderLockの「スローされるとき」のチェックを外す .NET開発者のためのDirectX連携手法 「LoaderLock が検出されました。」の対処方法 teapot.cpp #using System.dll #using System.Windows.Forms.dll #using System.Drawing.dll #using Microsoft.DirectX.dll #using Microsoft.DirectX.Direct3D.dll #using Microsoft.DirectX.Direct3DX.dll using namespace System; using namespace System Windows Forms; using namespace Microsoft DirectX; using namespace Microsoft DirectX Direct3D; //============================================================================== public ref class Teapot Form { private Device^ device;// Direct3Dデバイス Mesh^ teapot;// メッシュ・オブジェクト PresentParameters^ presentParams; public Teapot(void) { ClientSize = Drawing Size(400, 300); Text = "Managed Direct3D Sample - Simple Teapot"; } bool InitializeGraphics(void) { try { // Direct3Dデバイスの作成に使う構造体を設定 presentParams = gcnew PresentParameters(); presentParams- Windowed = true; presentParams- SwapEffect = SwapEffect Discard; presentParams- EnableAutoDepthStencil = true; presentParams- AutoDepthStencilFormat = DepthFormat D16; // Direct3Dデバイスを作成 device = gcnew Device(0, DeviceType Hardware, this, CreateFlags SoftwareVertexProcessing, presentParams); device- DeviceReset += gcnew EventHandler(this, Teapot OnResetDevice); OnResetDevice(device, nullptr); } catch (DirectXException^) { return false; } return true; } void OnResetDevice(Object^ sender, EventArgs^ e) { // メッシュ・オブジェクトを作成 teapot = Mesh Teapot(device); // Zバッファを有効にする device- RenderState- ZBufferEnable = true; // マテリアルを設定 Material^ mtrl = gcnew Material(); mtrl- Diffuse = Drawing Color White; mtrl- Ambient = Drawing Color White; device- Material = *mtrl; // 照明を設定 device- Lights[0]- Type = LightType Directional; device- Lights[0]- Direction = Vector3(1.0f, -1.0f, 1.0f); device- Lights[0]- Diffuse = Drawing Color White; device- Lights[0]- Ambient = Drawing Color FromArgb(50, 50, 50); device- Lights[0]- Enabled = true; //device- Lights[0]- Commit();// 廃止→Enabledで十分 device- RenderState- Lighting = true; // ビュー行列を設定 device- Transform- View = Matrix LookAtLH( Vector3(0.0f, 2.0f, -3.0f), Vector3(0.0f, 0.0f, 0.0f), Vector3(0.0f, 1.0f, 0.0f)); // 射影行列を設定 float fAspect = device- PresentationParameters- BackBufferWidth / (float)device- PresentationParameters- BackBufferHeight; device- Transform- Projection = Matrix PerspectiveFovLH( (float)(Math PI / 4.0f), fAspect, 1.0f, 100.0f); } // private void Render(void) { if (device == nullptr) return; device- Clear(ClearFlags Target | ClearFlags ZBuffer, Drawing Color Blue, 1.0f, 0); device- BeginScene(); device- Transform- World = Matrix RotationY( Environment TickCount / 1000.0f); teapot- DrawSubset(0); device- EndScene(); device- Present(); } }; //============================================================================== int main() { Teapot^ frm = gcnew Teapot(); if (!frm- InitializeGraphics()) { MessageBox Show("Direct3Dの初期化に失敗しました"); return 1; } frm- Show(); while (frm- Created) { frm- Render(); Application DoEvents(); } return 0; } app.config ?xml version= 1.0 encoding= utf-8 ? configuration startup useLegacyV2RuntimeActivationPolicy="true" supportedRuntime version="v4.0"/ /startup /configuration
https://w.atwiki.jp/sampleisbest/pages/208.html
開発環境 Microsoft Visual C# 2010 Express (SP1) 実行環境 Microsoft Windows XP Home Edition (SP3) プロジェクトの種類 Windows Game (4.0) プロジェクト名 XnaBlock Game1.cs using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace XnaBlock { class Game1 Game { GraphicsDeviceManager graphics; SpriteBatch sprite; SpriteFont font; Effect effect; Texture2D texture; // fps DateTime prevTime; int draw = 0; int fps = 0; const int blockMax = 20000; int blockNum = 0; VertexBuffer instanceBuffer; VertexBuffer geometryBuffer; IndexBuffer indexBuffer; VertexDeclaration instanceVertexDeclaration; VertexBufferBinding[] bindings; Matrix projection; // カメラ Vector3 camPos = new Vector3(50.5f, 1.5f, 50.5f); int camLat = 0; int camLong = 225; struct InstanceInfo { public Matrix World; public Vector2 AtlasCoordinate; } public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; Content.RootDirectory = "Content"; IsMouseVisible = true; } protected override void Initialize() { sprite = new SpriteBatch(GraphicsDevice); prevTime = DateTime.Now; base.Initialize(); } protected override void LoadContent() { // ソリューション エクスプローラーの(Content)に追加しておく font = Content.Load SpriteFont ("SpriteFont1"); // 新しい項目:Sprite Font effect = Content.Load Effect ("HardwareInstancing"); // 新しい項目:Effect File (.fx) texture = Content.Load Texture2D ("Texture4"); // 既存の項目:Texture4.png GenerateGeometryBuffers(0.5f); GenerateInstanceVertexDeclaration(); GenerateInstanceInformation(); bindings = new VertexBufferBinding[2]; bindings[0] = new VertexBufferBinding(geometryBuffer, 0); bindings[1] = new VertexBufferBinding(instanceBuffer, 0, 1); projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), GraphicsDevice.Viewport.AspectRatio, 0.1f, 2000); effect.CurrentTechnique = effect.Techniques["Instancing"]; effect.Parameters["cubeTexture"].SetValue(texture); base.LoadContent(); } void GenerateGeometryBuffers(float size) { VertexPositionTexture[] vertices = new VertexPositionTexture[24]; for (int n = 0; n 4; n++) { float u = size * ((n 1) * 2 - 1); float v = size * ((n 2) - 1); vertices[0 + n].Position = new Vector3(u, size, v); vertices[4 + n].Position = new Vector3(u, -size, -v); vertices[8 + n].Position = new Vector3(-size, -v, u); vertices[12 + n].Position = new Vector3(u, -v, size); vertices[16 + n].Position = new Vector3(size, -v, -u); vertices[20 + n].Position = new Vector3(-u, -v, -size); } for (int n = 0; n 4; n++) { int u = n 1; int v = (n 1) 1; vertices[0 + n].TextureCoordinate = new Vector2(0 + u, 0 + v); vertices[4 + n].TextureCoordinate = new Vector2(1 + u, 0 + v); vertices[8 + n].TextureCoordinate = new Vector2(2 + u, 0 + v); vertices[12 + n].TextureCoordinate = new Vector2(0 + u, 1 + v); vertices[16 + n].TextureCoordinate = new Vector2(1 + u, 1 + v); vertices[20 + n].TextureCoordinate = new Vector2(2 + u, 1 + v); } geometryBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionTexture), 24, BufferUsage.WriteOnly); geometryBuffer.SetData(vertices); int[] indices = new int[36]; for (int n = 0; n 6; n++) { int n6 = n * 6; int n4 = n * 4; indices[n6 + 0] = n4 + 0; indices[n6 + 1] = n4 + 1; indices[n6 + 2] = n4 + 2; indices[n6 + 3] = n4 + 1; indices[n6 + 4] = n4 + 3; indices[n6 + 5] = n4 + 2; } indexBuffer = new IndexBuffer(GraphicsDevice, typeof(int), 36, BufferUsage.WriteOnly); indexBuffer.SetData(indices); } void GenerateInstanceVertexDeclaration() { VertexElement[] elements = new VertexElement[5]; for (int n = 0; n 4; n++) { elements[n] = new VertexElement(sizeof(float) * 4 * n, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, n + 1); } elements[4] = new VertexElement(sizeof(float) * 16, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 5); instanceVertexDeclaration = new VertexDeclaration(elements); } void GenerateInstanceInformation() { InstanceInfo[] instances = new InstanceInfo[blockMax]; // 地面 int n = 0; for (int z = 0; z 100; z++) { for (int x = 0; x 100; x++) { instances[n].World = Matrix.CreateTranslation( new Vector3(x + 0.5f, 0.5f, z + 0.5f)); instances[n].AtlasCoordinate = new Vector2(0, 0); n++; } } Random rnd = new Random(); for (; n blockMax; n++) { instances[n].World = Matrix.CreateFromYawPitchRoll( (float)rnd.NextDouble() * MathHelper.TwoPi, (float)rnd.NextDouble() * MathHelper.TwoPi, (float)rnd.NextDouble() * MathHelper.TwoPi) * Matrix.CreateTranslation( new Vector3(rnd.Next(100), rnd.Next(100), rnd.Next(100))); instances[n].AtlasCoordinate = new Vector2(0, 0); } blockNum = n; instanceBuffer = new VertexBuffer(GraphicsDevice, instanceVertexDeclaration, blockMax, BufferUsage.WriteOnly); instanceBuffer.SetData(instances); } protected override void Update(GameTime gameTime) { KeyboardState state = Keyboard.GetState(); if (state[Keys.Escape] == KeyState.Down) Exit(); if (state[Keys.Escape] == KeyState.Down) Exit(); if (state[Keys.W] == KeyState.Down) Move(0, 0); if (state[Keys.S] == KeyState.Down) Move(180, 0); if (state[Keys.A] == KeyState.Down) Move(0, -90); if (state[Keys.D] == KeyState.Down) Move(0, 90); if (state[Keys.Up] == KeyState.Down) camLat++; if (state[Keys.Down] == KeyState.Down) camLat--; if (state[Keys.Left] == KeyState.Down) camLong--; if (state[Keys.Right] == KeyState.Down) camLong++; if (state[Keys.PageUp] == KeyState.Down) Move(90, 0); if (state[Keys.PageDown] == KeyState.Down) Move(-90, 0); base.Update(gameTime); } void Move(int degLat, int degLong) { float rad = MathHelper.ToRadians(camLat + degLat); if (degLong == 0) { camPos.Y += (float)Math.Sin(rad) * 0.2f; } float r = (float)Math.Cos(rad) * 0.2f; rad = MathHelper.ToRadians(camLong + degLong); camPos.X += (float)Math.Cos(rad) * r; camPos.Z += (float)Math.Sin(rad) * r; } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.DepthStencilState = DepthStencilState.Default; float rad = MathHelper.ToRadians(camLat); float y = (float)Math.Sin(rad) + camPos.Y; float r = (float)Math.Cos(rad); rad = MathHelper.ToRadians(camLong); float x = camPos.X + (float)Math.Cos(rad) * r; float z = camPos.Z + (float)Math.Sin(rad) * r; Matrix view = Matrix.CreateLookAt(camPos, new Vector3(x, y, z), Vector3.Up); GraphicsDevice.Indices = indexBuffer; effect.Parameters["WVP"].SetValue(view * projection); effect.CurrentTechnique.Passes[0].Apply(); GraphicsDevice.SetVertexBuffers(bindings); GraphicsDevice.DrawInstancedPrimitives(PrimitiveType.TriangleList, 0, 0, 24, 0, 12, blockNum); // フレームレート draw++; DateTime now = DateTime.Now; TimeSpan t = now - prevTime; if (t.TotalMilliseconds = 1000) { fps = draw; draw = 0; prevTime = now; } sprite.Begin(); string text = "fps=" + fps + " lat=" + camLat + " long=" + camLong + " block=" + blockNum; sprite.DrawString(font, text, new Vector2(0, 0), Color.White); text = string.Format("x={0 f1} y={1 f1} z={2 f1}", camPos.X, camPos.Y, camPos.Z); sprite.DrawString(font, text, new Vector2(0, 20), Color.White); sprite.End(); base.Draw(gameTime); } } } HardwareInstancing.fx /* Effect File プロジェクトのプロパティ [XNA Game Studio]タブ Use HiDef to access the complete API */ float4x4 WVP; texture cubeTexture; sampler TextureSampler = sampler_state { texture = cubeTexture ; mipfilter = LINEAR; minfilter = LINEAR; magfilter = LINEAR; }; struct InstancingVSinput { float4 Position POSITION0; float2 TexCoord TEXCOORD0; }; struct InstancingVSoutput { float4 Position POSITION0; float2 TexCoord TEXCOORD0; }; InstancingVSoutput InstancingVS( InstancingVSinput input, float4x4 instanceTransform TEXCOORD1, float2 atlasCoord TEXCOORD5) { InstancingVSoutput output; float4 pos = input.Position; pos = mul(pos, transpose(instanceTransform)); pos = mul(pos, WVP); output.Position = pos; output.TexCoord = float2( atlasCoord.x + (input.TexCoord.x / 4.0f), atlasCoord.y + (input.TexCoord.y / 4.0f)); return output; } float4 InstancingPS(InstancingVSoutput input) COLOR0 { return tex2D(TextureSampler, input.TexCoord); } technique Instancing { pass Pass0 { VertexShader = compile vs_3_0 InstancingVS(); PixelShader = compile ps_3_0 InstancingPS(); } }
https://w.atwiki.jp/sampleisbest/pages/178.html
開発環境 Microsoft Visual C# 2010 Express (SP1) 実行環境 Microsoft Windows XP Home Edition (SP3) プロジェクトの種類 Windows Game (4.0) プロジェクト名 XnaShader 参考 プログラマブル・シェーダによる積極的なGPUの活用 - @IT Program_2.cs // #2 using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; class Game1 Game { GraphicsDeviceManager graphics; VertexBuffer vb; Effect effect; Vector2 offset = new Vector2(-0.25f, 0.0f); float zoom = 3.0f; // 頂点構造体 struct MyVertex IVertexType { Vector2 Position; Vector2 UV; public MyVertex(Vector2 position, Vector2 uv) { Position = position; UV = uv; } public readonly static VertexDeclaration VertexDeclaration = new VertexDeclaration( new VertexElement[] { new VertexElement(0, VertexElementFormat.Vector2, VertexElementUsage.Position, 0), new VertexElement(8, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0), }); VertexDeclaration IVertexType.VertexDeclaration { get { return VertexDeclaration;} } } public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; Window.AllowUserResizing = true; } protected override void LoadContent() { const int numVertices = 4; vb = new VertexBuffer(GraphicsDevice, typeof(MyVertex), numVertices, BufferUsage.None); MyVertex[] vertices = new MyVertex[numVertices] { new MyVertex(new Vector2(-1.0f, 1.0f), new Vector2(0.0f, 1.0f)), // LT new MyVertex(new Vector2( 1.0f, 1.0f), new Vector2(1.0f, 1.0f)), // RT new MyVertex(new Vector2(-1.0f, -1.0f), new Vector2(0.0f, 0.0f)), // LB new MyVertex(new Vector2( 1.0f, -1.0f), new Vector2(1.0f, 0.0f)), // RB }; vb.SetData(vertices); // ContentにMandelbrot.fxを追加しておく effect = Content.Load Effect ("Mandelbrot"); base.LoadContent(); } protected override void Update(GameTime gameTime) { // 移動量 float offsetMove = 0.01f * (float)Math.Log(zoom + 1.0f); KeyboardState key = Keyboard.GetState(); if (key.IsKeyDown(Keys.Left)) { offset.X -= offsetMove; } if (key.IsKeyDown(Keys.Right)) { offset.X += offsetMove; } if (key.IsKeyDown(Keys.Down)) { offset.Y -= offsetMove; } if (key.IsKeyDown(Keys.Up)) { offset.Y += offsetMove; } if (key.IsKeyDown(Keys.PageDown)) { zoom *= 1.05f; } if (key.IsKeyDown(Keys.PageUp)) { zoom /= 1.05f; } if (key.IsKeyDown(Keys.Escape)) { Exit(); } base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // エフェクトのパラメータ更新 effect.Parameters["Zoom"].SetValue(zoom); effect.Parameters["Aspect"].SetValue(GraphicsDevice.Viewport.AspectRatio); effect.Parameters["Offset"].SetValue(offset); GraphicsDevice.SetVertexBuffer(vb); foreach(EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); } base.Draw(gameTime); } } class Program { static void Main() { using (Game1 game = new Game1()) { game.IsMouseVisible = true; game.Run(); } } } Mandelbrot_2.fx float Aspect = 1.0f; float Zoom = 1.0f; float2 Offset = float2(0.0f, 0.0f); // 頂点シェーダ struct VertexIn { float2 Pos POSITION; float2 UV TEXCOORD0; }; struct VertexOut { float4 ScreenPos POSITION; float2 UV TEXCOORD0; }; VertexOut MyVertexShader(VertexIn input) { VertexOut output; output.ScreenPos = float4(input.Pos, 0.0f, 1.0f); output.UV = input.UV; return output; } // ピクセルシェーダ struct PixelIn { float2 UV TEXCOORD0; }; struct PixelOut { float4 Color COLOR0; }; PixelOut MandelbrotShader(PixelIn input, uniform int MaxIterate) { const float2 c = (input.UV - 0.5f) * float2(1.0f, Aspect) * Zoom + Offset; float2 p = 0; int n; for (n = 0; n MaxIterate dot(p, p) 4.0f; n++) { p = float2(p.x * p.x - p.y * p.y, 2.0f * p.x * p.y) + c; } PixelOut output; if (n MaxIterate) { float u = (float)n / (float)MaxIterate; output.Color.rgb = float3(u, u, 1.0f - u); } else { output.Color.rgb = 0.0f; } output.Color.a = 1.0f; return output; } // レンダー technique Render { pass Pass0 { VertexShader = compile vs_3_0 MyVertexShader(); PixelShader = compile ps_3_0 MandelbrotShader(254); } }
https://w.atwiki.jp/bzspirit/pages/462.html
発売日 1998年9月20日 出版社 J-ROCK MAGAZINE B'zのリクエストベストアルバム 『B z The Best Treasure︎︎ 』の公式バンドスコア。 計16曲のスコアを収録。 19ページの豪華フォト、メンバーコメント入り全楽曲解説などを掲載。 収録曲 BLOWIN' 恋心(KOI-GOKORO) TIME Liar! Liar! ねがい 愛しい人よGood Night… Pleasure'98 ~人生の快楽~ ミエナイチカラ~INVISIBLE ONE~ もう一度キスしたかった FIREBALL Real Thing Shakes MOTEL いつかのメリークリスマス RUN HOME The Wild Wind 名前 コメント