반응형

반응형

'영어 > 영문법' 카테고리의 다른 글

병치, 도치 구문  (0) 2012.10.31
비교구문  (0) 2012.10.31
부사절  (0) 2012.10.31
명사절  (0) 2012.10.31
관계절  (1) 2012.10.31
반응형

반응형
반응형

첨부파일 :  DX11.pptx

반응형
반응형

** 버튼입력 이벤트처리 **
copyrightⓒ Gamza

- Download #1 : InputSystem.zip (1.8 KB), Download : 119

게임은 이벤트처리방식으로 만들지 않는것이 일반적이라서 사용자의 입력을 직접 처리해 주어야 하죠. 특히나 버튼일 경우는 현재 키의 '눌림상태' 만으로 사용자가 한 행동 -아무일도 안하고 있는가,눌렀는가,떼었는가,누른채로 있는가- 을 알아내야 합니다.

이것에 대해서는 여러가지로 설명할수 있지만 제가 생각하기에 가장 이해하기 쉬운것은 진리표에의한 설명인거 같네요.

우선 사용자의 행동을 알아내기위해선 두가지 준비물이 필요합니다.
첫째, 이전 프레임의 키의 '눌림상태'
둘째, 현재 프레임의 키의 '눌림상태'

이것을 간단히 코딩해 본다면 다음처럼 되겠죠...

void main()
{
bool old_key;
bool cur_key;
while(1)
{
cur_key = get_current_keystate();
// A
old_key = cur_key;
}
}

자...이제 'A'라는 부분에 이르면 우리가 원하는 준비물이 각각 old_key와 cur_key에 들어가 있게되겠죠?
자 그럼, 사용자가 무슨짓(?)을 하고있는지 맞춰보도록 합시다.
old_key
cur_key
Event
key state
user action
0
0
None
not pressed
아무일도 안하고 있다
0
1
KeyDown
pressed
키를 눌렀다
1
0
KeyUp
not pressed
키를 떼었다
1
1
None
pressed
누른채로 가만히 있다
이제 상태를 알았으니 'A'라는 부분에 프로그램만 짜넣으면 됩니다.
가령 버튼을 누를때만 총알이 나가야 한다면...
if( !old_key && cur_key ) { 총알발사; }

표를 잘보시면 원리가 눈에 보이죠?
32개의 키의 상태를 하나의 변수에 넣어두면 이벤트 검사할때 좀더 유리하죠.
unsigned long KeyEvent32 = ( oldKeyState32 ^ curKeyState32 );
unsigned long KeyPressEvent32 = KeyEvent32 & curKeyState32;
unsigned long KeyReleaseEvent32 = KeyEvent32 & (~curKeyState32);
이런다음...
if( KeyReleaseEvent32 & 1 ) 첫번째 키가 떨어졌음.
다음처럼 32개의 키들의 이벤트발생 여부를 한방에 알아올수도 있습니다.
if( KeyEvent32 != 0 ) 뭔가 이벤트가 일어났다.
else 아무런 키 이벤트가 없다.

PS, 첨부된 파일은 지금 개발중인 시스템에서 사용될 입력시스템입니다. 참고가 되었으면 하는 마음에..

반응형
반응형

2008 opengl 설치후

그리고 헤더파일부분에 #include <gl.h> 이렇게 해줘야 합니다

http://robotstory.tistory.com/184

반응형
반응형

 AGEIA 의 유명한 물리엔진인 PhysX (구 Novodex) 의 라이센스가 Free 로 풀렸습니다.
- PC 버전에 한하며 상용 프로젝트인 경우에도 사용 가능합니다.

*참고 사이트
http://devsupport.ageia.com/ics/support/KBAnswer.asp?questionID=378
http://devsupport.ageia.com/

반응형
반응형

http://www.member.hitel.net/~kaswan/

반응형
반응형

사전 바로가기 아이콘

반응형
반응형

http://upload.kin.naver.com/equation.nhn?callback=_$_equation$846_$_

반응형
반응형

http://www.gamasutra.com/


My Message close
AdTech Ad
image
Member Login
Email:
Password:
LOGIN
Forgot Password? | Sign Up
spacer arrow PROGRAMMING spacer
spacer ART
spacer AUDIO
arrow DESIGN
arrow PRODUCTION
arrow BIZ/MARKETING
AdTech Ad click here AdTech Ad
Latest Jobs
spacer View All Post a Job RSS spacer
October 30, 2012
2K Czech
Senior Producer &ndash; 2K Czech
2K Czech
Lead Mission Designer &ndash; 2K Czech
2K Czech
VFX Artist &ndash; 2K Czech
2K Czech
Senior Game-Engine Programmer &ndash; 2K Czech
Trion Worlds
Platform Producer
A2Z Research and Development
Art Director
spacer
Latest Blogs
spacer View All Post RSS spacer
October 30, 2012
Survival Horror, Then and Now [1]
Inside the Numbers: Slots Tycoon
Why Hotline Miami is an important game [8]
Sometimes, it feels good to fail [8]
Dishonored: The Missteps [10]
spacer
Latest Press Releases
spacer View All RSS spacer
October 30, 2012
AION Free-to-Play:
Finaler Kampf gegen...
Xploder has a Cheat Save
Set for Medal of
Honor:...
Nitrome and Brass Monkey
launch Touchy! - An
app...
FDG Entertainment
releases Slide Circus
(iOS)...
Kojima Productions\'
Popular Titles Also
Debuts in...
spacer
Event Calendar
spacer View All Submit Event spacer
arrow Project Horseshoe
Boerne, United States
11.01.2012
arrow Webinar: How to launch a warrior - News from the online gaming front
, United States
11.08.2012
arrow GDC China
Shanghai, China
11.17.2012
arrow Frank Armiate Lecture Series with guest speaker Seth Cooper, PhD, Creator and Developer of FoldIt
Chicago, United States
11.29.2012
spacer
About
spacer Editor-In-Chief:
Kris Graft
Features Director:
Christian Nutt
News Director:
Frank Cifaldi
Senior Contributing Editor:
Brandon Sheffield
News Editors:
Frank Cifaldi, Tom Curtis, Mike Rose, Eric Caoili, Kris Graft
Editors-At-Large:
Leigh Alexander, Chris Morris
Advertising:
Jennifer Sulik
Recruitment:
Gina Gross
Feature Submissions
Comment Guidelines
Sponsor
About
spacer If you enjoy reading this site, you might also want to check out these UBM TechWeb sites:

Game Career Guide (for student game developers.)

Indie Games (for independent game players/developers.)
Store
View All
November Issue
November 2012 Issue of Game Developer
October Issue
October 2012 Issue of Game Developer
September Issue
September 2012 Issue of Game Developer
August Issue
August 2012 Issue of Game Developer
Game Developer Salary Report 2005-2010
Game Developer Salary Report 2005-2010
image
image
image image View All Submit News RSS image
Disney buys LucasArts in surprise $4 billion deal
image Disney has added George Lucas' privately-owned Lucasfilm Ltd. -- including its video game publishing arm, LucasArts -- for an estimated $4.05 billion.
Tokyo Jungle studio not afraid to be Japanese Exclusive
image In an industry pumped full of sequels and safe bets, it was questionable that Western gamers would flock to Tokyo Jungle -- yet developers Crispy's and SCE Japan Studio weren't worried at all.
9
Slow sales of Sleeping Dogs, others to drive $67M loss at Square Enix
image Publisher Square Enix expected to break even for the six months ending September 30, but slower-than-expected sales of Sleeping Dogs among other games have caused the company to lose nearly $70 million.
5
Microsoft points to big Windows 8 sales to garner dev support
image Initial sales for Windows 8 are higher than Windows 7 -- Microsoft has already sold 4 million upgrades for its operating system to consumers, and has sold tens of millions of copies to corporate customers.
Raph Koster to examine 'How Games Think' at next month's GDC China
image Online game legend Raph Koster will present a keynote at next month's GDC China in Shanghai, examining "how games think," how they influence the world we live in, and what that means for our future.
3
Betting big on Wii U, Ubisoft hopes people understand the console Exclusive
image Ubisoft SVP Tony Key believes in the potential of Nintendo's innovative new Wii U. Problem is, he's not totally sure if the general consumer really understands the console's potential.
3
Grand Theft Auto V releasing next spring
image Grand Theft Auto V, the next entry in Rockstar North's extremely popular open world game series, will release worldwide for Xbox 360 and PlayStation 3 next spring.
1
Sports games carry EA though Q2, though holiday projections miss their mark
image EA's major sports franchises helped the publisher meet expectations for its second fiscal quarter, though the company disappointed analysts by projecting lower-than-expected revenues for the holiday season.
2
This Week In Video Game Criticism: From vulnerability fantasy to journalist drama
image This week, our partnership with game criticism site Critical Distance brings us picks from Kris Ligman on topics including the "vulnerability fantasy" offered by games like X-Com, last week's game journalist drama, and more.
Apotheon makes ancient art work in a modern game Exclusive
image Apotheon looks nothing like the last game independent developer Alientrap put out, Capsized -- that title inhabited a verdant alien world, lush with detailed hand-drawn illustrations of the planet's exotic flora.
1
iOS chief Scott Forstall leaving Apple
image Apple's iOS senior vice president Scott Forstall, who has overseen the operating systems and software for the iPhone and iPad since the devices launched, will leave the company next year.
Fastest-Growing Facebook Games: From Ruby Blast to JetSet Secrets
image Gamasutra's bi-weekly look at the fastest-growing Facebook titles examines recently popular games, including Zynga's match-3 puzzler Ruby Blast and Electronic Arts' newest release JetSet Secrets.
2
THQ struggling to break even on Darksiders II
image Darksiders II has sold an estimated 1 million copies, but analyst Michael Pachter says the game is struggling to cross the 2 million milestone it will need to reach for THQ to break even on the title.
UK game industry prepares for tax relief
image UK studios will have to pass a cultural test to show that they deserve to receive tax breaks. UKIE has stepped in to offer its suggestions as to how this cultural test can be best applied to the UK's video games industry.
3
How Valve empowers each and every one of its employees
image "Three people at the company can ship anything... the work gets better if you just check with a couple of people before you decide to push a button." - Greg Coomer, product designer at Valve.
image Windows Phone 8 SDK released
image Ex-38 Studios creative lead now at Sony Online Entertainment
EVE Online and the meaning of 'sandbox' Exclusive
image "Sandbox gameplay" is one of those ambiguous terms in game development that is used a lot, but rarely defined. CCP senior designer Matthew Woodward makes a strong argument for his own vision of the sandbox.
5
Windows Phone 8 launches with top games from rival platforms
image As it prepares to launch its Windows Phone 8 devices next month, Microsoft is aiming to convince consumers that the app and game selection on WP8 devices is comparable to those on iOS and Android.
8
How MechWarrior Online got funded without Kickstarter Exclusive
image Gamasutra talks to the developer behind the $5 million crowdfunding effort that's bringing MechWarrior Online stomping into the free-to-play battleground.
Assassin's Creed III's epic naval battles weren't expected to work Exclusive
image "They didn't know how unlikely it was to work, so they made it work." - Assassin's Creed III creative director Alex Hutchinson on how Ubisoft engineers got naval battles working.
1
Loot Drop's Ghost Recon social game has been canceled
image Things aren't going so well at social developer Loot Drop today, as studio co-founder Brenda Romero just revealed on Twitter that the company had to lay off the team behind the upcoming Ghost Recon Commander.
image Shade 3D, Pingflux providers launch new tools for Unity developers
image ESA's 15th annual 'Nite to Unite' charity dinner rasies $822,000
7
Behind Binding of Isaac's blasphemous success Exclusive
image Themes like child abuse and suicide should have relegated Edmund McMillen's The Binding of Isaac to the niche, but it sold a million units anyway. In a Game Developer magazine postmortem, McMillen talks blasphemy and game design.
[More News]
image
image
image
The biggest challenge for the Assassin's Creed III's creative lead is keeping things fresh.
image
4
What Would Geralt Do? Witcher 2's Approach to Choice and Decision
image CD Projekt's fascinating take on choice, decision and morality systems in games.
image
image Sponsored Feature: Epic Games' Unreal Engine Gets Faster, Faster with Intel Graphics Performance Analyzers
image Epic Games senior engine programmer Niklas Smedberg explains how Intel tools help performance.
image
image image
1
How One Studio Saved Itself From the Downturn
image
image
7
The Evolution of Puzzle Craft
image


click here
image
image
Expert Blogs All Blogs Post RSS
Call of Assassin's Horse Armour
by Tom Battey
Instead of bloating an already expensive product with free-to-play-like micro-transactions, what if...
1
Survival Horror, Then and Now
by Luis Guimaraes
Analysis on classic Survival Horror not by what they objectively are, but by what the hardcore fans...
3
The Education of a Game Producer part 1: Three ‘P’s to Remember
by Gerard Martin Cueto
This is the first in a series of entries detailing what I have learned as a game producer, as well...
8
Why Hotline Miami is an important game
by Rami Ismail
Hotline Miami isn’t so much a game about violence as it is a game about walking back to your car,...
8
Sometimes, it feels good to fail
by Tom Curtis
After playing hours and hours of Firaxis' XCOM: Enemy Unknown, I've come to appreciate games that...
image
image
image
Featured Contractors Add A Contractor
image image
Robotic Arm Software image
Robotic Arm Software brings a variety of tool development services to game companies. We focus on the asset pipeline, helping you to create, build and manage your data.
Ozone Music and Sound image
Creative Audio, the art of sound. That\'s all we do. Your projects, schedules, and budgets are unique, so are we.
Game Consulting image
Since 2002, GameCo is the most important Art Outsourcer in France. With an international team of senior artists and managers, we can handle your Art production with the highest quality and efficient rates.
Media Elements LLC image
Media Elements LLC is a global leader and top multimedia studio in business and multi-platform multimedia services for Video Game and Digital Entertainment.
GarageGames, LLC. image
GarageGames is currently located in Las Vegas, Nevada. As the makers of the Torque game development technology, we have provided professional level cross-platform technology and tools since 2000.
Forge Studios image
Forge Studios is an outsourcing production services studio founded by an experienced team of professionals. Our team has worked on a variety of projects providing high quality in-game content as well as engine integration, workflow setup, art direction.
PLAY! Illustration/Design for Toys & Interactive Games image
PlayIllustration.com showcases professional artists and design firms with experience in the GAME and TOY industries. Over 300 professional artists are featured on the site. Their skills include include illustration, 3D, modeling, animation, storyboarding,
Frogtale Studio image
Frogtale Studio is an offshore art production company based in Kuala Lumpur, Malaysia, providing high quality outsourcing solution to game developers.
Clean Cuts Music & Sound Design image
Clean Cuts is a world-class audio facility with over 25 years of experience in custom music composition, sound design, audio production and voice over casting. Our team of staff composers and sound designers are passionate and take pride in understanding
SomaTone Interactive Inc. image
With over 1000 titles to our credit, SomaTone is the #1 provider of audio and art in games, period. Our active clients include Activision, Electronic Arts, Ubisoft, Zynga, Playdom, Big Fish Games, PopCap, Gazillion, F9, Gameloft, Arkadium, THQ, Disney, a
image
image
image image View All View Featured Schools image
Game Jams: Game Development Speed Dating
image Here, Game Developer magazine editor Patrick Miller outlines how you can hone your game design skills by taking part in high-speed game jams.
Hello World: Moving From Journalism To Development And Beyond
image Next Level Games programmer Brian Davis interviews former journalist and current game producer James Mielke to talk shop about working in the industry, switching career paths, and more.
Exploring Emotional Storytelling With Mother 3
image Erik Foss of The Guildhall at SMU picks apart the narrative of Mother 3 to demonstrate how this quirky GBA title succeeds and fails in creating an emotional bond with its players.
image
image

반응형
반응형

FaceFX is OC3 Entertainment’s cutting edge solution for creating realistic facial animation from audio files. FaceFX is the culmination of years of experience working with lip-synchronization, 3D graphics, and facial animation. The product makes it easy to batch process thousands of audio files for your game, add expressions to a single animation without ruining the lip-synchronization, tweak an animation to perfection, or integrate the entire solution into your art pipeline.

반응형
반응형

반응형
반응형

http://www.boho.or.kr/

인터넷관련 보안관리

반응형
반응형

http://occamsrazr.net/occam.php/OccamsRazorMain

반응형

'유틸리티 > 자료 & 사이트' 카테고리의 다른 글

마이크로소프트 MSDN  (0) 2012.10.31
한국인터넷진흥원  (0) 2012.10.31
게임 에디터  (0) 2012.10.31
씽크프리 웹에서 오피스를 쓰다 doc,xls,ppt - 무료  (0) 2012.10.31
오우거관련 카페  (0) 2012.10.31
반응형

반응형

'유틸리티 > 자료 & 사이트' 카테고리의 다른 글

마이크로소프트 MSDN  (0) 2012.10.31
한국인터넷진흥원  (0) 2012.10.31
류광의 번역홈페이지  (0) 2012.10.31
씽크프리 웹에서 오피스를 쓰다 doc,xls,ppt - 무료  (0) 2012.10.31
오우거관련 카페  (0) 2012.10.31
반응형

http://member.thinkfree.com/member/goLandingPage.action

구글자체에 문서도구라고 해서 ppt 비스므리하게 제공은 하는데 좀 허접하다

하지만 thinkfree Online 에서

구글 계정만 있으면 구글 아이디로 로그인해서 오피스를 웹상에서 쓸 수 있게 제공한다

( 모든 웹 브라우저에서 동작한다 )

아이폰 어플로도 보기 기능이 가능하도록 제공한다, 안드로이드에서는 완벽하게 동작 한다고 한다

(어플 도 무료)

기능은 거의 동일하게다 있는 것같다( 확인은 해보지 않았지만 )

pc 상에 설치한 오피스 파일들을 웹오피스로 읽어 들일 수 있다

아쉬운점은 저장공간이 1G 인데 웹상 편집해 pc 에서 읽어들인 파일에 대해서는 자신의 웹 공간에 곧바로

저장하지 못하는 것 같다 이걸 다운 받아서 다시 웹으로 올려야 한다

하지만 웹에 한번 올린 문서에 대해서는 웹에서 편집 저장이 가능하다

그리고 단점이 하나 더 있는데 느리다

저장시 느리다는걸 좀 많이 느낄 수 있다

이 두가지만 보안하면 좀... 사용해볼만은 할텐데..

아직 웹에서 오피스를 쓰는것에 대한 편안함은 별로 느껴지지 않는다

pc에 한번 깔면 이메일로 로그인해서 파일 보내기 한거랑 많이 다르지 않기때문이다

이러나 저러나 그냥 있으면 그냥 좋을뿐, 꼭 필요한 존재가 될꺼 같진 않다

반응형

'유틸리티 > 자료 & 사이트' 카테고리의 다른 글

마이크로소프트 MSDN  (0) 2012.10.31
한국인터넷진흥원  (0) 2012.10.31
류광의 번역홈페이지  (0) 2012.10.31
게임 에디터  (0) 2012.10.31
오우거관련 카페  (0) 2012.10.31
반응형

http://cafe.naver.com/gamelecture.cafe 

반응형

'유틸리티 > 자료 & 사이트' 카테고리의 다른 글

마이크로소프트 MSDN  (0) 2012.10.31
한국인터넷진흥원  (0) 2012.10.31
류광의 번역홈페이지  (0) 2012.10.31
게임 에디터  (0) 2012.10.31
씽크프리 웹에서 오피스를 쓰다 doc,xls,ppt - 무료  (0) 2012.10.31
반응형


[매트랩(Matlab)] 11. Meshgrid & 3차원 그래프(3D plot)  Matlab / 서바이벌 

2011/03/17 15:30

복사http://psahnwoo.blog.me/110105012447


 

 

I. Meshgrid

 

이게.. 뭘 쓰기가 참 거시기 한 게.. 이걸 언제 써야 잘 쓰는 건질 모르겠어요.

행렬 곱셈 할 때 속도가 빨라지긴 하던데. (이게 주 목적인 거 같긴 하다..)

그래서 그냥 글 하나를 스크랩 해 옴.. (목록 봐도 나오고 링크는 여기:http://blog.naver.com/horgan/40004255437)

 

 내가 아는거 라곤

 

X = 1:5; Y = 6:10; 의 두 벡터가 있을 때

meshgrid를 이용하면 아래와 같이 나온다는 것 뿐.

 

 EDU>> X = 1:5; Y = 6:10;
EDU>> [x,y]=meshgrid(X,Y)

x =

     1     2     3     4     5
     1     2     3     4     5
     1     2     3     4     5
     1     2     3     4     5
     1     2     3     4     5


y =

     6     6     6     6     6
     7     7     7     7     7
     8     8     8     8     8
     9     9     9     9     9
    10    10    10    10    10

 EDU>> [x,y] = meshgrid(X)

%meshgrid(X) = meshgrid(X,X)

x =

     1     2     3     4     5
     1     2     3     4     5
     1     2     3     4     5
     1     2     3     4     5
     1     2     3     4     5


y =

     1     1     1     1     1
     2     2     2     2     2
     3     3     3     3     3
     4     4     4     4     4
     5     5     5     5     5

 

 

 

II. 기본적인 3D plot : Line Graphs

 

2D 그래프 그릴 때와 비슷합니다. 축이 하나 더 생긴 것 뿐이죠..

plot3명령어를 이용합니다.

 

 X = 1:10
Y = 2*sin(X)
Z = exp(X)
plot3(X,Y,Z)

 

%그래도 헷갈리니까 웬만하면 label 하는 습관을~

 

좀 제대로 재밌는 모양으로..

 

 clf %clear figure
x = linspace(0,10*pi,1000);
y = cos(x);
z = sin(x);
plot3(x,y,z)
grid on % 기준선 그리기. grid off로 해제 가능
xlabel('x')
ylabel('y')
zlabel('z')

 

회전해보았습니다.

 

x랑 y축 위치가 바뀌었죠? 돌리다보면 헷갈림. label필수.

 

 

 

II. 3D surface plot : mesh, surf, Contour, surface contour

 

네 가지 종류의 표면 플롯을 간단히 구현할 수 있습니다.

 

 clf
x = -2:0.2:2;
y = -2:0.2:2;
[X,Y] = meshgrid(x,y); 
Z = X.*exp(-X.^2 - Y.^2);

%Subplot 을 이용한

%네 가지 surface plot 구현

 

subplot(2,2,1)
mesh(X,Y,Z) %mesh
title('Mesh')


subplot(2,2,2)
surf(X,Y,Z) %surface
title('Surf')


subplot(2,2,3)
contour(X,Y,Z) %contour
title('Contour')

subplot(2,2,4)
surfc(X,Y,Z)

%surface와contour가

%동시에 나타남
title('Surfc')

 

 %colormap 색을 바꿀 수 있다.

%자세한 건 help에서

%colormap 검색

 

 

 colormap('bone')


colormap('winter')

 

 clf
colormap('jet') 
%matlab default colormap


pcolor(X,Y,Z)
colorbar

%색변화를 이용해 2D그래프로

% 3D를 나타냄

%colorbar을 이용해 색 확인

 

반응형
반응형

http://asurabalblata.tistory.com/28


관리자 모드로 들어가셔서 html/css편집에 들어가주세요




반응형
반응형

http://www.cmsfactory.net/node/400


티스토리 블로그의 오른쪽 위를 보면 티스토리 관련 메뉴들을 모아 놓은 메뉴바(툴바)가 있습니다. 이 메뉴바의 모양은 관리자 모드의 [화면설정 > 화면출력]에서 수정할 수 있는데, 아예 안보이게 하는 기능은 없습니다.

이 메뉴바가 블로그 운영에 필요하다면 그대로 사용하면 되지만, 그 자리에 다른 내용을 넣거나 배너 등을 달고 싶으면 메뉴바가 없는게 나을 때가 있습니다. 만약 이 메뉴바가 필요 없다면 어떻게 하면 될까요?

메뉴바를 아예 불러오지 못하게 할 수는 없지만, 화면에서 안보이게 할 수는 있습니다. style.css 파일에 아래의 코드를 넣으면 됩니다.

#tistorytoolbarid {display: none;}

그러면 아래처럼 툴바(메뉴바)가 사라집니다.

반응형
반응형

http://www.favicon.cc/

반응형
반응형

Ion Gaztanaga

the Boost Software 라이센스 하에 배포되어졌다, Version 1.0.

(첨부된 파일을 보세요 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Boost.Container 라이브러리는 STL 컨테이너를 포함하면서, 몇몇의 잘알려진 컨테이너들을 수행한다.

라이브러리의 목적이 향상된 특징들을 제공하기위해서 표준안에서 존재하지않거나 또는 최신표준을 제공하기위해서 C++03 을 따르는 컴파일러들에 기초된 특징들이다.

간단히 말해서 , Boost.Container 가 무엇을 제공하는가?

  • 이동의미(론)가 수행되어진다, pre-C++11 컴파일러들에 대한 에뮬레이션을 포함하면서...
  • 새로운 향상된 특징기능들이 존재한다 ( 예를들어 배치삽입(placement insertion), 재귀적 컨테이너들) .
  • 컨테이너들은 stateful 할당기들을 제공하고 Boost.Interprocess(그것들은 공유의 메모리안에서 안전하게 위치되어질수 있다)
    함께 호환된다.
  • 라이브러리들은 새로운 유용한 컨테이너들을 제공한다:
    • flat_map, flat_set, flat_multiset 그리고 flat_multiset: 표준 연관 컨테이너들을 위한 예약없는 교체 그러나
      더 사용하기쉬운 메모리 그리고 더빠른 검색.
    • stable_vector:
      std::list 와 std::vector hybrid 컨테이너:
      vector같은 임의접근 iterators 와 삽입들과 삭제들에서 리스트같은 iterator 안전성.
    • slist: 상수시간 size()을 제공하던 예전의 이전표준 싱글링크드리스트 구현.
      주의 : C++11의 forward_list 은 어떤 size()도 가지지않는다.

Boost.Container를 빌드하는것

Boost.Container를 컴파일할 필요는없다, 그것은 오직 헤더라이브러리이기 때문에.

단지 당신의 컴파일러 include 경로에 당신의 Boost 헤어 디렉토리를 포함시켜라.

Boost.Container는 적절한 C++98 호환성을 필요로한다. 작동하기위한 알려진 몇몇의 컴파일러들이 존재한다 :

  • Visual C++ >= 7.1.
  • GCC >= 4.1.
  • Intel C++ >= 9.0

Last revised: August 15, 2012 at 23:43:58 GMT


효율적인 삽입

이동의미(론)와 배치삽입은 당신의 C++ 어플리케이션들안에서 매우 긍정적인 영향을 가질수 있는 C++1 컨테이너들에의해 제공되어진 두가지 특징들이다. Boost.컨테이너들은 C++과 c++03 컴파일러들 모두를 위해서 두가지의 기술들을 이행한다

Move-aware 컨테이너들

모든 컨테이너들은 이동만가능한 유일한 타입들을 저장할수있는 Boost.컨테이너에 의해서 제공되어지고 value_type을 위한 요구조건들은

각 컨테이너 연산들에 의존한다.

C++3 컴파일러들에서 조차 C++11 필요조건들을 따르면서, 많은 연산들은 단지 복사 생성할수있는 타입들 대신에 이동할수있거나

기본(default) 생성할수있는 타입들을 지금부터 필요로한다.

컨테이너 그것들자체는 또한 이동할수있다, 예외를던지지 않는 보장과함께 만약 allocator나 predicate(있을경우) 복사연산들은 예외를

던지지않는다면..

이것은 고성능 연산들을 가능하게한다 데이터를 벡터들사이에서 옮길때.

예제를 봅시다 :

#include <boost/container/vector.hpp>
#include <boost/move/move.hpp>
#include <cassert>

//Non-copyable 클래스
class non_copyable
{
   BOOST_MOVABLE_BUT_NOT_COPYABLE(non_copyable)

   public:
   non_copyable(){}
   non_copyable(BOOST_RV_REF(non_copyable)) {}
   non_copyable& operator=(BOOST_RV_REF(non_copyable)) { return *this; }
};

int main ()
{
   using namespace boost::container;

   //벡터안에서 noe-copyable 오브젝트들을 저장한다
vector<non_copyable> v; non_copyable nc; v.push_back(boost::move(nc)); assert(v.size() == 1); //Reserve는 복사생성할수있는것을 더이상 필요로하지 않는다 v.reserve(100); assert(v.capacity() >= 100); //이 resize 오버로드는 이동하거나 기본 생성할수있는것을 단지 필요로한다 v.resize(200); assert(v.size() == 200); //컨테이너들은 또한 이동할수있다 vector<non_copyable> v_other(boost::move(v)); assert(v_other.size() == 200); assert(v.empty()); return 0; }

Emplace: 배치 삽입

Boost.Container에 의해 제공되어진 모든 컨테이너들은 배치삽입을 수행한다, 그것은(배치삽입) 오브젝트들이 어떤 임시오브젝트를 생성하는것 없이 사용자 아규먼트들로부터 직접적으로 컨테이너로 만들 수 있다는것을 의미한다.

컴파일러들을 위해 variadic template들없이 배치삽입이 아규먼트들의 한정된 (10)번까지 애뮬레이트되어지도록 지원하시오.

이동하는 값비싼 타입들은 완벽한 후보자들이다

emplace 함수들과 노드컨테이너들(list, set, ...) emplace 의 경우에는 컨테이너들 안에서 이동할수없고 복사할수없는 타입들을

정렬하는것을 허락한다 :

#include <boost/container/list.hpp>
#include <cassert>

//복사할 수 없고 이동할수없는 클래스
class non_copy_movable
{
   non_copy_movable(const non_copy_movable &);
   non_copy_movable& operator=(const non_copy_movable &);

   public:
   non_copy_movable(int = 0) {}
};

int main ()
{
   using namespace boost::container;

   //리스트안에서 복사할수없고 이동할수없는 오브젝트들을 저장한다
   list<non_copy_movable> l;
   non_copy_movable ncm;

   //한 새로운 요소는 만들어질것이다, non_copy_movable(int)생성자를 호출하면서...
   l.emplace(l.begin(), 0);
   assert(l.size() == 1);

   //한 새로운 요소는 만들어질것이다, 기본 생성자를 호출하면서...
   l.emplace(l.begin());
   assert(l.size() == 2);
   return 0;
}



이하 번역대기........


번역된 페이지 http://www.boost.org/doc/libs/1_51_0/doc/html/container.html

http://www.boost.org/doc/libs/1_51_0/doc/html/container/move_emplace.html

반응형
반응형

Kevlin Henney

소개
예제
참고문서
값 타입 조건들
헤더 <boost/any.hpp>
감사인사

소개

일반적인( 템플릿 기반 프로그래밍에 대조되는 일반적인 의미에서) 타입이 필요합니다

: 실로 변하기 쉬운 변수들, 일반의 엄밀한 그리고 정적인 타입들보다 많은 다른 더 구체적인 타입들의 값에 부합하는 것.

우리는 일반적인 타입의 3가지 기본 종류들을 구분할 수 있습니다.

  • 가능한 값 타입들(예를들면 int 와 string)의 다수중 하나를 유지할 수 있는 변환하는 타입들, 그리고 자유롭게 그들 사이에서 자유롭게 변한다. (예를들면 5 를 "5" 또는 그반대의 경우도 해석하는것)
    그러한 타입들은 스크립팅과 그밖의 해석되어지는 언어 안에서 공통입니다.
    boost::lexical_cast 는 그러한 변환 기능을 제공한다.

  • 다른 타입들의 값 그러나 그들(즉 5는 "5" 또는 5.0 둘중 한쪽으로 절대 변환되어지 않고 int 로서 정확하게 유지된다 )
    사이에서 변환을 시도하지 않는 구별되는 타입들.
    단일값들의 일반적인 컨테이너들, 타입의 인지를 제외하고 해석에 대해 그것들의 동작없음은 그것들을 해석이가능한 변환으로부터 얘기치 않은 일에대해 범위없이 효과적으로 안전하게합니다.

  • 접근과 프로그래머에 대한 해석의 모든 형태들을 맡기면서, 무엇이든 참조할수있는 하지만 실제 기본 타입에대해 염두하지 않는 분간없는 타입들.
    이 일은 void* 에 의해 지배되어집니다 그것은 얘기치 않은 일, 분명하지 않은 행동에 대한 범위의 다량을 줍니다.

( C++ Report 12(7), July/August 2000, Kevlin Henney에 의해 "높이평가되는 변환들" 에서 설명되어진 같은 이름들의 클래스에 기초로되어진)

boost::any 클래스는 두번째 범주에 기반되는 변하기 쉬운 값 타입입니다.

boost::any는 어떤 값 타입과 boost::any의 타입에 정확하게 반대되는 어떤 값의 안전 점검된 추출의 복사를 지원합니다.

더 많은 적절한 연산들을 제공하기때문에, 유사한 디자인은 일반적인 함수 어뎁터(adaptor),any_funtion, 일반적인 iterator adaptor, any_iteator, 그리고 균일한 런타임 처리를 필요로하는 다른 오브젝트 타입들에 사용할수있습니다.

최근 2009 7월 26일, at 21:11:03 +0100 에 수정되었습니다.


예제

다음의 코드는 어떤 오브젝트들의 암시적 변환과 복사를 사용하는 것에 대해 문법을 설명합니다 :


#include <list>
#include <boost/any.hpp>

using boost::any_cast;
typedef std::list<boost::any> many;

void append_int(many & values, int value)
{
    boost::any to_append = value;
    values.push_back(to_append);
}

void append_string(many & values, const std::string & value)
{
    values.push_back(value);
}

void append_char_ptr(many & values, const char * value)
{
    values.push_back(value);
}

void append_any(many & values, const boost::any & value)
{
    values.push_back(value);
}

void append_nothing(many & values)
{
    values.push_back(boost::any());
}

다음은 이전 정의들로부터 흐름을 설명하고 어떤 오브젝트들에 대한 조건들의 사용을 설명합니다 :

bool is_empty(const boost::any & operand)
{
    return operand.empty();
}

bool is_int(const boost::any & operand)
{
    return operand.type() == typeid(int);
}

bool is_char_ptr(const boost::any & operand)
{
    try
    {
        any_cast<const char *>(operand);
        return true;
    }
    catch(const boost::bad_any_cast &)
    {
        return false;
    }
}

bool is_string(const boost::any & operand)
{
    return any_cast<std::string>(&operand);
}

void count_all(many & values, std::ostream & out)
{
    out << "#empty == "
        << std::count_if(values.begin(), values.end(), is_empty) << std::endl;
    out << "#int == "
        << std::count_if(values.begin(), values.end(), is_int) << std::endl;
    out << "#const char * == "
        << std::count_if(values.begin(), values.end(), is_char_ptr) << std::endl;
    out << "#string == "
        << std::count_if(values.begin(), values.end(), is_string) << std::endl;
}

OMG의 property 서비스를 본떠서 만들어 졌기때문에, 타음의 타입들은 임의의 값 타입들에 대해 name-value 쌍들을 정의합니다 :

struct property
{
    property();
    property(const std::string &, const boost::any &);

    std::string name;
    boost::any value;
};

typedef std::list<property> properties;

다음의 기본 클래스는 임의의 인자 타입들 또한 필요로하는 콜벡들에 기반을 둔 런타임 다형성에 하나의 접근을 설명합니다 :

class consumer
{
public:
    virtual void notify(const any &) = 0;
    ...
};



참고문서

ValueType 필요조건들

값들(values)은 독자성이 중요하지 않은 견고한 정보의 오브젝트들이다, 즉 주안점은 대게 그것들의 상태와 그것들 주위에

조직화된 행동이다.

값들에 대해 또 하나의 구별되는 특징은 그것들의 단위이다:

예를들자면 보통은 다수와 같은 시스템안에서 간단한 개념들을 나타내는 조직적인 오브젝트들이다

한 값의 주안점은 그것의 상태안에 놓여있는것으로 그것은 독립성이 아니다,

값들이 복사되어질수 있고 대체적으로 다른것에서 하나가 할당 되어질수 있다,

public 복사생성자와 public 할당 operator의 명시적 또는 묵시적 정의를 필요로 하면서...

값들은 힙에 보다는 대체로 다른 범위들 즉 오브젝트들 또는 블럭들 내부에 남아있다

값들은 그러므로 보통 전달되어지고 곧장 조작되어진다 값들 또는 참조를 통함으로서...

하지만 독립성과 간접적인 방법을 잘 나타내는 포인터로서가 아닌..

any 에 사용되어지기 위한 값타입들에 대한 구체적인 필요조건이다 :

  • ValueType 은 복사생성되어진다[20.1.3].
  • ValueType 은 선택적으로 할당되어진다[23.1]. 강한 예외안전보장은 할당의 모든형태들에 필요하다.
  • ValueType에 대한 파괴자는 예외를던지지않는 예외안정보장성을 유지시킨다.

Header <boost/any.hpp>

namespace boost {
  class bad_any_cast;
  class any;
  template<typename T> T any_cast(any &);
  template<typename T> T any_cast(const any &);
  template<typename ValueType> const ValueType * any_cast(const any *);
  template<typename ValueType> ValueType * any_cast(any *);
}

Copyright © 2001 Kevlin Henney

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)



번역된 원문 http://www.boost.org/doc/libs/1_51_0/doc/html/any.html

http://www.boost.org/doc/libs/1_51_0/doc/html/any/s02.html

반응형
반응형

Eric Niebler

저작권 © 2005, 2006 Eric Niebler

Boost 소프트웨어 라이센스에 의해 배포되어졌다(참부파일을 보세요 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

목록

서문

사용자의 가이드
Accumulators 프레임워크
통계의 Accumulators 라이브러리
감사의 글
참고사항
Accumulators 프레임워크 참고문서
통계적 라이브러리 참고문서
수 연산들 라이브러리 참고문서

서문

정확히 잘못된 것 보다 대략 맞는게 더 낫다

-- 속담

설명

Boost.Accumulators 는 대체적으로 증분 계산을 위한 확장가능한 프레임워크 분만 아니라 증분 통계 계산을 위한 라이브러리 입니다

라이브러리는 accumulator 의 개념을 주로 취급합니다 그리고 accumulator 는 몇몇의 내부상태를 유지하고 한번에 데이터 한 샘플을 받아들이는 기본 계산에관한 엔티티입니다.

이 accumulators는 다른 accumulators에 있는 그들의 계산 몇몇을 떠남길지도 모른다 그리고 다른 accumulators를 accumulators가 의존합니다

Accumulators 는 accumulator 세트 하나와 함께 그룹화되어집니다.

Boost.Accumulators는 한 세트안의 accumulators 와 accumulators가 적절한 명령에서 처리되어지는 것을 보장하는 것 사이에서

상호의존성을 해결합니다

최근 2010년 8월 15일at 23:42:55 GMT 에 수정되었습니다.


유저 가이드

이 섹션은 새로운 accumulators를 생성하기위한 Boost.Accumulators 프레임워크를 사용하는 방법 그리고 증분 통계적 계산을

수행하기 위한 존재하는 통계적 accumulators를 사용하기 위한 방법을 설명합니다

Boost.Accumulators에 구체적인 구성요소에 관한 상세한 정보를 위해서, Reference 섹션을 확인하세요

Hello, World!

아래에 Accumulators 프리엠워크를 사용하는 방법과 증분 통계적 계산을 수행하기 위한 통계적 Accumulators에 대한 완전한 예제가 있습니다.

그것은 평균과 더블(doubles)의 시퀀스에대한 2nd moment(통계학 용어) 를 계산합니다.

#include <iostream>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/mean.hpp>
#include <boost/accumulators/statistics/moment.hpp>
using namespace boost::accumulators;

int main()
{
    // 2nd moment와 평균을 계산하는 것을 위한 accumulator 세트를 정의합니다
accumulator_set<double, stats<tag::mean, tag::moment<2> > > acc; // 몇몇의 데이터를 넣습니다 ... acc(1.2); acc(2.3); acc(3.4); acc(4.5); // 결과를 보여줍니다 ... std::cout << "Mean: " << mean(acc) << std::endl; std::cout << "Moment: " << accumulators::moment<2>(acc) << std::endl; return 0; }

이 프로그램은 다음을 보여줍니다:

Mean:   2.85
Moment: 9.635

* 이하 보류(0)


번역된 원문

http://www.boost.org/doc/libs/1_51_0/doc/html/accumulators.html

http://www.boost.org/doc/libs/1_51_0/doc/html/accumulators/user_s_guide.html

반응형
반응형

이 문서는 오직 전체 부스트의 문서의 일부를 나타냅니다 : QuickBook 이나 BoostBook 소스 로부터 발생되어진 문서입니다

결국 모든 Boost 라이브러리들은 그것들의 포멧들을 사용할지도 모릅니다.

하지만 그동안에, Boost의 문서의 많은 양은 이곳에서 이용할 수 없습니다.

컴퓨터 문서를 위한 http://www.boost.org/libs 를 보세요.

이 문서안에 기술되어진 라이브러리들의 몇몇을 위한 문서는 선택적 포멧(아래 두개)들안에서 이용 가능합니다 :

Boost 원문 : http://www.boost.org/doc/libs/1_51_0/doc/html/about.html

반응형
반응형

번역자 : 3DMP 운영자

boost 버전 : Boost 1.51.0 Library

원본 : http://www.boost.org

목적 : study

용어 : boost 에서 정해져있는 영어 대명사등이 될법한 것들을 번역하지 않고 그대로 기제합니다

남기는 말 : 해석순서는 순차적으로 가지만 쓸만한것 위주로 번역하고 번역하지 않고 보류하는 것에 대해선

제목과 같이 써놓겠습니다.

틀린 번역이나 오타가 있다면 댓글 달아주시거나 글을 남겨주시면 참고하여 수정하도록 하겠습니다



[Boost 1.51.0 라이브러리 문서]

항목별로

문자와 문자 처리

  • Conversion: 다형성과 사전적 캐스트들.
  • Format: format 라이브러리는 foramt-string을 따라 아규먼트들을 포멧하기위한 클래스를 제공한다, printf가 제공하는것처럼,
    그러나 주요 차이점 :
    format 은 내부의 스트림으로 아규먼트들을 전달한다, 그리고 또한 온전히 타입이 안전하고 자연스럽게 모든 유저저의 타입들을 지원한다.
  • Iostreams: Boost.IOStreams은 정의되는 스트림, 스트림 버퍼와 입/출력 파일을 위한 프레임워크를 제공한다.
  • Lexical Cast: 일반적인 문자그대로의 텍스트 변환, int가 string을 나타내거나 또는 반대인경우, Kevlin Henney로부터...
  • Locale: 로컬리제이션과 C++을 위한 툴들을 취급하는 유니코드를 제공한다.
  • Regex: 정규표현식 라이브러리.
  • Spirit: LL 파서 프레임워크는 인라인된 C++안에서 EBNF 문법처럼 직접적으로 파서들을 나타낸다.
  • String Algo: String 알고리즘 라이브러리.
  • Tokenizer: string또는 토큰들의 나열로 다른 문자연속을 분리한다.
  • Wave: Boost.Wave 라이브러리는 표준 준수이고, C99/C++ 프로세서 기능성의 고도로 설정된 수행이 iterator 인터페이스를 사용하기 위해서 쉬운것을 넘어 포장되어있다.
  • Xpressive: string이나 expreesion 템플릿처럼 쓰여질수있는 정규표현식, 그리고 그것은(expression 템플릿)은 각각 다른것들 그리고
    그들과 context-free 문법의 힘을가지고 재귀적으로 그것자체들을 참조한다.

컨테이너들

  • Array: 상수 사이즈의 배열을 위한 STL 호환 컨테이너 래퍼.
  • Bimap: C++을 위한 양방향성의 map 라이브러리. Boost.Bitmap으로 당신은 양쪽 타입이 키 로서 사용되어질 수 있는 연관 컨테이너를 만들 수있다.
  • Circular Buffer: STL 준수 컨테이너는 링이나 순환버퍼로 또한 알려져있다.
  • Container: 표준라이브러리 컨테이너와 확장들.
  • Dynamic Bitset: dynamic_bitset 클래스는 비트의 세트를 나타낸다. 그것은 operator[] 를 거쳐 각각의 비트의 값으로 접근과 그리고
    본래의 정수들로 적용할 수 있는 비트에관한 operator들의 모든것을 제공한다, 예를들어 operator&와 operator<< 세트안의 숫자가 dynamic_bitset의 생성자에 파라미터를 가쳐 실행시간에 구체화되어지는것과 같이.
  • GIL: 일반적 이미지 라이브러리
  • Graph: BGL 그래프 인터페이스와 그래프 구성요소는 일반적이다, 같은 의미안에서 표준 템플릿 라이브러리(STL) 처럼.
  • ICL: 인터벌 컨테이너 라이브러리, 인터벌 세트들(sets) 그리고 맵들(maps)과 연관되어있는 값들의 집합
  • Intrusive: Intrusive 컨테이너들과 알고리즘들.
  • Multi-Array: Boost.MultiArray는 일반적은 N 차원적의 배열 컨셉정의와 그것(배열)의 인터페이스의 공통적 구현을 제공한다.
  • Multi-Index: Boost 멀티인덱스 컨테이너 라이브러리는 하나 또는 다른 정렬과 접근 의미를 가지고 더많은 인덱스들을 유지하는 컨테이너의 구조를 가능하게하는 multi_index_container로 지명된 클래스 템플릿을 제공한다.
  • Pointer Container: 객체지향적 프로그래밍을 용이하게 하기위해서 힙이할당된 다형성 오브젝트를 정렬을 위한 컨테이너.
  • Property Map: value 오브젝트로 키 오브젝트를 만든 인터페이스를 정의한 개념.
  • Property Tree: 환경설정 데이터를 정렬하는것에 특별히 적합한 트리 데이터구조.
  • Unordered: 정렬되지않은 연관 컨테이너.
  • Variant: 안전, 일반적, 스택 기반된 차별된 병합(union) 컨테이너.

이터레이터들

  • GIL: =(일반적인 이미지 라이브러리)
  • Graph: BGL 그래프 인터페이스와 그래프 구성요소는 일반적(포괄적)이다, 표준 템플릿 라이브러리(STL)로서 같은 의미안에서.
  • Iterators: Boost 이터레이터(Iterator) 라이브러리는 두가지를 포함한다. 첫번째는 C++ 표준 이터레이터 필요조건을 확장할수 있는 개념의 시스템이다. 두번째는 이 확장되어진 개념들로 기반되어진 이터레이터를 만들기위한 구성요소들의 프레임워크이다 그리고 몇몇의 유용한 이터레이터 어뎁터(adaptors)를 포함한다.
  • Operators: 템플릿은 산술클래스들과 이터레이터들을 용이하게한다.
  • Tokenizer: string 이나 토큰의 연속에서 다른 문자 시퀀스를 절단(분할)한다.

알고리즘들

  • Algorithm: 유용한 일반적 알고리즘들의 모임.
  • Foreach: In C++, writing a loop that iterates over a sequence is tedious. We can either use iterators, which requires a considerable amount of boiler-plate, or we can use the std::for_each() algorithm and move our loop body into a predicate, which requires no less boiler-plate and forces us to move our logic far from where it will be used. In contrast, some other languages, like Perl, provide a dedicated "foreach" construct that automates this process. BOOST_FOREACH is just such a construct for C++. It iterates over sequences for us, freeing us from having to deal directly with iterators or write predicates.
  • Geometry: Geometry Library.
  • GIL: Generic Image Library
  • Graph: The BGL graph interface and graph components are generic, in the same sense as the the Standard Template Library (STL).
  • Min-Max: Standard library extensions for simultaneous min/max and min/max element computations.
  • Range: A new infrastructure for generic algorithms that builds on top of the new iterator concepts.
  • String Algo: String algorithms library.
  • Utility: Class noncopyable plus checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom.

함수 오브젝트들과 고차원 프로그래밍

  • Bind: boost::bind is a generalization of the standard functions std::bind1st and std::bind2nd. It supports arbitrary function objects, functions, function pointers, and member function pointers, and is able to bind any argument to a specific value or route input arguments into arbitrary positions.
  • Function: Function object wrappers for deferred calls or callbacks.
  • Functional: The Boost.Function library contains a family of class templates that are function object wrappers.
  • Functional/Factory: Function object templates for dynamic and static object creation
  • Functional/Forward: Adapters to allow generic function objects to accept arbitrary arguments
  • Functional/Hash: A TR1 hash function object that can be extended to hash user defined types.
  • Functional/Overloaded Function: Overload different functions into a single function object.
  • Lambda: Define small unnamed function objects at the actual call site, and more.
  • Local Function: Program functions locally, within other functions, directly within the scope where they are needed.
  • Member Function: Generalized binders for function/object/pointers and member functions.
  • Phoenix: Define small unnamed function objects at the actual call site, and more.
  • Ref: A utility library for passing references to generic functions.
  • Result Of: Determines the type of a function call expression.
  • Signals: Managed signals & slots callback implementation.
  • Signals2: Managed signals & slots callback implementation (thread-safe version 2).
  • Utility: Class noncopyable plus checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom.

일반적인 프로그래밍

  • Call Traits: Defines types for passing parameters.
  • Concept Check: Tools for generic programming.
  • Enable If: Selective inclusion of function template overloads.
  • Function Types: Boost.FunctionTypes provides functionality to classify, decompose and synthesize function, function pointer, function reference and pointer to member types.
  • GIL: Generic Image Library
  • In Place Factory, Typed In Place Factory: Generic in-place construction of contained objects with a variadic argument-list.
  • Operators: Templates ease arithmetic classes and iterators.
  • Property Map: Concepts defining interfaces which map key objects to value objects.
  • Static Assert: Static assertions (compile time assertions).
  • Type Traits: Templates for fundamental properties of types.

템플릿 메타프로그래밍

  • Function Types: Boost.FunctionTypes provides functionality to classify, decompose and synthesize function, function pointer, function reference and pointer to member types.
  • Fusion: Library for working with tuples, including various containers, algorithms, etc.
  • MPL: The Boost.MPL library is a general-purpose, high-level C++ template metaprogramming framework of compile-time algorithms, sequences and metafunctions. It provides a conceptual foundation and an extensive set of powerful and coherent tools that make doing explict metaprogramming in C++ as easy and enjoyable as possible within the current language.
  • Proto: Expression template library and compiler construction toolkit for domain-specific embedded languages.
  • Static Assert: Static assertions (compile time assertions).
  • Type Traits: Templates for fundamental properties of types.

프로세서 메타프로그래밍

  • Identity Type: Wrap types within round parenthesis so they can always be passed as macro parameters.
  • Preprocessor: Preprocessor metaprogramming tools including repetition and recursion.

동시(병행) 프로그래밍

  • Asio: Portable networking, including sockets, timers, hostname resolution and socket iostreams.
  • Context: Context switching library.
  • Interprocess: Shared memory, memory mapped files, process-shared mutexes, condition variables, containers and allocators.
  • MPI: Message Passing Interface library, for use in distributed-memory parallel application programming.
  • Thread: Portable C++ multi-threading.

수학과 수치(수)

  • Accumulators: Framework for incremental calculation, and collection of statistical accumulators.
  • Geometry: Geometry Library.
  • Integer: The organization of boost integer headers and classes is designed to take advantage of <stdint.h> types from the 1999 C standard without resorting to undefined behavior in terms of the 1998 C++ standard. The header <boost/cstdint.hpp> makes the standard integer types safely available in namespace boost without placing any names in namespace std.
  • Interval: Extends the usual arithmetic functions to mathematical intervals.
  • Math: Boost.Math includes several contributions in the domain of mathematics: The Greatest Common Divisor and Least Common Multiple library provides run-time and compile-time evaluation of the greatest common divisor (GCD) or least common multiple (LCM) of two integers. The Special Functions library currently provides eight templated special functions, in namespace boost. The Complex Number Inverse Trigonometric Functions are the inverses of trigonometric functions currently present in the C++ standard. Quaternions are a relative of complex numbers often used to parameterise rotations in three dimentional space. Octonions, like quaternions, are a relative of complex numbers.
  • Math Common Factor: Greatest common divisor and least common multiple.
  • Math Octonion: Octonions.
  • Math Quaternion: Quaternions.
  • Math/Special Functions: A wide selection of mathematical special functions.
  • Math/Statistical Distributions: A wide selection of univariate statistical distributions and functions that operate on them.
  • Multi-Array: Boost.MultiArray provides a generic N-dimensional array concept definition and common implementations of that interface.
  • Numeric Conversion: Optimized Policy-based Numeric Conversions.
  • Operators: Templates ease arithmetic classes and iterators.
  • Random: A complete system for random number generation.
  • Ratio: Compile time rational arithmetic.
  • Rational: A rational number class.
  • uBLAS: uBLAS provides matrix and vector classes as well as basic linear algebra routines. Several dense, packed and sparse storage schemes are supported.

확성과 테스팅

  • Concept Check: Tools for generic programming.
  • Static Assert: Static assertions (compile time assertions).
  • Test: Support for simple program testing, full unit testing, and for program execution monitoring.

데이터 구조들

  • Any: Safe, generic container for single values of different value types.
  • Bimap: Bidirectional maps library for C++. With Boost.Bimap you can create associative containers in which both types can be used as key.
  • Compressed Pair: Empty member optimization.
  • Container: Standard library containers and extensions.
  • Fusion: Library for working with tuples, including various containers, algorithms, etc.
  • Heap: Priority queue data structures.
  • ICL: Interval Container Library, interval sets and maps and aggregation of associated values
  • Multi-Index: The Boost Multi-index Containers Library provides a class template named multi_index_container which enables the construction of containers maintaining one or more indices with different sorting and access semantics.
  • Pointer Container: Containers for storing heap-allocated polymorphic objects to ease OO-programming.
  • Property Tree: A tree data structure especially suited to storing configuration data.
  • Tuple: Ease definition of functions returning multiple values, and more.
  • Uuid: 일반적으로 유일한 식별자.
  • Variant: Safe, generic, stack-based discriminated union container.

영역 세부적인 특성

  • Chrono: 유용한 시간 유틸리티들.
  • CRC: The Boost CRC Library provides two implementations of CRC (cyclic redundancy code) computation objects and two implementations of CRC computation functions. The implementations are template-based.
  • Date Time: A set of date-time libraries based on generic programming concepts.
  • Units: Zero-overhead dimensional analysis and unit/quantity manipulation and conversion.
  • Uuid: 일반적으로 유일한 식별자.

이미지 프로세싱

  • GIL: 일반적 이미지 라이브러리

입/출력

  • Asio: Portable networking, including sockets, timers, hostname resolution and socket iostreams.
  • Assign: Filling containers with constant or generated data has never been easier.
  • Format: The format library provides a class for formatting arguments according to a format-string, as does printf, but with two major differences: format sends the arguments to an internal stream, and so is entirely type-safe and naturally supports all user-defined types; the ellipsis (...) can not be used correctly in the strongly typed context of format, and thus the function call with arbitrary arguments is replaced by successive calls to an argument feeding operator%.
  • IO State Savers: The I/O sub-library of Boost helps segregate the large number of Boost headers. This sub-library should contain various items to use with/for the standard I/O library.
  • Iostreams: Boost.IOStreams provides a framework for defining streams, stream buffers and i/o filters.
  • Program Options: The program_options library allows program developers to obtain program options, that is (name, value) pairs from the user, via conventional methods such as command line and config file.
  • Serialization: Serialization for persistence and marshalling.

상호간의 언어지원

  • Python: The Boost Python Library is a framework for interfacing Python and C++. It allows you to quickly and seamlessly expose C++ classes functions and objects to Python, and vice-versa, using no special tools -- just your C++ compiler.

언어 특징 에뮬레이션

  • Exception: The Boost Exception library supports transporting of arbitrary data in exception objects, and transporting of exceptions between threads.
  • Foreach: In C++, writing a loop that iterates over a sequence is tedious. We can either use iterators, which requires a considerable amount of boiler-plate, or we can use the std::for_each() algorithm and move our loop body into a predicate, which requires no less boiler-plate and forces us to move our logic far from where it will be used. In contrast, some other languages, like Perl, provide a dedicated "foreach" construct that automates this process. BOOST_FOREACH is just such a construct for C++. It iterates over sequences for us, freeing us from having to deal directly with iterators or write predicates.
  • Move: C++03과 C++11 컴파일러를 위한 이식성있는 이동 의미.
  • Parameter: Boost.Parameter 라이브러리 - 이름에 의해서 아규먼트들을 받아들이는 함수들을 작성한다.
  • Scope Exit: 종료범위에서 임의적인 코드 실행.
  • Typeof: operator 애뮬레이션에대한 typeof.

메모리

  • Pool: 메모리풀 관리.
  • Smart Ptr: 스마트 포인터(smart pointer) 클래스 템플릿.
  • Utility: Class noncopyable plus checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom.

파싱

  • Spirit: LL parser framework represents parsers directly as EBNF grammars in inlined C++.

패턴과 숙어

  • Compressed Pair: 비어있는 멤버 최적화.
  • Flyweight: Design pattern to manage large quantities of highly redundant objects.
  • Signals: Managed signals & slots callback implementation.
  • Signals2: Managed signals & slots callback implementation (thread-safe version 2).
  • Utility: Class noncopyable plus checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom.

프로그래밍 인터페이스들

  • Function: Function object wrappers for deferred calls or callbacks.
  • Parameter: Boost.Parameter Library - Write functions that accept arguments by name.

상태 머신들

  • Meta State Machine: A very high-performance library for expressive UML2 finite state machines.
  • Statechart: Boost.Statechart - Arbitrarily complex finite state machines can be implemented in easily readable and maintainable C++ code.

시스템

  • Chrono: 유용한 시간 유틸리티들.
  • Context: 문맥 스위칭 라이브러리.
  • Date Time: A set of date-time libraries based on generic programming concepts.
  • Filesystem: The Boost Filesystem Library provides portable facilities to query and manipulate paths, files, and directories.
  • System: Operating system support, including the diagnostics support that will be part of the C++0x standard library.
  • Thread: 이식성있는 C++ 멀티 쓰래딩.

갖가지 주제를 다루는

  • Conversion: 다형성과 Lexical Cast.
  • Lexical Cast: General literal text conversions, such as an int represented a string, or vice-versa, from Kevlin Henney.
  • Numeric Conversion: Optimized Policy-based Numeric Conversions.
  • Optional: 선택적 값들을 위한 구별되어지는 결합적인 랩퍼(wrapper).
  • Polygon: Booleans/clipping, resizing/offsetting and more for planar polygons with integral coordinates.
  • Program Options: The program_options library allows program developers to obtain program options, that is (name, value) pairs from the user, via conventional methods such as command line and config file.
  • Swap: 향상된 일반적인 교체(swap) 함수.
  • Timer: Event timer, progress timer, and progress display classes.
  • TR1: The TR1 library provides an implementation of the C++ Technical Report on Standard Library Extensions. This library does not itself implement the TR1 components, rather it's a thin wrapper that will include your standard library's TR1 implementation (if it has one), otherwise it will include the Boost Library equivalents, and import them into namespace std::tr1.
  • Tribool: 3-상태 불리언 타입라이브러리.
  • Utility: Class noncopyable plus checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom.
  • Value Initialized: Wrapper for uniform-syntax value initialization, based on the original idea of David Abrahams.

깨진 컴파일러 회피방법

  • Compatibility: 표준 라이브러리를 따르지않는것을 위해 돕니다.
  • Config: Boost 라이브러리 개발자들이 컴파일러 특이방식에 적응하도록 돕는다; 라이브러리 유저를 위해서 고려되지않았다.

Revised $Date: 2012-08-29 18:37:51 -0400 (Wed, 29 Aug 2012) $

Distributed under the Boost Software License, Version 1.0.


번역 원문 : http://www.boost.org/doc/libs/1_51_0/?view=categorized

반응형
반응형

반응형
반응형

[밀리언 파티클 시스템]

http://210.96.133.182/knowledge/trend/abroad/__icsFiles/afieldfile/2010/05/02/72218.pdf


[파티클 엔진]

http://www4.wittenberg.edu/academics/mathcomp/computer_science/students/student_projects/computer%20graphics/bixler_guthikonda/index.html


[파티클시스템]

http://www.google.co.kr/url?sa=t&rct=j&q=%ED%8C%8C%ED%8B%B0%ED%81%B4%EC%8B%9C%EC%8A%A4%ED%85%9C&source=web&cd=1&ved=0CDQQFjAA&url=http%3A%2F%2Fcfs7.tistory.com%2Fupload_control%2Fdownload.blog%3Ffhandle%3DYmxvZzIwOTc5NEBmczcudGlzdG9yeS5jb206L2F0dGFjaC8wLzEyLnBkZg%3D%3D%26filename%3DClass08.pdf&ei=0c4wT5OHKIueiAfFvIyABQ&usg=AFQjCNHAP0WEevj95zn1t2ZjOwNtkONxUg&sig2=a1O1RjcbZHWnNqlwe-3qVQ&cad=rjt

http://www.google.co.kr/url?sa=t&rct=j&q=%ED%8C%8C%ED%8B%B0%ED%81%B4%EC%8B%9C%EC%8A%A4%ED%85%9C&source=web&cd=10&ved=0CGQQFjAJ&url=http%3A%2F%2Fpds5.egloos.com%2Fpds%2F200705%2F27%2F66%2F(particle_system).ppt&ei=0c4wT5OHKIueiAfFvIyABQ&usg=AFQjCNGKqBsmMz57U45RYXBVF3vrtd6MRg&sig2=mfdAbChMMCHtuImHGcRRzA&cad=rjt


GPU를 이용한 실시간 분수 시뮬레이션을 위한 파티클 시스템

http://visualcomputing.yonsei.ac.kr/papers/domestic/KCC08_sh.pdf


ppt 인데 소스 좀 있는것

http://graphics.pcu.ac.kr/nicesk/DirectX_2/10week/14Particle.pdf

http://www.google.co.kr/url?sa=t&rct=j&q=%ED%8C%8C%ED%8B%B0%ED%81%B4%EC%8B%9C%EC%8A%A4%ED%85%9C&source=web&cd=65&ved=0CEAQFjAEODw&url=http%3A%2F%2Fdis.dankook.ac.kr%2Flectures%2Fgame07%2Fattachment%2F1363750330.pdf&ei=ztYwT72WLaOkiAeft8SVBQ&usg=AFQjCNFFetFktZ4v9UFLaxLaDlxJevXHsA&sig2=bFSOrdtnlJTuSDCppIEvig&cad=rjt

반응형
반응형

http://blog.naver.com/doridori3510/30130730459



* 우연한 계기로. 컴포넌트 기반으로 게임을 설계하는 블로그까지 흘러갔다.

링크 : http://kiro86.egloos.com/661187

이번에 과제를 수행하면서

계속되는 상속의 상속의 상속..

그러다가 새로운 기능이 추가되면.

쓸데없는 부분까지 상속..

아. 코드가 지저분해지고 있어.

게임 개발에서도 보통 이런식의 계층적인 상속 구조로 진행해왔는데.

시간이 갈수록 점점 복잡해지는 게임의 오브젝트들.

나무가 움직이고, 돌이 깨지고.. 등등

그래서 좀더 유지보수와 개발을 편리하게 하기위한 설계의 하나의 방법인

컴포넌트 기반으로 클래스간의 관계를 정립하자.

컴포넌트가 무엇이냐.

그냥 쉽게 하나의 속성(?)으로 생각하면 될듯.

인간 이라는 오브젝트는

걸을 수 있다. ( 컴포넌트 1 )

죽을 수 있다. ( 컴포넌트 2 )

체력이 있다. ( 컴포넌트 3 )

..등등등. ...

다양한 속성을 지니고 있지 않은가.

GPG6 에 있는, 4.6 게임 객체 구성요소 시스템 에 그에 대한 설명이 나와있따.

정리를 해보자면.

GameObject. 하나의 오브젝트 ( 사람, 자동차, 몬스터.. 등등 )

class GameObject

{

map<Component_ID, *Component> 컴포넌트 자료 집합

Add_Component() // 컴포넌트 추가

Remove_Componet() // 컴포넌트 삭제

Get_Component( ID ) // 컴포넌트 ID에 대응되는 컴포넌트 리턴

}

이런식으로,

하나의 오브젝트는 여러개의 컴포넌트들을 추가하거나, 삭제, 인터페이스 Get 을 할수 있어야 겟다.

Component. 하나의 속성 ( 그려진다, 체력이 있다. 움직일 수있다.. )

class Component

{

GameObject* pOwner; // 현재 컴포넌트를 가지고 있는 오브젝트의 포인터를 가지고 있어야 한다.

// 컴포넌트끼리의 의사소통을 위해서.

// Owner 를 통해서, 또다른 컴포넌트를 얻어와야한다.

GetID() // 컴포넌트별로 식별 가능한 고유 아이디

GetFamilyID() // 비슷한 종류의 컴포넌트끼리의 그룹 아이디

}

이런식으로,

컴포넌트는 자기만의 식별 가능한 아이디를 가지고 있어야한다.

책에서는 클래스의 이름을 아이디로 하면, 서로 중복되지않는 고유 아이디를 가질 수 있다고!

패밀리 아이디가 필요한 이유도 있는데.

만약

그릴수 있는 컴포넌트가 있다.

class Component_Render

그리고 원을 그리는 컴포넌트가 있다. 어차피 그리는 컴포넌트니깐. 상위 컴포넌트를 상속 받는다.

class Component_Render_Sphere : public mponent_Render

또, 네모를 그리는 컴포넌트가 있다. 마찬가지로 상속

class Component_Render_Rect : public mponent_Render

이제.

class GameObject_A 가 있다.

근데 이놈은, 어떨경우에는 원을 그리고, 다른경우에는 네모도 그린다.

그렇다면 코드상에서

if( 원 컴포넌트 )

원 컴포넌트 -> Render()

else ( 네모 컴포넌트 )

네모 컴포넌트 -> Render()

이렇게 해야한단 말인가? 말도 안됨.

그래서 책에서는 FamilyID 를 통해서,

공통된 그룹은 그냥 상위 컴포넌트의 인터페이스를 가져와서 하면 된다고.

if( 렌더링 컴포넌트 )

렌더링 컴포넌트 -> Render() // 알아서, 현재 원이라면 원을 그리고, 네모라면 네모를 그리것지.

// 기본 코어는 끝이고.

// 책에서는 추가적으로. 템플릿 팩토리 객체. 를 통해서 컴포넌트와 오브젝트를 생성한다.

객체를 생성하는데 좀더 편하게 만들기 위해서.

각자 컴포넌트, 오브젝트를 생성하는 객체를 만들고.

이 객체들을 생성하는 팩토리 객체를 만들어서.

관리를 한다.

반응형
반응형



water reflection 수면 반사 방법! DirectX

2011/12/15 10:12

복사 http://blog.naver.com/doridori3510/30126259858


수면 반사에 대해 shaderx2 라는 책을보고 했지만 !

쉐이더 코드는 어셈으로 되어있었고ㅜㅜ 하다못해 소스는 컴파일이 안되고ㅜㅜ

삽질하는 경우가 많아서. 정리해본다.

처리 프로세스를 간략하게 정리하자면..

1. 현재 화면을 렌더링 한다.

2. 현재 카메라의 view 매트릭스를 미러링 한다.

3. 미러링된 view로 텍스쳐에 현재 화면을 그린다. ( 단, 수면을 경계로 cliping 한 영역을 그린다 )

4. 그려진 텍스쳐를 쉐이더 코드를 통해서 렌더링한다.

TIP. 카메라를 미러링 하기

그림판으로 대충 그린 그림으로 보고 이해를 하자면.

원본 카메라의 view를 플랜을 기준으로 미러링을 시킨다.

책에서는 자세하게 설명이 되어있는데.

어쨋든 현재 view를 미러링 시키기 위한 matrix를 만들어낼수 있다.

// 반사 매트릭스

D3DXMATRIX mtxReflect;
D3DXMatrixIdentity( &mtxReflect );
mtxReflect._22 = -1.0f;
mtxReflect._42 = 2.0f * WATER_HEIGHT;

현재 카메라의 view를 반사 매트릭스와 곱하면, 미러링된 카메라의 view를 얻을수 있다.

이 view를 셋팅을 하고 장면을 렌더링하면 반사된 장면을 얻을수 있다.

참고사항 :

1. 물을 기준으로 클리핑을 해서 미러 view로 렌더링 해야한다.

클리핑 평면을 셋팅하는데 쉐이더 코드로 메쉬를 그린다면! 평면을 trasform 해주어야 한다.

// 이런식으로 평면을 한번더 Transform 해준후에 디바이스에 셋팅하자.

D3DXMATRIX mtxView = *(pCamera->GetViewMatrix());
D3DXMATRIX mtxProj = *(pCamera->GetProjMatrix());

D3DXMATRIXA16 WorldToProjection = mtxView * mtxProj;

D3DXMatrixInverse(&WorldToProjection, NULL, &WorldToProjection);
D3DXMatrixTranspose(&WorldToProjection, &WorldToProjection);

D3DXPlaneTransform( &m_clip_plane, &m_local_plane, &WorldToProjection );
D3DXPlaneNormalize( &m_clip_plane, &m_clip_plane );

2. 평면을 기준으로 클리핑 할때, 약간 더 실제 평면 아래쪽으로 클리핑해야지 수면과의 경계에서 약간씩 틈이 보이는것을 방지할 수있다. 일명 약간의 꼼수!

< 왼쪽 : 실제 현재 view > < 오른쪽 : 미러 view로 직은 모습 >

TIP. 반사된 장면을 평면에 투영하기

반사된 장면을 찍었는데, 그냥 평면에다가 SetTexture로 그리면 아마 뭔가 좌표값이 안맞아서 이상하게 그려질 것이다. 이 문제로 한 3일간 삽질한것 같은데..

결론은. 평면을 렌더링 할때 텍스쳐의 uv 좌표계를 계산해주어야 한다.

즉, ( 투영 공식 = 미러뷰 * 프로젝션 ) 에서 정점위치를 계산한후에 이를 픽셀 세이더에 넘기고

픽셀에서는 투영된 정점 위치를 기준으로 다시 uv 좌표계를 계산한다.

# 정점 쉐이더

// UV 좌표 계산
o.ReflectPos = mul( float4( Pos, 1.0f ) , g_mWorld );
o.ReflectPos = mul( o.ReflectPos , g_Transfo ); // g_Transfo는 위에 있는 투영공식임.

# 픽셀 쉐이더

// UV 좌표 계산

float2 ProjectedTexCoords;
ProjectedTexCoords.x = input.ReflectPos.x / input.ReflectPos.w / 2.0f + 0.5f;
ProjectedTexCoords.y = -input.ReflectPos.y / input.ReflectPos.w / 2.0f + 0.5f;

후에 계산된 좌표값으로 샘플링 하면 된다.

참고사항 :

// 펙셀에서 저렇게 하는 이유 ( GPG 에있는 june8036님의 답변 )

x/w, y/w가 x/뷰변환된z y/뷰변환된z 라고 생각하면 될꺼 같네요.
D3DMatrixPerspectiveFovLH 이런 프로젝션 함수를 직접 구현해보시면 더 느낌이 오실거 같은데요.
결국 마지막 w값은 뷰변환되어져 나온 z값과 같이 되지요.
그래서 이 뷰변환된 z값을 x, y에 나누어 주면, 멀리 있는 물체는 화면의 정 중간에서 더 가깝게
만들어지고, 가까운 물체는 화면의 정 중간에서 더 멀게 나오는걸로 알고 있습니다.






http://blog.naver.com/doridori3510/30127128770


+ 수면 아래 장면 만들기

수면 위의 반사장면 만드는것과 동일하게 물을 기준으로 아래 장면을 텍스쳐로 만든후.

물 평면에 투영한다 !

좀더 좋은 효과를 만들기위해서 물과 지형과의 거리에 비례해서 알파값을 계산한다 !

TIP. 수면 아래 지형을 렌더링할때 픽셀 쉐이더 코드

// 수면과 지형의 거리 계산
float d = fWaterHeight - ((input.WorldPos.y) * test_Y );

// 색상공식
float4 r0;
r0.a = mul( test_A, d );
r0.a = saturate( r0.a );
r0.a = sqrt( r0.a );
r0.a = saturate( r0.a );

r0.r = saturate( exp2( -d * test_R ) );
r0.g = saturate( exp2( -d * test_G ) );
r0.b = saturate( exp2( -d * test_B ) );

+ 프레넬 공식에 비례해서 수면 위 장면, 수면 아래 장면을 섞어서 그릴지 계산.

TIP. 물 픽셀 쉐이더 코드에서 프레넬 계산

// 프레넬로 혼합
float fresnelTerm = (float)0;
fresnelTerm = 0.02+0.97f*pow((1-dot(eyeVector, normalVector)),5);
fresnelTerm = fresnelTerm * fresnelForce * DwColor.a; // 프레넬도 알파 적용
fresnelTerm = saturate( fresnelTerm );

// 프레넬로 반사,굴절 색상 결정
float4 mixColor = ( UpColor * fresnelTerm ) + ( DwColor * (1-fresnelTerm) );

+ 범프 텍스쳐를 기준으로, 수면 위, 아래 장면의 UV를 흔든다.

TIP. 물 픽셀 쉐이더 코드에서 범프 UV계산

// 범프 계산
float4 bumpColor1 = tex2D( bump_sampler, input.BumpPos1 );
float4 bumpColor2 = tex2D( bump_sampler, input.BumpPos2 );
float4 bumpColor = (bumpColor1 * fBumpRate ) + ( bumpColor2 * (1-fBumpRate) );

// 수면 아래
float2 DwBump = fDwBumpForce * (bumpColor.rg - 0.5f);
float4 DwPos = input.DwPos;
DwPos.xy += DwBump;
float4 DwColor = tex2Dproj( Dw_sampler, DwPos );

// 수면위
float2 UpBump = fUpBumpForce * (bumpColor.rg - 0.5f);
float4 UpPos = input.UpPos;
UpPos.xy += UpBump;
float4 UpColor = tex2Dproj( Up_sampler, UpPos );

+ 범프 텍스쳐를 노멀벡터로 생각해서 각각의 조명을 계산한다.

범프 텍스쳐를 기준으로 노멀 벡터를 구하는데, 노멀벡터의 Y값을 세우기 위해서 Z값을 Y값으로 생각해서 채워 넣는다.

이 방법이 통하는것은.

물이 평면이고 접선공간으로 변환해서 하는 결과값 ( bump.rgb * 조명방향[접선공간] ) = (bump.rbg)

이 성립하기 때문이다.

정확하게 말하자면, bump에서 읽어온 노멀값과 접선공간으로 변환된 조명과 연산해야한다.

// 조명의 방향을 접선공간으로 변형.
o.LightDir.x = dot(worldLightDirection, T);
o.LightDir.y = dot(worldLightDirection, B);
o.LightDir.z = dot(worldLightDirection, N);

// ViewVec 역시 접선공간으로 변형.

float3 viewVec = normalize(vWorldCameraPos - worldPos);
o.ViewVec.x = dot(viewVec, T);
o.ViewVec.y = dot(viewVec, B);
o.ViewVec.z = dot(viewVec, N);

ㅇㅇㅁㅅㅄ
TIP. 물 픽셀 쉐이더에서 조명 계산

// 범프에 따른 노멀벡터 구하기
float4 nomalBump = bumpColor * 2.0f - 1.0f; // 텍스쳐 좌표값을 노멀맵으로 변환
float4 bumpNormalVector = float4( nomalBump.r, nomalBump.b, nomalBump.g, nomalBump.a );
float4 normalVector = normalize( bumpNormalVector );

// 조명 계산
float4 Color = CalcAmbient() + CalcDiffuse( normalVector );

// 스펙큘라
float4 half = normalize( -LightDirection + eyeVector );
float4 speccolor = CalcSpecular( normalVector * fNomalPower, half, fSpecPower );

+ 최종적인 물의 칼라값 결정

원래 물 고유의 색상과 혼합한다.

TIP. 물 픽셀 쉐이더의 최종 output 색상

// 물 색상
float4 waterColor = float4(water_R, water_G, water_B, water_A );

float4 outputColor = ( ( (waterColor * rate) + ( mixColor * (1 - rate ) ) ) * Color ) + speccolor;
outputColor.a = DwColor.a; // 물깊이에 따른 알파값 적용

< 최종적인 스샷 >

세부적인 수치같은거 조절해야하는데... 귀찮다 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ

암튼 색상이랑 수치 비율이랑 조절하면 더 예뻐질것임. 성형수술같네;ㅁ;

비행기는 계속해서 움직이고 수면에 실시간으로 반사함 !

< 수치 조절 좀 했더니 >엉? 사진올려놓고 보니 비슷비슷한가?ㅋㅋ 실제로 보면 아닌데 ㅜ.ㅜ

[출처] water shader ! 물효과!|작성자 달혜

반응형

+ Recent posts